Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-zbee-zcl-general.c
blob478a45754ab4191682cdb79d1d277741eb317908
1 /* packet-zbee-zcl-general.c
2 * Dissector routines for the ZigBee ZCL General clusters like
3 * Basic, Identify, OnOff ...
4 * By Fabio Tarabelloni <fabio.tarabelloni@reloc.it>
5 * Copyright 2013 RELOC s.r.l.
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
14 /* Include Files */
15 #include "config.h"
17 #include <epan/packet.h>
18 #include <epan/to_str.h>
19 #include <epan/tfs.h>
20 #include <wsutil/array.h>
21 #include <wsutil/bits_ctz.h>
22 #include <wsutil/epochs.h>
23 #include <wsutil/utf8_entities.h>
25 #include "packet-zbee.h"
26 #include "packet-zbee-aps.h"
27 #include "packet-zbee-zcl.h"
30 /* ########################################################################## */
31 /* #### (0x0000) BASIC CLUSTER ############################################## */
32 /* ########################################################################## */
34 /*************************/
35 /* Defines */
36 /*************************/
38 /* Attributes */
39 #define ZBEE_ZCL_ATTR_ID_BASIC_ZCL_VERSION 0x0000 /* ZCL Version */
40 #define ZBEE_ZCL_ATTR_ID_BASIC_APPL_VERSION 0x0001 /* Application Version */
41 #define ZBEE_ZCL_ATTR_ID_BASIC_STACK_VERSION 0x0002 /* Stack Version */
42 #define ZBEE_ZCL_ATTR_ID_BASIC_HW_VERSION 0x0003 /* HW Version */
43 #define ZBEE_ZCL_ATTR_ID_BASIC_MANUFACTURER_NAME 0x0004 /* Manufacturer Name */
44 #define ZBEE_ZCL_ATTR_ID_BASIC_MODEL_ID 0x0005 /* Model Identifier */
45 #define ZBEE_ZCL_ATTR_ID_BASIC_DATE_CODE 0x0006 /* Date Code */
46 #define ZBEE_ZCL_ATTR_ID_BASIC_POWER_SOURCE 0x0007 /* Power Source */
47 #define ZBEE_ZCL_ATTR_ID_BASIC_LOCATION_DESCR 0x0010 /* Location Description */
48 #define ZBEE_ZCL_ATTR_ID_BASIC_PHY_ENVIRONMENT 0x0011 /* Physical Environment */
49 #define ZBEE_ZCL_ATTR_ID_BASIC_DEVICE_ENABLED 0x0012 /* Device Enabled */
50 #define ZBEE_ZCL_ATTR_ID_BASIC_ALARM_MASK 0x0013 /* Alarm Mask */
51 #define ZBEE_ZCL_ATTR_ID_BASIC_DISABLE_LOCAL_CFG 0x0014 /* Disable Local Config */
52 #define ZBEE_ZCL_ATTR_ID_BASIC_SW_BUILD_ID 0x4000 /* SW Build Id */
54 /* Server Commands Received */
55 #define ZBEE_ZCL_CMD_ID_BASIC_RESET_FACTORY_DEFAULTS 0x00 /* Reset to Factory Defaults */
57 /* Server Commands Generated - None */
59 /* Power Source Id */
60 #define ZBEE_ZCL_BASIC_PWR_SRC_UNKNOWN 0x00 /* Unknown */
61 #define ZBEE_ZCL_BASIC_PWR_SRC_MAINS_1PH 0x01 /* Mains (single phase) */
62 #define ZBEE_ZCL_BASIC_PWR_SRC_MAINS_3PH 0x02 /* Mains (3 phase) */
63 #define ZBEE_ZCL_BASIC_PWR_SRC_BATTERY 0x03 /* Battery */
64 #define ZBEE_ZCL_BASIC_PWR_SRC_DC_SRC 0x04 /* DC source */
65 #define ZBEE_ZCL_BASIC_PWR_SRC_EMERGENCY_1 0x05 /* Emergency mains constantly powered */
66 #define ZBEE_ZCL_BASIC_PWR_SRC_EMERGENCY_2 0x06 /* Emergency mains and transfer switch */
68 /* Device Enable Values */
69 #define ZBEE_ZCL_BASIC_DISABLED 0x00 /* Disabled */
70 #define ZBEE_ZCL_BASIC_ENABLED 0x01 /* Enabled */
72 /* Alarm Mask bit-mask */
73 #define ZBEE_ZCL_BASIC_ALARM_GEN_HW_FAULT 0x01 /* General hardware fault */
74 #define ZBEE_ZCL_BASIC_ALARM_GEN_SW_FAULT 0x02 /* General software fault */
75 #define ZBEE_ZCL_BASIC_ALARM_RESERVED 0xfc /* Reserved */
77 /* Disable Local Config bit-mask */
78 #define ZBEE_ZCL_BASIC_DIS_LOC_CFG_RESET 0x01 /* Reset (to factory defaults) */
79 #define ZBEE_ZCL_BASIC_DIS_LOC_CFG_DEV_CFG 0x02 /* Device configuration */
80 #define ZBEE_ZCL_BASIC_DIS_LOC_CFG_RESERVED 0xfc /* Reserved */
82 /*************************/
83 /* Function Declarations */
84 /*************************/
86 void proto_register_zbee_zcl_basic(void);
87 void proto_reg_handoff_zbee_zcl_basic(void);
89 /* Command Dissector Helpers */
90 static void dissect_zcl_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
92 /* Private functions prototype */
94 /*************************/
95 /* Global Variables */
96 /*************************/
97 /* Initialize the protocol and registered fields */
98 static int proto_zbee_zcl_basic;
100 static int hf_zbee_zcl_basic_attr_id;
101 static int hf_zbee_zcl_basic_pwr_src;
102 static int hf_zbee_zcl_basic_dev_en;
103 static int hf_zbee_zcl_basic_alarm_mask;
104 static int hf_zbee_zcl_basic_alarm_mask_gen_hw_fault;
105 static int hf_zbee_zcl_basic_alarm_mask_gen_sw_fault;
106 static int hf_zbee_zcl_basic_alarm_mask_reserved;
107 static int hf_zbee_zcl_basic_disable_local_cfg;
108 static int hf_zbee_zcl_basic_disable_local_cfg_reset;
109 static int hf_zbee_zcl_basic_disable_local_cfg_device_cfg;
110 static int hf_zbee_zcl_basic_disable_local_cfg_reserved;
111 static int hf_zbee_zcl_basic_srv_rx_cmd_id;
113 /* Initialize the subtree pointers */
114 static int ett_zbee_zcl_basic;
115 static int ett_zbee_zcl_basic_alarm_mask;
116 static int ett_zbee_zcl_basic_dis_local_cfg;
118 /* Attributes */
119 static const value_string zbee_zcl_basic_attr_names[] = {
120 { ZBEE_ZCL_ATTR_ID_BASIC_ZCL_VERSION, "ZCL Version" },
121 { ZBEE_ZCL_ATTR_ID_BASIC_APPL_VERSION, "Application Version" },
122 { ZBEE_ZCL_ATTR_ID_BASIC_STACK_VERSION, "Stack Version" },
123 { ZBEE_ZCL_ATTR_ID_BASIC_HW_VERSION, "HW Version" },
124 { ZBEE_ZCL_ATTR_ID_BASIC_MANUFACTURER_NAME, "Manufacturer Name" },
125 { ZBEE_ZCL_ATTR_ID_BASIC_MODEL_ID, "Model Identifier" },
126 { ZBEE_ZCL_ATTR_ID_BASIC_DATE_CODE, "Date Code" },
127 { ZBEE_ZCL_ATTR_ID_BASIC_POWER_SOURCE, "Power Source" },
128 { ZBEE_ZCL_ATTR_ID_BASIC_LOCATION_DESCR, "Location Description" },
129 { ZBEE_ZCL_ATTR_ID_BASIC_PHY_ENVIRONMENT, "Physical Environment" },
130 { ZBEE_ZCL_ATTR_ID_BASIC_DEVICE_ENABLED, "Device Enabled" },
131 { ZBEE_ZCL_ATTR_ID_BASIC_ALARM_MASK, "Alarm Mask" },
132 { ZBEE_ZCL_ATTR_ID_BASIC_DISABLE_LOCAL_CFG, "Disable Local Config" },
133 { ZBEE_ZCL_ATTR_ID_BASIC_SW_BUILD_ID, "Software Build Id" },
134 { 0, NULL }
137 /* Server Commands Received */
138 static const value_string zbee_zcl_basic_srv_rx_cmd_names[] = {
139 { ZBEE_ZCL_CMD_ID_BASIC_RESET_FACTORY_DEFAULTS, "Reset to Factory Defaults" },
140 { 0, NULL }
143 /* Power Source Names */
144 static const value_string zbee_zcl_basic_pwr_src_names[] = {
145 { ZBEE_ZCL_BASIC_PWR_SRC_UNKNOWN, "Unknown" },
146 { ZBEE_ZCL_BASIC_PWR_SRC_MAINS_1PH, "Mains (single phase)" },
147 { ZBEE_ZCL_BASIC_PWR_SRC_MAINS_3PH, "Mains (3 phase)" },
148 { ZBEE_ZCL_BASIC_PWR_SRC_BATTERY, "Battery" },
149 { ZBEE_ZCL_BASIC_PWR_SRC_DC_SRC, "DC source" },
150 { ZBEE_ZCL_BASIC_PWR_SRC_EMERGENCY_1, "Emergency mains constantly powered" },
151 { ZBEE_ZCL_BASIC_PWR_SRC_EMERGENCY_2, "Emergency mains and transfer switch" },
152 { 0, NULL }
155 /* Device Enable Names */
156 static const value_string zbee_zcl_basic_dev_en_names[] = {
157 { ZBEE_ZCL_BASIC_DISABLED, "Disabled" },
158 { ZBEE_ZCL_BASIC_ENABLED, "Enabled" },
159 { 0, NULL }
162 /*************************/
163 /* Function Bodies */
164 /*************************/
166 /*FUNCTION:------------------------------------------------------
167 * NAME
168 * dissect_zbee_zcl_basic
169 * DESCRIPTION
170 * ZigBee ZCL Basic cluster dissector for wireshark.
171 * PARAMETERS
172 * tvbuff_t *tvb - pointer to buffer containing raw packet.
173 * packet_info *pinfo - pointer to packet information fields
174 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
175 * void *data - pointer to ZCL packet structure.
176 * RETURNS
177 * int - length of parsed data.
178 *---------------------------------------------------------------
180 static int
181 dissect_zbee_zcl_basic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
183 zbee_zcl_packet *zcl;
184 unsigned offset = 0;
185 uint8_t cmd_id;
187 /* Reject the packet if data is NULL */
188 if (data == NULL)
189 return 0;
190 zcl = (zbee_zcl_packet *)data;
191 cmd_id = zcl->cmd_id;
193 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
194 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
195 /* Append the command name to the info column. */
196 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
197 val_to_str_const(cmd_id, zbee_zcl_basic_srv_rx_cmd_names, "Unknown Command"),
198 zcl->tran_seqno);
200 if (tree) {
201 /* Add the command ID. */
202 proto_tree_add_item(tree, hf_zbee_zcl_basic_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
204 /*offset++;*/
206 /* Call the appropriate command dissector */
207 switch (cmd_id) {
209 case ZBEE_ZCL_CMD_ID_BASIC_RESET_FACTORY_DEFAULTS:
210 /* No payload */
211 break;
213 default:
214 break;
218 return tvb_captured_length(tvb);
219 } /*dissect_zbee_zcl_basic*/
222 /*FUNCTION:------------------------------------------------------
223 * NAME
224 * dissect_zcl_basic_attr_data
225 * DESCRIPTION
226 * this function is called by ZCL foundation dissector in order to decode
227 * specific cluster attributes data.
228 * PARAMETERS
229 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
230 * tvbuff_t *tvb - pointer to buffer containing raw packet.
231 * unsigned *offset - pointer to buffer offset
232 * uint16_t attr_id - attribute identifier
233 * unsigned data_type - attribute data type
234 * bool client_attr- ZCL client
235 * RETURNS
236 * none
237 *---------------------------------------------------------------
239 void
240 dissect_zcl_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
243 static int * const alarm_mask[] = {
244 &hf_zbee_zcl_basic_alarm_mask_gen_hw_fault,
245 &hf_zbee_zcl_basic_alarm_mask_gen_sw_fault,
246 &hf_zbee_zcl_basic_alarm_mask_reserved,
247 NULL
250 static int * const local_cfg[] = {
251 &hf_zbee_zcl_basic_disable_local_cfg_reset,
252 &hf_zbee_zcl_basic_disable_local_cfg_device_cfg,
253 &hf_zbee_zcl_basic_disable_local_cfg_reserved,
254 NULL
257 /* Dissect attribute data type and data */
258 switch (attr_id) {
260 case ZBEE_ZCL_ATTR_ID_BASIC_POWER_SOURCE:
261 proto_tree_add_item(tree, hf_zbee_zcl_basic_pwr_src, tvb, *offset, 1, ENC_NA);
262 *offset += 1;
263 break;
265 case ZBEE_ZCL_ATTR_ID_BASIC_DEVICE_ENABLED:
266 proto_tree_add_item(tree, hf_zbee_zcl_basic_dev_en, tvb, *offset, 1, ENC_NA);
267 *offset += 1;
268 break;
270 case ZBEE_ZCL_ATTR_ID_BASIC_ALARM_MASK:
271 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_basic_alarm_mask , ett_zbee_zcl_basic_alarm_mask, alarm_mask, ENC_NA);
272 *offset += 1;
273 break;
275 case ZBEE_ZCL_ATTR_ID_BASIC_DISABLE_LOCAL_CFG:
276 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_basic_disable_local_cfg , ett_zbee_zcl_basic_dis_local_cfg, local_cfg, ENC_NA);
277 *offset += 1;
278 break;
280 case ZBEE_ZCL_ATTR_ID_BASIC_ZCL_VERSION:
281 case ZBEE_ZCL_ATTR_ID_BASIC_APPL_VERSION:
282 case ZBEE_ZCL_ATTR_ID_BASIC_STACK_VERSION:
283 case ZBEE_ZCL_ATTR_ID_BASIC_HW_VERSION:
284 case ZBEE_ZCL_ATTR_ID_BASIC_MANUFACTURER_NAME:
285 case ZBEE_ZCL_ATTR_ID_BASIC_MODEL_ID:
286 case ZBEE_ZCL_ATTR_ID_BASIC_DATE_CODE:
287 case ZBEE_ZCL_ATTR_ID_BASIC_PHY_ENVIRONMENT:
288 case ZBEE_ZCL_ATTR_ID_BASIC_LOCATION_DESCR:
289 case ZBEE_ZCL_ATTR_ID_BASIC_SW_BUILD_ID:
290 default:
291 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
292 break;
295 } /*dissect_zcl_basic_attr_data*/
298 /*FUNCTION:------------------------------------------------------
299 * NAME
300 * proto_register_zbee_zcl_basic
301 * DESCRIPTION
302 * ZigBee ZCL Basic cluster protocol registration routine.
303 * PARAMETERS
304 * none
305 * RETURNS
306 * void
307 *---------------------------------------------------------------
309 void
310 proto_register_zbee_zcl_basic(void)
312 /* Setup list of header fields */
313 static hf_register_info hf[] = {
315 { &hf_zbee_zcl_basic_attr_id,
316 { "Attribute", "zbee_zcl_general.basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_basic_attr_names),
317 0x00, NULL, HFILL } },
319 { &hf_zbee_zcl_basic_pwr_src,
320 { "Power Source", "zbee_zcl_general.basic.attr.pwr_src", FT_UINT8, BASE_HEX, VALS(zbee_zcl_basic_pwr_src_names),
321 0x00, NULL, HFILL } },
323 { &hf_zbee_zcl_basic_dev_en,
324 { "Device Enabled", "zbee_zcl_general.basic.attr.dev_en", FT_UINT8, BASE_HEX, VALS(zbee_zcl_basic_dev_en_names),
325 0x00, NULL, HFILL } },
327 /* start Alarm Mask fields */
328 { &hf_zbee_zcl_basic_alarm_mask,
329 { "Alarm Mask", "zbee_zcl_general.basic.attr.alarm_mask", FT_UINT8, BASE_HEX, NULL,
330 0x0, NULL, HFILL } },
332 { &hf_zbee_zcl_basic_alarm_mask_gen_hw_fault,
333 { "General hardware fault", "zbee_zcl_general.basic.attr.alarm_mask.gen_hw_fault", FT_UINT8, BASE_DEC, NULL,
334 ZBEE_ZCL_BASIC_ALARM_GEN_HW_FAULT, NULL, HFILL } },
336 { &hf_zbee_zcl_basic_alarm_mask_gen_sw_fault,
337 { "General software fault", "zbee_zcl_general.basic.attr.alarm_mask.gen_sw_fault", FT_UINT8, BASE_DEC, NULL,
338 ZBEE_ZCL_BASIC_ALARM_GEN_SW_FAULT, NULL, HFILL } },
340 { &hf_zbee_zcl_basic_alarm_mask_reserved,
341 { "Reserved", "zbee_zcl_general.basic.attr.alarm_mask.reserved", FT_UINT8, BASE_DEC, NULL,
342 ZBEE_ZCL_BASIC_ALARM_RESERVED, NULL, HFILL } },
343 /* end Alarm Mask fields */
345 /* start Disable Local Config fields */
346 { &hf_zbee_zcl_basic_disable_local_cfg,
347 { "Disable Local Config", "zbee_zcl_general.basic.attr.dis_loc_cfg", FT_UINT8, BASE_HEX, NULL,
348 0x0, NULL, HFILL } },
350 { &hf_zbee_zcl_basic_disable_local_cfg_reset,
351 { "Reset (to factory defaults)", "zbee_zcl_general.basic.attr.dis_loc_cfg.reset", FT_UINT8, BASE_DEC, NULL,
352 ZBEE_ZCL_BASIC_DIS_LOC_CFG_RESET , NULL, HFILL } },
354 { &hf_zbee_zcl_basic_disable_local_cfg_device_cfg,
355 { "Device configuration", "zbee_zcl_general.basic.attr.dis_loc_cfg.dev_cfg", FT_UINT8, BASE_DEC, NULL,
356 ZBEE_ZCL_BASIC_DIS_LOC_CFG_DEV_CFG , NULL, HFILL } },
358 { &hf_zbee_zcl_basic_disable_local_cfg_reserved,
359 { "Reserved", "zbee_zcl_general.basic.attr.dis_loc_cfg.reserved", FT_UINT8, BASE_DEC, NULL,
360 ZBEE_ZCL_BASIC_DIS_LOC_CFG_RESERVED , NULL, HFILL } },
361 /* end Disable Local Config fields */
363 { &hf_zbee_zcl_basic_srv_rx_cmd_id,
364 { "Command", "zbee_zcl_general.basic.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_basic_srv_rx_cmd_names),
365 0x00, NULL, HFILL } }
369 /* ZCL Basic subtrees */
370 static int *ett[] = {
371 &ett_zbee_zcl_basic,
372 &ett_zbee_zcl_basic_alarm_mask,
373 &ett_zbee_zcl_basic_dis_local_cfg
376 /* Register the ZigBee ZCL Basic cluster protocol name and description */
377 proto_zbee_zcl_basic = proto_register_protocol("ZigBee ZCL Basic", "ZCL Basic", ZBEE_PROTOABBREV_ZCL_BASIC);
378 proto_register_field_array(proto_zbee_zcl_basic, hf, array_length(hf));
379 proto_register_subtree_array(ett, array_length(ett));
381 /* Register the ZigBee ZCL Basic dissector. */
382 register_dissector(ZBEE_PROTOABBREV_ZCL_BASIC, dissect_zbee_zcl_basic, proto_zbee_zcl_basic);
383 } /*proto_register_zbee_zcl_basic*/
385 /*FUNCTION:------------------------------------------------------
386 * NAME
387 * proto_reg_handoff_zbee_zcl_basic
388 * DESCRIPTION
389 * Hands off the ZCL Basic dissector.
390 * PARAMETERS
391 * none
392 * RETURNS
393 * none
394 *---------------------------------------------------------------
396 void
397 proto_reg_handoff_zbee_zcl_basic(void)
399 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_BASIC,
400 proto_zbee_zcl_basic,
401 ett_zbee_zcl_basic,
402 ZBEE_ZCL_CID_BASIC,
403 ZBEE_MFG_CODE_NONE,
404 hf_zbee_zcl_basic_attr_id,
405 hf_zbee_zcl_basic_attr_id,
406 hf_zbee_zcl_basic_srv_rx_cmd_id,
408 (zbee_zcl_fn_attr_data)dissect_zcl_basic_attr_data
410 } /*proto_reg_handoff_zbee_zcl_basic*/
414 /* ########################################################################## */
415 /* #### (0x0001) POWER CONFIGURATION CLUSTER ################################ */
416 /* ########################################################################## */
418 /*************************/
419 /* Defines */
420 /*************************/
422 /* Attributes */
423 #define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE 0x0000 /* Mains voltage */
424 #define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_FREQUENCY 0x0001 /* Mains frequency */
425 #define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_ALARM_MASK 0x0010 /* Mains Alarm Mask */
426 #define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MIN_THR 0x0011 /* Mains Voltage Min Threshold */
427 #define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MAX_THR 0x0012 /* Mains Voltage Max Threshold */
428 #define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_DWELL_TP 0x0013 /* Mains Voltage Dwell Trip Point */
429 #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE 0x0020 /* Battery Voltage */
430 #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_PERCENTAGE 0x0021 /* Battery Percentage Remaining */
431 #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_MANUFACTURER 0x0030 /* Battery Manufacturer */
432 #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_SIZE 0x0031 /* Battery Size */
433 #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_AH_RATING 0x0032 /* Battery AHr Rating */
434 #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_QUANTITY 0x0033 /* Battery Quantity */
435 #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_RATED_VOLTAGE 0x0034 /* Battery Rated Voltage */
436 #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_ALARM_MASK 0x0035 /* Battery Alarm Mask */
437 #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE_MIN_THR 0x0036 /* Battery Voltage Min Threshold */
439 /* Server Commands Received - None */
441 /* Server Commands Generated - None */
443 /* Mains Alarm Mask bit-mask */
444 #define ZBEE_ZCL_POWER_CONF_MAINS_ALARM_LOW 0x01 /* Mains voltage too low */
445 #define ZBEE_ZCL_POWER_CONF_MAINS_ALARM_HIGH 0x02 /* Mains voltage too high */
446 #define ZBEE_ZCL_POWER_CONF_MAINS_ALARM_RESERVED 0xfc /* Reserved */
448 /* Battery Size values */
449 #define ZBEE_ZCL_POWER_CONF_BAT_TYPE_NO_BAT 0x00 /* No battery */
450 #define ZBEE_ZCL_POWER_CONF_BAT_TYPE_BUILT_IN 0x01 /* Built in */
451 #define ZBEE_ZCL_POWER_CONF_BAT_TYPE_OTHER 0x02 /* Other */
452 #define ZBEE_ZCL_POWER_CONF_BAT_TYPE_AA 0x03 /* AA */
453 #define ZBEE_ZCL_POWER_CONF_BAT_TYPE_AAA 0x04 /* AAA */
454 #define ZBEE_ZCL_POWER_CONF_BAT_TYPE_C 0x05 /* C */
455 #define ZBEE_ZCL_POWER_CONF_BAT_TYPE_D 0x06 /* D */
456 #define ZBEE_ZCL_POWER_CONF_BAT_TYPE_UNKNOWN 0xFF /* Unknown */
458 /* Battery alarm mask bit-mask */
459 #define ZBEE_ZCL_POWER_CONF_BATTERY_ALARM_LOW 0x01 /* Battery voltage too low */
460 #define ZBEE_ZCL_POWER_CONF_BATTERY_ALARM_RESERVED 0xfe /* Reserved */
462 /*************************/
463 /* Function Declarations */
464 /*************************/
466 void proto_register_zbee_zcl_power_config(void);
467 void proto_reg_handoff_zbee_zcl_power_config(void);
469 /* Command Dissector Helpers */
470 static void dissect_zcl_power_config_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
472 /* Private functions prototype */
474 /*************************/
475 /* Global Variables */
476 /*************************/
477 /* Initialize the protocol and registered fields */
478 static int proto_zbee_zcl_power_config;
479 static int hf_zbee_zcl_power_config_attr_id;
480 static int hf_zbee_zcl_power_config_batt_type;
481 static int hf_zbee_zcl_power_config_mains_alarm_mask;
482 static int hf_zbee_zcl_power_config_mains_alarm_mask_low;
483 static int hf_zbee_zcl_power_config_mains_alarm_mask_high;
484 static int hf_zbee_zcl_power_config_mains_alarm_mask_reserved;
485 static int hf_zbee_zcl_power_config_batt_alarm_mask;
486 static int hf_zbee_zcl_power_config_batt_alarm_mask_low;
487 static int hf_zbee_zcl_power_config_batt_alarm_mask_reserved;
488 static int hf_zbee_zcl_power_config_mains_voltage;
489 static int hf_zbee_zcl_power_config_mains_frequency;
490 static int hf_zbee_zcl_power_config_mains_voltage_min_thr;
491 static int hf_zbee_zcl_power_config_mains_voltage_max_thr;
492 static int hf_zbee_zcl_power_config_mains_voltage_dwell_tp;
493 static int hf_zbee_zcl_power_config_batt_voltage;
494 static int hf_zbee_zcl_power_config_batt_percentage;
495 static int hf_zbee_zcl_power_config_batt_ah_rating;
496 static int hf_zbee_zcl_power_config_batt_rated_voltage;
497 static int hf_zbee_zcl_power_config_batt_voltage_min_thr;
498 /* Initialize the subtree pointers */
499 static int ett_zbee_zcl_power_config;
500 static int ett_zbee_zcl_power_config_mains_alarm_mask;
501 static int ett_zbee_zcl_power_config_batt_alarm_mask;
503 /* Attributes */
504 static const value_string zbee_zcl_power_config_attr_names[] = {
505 { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE, "Mains Voltage" },
506 { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_FREQUENCY, "Mains Frequency" },
507 { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_ALARM_MASK, "Mains Alarm Mask" },
508 { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MIN_THR, "Mains Voltage Min Threshold" },
509 { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MAX_THR, "Mains Voltage Max Threshold" },
510 { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_DWELL_TP, "Mains Voltage Dwell Trip Point" },
511 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE, "Battery Voltage" },
512 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_PERCENTAGE, "Battery Percentage Remaining" },
513 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_MANUFACTURER, "Battery Manufacturer" },
514 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_SIZE, "Battery Size" },
515 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_AH_RATING, "Battery AHr Rating" },
516 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_QUANTITY, "Battery Quantity" },
517 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_RATED_VOLTAGE, "Battery Rated Voltage" },
518 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_ALARM_MASK, "Battery Alarm Mask" },
519 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE_MIN_THR, "Battery Voltage Minimum Threshold" },
520 { 0, NULL }
524 /* Battery size Names */
525 static const value_string zbee_zcl_power_config_batt_type_names[] = {
526 { ZBEE_ZCL_POWER_CONF_BAT_TYPE_NO_BAT, "No battery" },
527 { ZBEE_ZCL_POWER_CONF_BAT_TYPE_BUILT_IN, "Built in" },
528 { ZBEE_ZCL_POWER_CONF_BAT_TYPE_OTHER, "Other" },
529 { ZBEE_ZCL_POWER_CONF_BAT_TYPE_AA, "AA" },
530 { ZBEE_ZCL_POWER_CONF_BAT_TYPE_AAA, "AAA" },
531 { ZBEE_ZCL_POWER_CONF_BAT_TYPE_C, "C" },
532 { ZBEE_ZCL_POWER_CONF_BAT_TYPE_D, "D" },
533 { ZBEE_ZCL_POWER_CONF_BAT_TYPE_UNKNOWN, "Unknown" },
534 { 0, NULL }
538 /*************************/
539 /* Function Bodies */
540 /*************************/
542 /*FUNCTION:------------------------------------------------------
543 * NAME
544 * dissect_zbee_zcl_power_config
545 * DESCRIPTION
546 * ZigBee ZCL power configuration cluster dissector for wireshark.
547 * PARAMETERS
548 * tvbuff_t *tvb - pointer to buffer containing raw packet.
549 * packet_info *pinfo - pointer to packet information fields
550 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
551 * RETURNS
552 * none
553 *---------------------------------------------------------------
555 static int
556 dissect_zbee_zcl_power_config(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_)
558 return tvb_captured_length(tvb);
559 } /*dissect_zbee_zcl_power_config*/
561 /*FUNCTION:------------------------------------------------------
562 * NAME
563 * decode_power_conf_voltage
564 * DESCRIPTION
565 * this function decodes voltage values
566 * PARAMETERS
567 * unsigned *s - string to display
568 * uint32_t value - value to decode
569 * RETURNS
570 * none
571 *---------------------------------------------------------------
573 static void
574 decode_power_conf_voltage(char *s, uint32_t value)
576 snprintf(s, ITEM_LABEL_LENGTH, "%d.%d [V]", value/10, value%10);
577 return;
578 } /*decode_power_conf_voltage*/
580 /*FUNCTION:------------------------------------------------------
581 * NAME
582 * decode_power_conf_percentage
583 * DESCRIPTION
584 * this function decodes percentage values
585 * PARAMETERS
586 * unsigned *s - string to display
587 * uint32_t value - value to decode
588 * RETURNS
589 * none
590 *---------------------------------------------------------------
592 static void
593 decode_power_conf_percentage(char *s, uint32_t value)
595 snprintf(s, ITEM_LABEL_LENGTH, "%.1f [%%]", value/2.0);
596 return;
597 } /*decode_power_conf_percentage*/
599 /*FUNCTION:------------------------------------------------------
600 * NAME
601 * decode_power_conf_frequency
602 * DESCRIPTION
603 * this function decodes mains frequency values
604 * PARAMETERS
605 * unsigned *s - string to display
606 * uint32_t value - value to decode
607 * RETURNS
608 * none
609 *---------------------------------------------------------------
611 static void
612 decode_power_conf_frequency(char *s, uint32_t value)
614 if(value == 0x00)
615 snprintf(s, ITEM_LABEL_LENGTH, "Frequency too low to be measured (or DC supply)");
616 else if(value == 0xfe)
617 snprintf(s, ITEM_LABEL_LENGTH, "Frequency too high to be measured");
618 else if (value == 0xff)
619 snprintf(s, ITEM_LABEL_LENGTH, "Frequency could not be measured");
620 else
621 snprintf(s, ITEM_LABEL_LENGTH, "%d [Hz]", value*2);
622 return;
623 } /*decode_power_conf_frequency*/
625 /*FUNCTION:------------------------------------------------------
626 * NAME
627 * decode_power_conf_batt_AHr
628 * DESCRIPTION
629 * this function decodes battery capacity values
630 * PARAMETERS
631 * unsigned *s - string to display
632 * uint32_t value - value to decode
633 * RETURNS
634 * none
635 *---------------------------------------------------------------
637 static void
638 decode_power_conf_batt_AHr(char *s, uint32_t value)
640 snprintf(s, ITEM_LABEL_LENGTH, "%d [mAHr]", value*10);
641 return;
642 } /*decode_power_conf_batt_AHr*/
644 /*FUNCTION:------------------------------------------------------
645 * NAME
646 * dissect_zcl_power_config_attr_data
647 * DESCRIPTION
648 * this function is called by ZCL foundation dissector in order to decode
649 * specific cluster attributes data.
650 * PARAMETERS
651 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
652 * tvbuff_t *tvb - pointer to buffer containing raw packet.
653 * unsigned *offset - pointer to buffer offset
654 * uint16_t attr_id - attribute identifier
655 * unsigned data_type - attribute data type
656 * bool client_attr- ZCL client
657 * RETURNS
658 * none
659 *---------------------------------------------------------------
661 void
662 dissect_zcl_power_config_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
664 proto_item *it;
665 static int * const mains_alarm_mask[] = {
666 &hf_zbee_zcl_power_config_mains_alarm_mask_low,
667 &hf_zbee_zcl_power_config_mains_alarm_mask_high,
668 &hf_zbee_zcl_power_config_mains_alarm_mask_reserved,
669 NULL
672 static int * const batt_alarm_mask[] = {
673 &hf_zbee_zcl_power_config_batt_alarm_mask_low,
674 &hf_zbee_zcl_power_config_batt_alarm_mask_reserved,
675 NULL
678 /* Dissect attribute data type and data */
679 switch (attr_id) {
680 case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE:
681 proto_tree_add_item(tree, hf_zbee_zcl_power_config_mains_voltage, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
682 *offset += 2;
683 break;
684 case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_FREQUENCY:
685 proto_tree_add_item(tree, hf_zbee_zcl_power_config_mains_frequency, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
686 *offset += 1;
687 break;
688 case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_ALARM_MASK:
689 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_power_config_mains_alarm_mask, ett_zbee_zcl_power_config_mains_alarm_mask, mains_alarm_mask, ENC_LITTLE_ENDIAN);
690 *offset += 1;
691 break;
692 case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MIN_THR:
693 proto_tree_add_item(tree, hf_zbee_zcl_power_config_mains_voltage_min_thr, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
694 *offset += 2;
695 break;
696 case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MAX_THR:
697 proto_tree_add_item(tree, hf_zbee_zcl_power_config_mains_voltage_max_thr, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
698 *offset += 2;
699 break;
700 case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_DWELL_TP:
701 it = proto_tree_add_item(tree, hf_zbee_zcl_power_config_mains_voltage_dwell_tp, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
702 proto_item_append_text(it, " [s]");
703 *offset += 2;
704 break;
705 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_SIZE:
706 proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
707 *offset += 1;
708 break;
709 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE:
710 proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_voltage, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
711 *offset += 1;
712 break;
713 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_PERCENTAGE:
714 proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_percentage, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
715 *offset += 1;
716 break;
717 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_AH_RATING:
718 proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_ah_rating, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
719 *offset += 2;
720 break;
721 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_RATED_VOLTAGE:
722 proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_rated_voltage, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
723 *offset += 1;
724 break;
725 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_ALARM_MASK:
726 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_power_config_batt_alarm_mask, ett_zbee_zcl_power_config_batt_alarm_mask, batt_alarm_mask, ENC_LITTLE_ENDIAN);
727 *offset += 1;
728 break;
729 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE_MIN_THR:
730 proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_voltage_min_thr, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
731 *offset += 1;
732 break;
734 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_MANUFACTURER:
735 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_QUANTITY:
736 default:
737 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
738 break;
741 } /*dissect_zcl_power_config_attr_data*/
744 /*FUNCTION:------------------------------------------------------
745 * NAME
746 * proto_register_zbee_zcl_power_config
747 * DESCRIPTION
748 * ZigBee ZCL power configuration cluster protocol registration routine.
749 * PARAMETERS
750 * none
751 * RETURNS
752 * void
753 *---------------------------------------------------------------
755 void
756 proto_register_zbee_zcl_power_config(void)
758 /* Setup list of header fields */
759 static hf_register_info hf[] = {
761 { &hf_zbee_zcl_power_config_attr_id,
762 { "Attribute", "zbee_zcl_general.power_config.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_power_config_attr_names),
763 0x00, NULL, HFILL } },
765 { &hf_zbee_zcl_power_config_batt_type,
766 { "Battery Type", "zbee_zcl_general.power_config.attr.batt_type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_power_config_batt_type_names),
767 0x00, NULL, HFILL } },
769 /* start mains Alarm Mask fields */
770 { &hf_zbee_zcl_power_config_mains_alarm_mask,
771 { "Mains Alarm Mask", "zbee_zcl_general.power_config.attr.mains_alarm_mask", FT_UINT8, BASE_HEX, NULL,
772 0x0, NULL, HFILL } },
774 { &hf_zbee_zcl_power_config_mains_alarm_mask_low,
775 { "Mains Voltage too low", "zbee_zcl_general.power_config.attr.mains_alarm_mask.mains_too_low", FT_UINT8, BASE_DEC, NULL,
776 ZBEE_ZCL_POWER_CONF_MAINS_ALARM_LOW, NULL, HFILL } },
778 { &hf_zbee_zcl_power_config_mains_alarm_mask_high,
779 { "Mains Voltage too high", "zbee_zcl_general.power_config.attr.mains_alarm_mask.mains_too_high", FT_UINT8, BASE_DEC, NULL,
780 ZBEE_ZCL_POWER_CONF_MAINS_ALARM_HIGH, NULL, HFILL } },
782 { &hf_zbee_zcl_power_config_mains_alarm_mask_reserved,
783 { "Reserved", "zbee_zcl_general.power_config.attr.mains_alarm_mask.reserved", FT_UINT8, BASE_DEC, NULL,
784 ZBEE_ZCL_POWER_CONF_MAINS_ALARM_RESERVED, NULL, HFILL } },
785 /* end mains Alarm Mask fields */
787 /* start battery Alarm Mask fields */
788 { &hf_zbee_zcl_power_config_batt_alarm_mask,
789 { "Battery Alarm Mask", "zbee_zcl_general.power_config.attr.batt_alarm_mask", FT_UINT8, BASE_HEX, NULL,
790 0x0, NULL, HFILL } },
792 { &hf_zbee_zcl_power_config_batt_alarm_mask_low,
793 { "Battery Voltage too low", "zbee_zcl_general.power_config.batt_attr.alarm_mask.batt_too_low", FT_UINT8, BASE_DEC, NULL,
794 ZBEE_ZCL_POWER_CONF_BATTERY_ALARM_LOW, NULL, HFILL } },
796 { &hf_zbee_zcl_power_config_batt_alarm_mask_reserved,
797 { "Reserved", "zbee_zcl_general.power_config.attr.batt_alarm_mask.reserved", FT_UINT8, BASE_DEC, NULL,
798 ZBEE_ZCL_POWER_CONF_BATTERY_ALARM_RESERVED, NULL, HFILL } },
799 /* end battery Alarm Mask fields */
801 { &hf_zbee_zcl_power_config_mains_voltage,
802 { "Measured Mains Voltage", "zbee_zcl_general.power_config.attr.mains_voltage", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage),
803 0x00, NULL, HFILL } },
805 { &hf_zbee_zcl_power_config_mains_frequency,
806 { "Measured Mains Frequency", "zbee_zcl_general.power_config.attr.mains_frequency", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_conf_frequency),
807 0x00, NULL, HFILL } },
809 { &hf_zbee_zcl_power_config_mains_voltage_min_thr,
810 { "Mains Voltage Minimum Threshold", "zbee_zcl_general.power_config.attr.mains_volt_min", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage),
811 0x00, NULL, HFILL } },
813 { &hf_zbee_zcl_power_config_mains_voltage_max_thr,
814 { "Mains Voltage Maximum Threshold", "zbee_zcl_general.power_config.attr.mains_volt_max", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage),
815 0x00, NULL, HFILL } },
817 { &hf_zbee_zcl_power_config_batt_voltage,
818 { "Measured Battery Voltage", "zbee_zcl_general.power_config.attr.batt_voltage", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage),
819 0x00, NULL, HFILL } },
821 { &hf_zbee_zcl_power_config_batt_percentage,
822 { "Remaining Battery Percentage", "zbee_zcl_general.power_config.attr.batt_percentage", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_conf_percentage),
823 0x00, NULL, HFILL } },
825 { &hf_zbee_zcl_power_config_batt_ah_rating,
826 { "Battery Capacity", "zbee_zcl_general.power_config.attr.batt_AHr", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_power_conf_batt_AHr),
827 0x00, NULL, HFILL } },
829 { &hf_zbee_zcl_power_config_batt_rated_voltage,
830 { "Battery Rated Voltage", "zbee_zcl_general.power_config.attr.batt_rated_voltage", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage),
831 0x00, NULL, HFILL } },
833 { &hf_zbee_zcl_power_config_batt_voltage_min_thr,
834 { "Battery Voltage Minimum Threshold", "zbee_zcl_general.power_config.attr.batt_voltage_min_thr", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage),
835 0x00, NULL, HFILL } },
837 { &hf_zbee_zcl_power_config_mains_voltage_dwell_tp,
838 { "Mains Voltage Dwell Trip Point", "zbee_zcl_general.power_config.attr.mains_dwell_tp", FT_UINT16, BASE_DEC, NULL,
839 0x00, NULL, HFILL } },
842 /* ZCL power configuration subtrees */
843 static int *ett[] = {
844 &ett_zbee_zcl_power_config,
845 &ett_zbee_zcl_power_config_mains_alarm_mask,
846 &ett_zbee_zcl_power_config_batt_alarm_mask
849 /* Register the ZigBee ZCL power configuration cluster protocol name and description */
850 proto_zbee_zcl_power_config = proto_register_protocol("ZigBee ZCL Power Configuration", "ZCL Power Configuration", ZBEE_PROTOABBREV_ZCL_POWER_CONFIG);
851 proto_register_field_array(proto_zbee_zcl_power_config, hf, array_length(hf));
852 proto_register_subtree_array(ett, array_length(ett));
854 /* Register the ZigBee ZCL power configuration dissector. */
855 register_dissector(ZBEE_PROTOABBREV_ZCL_POWER_CONFIG, dissect_zbee_zcl_power_config, proto_zbee_zcl_power_config);
856 } /*proto_register_zbee_zcl_power_config*/
858 /*FUNCTION:------------------------------------------------------
859 * NAME
860 * proto_reg_handoff_zbee_zcl_power_config
861 * DESCRIPTION
862 * Hands off the ZCL power configuration dissector.
863 * PARAMETERS
864 * none
865 * RETURNS
866 * none
867 *---------------------------------------------------------------
869 void
870 proto_reg_handoff_zbee_zcl_power_config(void)
872 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_POWER_CONFIG,
873 proto_zbee_zcl_power_config,
874 ett_zbee_zcl_power_config,
875 ZBEE_ZCL_CID_POWER_CONFIG,
876 ZBEE_MFG_CODE_NONE,
877 hf_zbee_zcl_power_config_attr_id,
878 hf_zbee_zcl_power_config_attr_id,
879 -1, -1,
880 (zbee_zcl_fn_attr_data)dissect_zcl_power_config_attr_data
882 } /*proto_reg_handoff_zbee_zcl_power_config*/
885 /* ########################################################################## */
886 /* #### (0x0002) DEVICE TEMPERATURE CONFIGURATION CLUSTER ################### */
887 /* ########################################################################## */
889 /*************************/
890 /* Defines */
891 /*************************/
893 /*Attributes*/
894 #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_CURRENT_TEMP 0x0000 /*Current Temperature*/
895 #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MIN_TEMP_EXP 0x0001 /*Min Temperature Experienced*/
896 #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MAX_TEMP_EXP 0x0002 /*Max Temperature Experienced*/
897 #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_OVER_TEMP_TOTAL_DWELL 0x0003 /*Over Temperature Total Dwell*/
899 #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK 0x0010 /*Device Temperature Alarm Mask*/
900 #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_THRESHOLD 0x0011 /*Low Temperature Threshold*/
901 #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_THRESHOLD 0x0012 /*High Temperature Threshold*/
902 #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_DWELL_TRIP_POINT 0x0013 /*Low Temperature Dwell Trip Point*/
903 #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_DWELL_TRIP_POINT 0x0014 /*High Temperature Dwell Trip Point*/
905 /*Server commands received - none*/
907 /*Server commands generated - none*/
909 /*Device Temperature Alarm Mask Value*/
910 #define ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_TOO_LOW 0x01 /*Mains Voltage too low*/
911 #define ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_TOO_HIGH 0x02 /*Mains Voltage too high*/
912 #define ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_RESERVED 0xfc /*Mains Voltage reserved*/
914 /*************************/
915 /* Function Declarations */
916 /*************************/
918 void proto_register_zbee_zcl_device_temperature_configuration(void);
919 void proto_reg_handoff_zbee_zcl_device_temperature_configuration(void);
921 /* Command Dissector Helpers */
922 static void dissect_zcl_device_temperature_configuration_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
924 /* Private functions prototype */
926 /*************************/
927 /* Global Variables */
928 /*************************/
929 /* Initialize the protocol and registered fields */
930 static int proto_zbee_zcl_device_temperature_configuration;
932 static int hf_zbee_zcl_device_temperature_configuration_attr_id;
933 static int hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask;
934 static int hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_low;
935 static int hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_high;
936 static int hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_reserved;
938 /* Initialize the subtree pointers */
939 static int ett_zbee_zcl_device_temperature_configuration;
940 static int ett_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask;
942 /* Attributes */
943 static const value_string zbee_zcl_device_temperature_configuration_attr_names[] = {
944 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_CURRENT_TEMP, "Current Temperature" },
945 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MIN_TEMP_EXP, "Min Temperature Experienced" },
946 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MAX_TEMP_EXP, "Max Temperature Experienced" },
947 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_OVER_TEMP_TOTAL_DWELL, "Over Temperature Total Dwell" },
948 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK, "Device Temperature Alarm Mask" },
949 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_THRESHOLD, "Low Temperature Threshold" },
950 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_THRESHOLD, "High Temperature Threshold" },
951 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_DWELL_TRIP_POINT, "Low Temperature Dwell Trip Point" },
952 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_DWELL_TRIP_POINT, "High Temperature Dwell Trip Point" },
953 { 0, NULL }
956 /*************************/
957 /* Function Bodies */
958 /*************************/
960 /*FUNCTION:------------------------------------------------------
961 * NAME
962 * dissect_zbee_zcl_device_temperature_configuration
963 * DESCRIPTION
964 * ZigBee ZCL Device Temperature Configuration cluster dissector for wireshark.
965 * PARAMETERS
966 * tvbuff_t *tvb - pointer to buffer containing raw packet.
967 * packet_info *pinfo - pointer to packet information fields
968 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
969 * RETURNS
970 * int - length of parsed data.
971 *---------------------------------------------------------------
974 static int
975 dissect_zbee_zcl_device_temperature_configuration(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_)
977 return tvb_captured_length(tvb);
978 } /*dissect_zbee_zcl_device_temperature_configuration*/
981 /*FUNCTION:------------------------------------------------------
982 * NAME
983 * dissect_zcl_device_temperature_configuration_attr_data
984 * DESCRIPTION
985 * this function is called by ZCL foundation dissector in order to decode
986 * specific cluster attributes data.
987 * PARAMETERS
988 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
989 * tvbuff_t *tvb - pointer to buffer containing raw packet.
990 * unsigned *offset - pointer to buffer offset
991 * uint16_t attr_id - attribute identifier
992 * unsigned data_type - attribute data type
993 * bool client_attr- ZCL client
994 * RETURNS
995 * none
996 *---------------------------------------------------------------
998 void
999 dissect_zcl_device_temperature_configuration_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
1001 static int * const device_temp_alarm_mask[] = {
1002 &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_low,
1003 &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_high,
1004 &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_reserved,
1005 NULL
1008 /* Dissect attribute data type and data */
1009 switch (attr_id) {
1011 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK:
1012 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask, ett_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask, device_temp_alarm_mask, ENC_LITTLE_ENDIAN);
1013 *offset += 1;
1014 break;
1016 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_CURRENT_TEMP:
1017 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MIN_TEMP_EXP:
1018 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MAX_TEMP_EXP:
1019 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_OVER_TEMP_TOTAL_DWELL:
1020 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_THRESHOLD:
1021 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_THRESHOLD:
1022 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_DWELL_TRIP_POINT:
1023 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_DWELL_TRIP_POINT:
1024 default:
1025 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
1026 break;
1029 } /*dissect_zcl_device_temperature_configuration_attr_data*/
1032 /*FUNCTION:------------------------------------------------------
1033 * NAME
1034 * proto_register_zbee_zcl_device_temperature_configuration
1035 * DESCRIPTION
1036 * ZigBee ZCL Device Temperature Configuration cluster protocol registration routine.
1037 * PARAMETERS
1038 * none
1039 * RETURNS
1040 * none
1041 *---------------------------------------------------------------
1043 void
1044 proto_register_zbee_zcl_device_temperature_configuration(void)
1046 /* Setup list of header fields */
1047 static hf_register_info hf[] = {
1049 { &hf_zbee_zcl_device_temperature_configuration_attr_id,
1050 { "Attribute", "zbee_zcl_general.device_temperature_configuration.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_device_temperature_configuration_attr_names),
1051 0x00, NULL, HFILL } },
1053 /* start Device Temperature Alarm Mask fields */
1054 { &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask,
1055 { "Device Temperature Alarm Mask", "zbee_zcl_general.device_temperature_configuration.attr.device_temp_alarm_mask", FT_UINT8, BASE_HEX, NULL,
1056 0x00, NULL, HFILL } },
1058 { &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_low,
1059 { "Device Temperature too low", "zbee_zcl_general.device_temperature_configuration.attr.device_temp_alarm_mask.too_low", FT_UINT8, BASE_DEC, NULL,
1060 ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_TOO_LOW, NULL, HFILL } },
1062 { &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_high,
1063 { "Device Temperature too high", "zbee_zcl_general.device_temperature_configuration.attr.device_temp_alarm_mask.too_high", FT_UINT8, BASE_DEC, NULL,
1064 ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_TOO_HIGH, NULL, HFILL } },
1066 { &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_reserved,
1067 { "Reserved", "zbee_zcl_general.device_temperature_configuration.attr.device_temp_alarm_mask.reserved", FT_UINT8, BASE_DEC, NULL,
1068 ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_RESERVED, NULL, HFILL } }
1069 /* end Device Temperature Alarm Mask fields */
1072 /* ZCL Device Temperature Configuration subtrees */
1073 static int *ett[] = {
1074 &ett_zbee_zcl_device_temperature_configuration,
1075 &ett_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask
1078 /* Register the ZigBee ZCL Device Temperature Configuration cluster protocol name and description */
1079 proto_zbee_zcl_device_temperature_configuration = proto_register_protocol("ZigBee ZCL Device Temperature Configuration", "ZCL Device Temperature Configuration", ZBEE_PROTOABBREV_ZCL_DEVICE_TEMP_CONFIG);
1080 proto_register_field_array(proto_zbee_zcl_device_temperature_configuration, hf, array_length(hf));
1081 proto_register_subtree_array(ett, array_length(ett));
1083 /* Register the ZigBee ZCL Device Temperature Configuration dissector. */
1084 register_dissector(ZBEE_PROTOABBREV_ZCL_DEVICE_TEMP_CONFIG, dissect_zbee_zcl_device_temperature_configuration, proto_zbee_zcl_device_temperature_configuration);
1085 } /*proto_register_zbee_zcl_device_temperature_configuration*/
1087 /*FUNCTION:------------------------------------------------------
1088 * NAME
1089 * proto_reg_handoff_zbee_zcl_device_temperature_configuration
1090 * DESCRIPTION
1091 * Hands off the ZCL Device Temperature Configuration dissector.
1092 * PARAMETERS
1093 * none
1094 * RETURNS
1095 * none
1096 *---------------------------------------------------------------
1098 void
1099 proto_reg_handoff_zbee_zcl_device_temperature_configuration(void)
1101 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_DEVICE_TEMP_CONFIG,
1102 proto_zbee_zcl_device_temperature_configuration,
1103 ett_zbee_zcl_device_temperature_configuration,
1104 ZBEE_ZCL_CID_DEVICE_TEMP_CONFIG,
1105 ZBEE_MFG_CODE_NONE,
1106 hf_zbee_zcl_device_temperature_configuration_attr_id,
1107 hf_zbee_zcl_device_temperature_configuration_attr_id,
1108 -1, -1,
1109 (zbee_zcl_fn_attr_data)dissect_zcl_device_temperature_configuration_attr_data
1111 } /*proto_reg_handoff_zbee_zcl_device_temperature_configuration*/
1114 /* ########################################################################## */
1115 /* #### (0x0003) IDENTIFY CLUSTER ########################################### */
1116 /* ########################################################################## */
1118 /*************************/
1119 /* Defines */
1120 /*************************/
1122 /* Attributes */
1123 #define ZBEE_ZCL_ATTR_ID_IDENTIFY_IDENTIFY_TIME 0x0000 /* Identify Time */
1125 /* Server Commands Received */
1126 #define ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY 0x00 /* Identify */
1127 #define ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY 0x01 /* Identify Query */
1128 #define ZBEE_ZCL_CMD_ID_IDENTIFY_TRIGGER_EFFECT 0x40 /* Trigger Effect */
1130 /* Server Commands Generated */
1131 #define ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY_RSP 0x00 /* Identify Query Response */
1134 /*************************/
1135 /* Function Declarations */
1136 /*************************/
1138 void proto_register_zbee_zcl_identify(void);
1139 void proto_reg_handoff_zbee_zcl_identify(void);
1141 /* Command Dissector Helpers */
1142 static void dissect_zcl_identify_identify (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1143 static void dissect_zcl_identify_identifyqueryrsp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1144 static void dissect_zcl_identify_triggereffect (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1145 static void dissect_zcl_identify_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
1147 /* Private functions prototype */
1149 /*************************/
1150 /* Global Variables */
1151 /*************************/
1152 /* Initialize the protocol and registered fields */
1153 static int proto_zbee_zcl_identify;
1155 static int hf_zbee_zcl_identify_attr_id;
1156 static int hf_zbee_zcl_identify_identify_time;
1157 static int hf_zbee_zcl_identify_identify_timeout;
1158 static int hf_zbee_zcl_identify_effect_id;
1159 static int hf_zbee_zcl_identify_effect_variant;
1160 static int hf_zbee_zcl_identify_srv_rx_cmd_id;
1161 static int hf_zbee_zcl_identify_srv_tx_cmd_id;
1163 /* Initialize the subtree pointers */
1164 static int ett_zbee_zcl_identify;
1166 /* Attributes */
1167 static const value_string zbee_zcl_identify_attr_names[] = {
1168 { ZBEE_ZCL_ATTR_ID_IDENTIFY_IDENTIFY_TIME, "Identify Time" },
1169 { 0, NULL }
1172 /* Server Commands Received */
1173 static const value_string zbee_zcl_identify_srv_rx_cmd_names[] = {
1174 { ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY, "Identify" },
1175 { ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY, "Identify Query" },
1176 { ZBEE_ZCL_CMD_ID_IDENTIFY_TRIGGER_EFFECT, "Trigger Effect" },
1177 { 0, NULL }
1180 /* Server Commands Generated */
1181 static const value_string zbee_zcl_identify_srv_tx_cmd_names[] = {
1182 { ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY_RSP, "Identify Query Response" },
1183 { 0, NULL }
1186 /* Trigger Effects */
1187 static const value_string zbee_zcl_identify_effect_id_names[] = {
1188 { 0x00, "Blink" },
1189 { 0x01, "Breathe" },
1190 { 0x02, "Okay" },
1191 { 0x0b, "Channel change" },
1192 { 0xfe, "Finish" },
1193 { 0xff, "Stop" },
1194 { 0, NULL }
1197 /*************************/
1198 /* Function Bodies */
1199 /*************************/
1201 /*FUNCTION:------------------------------------------------------
1202 * NAME
1203 * dissect_zbee_zcl_identify
1204 * DESCRIPTION
1205 * ZigBee ZCL Identify cluster dissector for wireshark.
1206 * PARAMETERS
1207 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1208 * packet_info *pinfo - pointer to packet information fields
1209 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1210 * void *data - pointer to ZCL packet structure.
1211 * RETURNS
1212 * int - length of parsed data.
1213 *---------------------------------------------------------------
1215 static int
1216 dissect_zbee_zcl_identify(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1218 proto_tree *payload_tree;
1219 zbee_zcl_packet *zcl;
1220 unsigned offset = 0;
1221 uint8_t cmd_id;
1222 int rem_len;
1224 /* Reject the packet if data is NULL */
1225 if (data == NULL)
1226 return 0;
1227 zcl = (zbee_zcl_packet *)data;
1228 cmd_id = zcl->cmd_id;
1230 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
1231 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
1232 /* Append the command name to the info column. */
1233 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
1234 val_to_str_const(cmd_id, zbee_zcl_identify_srv_rx_cmd_names, "Unknown Command"),
1235 zcl->tran_seqno);
1237 /* Add the command ID. */
1238 proto_tree_add_item(tree, hf_zbee_zcl_identify_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1240 /* Check is this command has a payload, than add the payload tree */
1241 rem_len = tvb_reported_length_remaining(tvb, ++offset);
1242 if (rem_len > 0) {
1243 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_identify, NULL, "Payload");
1245 /* Call the appropriate command dissector */
1246 switch (cmd_id) {
1247 case ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY:
1248 dissect_zcl_identify_identify(tvb, payload_tree, &offset);
1249 break;
1251 case ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY:
1252 /* without payload*/
1253 break;
1255 case ZBEE_ZCL_CMD_ID_IDENTIFY_TRIGGER_EFFECT:
1256 dissect_zcl_identify_triggereffect(tvb, payload_tree, &offset);
1257 break;
1259 default:
1260 break;
1264 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
1265 /* Append the command name to the info column. */
1266 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
1267 val_to_str_const(cmd_id, zbee_zcl_identify_srv_tx_cmd_names, "Unknown Command"),
1268 zcl->tran_seqno);
1270 /* Add the command ID. */
1271 proto_tree_add_item(tree, hf_zbee_zcl_identify_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1273 /* Check is this command has a payload, than add the payload tree */
1274 rem_len = tvb_reported_length_remaining(tvb, ++offset);
1275 if (rem_len > 0) {
1276 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_identify, NULL, "Payload");
1278 /* Call the appropriate command dissector */
1279 switch (cmd_id) {
1280 case ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY_RSP:
1281 dissect_zcl_identify_identifyqueryrsp(tvb, payload_tree, &offset);
1282 break;
1284 default:
1285 break;
1290 return tvb_captured_length(tvb);
1291 } /*dissect_zbee_zcl_identify*/
1294 /*FUNCTION:------------------------------------------------------
1295 * NAME
1296 * dissect_zcl_identify_identify
1297 * DESCRIPTION
1298 * this function decodes the Identify payload.
1299 * PARAMETERS
1300 * tvb - the tv buffer of the current data_type
1301 * tree - the tree to append this item to
1302 * offset - offset of data in tvb
1303 * RETURNS
1304 * none
1305 *---------------------------------------------------------------
1307 static void
1308 dissect_zcl_identify_identify(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1310 /* Retrieve "Identify Time" field */
1311 proto_tree_add_item(tree, hf_zbee_zcl_identify_identify_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1312 *offset += 2;
1314 } /*dissect_zcl_identify_identify*/
1317 /*FUNCTION:------------------------------------------------------
1318 * NAME
1319 * dissect_zcl_identify_identifyqueryrsp
1320 * DESCRIPTION
1321 * this function decodes the IdentifyQueryResponse payload.
1322 * PARAMETERS
1323 * tvb - the tv buffer of the current data_type
1324 * tree - the tree to append this item to
1325 * offset - offset of data in tvb
1326 * RETURNS
1327 * none
1328 *---------------------------------------------------------------
1330 static void
1331 dissect_zcl_identify_identifyqueryrsp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1333 /* Retrieve "Identify Timeout" field */
1334 proto_tree_add_item(tree, hf_zbee_zcl_identify_identify_timeout, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1335 *offset += 2;
1337 } /*dissect_zcl_identify_identifyqueryrsp*/
1339 /*FUNCTION:------------------------------------------------------
1340 * NAME
1341 * dissect_zcl_identify_triggereffect
1342 * DESCRIPTION
1343 * this function decodes the Trigger Effect payload.
1344 * PARAMETERS
1345 * tvb - the tv buffer of the current data_type
1346 * tree - the tree to append this item to
1347 * offset - offset of data in tvb
1348 * RETURNS
1349 * none
1350 *---------------------------------------------------------------
1352 static void
1353 dissect_zcl_identify_triggereffect(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1355 /* Retrieve "Trigger Effect Id" field */
1356 proto_tree_add_item(tree, hf_zbee_zcl_identify_effect_id, tvb, *offset, 1, ENC_NA);
1357 *offset += 1;
1359 /* Retrieve "Trigger Effect Variant" field */
1360 proto_tree_add_item(tree, hf_zbee_zcl_identify_effect_variant, tvb, *offset, 1, ENC_NA);
1361 *offset += 1;
1363 } /*dissect_zcl_identify_triggereffect*/
1366 /*FUNCTION:------------------------------------------------------
1367 * NAME
1368 * dissect_zcl_identify_attr_data
1369 * DESCRIPTION
1370 * this function is called by ZCL foundation dissector in order to decode
1371 * specific cluster attributes data.
1372 * PARAMETERS
1373 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1374 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1375 * unsigned *offset - pointer to buffer offset
1376 * uint16_t attr_id - attribute identifier
1377 * unsigned data_type - attribute data type
1378 * bool client_attr- ZCL client
1379 * RETURNS
1380 * none
1381 *---------------------------------------------------------------
1383 void
1384 dissect_zcl_identify_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
1386 /* Dissect attribute data type and data */
1387 switch ( attr_id ) {
1389 case ZBEE_ZCL_ATTR_ID_IDENTIFY_IDENTIFY_TIME:
1390 proto_tree_add_item(tree, hf_zbee_zcl_identify_identify_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1391 *offset += 2;
1392 break;
1394 default:
1395 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
1396 break;
1399 } /*dissect_zcl_identify_attr_data*/
1402 /*FUNCTION:------------------------------------------------------
1403 * NAME
1404 * proto_register_zbee_zcl_identify
1405 * DESCRIPTION
1406 * ZigBee ZCL Identify cluster protocol registration routine.
1407 * PARAMETERS
1408 * none
1409 * RETURNS
1410 * void
1411 *---------------------------------------------------------------
1413 void
1414 proto_register_zbee_zcl_identify(void)
1416 /* Setup list of header fields */
1417 static hf_register_info hf[] = {
1419 { &hf_zbee_zcl_identify_attr_id,
1420 { "Attribute", "zbee_zcl_general.identify.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_identify_attr_names),
1421 0x00, NULL, HFILL } },
1423 { &hf_zbee_zcl_identify_identify_time,
1424 { "Identify Time", "zbee_zcl_general.identify.attr.identify_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_seconds),
1425 0x00, NULL, HFILL } },
1427 { &hf_zbee_zcl_identify_identify_timeout,
1428 { "Identify Timeout", "zbee_zcl_general.identify.identify_timeout", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_seconds),
1429 0x00, NULL, HFILL } },
1431 { &hf_zbee_zcl_identify_effect_id,
1432 { "Effect", "zbee_zcl_general.identify.effect_id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_identify_effect_id_names),
1433 0x00, NULL, HFILL } },
1435 { &hf_zbee_zcl_identify_effect_variant,
1436 { "Variant", "zbee_zcl_general.identify.effect_variant", FT_UINT8, BASE_DEC, NULL,
1437 0x00, NULL, HFILL } },
1439 { &hf_zbee_zcl_identify_srv_rx_cmd_id,
1440 { "Command", "zbee_zcl_general.identify.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_identify_srv_rx_cmd_names),
1441 0x00, NULL, HFILL } },
1443 { &hf_zbee_zcl_identify_srv_tx_cmd_id,
1444 { "Command", "zbee_zcl_general.identify.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_identify_srv_tx_cmd_names),
1445 0x00, NULL, HFILL } }
1449 /* ZCL Identify subtrees */
1450 static int *ett[] = {
1451 &ett_zbee_zcl_identify
1454 /* Register the ZigBee ZCL Identify cluster protocol name and description */
1455 proto_zbee_zcl_identify = proto_register_protocol("ZigBee ZCL Identify", "ZCL Identify", ZBEE_PROTOABBREV_ZCL_IDENTIFY);
1456 proto_register_field_array(proto_zbee_zcl_identify, hf, array_length(hf));
1457 proto_register_subtree_array(ett, array_length(ett));
1459 /* Register the ZigBee ZCL Identify dissector. */
1460 register_dissector(ZBEE_PROTOABBREV_ZCL_IDENTIFY, dissect_zbee_zcl_identify, proto_zbee_zcl_identify);
1462 } /*proto_register_zbee_zcl_identify*/
1465 /*FUNCTION:------------------------------------------------------
1466 * NAME
1467 * proto_reg_handoff_zbee_zcl_identify
1468 * DESCRIPTION
1469 * Hands off the ZCL Identify dissector.
1470 * PARAMETERS
1471 * none
1472 * RETURNS
1473 * none
1474 *---------------------------------------------------------------
1476 void
1477 proto_reg_handoff_zbee_zcl_identify(void)
1479 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_IDENTIFY,
1480 proto_zbee_zcl_identify,
1481 ett_zbee_zcl_identify,
1482 ZBEE_ZCL_CID_IDENTIFY,
1483 ZBEE_MFG_CODE_NONE,
1484 hf_zbee_zcl_identify_attr_id,
1485 hf_zbee_zcl_identify_attr_id,
1486 hf_zbee_zcl_identify_srv_rx_cmd_id,
1487 hf_zbee_zcl_identify_srv_tx_cmd_id,
1488 (zbee_zcl_fn_attr_data)dissect_zcl_identify_attr_data
1490 } /*proto_reg_handoff_zbee_zcl_identify*/
1493 /* ########################################################################## */
1494 /* #### (0x0004) GROUPS CLUSTER ############################################# */
1495 /* ########################################################################## */
1497 /*************************/
1498 /* Defines */
1499 /*************************/
1501 #define ZBEE_ZCL_CMD_ID_GROUPS_NAME_SUPPORT_MASK 0x80 /*Name support Mask*/
1502 /* Attributes */
1503 #define ZBEE_ZCL_ATTR_ID_GROUPS_NAME_SUPPORT 0x0000 /* Groups Name Support*/
1505 /* Server Commands Received */
1506 #define ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP 0x00 /* Add Group */
1507 #define ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP 0x01 /* View Group */
1508 #define ZBEE_ZCL_CMD_ID_GROUPS_ADD_GET_GROUP_MEMBERSHIP 0x02 /* Get Group Membership */
1509 #define ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP 0x03 /* Remove a Group */
1510 #define ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_ALL_GROUPS 0x04 /* Remove all Groups */
1511 #define ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_IF_IDENTIFYING 0x05 /* Add Group if Identifying */
1514 /* Server Commands Generated */
1515 #define ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_RESPONSE 0x00 /* Add Group Response */
1516 #define ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP_RESPONSE 0x01 /* View Group Response */
1517 #define ZBEE_ZCL_CMD_ID_GROUPS_GET_GROUP_MEMBERSHIP_RESPONSE 0x02 /* Get Group Membership Response */
1518 #define ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP_RESPONSE 0x03 /* Remove a Group Response */
1520 /*************************/
1521 /* Function Declarations */
1522 /*************************/
1524 void proto_register_zbee_zcl_groups(void);
1525 void proto_reg_handoff_zbee_zcl_groups(void);
1527 /* Command Dissector Helpers */
1528 static void dissect_zcl_groups_add_group_or_if_identifying (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1529 static void dissect_zcl_groups_view_group (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1530 static void dissect_zcl_groups_get_group_membership (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1531 static void dissect_zcl_groups_remove_group (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1532 static void dissect_zcl_groups_add_remove_group_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1533 static void dissect_zcl_groups_view_group_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1534 static void dissect_zcl_groups_get_group_membership_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1536 static void dissect_zcl_groups_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
1538 /* Private functions prototype */
1540 /*************************/
1541 /* Global Variables */
1542 /*************************/
1543 /* Initialize the protocol and registered fields */
1544 static int proto_zbee_zcl_groups;
1546 static int hf_zbee_zcl_groups_attr_id;
1547 static int hf_zbee_zcl_groups_group_name_support;
1548 static int hf_zbee_zcl_groups_group_id;
1549 static int hf_zbee_zcl_groups_group_count;
1550 static int hf_zbee_zcl_groups_group_capacity;
1551 static int hf_zbee_zcl_groups_status;
1552 static int hf_zbee_zcl_groups_attr_str_len;
1553 static int hf_zbee_zcl_groups_attr_str;
1554 static int hf_zbee_zcl_groups_srv_rx_cmd_id;
1555 static int hf_zbee_zcl_groups_srv_tx_cmd_id;
1556 static int hf_zbee_zcl_groups_group_list;
1558 /* Initialize the subtree pointers */
1559 static int ett_zbee_zcl_groups;
1560 static int ett_zbee_zcl_groups_grp_ctrl;
1562 /* Attributes */
1563 static const value_string zbee_zcl_groups_attr_names[] = {
1564 { ZBEE_ZCL_ATTR_ID_GROUPS_NAME_SUPPORT, "Groups Name Support" },
1565 { 0, NULL }
1568 /* Server Commands Received */
1569 static const value_string zbee_zcl_groups_srv_rx_cmd_names[] = {
1570 { ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP, "Add Group" },
1571 { ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP, "View Group" },
1572 { ZBEE_ZCL_CMD_ID_GROUPS_ADD_GET_GROUP_MEMBERSHIP, "Get Group Membership" },
1573 { ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP, "Remove a Group" },
1574 { ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_ALL_GROUPS, "Remove all Groups" },
1575 { ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_IF_IDENTIFYING, "Add Group if Identifying" },
1576 { 0, NULL }
1579 /* Server Commands Generated */
1580 static const value_string zbee_zcl_groups_srv_tx_cmd_names[] = {
1581 { ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_RESPONSE, "Add Group Response" },
1582 { ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP_RESPONSE, "View Group Response" },
1583 { ZBEE_ZCL_CMD_ID_GROUPS_GET_GROUP_MEMBERSHIP_RESPONSE, "Get Group Membership Response" },
1584 { ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP_RESPONSE, "Remove a Group Response" },
1585 { 0, NULL }
1589 /*************************/
1590 /* Function Bodies */
1591 /*************************/
1593 /*FUNCTION:------------------------------------------------------
1594 * NAME
1595 * dissect_zbee_zcl_groups
1596 * DESCRIPTION
1597 * ZigBee ZCL Groups cluster dissector for wireshark.
1598 * PARAMETERS
1599 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1600 * packet_info *pinfo - pointer to packet information fields
1601 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1602 * RETURNS
1603 * none
1604 *---------------------------------------------------------------
1606 static int
1607 dissect_zbee_zcl_groups(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1609 proto_tree *payload_tree;
1610 zbee_zcl_packet *zcl;
1611 unsigned offset = 0;
1612 uint8_t cmd_id;
1613 int rem_len;
1615 /* Reject the packet if data is NULL */
1616 if (data == NULL)
1617 return 0;
1618 zcl = (zbee_zcl_packet *)data;
1619 cmd_id = zcl->cmd_id;
1621 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
1622 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
1623 /* Append the command name to the info column. */
1624 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
1625 val_to_str_const(cmd_id, zbee_zcl_groups_srv_rx_cmd_names, "Unknown Command"),
1626 zcl->tran_seqno);
1628 /* Add the command ID. */
1629 proto_tree_add_item(tree, hf_zbee_zcl_groups_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1631 /* Check if this command has a payload, then add the payload tree */
1632 rem_len = tvb_reported_length_remaining(tvb, ++offset);
1633 if (rem_len > 0) {
1634 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_groups, NULL, "Payload");
1636 /* Call the appropriate command dissector */
1637 switch (cmd_id) {
1638 case ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP:
1639 dissect_zcl_groups_add_group_or_if_identifying(tvb, payload_tree, &offset);
1640 break;
1642 case ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP:
1643 dissect_zcl_groups_view_group(tvb, payload_tree, &offset);
1644 break;
1646 case ZBEE_ZCL_CMD_ID_GROUPS_ADD_GET_GROUP_MEMBERSHIP:
1647 dissect_zcl_groups_get_group_membership(tvb, payload_tree, &offset);
1648 break;
1650 case ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP:
1651 dissect_zcl_groups_remove_group(tvb, payload_tree, &offset);
1652 break;
1654 case ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_ALL_GROUPS:
1655 /* without payload*/
1656 break;
1658 case ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_IF_IDENTIFYING:
1659 dissect_zcl_groups_add_group_or_if_identifying(tvb, payload_tree, &offset);
1660 break;
1662 default:
1663 break;
1667 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
1668 /* Append the command name to the info column. */
1669 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
1670 val_to_str_const(cmd_id, zbee_zcl_groups_srv_tx_cmd_names, "Unknown Command"),
1671 zcl->tran_seqno);
1673 /* Add the command ID. */
1674 proto_tree_add_item(tree, hf_zbee_zcl_groups_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1676 /* Check if this command has a payload, then add the payload tree */
1677 rem_len = tvb_reported_length_remaining(tvb, ++offset);
1678 if (rem_len > 0) {
1679 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_groups, NULL, "Payload");
1681 /* Call the appropriate command dissector */
1682 switch (cmd_id) {
1683 case ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_RESPONSE:
1684 dissect_zcl_groups_add_remove_group_response(tvb, payload_tree, &offset);
1685 break;
1687 case ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP_RESPONSE:
1688 dissect_zcl_groups_view_group_response(tvb, payload_tree, &offset);
1689 break;
1691 case ZBEE_ZCL_CMD_ID_GROUPS_GET_GROUP_MEMBERSHIP_RESPONSE:
1692 dissect_zcl_groups_get_group_membership_response(tvb, payload_tree, &offset);
1693 break;
1695 case ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP_RESPONSE:
1696 dissect_zcl_groups_add_remove_group_response(tvb, payload_tree, &offset);
1697 break;
1699 default:
1700 break;
1705 return tvb_captured_length(tvb);
1706 } /*dissect_zbee_zcl_groups*/
1709 /*FUNCTION:------------------------------------------------------
1710 * NAME
1711 * dissect_zcl_groups_add_group_or_if_identifying
1712 * DESCRIPTION
1713 * this function decodes the Add Group or Add Group If
1714 * Identifying payload.
1715 * PARAMETERS
1716 * tvb - the tv buffer of the current data_type
1717 * tree - the tree to append this item to
1718 * offset - offset of data in tvb
1719 * RETURNS
1720 * none
1721 *---------------------------------------------------------------
1723 static void
1724 dissect_zcl_groups_add_group_or_if_identifying(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1726 unsigned attr_uint;
1727 uint8_t *attr_string;
1729 /* Retrieve "Group ID" field */
1730 proto_tree_add_item(tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1731 *offset += 2;
1733 /* Retrieve "Group Name" field */
1734 attr_uint = tvb_get_uint8(tvb, *offset); /* string length */
1735 if (attr_uint == 0xff) attr_uint = 0;
1737 proto_tree_add_uint(tree, hf_zbee_zcl_groups_attr_str_len, tvb, *offset, 1, attr_uint);
1739 *offset += 1;
1741 attr_string = tvb_get_string_enc(wmem_packet_scope(), tvb, *offset, attr_uint, ENC_ASCII);
1743 proto_item_append_text(tree, ", String: %s", attr_string);
1744 proto_tree_add_string(tree, hf_zbee_zcl_groups_attr_str, tvb, *offset, attr_uint, attr_string);
1746 *offset += attr_uint;
1748 } /*dissect_zcl_groups_add_group*/
1751 /*FUNCTION:------------------------------------------------------
1752 * NAME
1753 * dissect_zcl_groups_view_group
1754 * DESCRIPTION
1755 * this function decodes the View Group payload.
1756 * PARAMETERS
1757 * tvb - the tv buffer of the current data_type
1758 * tree - the tree to append this item to
1759 * offset - offset of data in tvb
1760 * RETURNS
1761 * none
1762 *---------------------------------------------------------------
1764 static void
1765 dissect_zcl_groups_view_group(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1767 /* Retrieve "Groups Timeout" field */
1768 proto_tree_add_item(tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1769 *offset += 2;
1771 } /*dissect_zcl_groups_view_group*/
1774 /*FUNCTION:------------------------------------------------------
1775 * NAME
1776 * dissect_zcl_groups_get_group_membership
1777 * DESCRIPTION
1778 * this function decodes the Get Group Membership payload.
1779 * PARAMETERS
1780 * tvb - the tv buffer of the current data_type
1781 * tree - the tree to append this item to
1782 * offset - offset of data in tvb
1783 * RETURNS
1784 * none
1785 *---------------------------------------------------------------
1787 static void
1788 dissect_zcl_groups_get_group_membership(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1790 proto_item *grp_list;
1791 proto_tree *grp_list_tree;
1792 uint8_t count, i;
1793 /* Retrieve "Group Count" field */
1794 count = tvb_get_uint8(tvb, *offset);
1795 proto_tree_add_uint(tree, hf_zbee_zcl_groups_group_count, tvb, *offset, 1, count);
1796 *offset += 1;
1798 if(count > 0)
1800 grp_list = proto_tree_add_item(tree, hf_zbee_zcl_groups_group_list, tvb, *offset, 2*count, ENC_NA);
1801 grp_list_tree = proto_item_add_subtree(grp_list, ett_zbee_zcl_groups_grp_ctrl);
1802 /* Retrieve "Group List" members */
1803 for( i = 0; i < count; i++)
1805 proto_tree_add_item(grp_list_tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1806 *offset += 2;
1810 } /*dissect_zcl_groups_get_group_membership*/
1813 /*FUNCTION:------------------------------------------------------
1814 * NAME
1815 * dissect_zcl_groups_remove_group
1816 * DESCRIPTION
1817 * this function decodes the Remove Group payload.
1818 * PARAMETERS
1819 * tvb - the tv buffer of the current data_type
1820 * tree - the tree to append this item to
1821 * offset - offset of data in tvb
1822 * RETURNS
1823 * none
1824 *---------------------------------------------------------------
1826 static void
1827 dissect_zcl_groups_remove_group(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1829 /* Retrieve "Groups ID" field */
1830 proto_tree_add_item(tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1831 *offset += 2;
1833 } /*dissect_zcl_groups_remove_group*/
1836 /*FUNCTION:------------------------------------------------------
1837 * NAME
1838 * dissect_zcl_groups_add_group_response
1839 * DESCRIPTION
1840 * this function decodes the Add Group Response payload.
1841 * PARAMETERS
1842 * tvb - the tv buffer of the current data_type
1843 * tree - the tree to append this item to
1844 * offset - offset of data in tvb
1845 * RETURNS
1846 * none
1847 *---------------------------------------------------------------
1849 static void
1850 dissect_zcl_groups_add_remove_group_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1852 /* Retrieve "Status" field */
1853 proto_tree_add_item(tree, hf_zbee_zcl_groups_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1854 *offset += 1;
1856 /* Retrieve "Groups ID" field */
1857 proto_tree_add_item(tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1858 *offset += 2;
1860 } /*dissect_zcl_groups_remove_group*/
1863 /*FUNCTION:------------------------------------------------------
1864 * NAME
1865 * dissect_zcl_groups_view_group_response
1866 * DESCRIPTION
1867 * this function decodes the View Group Response payload
1868 * PARAMETERS
1869 * tvb - the tv buffer of the current data_type
1870 * tree - the tree to append this item to
1871 * offset - offset of data in tvb
1872 * RETURNS
1873 * none
1874 *---------------------------------------------------------------
1876 static void
1877 dissect_zcl_groups_view_group_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1879 unsigned attr_uint;
1880 uint8_t *attr_string;
1881 /* Retrieve "Status" field */
1882 proto_tree_add_item(tree, hf_zbee_zcl_groups_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1883 *offset += 1;
1885 /* Retrieve "Group ID" field */
1886 proto_tree_add_item(tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1887 *offset += 2;
1889 /* Retrieve "Group Name" field */
1890 attr_uint = tvb_get_uint8(tvb, *offset); /* string length */
1891 if (attr_uint == 0xff) attr_uint = 0;
1893 proto_tree_add_uint(tree, hf_zbee_zcl_groups_attr_str_len, tvb, *offset, 1, attr_uint);
1895 *offset += 1;
1897 attr_string = tvb_get_string_enc(wmem_packet_scope(), tvb, *offset, attr_uint, ENC_ASCII);
1899 proto_item_append_text(tree, ", String: %s", attr_string);
1900 proto_tree_add_string(tree, hf_zbee_zcl_groups_attr_str, tvb, *offset, attr_uint, attr_string);
1902 *offset += attr_uint;
1903 } /*dissect_zcl_groups_add_group*/
1906 /*FUNCTION:------------------------------------------------------
1907 * NAME
1908 * dissect_zcl_groups_get_group_membership_response
1909 * DESCRIPTION
1910 * this function decodes the Get Group Membership Response payload.
1911 * PARAMETERS
1912 * tvb - the tv buffer of the current data_type
1913 * tree - the tree to append this item to
1914 * offset - offset of data in tvb
1915 * RETURNS
1916 * none
1917 *---------------------------------------------------------------
1919 static void
1920 dissect_zcl_groups_get_group_membership_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1922 proto_item *grp_list;
1923 proto_tree *grp_list_tree;
1924 uint8_t count, i;
1926 /* Retrieve "Capacity" field */
1927 proto_tree_add_item(tree, hf_zbee_zcl_groups_group_capacity, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1928 *offset += 1;
1930 /* Retrieve "Group Count" field */
1931 count = tvb_get_uint8(tvb, *offset);
1932 proto_tree_add_uint(tree, hf_zbee_zcl_groups_group_count, tvb, *offset, 1, count);
1933 *offset += 1;
1934 if(count > 0)
1936 grp_list = proto_tree_add_item(tree, hf_zbee_zcl_groups_group_list, tvb, *offset, 2*count, ENC_NA);
1937 grp_list_tree = proto_item_add_subtree(grp_list, ett_zbee_zcl_groups_grp_ctrl);
1938 /* Retrieve "Group List" members */
1939 for( i = 0; i < count; i++)
1941 proto_tree_add_item(grp_list_tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1942 *offset += 2;
1946 } /*dissect_zcl_groups_get_group_membership*/
1949 /*FUNCTION:------------------------------------------------------
1950 * NAME
1951 * dissect_zcl_groups_attr_data
1952 * DESCRIPTION
1953 * this function is called by ZCL foundation dissector in order to decode
1954 * specific cluster attributes data.
1955 * PARAMETERS
1956 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1957 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1958 * unsigned *offset - pointer to buffer offset
1959 * uint16_t attr_id - attribute identifier
1960 * unsigned data_type - attribute data type
1961 * bool client_attr- ZCL client
1962 * RETURNS
1963 * none
1964 *---------------------------------------------------------------
1966 void
1967 dissect_zcl_groups_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
1969 /* Dissect attribute data type and data */
1970 switch ( attr_id ) {
1972 case ZBEE_ZCL_ATTR_ID_GROUPS_NAME_SUPPORT:
1973 proto_tree_add_item(tree, hf_zbee_zcl_groups_group_name_support, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1974 *offset += 1;
1975 break;
1977 default:
1978 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
1979 break;
1982 } /*dissect_zcl_groups_attr_data*/
1985 /*FUNCTION:------------------------------------------------------
1986 * NAME
1987 * proto_register_zbee_zcl_groups
1988 * DESCRIPTION
1989 * ZigBee ZCL Groups cluster protocol registration routine.
1990 * PARAMETERS
1991 * none
1992 * RETURNS
1993 * void
1994 *---------------------------------------------------------------
1996 void
1997 proto_register_zbee_zcl_groups(void)
1999 /* Setup list of header fields */
2000 static hf_register_info hf[] = {
2002 { &hf_zbee_zcl_groups_attr_id,
2003 { "Attribute", "zbee_zcl_general.groups.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_groups_attr_names),
2004 0x00, NULL, HFILL } },
2006 { &hf_zbee_zcl_groups_group_name_support,
2007 { "Group Name Support", "zbee_zcl_general.groups.attr.group_name_support", FT_BOOLEAN, 8, NULL,
2008 ZBEE_ZCL_CMD_ID_GROUPS_NAME_SUPPORT_MASK, NULL, HFILL } },
2010 { &hf_zbee_zcl_groups_group_id,
2011 { "Group ID", "zbee_zcl_general.groups.group_id", FT_UINT16, BASE_HEX, NULL,
2012 0x00, NULL, HFILL } },
2014 { &hf_zbee_zcl_groups_group_list,
2015 {"Group List", "zbee_zcl_general.groups.group_list",FT_NONE,BASE_NONE, NULL,
2016 0x00, NULL, HFILL } },
2018 { &hf_zbee_zcl_groups_group_count,
2019 { "Group Count", "zbee_zcl_general.groups.group_count", FT_UINT8, BASE_DEC, NULL,
2020 0x00, NULL, HFILL } },
2022 { &hf_zbee_zcl_groups_group_capacity,
2023 { "Group Capacity", "zbee_zcl_general.groups.group_capacity", FT_UINT8, BASE_DEC, NULL,
2024 0x00, NULL, HFILL } },
2026 { &hf_zbee_zcl_groups_status,
2027 { "Group Status", "zbee_zcl_general.groups.group_status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names),
2028 0x00, NULL, HFILL } },
2030 { &hf_zbee_zcl_groups_attr_str_len,
2031 { "Length", "zbee_zcl_general.groups.attr_str_len", FT_UINT8, BASE_DEC, NULL,
2032 0x00, NULL, HFILL }},
2034 { &hf_zbee_zcl_groups_attr_str,
2035 { "String", "zbee_zcl_general.groups_attr_str", FT_STRING, BASE_NONE, NULL,
2036 0x00, NULL, HFILL }},
2038 { &hf_zbee_zcl_groups_srv_rx_cmd_id,
2039 { "Command", "zbee_zcl_general.groups.cmd_srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_groups_srv_rx_cmd_names),
2040 0x00, NULL, HFILL } },
2042 { &hf_zbee_zcl_groups_srv_tx_cmd_id,
2043 { "Command", "zbee_zcl_general.groups.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_groups_srv_tx_cmd_names),
2044 0x00, NULL, HFILL } }
2048 /* ZCL Groups subtrees */
2049 static int *ett[] = {
2050 &ett_zbee_zcl_groups,
2051 &ett_zbee_zcl_groups_grp_ctrl
2054 /* Register the ZigBee ZCL Groups cluster protocol name and description */
2055 proto_zbee_zcl_groups = proto_register_protocol("ZigBee ZCL Groups", "ZCL Groups", ZBEE_PROTOABBREV_ZCL_GROUPS);
2056 proto_register_field_array(proto_zbee_zcl_groups, hf, array_length(hf));
2057 proto_register_subtree_array(ett, array_length(ett));
2059 /* Register the ZigBee ZCL Groups dissector. */
2060 register_dissector(ZBEE_PROTOABBREV_ZCL_GROUPS, dissect_zbee_zcl_groups, proto_zbee_zcl_groups);
2062 } /*proto_register_zbee_zcl_groups*/
2065 /*FUNCTION:------------------------------------------------------
2066 * NAME
2067 * proto_reg_handoff_zbee_zcl_groups
2068 * DESCRIPTION
2069 * Hands off the ZCL Groups dissector.
2070 * PARAMETERS
2071 * none
2072 * RETURNS
2073 * none
2074 *---------------------------------------------------------------
2076 void
2077 proto_reg_handoff_zbee_zcl_groups(void)
2079 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_GROUPS,
2080 proto_zbee_zcl_groups,
2081 ett_zbee_zcl_groups,
2082 ZBEE_ZCL_CID_GROUPS,
2083 ZBEE_MFG_CODE_NONE,
2084 hf_zbee_zcl_groups_attr_id,
2085 hf_zbee_zcl_groups_attr_id,
2086 hf_zbee_zcl_groups_srv_rx_cmd_id,
2087 hf_zbee_zcl_groups_srv_tx_cmd_id,
2088 (zbee_zcl_fn_attr_data)dissect_zcl_groups_attr_data
2090 } /*proto_reg_handoff_zbee_zcl_groups*/
2093 /* ########################################################################## */
2094 /* #### (0x0005) SCENES CLUSTER ############################################# */
2095 /* ########################################################################## */
2097 /*************************/
2098 /* Defines */
2099 /*************************/
2101 #define ZBEE_ZCL_ATTR_SCENES_SCENE_VALID_MASK 0x01 /* bit 0 */
2103 /* Attributes */
2104 #define ZBEE_ZCL_ATTR_ID_SCENES_SCENE_COUNT 0x0000 /* Scene Count */
2105 #define ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_SCENE 0x0001 /* Current Scene */
2106 #define ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_GROUP 0x0002 /* Current Group */
2107 #define ZBEE_ZCL_ATTR_ID_SCENES_SCENE_VALID 0x0003 /* Scene Valid */
2108 #define ZBEE_ZCL_ATTR_ID_SCENES_NAME_SUPPORT 0x0004 /* Name Support */
2109 #define ZBEE_ZCL_ATTR_ID_SCENES_LAST_CONFIGURED_BY 0x0005 /* Last Configured By */
2111 /* Scene Name Support */
2112 #define ZBEE_ZCL_SCENES_NAME_NOT_SUPPORTED 0x00 /* Scene Names Not Supported */
2113 #define ZBEE_ZCL_SCENES_NAME_SUPPORTED 0x01 /* Scene Names Supported */
2115 /* Copy Mode */
2116 #define ZBEE_ZCL_SCENES_COPY_SPECIFIED 0x00 /* Copy Specified Scenes */
2117 #define ZBEE_ZCL_SCENES_COPY_ALL 0x01 /* Copy All Scenes */
2119 /* Server Commands Received */
2120 #define ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE 0x00 /* Add Scene */
2121 #define ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE 0x01 /* View Scene */
2122 #define ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE 0x02 /* Remove a Scene */
2123 #define ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES 0x03 /* Remove all Scenes */
2124 #define ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE 0x04 /* Store Scene */
2125 #define ZBEE_ZCL_CMD_ID_SCENES_RECALL_SCENE 0x05 /* Recall Scene */
2126 #define ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP 0x06 /* Get Scene Membership */
2127 #define ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE 0x40 /* Enhanced Add Scene */
2128 #define ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE 0x41 /* Enhanced View Scene */
2129 #define ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE 0x42 /* Copy Scene */
2130 #define ZBEE_ZCL_CMD_ID_SCENES_NAME_SUPPORT_MASK 0x80
2132 /* Server Commands Generated */
2133 #define ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE_RESPONSE 0x00 /* Add Scene Response */
2134 #define ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE_RESPONSE 0x01 /* View Scene Response */
2135 #define ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE_RESPONSE 0x02 /* Remove a Scene Response */
2136 #define ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES_RESPONSE 0x03 /* Remove all Scenes Response */
2137 #define ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE_RESPONSE 0x04 /* Store Scene Response */
2138 #define ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP_RESPONSE 0x06 /* Get Scene Membership Response */
2139 #define ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE_RESPONSE 0x40 /* Enhanced Add Scene Response */
2140 #define ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE_RESPONSE 0x41 /* Enhanced View Scene Response */
2141 #define ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE_RESPONSE 0x42 /* Copy Scene Response */
2143 /* Enhanced */
2144 #define IS_ENHANCED true
2145 #define IS_NOT_ENHANCED false
2147 /*************************/
2148 /* Function Declarations */
2149 /*************************/
2151 void proto_register_zbee_zcl_scenes(void);
2152 void proto_reg_handoff_zbee_zcl_scenes(void);
2154 /* Command Dissector Helpers */
2155 static void dissect_zcl_scenes_add_scene (tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool enhanced);
2156 static void dissect_zcl_scenes_view_remove_store_recall_scene (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
2157 static void dissect_zcl_scenes_remove_all_get_scene_membership (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
2158 static void dissect_zcl_scenes_copy_scene (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
2159 static void dissect_zcl_scenes_add_remove_store_scene_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
2160 static void dissect_zcl_scenes_view_scene_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool enhanced);
2161 static void dissect_zcl_scenes_remove_all_scenes_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
2162 static void dissect_zcl_scenes_get_scene_membership_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
2163 static void dissect_zcl_scenes_copy_scene_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
2165 static void dissect_zcl_scenes_extension_fields (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
2166 static void dissect_zcl_scenes_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
2168 /* Private functions prototype */
2170 /*************************/
2171 /* Global Variables */
2172 /*************************/
2173 /* Initialize the protocol and registered fields */
2174 static int proto_zbee_zcl_scenes;
2176 static int hf_zbee_zcl_scenes_attr_id;
2177 static int hf_zbee_zcl_scenes_attr_id_scene_valid;
2178 static int hf_zbee_zcl_scenes_attr_id_name_support;
2179 static int hf_zbee_zcl_scenes_group_id;
2180 static int hf_zbee_zcl_scenes_group_id_from;
2181 static int hf_zbee_zcl_scenes_group_id_to;
2182 static int hf_zbee_zcl_scenes_scene_id;
2183 static int hf_zbee_zcl_scenes_scene_id_from;
2184 static int hf_zbee_zcl_scenes_scene_id_to;
2185 static int hf_zbee_zcl_scenes_transit_time;
2186 static int hf_zbee_zcl_scenes_enh_transit_time;
2187 static int hf_zbee_zcl_scenes_extension_set_cluster;
2188 static int hf_zbee_zcl_scenes_extension_set_onoff;
2189 static int hf_zbee_zcl_scenes_extension_set_level;
2190 static int hf_zbee_zcl_scenes_extension_set_x;
2191 static int hf_zbee_zcl_scenes_extension_set_y;
2192 static int hf_zbee_zcl_scenes_extension_set_hue;
2193 static int hf_zbee_zcl_scenes_extension_set_saturation;
2194 static int hf_zbee_zcl_scenes_extension_set_color_loop_active;
2195 static int hf_zbee_zcl_scenes_extension_set_color_loop_direction;
2196 static int hf_zbee_zcl_scenes_extension_set_color_loop_time;
2197 static int hf_zbee_zcl_scenes_extension_set_cooling_setpoint;
2198 static int hf_zbee_zcl_scenes_extension_set_heating_setpoint;
2199 static int hf_zbee_zcl_scenes_extension_set_system_mode;
2200 static int hf_zbee_zcl_scenes_extension_set_lock_state;
2201 static int hf_zbee_zcl_scenes_extension_set_lift_percentage;
2202 static int hf_zbee_zcl_scenes_extension_set_tilt_percentage;
2204 static int hf_zbee_zcl_scenes_status;
2205 static int hf_zbee_zcl_scenes_capacity;
2206 static int hf_zbee_zcl_scenes_scene_count;
2207 static int hf_zbee_zcl_scenes_attr_str_len;
2208 static int hf_zbee_zcl_scenes_attr_str;
2209 static int hf_zbee_zcl_scenes_srv_rx_cmd_id;
2210 static int hf_zbee_zcl_scenes_srv_tx_cmd_id;
2211 static int hf_zbee_zcl_scenes_scene_list;
2212 static int hf_zbee_zcl_scenes_copy_mode;
2214 /* Initialize the subtree pointers */
2215 static int ett_zbee_zcl_scenes;
2216 static int ett_zbee_zcl_scenes_scene_ctrl;
2217 static int ett_zbee_zcl_scenes_extension_field_set;
2219 /* Attributes */
2220 static const value_string zbee_zcl_scenes_attr_names[] = {
2221 { ZBEE_ZCL_ATTR_ID_SCENES_SCENE_COUNT, "Scene Count" },
2222 { ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_SCENE, "Current Scene" },
2223 { ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_GROUP, "Current Group" },
2224 { ZBEE_ZCL_ATTR_ID_SCENES_SCENE_VALID, "Scene Valid" },
2225 { ZBEE_ZCL_ATTR_ID_SCENES_NAME_SUPPORT, "Name Support" },
2226 { ZBEE_ZCL_ATTR_ID_SCENES_LAST_CONFIGURED_BY, "Last Configured By" },
2227 { 0, NULL }
2230 /* Server Commands Received */
2231 static const value_string zbee_zcl_scenes_srv_rx_cmd_names[] = {
2232 { ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE, "Add Scene" },
2233 { ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE, "View Scene" },
2234 { ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE, "Remove a Scene" },
2235 { ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES, "Remove all Scenes" },
2236 { ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE, "Store Scene" },
2237 { ZBEE_ZCL_CMD_ID_SCENES_RECALL_SCENE, "Recall Scene" },
2238 { ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP, "Get Scene Membership" },
2239 { ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE, "Enhanced Add Scene" },
2240 { ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE, "Enhanced View Scene" },
2241 { ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE, "Copy Scene" },
2242 { 0, NULL }
2245 /* Server Commands Generated */
2246 static const value_string zbee_zcl_scenes_srv_tx_cmd_names[] = {
2247 { ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE_RESPONSE, "Add Scene Response" },
2248 { ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE_RESPONSE, "View Scene Response" },
2249 { ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE_RESPONSE, "Remove a Scene Response" },
2250 { ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES_RESPONSE, "Remove all Scene Response" },
2251 { ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE_RESPONSE, "Store Scene Response" },
2252 { ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP_RESPONSE, "Get Scene Membership Response" },
2253 { ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE_RESPONSE, "Enhanced Add Scene Response" },
2254 { ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE_RESPONSE, "Enhanced View Scene Response" },
2255 { ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE_RESPONSE, "Copy Scene Response" },
2256 { 0, NULL }
2259 /* Scene Names Support Values */
2260 static const value_string zbee_zcl_scenes_group_names_support_values[] = {
2261 { ZBEE_ZCL_SCENES_NAME_NOT_SUPPORTED, "Scene names not supported" },
2262 { ZBEE_ZCL_SCENES_NAME_SUPPORTED, "Scene names supported" },
2263 { 0, NULL }
2266 /* Scene Copy Mode Values */
2267 static const value_string zbee_zcl_scenes_copy_mode_values[] = {
2268 { ZBEE_ZCL_SCENES_COPY_SPECIFIED, "Copy Specified Scenes" },
2269 { ZBEE_ZCL_SCENES_COPY_ALL, "Copy All Scenes" },
2270 { 0, NULL }
2273 /* Color Loop Directions */
2274 static const value_string zbee_zcl_scenes_color_loop_direction_values[] = {
2275 { 0x00, "Hue is Decrementing" },
2276 { 0x01, "Hue is Incrementing" },
2277 { 0, NULL }
2281 /*************************/
2282 /* Function Bodies */
2283 /*************************/
2285 /*FUNCTION:------------------------------------------------------
2286 * NAME
2287 * decode_color_xy
2288 * DESCRIPTION
2289 * this function decodes color xy values
2290 * PARAMETERS
2291 * unsigned *s - string to display
2292 * uint16_t value - value to decode
2293 * RETURNS
2294 * none
2295 *---------------------------------------------------------------
2297 static void
2298 decode_color_xy(char *s, uint16_t value)
2300 snprintf(s, ITEM_LABEL_LENGTH, "%.4lf", value/65535.0);
2303 /*FUNCTION:------------------------------------------------------
2304 * NAME
2305 * decode_setpoint
2306 * DESCRIPTION
2307 * this function decodes the setpoint
2308 * PARAMETERS
2309 * unsigned *s - string to display
2310 * uint16_t value - value to decode
2311 * RETURNS
2312 * none
2313 *---------------------------------------------------------------
2315 static void decode_setpoint(char *s, int16_t value)
2317 snprintf(s, ITEM_LABEL_LENGTH, "%.2lf [" UTF8_DEGREE_SIGN "C]", value/100.0);
2320 /*FUNCTION:------------------------------------------------------
2321 * NAME
2322 * dissect_zbee_zcl_scenes
2323 * DESCRIPTION
2324 * ZigBee ZCL Scenes cluster dissector for wireshark.
2325 * PARAMETERS
2326 * tvbuff_t *tvb - pointer to buffer containing raw packet.
2327 * packet_info *pinfo - pointer to packet information fields
2328 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
2329 * RETURNS
2330 * none
2331 *---------------------------------------------------------------
2333 static int
2334 dissect_zbee_zcl_scenes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
2336 proto_tree *payload_tree;
2337 zbee_zcl_packet *zcl;
2338 unsigned offset = 0;
2339 uint8_t cmd_id;
2340 int rem_len;
2342 /* Reject the packet if data is NULL */
2343 if (data == NULL)
2344 return 0;
2345 zcl = (zbee_zcl_packet *)data;
2346 cmd_id = zcl->cmd_id;
2348 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
2349 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
2350 /* Append the command name to the info column. */
2351 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
2352 val_to_str_const(cmd_id, zbee_zcl_scenes_srv_rx_cmd_names, "Unknown Command"),
2353 zcl->tran_seqno);
2355 /* Add the command ID. */
2356 proto_tree_add_item(tree, hf_zbee_zcl_scenes_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2358 /* Check if this command has a payload, then add the payload tree */
2359 rem_len = tvb_reported_length_remaining(tvb, ++offset);
2360 if (rem_len > 0) {
2361 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_scenes, NULL, "Payload");
2363 /* Call the appropriate command dissector */
2364 switch (cmd_id) {
2365 case ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE:
2366 dissect_zcl_scenes_add_scene(tvb, payload_tree, &offset, IS_NOT_ENHANCED);
2367 break;
2369 case ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE:
2370 dissect_zcl_scenes_add_scene(tvb, payload_tree, &offset, IS_ENHANCED);
2371 break;
2373 case ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE:
2374 case ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE:
2375 case ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE:
2376 case ZBEE_ZCL_CMD_ID_SCENES_RECALL_SCENE:
2377 case ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE:
2378 dissect_zcl_scenes_view_remove_store_recall_scene(tvb, payload_tree, &offset);
2379 break;
2381 case ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES:
2382 case ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP:
2383 dissect_zcl_scenes_remove_all_get_scene_membership(tvb, payload_tree, &offset);
2384 break;
2386 case ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE:
2387 dissect_zcl_scenes_copy_scene(tvb, payload_tree, &offset);
2388 break;
2390 default:
2391 break;
2395 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
2396 /* Append the command name to the info column. */
2397 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
2398 val_to_str_const(cmd_id, zbee_zcl_scenes_srv_tx_cmd_names, "Unknown Command"),
2399 zcl->tran_seqno);
2401 /* Add the command ID. */
2402 proto_tree_add_item(tree, hf_zbee_zcl_scenes_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2404 /* Check if this command has a payload, then add the payload tree */
2405 rem_len = tvb_reported_length_remaining(tvb, ++offset);
2406 if (rem_len > 0) {
2407 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_scenes, NULL, "Payload");
2409 /* Call the appropriate command dissector */
2410 switch (cmd_id) {
2411 case ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE_RESPONSE:
2412 case ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE_RESPONSE:
2413 case ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE_RESPONSE:
2414 case ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE_RESPONSE:
2415 dissect_zcl_scenes_add_remove_store_scene_response(tvb, payload_tree, &offset);
2416 break;
2418 case ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE_RESPONSE:
2419 dissect_zcl_scenes_view_scene_response(tvb, payload_tree, &offset, IS_NOT_ENHANCED);
2420 break;
2422 case ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE_RESPONSE:
2423 dissect_zcl_scenes_view_scene_response(tvb, payload_tree, &offset, IS_ENHANCED);
2424 break;
2426 case ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES_RESPONSE:
2427 dissect_zcl_scenes_remove_all_scenes_response(tvb, payload_tree, &offset);
2428 break;
2430 case ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP_RESPONSE:
2431 dissect_zcl_scenes_get_scene_membership_response(tvb, payload_tree, &offset);
2432 break;
2434 case ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE_RESPONSE:
2435 dissect_zcl_scenes_copy_scene_response(tvb, payload_tree, &offset);
2436 break;
2438 default:
2439 break;
2444 return tvb_captured_length(tvb);
2445 } /*dissect_zbee_zcl_scenes*/
2448 /*FUNCTION:------------------------------------------------------
2449 * NAME
2450 * dissect_zcl_scenes_add_scene
2451 * DESCRIPTION
2452 * this function decodes the Add Scene payload.
2453 * PARAMETERS
2454 * tvb - the tv buffer of the current data_type
2455 * tree - the tree to append this item to
2456 * offset - offset of data in tvb
2457 * enhanced - use enhanced transition time
2458 * RETURNS
2459 * none
2460 *---------------------------------------------------------------
2462 static void
2463 dissect_zcl_scenes_add_scene(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool enhanced)
2465 unsigned attr_uint;
2466 uint8_t *attr_string;
2468 /* Retrieve "Group ID" field */
2469 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2470 *offset += 2;
2472 /* Retrieve "Scene ID" field */
2473 proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2474 *offset += 1;
2476 /* Retrieve "Transition Time" field */
2477 proto_tree_add_item(tree, enhanced ? hf_zbee_zcl_scenes_enh_transit_time : hf_zbee_zcl_scenes_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2478 *offset += 2;
2480 /* Retrieve Scene Name */
2481 attr_uint = tvb_get_uint8(tvb, *offset); /* string length */
2482 if (attr_uint == 0xff) attr_uint = 0;
2484 proto_tree_add_uint(tree, hf_zbee_zcl_scenes_attr_str_len, tvb, *offset, 1, attr_uint);
2486 *offset += 1;
2488 attr_string = tvb_get_string_enc(wmem_packet_scope(), tvb, *offset, attr_uint, ENC_ASCII);
2490 proto_item_append_text(tree, ", String: %s", attr_string);
2491 proto_tree_add_string(tree, hf_zbee_zcl_scenes_attr_str, tvb, *offset, attr_uint, attr_string);
2493 *offset += attr_uint;
2495 /* Retrieve "Extension Set" field */
2496 dissect_zcl_scenes_extension_fields(tvb, tree, offset);
2498 } /*dissect_zcl_scenes_add_scene*/
2501 /*FUNCTION:--------------------------------------------------------------------
2502 * NAME
2503 * dissect_zcl_scenes_view_remove_store_recall_scene
2504 * DESCRIPTION
2505 * this function decodes the View, Remove, Store and Recall Scene payload.
2506 * PARAMETERS
2507 * tvb - the tv buffer of the current data_type
2508 * tree - the tree to append this item to
2509 * offset - offset of data in tvb
2510 * RETURNS
2511 * none
2512 *------------------------------------------------------------------------------
2514 static void
2515 dissect_zcl_scenes_view_remove_store_recall_scene(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2517 /* Retrieve "Group ID" field */
2518 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2519 *offset += 2;
2521 /* Retrieve "Scene ID" field */
2522 proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2523 *offset += 1;
2525 } /*dissect_zcl_scenes_view_remove_store_recall_scene*/
2528 /*FUNCTION:-------------------------------------------------------------------
2529 * NAME
2530 * dissect_zcl_scenes_remove_all_get_scene_membership
2531 * DESCRIPTION
2532 * this function decodes the Remove all and Get Scene Membership payload.
2533 * PARAMETERS
2534 * tvb - the tv buffer of the current data_type
2535 * tree - the tree to append this item to
2536 * offset - offset of data in tvb
2537 * RETURNS
2538 * none
2539 *-----------------------------------------------------------------------------
2541 static void
2542 dissect_zcl_scenes_remove_all_get_scene_membership(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2544 /* Retrieve "Group ID" field */
2545 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2546 *offset += 2;
2548 } /*dissect_zcl_scenes_remove_all_get_scene_membership*/
2551 /*FUNCTION:--------------------------------------------------------------------
2552 * NAME
2553 * dissect_zcl_scenes_copy_scene
2554 * DESCRIPTION
2555 * this function decodes the Copy Scene payload.
2556 * PARAMETERS
2557 * tvb - the tv buffer of the current data_type
2558 * tree - the tree to append this item to
2559 * offset - offset of data in tvb
2560 * RETURNS
2561 * none
2562 *------------------------------------------------------------------------------
2564 static void
2565 dissect_zcl_scenes_copy_scene(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2567 /* Retrieve "Mode" field */
2568 proto_tree_add_item(tree, hf_zbee_zcl_scenes_copy_mode, tvb, *offset, 1, ENC_NA);
2569 *offset += 1;
2571 /* Retrieve "Group ID From" field */
2572 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id_from, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2573 *offset += 2;
2575 /* Retrieve "Scene ID From" field */
2576 proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id_from, tvb, *offset, 1, ENC_NA);
2577 *offset += 1;
2579 /* Retrieve "Group ID To" field */
2580 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id_to, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2581 *offset += 2;
2583 /* Retrieve "Scene ID To" field */
2584 proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id_to, tvb, *offset, 1, ENC_NA);
2585 *offset += 1;
2587 } /*dissect_zcl_scenes_copy_scene*/
2590 /*FUNCTION:------------------------------------------------------
2591 * NAME
2592 * dissect_zcl_scenes_add_remove_store_scene_response
2593 * DESCRIPTION
2594 * this function decodes the Add, Remove, Store Scene payload.
2595 * PARAMETERS
2596 * tvb - the tv buffer of the current data_type
2597 * tree - the tree to append this item to
2598 * offset - offset of data in tvb
2599 * RETURNS
2600 * none
2601 *---------------------------------------------------------------
2603 static void
2604 dissect_zcl_scenes_add_remove_store_scene_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2606 /* Retrieve "Status" field */
2607 proto_tree_add_item(tree, hf_zbee_zcl_scenes_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2608 *offset += 1;
2610 /* Retrieve "Group ID" field */
2611 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2612 *offset += 2;
2614 /* Retrieve "Scene ID" field */
2615 proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2616 *offset += 1;
2618 } /*dissect_zcl_scenes_add_remove_store_scene_response*/
2621 /*FUNCTION:------------------------------------------------------
2622 * NAME
2623 * dissect_zcl_scenes_view_scene_response
2624 * DESCRIPTION
2625 * this function decodes the View Scene Response payload.
2626 * PARAMETERS
2627 * tvb - the tv buffer of the current data_type
2628 * tree - the tree to append this item to
2629 * offset - offset of data in tvb
2630 * enhanced - use enhanced transition time
2631 * RETURNS
2632 * none
2633 *---------------------------------------------------------------
2635 static void
2636 dissect_zcl_scenes_view_scene_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool enhanced)
2638 uint8_t status, *attr_string;
2639 unsigned attr_uint;
2641 /* Retrieve "Status" field */
2642 status = tvb_get_uint8(tvb, *offset);
2643 proto_tree_add_item(tree, hf_zbee_zcl_scenes_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2644 *offset += 1;
2646 /* Retrieve "Group ID" field */
2647 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2648 *offset += 2;
2650 /* Retrieve "Scene ID" field */
2651 proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2652 *offset += 1;
2654 if(status == ZBEE_ZCL_STAT_SUCCESS)
2656 /* Retrieve "Transition Time" field */
2657 proto_tree_add_item(tree, enhanced ? hf_zbee_zcl_scenes_enh_transit_time : hf_zbee_zcl_scenes_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2658 *offset += 2;
2660 /* Retrieve Scene Name */
2661 attr_uint = tvb_get_uint8(tvb, *offset); /* string length */
2662 if (attr_uint == 0xff) attr_uint = 0;
2664 proto_tree_add_uint(tree, hf_zbee_zcl_scenes_attr_str_len, tvb, *offset, 1, attr_uint);
2666 *offset += 1;
2668 attr_string = tvb_get_string_enc(wmem_packet_scope(), tvb, *offset, attr_uint, ENC_ASCII);
2670 proto_item_append_text(tree, ", String: %s", attr_string);
2671 proto_tree_add_string(tree, hf_zbee_zcl_scenes_attr_str, tvb, *offset, attr_uint, attr_string);
2673 *offset += attr_uint;
2675 /* Retrieve "Extension Set" field */
2676 dissect_zcl_scenes_extension_fields(tvb, tree, offset);
2680 } /*dissect_zcl_scenes_view_scene_response*/
2683 /*FUNCTION:------------------------------------------------------
2684 * NAME
2685 * dissect_zcl_scenes_remove_all_scenes_response
2686 * DESCRIPTION
2687 * this function decodes the Remove All Scenes Response payload
2688 * PARAMETERS
2689 * tvb - the tv buffer of the current data_type
2690 * tree - the tree to append this item to
2691 * offset - offset of data in tvb
2692 * RETURNS
2693 * none
2694 *---------------------------------------------------------------
2696 static void
2697 dissect_zcl_scenes_remove_all_scenes_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2699 /* Retrieve "Status" field */
2700 proto_tree_add_item(tree, hf_zbee_zcl_scenes_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2701 *offset += 1;
2703 /* Retrieve "Group ID" field */
2704 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2705 *offset += 2;
2707 } /*dissect_zcl_scenes_remove_all_scenes_response*/
2710 /*FUNCTION:------------------------------------------------------
2711 * NAME
2712 * dissect_zcl_scenes_get_scene_membership_response
2713 * DESCRIPTION
2714 * this function decodes the Get Scene Membership Response payload.
2715 * PARAMETERS
2716 * tvb - the tv buffer of the current data_type
2717 * tree - the tree to append this item to
2718 * offset - offset of data in tvb
2719 * RETURNS
2720 * none
2721 *---------------------------------------------------------------
2723 static void
2724 dissect_zcl_scenes_get_scene_membership_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2726 proto_item *scene_list;
2727 proto_tree *scene_list_tree;
2728 uint8_t status, count, i;
2730 /* Retrieve "Status" field */
2731 status = tvb_get_uint8(tvb, *offset);
2732 proto_tree_add_item(tree, hf_zbee_zcl_scenes_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2733 *offset += 1;
2735 /* Retrieve "Capacity" field */
2736 proto_tree_add_item(tree, hf_zbee_zcl_scenes_capacity, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2737 *offset += 1;
2739 /* Retrieve "Group ID" field */
2740 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2741 *offset += 2;
2743 if(status == ZBEE_ZCL_STAT_SUCCESS)
2745 /* Retrieve "Scene Count" field */
2746 count = tvb_get_uint8(tvb, *offset);
2747 proto_tree_add_uint(tree, hf_zbee_zcl_scenes_scene_count, tvb, *offset, 1, count);
2748 *offset += 1;
2750 if(count>0)
2752 scene_list=proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_list, tvb, *offset, count, ENC_NA);
2753 scene_list_tree = proto_item_add_subtree(scene_list, ett_zbee_zcl_scenes_scene_ctrl);
2754 /* Retrieve "Scene List" */
2755 for( i = 0; i < count; i++)
2757 proto_tree_add_item(scene_list_tree, hf_zbee_zcl_scenes_scene_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2758 *offset += 1;
2763 } /*dissect_zcl_scenes_get_scene_membership_response*/
2766 /*FUNCTION:------------------------------------------------------
2767 * NAME
2768 * dissect_zcl_scenes_copy_scene_response
2769 * DESCRIPTION
2770 * this function decodes the Copy Scene payload.
2771 * PARAMETERS
2772 * tvb - the tv buffer of the current data_type
2773 * tree - the tree to append this item to
2774 * offset - offset of data in tvb
2775 * RETURNS
2776 * none
2777 *---------------------------------------------------------------
2779 static void
2780 dissect_zcl_scenes_copy_scene_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2782 /* Retrieve "Status" field */
2783 proto_tree_add_item(tree, hf_zbee_zcl_scenes_status, tvb, *offset, 1, ENC_NA);
2784 *offset += 1;
2786 /* Retrieve "Group ID From" field */
2787 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id_from, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2788 *offset += 2;
2790 /* Retrieve "Scene ID From" field */
2791 proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id_from, tvb, *offset, 1, ENC_NA);
2792 *offset += 1;
2794 } /*dissect_zcl_scenes_copy_scene_response*/
2797 /*FUNCTION:------------------------------------------------------
2798 * NAME
2799 * dissect_zcl_scenes_extension_fields
2800 * DESCRIPTION
2801 * this function decodes the extension set fields
2802 * PARAMETERS
2803 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
2804 * tvbuff_t *tvb - pointer to buffer containing raw packet.
2805 * unsigned *offset - pointer to buffer offset
2806 * RETURNS
2807 * none
2808 *---------------------------------------------------------------
2810 static void dissect_zcl_scenes_extension_fields(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2812 uint8_t set = 1;
2813 proto_tree *subtree;
2815 // Is there an extension field?
2816 bool hasExtensionField = tvb_offset_exists(tvb, *offset+2);
2818 while (hasExtensionField)
2820 // Retrieve the cluster and the length
2821 uint32_t cluster = tvb_get_uint16(tvb, *offset, ENC_LITTLE_ENDIAN);
2822 uint8_t length = tvb_get_uint8 (tvb, *offset+2);
2824 // Create a subtree
2825 subtree = proto_tree_add_subtree_format(tree, tvb, *offset, length, ett_zbee_zcl_scenes_extension_field_set, NULL, "Extension field set %d", set++);
2826 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_cluster, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2827 *offset += 3;
2829 switch (cluster)
2831 case ZBEE_ZCL_CID_ON_OFF:
2832 if (length >= 1)
2834 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_onoff, tvb, *offset, 1, ENC_NA);
2835 length -= 1;
2836 *offset += 1;
2838 break;
2840 case ZBEE_ZCL_CID_LEVEL_CONTROL:
2841 if (length >= 1)
2843 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_level, tvb, *offset, 1, ENC_NA);
2844 length -= 1;
2845 *offset += 1;
2847 break;
2849 case ZBEE_ZCL_CID_COLOR_CONTROL:
2850 if (length >= 2)
2852 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_x, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2853 length -= 2;
2854 *offset += 2;
2856 if (length >= 2)
2858 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_y, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2859 length -= 2;
2860 *offset += 2;
2862 if (length >= 2)
2864 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_hue, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2865 length -= 2;
2866 *offset += 2;
2868 if (length >= 1)
2870 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_saturation, tvb, *offset, 1, ENC_NA);
2871 length -= 1;
2872 *offset += 1;
2874 if (length >= 1)
2876 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_color_loop_active, tvb, *offset, 1, ENC_NA);
2877 length -= 1;
2878 *offset += 1;
2880 if (length >= 1)
2882 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_color_loop_direction, tvb, *offset, 1, ENC_NA);
2883 length -= 1;
2884 *offset += 1;
2886 if (length >= 2)
2888 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_color_loop_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2889 length -= 2;
2890 *offset += 2;
2892 break;
2894 case ZBEE_ZCL_CID_DOOR_LOCK:
2895 if (length >= 1)
2897 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_lock_state, tvb, *offset, 1, ENC_NA);
2898 length -= 1;
2899 *offset += 1;
2901 break;
2903 case ZBEE_ZCL_CID_WINDOW_COVERING:
2904 if (length >= 1)
2906 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_lift_percentage, tvb, *offset, 1, ENC_NA);
2907 length -= 1;
2908 *offset += 1;
2910 if (length >= 1)
2912 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_tilt_percentage, tvb, *offset, 1, ENC_NA);
2913 length -= 1;
2914 *offset += 1;
2916 break;
2918 case ZBEE_ZCL_CID_THERMOSTAT:
2919 if (length >= 2)
2921 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_cooling_setpoint, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2922 length -= 2;
2923 *offset += 2;
2925 if (length >= 2)
2927 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_heating_setpoint, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2928 length -= 2;
2929 *offset += 2;
2931 if (length >= 1)
2933 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_system_mode, tvb, *offset, 1, ENC_NA);
2934 length -= 1;
2935 *offset += 1;
2937 break;
2940 *offset += length;
2941 hasExtensionField = tvb_offset_exists(tvb, *offset+2);
2946 /*FUNCTION:------------------------------------------------------
2947 * NAME
2948 * dissect_zcl_scenes_attr_data
2949 * DESCRIPTION
2950 * this function is called by ZCL foundation dissector in order to decode
2951 * specific cluster attributes data.
2952 * PARAMETERS
2953 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
2954 * tvbuff_t *tvb - pointer to buffer containing raw packet.
2955 * unsigned *offset - pointer to buffer offset
2956 * uint16_t attr_id - attribute identifier
2957 * unsigned data_type - attribute data type
2958 * bool client_attr- ZCL client
2959 * RETURNS
2960 * none
2961 *---------------------------------------------------------------
2963 void
2964 dissect_zcl_scenes_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
2966 /* Dissect attribute data type and data */
2967 switch ( attr_id ) {
2969 case ZBEE_ZCL_ATTR_ID_SCENES_SCENE_VALID:
2970 proto_tree_add_item(tree, hf_zbee_zcl_scenes_attr_id_scene_valid, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2971 *offset += 1;
2972 break;
2974 case ZBEE_ZCL_ATTR_ID_SCENES_NAME_SUPPORT:
2975 proto_tree_add_item(tree, hf_zbee_zcl_scenes_attr_id_name_support, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2976 *offset += 1;
2977 break;
2979 case ZBEE_ZCL_ATTR_ID_SCENES_SCENE_COUNT:
2980 case ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_SCENE:
2981 case ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_GROUP:
2982 case ZBEE_ZCL_ATTR_ID_SCENES_LAST_CONFIGURED_BY:
2983 default:
2984 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
2985 break;
2988 } /*dissect_zcl_scenes_attr_data*/
2991 /*FUNCTION:------------------------------------------------------
2992 * NAME
2993 * proto_register_zbee_zcl_scenes
2994 * DESCRIPTION
2995 * ZigBee ZCL Scenes cluster protocol registration routine.
2996 * PARAMETERS
2997 * none
2998 * RETURNS
2999 * void
3000 *---------------------------------------------------------------
3002 void
3003 proto_register_zbee_zcl_scenes(void)
3005 /* Setup list of header fields */
3006 static hf_register_info hf[] = {
3008 { &hf_zbee_zcl_scenes_attr_id,
3009 { "Attribute", "zbee_zcl_general.scenes.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_scenes_attr_names),
3010 0x00, NULL, HFILL } },
3012 { &hf_zbee_zcl_scenes_scene_list,
3013 {"Scene List", "zbee_zcl_general.groups.scene_list",FT_NONE,BASE_NONE, NULL,
3014 0x00, NULL, HFILL } },
3016 { &hf_zbee_zcl_scenes_group_id,
3017 { "Group ID", "zbee_zcl_general.scenes.group_id", FT_UINT16, BASE_HEX, NULL,
3018 0x00, NULL, HFILL } },
3020 { &hf_zbee_zcl_scenes_group_id_from,
3021 { "Group ID From", "zbee_zcl_general.scenes.group_id_from", FT_UINT16, BASE_HEX, NULL,
3022 0x00, NULL, HFILL } },
3024 { &hf_zbee_zcl_scenes_group_id_to,
3025 { "Group ID To", "zbee_zcl_general.scenes.group_id_to", FT_UINT16, BASE_HEX, NULL,
3026 0x00, NULL, HFILL } },
3028 { &hf_zbee_zcl_scenes_scene_id,
3029 { "Scene ID", "zbee_zcl_general.scenes.scene_id", FT_UINT8, BASE_HEX, NULL,
3030 0x00, NULL, HFILL } },
3032 { &hf_zbee_zcl_scenes_scene_id_from,
3033 { "Scene ID From", "zbee_zcl_general.scenes.scene_id_from", FT_UINT8, BASE_HEX, NULL,
3034 0x00, NULL, HFILL } },
3036 { &hf_zbee_zcl_scenes_scene_id_to,
3037 { "Scene ID To", "zbee_zcl_general.scenes.scene_id_to", FT_UINT8, BASE_HEX, NULL,
3038 0x00, NULL, HFILL } },
3040 { &hf_zbee_zcl_scenes_transit_time,
3041 { "Transition Time", "zbee_zcl_general.scenes.transit_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_seconds),
3042 0x00, NULL, HFILL } },
3044 { &hf_zbee_zcl_scenes_enh_transit_time,
3045 { "Transition Time", "zbee_zcl_general.scenes.enh_transit_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms),
3046 0x00, NULL, HFILL } },
3048 { &hf_zbee_zcl_scenes_status,
3049 { "Scenes Status", "zbee_zcl_general.scenes.scenes_status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names),
3050 0x00, NULL, HFILL } },
3052 { &hf_zbee_zcl_scenes_capacity,
3053 { "Scene Capacity", "zbee_zcl_general.scenes.scene_capacity", FT_UINT8, BASE_DEC, NULL,
3054 0x00, NULL, HFILL } },
3056 { &hf_zbee_zcl_scenes_scene_count,
3057 { "Scene Count", "zbee_zcl_general.scenes.scene_count", FT_UINT8, BASE_DEC, NULL,
3058 0x00, NULL, HFILL } },
3060 { &hf_zbee_zcl_scenes_attr_id_name_support,
3061 { "Scene Name Support", "zbee_zcl_general.scenes.attr.name_support", FT_UINT8, BASE_HEX, VALS(zbee_zcl_scenes_group_names_support_values),
3062 ZBEE_ZCL_CMD_ID_SCENES_NAME_SUPPORT_MASK, NULL, HFILL } },
3064 { &hf_zbee_zcl_scenes_attr_id_scene_valid,
3065 { "Scene Valid", "zbee_zcl_general.scenes.scene_valid", FT_BOOLEAN, 8, NULL,
3066 ZBEE_ZCL_ATTR_SCENES_SCENE_VALID_MASK, NULL, HFILL } },
3068 { &hf_zbee_zcl_scenes_attr_str_len,
3069 { "Length", "zbee_zcl_general.scenes.attr_str_len", FT_UINT8, BASE_DEC, NULL,
3070 0x00, NULL, HFILL }},
3072 { &hf_zbee_zcl_scenes_attr_str,
3073 { "String", "zbee_zcl_general.scenes.attr_str", FT_STRING, BASE_NONE, NULL,
3074 0x00, NULL, HFILL }},
3076 { &hf_zbee_zcl_scenes_extension_set_cluster,
3077 { "Cluster", "zbee_zcl_general.scenes.extension_set.cluster", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_aps_cid_names),
3078 0x00, NULL, HFILL }},
3080 { &hf_zbee_zcl_scenes_extension_set_onoff,
3081 { "On/Off", "zbee_zcl_general.scenes.extension_set.onoff", FT_UINT8, BASE_DEC, NULL,
3082 0x00, NULL, HFILL }},
3084 { &hf_zbee_zcl_scenes_extension_set_level,
3085 { "Level", "zbee_zcl_general.scenes.extension_set.level", FT_UINT8, BASE_DEC, NULL,
3086 0x00, NULL, HFILL }},
3088 { &hf_zbee_zcl_scenes_extension_set_x,
3089 { "Color X", "zbee_zcl_general.scenes.extension_set.color_x", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
3090 0x00, NULL, HFILL }},
3092 { &hf_zbee_zcl_scenes_extension_set_y,
3093 { "Color Y", "zbee_zcl_general.scenes.extension_set.color_y", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
3094 0x00, NULL, HFILL }},
3096 { &hf_zbee_zcl_scenes_extension_set_hue,
3097 { "Enhanced Hue", "zbee_zcl_general.scenes.extension_set.hue", FT_UINT16, BASE_DEC, NULL,
3098 0x00, NULL, HFILL }},
3100 { &hf_zbee_zcl_scenes_extension_set_saturation,
3101 { "Saturation", "zbee_zcl_general.scenes.extension_set.saturation", FT_UINT8, BASE_DEC, NULL,
3102 0x00, NULL, HFILL }},
3104 { &hf_zbee_zcl_scenes_extension_set_color_loop_active,
3105 { "Color Loop Active", "zbee_zcl_general.scenes.extension_set.color_loop_active", FT_BOOLEAN, BASE_NONE, NULL,
3106 0x00, NULL, HFILL }},
3108 { &hf_zbee_zcl_scenes_extension_set_color_loop_direction,
3109 { "Color Loop Direction", "zbee_zcl_general.scenes.extension_set.color_loop_direction", FT_UINT8, BASE_DEC, VALS(zbee_zcl_scenes_color_loop_direction_values),
3110 0x00, NULL, HFILL }},
3112 { &hf_zbee_zcl_scenes_extension_set_color_loop_time,
3113 { "Color Loop Time", "zbee_zcl_general.scenes.extension_set.color_loop_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_seconds),
3114 0x00, NULL, HFILL }},
3116 { &hf_zbee_zcl_scenes_extension_set_lock_state,
3117 { "Lock State", "zbee_zcl_general.scenes.extension_set.lock_state", FT_UINT8, BASE_DEC, NULL,
3118 0x00, NULL, HFILL }},
3120 { &hf_zbee_zcl_scenes_extension_set_lift_percentage,
3121 { "Current Position Lift Percentage", "zbee_zcl_general.scenes.extension_set.current_position_lift_percentage", FT_UINT8, BASE_DEC, NULL,
3122 0x00, NULL, HFILL }},
3124 { &hf_zbee_zcl_scenes_extension_set_tilt_percentage,
3125 { "Current Position Tilt Percentage", "zbee_zcl_general.scenes.extension_set.current_position_tilt_percentage", FT_UINT8, BASE_DEC, NULL,
3126 0x00, NULL, HFILL }},
3128 { &hf_zbee_zcl_scenes_extension_set_cooling_setpoint,
3129 { "Occupied Cooling Setpoint", "zbee_zcl_general.scenes.extension_set.occupied_cooling_setpoint", FT_INT16, BASE_CUSTOM, CF_FUNC(decode_setpoint),
3130 0x00, NULL, HFILL }},
3132 { &hf_zbee_zcl_scenes_extension_set_heating_setpoint,
3133 { "Occupied Heating Setpoint", "zbee_zcl_general.scenes.extension_set.occupied_heating_setpoint", FT_INT16, BASE_CUSTOM, CF_FUNC(decode_setpoint),
3134 0x00, NULL, HFILL }},
3136 { &hf_zbee_zcl_scenes_extension_set_system_mode,
3137 { "System Mode", "zbee_zcl_general.scenes.extension_set.system_mode", FT_UINT8, BASE_DEC, NULL,
3138 0x00, NULL, HFILL }},
3140 { &hf_zbee_zcl_scenes_copy_mode,
3141 { "Scene Copy Mode", "zbee_zcl_general.scenes.copy_mode", FT_UINT8, BASE_DEC, VALS(zbee_zcl_scenes_copy_mode_values),
3142 0x00, NULL, HFILL } },
3144 { &hf_zbee_zcl_scenes_srv_rx_cmd_id,
3145 { "Command", "zbee_zcl_general.scenes.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_scenes_srv_rx_cmd_names),
3146 0x00, NULL, HFILL } },
3148 { &hf_zbee_zcl_scenes_srv_tx_cmd_id,
3149 { "Command", "zbee_zcl_general.scenes.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_scenes_srv_tx_cmd_names),
3150 0x00, NULL, HFILL } }
3154 /* ZCL Scenes subtrees */
3155 static int *ett[] = {
3156 &ett_zbee_zcl_scenes,
3157 &ett_zbee_zcl_scenes_scene_ctrl,
3158 &ett_zbee_zcl_scenes_extension_field_set
3161 /* Register the ZigBee ZCL Scenes cluster protocol name and description */
3162 proto_zbee_zcl_scenes = proto_register_protocol("ZigBee ZCL Scenes", "ZCL Scenes", ZBEE_PROTOABBREV_ZCL_SCENES);
3163 proto_register_field_array(proto_zbee_zcl_scenes, hf, array_length(hf));
3164 proto_register_subtree_array(ett, array_length(ett));
3166 /* Register the ZigBee ZCL Scenes dissector. */
3167 register_dissector(ZBEE_PROTOABBREV_ZCL_SCENES, dissect_zbee_zcl_scenes, proto_zbee_zcl_scenes);
3169 } /*proto_register_zbee_zcl_scenes*/
3172 /*FUNCTION:------------------------------------------------------
3173 * NAME
3174 * proto_reg_handoff_zbee_zcl_scenes
3175 * DESCRIPTION
3176 * Hands off the ZCL Scenes dissector.
3177 * PARAMETERS
3178 * none
3179 * RETURNS
3180 * none
3181 *---------------------------------------------------------------
3183 void
3184 proto_reg_handoff_zbee_zcl_scenes(void)
3187 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_SCENES,
3188 proto_zbee_zcl_scenes,
3189 ett_zbee_zcl_scenes,
3190 ZBEE_ZCL_CID_SCENES,
3191 ZBEE_MFG_CODE_NONE,
3192 hf_zbee_zcl_scenes_attr_id,
3193 hf_zbee_zcl_scenes_attr_id,
3194 hf_zbee_zcl_scenes_srv_rx_cmd_id,
3195 hf_zbee_zcl_scenes_srv_tx_cmd_id,
3196 (zbee_zcl_fn_attr_data)dissect_zcl_scenes_attr_data
3198 } /*proto_reg_handoff_zbee_zcl_scenes*/
3201 /* ########################################################################## */
3202 /* #### (0x0006) ON/OFF CLUSTER ############################################# */
3203 /* ########################################################################## */
3205 /*************************/
3206 /* Defines */
3207 /*************************/
3209 /* Attributes */
3210 #define ZBEE_ZCL_ON_OFF_ATTR_ID_ONOFF 0x0000
3211 #define ZBEE_ZCL_ON_OFF_ATTR_ID_GLOBALSCENECONTROL 0x4000
3212 #define ZBEE_ZCL_ON_OFF_ATTR_ID_ONTIME 0x4001
3213 #define ZBEE_ZCL_ON_OFF_ATTR_ID_OFFWAITTIME 0x4002
3214 #define ZBEE_ZCL_ON_OFF_ATTR_ID_STARTUPONOFF 0x4003
3216 /* Server Commands Received */
3217 #define ZBEE_ZCL_ON_OFF_CMD_OFF 0x00 /* Off */
3218 #define ZBEE_ZCL_ON_OFF_CMD_ON 0x01 /* On */
3219 #define ZBEE_ZCL_ON_OFF_CMD_TOGGLE 0x02 /* Toggle */
3220 #define ZBEE_ZCL_ON_OFF_CMD_OFF_WITH_EFFECT 0x40 /* Off with effect */
3221 #define ZBEE_ZCL_ON_OFF_CMD_ON_WITH_RECALL_GLOBAL_SCENE 0x41 /* On with recall global scene */
3222 #define ZBEE_ZCL_ON_OFF_CMD_ON_WITH_TIMED_OFF 0x42 /* On with timed off */
3224 /* On/Off Control Field */
3225 #define ZBEE_ZCL_ON_OFF_TIMED_OFF_CONTROL_MASK_ACCEPT_ONLY_WHEN_ON 0x01
3226 #define ZBEE_ZCL_ON_OFF_TIMED_OFF_CONTROL_MASK_RESERVED 0xFE
3228 /*************************/
3229 /* Function Declarations */
3230 /*************************/
3232 void proto_register_zbee_zcl_on_off(void);
3233 void proto_reg_handoff_zbee_zcl_on_off(void);
3235 /* Command Dissector Helpers */
3236 static void dissect_zcl_on_off_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
3238 /* Private functions prototype */
3240 /*************************/
3241 /* Global Variables */
3242 /*************************/
3244 /* Initialize the protocol and registered fields */
3245 static int proto_zbee_zcl_on_off;
3247 static int hf_zbee_zcl_on_off_attr_id;
3248 static int hf_zbee_zcl_on_off_attr_onoff;
3249 static int hf_zbee_zcl_on_off_attr_globalscenecontrol;
3250 static int hf_zbee_zcl_on_off_attr_ontime;
3251 static int hf_zbee_zcl_on_off_attr_offwaittime;
3252 static int hf_zbee_zcl_on_off_attr_startuponoff;
3253 static int hf_zbee_zcl_on_off_srv_rx_cmd_id;
3255 static int hf_zbee_zcl_on_off_effect_identifier;
3256 static int hf_zbee_zcl_on_off_effect_variant_delayed_all_off;
3257 static int hf_zbee_zcl_on_off_effect_variant_dying_light;
3258 static int hf_zbee_zcl_on_off_effect_variant_reserved;
3260 static int hf_zbee_zcl_on_off_timed_off_control_mask;
3261 static int hf_zbee_zcl_on_off_timed_off_control_mask_accept_only_when_on;
3262 static int hf_zbee_zcl_on_off_timed_off_control_mask_reserved;
3264 /* Initialize the subtree pointers */
3265 static int ett_zbee_zcl_on_off;
3266 static int ett_zbee_zcl_on_off_timed_off_control_mask;
3268 /* Attributes */
3269 static const value_string zbee_zcl_on_off_attr_names[] = {
3270 { ZBEE_ZCL_ON_OFF_ATTR_ID_ONOFF, "OnOff" },
3271 { ZBEE_ZCL_ON_OFF_ATTR_ID_GLOBALSCENECONTROL, "GlobalSceneControl" },
3272 { ZBEE_ZCL_ON_OFF_ATTR_ID_ONTIME, "OnTime" },
3273 { ZBEE_ZCL_ON_OFF_ATTR_ID_OFFWAITTIME, "OffWaitTime" },
3274 { ZBEE_ZCL_ON_OFF_ATTR_ID_STARTUPONOFF, "StartUpOnOff" },
3275 { 0, NULL }
3278 /* Server Commands Generated */
3279 static const value_string zbee_zcl_on_off_srv_rx_cmd_names[] = {
3280 { ZBEE_ZCL_ON_OFF_CMD_OFF, "Off" },
3281 { ZBEE_ZCL_ON_OFF_CMD_ON, "On" },
3282 { ZBEE_ZCL_ON_OFF_CMD_TOGGLE, "Toggle" },
3283 { ZBEE_ZCL_ON_OFF_CMD_OFF_WITH_EFFECT, "Off with effect" },
3284 { ZBEE_ZCL_ON_OFF_CMD_ON_WITH_RECALL_GLOBAL_SCENE, "On with recall global scene" },
3285 { ZBEE_ZCL_ON_OFF_CMD_ON_WITH_TIMED_OFF, "On with timed off" },
3286 { 0, NULL }
3289 static const range_string zbee_zcl_on_off_effect_identifier_names[] = {
3290 { 0x00, 0x00, "Delayed All Off" },
3291 { 0x01, 0x01, "Dying Light" },
3292 { 0x02, 0xFF, "Reserved" },
3293 { 0, 0, NULL }
3296 static const range_string zbee_zcl_on_off_effect_variant_delayed_all_off_names[] = {
3297 { 0x00, 0x00, "Fade to off in 0.8 seconds" },
3298 { 0x01, 0x01, "No fade" },
3299 { 0x02, 0x02, "50% dim down in 0.8 seconds then fade to off in 12 seconds" },
3300 { 0x03, 0xFF, "Reserved" },
3301 { 0, 0, NULL }
3304 static const range_string zbee_zcl_on_off_effect_variant_dying_light_names[] = {
3305 { 0x00, 0x00, "20% dim up in 0.5s then fade to off in 1 second" },
3306 { 0x01, 0xFF, "Reserved" },
3307 { 0, 0, NULL }
3310 static const range_string zbee_zcl_on_off_effect_variant_reserved_names[] = {
3311 { 0x00, 0xFF, "Reserved" },
3312 { 0, 0, NULL }
3315 static const range_string zbee_zcl_on_off_startup_on_off_names[] = {
3316 { 0x00, 0x00, "Set the OnOff attribute to Off" },
3317 { 0x01, 0x01, "Set the OnOff attribute to On" },
3318 { 0x02, 0x02, "Toggle the OnOff attribute" },
3319 { 0x03, 0xFE, "Reserved" },
3320 { 0xFF, 0xFF, "Set the OnOff attribute to its previous value" },
3321 { 0, 0, NULL }
3324 /*************************/
3325 /* Function Bodies */
3326 /*************************/
3328 /*FUNCTION:------------------------------------------------------
3329 * NAME
3330 * dissect_zbee_zcl_onoff
3331 * DESCRIPTION
3332 * ZigBee ZCL OnOff cluster dissector for wireshark.
3333 * PARAMETERS
3334 * tvbuff_t *tvb - pointer to buffer containing raw packet.
3335 * packet_info *pinfo - pointer to packet information fields
3336 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
3337 * void *data - pointer to ZCL packet structure.
3338 * RETURNS
3339 * int - length of parsed data.
3340 *---------------------------------------------------------------
3342 static int
3343 dissect_zbee_zcl_on_off(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
3345 proto_tree *payload_tree;
3346 zbee_zcl_packet *zcl;
3347 unsigned offset = 0;
3348 uint8_t cmd_id;
3349 int rem_len;
3350 uint8_t effect_identifier = 0;
3352 static int * const onoff_control_mask[] = {
3353 &hf_zbee_zcl_on_off_timed_off_control_mask_accept_only_when_on,
3354 &hf_zbee_zcl_on_off_timed_off_control_mask_reserved,
3355 NULL
3358 /* Reject the packet if data is NULL */
3359 if (data == NULL)
3360 return 0;
3361 zcl = (zbee_zcl_packet *)data;
3362 cmd_id = zcl->cmd_id;
3364 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
3365 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
3366 /* Append the command name to the info column. */
3367 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
3368 val_to_str_const(cmd_id, zbee_zcl_on_off_srv_rx_cmd_names, "Unknown Command"),
3369 zcl->tran_seqno);
3371 /* Add the command ID. */
3372 proto_tree_add_item(tree, hf_zbee_zcl_on_off_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3373 rem_len = tvb_reported_length_remaining(tvb, ++offset);
3374 if (rem_len > 0) {
3375 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_on_off, NULL, "Payload");
3377 switch (cmd_id) {
3378 case ZBEE_ZCL_ON_OFF_CMD_OFF_WITH_EFFECT:
3379 proto_tree_add_item(payload_tree, hf_zbee_zcl_on_off_effect_identifier, tvb, offset, 1, ENC_NA);
3380 effect_identifier = tvb_get_uint8(tvb, offset);
3381 offset += 1;
3382 switch (effect_identifier) {
3383 case 0x00:
3384 proto_tree_add_item(payload_tree, hf_zbee_zcl_on_off_effect_variant_delayed_all_off, tvb, offset, 1, ENC_NA);
3385 break;
3386 case 0x01:
3387 proto_tree_add_item(payload_tree, hf_zbee_zcl_on_off_effect_variant_dying_light, tvb, offset, 1, ENC_NA);
3388 break;
3389 default:
3390 proto_tree_add_item(payload_tree, hf_zbee_zcl_on_off_effect_variant_reserved, tvb, offset, 1, ENC_NA);
3391 break;
3393 break;
3395 case ZBEE_ZCL_ON_OFF_CMD_ON_WITH_TIMED_OFF:
3396 proto_tree_add_bitmask(payload_tree, tvb, offset, hf_zbee_zcl_on_off_timed_off_control_mask, ett_zbee_zcl_on_off_timed_off_control_mask, onoff_control_mask, ENC_LITTLE_ENDIAN);
3397 offset += 1;
3399 dissect_zcl_on_off_attr_data(payload_tree, tvb, &offset, ZBEE_ZCL_ON_OFF_ATTR_ID_ONTIME, FT_UINT16, false);
3400 dissect_zcl_on_off_attr_data(payload_tree, tvb, &offset, ZBEE_ZCL_ON_OFF_ATTR_ID_OFFWAITTIME, FT_UINT16, false);
3401 break;
3403 default:
3404 break;
3409 return tvb_captured_length(tvb);
3410 } /*dissect_zbee_zcl_on_off*/
3413 /*FUNCTION:------------------------------------------------------
3414 * NAME
3415 * dissect_zcl_on_off_attr_data
3416 * DESCRIPTION
3417 * this function is called by ZCL foundation dissector in order to decode
3418 * specific cluster attributes data.
3419 * PARAMETERS
3420 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
3421 * tvbuff_t *tvb - pointer to buffer containing raw packet.
3422 * unsigned *offset - pointer to buffer offset
3423 * uint16_t attr_id - attribute identifier
3424 * unsigned data_type - attribute data type
3425 * bool client_attr- ZCL client
3426 * RETURNS
3427 * none
3428 *---------------------------------------------------------------
3430 void
3431 dissect_zcl_on_off_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
3433 /* Dissect attribute data type and data */
3434 switch (attr_id) {
3436 case ZBEE_ZCL_ON_OFF_ATTR_ID_ONOFF:
3437 proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_onoff, tvb, *offset, 1, ENC_NA);
3438 *offset += 1;
3439 break;
3441 case ZBEE_ZCL_ON_OFF_ATTR_ID_GLOBALSCENECONTROL:
3442 proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_globalscenecontrol, tvb, *offset, 1, ENC_NA);
3443 *offset += 1;
3444 break;
3446 case ZBEE_ZCL_ON_OFF_ATTR_ID_ONTIME:
3447 proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_ontime, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
3448 *offset += 2;
3449 break;
3451 case ZBEE_ZCL_ON_OFF_ATTR_ID_OFFWAITTIME:
3452 proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_offwaittime, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
3453 *offset += 2;
3454 break;
3456 case ZBEE_ZCL_ON_OFF_ATTR_ID_STARTUPONOFF:
3457 proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_startuponoff, tvb, *offset, 1, ENC_NA);
3458 *offset += 1;
3459 break;
3461 default:
3462 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
3463 break;
3466 } /*dissect_zcl_on_off_attr_data*/
3468 /*FUNCTION:------------------------------------------------------
3469 * NAME
3470 * proto_register_zbee_zcl_on_off
3471 * DESCRIPTION
3472 * ZigBee ZCL OnOff cluster protocol registration routine.
3473 * PARAMETERS
3474 * none
3475 * RETURNS
3476 * void
3477 *---------------------------------------------------------------
3479 void
3480 proto_register_zbee_zcl_on_off(void)
3482 /* Setup list of header fields */
3483 static hf_register_info hf[] = {
3485 { &hf_zbee_zcl_on_off_attr_id,
3486 { "Attribute", "zbee_zcl_general.onoff.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_on_off_attr_names),
3487 0x00, NULL, HFILL } },
3489 { &hf_zbee_zcl_on_off_attr_onoff,
3490 { "On/off Control", "zbee_zcl_general.onoff.attr.onoff", FT_BOOLEAN, BASE_NONE, TFS(&tfs_on_off),
3491 0x00, NULL, HFILL } },
3493 { &hf_zbee_zcl_on_off_attr_globalscenecontrol,
3494 { "Global Scene Control", "zbee_zcl_general.onoff.attr.globalscenecontrol", FT_BOOLEAN, BASE_NONE, NULL,
3495 0x00, NULL, HFILL } },
3497 { &hf_zbee_zcl_on_off_attr_ontime,
3498 { "On Time", "zbee_zcl_general.onoff.attr.ontime", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms),
3499 0x00, NULL, HFILL } },
3501 { &hf_zbee_zcl_on_off_attr_offwaittime,
3502 { "Off Wait Time", "zbee_zcl_general.onoff.attr.offwaittime", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms),
3503 0x00, NULL, HFILL } },
3505 { &hf_zbee_zcl_on_off_attr_startuponoff,
3506 { "Startup On Off", "zbee_zcl_general.onoff.attr.startuponoff", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_zcl_on_off_startup_on_off_names),
3507 0x00, NULL, HFILL } },
3509 { &hf_zbee_zcl_on_off_effect_identifier,
3510 { "Effect Identifier", "zbee_zcl_general.onoff.effect_identifier", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_zcl_on_off_effect_identifier_names),
3511 0x00, NULL, HFILL } },
3513 { &hf_zbee_zcl_on_off_effect_variant_delayed_all_off,
3514 { "Effect Variant", "zbee_zcl_general.onoff.effect_variant", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_zcl_on_off_effect_variant_delayed_all_off_names),
3515 0x00, NULL, HFILL } },
3517 { &hf_zbee_zcl_on_off_effect_variant_dying_light,
3518 { "Effect Variant", "zbee_zcl_general.onoff.effect_variant", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_zcl_on_off_effect_variant_dying_light_names),
3519 0x00, NULL, HFILL } },
3521 { &hf_zbee_zcl_on_off_effect_variant_reserved,
3522 { "Effect Variant", "zbee_zcl_general.onoff.effect_variant", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_zcl_on_off_effect_variant_reserved_names),
3523 0x00, NULL, HFILL } },
3525 { &hf_zbee_zcl_on_off_timed_off_control_mask,
3526 { "On/Off Control Mask", "zbee_zcl_general.onoff.onoff_control_mask", FT_UINT8, BASE_HEX, NULL,
3527 0x00, NULL, HFILL } },
3529 { &hf_zbee_zcl_on_off_timed_off_control_mask_accept_only_when_on,
3530 { "Accept Only When On", "zbee_zcl_general.onoff.onoff_control_mask.accept_only_when_on", FT_UINT8, BASE_DEC, NULL,
3531 ZBEE_ZCL_ON_OFF_TIMED_OFF_CONTROL_MASK_ACCEPT_ONLY_WHEN_ON, NULL, HFILL } },
3533 { &hf_zbee_zcl_on_off_timed_off_control_mask_reserved,
3534 { "Reserved", "zbee_zcl_general.onoff.onoff_control_mask.reserved", FT_UINT8, BASE_DEC, NULL,
3535 ZBEE_ZCL_ON_OFF_TIMED_OFF_CONTROL_MASK_RESERVED, NULL, HFILL } },
3537 { &hf_zbee_zcl_on_off_srv_rx_cmd_id,
3538 { "Command", "zbee_zcl_general.onoff.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_on_off_srv_rx_cmd_names),
3539 0x00, NULL, HFILL } }
3543 /* ZCL OnOff subtrees */
3544 static int *ett[] = { &ett_zbee_zcl_on_off,
3545 &ett_zbee_zcl_on_off_timed_off_control_mask };
3547 /* Register the ZigBee ZCL OnOff cluster protocol name and description */
3548 proto_zbee_zcl_on_off = proto_register_protocol("ZigBee ZCL OnOff", "ZCL OnOff", ZBEE_PROTOABBREV_ZCL_ONOFF);
3549 proto_register_field_array(proto_zbee_zcl_on_off, hf, array_length(hf));
3550 proto_register_subtree_array(ett, array_length(ett));
3552 /* Register the ZigBee ZCL OnOff dissector. */
3553 register_dissector(ZBEE_PROTOABBREV_ZCL_ONOFF, dissect_zbee_zcl_on_off, proto_zbee_zcl_on_off);
3554 } /* proto_register_zbee_zcl_on_off */
3556 /*FUNCTION:------------------------------------------------------
3557 * NAME
3558 * proto_reg_handoff_zbee_zcl_on_off
3559 * DESCRIPTION
3560 * Hands off the Zcl OnOff cluster dissector.
3561 * PARAMETERS
3562 * none
3563 * RETURNS
3564 * void
3565 *---------------------------------------------------------------
3567 void
3568 proto_reg_handoff_zbee_zcl_on_off(void)
3570 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ONOFF,
3571 proto_zbee_zcl_on_off,
3572 ett_zbee_zcl_on_off,
3573 ZBEE_ZCL_CID_ON_OFF,
3574 ZBEE_MFG_CODE_NONE,
3575 hf_zbee_zcl_on_off_attr_id,
3576 hf_zbee_zcl_on_off_attr_id,
3577 hf_zbee_zcl_on_off_srv_rx_cmd_id,
3579 (zbee_zcl_fn_attr_data)dissect_zcl_on_off_attr_data
3581 } /*proto_reg_handoff_zbee_zcl_on_off*/
3583 /* ############################################################################################### */
3584 /* #### (0x0007) ON/OFF SWITCH CONFIGURATION CLUSTER ############################################# */
3585 /* ############################################################################################### */
3587 /*************************/
3588 /* Defines */
3589 /*************************/
3591 /* Attributes */
3592 #define ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_TYPE 0x0000 /* Switch Type */
3593 #define ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_ACTIONS 0x0010 /* Switch Actions */
3595 /* No Server Commands Received */
3597 /*************************/
3598 /* Function Declarations */
3599 /*************************/
3601 void proto_register_zbee_zcl_on_off_switch_configuration(void);
3602 void proto_reg_handoff_zbee_zcl_on_off_switch_configuration(void);
3604 /* Command Dissector Helpers */
3605 static void dissect_zcl_on_off_switch_configuration_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
3607 /* Private functions prototype */
3609 /*************************/
3610 /* Global Variables */
3611 /*************************/
3613 /* Initialize the protocol and registered fields */
3614 static int proto_zbee_zcl_on_off_switch_configuration;
3616 static int hf_zbee_zcl_on_off_switch_configuration_attr_id;
3617 static int hf_zbee_zcl_on_off_switch_configuration_attr_switch_type;
3618 static int hf_zbee_zcl_on_off_switch_configuration_attr_switch_actions;
3620 /* Initialize the subtree pointers */
3621 static int ett_zbee_zcl_on_off_switch_configuration;
3623 /* Attributes */
3624 static const value_string zbee_zcl_on_off_switch_configuration_attr_names[] = {
3625 { ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_TYPE, "Switch Type" },
3626 { ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_ACTIONS, "Switch Actions" },
3627 { 0, NULL }
3630 /* Switch Type Names */
3631 static const value_string zbee_zcl_on_off_switch_configuration_switch_type_names[] = {
3632 { 0x00, "Toggle" },
3633 { 0x01, "Momentary" },
3634 { 0, NULL }
3637 /* Switch Actions Names */
3638 static const value_string zbee_zcl_on_off_switch_configuration_switch_actions_names[] = {
3639 { 0x00, "On" },
3640 { 0x01, "Off" },
3641 { 0x02, "Toggle" },
3642 { 0, NULL }
3645 /*************************/
3646 /* Function Bodies */
3647 /*************************/
3649 /*FUNCTION:------------------------------------------------------
3650 * NAME
3651 * dissect_zbee_zcl_on_off_switch_configuration
3652 * DESCRIPTION
3653 * ZigBee ZCL OnOff Switch Configuration cluster dissector for wireshark.
3654 * PARAMETERS
3655 * tvbuff_t *tvb - pointer to buffer containing raw packet.
3656 * packet_info *pinfo - pointer to packet information fields
3657 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
3658 * RETURNS
3659 * int - length of parsed data.
3660 *---------------------------------------------------------------
3662 static int
3663 dissect_zbee_zcl_on_off_switch_configuration(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_)
3665 return tvb_captured_length(tvb);
3666 } /*dissect_zbee_zcl_on_off_switch_configuration*/
3669 /*FUNCTION:------------------------------------------------------
3670 * NAME
3671 * dissect_zcl_on_off_switch_configuration_attr_data
3672 * DESCRIPTION
3673 * this function is called by ZCL foundation dissector in order to decode
3674 * specific cluster attributes data.
3675 * PARAMETERS
3676 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
3677 * tvbuff_t *tvb - pointer to buffer containing raw packet.
3678 * unsigned *offset - pointer to buffer offset
3679 * uint16_t attr_id - attribute identifier
3680 * unsigned data_type - attribute data type
3681 * bool client_attr- ZCL client
3682 * RETURNS
3683 * none
3684 *---------------------------------------------------------------
3686 void
3687 dissect_zcl_on_off_switch_configuration_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
3689 /* Dissect attribute data type and data */
3690 switch (attr_id) {
3692 case ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_TYPE:
3693 proto_tree_add_item(tree, hf_zbee_zcl_on_off_switch_configuration_attr_switch_type, tvb, *offset, 1, ENC_NA);
3694 *offset += 1;
3695 break;
3697 case ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_ACTIONS:
3698 proto_tree_add_item(tree, hf_zbee_zcl_on_off_switch_configuration_attr_switch_actions, tvb, *offset, 1, ENC_NA);
3699 *offset += 1;
3700 break;
3702 default:
3703 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
3704 break;
3707 } /*dissect_zcl_on_off_switch_configuration_attr_data*/
3710 /*FUNCTION:------------------------------------------------------
3711 * NAME
3712 * proto_register_zbee_zcl_on_off_switch_configuration
3713 * DESCRIPTION
3714 * ZigBee ZCL OnOff cluster protocol registration routine.
3715 * PARAMETERS
3716 * none
3717 * RETURNS
3718 * void
3719 *---------------------------------------------------------------
3721 void
3722 proto_register_zbee_zcl_on_off_switch_configuration(void)
3724 /* Setup list of header fields */
3725 static hf_register_info hf[] = {
3727 { &hf_zbee_zcl_on_off_switch_configuration_attr_id,
3728 { "Attribute", "zbee_zcl_general.onoff_switch_configuration.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_on_off_switch_configuration_attr_names),
3729 0x00, NULL, HFILL } },
3731 { &hf_zbee_zcl_on_off_switch_configuration_attr_switch_type,
3732 { "Switch Type", "zbee_zcl_general.onoff.attr.switch_type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_on_off_switch_configuration_switch_type_names),
3733 0x00, NULL, HFILL } },
3735 { &hf_zbee_zcl_on_off_switch_configuration_attr_switch_actions,
3736 { "Switch Action", "zbee_zcl_general.onoff.attr.switch_actions", FT_UINT8, BASE_HEX, VALS(zbee_zcl_on_off_switch_configuration_switch_actions_names),
3737 0x00, NULL, HFILL } }
3741 /* ZCL Identify subtrees */
3742 static int *ett[] = {
3743 &ett_zbee_zcl_on_off_switch_configuration
3746 /* Register the ZigBee ZCL OnOff Switch Configuration cluster protocol name and description */
3747 proto_zbee_zcl_on_off_switch_configuration = proto_register_protocol("ZigBee ZCL OnOff Switch Configuration", "ZCL OnOff Switch Configuration", ZBEE_PROTOABBREV_ZCL_ONOFF_SWITCH_CONFIG);
3748 proto_register_field_array(proto_zbee_zcl_on_off_switch_configuration, hf, array_length(hf));
3749 proto_register_subtree_array(ett, array_length(ett));
3751 /* Register the ZigBee ZCL OnOff dissector. */
3752 register_dissector(ZBEE_PROTOABBREV_ZCL_ONOFF_SWITCH_CONFIG, dissect_zbee_zcl_on_off_switch_configuration, proto_zbee_zcl_on_off_switch_configuration);
3753 } /* proto_register_zbee_zcl_on_off_switch_configuration */
3755 /*FUNCTION:------------------------------------------------------
3756 * NAME
3757 * proto_reg_handoff_zbee_zcl_on_off_switch_configuration
3758 * DESCRIPTION
3759 * Hands off the Zcl OnOff cluster dissector.
3760 * PARAMETERS
3761 * none
3762 * RETURNS
3763 * none
3764 *---------------------------------------------------------------
3766 void
3767 proto_reg_handoff_zbee_zcl_on_off_switch_configuration(void)
3769 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ONOFF_SWITCH_CONFIG,
3770 proto_zbee_zcl_on_off_switch_configuration,
3771 ett_zbee_zcl_on_off_switch_configuration,
3772 ZBEE_ZCL_CID_ON_OFF_SWITCH_CONFIG,
3773 ZBEE_MFG_CODE_NONE,
3774 hf_zbee_zcl_on_off_switch_configuration_attr_id,
3775 hf_zbee_zcl_on_off_switch_configuration_attr_id,
3776 -1, -1,
3777 (zbee_zcl_fn_attr_data)dissect_zcl_on_off_switch_configuration_attr_data
3779 } /*proto_reg_handoff_zbee_zcl_on_off_switch_configuration*/
3781 /* ########################################################################## */
3782 /* #### (0x0009) ALARMS CLUSTER ############################################# */
3783 /* ########################################################################## */
3785 /*************************/
3786 /* Defines */
3787 /*************************/
3789 /* Attributes */
3790 #define ZBEE_ZCL_ATTR_ID_ALARMS_ALARM_COUNT 0x0000 /* Alarm Count */
3792 /* Server Commands Received */
3793 #define ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM 0x00 /* Reset Alarm */
3794 #define ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALL_ALARMS 0x01 /* Reset All Alarms */
3795 #define ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM 0x02 /* Get Alarm */
3796 #define ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM_LOG 0x03 /* Reset Alarm Log */
3798 /* Server Commands Generated */
3799 #define ZBEE_ZCL_CMD_ID_ALARMS_ALARM 0x00 /* Alarm */
3800 #define ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM_RESPONSE 0x01 /* Get Alarm Response */
3802 /*************************/
3803 /* Function Declarations */
3804 /*************************/
3806 void proto_register_zbee_zcl_alarms(void);
3807 void proto_reg_handoff_zbee_zcl_alarms(void);
3809 /* Private functions prototype */
3811 /*************************/
3812 /* Global Variables */
3813 /*************************/
3814 /* Initialize the protocol and registered fields */
3815 static int proto_zbee_zcl_alarms;
3817 static int hf_zbee_zcl_alarms_attr_id;
3818 static int hf_zbee_zcl_alarms_alarm_code;
3819 static int hf_zbee_zcl_alarms_cluster_id;
3820 static int hf_zbee_zcl_alarms_status;
3821 static int hf_zbee_zcl_alarms_timestamp;
3822 static int hf_zbee_zcl_alarms_srv_rx_cmd_id;
3823 static int hf_zbee_zcl_alarms_srv_tx_cmd_id;
3825 /* Initialize the subtree pointers */
3826 static int ett_zbee_zcl_alarms;
3828 /* Attributes */
3829 static const value_string zbee_zcl_alarms_attr_names[] = {
3830 { ZBEE_ZCL_ATTR_ID_ALARMS_ALARM_COUNT, "Alarm Count" },
3831 { 0, NULL }
3834 /* Server Commands Received */
3835 static const value_string zbee_zcl_alarms_srv_rx_cmd_names[] = {
3836 { ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM, "Reset Alarm" },
3837 { ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALL_ALARMS, "Reset All Alarms" },
3838 { ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM, "Get Alarm" },
3839 { ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM_LOG, "Reset Alarm Log" },
3840 { 0, NULL }
3843 /* Server Commands Generated */
3844 static const value_string zbee_zcl_alarms_srv_tx_cmd_names[] = {
3845 { ZBEE_ZCL_CMD_ID_ALARMS_ALARM, "Alarm" },
3846 { ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM_RESPONSE,"Get Alarm Response" },
3847 { 0, NULL }
3850 /*************************/
3851 /* Function Bodies */
3852 /*************************/
3854 /*FUNCTION:------------------------------------------------------
3855 * NAME
3856 * dissect_zcl_alarms_attr_data
3857 * DESCRIPTION
3858 * this function is called by ZCL foundation dissector in order to decode
3859 * specific cluster attributes data.
3860 * PARAMETERS
3861 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
3862 * tvbuff_t *tvb - pointer to buffer containing raw packet.
3863 * unsigned *offset - pointer to buffer offset
3864 * uint16_t attr_id - attribute identifier
3865 * unsigned data_type - attribute data type
3866 * bool client_attr- ZCL client
3867 * RETURNS
3868 * none
3869 *--------------------------------------------------------------- */
3870 static void
3871 dissect_zcl_alarms_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
3873 /* Dissect attribute data type and data */
3874 switch ( attr_id ) {
3875 case ZBEE_ZCL_ATTR_ID_ALARMS_ALARM_COUNT:
3876 default:
3877 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
3878 break;
3881 } /*dissect_zcl_alarms_attr_data*/
3883 /*FUNCTION:------------------------------------------------------
3884 * NAME
3885 * dissect_zcl_alarms_alarm_and_reset_alarm
3886 * DESCRIPTION
3887 * this function decodes the Alarm and Reset Alarm payload.
3888 * PARAMETERS
3889 * tvb - the tv buffer of the current data_type
3890 * tree - the tree to append this item to
3891 * offset - offset of data in tvb
3892 * RETURNS
3893 * none
3894 *---------------------------------------------------------------
3896 static void
3897 dissect_zcl_alarms_alarm_and_reset_alarm(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
3899 /* Retrieve "Alarm Code" field */
3900 proto_tree_add_item(tree, hf_zbee_zcl_alarms_alarm_code, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
3901 *offset += 1;
3903 /* Retrieve "Cluster ID" field */
3904 proto_tree_add_item(tree, hf_zbee_zcl_alarms_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
3905 *offset += 2;
3907 } /*dissect_zcl_alarms_alarm_and_reset_alarm*/
3910 /*FUNCTION:--------------------------------------------------------------------
3911 * NAME
3912 * dissect_zcl_alarms_get_alarm_response
3913 * DESCRIPTION
3914 * this function decodes the Get Alarm Response payload
3915 * PARAMETERS
3916 * tvb - the tv buffer of the current data_type
3917 * tree - the tree to append this item to
3918 * offset - offset of data in tvb
3919 * RETURNS
3920 * none
3921 *------------------------------------------------------------------------------
3924 static void
3925 dissect_zcl_alarms_get_alarm_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
3927 uint8_t status;
3929 /* Retrieve "Status" field */
3930 status = tvb_get_uint8(tvb, *offset);
3931 proto_tree_add_item(tree, hf_zbee_zcl_alarms_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
3932 *offset += 1;
3934 if(status == ZBEE_ZCL_STAT_SUCCESS)
3936 /* Retrieve "Alarm Code" field */
3937 proto_tree_add_item(tree, hf_zbee_zcl_alarms_alarm_code, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
3938 *offset += 1;
3940 /* Retrieve "Cluster ID" field */
3941 proto_tree_add_item(tree, hf_zbee_zcl_alarms_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
3942 *offset += 2;
3944 /* Retrieve "Timestamp" field */
3945 proto_tree_add_item(tree, hf_zbee_zcl_alarms_timestamp, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
3946 *offset += 4;
3949 } /*dissect_zcl_alarms_get_alarm_response*/
3953 /*FUNCTION:------------------------------------------------------
3954 * NAME
3955 * dissect_zbee_zcl_alarms
3956 * DESCRIPTION
3957 * ZigBee ZCL Alarms cluster dissector for wireshark.
3958 * PARAMETERS
3959 * tvbuff_t *tvb - pointer to buffer containing raw packet.
3960 * packet_info *pinfo - pointer to packet information fields
3961 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
3962 * RETURNS
3963 * none
3964 *---------------------------------------------------------------
3966 static int
3967 dissect_zbee_zcl_alarms(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
3969 proto_tree *payload_tree;
3970 zbee_zcl_packet *zcl;
3971 unsigned offset = 0;
3972 uint8_t cmd_id;
3973 int rem_len;
3975 /* Reject the packet if data is NULL */
3976 if (data == NULL)
3977 return 0;
3978 zcl = (zbee_zcl_packet *)data;
3979 cmd_id = zcl->cmd_id;
3981 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
3982 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
3983 /* Append the command name to the info column. */
3984 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
3985 val_to_str_const(cmd_id, zbee_zcl_alarms_srv_rx_cmd_names, "Unknown Command"),
3986 zcl->tran_seqno);
3988 /* Add the command ID. */
3989 proto_tree_add_item(tree, hf_zbee_zcl_alarms_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
3991 /* Check if this command has a payload, then add the payload tree */
3992 rem_len = tvb_reported_length_remaining(tvb, ++offset);
3993 if (rem_len > 0) {
3994 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_alarms, NULL, "Payload");
3996 /* Call the appropriate command dissector */
3997 switch (cmd_id) {
3998 case ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM:
3999 dissect_zcl_alarms_alarm_and_reset_alarm(tvb, payload_tree, &offset);
4000 break;
4002 case ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALL_ALARMS:
4003 case ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM:
4004 case ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM_LOG:
4005 /* No Payload */
4006 default:
4007 break;
4011 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
4012 /* Append the command name to the info column. */
4013 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
4014 val_to_str_const(cmd_id, zbee_zcl_alarms_srv_tx_cmd_names, "Unknown Command"),
4015 zcl->tran_seqno);
4017 /* Add the command ID. */
4018 proto_tree_add_item(tree, hf_zbee_zcl_alarms_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4020 /* Check if this command has a payload, then add the payload tree */
4021 rem_len = tvb_reported_length_remaining(tvb, ++offset);
4022 if (rem_len > 0) {
4023 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_alarms, NULL, "Payload");
4025 /* Call the appropriate command dissector */
4026 switch (cmd_id) {
4027 case ZBEE_ZCL_CMD_ID_ALARMS_ALARM:
4028 dissect_zcl_alarms_alarm_and_reset_alarm(tvb, payload_tree, &offset);
4029 break;
4031 case ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM_RESPONSE:
4032 dissect_zcl_alarms_get_alarm_response(tvb, payload_tree, &offset);
4033 break;
4035 default:
4036 break;
4041 return tvb_captured_length(tvb);
4042 } /*dissect_zbee_zcl_alarms*/
4048 /*FUNCTION:------------------------------------------------------
4049 * NAME
4050 * proto_register_zbee_zcl_alarms
4051 * DESCRIPTION
4052 * ZigBee ZCL Alarms cluster protocol registration routine.
4053 * PARAMETERS
4054 * none
4055 * RETURNS
4056 * void
4057 *---------------------------------------------------------------
4059 void
4060 proto_register_zbee_zcl_alarms(void)
4062 /* Setup list of header fields */
4063 static hf_register_info hf[] = {
4065 { &hf_zbee_zcl_alarms_attr_id,
4066 { "Attribute", "zbee_zcl_general.alarms.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_alarms_attr_names),
4067 0x00, NULL, HFILL } },
4069 { &hf_zbee_zcl_alarms_alarm_code,
4070 { "Alarm Code", "zbee_zcl_general.alarms.alarm_code", FT_UINT8, BASE_HEX, NULL,
4071 0x00, NULL, HFILL } },
4073 { &hf_zbee_zcl_alarms_cluster_id,
4074 { "Cluster ID", "zbee_zcl_general.alarms.cluster_id", FT_UINT16, BASE_HEX, NULL,
4075 0x00, NULL, HFILL } },
4077 { &hf_zbee_zcl_alarms_status,
4078 { "Status", "zbee_zcl_general.alarms.status", FT_UINT8, BASE_DEC, VALS(zbee_zcl_status_names),
4079 0x00, NULL, HFILL } },
4081 { &hf_zbee_zcl_alarms_timestamp,
4082 { "Timestamp", "zbee_zcl_general.alarms.timestamp", FT_UINT32, BASE_HEX, NULL,
4083 0x00, NULL, HFILL } },
4085 { &hf_zbee_zcl_alarms_srv_rx_cmd_id,
4086 { "Command", "zbee_zcl_general.alarms.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_alarms_srv_rx_cmd_names),
4087 0x00, NULL, HFILL } },
4089 { &hf_zbee_zcl_alarms_srv_tx_cmd_id,
4090 { "Command", "zbee_zcl_general.alarms.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_alarms_srv_tx_cmd_names),
4091 0x00, NULL, HFILL } }
4095 /* ZCL Alarms subtrees */
4096 static int *ett[] = {
4097 &ett_zbee_zcl_alarms
4100 /* Register the ZigBee ZCL Alarms cluster protocol name and description */
4101 proto_zbee_zcl_alarms = proto_register_protocol("ZigBee ZCL Alarms", "ZCL Alarms", ZBEE_PROTOABBREV_ZCL_ALARMS);
4102 proto_register_field_array(proto_zbee_zcl_alarms, hf, array_length(hf));
4103 proto_register_subtree_array(ett, array_length(ett));
4105 /* Register the ZigBee ZCL Alarms dissector. */
4106 register_dissector(ZBEE_PROTOABBREV_ZCL_ALARMS, dissect_zbee_zcl_alarms, proto_zbee_zcl_alarms);
4108 } /*proto_register_zbee_zcl_alarms*/
4111 /*FUNCTION:------------------------------------------------------
4112 * NAME
4113 * proto_reg_handoff_zbee_zcl_alarms
4114 * DESCRIPTION
4115 * Hands off the ZCL Alarms dissector.
4116 * PARAMETERS
4117 * none
4118 * RETURNS
4119 * none
4120 *---------------------------------------------------------------
4122 void
4123 proto_reg_handoff_zbee_zcl_alarms(void)
4125 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ALARMS,
4126 proto_zbee_zcl_alarms,
4127 ett_zbee_zcl_alarms,
4128 ZBEE_ZCL_CID_ALARMS,
4129 ZBEE_MFG_CODE_NONE,
4130 hf_zbee_zcl_alarms_attr_id,
4131 hf_zbee_zcl_alarms_attr_id,
4132 hf_zbee_zcl_alarms_srv_rx_cmd_id,
4133 hf_zbee_zcl_alarms_srv_tx_cmd_id,
4134 (zbee_zcl_fn_attr_data)dissect_zcl_alarms_attr_data
4136 } /*proto_reg_handoff_zbee_zcl_alarms*/
4139 /* ########################################################################## */
4140 /* #### (0x000A) TIME CLUSTER ############################################### */
4141 /* ########################################################################## */
4143 /*************************/
4144 /* Defines */
4145 /*************************/
4147 /* Attributes */
4148 #define ZBEE_ZCL_ATTR_ID_TIME_TIME 0x0000 /* Time */
4149 #define ZBEE_ZCL_ATTR_ID_TIME_TIME_STATUS 0x0001 /* Time Status */
4150 #define ZBEE_ZCL_ATTR_ID_TIME_TIME_ZONE 0x0002 /* Time Zone */
4151 #define ZBEE_ZCL_ATTR_ID_TIME_DST_START 0x0003 /* Daylight Saving Time Start*/
4152 #define ZBEE_ZCL_ATTR_ID_TIME_DST_END 0x0004 /* Daylight Saving Time End */
4153 #define ZBEE_ZCL_ATTR_ID_TIME_DST_SHIFT 0x0005 /* Daylight Saving Time Shift */
4154 #define ZBEE_ZCL_ATTR_ID_TIME_STD_TIME 0x0006 /* Standard Time */
4155 #define ZBEE_ZCL_ATTR_ID_TIME_LOCAL_TIME 0x0007 /* Local Time */
4156 #define ZBEE_ZCL_ATTR_ID_TIME_LAST_SET_TIME 0x0008 /* Last Set Time */
4157 #define ZBEE_ZCL_ATTR_ID_TIME_VALID_UNTIL_TIME 0x0009 /* Valid Until Time */
4159 /* Server commands received - none */
4161 /* Server commands generated - none */
4163 /* Time Status Mask Value */
4164 #define ZBEE_ZCL_TIME_MASTER 0x01 /* Master Clock */
4165 #define ZBEE_ZCL_TIME_SYNCHRONIZED 0x02 /* Synchronized */
4166 #define ZBEE_ZCL_TIME_MASTER_ZONE_DST 0x04 /* Master for Time Zone and DST */
4167 #define ZBEE_ZCL_TIME_SUPERSEDING 0x08 /* Superseded */
4169 /*************************/
4170 /* Function Declarations */
4171 /*************************/
4173 void proto_register_zbee_zcl_time(void);
4174 void proto_reg_handoff_zbee_zcl_time(void);
4177 /*************************/
4178 /* Global Variables */
4179 /*************************/
4180 /* Initialize the protocol and registered fields */
4181 static int proto_zbee_zcl_time;
4183 static int hf_zbee_zcl_time_attr_id;
4184 static int hf_zbee_zcl_time_status;
4185 static int hf_zbee_zcl_time_status_master;
4186 static int hf_zbee_zcl_time_status_synchronized;
4187 static int hf_zbee_zcl_time_status_master_zone_dst;
4188 static int hf_zbee_zcl_time_status_superseding;
4190 /* Initialize the subtree pointers */
4191 static int ett_zbee_zcl_time;
4192 static int ett_zbee_zcl_time_status_mask;
4194 /* Attributes */
4195 static const value_string zbee_zcl_time_attr_names[] = {
4196 { ZBEE_ZCL_ATTR_ID_TIME_TIME, "Time" },
4197 { ZBEE_ZCL_ATTR_ID_TIME_TIME_STATUS, "Time Status" },
4198 { ZBEE_ZCL_ATTR_ID_TIME_TIME_ZONE, "Time Zone" },
4199 { ZBEE_ZCL_ATTR_ID_TIME_DST_START, "Daylight Saving Time Start" },
4200 { ZBEE_ZCL_ATTR_ID_TIME_DST_END, "Daylight Saving Time End" },
4201 { ZBEE_ZCL_ATTR_ID_TIME_DST_SHIFT, "Daylight Saving Time Shift" },
4202 { ZBEE_ZCL_ATTR_ID_TIME_STD_TIME, "Standard Time" },
4203 { ZBEE_ZCL_ATTR_ID_TIME_LOCAL_TIME, "Local Time" },
4204 { ZBEE_ZCL_ATTR_ID_TIME_LAST_SET_TIME, "Last Set Time" },
4205 { ZBEE_ZCL_ATTR_ID_TIME_VALID_UNTIL_TIME, "Valid Until Time" },
4206 { 0, NULL }
4209 /*************************/
4210 /* Function Bodies */
4211 /*************************/
4213 /*FUNCTION:------------------------------------------------------
4214 * NAME
4215 * dissect_zcl_time_attr_data
4216 * DESCRIPTION
4217 * this function is called by ZCL foundation dissector in order to decode
4218 * specific cluster attributes data.
4219 * PARAMETERS
4220 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
4221 * tvbuff_t *tvb - pointer to buffer containing raw packet.
4222 * unsigned *offset - pointer to buffer offset
4223 * uint16_t attr_id - attribute identifier
4224 * unsigned data_type - attribute data type
4225 * bool client_attr- ZCL client
4226 * RETURNS
4227 * none
4228 *--------------------------------------------------------------- */
4229 static void
4230 dissect_zcl_time_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
4232 static int * const time_status_mask[] = {
4233 &hf_zbee_zcl_time_status_master,
4234 &hf_zbee_zcl_time_status_synchronized,
4235 &hf_zbee_zcl_time_status_master_zone_dst,
4236 &hf_zbee_zcl_time_status_superseding,
4237 NULL
4240 /* Dissect attribute data type and data */
4241 switch (attr_id) {
4243 case ZBEE_ZCL_ATTR_ID_TIME_TIME_STATUS:
4244 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_time_status, ett_zbee_zcl_time_status_mask, time_status_mask, ENC_LITTLE_ENDIAN);
4245 *offset += 1;
4246 break;
4248 case ZBEE_ZCL_ATTR_ID_TIME_TIME:
4249 case ZBEE_ZCL_ATTR_ID_TIME_TIME_ZONE:
4250 case ZBEE_ZCL_ATTR_ID_TIME_DST_START:
4251 case ZBEE_ZCL_ATTR_ID_TIME_DST_END:
4252 case ZBEE_ZCL_ATTR_ID_TIME_DST_SHIFT:
4253 case ZBEE_ZCL_ATTR_ID_TIME_STD_TIME:
4254 case ZBEE_ZCL_ATTR_ID_TIME_LOCAL_TIME:
4255 case ZBEE_ZCL_ATTR_ID_TIME_LAST_SET_TIME:
4256 case ZBEE_ZCL_ATTR_ID_TIME_VALID_UNTIL_TIME:
4257 default:
4258 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
4259 break;
4262 } /*dissect_zcl_time_attr_data*/
4263 /*FUNCTION:------------------------------------------------------
4264 * NAME
4265 * dissect_zbee_zcl_time
4266 * DESCRIPTION
4267 * ZigBee ZCL Time cluster dissector for wireshark.
4268 * PARAMETERS
4269 * tvbuff_t *tvb - pointer to buffer containing raw packet.
4270 * packet_info *pinfo - pointer to packet information fields
4271 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
4272 * RETURNS
4273 * none
4274 *---------------------------------------------------------------
4277 static int
4278 dissect_zbee_zcl_time(tvbuff_t _U_ *tvb, packet_info _U_ * pinfo, proto_tree _U_* tree, void _U_* data)
4280 /* No commands is being received and generated by server
4281 * No cluster specific commands are received by client
4283 return 0;
4284 } /*dissect_zbee_zcl_time*/
4286 /*FUNCTION:------------------------------------------------------
4287 * NAME
4288 * proto_register_zbee_zcl_time
4289 * DESCRIPTION
4290 * ZigBee ZCL Time cluster protocol registration routine.
4291 * PARAMETERS
4292 * none
4293 * RETURNS
4294 * void
4295 *---------------------------------------------------------------
4297 void
4298 proto_register_zbee_zcl_time(void)
4300 /* Setup list of header fields */
4301 static hf_register_info hf[] = {
4303 { &hf_zbee_zcl_time_attr_id,
4304 { "Attribute", "zbee_zcl_general.time.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_time_attr_names),
4305 0x00, NULL, HFILL } },
4307 /* start Time Status Mask fields */
4308 { &hf_zbee_zcl_time_status,
4309 { "Time Status", "zbee_zcl_general.time.attr.time_status", FT_UINT8, BASE_HEX, NULL,
4310 0x00, NULL, HFILL } },
4312 { &hf_zbee_zcl_time_status_master,
4313 { "Master", "zbee_zcl_general.time.attr.time_status.master", FT_BOOLEAN, 8, NULL,
4314 ZBEE_ZCL_TIME_MASTER, NULL, HFILL } },
4316 { &hf_zbee_zcl_time_status_synchronized,
4317 { "Synchronized", "zbee_zcl_general.time.attr.time_status.synchronized", FT_BOOLEAN, 8, NULL,
4318 ZBEE_ZCL_TIME_SYNCHRONIZED, NULL, HFILL } },
4320 { &hf_zbee_zcl_time_status_master_zone_dst,
4321 { "Master for Time Zone and DST", "zbee_zcl_general.time.attr.time_status.master_zone_dst", FT_BOOLEAN, 8, NULL,
4322 ZBEE_ZCL_TIME_MASTER_ZONE_DST, NULL, HFILL } },
4324 { &hf_zbee_zcl_time_status_superseding,
4325 { "Superseded", "zbee_zcl_general.time.attr.time_status.superseding", FT_BOOLEAN, 8, NULL,
4326 ZBEE_ZCL_TIME_SUPERSEDING, NULL, HFILL } }
4327 /* end Time Status Mask fields */
4330 /* ZCL Time subtrees */
4331 static int *ett[] = {
4332 &ett_zbee_zcl_time,
4333 &ett_zbee_zcl_time_status_mask
4336 /* Register the ZigBee ZCL Time cluster protocol name and description */
4337 proto_zbee_zcl_time = proto_register_protocol("ZigBee ZCL Time", "ZCL Time", ZBEE_PROTOABBREV_ZCL_TIME);
4338 proto_register_field_array(proto_zbee_zcl_time, hf, array_length(hf));
4339 proto_register_subtree_array(ett, array_length(ett));
4341 /* Register the ZigBee ZCL Time dissector. */
4342 register_dissector(ZBEE_PROTOABBREV_ZCL_TIME, dissect_zbee_zcl_time, proto_zbee_zcl_time);
4343 } /*proto_register_zbee_zcl_time*/
4345 /*FUNCTION:------------------------------------------------------
4346 * NAME
4347 * proto_reg_handoff_zbee_zcl_time
4348 * DESCRIPTION
4349 * Hands off the ZCL Time dissector.
4350 * PARAMETERS
4351 * none
4352 * RETURNS
4353 * none
4354 *---------------------------------------------------------------
4356 void
4357 proto_reg_handoff_zbee_zcl_time(void)
4359 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_TIME,
4360 proto_zbee_zcl_time,
4361 ett_zbee_zcl_time,
4362 ZBEE_ZCL_CID_TIME,
4363 ZBEE_MFG_CODE_NONE,
4364 hf_zbee_zcl_time_attr_id,
4365 hf_zbee_zcl_time_attr_id,
4366 -1, -1,
4367 (zbee_zcl_fn_attr_data)dissect_zcl_time_attr_data
4369 } /*proto_reg_handoff_zbee_zcl_time*/
4374 /* ########################################################################## */
4375 /* #### (0x0008) LEVEL_CONTROL CLUSTER ###################################### */
4376 /* ########################################################################## */
4378 /*************************/
4379 /* Defines */
4380 /*************************/
4382 /* Attributes */
4383 #define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_CURRENT_LEVEL 0x0000 /* Current Level */
4384 #define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_REMAINING_TIME 0x0001 /* Remaining Time */
4385 #define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ONOFF_TRANSIT_TIME 0x0010 /* OnOff Transition Time */
4386 #define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ON_LEVEL 0x0011 /* On Level */
4387 #define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_STARTUP_LEVEL 0x4000 /* Startup Level */
4389 /* Server Commands Received */
4390 #define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL 0x00 /* Move to Level */
4391 #define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE 0x01 /* Move */
4392 #define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP 0x02 /* Step */
4393 #define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP 0x03 /* Stop */
4394 #define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL_WITH_ONOFF 0x04 /* Move to Level with OnOff */
4395 #define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_WITH_ONOFF 0x05 /* Move with OnOff */
4396 #define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP_WITH_ONOFF 0x06 /* Step with OnOff */
4397 #define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP_WITH_ONOFF 0x07 /* Stop with OnOff */
4399 /*************************/
4400 /* Function Declarations */
4401 /*************************/
4403 void proto_register_zbee_zcl_level_control(void);
4404 void proto_reg_handoff_zbee_zcl_level_control(void);
4406 /* Private functions prototype */
4408 /*************************/
4409 /* Global Variables */
4410 /*************************/
4411 /* Initialize the protocol and registered fields */
4412 static int proto_zbee_zcl_level_control;
4414 static int hf_zbee_zcl_level_control_attr_id;
4415 static int hf_zbee_zcl_level_control_attr_current_level;
4416 static int hf_zbee_zcl_level_control_attr_remaining_time;
4417 static int hf_zbee_zcl_level_control_attr_onoff_transmit_time;
4418 static int hf_zbee_zcl_level_control_attr_on_level;
4419 static int hf_zbee_zcl_level_control_attr_startup_level;
4420 static int hf_zbee_zcl_level_control_level;
4421 static int hf_zbee_zcl_level_control_move_mode;
4422 static int hf_zbee_zcl_level_control_rate;
4423 static int hf_zbee_zcl_level_control_step_mode;
4424 static int hf_zbee_zcl_level_control_step_size;
4425 static int hf_zbee_zcl_level_control_transit_time;
4426 static int hf_zbee_zcl_level_control_srv_rx_cmd_id;
4428 /* Initialize the subtree pointers */
4429 static int ett_zbee_zcl_level_control;
4431 /* Attributes */
4432 static const value_string zbee_zcl_level_control_attr_names[] = {
4433 { ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_CURRENT_LEVEL, "Current Level" },
4434 { ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_REMAINING_TIME, "Remaining Time" },
4435 { ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ONOFF_TRANSIT_TIME, "OnOff Transition Time" },
4436 { ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ON_LEVEL, "On Level" },
4437 { ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_STARTUP_LEVEL, "Startup Level" },
4438 { 0, NULL }
4441 /* Server Commands Received */
4442 static const value_string zbee_zcl_level_control_srv_rx_cmd_names[] = {
4443 { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL, "Move to Level" },
4444 { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE, "Move" },
4445 { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP, "Step" },
4446 { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP, "Stop" },
4447 { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL_WITH_ONOFF, "Move to Level with OnOff" },
4448 { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_WITH_ONOFF, "Move with OnOff" },
4449 { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP_WITH_ONOFF, "Step with OnOff" },
4450 { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP_WITH_ONOFF, "Stop with OnOff" },
4451 { 0, NULL }
4454 /* Move Mode Values */
4455 static const value_string zbee_zcl_level_control_move_step_mode_values[] = {
4456 { 0x00, "Up" },
4457 { 0x01, "Down" },
4458 { 0, NULL }
4461 static const range_string zbee_zcl_level_control_startup_level_names[] = {
4462 { 0x00, 0x00, "Set the CurrentLevel attribute to the minimum" },
4463 { 0x01, 0xFE, "Set the CurrentLevel attribute to this value" },
4464 { 0xFF, 0xFF, "Set the CurrentLevel attribute to its previous value" },
4465 { 0, 0, NULL }
4468 /*************************/
4469 /* Function Bodies */
4470 /*************************/
4471 /*FUNCTION:------------------------------------------------------
4472 * NAME
4473 * dissect_zcl_level_control_move_to_level
4474 * DESCRIPTION
4475 * this function decodes the Move to Level payload.
4476 * PARAMETERS
4477 * tvb - the tv buffer of the current data_type
4478 * tree - the tree to append this item to
4479 * offset - offset of data in tvb
4480 * RETURNS
4481 * none
4482 *---------------------------------------------------------------
4484 static void
4485 dissect_zcl_level_control_move_to_level(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
4487 /* Retrieve "Level" field */
4488 proto_tree_add_item(tree, hf_zbee_zcl_level_control_level, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
4489 *offset += 1;
4491 /* Retrieve "Transition Time" field */
4492 proto_tree_add_item(tree, hf_zbee_zcl_level_control_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
4493 *offset += 2;
4495 } /*dissect_zcl_level_control_move_to_level*/
4498 /*FUNCTION:--------------------------------------------------------------------
4499 * NAME
4500 * dissect_zcl_level_control_move
4501 * DESCRIPTION
4502 * this function decodes the Move payload
4503 * PARAMETERS
4504 * tvb - the tv buffer of the current data_type
4505 * tree - the tree to append this item to
4506 * offset - offset of data in tvb
4507 * RETURNS
4508 * none
4509 *------------------------------------------------------------------------------
4512 static void
4513 dissect_zcl_level_control_move(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
4515 /* Retrieve "Move Mode" field */
4516 proto_tree_add_item(tree, hf_zbee_zcl_level_control_move_mode, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
4517 *offset += 1;
4519 /* Retrieve "Rate" field */
4520 proto_tree_add_item(tree, hf_zbee_zcl_level_control_rate, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
4521 *offset += 1;
4523 } /*dissect_zcl_level_control_move*/
4526 /*FUNCTION:-------------------------------------------------------------------
4527 * NAME
4528 * dissect_zcl_level_control_step
4529 * DESCRIPTION
4530 * this function decodes the Step payload.
4531 * PARAMETERS
4532 * tvb - the tv buffer of the current data_type
4533 * tree - the tree to append this item to
4534 * offset - offset of data in tvb
4535 * RETURNS
4536 * none
4537 *-----------------------------------------------------------------------------
4539 static void
4540 dissect_zcl_level_control_step(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
4542 /* Retrieve "Step Mode" field */
4543 proto_tree_add_item(tree, hf_zbee_zcl_level_control_step_mode, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
4544 *offset += 1;
4546 /* Retrieve "Step Size" field */
4547 proto_tree_add_item(tree, hf_zbee_zcl_level_control_step_size, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
4548 *offset += 1;
4550 /* Retrieve "Transition Time" field */
4551 proto_tree_add_item(tree, hf_zbee_zcl_level_control_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
4552 *offset += 2;
4554 } /*dissect_zcl_level_control_step*/
4557 /*FUNCTION:------------------------------------------------------
4558 * NAME
4559 * dissect_zcl_level_control_attr_data
4560 * DESCRIPTION
4561 * this function is called by ZCL foundation dissector in order to decode
4562 * specific cluster attributes data.
4563 * PARAMETERS
4564 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
4565 * tvbuff_t *tvb - pointer to buffer containing raw packet.
4566 * unsigned *offset - pointer to buffer offset
4567 * uint16_t attr_id - attribute identifier
4568 * unsigned data_type - attribute data type
4569 * RETURNS
4570 * none
4571 *---------------------------------------------------------------
4574 /*FUNCTION:------------------------------------------------------
4575 * NAME
4576 * dissect_zbee_zcl_level_control
4577 * DESCRIPTION
4578 * ZigBee ZCL Level Control cluster dissector for wireshark.
4579 * PARAMETERS
4580 * tvbuff_t *tvb - pointer to buffer containing raw packet.
4581 * packet_info *pinfo - pointer to packet information fields
4582 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
4583 * RETURNS
4584 * none
4585 *---------------------------------------------------------------
4587 static int
4588 dissect_zbee_zcl_level_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
4590 proto_tree *payload_tree;
4591 zbee_zcl_packet *zcl;
4592 unsigned offset = 0;
4593 uint8_t cmd_id;
4594 int rem_len;
4596 /* Reject the packet if data is NULL */
4597 if (data == NULL)
4598 return 0;
4599 zcl = (zbee_zcl_packet *)data;
4600 cmd_id = zcl->cmd_id;
4602 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
4603 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
4604 /* Append the command name to the info column. */
4605 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
4606 val_to_str_const(cmd_id, zbee_zcl_level_control_srv_rx_cmd_names, "Unknown Command"),
4607 zcl->tran_seqno);
4609 /* Add the command ID. */
4610 proto_tree_add_item(tree, hf_zbee_zcl_level_control_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
4612 /* Check if this command has a payload, then add the payload tree */
4613 rem_len = tvb_reported_length_remaining(tvb, ++offset);
4614 if (rem_len > 0) {
4615 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_level_control, NULL, "Payload");
4617 /* Call the appropriate command dissector */
4618 switch (cmd_id) {
4619 case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL:
4620 case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL_WITH_ONOFF:
4621 dissect_zcl_level_control_move_to_level(tvb, payload_tree, &offset);
4622 break;
4624 case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE:
4625 case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_WITH_ONOFF:
4626 dissect_zcl_level_control_move(tvb, payload_tree, &offset);
4627 break;
4629 case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP:
4630 case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP_WITH_ONOFF:
4631 dissect_zcl_level_control_step(tvb, payload_tree, &offset);
4632 break;
4634 case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP:
4635 case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP_WITH_ONOFF:
4636 /* No Payload */
4637 default:
4638 break;
4643 return tvb_captured_length(tvb);
4644 } /*dissect_zbee_zcl_level_control*/
4648 static void
4649 dissect_zcl_level_control_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
4651 /* Dissect attribute data type and data */
4652 switch ( attr_id ) {
4653 case ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_CURRENT_LEVEL:
4654 proto_tree_add_item(tree, hf_zbee_zcl_level_control_attr_current_level, tvb, *offset, 1, ENC_NA);
4655 *offset += 1;
4656 break;
4658 case ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_REMAINING_TIME:
4659 proto_tree_add_item(tree, hf_zbee_zcl_level_control_attr_remaining_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
4660 *offset += 2;
4661 break;
4663 case ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ONOFF_TRANSIT_TIME:
4664 proto_tree_add_item(tree, hf_zbee_zcl_level_control_attr_onoff_transmit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
4665 *offset += 2;
4666 break;
4668 case ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ON_LEVEL:
4669 proto_tree_add_item(tree, hf_zbee_zcl_level_control_attr_on_level, tvb, *offset, 1, ENC_NA);
4670 *offset += 1;
4671 break;
4673 case ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_STARTUP_LEVEL:
4674 proto_tree_add_item(tree, hf_zbee_zcl_level_control_attr_startup_level, tvb, *offset, 1, ENC_NA);
4675 *offset += 1;
4676 break;
4678 default:
4679 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
4680 break;
4683 } /*dissect_zcl_level_control_attr_data*/
4686 /*FUNCTION:------------------------------------------------------
4687 * NAME
4688 * proto_register_zbee_zcl_level_control
4689 * DESCRIPTION
4690 * ZigBee ZCL Level Control cluster protocol registration routine.
4691 * PARAMETERS
4692 * none
4693 * RETURNS
4694 * void
4695 *---------------------------------------------------------------
4697 void
4698 proto_register_zbee_zcl_level_control(void)
4700 /* Setup list of header fields */
4701 static hf_register_info hf[] = {
4703 { &hf_zbee_zcl_level_control_attr_id,
4704 { "Attribute", "zbee_zcl_general.level_control.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_level_control_attr_names),
4705 0x00, NULL, HFILL } },
4707 { &hf_zbee_zcl_level_control_attr_current_level,
4708 { "Current Level", "zbee_zcl_general.level_control.attr.current_level", FT_UINT8, BASE_DEC, NULL,
4709 0x00, NULL, HFILL } },
4711 { &hf_zbee_zcl_level_control_attr_remaining_time,
4712 { "Remaining Time", "zbee_zcl_general.level_control.attr.remaining_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms),
4713 0x00, NULL, HFILL } },
4715 { &hf_zbee_zcl_level_control_attr_onoff_transmit_time,
4716 { "Current Level", "zbee_zcl_general.level_control.attr.onoff_transmit_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms),
4717 0x00, NULL, HFILL } },
4719 { &hf_zbee_zcl_level_control_attr_on_level,
4720 { "On Level", "zbee_zcl_general.level_control.attr.on_level", FT_UINT8, BASE_DEC, NULL,
4721 0x00, NULL, HFILL } },
4723 { &hf_zbee_zcl_level_control_attr_startup_level,
4724 { "Startup Level", "zbee_zcl_general.level_control.attr.startup_level", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_zcl_level_control_startup_level_names),
4725 0x00, NULL, HFILL } },
4727 { &hf_zbee_zcl_level_control_level,
4728 { "Level", "zbee_zcl_general.level_control.level", FT_UINT8, BASE_DEC, NULL,
4729 0x00, NULL, HFILL } },
4731 { &hf_zbee_zcl_level_control_move_mode,
4732 { "Move Mode", "zbee_zcl_general.level_control.move_mode", FT_UINT8, BASE_HEX, VALS(zbee_zcl_level_control_move_step_mode_values),
4733 0x00, NULL, HFILL } },
4735 { &hf_zbee_zcl_level_control_rate,
4736 { "Rate", "zbee_zcl_general.level_control.rate", FT_UINT8, BASE_DEC, NULL,
4737 0x00, NULL, HFILL } },
4739 { &hf_zbee_zcl_level_control_step_mode,
4740 { "Step Mode", "zbee_zcl_general.level_control.step_mode", FT_UINT8, BASE_HEX, VALS(zbee_zcl_level_control_move_step_mode_values),
4741 0x00, NULL, HFILL } },
4743 { &hf_zbee_zcl_level_control_step_size,
4744 { "Step Size", "zbee_zcl_general.level_control.step_size", FT_UINT8, BASE_DEC, NULL,
4745 0x00, NULL, HFILL } },
4747 { &hf_zbee_zcl_level_control_transit_time,
4748 { "Transition Time", "zbee_zcl_general.level_control.transit_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms),
4749 0x00, NULL, HFILL } },
4751 { &hf_zbee_zcl_level_control_srv_rx_cmd_id,
4752 { "Command", "zbee_zcl_general.level_control.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_level_control_srv_rx_cmd_names),
4753 0x00, NULL, HFILL } }
4757 /* ZCL Identify subtrees */
4758 static int *ett[] = {
4759 &ett_zbee_zcl_level_control
4762 /* Register the ZigBee ZCL Level Control cluster protocol name and description */
4763 proto_zbee_zcl_level_control = proto_register_protocol("ZigBee ZCL Level Control", "ZCL Level Control", ZBEE_PROTOABBREV_ZCL_LEVEL_CONTROL);
4764 proto_register_field_array(proto_zbee_zcl_level_control, hf, array_length(hf));
4765 proto_register_subtree_array(ett, array_length(ett));
4767 /* Register the ZigBee ZCL Level Control dissector. */
4768 register_dissector(ZBEE_PROTOABBREV_ZCL_LEVEL_CONTROL, dissect_zbee_zcl_level_control, proto_zbee_zcl_level_control);
4770 } /*proto_register_zbee_zcl_level_control*/
4773 /*FUNCTION:------------------------------------------------------
4774 * NAME
4775 * proto_reg_handoff_zbee_zcl_level_control
4776 * DESCRIPTION
4777 * Hands off the ZCL Level Control dissector.
4778 * PARAMETERS
4779 * none
4780 * RETURNS
4781 * none
4782 *---------------------------------------------------------------
4784 void
4785 proto_reg_handoff_zbee_zcl_level_control(void)
4787 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_LEVEL_CONTROL,
4788 proto_zbee_zcl_level_control,
4789 ett_zbee_zcl_level_control,
4790 ZBEE_ZCL_CID_LEVEL_CONTROL,
4791 ZBEE_MFG_CODE_NONE,
4792 hf_zbee_zcl_level_control_attr_id,
4793 hf_zbee_zcl_level_control_attr_id,
4794 hf_zbee_zcl_level_control_srv_rx_cmd_id,
4796 (zbee_zcl_fn_attr_data)dissect_zcl_level_control_attr_data
4798 } /*proto_reg_handoff_zbee_zcl_level_control*/
4801 /* ########################################################################## */
4802 /* #### (0x000B) RSSI LOCATION CLUSTER ###################################### */
4803 /* ########################################################################## */
4805 /*************************/
4806 /* Defines */
4807 /*************************/
4809 /* Attributes */
4810 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE 0x0000 /* Location Type */
4811 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD 0x0001 /* Location Method */
4812 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_AGE 0x0002 /* Location Age */
4813 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_QUALITY_MEASURE 0x0003 /* Quality Measure */
4814 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_OF_DEVICES 0x0004 /* Number of Devices */
4815 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_1 0x0010 /* Coordinate 1 */
4816 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_2 0x0011 /* Coordinate 2 */
4817 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_3 0x0012 /* Coordinate 3 */
4818 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_POWER 0x0013 /* Power */
4819 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_PATH_LOSS_EXPONENT 0x0014 /* Path Loss Exponent */
4820 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_REPORTING_PERIOD 0x0015 /* Reporting Period */
4821 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_CALCULATION_PERIOD 0x0016 /* Calculation Period */
4822 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_RSSI_MEAS 0x0017 /* Number RSSI Measurements */
4824 /* Location Type Mask Values */
4825 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_ABSOLUTE 0x01 /* Absolute/Measured */
4826 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_2D 0x02 /* 2D/3D */
4827 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_COORDINATE 0x0C /* Coordinate System */
4828 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_RESERVED 0xF0 /* Coordinate System */
4830 /* Location Method Values */
4831 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_LATERATION 0x00 /* Lateration */
4832 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_SIGNPOSTING 0x01 /* Signposting */
4833 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_RF_FINGERPRINTING 0x02 /* RF Fingerprinting */
4834 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_OUT_OF_BAND 0x03 /* Out of Band */
4835 #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_CENTRALIZED 0x04 /* Centralized */
4837 /* Server Commands Received */
4838 #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_ABSOLUTE_LOCATION 0x00 /* Set Absolute Location */
4839 #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_DEVICE_CONFIG 0x01 /* Set Device Configuration */
4840 #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_DEVICE_CONFIG 0x02 /* Get Device Configuration */
4841 #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_LOCATION_DATA 0x03 /* Get Location Data */
4842 #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_RESPONSE 0x04 /* RSSI Response */
4843 #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SEND_PINGS 0x05 /* Send Pings */
4844 #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_ANCHOR_NODE_ANNOUNCE 0x06 /* Anchor Node Announce */
4847 /* Server Commands Generated */
4848 #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_DEVICE_CONFIG_RESPONSE 0x00 /* Device Configuration Response */
4849 #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_RESPONSE 0x01 /* Location Data Response */
4850 #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_NOTIF 0x02 /* Location Data Notification */
4851 #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_COMPACT_LOCATION_DATA_NOTIF 0x03 /* Compact Location Data Notification */
4852 #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_PING 0x04 /* RSSI Ping */
4853 #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_REQUEST 0x05 /* RSSI Request */
4854 #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REPORT_RSSI_MEAS 0x06 /* Report RSSI Measurements */
4855 #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REQUEST_OWN_LOCATION 0x07 /* Request Own Location */
4858 /*************************/
4859 /* Function Declarations */
4860 /*************************/
4862 void proto_register_zbee_zcl_rssi_location(void);
4863 void proto_reg_handoff_zbee_zcl_rssi_location(void);
4865 /* Command Dissector Helpers */
4866 static void dissect_zcl_rssi_location_set_absolute_location (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4867 static void dissect_zcl_rssi_location_set_device_config (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4868 static void dissect_zcl_rssi_location_get_device_config (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4869 static void dissect_zcl_rssi_location_get_location_data (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4870 static void dissect_zcl_rssi_location_rssi_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4871 static void dissect_zcl_rssi_location_send_pings (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4872 static void dissect_zcl_rssi_location_anchor_node_announce (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4874 static void dissect_zcl_rssi_location_device_config_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4875 static void dissect_zcl_rssi_location_location_data_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4876 static void dissect_zcl_rssi_location_location_data_notif (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4877 static void dissect_zcl_rssi_location_compact_location_data_notif (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4878 static void dissect_zcl_rssi_location_rssi_ping (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4879 static void dissect_zcl_rssi_location_report_rssi_meas (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4880 static void dissect_zcl_rssi_location_request_own_location (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4882 static void dissect_zcl_rssi_location_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
4884 /* Private functions prototype */
4886 /*************************/
4887 /* Global Variables */
4888 /*************************/
4889 /* Initialize the protocol and registered fields */
4890 static int proto_zbee_zcl_rssi_location;
4892 static int hf_zbee_zcl_rssi_location_attr_id;
4893 static int hf_zbee_zcl_rssi_location_location_type;
4894 static int hf_zbee_zcl_rssi_location_location_type_absolute;
4895 static int hf_zbee_zcl_rssi_location_location_type_2D;
4896 static int hf_zbee_zcl_rssi_location_location_type_coordinate_system;
4897 static int hf_zbee_zcl_rssi_location_location_type_reserved;
4898 static int hf_zbee_zcl_rssi_location_attr_id_location_method;
4899 static int hf_zbee_zcl_rssi_location_coordinate1;
4900 static int hf_zbee_zcl_rssi_location_coordinate2;
4901 static int hf_zbee_zcl_rssi_location_coordinate3;
4902 static int hf_zbee_zcl_rssi_location_power;
4903 static int hf_zbee_zcl_rssi_location_path_loss_expo;
4904 static int hf_zbee_zcl_rssi_location_calc_period;
4905 static int hf_zbee_zcl_rssi_location_number_rssi_meas;
4906 static int hf_zbee_zcl_rssi_location_reporting_period;
4907 static int hf_zbee_zcl_rssi_location_target_add;
4908 static int hf_zbee_zcl_rssi_location_header;
4909 static int hf_zbee_zcl_rssi_location_header_abs_only;
4910 static int hf_zbee_zcl_rssi_location_header_recalc;
4911 static int hf_zbee_zcl_rssi_location_header_bcast_ind;
4912 static int hf_zbee_zcl_rssi_location_header_bcast_res;
4913 static int hf_zbee_zcl_rssi_location_header_compact_res;
4914 static int hf_zbee_zcl_rssi_location_header_res;
4915 static int hf_zbee_zcl_rssi_location_number_responses;
4916 static int hf_zbee_zcl_rssi_location_replaying_device;
4917 static int hf_zbee_zcl_rssi_location_rssi;
4918 static int hf_zbee_zcl_rssi_location_anchor_node_add;
4919 static int hf_zbee_zcl_rssi_location_status;
4920 static int hf_zbee_zcl_rssi_location_quality_measure;
4921 static int hf_zbee_zcl_rssi_location_location_age;
4922 static int hf_zbee_zcl_rssi_location_reporting_add;
4923 static int hf_zbee_zcl_rssi_location_no_of_neigh;
4924 static int hf_zbee_zcl_rssi_location_neighbour_add;
4925 static int hf_zbee_zcl_rssi_location_request_add;
4926 static int hf_zbee_zcl_rssi_location_srv_rx_cmd_id;
4927 static int hf_zbee_zcl_rssi_location_srv_tx_cmd_id;
4929 /* Initialize the subtree pointers */
4930 static int ett_zbee_zcl_rssi_location;
4931 static int ett_zbee_zcl_rssi_location_location_type;
4932 static int ett_zbee_zcl_rssi_location_header;
4934 /* Attributes */
4935 static const value_string zbee_zcl_rssi_location_attr_names[] = {
4936 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE, "Location Type" },
4937 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD, "Location Method" },
4938 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_AGE, "Location Age" },
4939 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_QUALITY_MEASURE, "Quality Measure" },
4940 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_OF_DEVICES, "Number of Devices" },
4941 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_1, "Coordinate 1" },
4942 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_2, "Coordinate 2" },
4943 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_3, "Coordinate 3" },
4944 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_POWER, "Power" },
4945 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_PATH_LOSS_EXPONENT, "Path Loss Exponent" },
4946 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_REPORTING_PERIOD, "Reporting Period" },
4947 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_CALCULATION_PERIOD, "Calculation Period" },
4948 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_RSSI_MEAS, "Number RSSI Measurements" },
4949 { 0, NULL }
4952 /* Server Commands Received */
4953 static const value_string zbee_zcl_rssi_location_srv_rx_cmd_names[] = {
4954 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_ABSOLUTE_LOCATION, "Set Absolute Location" },
4955 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_DEVICE_CONFIG, "Set Device Configuration" },
4956 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_DEVICE_CONFIG, "Get Device Configuration" },
4957 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_LOCATION_DATA, "Get Location Data" },
4958 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_RESPONSE, "RSSI Response" },
4959 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SEND_PINGS, "Send Pings" },
4960 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_ANCHOR_NODE_ANNOUNCE, "Anchor Node Announce" },
4961 { 0, NULL }
4964 /* Server Commands Generated */
4965 static const value_string zbee_zcl_rssi_location_srv_tx_cmd_names[] = {
4966 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_DEVICE_CONFIG_RESPONSE, "Device Configuration Response" },
4967 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_RESPONSE, "Location Data Response" },
4968 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_NOTIF, "Location Data Notification" },
4969 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_COMPACT_LOCATION_DATA_NOTIF, "Compact Location Data Notification" },
4970 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_PING, "RSSI Ping" },
4971 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_REQUEST, "RSSI Request" },
4972 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REPORT_RSSI_MEAS, "Report RSSI Measurements" },
4973 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REQUEST_OWN_LOCATION, "Request Own Location" },
4974 { 0, NULL }
4977 /* Location Method Values */
4978 static const value_string zbee_zcl_rssi_location_location_method_values[] = {
4979 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_LATERATION, "Lateration" },
4980 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_SIGNPOSTING, "Signposting" },
4981 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_RF_FINGERPRINTING, "RF Fingerprinting" },
4982 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_OUT_OF_BAND, "Out of Band" },
4983 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_CENTRALIZED, "Centralized" },
4984 { 0, NULL }
4987 /* Location type absolute values*/
4988 static const value_string zbee_zcl_rssi_location_location_type_abs_values[] = {
4989 {0, "Measured Location"},
4990 {1, "Absolute Location"},
4991 {0, NULL}
4994 /* Location type 2D/3D values*/
4995 static const value_string zbee_zcl_rssi_location_location_type_2D_values[] = {
4996 {0, "Three Dimensional"},
4997 {1, "Two Dimensional"},
4998 {0, NULL}
5001 /* Location type Coordinate System values*/
5002 static const value_string zbee_zcl_rssi_location_location_type_coordinate_values[] = {
5003 {0, "Rectangular"},
5004 {1, "Reserved"},
5005 {2, "Reserved"},
5006 {3, "Reserved"},
5007 {0, NULL}
5010 /*************************/
5011 /* Function Bodies */
5012 /*************************/
5014 /*FUNCTION:------------------------------------------------------
5015 * NAME
5016 * dissect_zbee_zcl_rssi_location
5017 * DESCRIPTION
5018 * ZigBee ZCL RSSI Location cluster dissector for wireshark.
5019 * PARAMETERS
5020 * tvbuff_t *tvb - pointer to buffer containing raw packet.
5021 * packet_info *pinfo - pointer to packet information fields
5022 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
5023 * RETURNS
5024 * none
5025 *---------------------------------------------------------------
5027 static int
5028 dissect_zbee_zcl_rssi_location(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
5030 proto_tree *payload_tree;
5031 zbee_zcl_packet *zcl;
5032 unsigned offset = 0;
5033 uint8_t cmd_id;
5034 int rem_len;
5036 /* Reject the packet if data is NULL */
5037 if (data == NULL)
5038 return 0;
5039 zcl = (zbee_zcl_packet *)data;
5040 cmd_id = zcl->cmd_id;
5042 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
5043 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
5044 /* Append the command name to the info column. */
5045 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
5046 val_to_str_const(cmd_id, zbee_zcl_rssi_location_srv_rx_cmd_names, "Unknown Command"),
5047 zcl->tran_seqno);
5049 /* Add the command ID. */
5050 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5052 /* Check if this command has a payload, then add the payload tree */
5053 rem_len = tvb_reported_length_remaining(tvb, ++offset);
5054 if (rem_len > 0) {
5055 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_rssi_location, NULL, "Payload");
5057 /* Call the appropriate command dissector */
5058 switch (cmd_id) {
5059 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_ABSOLUTE_LOCATION:
5060 dissect_zcl_rssi_location_set_absolute_location(tvb, payload_tree, &offset);
5061 break;
5063 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_DEVICE_CONFIG:
5064 dissect_zcl_rssi_location_set_device_config(tvb, payload_tree, &offset);
5065 break;
5067 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_DEVICE_CONFIG:
5068 dissect_zcl_rssi_location_get_device_config(tvb, payload_tree, &offset);
5069 break;
5071 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_LOCATION_DATA:
5072 dissect_zcl_rssi_location_get_location_data(tvb, payload_tree, &offset);
5073 break;
5075 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_RESPONSE:
5076 dissect_zcl_rssi_location_rssi_response(tvb, payload_tree, &offset);
5077 break;
5079 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SEND_PINGS:
5080 dissect_zcl_rssi_location_send_pings(tvb, payload_tree, &offset);
5081 break;
5083 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_ANCHOR_NODE_ANNOUNCE:
5084 dissect_zcl_rssi_location_anchor_node_announce(tvb, payload_tree, &offset);
5085 break;
5087 default:
5088 break;
5092 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
5093 /* Append the command name to the info column. */
5094 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
5095 val_to_str_const(cmd_id, zbee_zcl_rssi_location_srv_tx_cmd_names, "Unknown Command"),
5096 zcl->tran_seqno);
5098 /* Add the command ID. */
5099 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
5101 /* Check if this command has a payload, then add the payload tree */
5102 rem_len = tvb_reported_length_remaining(tvb, ++offset);
5103 if (rem_len > 0) {
5104 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_rssi_location, NULL, "Payload");
5106 /* Call the appropriate command dissector */
5107 switch (cmd_id) {
5108 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_DEVICE_CONFIG_RESPONSE:
5109 dissect_zcl_rssi_location_device_config_response(tvb, payload_tree, &offset);
5110 break;
5111 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_RESPONSE:
5112 dissect_zcl_rssi_location_location_data_response(tvb, payload_tree, &offset);
5113 break;
5115 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_NOTIF:
5116 dissect_zcl_rssi_location_location_data_notif(tvb, payload_tree, &offset);
5117 break;
5119 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_COMPACT_LOCATION_DATA_NOTIF:
5120 dissect_zcl_rssi_location_compact_location_data_notif(tvb, payload_tree, &offset);
5121 break;
5123 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_PING:
5124 dissect_zcl_rssi_location_rssi_ping(tvb, payload_tree, &offset);
5125 break;
5127 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_REQUEST:
5128 /* No Payload */
5129 break;
5131 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REPORT_RSSI_MEAS:
5132 dissect_zcl_rssi_location_report_rssi_meas(tvb, payload_tree, &offset);
5133 break;
5135 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REQUEST_OWN_LOCATION:
5136 dissect_zcl_rssi_location_request_own_location(tvb, payload_tree, &offset);
5137 break;
5139 default:
5140 break;
5145 return tvb_captured_length(tvb);
5146 } /*dissect_zbee_zcl_rssi_location*/
5149 /*FUNCTION:------------------------------------------------------
5150 * NAME
5151 * dissect_zcl_rssi_location_set_absolute_location
5152 * DESCRIPTION
5153 * this function decodes the Set Absolute Location payload.
5154 * PARAMETERS
5155 * tvb - the tv buffer of the current data_type
5156 * tree - the tree to append this item to
5157 * offset - offset of data in tvb
5158 * RETURNS
5159 * none
5160 *---------------------------------------------------------------
5162 static void
5163 dissect_zcl_rssi_location_set_absolute_location(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5165 /* Retrieve "Coordinate 1" field */
5166 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5167 *offset += 2;
5169 /* Retrieve "Coordinate 2" field */
5170 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5171 *offset += 2;
5173 /* Retrieve "Coordinate 3" field */
5174 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5175 *offset += 2;
5177 /* Retrieve "Power" field */
5178 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5179 *offset += 2;
5181 /* Retrieve "Path Loss Exponent" field */
5182 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_path_loss_expo, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5183 *offset += 2;
5185 } /*dissect_zcl_rssi_location_set_absolute_location*/
5188 /*FUNCTION:--------------------------------------------------------------------
5189 * NAME
5190 * dissect_zcl_rssi_location_set_device_config
5191 * DESCRIPTION
5192 * this function decodes the Set Device Configuration payload.
5193 * PARAMETERS
5194 * tvb - the tv buffer of the current data_type
5195 * tree - the tree to append this item to
5196 * offset - offset of data in tvb
5197 * RETURNS
5198 * none
5199 *------------------------------------------------------------------------------
5201 static void
5202 dissect_zcl_rssi_location_set_device_config(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5204 /* Retrieve "Power" field */
5205 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5206 *offset += 2;
5208 /* Retrieve "Path Loss Exponent" field */
5209 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_path_loss_expo, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5210 *offset += 2;
5212 /* Retrieve "Calculation Period" field */
5213 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_calc_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5214 *offset += 2;
5216 /* Retrieve "Number RSSI Measurements" field */
5217 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_rssi_meas, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
5218 *offset += 1;
5220 /* Retrieve "Reporting Period" field */
5221 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_reporting_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5222 *offset += 2;
5224 } /*dissect_zcl_rssi_location_set_device_config*/
5227 /*FUNCTION:-------------------------------------------------------------------
5228 * NAME
5229 * dissect_zcl_rssi_location_get_device_config
5230 * DESCRIPTION
5231 * this function decodes the Get Device Configuration payload.
5232 * PARAMETERS
5233 * tvb - the tv buffer of the current data_type
5234 * tree - the tree to append this item to
5235 * offset - offset of data in tvb
5236 * RETURNS
5237 * none
5238 *-----------------------------------------------------------------------------
5240 static void
5241 dissect_zcl_rssi_location_get_device_config(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5243 /* Retrieve "Target Address" field */
5244 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_target_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
5245 *offset += 8;
5247 } /*dissect_zcl_rssi_location_get_device_config*/
5250 /*FUNCTION:-------------------------------------------------------------------
5251 * NAME
5252 * dissect_zcl_rssi_location_get_location_data
5253 * DESCRIPTION
5254 * this function decodes the Get Location Data payload.
5255 * PARAMETERS
5256 * tvb - the tv buffer of the current data_type
5257 * tree - the tree to append this item to
5258 * offset - offset of data in tvb
5259 * RETURNS
5260 * none
5261 *-----------------------------------------------------------------------------
5263 static void
5264 dissect_zcl_rssi_location_get_location_data(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5266 uint8_t header;
5268 static int * const location_header_fields[] = {
5269 &hf_zbee_zcl_rssi_location_header_abs_only,
5270 &hf_zbee_zcl_rssi_location_header_recalc,
5271 &hf_zbee_zcl_rssi_location_header_bcast_ind,
5272 &hf_zbee_zcl_rssi_location_header_bcast_res,
5273 &hf_zbee_zcl_rssi_location_header_compact_res,
5274 &hf_zbee_zcl_rssi_location_header_res,
5275 NULL
5278 /* Retrieve "8-bit header" field */
5279 header = tvb_get_uint8(tvb, *offset);
5280 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_rssi_location_header, ett_zbee_zcl_rssi_location_header, location_header_fields, ENC_LITTLE_ENDIAN);
5281 *offset += 1;
5283 /* Retrieve the number responses field */
5284 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_responses, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
5285 *offset += 1;
5287 /* Retrieve the IEEE address field */
5288 if(header & 0x04)
5290 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_target_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
5291 *offset += 8;
5294 } /*dissect_zcl_rssi_location_get_location_data*/
5297 /*FUNCTION:--------------------------------------------------------------------
5298 * NAME
5299 * dissect_zcl_rssi_location_rssi_response
5300 * DESCRIPTION
5301 * this function decodes the RSSI Response payload.
5302 * PARAMETERS
5303 * tvb - the tv buffer of the current data_type
5304 * tree - the tree to append this item to
5305 * offset - offset of data in tvb
5306 * RETURNS
5307 * none
5308 *------------------------------------------------------------------------------
5310 static void
5311 dissect_zcl_rssi_location_rssi_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5313 /* Retrieve "Replaying Device" field */
5314 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_replaying_device, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
5315 *offset += 8;
5317 /* Retrieve "Coordinate 1" field */
5318 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5319 *offset += 2;
5321 /* Retrieve "Coordinate 2" field */
5322 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5323 *offset += 2;
5325 /* Retrieve "Coordinate 3" field */
5326 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5327 *offset += 2;
5329 /* Retrieve "RSSI" field */
5330 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_rssi, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
5331 *offset += 1;
5333 /* Retrieve "Number RSSI Measurements" field */
5334 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_rssi_meas, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
5335 *offset += 1;
5337 } /*dissect_zcl_rssi_location_rssi_response*/
5340 /*FUNCTION:------------------------------------------------------
5341 * NAME
5342 * dissect_zcl_rssi_location_send_pings
5343 * DESCRIPTION
5344 * this function decodes the Send Pings payload.
5345 * PARAMETERS
5346 * tvb - the tv buffer of the current data_type
5347 * tree - the tree to append this item to
5348 * offset - offset of data in tvb
5349 * RETURNS
5350 * none
5351 *---------------------------------------------------------------
5353 static void
5354 dissect_zcl_rssi_location_send_pings(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5356 /* Retrieve "Target Address" field */
5357 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_target_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
5358 *offset += 8;
5360 /* Retrieve "Number RSSI Measurements" field */
5361 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_rssi_meas, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
5362 *offset += 1;
5364 /* Retrieve "Calculation Period" field */
5365 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_calc_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5366 *offset += 2;
5368 } /*dissect_zcl_rssi_location_send_pings*/
5371 /*FUNCTION:------------------------------------------------------
5372 * NAME
5373 * dissect_zcl_rssi_location_anchor_node_announce
5374 * DESCRIPTION
5375 * this function decodes the Anchor Node Announce payload
5376 * PARAMETERS
5377 * tvb - the tv buffer of the current data_type
5378 * tree - the tree to append this item to
5379 * offset - offset of data in tvb
5380 * RETURNS
5381 * none
5382 *---------------------------------------------------------------
5384 static void
5385 dissect_zcl_rssi_location_anchor_node_announce(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5387 /* Retrieve "Anchor Node Address" field */
5388 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_anchor_node_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
5389 *offset += 8;
5391 /* Retrieve "Coordinate 1" field */
5392 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5393 *offset += 2;
5395 /* Retrieve "Coordinate 2" field */
5396 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5397 *offset += 2;
5399 /* Retrieve "Coordinate 3" field */
5400 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5401 *offset += 2;
5403 } /*dissect_zcl_rssi_location_anchor_node_announce*/
5406 /*FUNCTION:--------------------------------------------------------------------
5407 * NAME
5408 * dissect_zcl_rssi_location_device_config_response
5409 * DESCRIPTION
5410 * this function decodes the Device Configuration Response payload.
5411 * PARAMETERS
5412 * tvb - the tv buffer of the current data_type
5413 * tree - the tree to append this item to
5414 * offset - offset of data in tvb
5415 * RETURNS
5416 * none
5417 *------------------------------------------------------------------------------
5419 static void
5420 dissect_zcl_rssi_location_device_config_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5422 uint8_t status;
5424 /* Retrieve "Status" field */
5425 status = tvb_get_uint8(tvb, *offset);
5426 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
5427 *offset += 1;
5429 if(status == ZBEE_ZCL_STAT_SUCCESS)
5431 /* Retrieve "Power" field */
5432 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5433 *offset += 2;
5435 /* Retrieve "Path Loss Exponent" field */
5436 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_path_loss_expo, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5437 *offset += 2;
5439 /* Retrieve "Calculation Period" field */
5440 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_calc_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5441 *offset += 2;
5443 /* Retrieve "Number RSSI Measurements" field */
5444 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_rssi_meas, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
5445 *offset += 1;
5447 /* Retrieve "Reporting Period" field */
5448 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_reporting_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5449 *offset += 2;
5452 } /*dissect_zcl_rssi_location_device_config_response*/
5455 /*FUNCTION:------------------------------------------------------
5456 * NAME
5457 * dissect_zcl_rssi_location_location_data_response
5458 * DESCRIPTION
5459 * this function decodes the Location Data Response payload.
5460 * PARAMETERS
5461 * tvb - the tv buffer of the current data_type
5462 * tree - the tree to append this item to
5463 * offset - offset of data in tvb
5464 * RETURNS
5465 * none
5466 *---------------------------------------------------------------
5468 static void
5469 dissect_zcl_rssi_location_location_data_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5471 uint8_t status;
5473 /* Retrieve "Status" field */
5474 status = tvb_get_uint8(tvb, *offset);
5475 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
5476 *offset += 1;
5478 if(status == ZBEE_ZCL_STAT_SUCCESS)
5480 /* Retrieve "Location Type" field */
5481 dissect_zcl_rssi_location_attr_data(tree, tvb, offset, ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE, ZBEE_ZCL_8_BIT_DATA, false);
5483 /* Retrieve "Coordinate 1" field */
5484 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5485 *offset += 2;
5487 /* Retrieve "Coordinate 2" field */
5488 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5489 *offset += 2;
5491 /* Retrieve "Coordinate 3" field */
5492 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5493 *offset += 2;
5495 /* Retrieve "Power" field */
5496 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5497 *offset += 2;
5499 /* Retrieve "Path Loss Exponent" field */
5500 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_path_loss_expo, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5501 *offset += 2;
5503 /* Retrieve "Location Method" field */
5504 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_attr_id_location_method, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
5505 *offset += 1;
5507 /* Retrieve "Quality Measure" field */
5508 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_quality_measure, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
5509 *offset += 1;
5511 /* Retrieve "Location Age" field */
5512 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_location_age, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5513 *offset += 2;
5516 } /*dissect_zcl_rssi_location_location_data_response*/
5519 /*FUNCTION:------------------------------------------------------
5520 * NAME
5521 * dissect_zcl_rssi_location_location_data_notif
5522 * DESCRIPTION
5523 * this function decodes the Location Data Notification payload.
5524 * PARAMETERS
5525 * tvb - the tv buffer of the current data_type
5526 * tree - the tree to append this item to
5527 * offset - offset of data in tvb
5528 * RETURNS
5529 * none
5530 *---------------------------------------------------------------
5532 static void
5533 dissect_zcl_rssi_location_location_data_notif(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5535 uint8_t temp;
5537 /* Retrieve "Location Type" field */
5538 temp = tvb_get_uint8(tvb, *offset);
5539 dissect_zcl_rssi_location_attr_data(tree, tvb, offset, ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE, ZBEE_ZCL_8_BIT_DATA, false);
5541 /* Retrieve "Coordinate 1" field */
5542 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5543 *offset += 2;
5545 /* Retrieve "Coordinate 2" field */
5546 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5547 *offset += 2;
5549 if((temp & ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_2D) != 0x02)
5551 /* Retrieve "Coordinate 3" field */
5552 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5553 *offset += 2;
5556 /* Retrieve "Power" field */
5557 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5558 *offset += 2;
5560 /* Retrieve "Path Loss Exponent" field */
5561 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_path_loss_expo, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5562 *offset += 2;
5564 if((temp & ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_COORDINATE) != 0x0C)
5566 /* Retrieve "Location Method" field */
5567 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_attr_id_location_method, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
5568 *offset += 1;
5570 /* Retrieve "Quality Measure" field */
5571 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_quality_measure, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
5572 *offset += 1;
5574 /* Retrieve "Location Age" field */
5575 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_location_age, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5576 *offset += 2;
5580 } /*dissect_zcl_rssi_location_location_data_notif*/
5583 /*FUNCTION:------------------------------------------------------
5584 * NAME
5585 * dissect_zcl_rssi_location_compact_location_data_notif
5586 * DESCRIPTION
5587 * this function decodes the Location Data Notification payload.
5588 * PARAMETERS
5589 * tvb - the tv buffer of the current data_type
5590 * tree - the tree to append this item to
5591 * offset - offset of data in tvb
5592 * RETURNS
5593 * none
5594 *---------------------------------------------------------------
5596 static void
5597 dissect_zcl_rssi_location_compact_location_data_notif(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5599 uint8_t temp;
5601 /* Retrieve "Location Type" field */
5602 temp = tvb_get_uint8(tvb, *offset);
5603 dissect_zcl_rssi_location_attr_data(tree, tvb, offset, ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE, ZBEE_ZCL_8_BIT_DATA, false);
5605 /* Retrieve "Coordinate 1" field */
5606 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5607 *offset += 2;
5609 /* Retrieve "Coordinate 2" field */
5610 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5611 *offset += 2;
5613 if((temp & ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_2D) != 0x02)
5615 /* Retrieve "Coordinate 3" field */
5616 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5617 *offset += 2;
5620 if((temp & ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_COORDINATE) != 0x0C)
5622 /* Retrieve "Quality Measure" field */
5623 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_quality_measure, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
5624 *offset += 1;
5626 /* Retrieve "Location Age" field */
5627 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_location_age, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5628 *offset += 2;
5632 } /*dissect_zcl_rssi_location_compact_location_data_notif*/
5634 /*FUNCTION:------------------------------------------------------
5635 * NAME
5636 * dissect_zcl_rssi_location_rssi_ping
5637 * DESCRIPTION
5638 * this function decodes the RSSI Ping payload.
5639 * PARAMETERS
5640 * tvb - the tv buffer of the current data_type
5641 * tree - the tree to append this item to
5642 * offset - offset of data in tvb
5643 * RETURNS
5644 * none
5645 *---------------------------------------------------------------
5647 static void
5648 dissect_zcl_rssi_location_rssi_ping(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5650 /* Retrieve "Location Type" field */
5651 dissect_zcl_rssi_location_attr_data(tree, tvb, offset, ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE, ZBEE_ZCL_8_BIT_DATA, false);
5654 } /*dissect_zcl_rssi_location_rssi_ping*/
5657 /*FUNCTION:------------------------------------------------------
5658 * NAME
5659 * dissect_zcl_rssi_location_report_rssi_meas
5660 * DESCRIPTION
5661 * this function decodes the Report RSSI Measurements payload
5662 * PARAMETERS
5663 * tvb - the tv buffer of the current data_type
5664 * tree - the tree to append this item to
5665 * offset - offset of data in tvb
5666 * RETURNS
5667 * none
5668 *---------------------------------------------------------------
5670 static void
5671 dissect_zcl_rssi_location_report_rssi_meas(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5673 uint8_t count, i;
5674 /* Retrieve "Reporting Address" field */
5675 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_reporting_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
5676 *offset += 8;
5678 /* Retrieve "Number of Neighbours" field */
5679 count = tvb_get_uint8(tvb, *offset);
5680 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_no_of_neigh, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
5681 *offset += 1;
5683 for( i = 0; i < count; i++)
5685 /* Retrieve "Neighbour Address" field */
5686 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_neighbour_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
5687 *offset += 8;
5689 /* Retrieve "Coordinate 1" field */
5690 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5691 *offset += 2;
5693 /* Retrieve "Coordinate 2" field */
5694 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5695 *offset += 2;
5697 /* Retrieve "Coordinate 3" field */
5698 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
5699 *offset += 2;
5701 /* Retrieve "RSSI" field */
5702 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_rssi, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
5703 *offset += 1;
5705 /* Retrieve "Number RSSI Measurements" field */
5706 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_rssi_meas, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
5707 *offset += 1;
5710 } /*dissect_zcl_rssi_location_report_rssi_meas*/
5713 /*FUNCTION:-------------------------------------------------------------------
5714 * NAME
5715 * dissect_zcl_rssi_location_request_own_location
5716 * DESCRIPTION
5717 * this function decodes the Request Own Location payload.
5718 * PARAMETERS
5719 * tvb - the tv buffer of the current data_type
5720 * tree - the tree to append this item to
5721 * offset - offset of data in tvb
5722 * RETURNS
5723 * none
5724 *-----------------------------------------------------------------------------
5726 static void
5727 dissect_zcl_rssi_location_request_own_location(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5729 /* Retrieve "Requesting Address Address" field */
5730 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_request_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
5731 *offset += 8;
5733 } /*dissect_zcl_rssi_location_request_own_location*/
5736 /*FUNCTION:------------------------------------------------------
5737 * NAME
5738 * dissect_zcl_rssi_location_attr_data
5739 * DESCRIPTION
5740 * this function is called by ZCL foundation dissector in order to decode
5741 * specific cluster attributes data.
5742 * PARAMETERS
5743 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
5744 * tvbuff_t *tvb - pointer to buffer containing raw packet.
5745 * unsigned *offset - pointer to buffer offset
5746 * uint16_t attr_id - attribute identifier
5747 * unsigned data_type - attribute data type
5748 * bool client_attr- ZCL client
5749 * RETURNS
5750 * none
5751 *---------------------------------------------------------------
5753 void
5754 dissect_zcl_rssi_location_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
5756 static int * const location_type[] = {
5757 &hf_zbee_zcl_rssi_location_location_type_absolute,
5758 &hf_zbee_zcl_rssi_location_location_type_2D,
5759 &hf_zbee_zcl_rssi_location_location_type_coordinate_system,
5760 &hf_zbee_zcl_rssi_location_location_type_reserved,
5761 NULL
5764 /* Dissect attribute data type and data */
5765 switch ( attr_id ) {
5767 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE:
5768 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_rssi_location_location_type, ett_zbee_zcl_rssi_location_location_type, location_type, ENC_LITTLE_ENDIAN);
5769 *offset += 1;
5770 break;
5772 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD:
5773 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_attr_id_location_method, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
5774 *offset += 1;
5775 break;
5777 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_AGE:
5778 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_QUALITY_MEASURE:
5779 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_OF_DEVICES:
5780 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_1:
5781 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_2:
5782 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_3:
5783 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_POWER:
5784 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_PATH_LOSS_EXPONENT:
5785 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_REPORTING_PERIOD:
5786 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_CALCULATION_PERIOD:
5787 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_RSSI_MEAS:
5788 default:
5789 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
5790 break;
5793 } /*dissect_zcl_rssi_location_attr_data*/
5796 /*FUNCTION:------------------------------------------------------
5797 * NAME
5798 * proto_register_zbee_zcl_rssi_location
5799 * DESCRIPTION
5800 * ZigBee ZCL RSSI Location cluster protocol registration routine.
5801 * PARAMETERS
5802 * none
5803 * RETURNS
5804 * void
5805 *---------------------------------------------------------------
5807 void
5808 proto_register_zbee_zcl_rssi_location(void)
5810 /* Setup list of header fields */
5811 static hf_register_info hf[] = {
5813 { &hf_zbee_zcl_rssi_location_attr_id,
5814 { "Attribute", "zbee_zcl_general.rssi_location.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_rssi_location_attr_names),
5815 0x00, NULL, HFILL } },
5817 /* start Location Type fields */
5818 { &hf_zbee_zcl_rssi_location_location_type,
5819 { "Location Type", "zbee_zcl_general.rssi_location.attr_id.location_type", FT_UINT8, BASE_HEX, NULL,
5820 0x00, NULL, HFILL } },
5822 { &hf_zbee_zcl_rssi_location_location_type_absolute,
5823 { "Location Type Absolute/Measured", "zbee_zcl_general.rssi_location.attr_id.location_type.abs", FT_UINT8, BASE_HEX, VALS(zbee_zcl_rssi_location_location_type_abs_values),
5824 ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_ABSOLUTE, NULL, HFILL } },
5826 { &hf_zbee_zcl_rssi_location_location_type_2D,
5827 { "Location Type 2D/3D", "zbee_zcl_general.rssi_location.attr_id.location_type.2D", FT_UINT8, BASE_HEX, VALS(zbee_zcl_rssi_location_location_type_2D_values),
5828 ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_2D, NULL, HFILL } },
5830 { &hf_zbee_zcl_rssi_location_location_type_coordinate_system,
5831 { "Location Type Coordinate System", "zbee_zcl_general.rssi_location.attr_id.location_type.coordinate", FT_UINT8, BASE_HEX, VALS(zbee_zcl_rssi_location_location_type_coordinate_values),
5832 ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_COORDINATE, NULL, HFILL } },
5834 { &hf_zbee_zcl_rssi_location_location_type_reserved,
5835 { "Reserved", "zbee_zcl_general.rssi_location.attr_id.location_type.reserved", FT_BOOLEAN, 8, NULL,
5836 ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_RESERVED, NULL, HFILL } },
5837 /* end Location Type fields */
5839 { &hf_zbee_zcl_rssi_location_attr_id_location_method,
5840 { "Location Method", "zbee_zcl_general.rssi_location.attr_id.location_method", FT_UINT8, BASE_HEX, VALS(zbee_zcl_rssi_location_location_method_values),
5841 0x00, NULL, HFILL } },
5843 { &hf_zbee_zcl_rssi_location_coordinate1,
5844 { "Coordinate 1", "zbee_zcl_general.rssi_location.coordinate1", FT_UINT16, BASE_HEX, NULL,
5845 0x00, NULL, HFILL } },
5847 { &hf_zbee_zcl_rssi_location_coordinate2,
5848 { "Coordinate 2", "zbee_zcl_general.rssi_location.coordinate2", FT_UINT16, BASE_HEX, NULL,
5849 0x00, NULL, HFILL } },
5851 { &hf_zbee_zcl_rssi_location_coordinate3,
5852 { "Coordinate 3", "zbee_zcl_general.rssi_location.coordinate3", FT_UINT16, BASE_HEX, NULL,
5853 0x00, NULL, HFILL } },
5855 { &hf_zbee_zcl_rssi_location_power,
5856 { "Power", "zbee_zcl_general.rssi_location.power", FT_UINT16, BASE_HEX, NULL,
5857 0x00, NULL, HFILL } },
5859 { &hf_zbee_zcl_rssi_location_path_loss_expo,
5860 { "Path Loss Exponent", "zbee_zcl_general.rssi_location.path_loss_exponent", FT_UINT16, BASE_HEX, NULL,
5861 0x00, NULL, HFILL } },
5863 { &hf_zbee_zcl_rssi_location_calc_period,
5864 { "Calculation Period", "zbee_zcl_general.rssi_location.calc_period", FT_UINT16, BASE_HEX, NULL,
5865 0x00, NULL, HFILL } },
5867 { &hf_zbee_zcl_rssi_location_number_rssi_meas,
5868 { "Number RSSI Measurements", "zbee_zcl_general.rssi_location.number_rssi_meas", FT_UINT8, BASE_HEX, NULL,
5869 0x00, NULL, HFILL } },
5871 { &hf_zbee_zcl_rssi_location_reporting_period,
5872 { "Reporting Period", "zbee_zcl_general.rssi_location.reporting_period", FT_UINT16, BASE_HEX, NULL,
5873 0x00, NULL, HFILL } },
5875 { &hf_zbee_zcl_rssi_location_target_add,
5876 { "Target Address", "zbee_zcl_general.rssi_location.target_add", FT_UINT64, BASE_HEX, NULL,
5877 0x00, NULL, HFILL } },
5879 { &hf_zbee_zcl_rssi_location_header,
5880 { "Header Data", "zbee_zcl_general.rssi_location.location_header", FT_UINT8, BASE_HEX, NULL,
5881 0x00, NULL, HFILL } },
5883 { &hf_zbee_zcl_rssi_location_header_abs_only,
5884 { "Absolute Only", "zbee_zcl_general.rssi_location.header.abs_only", FT_BOOLEAN, 8, NULL,
5885 0x01, NULL, HFILL } },
5887 { &hf_zbee_zcl_rssi_location_header_recalc,
5888 { "Recalculate", "zbee_zcl_general.rssi_location.header.recalc", FT_BOOLEAN, 8, NULL,
5889 0x02, NULL, HFILL } },
5891 { &hf_zbee_zcl_rssi_location_header_bcast_ind,
5892 { "Broadcast Indicator", "zbee_zcl_general.rssi_location.header.bcast_ind", FT_BOOLEAN, 8, NULL,
5893 0x04, NULL, HFILL } },
5895 { &hf_zbee_zcl_rssi_location_header_bcast_res,
5896 { "Broadcast Response", "zbee_zcl_general.rssi_location.header.bcast_response", FT_BOOLEAN, 8, NULL,
5897 0x08, NULL, HFILL } },
5899 { &hf_zbee_zcl_rssi_location_header_compact_res,
5900 { "Compact Response", "zbee_zcl_general.rssi_location.compact_res", FT_BOOLEAN, 8, NULL,
5901 0x10, NULL, HFILL } },
5903 { &hf_zbee_zcl_rssi_location_header_res,
5904 { "Reserved", "zbee_zcl_general.rssi_location.reserved", FT_BOOLEAN, 8, NULL,
5905 0xE0, NULL, HFILL } },
5907 { &hf_zbee_zcl_rssi_location_number_responses,
5908 { "Number Responses", "zbee_zcl_general.rssi_location.number_responses", FT_UINT8, BASE_HEX, NULL,
5909 0x00, NULL, HFILL } },
5911 { &hf_zbee_zcl_rssi_location_replaying_device,
5912 { "Replying Device", "zbee_zcl_general.rssi_location.replying_device", FT_UINT64, BASE_HEX, NULL,
5913 0x00, NULL, HFILL } },
5915 { &hf_zbee_zcl_rssi_location_rssi,
5916 { "RSSI", "zbee_zcl_general.rssi_location.rssi", FT_UINT8, BASE_DEC, NULL,
5917 0x00, NULL, HFILL } },
5919 { &hf_zbee_zcl_rssi_location_anchor_node_add,
5920 { "Anchor Node Address", "zbee_zcl_general.rssi_location.anchor_node_add", FT_UINT64, BASE_HEX, NULL,
5921 0x00, NULL, HFILL } },
5923 { &hf_zbee_zcl_rssi_location_status,
5924 { "Status", "zbee_zcl_general.rssi_location.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names),
5925 0x00, NULL, HFILL } },
5927 { &hf_zbee_zcl_rssi_location_quality_measure,
5928 { "Quality Measure", "zbee_zcl_general.rssi_location.quality_measure", FT_UINT8, BASE_HEX, NULL,
5929 0x00, NULL, HFILL } },
5931 { &hf_zbee_zcl_rssi_location_location_age,
5932 { "Location Age", "zbee_zcl_general.rssi_location.location_age", FT_UINT16, BASE_HEX, NULL,
5933 0x00, NULL, HFILL } },
5935 { &hf_zbee_zcl_rssi_location_reporting_add,
5936 { "Reporting Address", "zbee_zcl_general.rssi_location.reporting_add", FT_UINT64, BASE_HEX, NULL,
5937 0x00, NULL, HFILL } },
5939 { &hf_zbee_zcl_rssi_location_no_of_neigh,
5940 { "Number of Neighbours", "zbee_zcl_general.rssi_location.no_of_neigh", FT_UINT8, BASE_DEC, NULL,
5941 0x00, NULL, HFILL } },
5943 { &hf_zbee_zcl_rssi_location_neighbour_add,
5944 { "Neighbour Address", "zbee_zcl_general.rssi_location.neighbour_add", FT_UINT64, BASE_HEX, NULL,
5945 0x00, NULL, HFILL } },
5947 { &hf_zbee_zcl_rssi_location_request_add,
5948 { "Requesting Address", "zbee_zcl_general.rssi_location.request_add", FT_UINT64, BASE_HEX, NULL,
5949 0x00, NULL, HFILL } },
5951 { &hf_zbee_zcl_rssi_location_srv_rx_cmd_id,
5952 { "Command", "zbee_zcl_general.rssi_location.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_rssi_location_srv_rx_cmd_names),
5953 0x00, NULL, HFILL } },
5955 { &hf_zbee_zcl_rssi_location_srv_tx_cmd_id,
5956 { "Command", "zbee_zcl_general.rssi_location.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_rssi_location_srv_tx_cmd_names),
5957 0x00, NULL, HFILL } }
5961 /* ZCL RSSI Location subtrees */
5962 static int *ett[] = {
5963 &ett_zbee_zcl_rssi_location,
5964 &ett_zbee_zcl_rssi_location_location_type,
5965 &ett_zbee_zcl_rssi_location_header
5968 /* Register the ZigBee ZCL RSSI Location cluster protocol name and description */
5969 proto_zbee_zcl_rssi_location = proto_register_protocol("ZigBee ZCL RSSI Location", "ZCL RSSI Location", ZBEE_PROTOABBREV_ZCL_RSSI_LOCATION);
5970 proto_register_field_array(proto_zbee_zcl_rssi_location, hf, array_length(hf));
5971 proto_register_subtree_array(ett, array_length(ett));
5973 /* Register the ZigBee ZCL RSSI Location dissector. */
5974 register_dissector(ZBEE_PROTOABBREV_ZCL_RSSI_LOCATION, dissect_zbee_zcl_rssi_location, proto_zbee_zcl_rssi_location);
5976 } /*proto_register_zbee_zcl_rssi_location*/
5979 /*FUNCTION:------------------------------------------------------
5980 * NAME
5981 * proto_reg_handoff_zbee_zcl_rssi_location
5982 * DESCRIPTION
5983 * Hands off the ZCL RSSI Location dissector.
5984 * PARAMETERS
5985 * none
5986 * RETURNS
5987 * none
5988 *---------------------------------------------------------------
5990 void
5991 proto_reg_handoff_zbee_zcl_rssi_location(void)
5993 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_RSSI_LOCATION,
5994 proto_zbee_zcl_rssi_location,
5995 ett_zbee_zcl_rssi_location,
5996 ZBEE_ZCL_CID_RSSI_LOCATION,
5997 ZBEE_MFG_CODE_NONE,
5998 hf_zbee_zcl_rssi_location_attr_id,
5999 hf_zbee_zcl_rssi_location_attr_id,
6000 hf_zbee_zcl_rssi_location_srv_rx_cmd_id,
6001 hf_zbee_zcl_rssi_location_srv_tx_cmd_id,
6002 (zbee_zcl_fn_attr_data)dissect_zcl_rssi_location_attr_data
6004 } /*proto_reg_handoff_zbee_zcl_rssi_location*/
6006 /****************************************************************************************************/
6007 /****************************************************************************************************/
6008 /****************************************************************************************************/
6011 /* Reliability Enumeration Values */
6012 #define ZBEE_ZCL_RELIABILITY_NO_FAULT_DETECTED 0x00 /* No Fault Detected */
6013 #define ZBEE_ZCL_RELIABILITY_NO_SENSOR 0x01 /* No Sensor */
6014 #define ZBEE_ZCL_RELIABILITY_OVER_RANGE 0x02 /* Over Range */
6015 #define ZBEE_ZCL_RELIABILITY_UNDER_RANGE 0x03 /* Under Range */
6016 #define ZBEE_ZCL_RELIABILITY_OPEN_LOOP 0x04 /* Open Loop */
6017 #define ZBEE_ZCL_RELIABILITY_SHORTED_LOOP 0x05 /* Shorted Loop */
6018 #define ZBEE_ZCL_RELIABILITY_NO_OUTPUT 0x06 /* No Output */
6019 #define ZBEE_ZCL_RELIABILITY_UNRELIABLE_OTHER 0x07 /* Unreliable Other */
6020 #define ZBEE_ZCL_RELIABILITY_PROCESS_ERROR 0x08 /* Process Error */
6021 #define ZBEE_ZCL_RELIABILITY_MULTI_STATE_FAULT 0x09 /* Multi-State Fault */
6022 #define ZBEE_ZCL_RELIABILITY_CONFIGURATION_ERROR 0x0A /* Configuration Error */
6024 static const value_string zbee_zcl_reliability_names[] = {
6025 {ZBEE_ZCL_RELIABILITY_NO_FAULT_DETECTED, "No Fault Detected"},
6026 {ZBEE_ZCL_RELIABILITY_NO_SENSOR, "No Sensor"},
6027 {ZBEE_ZCL_RELIABILITY_OVER_RANGE, "Over Range"},
6028 {ZBEE_ZCL_RELIABILITY_UNDER_RANGE, "Under Range"},
6029 {ZBEE_ZCL_RELIABILITY_OPEN_LOOP, "Open Loop"},
6030 {ZBEE_ZCL_RELIABILITY_SHORTED_LOOP, "Shorted Loop"},
6031 {ZBEE_ZCL_RELIABILITY_NO_OUTPUT, "No Output"},
6032 {ZBEE_ZCL_RELIABILITY_UNRELIABLE_OTHER, "Unreliable Other"},
6033 {ZBEE_ZCL_RELIABILITY_PROCESS_ERROR, "Process Error"},
6034 {ZBEE_ZCL_RELIABILITY_MULTI_STATE_FAULT, "Multi-State Fault"},
6035 {ZBEE_ZCL_RELIABILITY_CONFIGURATION_ERROR, "Configuration Error"},
6036 {0, NULL}
6039 /* Status Flags Mask Values */
6040 #define ZBEE_ZCL_STATUS_IN_ALARM 0x01 /* In Alarm Flag */
6041 #define ZBEE_ZCL_STATUS_FAULT 0x02 /* Fault Flag */
6042 #define ZBEE_ZCL_STATUS_OVERRIDDEN 0x04 /* Overridden Flag */
6043 #define ZBEE_ZCL_STATUS_OUT_OF_SERVICE 0x08 /* Out of Service Flag */
6046 /* ########################################################################## */
6047 /* #### (0x000C) ANALOG INPUT (BASIC) CLUSTER ############################### */
6048 /* ########################################################################## */
6050 /*************************/
6051 /* Defines */
6052 /*************************/
6054 /*Attributes*/
6055 #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_DESCRIPTION 0x001C /* Description */
6056 #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MAX_PRESENT_VALUE 0x0041 /* Max Present Value */
6057 #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MIN_PRESENT_VALUE 0x0045 /* Min Present Value */
6058 #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */
6059 #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_PRESENT_VALUE 0x0055 /* Present Value */
6060 #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RELIABILITY 0x0067 /* Reliability */
6061 #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RESOLUTION 0x006A /* Resolution */
6062 #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_STATUS_FLAGS 0x006F /* Status Flags */
6063 #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_ENGINEERING_UNITS 0x0075 /* Engineering Units */
6064 #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */
6066 /*Server commands received - none*/
6068 /*Server commands generated - none*/
6070 /*************************/
6071 /* Function Declarations */
6072 /*************************/
6074 void proto_register_zbee_zcl_analog_input_basic(void);
6075 void proto_reg_handoff_zbee_zcl_analog_input_basic(void);
6077 /* Command Dissector Helpers */
6078 static void dissect_zcl_analog_input_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
6080 /* Private functions prototype */
6082 /*************************/
6083 /* Global Variables */
6084 /*************************/
6085 /* Initialize the protocol and registered fields */
6086 static int proto_zbee_zcl_analog_input_basic;
6088 static int hf_zbee_zcl_analog_input_basic_attr_id;
6089 static int hf_zbee_zcl_analog_input_basic_reliability;
6090 static int hf_zbee_zcl_analog_input_basic_status_flags;
6091 static int hf_zbee_zcl_analog_input_basic_status_in_alarm;
6092 static int hf_zbee_zcl_analog_input_basic_status_fault;
6093 static int hf_zbee_zcl_analog_input_basic_status_overridden;
6094 static int hf_zbee_zcl_analog_input_basic_status_out_of_service;
6096 /* Initialize the subtree pointers */
6097 static int ett_zbee_zcl_analog_input_basic;
6098 static int ett_zbee_zcl_analog_input_basic_status_flags;
6100 /* Attributes */
6101 static const value_string zbee_zcl_analog_input_basic_attr_names[] = {
6102 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_DESCRIPTION, "Description" },
6103 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MAX_PRESENT_VALUE, "Max Present Value" },
6104 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MIN_PRESENT_VALUE, "Min Present Value" },
6105 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_OUT_OF_SERVICE, "Out of Service" },
6106 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_PRESENT_VALUE, "Present Value" },
6107 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RELIABILITY, "Reliability" },
6108 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RESOLUTION, "Resolution" },
6109 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_STATUS_FLAGS, "Status Flags" },
6110 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_ENGINEERING_UNITS, "Engineering Units" },
6111 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_APPLICATION_TYPE, "Application Type" },
6112 { 0, NULL }
6115 /*************************/
6116 /* Function Bodies */
6117 /*************************/
6119 /*FUNCTION:------------------------------------------------------
6120 * NAME
6121 * dissect_zbee_zcl_analog_input_basic
6122 * DESCRIPTION
6123 * ZigBee ZCL Analog Input Basic cluster dissector for wireshark.
6124 * PARAMETERS
6125 * tvbuff_t *tvb - pointer to buffer containing raw packet.
6126 * packet_info *pinfo - pointer to packet information fields
6127 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
6128 * RETURNS
6129 * int - length of parsed data.
6130 *---------------------------------------------------------------
6133 static int
6134 dissect_zbee_zcl_analog_input_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_)
6136 return tvb_captured_length(tvb);
6137 } /*dissect_zbee_zcl_analog_input_basic*/
6140 /*FUNCTION:------------------------------------------------------
6141 * NAME
6142 * dissect_zcl_analog_input_basic_attr_data
6143 * DESCRIPTION
6144 * this function is called by ZCL foundation dissector in order to decode
6145 * specific cluster attributes data.
6146 * PARAMETERS
6147 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
6148 * tvbuff_t *tvb - pointer to buffer containing raw packet.
6149 * unsigned *offset - pointer to buffer offset
6150 * uint16_t attr_id - attribute identifier
6151 * unsigned data_type - attribute data type
6152 * bool client_attr- ZCL client
6153 * RETURNS
6154 * none
6155 *---------------------------------------------------------------
6157 void
6158 dissect_zcl_analog_input_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
6160 static int * const status_flags[] = {
6161 &hf_zbee_zcl_analog_input_basic_status_in_alarm,
6162 &hf_zbee_zcl_analog_input_basic_status_fault,
6163 &hf_zbee_zcl_analog_input_basic_status_overridden,
6164 &hf_zbee_zcl_analog_input_basic_status_out_of_service,
6165 NULL
6168 /* Dissect attribute data type and data */
6169 switch (attr_id) {
6171 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RELIABILITY:
6172 proto_tree_add_item(tree, hf_zbee_zcl_analog_input_basic_reliability, tvb, *offset, 1, ENC_NA);
6173 *offset += 1;
6174 break;
6176 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_STATUS_FLAGS:
6177 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_analog_input_basic_status_flags, ett_zbee_zcl_analog_input_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN);
6178 *offset += 1;
6179 break;
6181 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_DESCRIPTION:
6182 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MAX_PRESENT_VALUE:
6183 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MIN_PRESENT_VALUE:
6184 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_OUT_OF_SERVICE:
6185 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_PRESENT_VALUE:
6186 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RESOLUTION:
6187 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_ENGINEERING_UNITS:
6188 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_APPLICATION_TYPE:
6189 default:
6190 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
6191 break;
6194 } /*dissect_zcl_analog_input_basic_attr_data*/
6197 /*FUNCTION:------------------------------------------------------
6198 * NAME
6199 * proto_register_zbee_zcl_analog_input_basic
6200 * DESCRIPTION
6201 * ZigBee ZCL Analog Input Basic cluster protocol registration routine.
6202 * PARAMETERS
6203 * none
6204 * RETURNS
6205 * none
6206 *---------------------------------------------------------------
6208 void
6209 proto_register_zbee_zcl_analog_input_basic(void)
6211 /* Setup list of header fields */
6212 static hf_register_info hf[] = {
6214 { &hf_zbee_zcl_analog_input_basic_attr_id,
6215 { "Attribute", "zbee_zcl_general.analog_input_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_analog_input_basic_attr_names),
6216 0x00, NULL, HFILL } },
6218 { &hf_zbee_zcl_analog_input_basic_reliability,
6219 { "Reliability", "zbee_zcl_general.analog_input_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names),
6220 0x00, NULL, HFILL } },
6222 /* start Status Flags fields */
6223 { &hf_zbee_zcl_analog_input_basic_status_flags,
6224 { "Status Flags", "zbee_zcl_general.analog_input_basic.attr.status", FT_UINT8, BASE_HEX, NULL,
6225 0x00, NULL, HFILL } },
6227 { &hf_zbee_zcl_analog_input_basic_status_in_alarm,
6228 { "In Alarm Status", "zbee_zcl_general.analog_input_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL,
6229 ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } },
6231 { &hf_zbee_zcl_analog_input_basic_status_fault,
6232 { "Fault Status", "zbee_zcl_general.analog_input_basic.attr.status.fault",FT_BOOLEAN, 8, NULL,
6233 ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } },
6235 { &hf_zbee_zcl_analog_input_basic_status_overridden,
6236 { "Overridden Status", "zbee_zcl_general.analog_input_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL,
6237 ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } },
6239 { &hf_zbee_zcl_analog_input_basic_status_out_of_service,
6240 { "Out of Service Status", "zbee_zcl_general.analog_input_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL,
6241 ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } }
6242 /* end Status Flags fields */
6245 /* ZCL Analog Input Basic subtrees */
6246 static int *ett[] = {
6247 &ett_zbee_zcl_analog_input_basic,
6248 &ett_zbee_zcl_analog_input_basic_status_flags
6253 /* Register the ZigBee ZCL Analog Input Basic cluster protocol name and description */
6254 proto_zbee_zcl_analog_input_basic = proto_register_protocol("ZigBee ZCL Analog Input Basic", "ZCL Analog Input Basic", ZBEE_PROTOABBREV_ZCL_ANALOG_INPUT_BASIC);
6255 proto_register_field_array(proto_zbee_zcl_analog_input_basic, hf, array_length(hf));
6256 proto_register_subtree_array(ett, array_length(ett));
6258 /* Register the ZigBee ZCL Analog Input Basic dissector. */
6259 register_dissector(ZBEE_PROTOABBREV_ZCL_ANALOG_INPUT_BASIC, dissect_zbee_zcl_analog_input_basic, proto_zbee_zcl_analog_input_basic);
6260 } /*proto_register_zbee_zcl_analog_input_basic*/
6262 /*FUNCTION:------------------------------------------------------
6263 * NAME
6264 * proto_reg_handoff_zbee_zcl_analog_input_basic
6265 * DESCRIPTION
6266 * Hands off the ZCL Analog Input Basic dissector.
6267 * PARAMETERS
6268 * none
6269 * RETURNS
6270 * none
6271 *---------------------------------------------------------------
6273 void
6274 proto_reg_handoff_zbee_zcl_analog_input_basic(void)
6276 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ANALOG_INPUT_BASIC,
6277 proto_zbee_zcl_analog_input_basic,
6278 ett_zbee_zcl_analog_input_basic,
6279 ZBEE_ZCL_CID_ANALOG_INPUT_BASIC,
6280 ZBEE_MFG_CODE_NONE,
6281 hf_zbee_zcl_analog_input_basic_attr_id,
6282 hf_zbee_zcl_analog_input_basic_attr_id,
6283 -1, -1,
6284 (zbee_zcl_fn_attr_data)dissect_zcl_analog_input_basic_attr_data
6286 } /*proto_reg_handoff_zbee_zcl_analog_input_basic*/
6289 /* ########################################################################## */
6290 /* #### (0x000D) ANALOG OUTPUT (BASIC) CLUSTER ############################## */
6291 /* ########################################################################## */
6293 /*************************/
6294 /* Defines */
6295 /*************************/
6297 /*Attributes*/
6298 #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_DESCRIPTION 0x001C /* Description */
6299 #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MAX_PRESENT_VALUE 0x0041 /* Max Present Value */
6300 #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MIN_PRESENT_VALUE 0x0045 /* Min Present Value */
6301 #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */
6302 #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRESENT_VALUE 0x0055 /* Present Value */
6303 #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRIORITY_ARRAY 0x0057 /* Priority Array */
6304 #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELIABILITY 0x0067 /* Reliability */
6305 #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELINQUISH_DEFAULT 0x0068 /* Relinquish Default */
6306 #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RESOLUTION 0x006A /* Resolution */
6307 #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_STATUS_FLAGS 0x006F /* Status Flags */
6308 #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_ENGINEERING_UNITS 0x0075 /* Engineering Units */
6309 #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */
6311 /*Server commands received - none*/
6313 /*Server commands generated - none*/
6315 /*************************/
6316 /* Function Declarations */
6317 /*************************/
6319 void proto_register_zbee_zcl_analog_output_basic(void);
6320 void proto_reg_handoff_zbee_zcl_analog_output_basic(void);
6322 /* Command Dissector Helpers */
6323 static void dissect_zcl_analog_output_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
6325 /* Private functions prototype */
6327 /*************************/
6328 /* Global Variables */
6329 /*************************/
6330 /* Initialize the protocol and registered fields */
6331 static int proto_zbee_zcl_analog_output_basic;
6333 static int hf_zbee_zcl_analog_output_basic_attr_id;
6334 static int hf_zbee_zcl_analog_output_basic_reliability;
6335 static int hf_zbee_zcl_analog_output_basic_status_flags;
6336 static int hf_zbee_zcl_analog_output_basic_status_in_alarm;
6337 static int hf_zbee_zcl_analog_output_basic_status_fault;
6338 static int hf_zbee_zcl_analog_output_basic_status_overridden;
6339 static int hf_zbee_zcl_analog_output_basic_status_out_of_service;
6340 static int hf_zbee_zcl_analog_output_basic_priority_array_bool;
6341 static int hf_zbee_zcl_analog_output_basic_priority_array_sing_prec;
6342 static int hf_zbee_zcl_analog_output_basic_priority_array;
6343 static int hf_zbee_zcl_analog_output_basic_structure;
6345 /* Initialize the subtree pointers */
6346 static int ett_zbee_zcl_analog_output_basic;
6347 static int ett_zbee_zcl_analog_output_basic_status_flags;
6348 static int ett_zbee_zcl_analog_output_basic_priority_array;
6349 static int ett_zbee_zcl_analog_output_basic_priority_array_structure;
6351 /* Attributes */
6352 static const value_string zbee_zcl_analog_output_basic_attr_names[] = {
6353 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_DESCRIPTION, "Description" },
6354 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MAX_PRESENT_VALUE, "Max Present Value" },
6355 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MIN_PRESENT_VALUE, "Min Present Value" },
6356 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_OUT_OF_SERVICE, "Out of Service" },
6357 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRESENT_VALUE, "Present Value" },
6358 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRIORITY_ARRAY, "Priority Array" },
6359 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELIABILITY, "Reliability" },
6360 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELINQUISH_DEFAULT, "Relinquish Default" },
6361 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RESOLUTION, "Resolution" },
6362 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_STATUS_FLAGS, "Status Flags" },
6363 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_ENGINEERING_UNITS, "Engineering Units" },
6364 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_APPLICATION_TYPE, "Application Type" },
6365 { 0, NULL }
6368 /*************************/
6369 /* Function Bodies */
6370 /*************************/
6372 /*FUNCTION:------------------------------------------------------
6373 * NAME
6374 * dissect_zbee_zcl_analog_output_basic
6375 * DESCRIPTION
6376 * ZigBee ZCL Analog Output Basic cluster dissector for wireshark.
6377 * PARAMETERS
6378 * tvbuff_t *tvb - pointer to buffer containing raw packet.
6379 * packet_info *pinfo - pointer to packet information fields
6380 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
6381 * RETURNS
6382 * int - length of parsed data.
6383 *---------------------------------------------------------------
6386 static int
6387 dissect_zbee_zcl_analog_output_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_)
6389 return tvb_captured_length(tvb);
6390 } /*dissect_zbee_zcl_analog_output_basic*/
6393 /*FUNCTION:------------------------------------------------------
6394 * NAME
6395 * dissect_zcl_analog_output_basic_attr_data
6396 * DESCRIPTION
6397 * this function is called by ZCL foundation dissector in order to decode
6398 * specific cluster attributes data.
6399 * PARAMETERS
6400 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
6401 * tvbuff_t *tvb - pointer to buffer containing raw packet.
6402 * unsigned *offset - pointer to buffer offset
6403 * uint16_t attr_id - attribute identifier
6404 * unsigned data_type - attribute data type
6405 * bool client_attr- ZCL client
6406 * RETURNS
6407 * none
6408 *---------------------------------------------------------------
6410 void
6411 dissect_zcl_analog_output_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
6413 proto_item *ti = NULL, *tj = NULL;
6414 proto_tree *sub_tree = NULL, *sub = NULL;
6415 int i;
6417 static int * const status_flags[] = {
6418 &hf_zbee_zcl_analog_output_basic_status_in_alarm,
6419 &hf_zbee_zcl_analog_output_basic_status_fault,
6420 &hf_zbee_zcl_analog_output_basic_status_overridden,
6421 &hf_zbee_zcl_analog_output_basic_status_out_of_service,
6422 NULL
6425 /* Dissect attribute data type and data */
6426 switch (attr_id) {
6428 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRIORITY_ARRAY:
6429 ti = proto_tree_add_item(tree,hf_zbee_zcl_analog_output_basic_priority_array, tvb, *offset, 80, ENC_NA);
6430 sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_analog_output_basic_priority_array);
6432 for(i = 1; i <= 16; i++)
6434 tj = proto_tree_add_item(sub_tree, hf_zbee_zcl_analog_output_basic_structure, tvb, *offset, 5, ENC_NA);
6435 proto_item_append_text(tj," %d",i);
6436 sub = proto_item_add_subtree(tj, ett_zbee_zcl_analog_output_basic_priority_array_structure);
6437 proto_tree_add_item(sub, hf_zbee_zcl_analog_output_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
6438 *offset += 1;
6439 proto_tree_add_item(sub, hf_zbee_zcl_analog_output_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
6440 *offset += 4;
6442 break;
6444 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELIABILITY:
6445 proto_tree_add_item(tree, hf_zbee_zcl_analog_output_basic_reliability, tvb, *offset, 1, ENC_NA);
6446 *offset += 1;
6447 break;
6449 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_STATUS_FLAGS:
6450 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_analog_output_basic_status_flags, ett_zbee_zcl_analog_output_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN);
6451 *offset += 1;
6452 break;
6454 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_DESCRIPTION:
6455 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MAX_PRESENT_VALUE:
6456 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MIN_PRESENT_VALUE:
6457 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_OUT_OF_SERVICE:
6458 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRESENT_VALUE:
6459 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELINQUISH_DEFAULT:
6460 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RESOLUTION:
6461 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_ENGINEERING_UNITS:
6462 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_APPLICATION_TYPE:
6463 default:
6464 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
6465 break;
6468 } /*dissect_zcl_analog_output_basic_attr_data*/
6471 /*FUNCTION:------------------------------------------------------
6472 * NAME
6473 * proto_register_zbee_zcl_analog_output_basic
6474 * DESCRIPTION
6475 * ZigBee ZCL Analog Output Basic cluster protocol registration routine.
6476 * PARAMETERS
6477 * none
6478 * RETURNS
6479 * none
6480 *---------------------------------------------------------------
6482 void
6483 proto_register_zbee_zcl_analog_output_basic(void)
6485 /* Setup list of header fields */
6486 static hf_register_info hf[] = {
6488 { &hf_zbee_zcl_analog_output_basic_attr_id,
6489 { "Attribute", "zbee_zcl_general.analog_output_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_analog_output_basic_attr_names),
6490 0x0, NULL, HFILL } },
6492 { &hf_zbee_zcl_analog_output_basic_reliability,
6493 { "Reliability", "zbee_zcl_general.analog_output_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names),
6494 0x0, NULL, HFILL } },
6496 /* start Status Flags fields */
6497 { &hf_zbee_zcl_analog_output_basic_status_flags,
6498 { "Status Flags", "zbee_zcl_general.analog_output_basic.attr.status", FT_UINT8, BASE_HEX, NULL,
6499 0x0, NULL, HFILL } },
6501 { &hf_zbee_zcl_analog_output_basic_status_in_alarm,
6502 { "In Alarm Status", "zbee_zcl_general.analog_output_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL,
6503 ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } },
6505 { &hf_zbee_zcl_analog_output_basic_status_fault,
6506 { "Fault Status", "zbee_zcl_general.analog_output_basic.attr.status.fault", FT_BOOLEAN, 8, NULL,
6507 ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } },
6509 { &hf_zbee_zcl_analog_output_basic_status_overridden,
6510 { "Overridden Status", "zbee_zcl_general.analog_output_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL,
6511 ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } },
6513 { &hf_zbee_zcl_analog_output_basic_status_out_of_service,
6514 { "Out of Service Status", "zbee_zcl_general.analog_output_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL,
6515 ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } },
6516 /* end Status Flags fields */
6518 { &hf_zbee_zcl_analog_output_basic_priority_array_bool,
6519 { "Valid/Invalid", "zbee_zcl_general.analog_output_basic.attr.priority_array.bool", FT_BOOLEAN, BASE_NONE, TFS(&tfs_invalid_valid),
6520 0x0, NULL, HFILL } },
6522 { &hf_zbee_zcl_analog_output_basic_priority_array_sing_prec,
6523 { "Priority Value", "zbee_zcl_general.analog_output_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL,
6524 0x0, NULL, HFILL } },
6526 { &hf_zbee_zcl_analog_output_basic_priority_array,
6527 { "Priority Array", "zbee_zcl_general.analog_output_basic.priority_array", FT_NONE, BASE_NONE, NULL,
6528 0x0, NULL, HFILL } },
6530 { &hf_zbee_zcl_analog_output_basic_structure,
6531 { "Structure", "zbee_zcl_general.analog_output_basic.structure", FT_NONE, BASE_NONE, NULL,
6532 0x0, NULL, HFILL } }
6535 /* ZCL Analog Output Basic subtrees */
6536 static int *ett[] = {
6537 &ett_zbee_zcl_analog_output_basic,
6538 &ett_zbee_zcl_analog_output_basic_status_flags,
6539 &ett_zbee_zcl_analog_output_basic_priority_array,
6540 &ett_zbee_zcl_analog_output_basic_priority_array_structure
6545 /* Register the ZigBee ZCL Analog Output Basic cluster protocol name and description */
6546 proto_zbee_zcl_analog_output_basic = proto_register_protocol("ZigBee ZCL Analog Output Basic", "ZCL Analog Output Basic", ZBEE_PROTOABBREV_ZCL_ANALOG_OUTPUT_BASIC);
6547 proto_register_field_array(proto_zbee_zcl_analog_output_basic, hf, array_length(hf));
6548 proto_register_subtree_array(ett, array_length(ett));
6550 /* Register the ZigBee ZCL Analog Output Basic dissector. */
6551 register_dissector(ZBEE_PROTOABBREV_ZCL_ANALOG_OUTPUT_BASIC, dissect_zbee_zcl_analog_output_basic, proto_zbee_zcl_analog_output_basic);
6552 } /*proto_register_zbee_zcl_analog_output_basic*/
6554 /*FUNCTION:------------------------------------------------------
6555 * NAME
6556 * proto_reg_handoff_zbee_zcl_analog_output_basic
6557 * DESCRIPTION
6558 * Hands off the ZCL Analog Output Basic dissector.
6559 * PARAMETERS
6560 * none
6561 * RETURNS
6562 * none
6563 *---------------------------------------------------------------
6565 void
6566 proto_reg_handoff_zbee_zcl_analog_output_basic(void)
6568 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ANALOG_OUTPUT_BASIC,
6569 proto_zbee_zcl_analog_output_basic,
6570 ett_zbee_zcl_analog_output_basic,
6571 ZBEE_ZCL_CID_ANALOG_OUTPUT_BASIC,
6572 ZBEE_MFG_CODE_NONE,
6573 hf_zbee_zcl_analog_output_basic_attr_id,
6574 hf_zbee_zcl_analog_output_basic_attr_id,
6575 -1, -1,
6576 (zbee_zcl_fn_attr_data)dissect_zcl_analog_output_basic_attr_data
6578 } /*proto_reg_handoff_zbee_zcl_analog_output_basic*/
6581 /* ########################################################################## */
6582 /* #### (0x000E) ANALOG VALUE (BASIC) CLUSTER ############################### */
6583 /* ########################################################################## */
6585 /*************************/
6586 /* Defines */
6587 /*************************/
6589 /*Attributes*/
6590 #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_DESCRIPTION 0x001C /* Description */
6591 #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */
6592 #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRESENT_VALUE 0x0055 /* Present Value */
6593 #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRIORITY_ARRAY 0x0057 /* Priority Array */
6594 #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELIABILITY 0x0067 /* Reliability */
6595 #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELINQUISH_DEFAULT 0x0068 /* Relinquish Default */
6596 #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_STATUS_FLAGS 0x006F /* Status Flags */
6597 #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_ENGINEERING_UNITS 0x0075 /* Engineering Units */
6598 #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */
6600 /*Server commands received - none*/
6602 /*Server commands generated - none*/
6604 /*************************/
6605 /* Function Declarations */
6606 /*************************/
6608 void proto_register_zbee_zcl_analog_value_basic(void);
6609 void proto_reg_handoff_zbee_zcl_analog_value_basic(void);
6611 /* Command Dissector Helpers */
6612 static void dissect_zcl_analog_value_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
6614 /* Private functions prototype */
6616 /*************************/
6617 /* Global Variables */
6618 /*************************/
6619 /* Initialize the protocol and registered fields */
6620 static int proto_zbee_zcl_analog_value_basic;
6622 static int hf_zbee_zcl_analog_value_basic_attr_id;
6623 static int hf_zbee_zcl_analog_value_basic_reliability;
6624 static int hf_zbee_zcl_analog_value_basic_status_flags;
6625 static int hf_zbee_zcl_analog_value_basic_status_in_alarm;
6626 static int hf_zbee_zcl_analog_value_basic_status_fault;
6627 static int hf_zbee_zcl_analog_value_basic_status_overridden;
6628 static int hf_zbee_zcl_analog_value_basic_status_out_of_service;
6629 static int hf_zbee_zcl_analog_value_basic_priority_array_bool;
6630 static int hf_zbee_zcl_analog_value_basic_priority_array_sing_prec;
6631 static int hf_zbee_zcl_analog_value_basic_priority_array;
6632 static int hf_zbee_zcl_analog_value_basic_structure;
6634 /* Initialize the subtree pointers */
6635 static int ett_zbee_zcl_analog_value_basic;
6636 static int ett_zbee_zcl_analog_value_basic_status_flags;
6637 static int ett_zbee_zcl_analog_value_basic_priority_array;
6638 static int ett_zbee_zcl_analog_value_basic_priority_array_structure;
6640 /* Attributes */
6641 static const value_string zbee_zcl_analog_value_basic_attr_names[] = {
6642 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_DESCRIPTION, "Description" },
6643 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_OUT_OF_SERVICE, "Out of Service" },
6644 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRESENT_VALUE, "Present Value" },
6645 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRIORITY_ARRAY, "Priority Array" },
6646 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELIABILITY, "Reliability" },
6647 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELINQUISH_DEFAULT, "Relinquish Default" },
6648 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_STATUS_FLAGS, "Status Flags" },
6649 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_ENGINEERING_UNITS, "Engineering Units" },
6650 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_APPLICATION_TYPE, "Application Type" },
6651 { 0, NULL }
6654 /*************************/
6655 /* Function Bodies */
6656 /*************************/
6658 /*FUNCTION:------------------------------------------------------
6659 * NAME
6660 * dissect_zbee_zcl_analog_value_basic
6661 * DESCRIPTION
6662 * ZigBee ZCL Analog Value Basic cluster dissector for wireshark.
6663 * PARAMETERS
6664 * tvbuff_t *tvb - pointer to buffer containing raw packet.
6665 * packet_info *pinfo - pointer to packet information fields
6666 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
6667 * RETURNS
6668 * int - length of parsed data.
6669 *---------------------------------------------------------------
6672 static int
6673 dissect_zbee_zcl_analog_value_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_)
6675 return tvb_captured_length(tvb);
6676 } /*dissect_zbee_zcl_analog_value_basic*/
6679 /*FUNCTION:------------------------------------------------------
6680 * NAME
6681 * dissect_zcl_analog_value_basic_attr_data
6682 * DESCRIPTION
6683 * this function is called by ZCL foundation dissector in order to decode
6684 * specific cluster attributes data.
6685 * PARAMETERS
6686 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
6687 * tvbuff_t *tvb - pointer to buffer containing raw packet.
6688 * unsigned *offset - pointer to buffer offset
6689 * uint16_t attr_id - attribute identifier
6690 * unsigned data_type - attribute data type
6691 * bool client_attr- ZCL client
6692 * RETURNS
6693 * none
6694 *---------------------------------------------------------------
6696 void
6697 dissect_zcl_analog_value_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
6699 proto_item *ti = NULL, *tj = NULL;
6700 proto_tree *sub_tree = NULL, *sub = NULL;
6701 int i;
6703 static int * const status_flags[] = {
6704 &hf_zbee_zcl_analog_value_basic_status_in_alarm,
6705 &hf_zbee_zcl_analog_value_basic_status_fault,
6706 &hf_zbee_zcl_analog_value_basic_status_overridden,
6707 &hf_zbee_zcl_analog_value_basic_status_out_of_service,
6708 NULL
6711 /* Dissect attribute data type and data */
6712 switch (attr_id) {
6714 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRIORITY_ARRAY:
6715 ti = proto_tree_add_item(tree,hf_zbee_zcl_analog_value_basic_priority_array, tvb, *offset, 80, ENC_NA);
6716 sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_analog_value_basic_priority_array);
6718 for( i = 1; i <= 16; i++)
6720 tj = proto_tree_add_item(sub_tree, hf_zbee_zcl_analog_value_basic_structure, tvb, *offset, 5, ENC_NA);
6721 proto_item_append_text(tj," %d",i);
6722 sub = proto_item_add_subtree(tj, ett_zbee_zcl_analog_value_basic_priority_array_structure);
6723 proto_tree_add_item(sub, hf_zbee_zcl_analog_value_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
6724 *offset += 1;
6725 proto_tree_add_item(sub, hf_zbee_zcl_analog_value_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
6726 *offset += 4;
6728 break;
6730 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELIABILITY:
6731 proto_tree_add_item(tree, hf_zbee_zcl_analog_value_basic_reliability, tvb, *offset, 1, ENC_NA);
6732 *offset += 1;
6733 break;
6735 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_STATUS_FLAGS:
6736 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_analog_value_basic_status_flags, ett_zbee_zcl_analog_value_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN);
6737 *offset += 1;
6738 break;
6740 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_DESCRIPTION:
6741 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_OUT_OF_SERVICE:
6742 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRESENT_VALUE:
6743 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELINQUISH_DEFAULT:
6744 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_ENGINEERING_UNITS:
6745 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_APPLICATION_TYPE:
6746 default:
6747 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
6748 break;
6751 } /*dissect_zcl_analog_value_basic_attr_data*/
6754 /*FUNCTION:------------------------------------------------------
6755 * NAME
6756 * proto_register_zbee_zcl_analog_value_basic
6757 * DESCRIPTION
6758 * ZigBee ZCL Analog Value Basic cluster protocol registration routine.
6759 * PARAMETERS
6760 * none
6761 * RETURNS
6762 * none
6763 *---------------------------------------------------------------
6765 void
6766 proto_register_zbee_zcl_analog_value_basic(void)
6768 /* Setup list of header fields */
6769 static hf_register_info hf[] = {
6771 { &hf_zbee_zcl_analog_value_basic_attr_id,
6772 { "Attribute", "zbee_zcl_general.analog_value_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_analog_value_basic_attr_names),
6773 0x00, NULL, HFILL } },
6775 { &hf_zbee_zcl_analog_value_basic_reliability,
6776 { "Reliability", "zbee_zcl_general.analog_value_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names),
6777 0x00, NULL, HFILL } },
6779 /* start Status Flags fields */
6780 { &hf_zbee_zcl_analog_value_basic_status_flags,
6781 { "Status Flags", "zbee_zcl_general.analog_value_basic.attr.status", FT_UINT8, BASE_HEX, NULL,
6782 0x00, NULL, HFILL } },
6784 { &hf_zbee_zcl_analog_value_basic_status_in_alarm,
6785 { "In Alarm Status", "zbee_zcl_general.analog_value_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL,
6786 ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } },
6788 { &hf_zbee_zcl_analog_value_basic_status_fault,
6789 { "Fault Status", "zbee_zcl_general.analog_value_basic.attr.status.fault", FT_BOOLEAN, 8, NULL,
6790 ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } },
6792 { &hf_zbee_zcl_analog_value_basic_status_overridden,
6793 { "Overridden Status", "zbee_zcl_general.analog_value_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL,
6794 ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } },
6796 { &hf_zbee_zcl_analog_value_basic_status_out_of_service,
6797 { "Out of Service Status", "zbee_zcl_general.analog_value_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL,
6798 ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } },
6799 /* end Status Flags fields */
6801 { &hf_zbee_zcl_analog_value_basic_priority_array_bool,
6802 { "Valid/Invalid", "zbee_zcl_general.analog_value_basic.attr.priority_array.bool", FT_BOOLEAN, BASE_NONE, TFS(&tfs_invalid_valid),
6803 0x00, NULL, HFILL } },
6805 { &hf_zbee_zcl_analog_value_basic_priority_array_sing_prec,
6806 { "Priority Value", "zbee_zcl_general.analog_value_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL,
6807 0x00, NULL, HFILL } },
6809 { &hf_zbee_zcl_analog_value_basic_priority_array,
6810 { "Priority Array", "zbee_zcl_general.analog_value_basic.priority_array", FT_NONE, BASE_NONE, NULL,
6811 0x00, NULL, HFILL } },
6813 { &hf_zbee_zcl_analog_value_basic_structure,
6814 { "Structure", "zbee_zcl_general.analog_value_basic.structure", FT_NONE, BASE_NONE, NULL,
6815 0x00, NULL, HFILL } }
6818 /* ZCL Analog Value Basic subtrees */
6819 static int *ett[] = {
6820 &ett_zbee_zcl_analog_value_basic,
6821 &ett_zbee_zcl_analog_value_basic_status_flags,
6822 &ett_zbee_zcl_analog_value_basic_priority_array,
6823 &ett_zbee_zcl_analog_value_basic_priority_array_structure
6826 /* Register the ZigBee ZCL Analog Value Basic cluster protocol name and description */
6827 proto_zbee_zcl_analog_value_basic = proto_register_protocol("ZigBee ZCL Analog Value Basic", "ZCL Analog Value Basic", ZBEE_PROTOABBREV_ZCL_ANALOG_VALUE_BASIC);
6828 proto_register_field_array(proto_zbee_zcl_analog_value_basic, hf, array_length(hf));
6829 proto_register_subtree_array(ett, array_length(ett));
6831 /* Register the ZigBee ZCL Analog Value Basic dissector. */
6832 register_dissector(ZBEE_PROTOABBREV_ZCL_ANALOG_VALUE_BASIC, dissect_zbee_zcl_analog_value_basic, proto_zbee_zcl_analog_value_basic);
6833 } /*proto_register_zbee_zcl_analog_value_basic*/
6835 /*FUNCTION:------------------------------------------------------
6836 * NAME
6837 * proto_reg_handoff_zbee_zcl_analog_value_basic
6838 * DESCRIPTION
6839 * Hands off the ZCL Analog Value Basic dissector.
6840 * PARAMETERS
6841 * none
6842 * RETURNS
6843 * none
6844 *---------------------------------------------------------------
6846 void
6847 proto_reg_handoff_zbee_zcl_analog_value_basic(void)
6849 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ANALOG_VALUE_BASIC,
6850 proto_zbee_zcl_analog_value_basic,
6851 ett_zbee_zcl_analog_value_basic,
6852 ZBEE_ZCL_CID_ANALOG_VALUE_BASIC,
6853 ZBEE_MFG_CODE_NONE,
6854 hf_zbee_zcl_analog_value_basic_attr_id,
6855 hf_zbee_zcl_analog_value_basic_attr_id,
6856 -1, -1,
6857 (zbee_zcl_fn_attr_data)dissect_zcl_analog_value_basic_attr_data
6859 } /*proto_reg_handoff_zbee_zcl_analog_value_basic*/
6862 /* ########################################################################## */
6863 /* #### (0x000F) BINARY INPUT (BASIC) CLUSTER ############################### */
6864 /* ########################################################################## */
6866 /*************************/
6867 /* Defines */
6868 /*************************/
6870 /*Attributes*/
6871 #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_ACTIVE_TEXT 0x0004 /* Active Text */
6872 #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_DESCRIPTION 0x001C /* Description */
6873 #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_INACTIVE_TEXT 0x002E /* Inactive Text */
6874 #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */
6875 #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_POLARITY 0x0054 /* Polarity */
6876 #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_PRESENT_VALUE 0x0055 /* Present Value */
6877 #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_RELIABILITY 0x0067 /* Reliability */
6878 #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_STATUS_FLAGS 0x006F /* Status Flags */
6879 #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */
6881 /*Server commands received - none*/
6883 /*Server commands generated - none*/
6885 static const value_string zbee_zcl_binary_input_polarity_values[] = {
6886 {0, "Normal"},
6887 {1, "Reversed"},
6888 {0, NULL}
6891 /*************************/
6892 /* Function Declarations */
6893 /*************************/
6895 void proto_register_zbee_zcl_binary_input_basic(void);
6896 void proto_reg_handoff_zbee_zcl_binary_input_basic(void);
6898 /* Command Dissector Helpers */
6899 static void dissect_zcl_binary_input_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
6901 /* Private functions prototype */
6903 /*************************/
6904 /* Global Variables */
6905 /*************************/
6906 /* Initialize the protocol and registered fields */
6907 static int proto_zbee_zcl_binary_input_basic;
6909 static int hf_zbee_zcl_binary_input_basic_attr_id;
6910 static int hf_zbee_zcl_binary_input_basic_status_flags;
6911 static int hf_zbee_zcl_binary_input_basic_status_in_alarm;
6912 static int hf_zbee_zcl_binary_input_basic_status_fault;
6913 static int hf_zbee_zcl_binary_input_basic_status_overridden;
6914 static int hf_zbee_zcl_binary_input_basic_status_out_of_service;
6915 static int hf_zbee_zcl_binary_input_basic_polarity;
6916 static int hf_zbee_zcl_binary_input_basic_reliability;
6918 /* Initialize the subtree pointers */
6919 static int ett_zbee_zcl_binary_input_basic;
6920 static int ett_zbee_zcl_binary_input_basic_status_flags;
6922 /* Attributes */
6923 static const value_string zbee_zcl_binary_input_basic_attr_names[] = {
6924 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_ACTIVE_TEXT, "Active Text" },
6925 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_DESCRIPTION, "Description" },
6926 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_INACTIVE_TEXT, "Inactive Text" },
6927 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_OUT_OF_SERVICE, "Out of Service" },
6928 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_POLARITY, "Polarity" },
6929 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_PRESENT_VALUE, "Present Value" },
6930 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_RELIABILITY, "Reliability" },
6931 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_STATUS_FLAGS, "Status Flags" },
6932 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_APPLICATION_TYPE, "Application Type" },
6933 { 0, NULL }
6936 /*************************/
6937 /* Function Bodies */
6938 /*************************/
6940 /*FUNCTION:------------------------------------------------------
6941 * NAME
6942 * dissect_zbee_zcl_binary_input_basic
6943 * DESCRIPTION
6944 * ZigBee ZCL Binary Input Basic cluster dissector for wireshark.
6945 * PARAMETERS
6946 * tvbuff_t *tvb - pointer to buffer containing raw packet.
6947 * packet_info *pinfo - pointer to packet information fields
6948 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
6949 * RETURNS
6950 * int - length of parsed data.
6951 *---------------------------------------------------------------
6954 static int
6955 dissect_zbee_zcl_binary_input_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_)
6957 return tvb_captured_length(tvb);
6958 } /*dissect_zbee_zcl_binary_input_basic*/
6961 /*FUNCTION:------------------------------------------------------
6962 * NAME
6963 * dissect_zcl_binary_input_basic_attr_data
6964 * DESCRIPTION
6965 * this function is called by ZCL foundation dissector in order to decode
6966 * specific cluster attributes data.
6967 * PARAMETERS
6968 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
6969 * tvbuff_t *tvb - pointer to buffer containing raw packet.
6970 * unsigned *offset - pointer to buffer offset
6971 * uint16_t attr_id - attribute identifier
6972 * unsigned data_type - attribute data type
6973 * bool client_attr- ZCL client
6974 * RETURNS
6975 * none
6976 *---------------------------------------------------------------
6978 void
6979 dissect_zcl_binary_input_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
6981 static int * const status_flags[] = {
6982 &hf_zbee_zcl_binary_input_basic_status_in_alarm,
6983 &hf_zbee_zcl_binary_input_basic_status_fault,
6984 &hf_zbee_zcl_binary_input_basic_status_overridden,
6985 &hf_zbee_zcl_binary_input_basic_status_out_of_service,
6986 NULL
6989 /* Dissect attribute data type and data */
6990 switch (attr_id) {
6992 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_POLARITY:
6993 proto_tree_add_item(tree, hf_zbee_zcl_binary_input_basic_polarity, tvb, *offset, 1, ENC_NA);
6994 *offset += 1;
6995 break;
6997 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_RELIABILITY:
6998 proto_tree_add_item(tree, hf_zbee_zcl_binary_input_basic_reliability, tvb, *offset, 1, ENC_NA);
6999 *offset += 1;
7000 break;
7002 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_STATUS_FLAGS:
7003 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_binary_input_basic_status_flags, ett_zbee_zcl_binary_input_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN);
7004 *offset += 1;
7005 break;
7007 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_ACTIVE_TEXT:
7008 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_INACTIVE_TEXT:
7009 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_DESCRIPTION:
7010 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_OUT_OF_SERVICE:
7011 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_PRESENT_VALUE:
7012 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_APPLICATION_TYPE:
7013 default:
7014 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
7015 break;
7018 } /*dissect_zcl_binary_input_basic_attr_data*/
7021 /*FUNCTION:------------------------------------------------------
7022 * NAME
7023 * proto_register_zbee_zcl_binary_input_basic
7024 * DESCRIPTION
7025 * ZigBee ZCL Binary Input Basic cluster protocol registration routine.
7026 * PARAMETERS
7027 * none
7028 * RETURNS
7029 * none
7030 *---------------------------------------------------------------
7032 void
7033 proto_register_zbee_zcl_binary_input_basic(void)
7035 /* Setup list of header fields */
7036 static hf_register_info hf[] = {
7038 { &hf_zbee_zcl_binary_input_basic_attr_id,
7039 { "Attribute", "zbee_zcl_general.binary_input_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_binary_input_basic_attr_names),
7040 0x00, NULL, HFILL } },
7042 { &hf_zbee_zcl_binary_input_basic_reliability,
7043 { "Reliability", "zbee_zcl_general.binary_input_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names),
7044 0x00, NULL, HFILL } },
7046 /* start Status Flags fields */
7047 { &hf_zbee_zcl_binary_input_basic_status_flags,
7048 { "Status Flags", "zbee_zcl_general.binary_input_basic.attr.status", FT_UINT8, BASE_HEX, NULL,
7049 0x00, NULL, HFILL } },
7051 { &hf_zbee_zcl_binary_input_basic_status_in_alarm,
7052 { "In Alarm Status", "zbee_zcl_general.binary_input_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL,
7053 ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } },
7055 { &hf_zbee_zcl_binary_input_basic_status_fault,
7056 { "Fault Status", "zbee_zcl_general.binary_input_basic.attr.status.fault", FT_BOOLEAN, 8, NULL,
7057 ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } },
7059 { &hf_zbee_zcl_binary_input_basic_status_overridden,
7060 { "Overridden Status", "zbee_zcl_general.binary_input_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL,
7061 ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } },
7063 { &hf_zbee_zcl_binary_input_basic_status_out_of_service,
7064 { "Out of Service Status", "zbee_zcl_general.binary_input_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL,
7065 ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } },
7066 /* end Status Flags fields */
7068 { &hf_zbee_zcl_binary_input_basic_polarity,
7069 { "Polarity", "zbee_zcl_general.binary_input_basic.attr.polarity", FT_UINT8, BASE_HEX, VALS(zbee_zcl_binary_input_polarity_values),
7070 0x00, NULL, HFILL } }
7074 /* ZCL Binary Input Basic subtrees */
7075 static int *ett[] = {
7076 &ett_zbee_zcl_binary_input_basic,
7077 &ett_zbee_zcl_binary_input_basic_status_flags
7080 /* Register the ZigBee ZCL Binary Input Basic cluster protocol name and description */
7081 proto_zbee_zcl_binary_input_basic = proto_register_protocol("ZigBee ZCL Binary Input Basic", "ZCL Binary Input Basic", ZBEE_PROTOABBREV_ZCL_BINARY_INPUT_BASIC);
7082 proto_register_field_array(proto_zbee_zcl_binary_input_basic, hf, array_length(hf));
7083 proto_register_subtree_array(ett, array_length(ett));
7085 /* Register the ZigBee ZCL Binary Input Basic dissector. */
7086 register_dissector(ZBEE_PROTOABBREV_ZCL_BINARY_INPUT_BASIC, dissect_zbee_zcl_binary_input_basic, proto_zbee_zcl_binary_input_basic);
7087 } /*proto_register_zbee_zcl_binary_input_basic*/
7089 /*FUNCTION:------------------------------------------------------
7090 * NAME
7091 * proto_reg_handoff_zbee_zcl_binary_input_basic
7092 * DESCRIPTION
7093 * Hands off the ZCL Binary Input Basic dissector.
7094 * PARAMETERS
7095 * none
7096 * RETURNS
7097 * none
7098 *---------------------------------------------------------------
7100 void
7101 proto_reg_handoff_zbee_zcl_binary_input_basic(void)
7103 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_BINARY_INPUT_BASIC,
7104 proto_zbee_zcl_binary_input_basic,
7105 ett_zbee_zcl_binary_input_basic,
7106 ZBEE_ZCL_CID_BINARY_INPUT_BASIC,
7107 ZBEE_MFG_CODE_NONE,
7108 hf_zbee_zcl_binary_input_basic_attr_id,
7109 hf_zbee_zcl_binary_input_basic_attr_id,
7110 -1, -1,
7111 (zbee_zcl_fn_attr_data)dissect_zcl_binary_input_basic_attr_data
7113 } /*proto_reg_handoff_zbee_zcl_binary_input_basic*/
7115 /* ########################################################################## */
7116 /* #### (0x0010) BINARY OUTPUT (BASIC) CLUSTER ############################## */
7117 /* ########################################################################## */
7119 /*************************/
7120 /* Defines */
7121 /*************************/
7123 /*Attributes*/
7124 #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_ACTIVE_TEXT 0x0004 /* Active Text */
7125 #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_DESCRIPTION 0x001C /* Description */
7126 #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_INACTIVE_TEXT 0x002E /* Inactive Text */
7127 #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_OFF_TIME 0x0042 /* Maximum Off Time */
7128 #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_ON_TIME 0x0043 /* Minimum On Time */
7129 #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */
7130 #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_POLARITY 0x0054 /* Polarity */
7131 #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRESENT_VALUE 0x0055 /* Present Value */
7132 #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRIORITY_ARRAY 0x0057 /* Priority Array */
7133 #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELIABILITY 0x0067 /* Reliability */
7134 #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELINQUISH_DEFAULT 0x0068 /* Relinquish Default */
7135 #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_STATUS_FLAGS 0x006F /* Status Flags */
7136 #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */
7138 /*Server commands received - none*/
7140 /*Server commands generated - none*/
7142 static const value_string zbee_zcl_binary_output_polarity_values[] = {
7143 {0, "Normal"},
7144 {1, "Reversed"},
7145 {0, NULL}
7148 /*************************/
7149 /* Function Declarations */
7150 /*************************/
7152 void proto_register_zbee_zcl_binary_output_basic(void);
7153 void proto_reg_handoff_zbee_zcl_binary_output_basic(void);
7155 /* Command Dissector Helpers */
7156 static void dissect_zcl_binary_output_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
7158 /* Private functions prototype */
7160 /*************************/
7161 /* Global Variables */
7162 /*************************/
7163 /* Initialize the protocol and registered fields */
7164 static int proto_zbee_zcl_binary_output_basic;
7166 static int hf_zbee_zcl_binary_output_basic_attr_id;
7167 static int hf_zbee_zcl_binary_output_basic_status_flags;
7168 static int hf_zbee_zcl_binary_output_basic_status_in_alarm;
7169 static int hf_zbee_zcl_binary_output_basic_status_fault;
7170 static int hf_zbee_zcl_binary_output_basic_status_overridden;
7171 static int hf_zbee_zcl_binary_output_basic_status_out_of_service;
7172 static int hf_zbee_zcl_binary_output_basic_priority_array_bool;
7173 static int hf_zbee_zcl_binary_output_basic_priority_array_sing_prec;
7174 static int hf_zbee_zcl_binary_output_basic_polarity;
7175 static int hf_zbee_zcl_binary_output_basic_reliability;
7176 static int hf_zbee_zcl_binary_output_basic_priority_array;
7177 static int hf_zbee_zcl_binary_output_basic_structure;
7179 /* Initialize the subtree pointers */
7180 static int ett_zbee_zcl_binary_output_basic;
7181 static int ett_zbee_zcl_binary_output_basic_status_flags;
7182 static int ett_zbee_zcl_binary_output_basic_priority_array;
7183 static int ett_zbee_zcl_binary_output_basic_priority_array_structure;
7185 /* Attributes */
7186 static const value_string zbee_zcl_binary_output_basic_attr_names[] = {
7187 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_ACTIVE_TEXT, "Active Text" },
7188 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_DESCRIPTION, "Description" },
7189 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_INACTIVE_TEXT, "Inactive Text" },
7190 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_OFF_TIME, "Minimum Off Time" },
7191 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_ON_TIME, "Minimum On Time" },
7192 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_OUT_OF_SERVICE, "Out of Service" },
7193 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_POLARITY, "Polarity" },
7194 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRESENT_VALUE, "Present Value" },
7195 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRIORITY_ARRAY, "Priority Array" },
7196 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELIABILITY, "Reliability" },
7197 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELINQUISH_DEFAULT, "Relinquish Default" },
7198 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_STATUS_FLAGS, "Status Flags" },
7199 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_APPLICATION_TYPE, "Application Type" },
7200 { 0, NULL }
7203 /*************************/
7204 /* Function Bodies */
7205 /*************************/
7207 /*FUNCTION:------------------------------------------------------
7208 * NAME
7209 * dissect_zbee_zcl_binary_output_basic
7210 * DESCRIPTION
7211 * ZigBee ZCL Binary Output Basic cluster dissector for wireshark.
7212 * PARAMETERS
7213 * tvbuff_t *tvb - pointer to buffer containing raw packet.
7214 * packet_info *pinfo - pointer to packet information fields
7215 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
7216 * RETURNS
7217 * int - length of parsed data.
7218 *---------------------------------------------------------------
7221 static int
7222 dissect_zbee_zcl_binary_output_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_)
7224 return tvb_captured_length(tvb);
7225 } /*dissect_zbee_zcl_binary_output_basic*/
7228 /*FUNCTION:------------------------------------------------------
7229 * NAME
7230 * dissect_zcl_binary_output_basic_attr_data
7231 * DESCRIPTION
7232 * this function is called by ZCL foundation dissector in order to decode
7233 * specific cluster attributes data.
7234 * PARAMETERS
7235 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
7236 * tvbuff_t *tvb - pointer to buffer containing raw packet.
7237 * unsigned *offset - pointer to buffer offset
7238 * uint16_t attr_id - attribute identifier
7239 * unsigned data_type - attribute data type
7240 * bool client_attr- ZCL client
7241 * RETURNS
7242 * none
7243 *---------------------------------------------------------------
7245 void
7246 dissect_zcl_binary_output_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
7248 proto_item *ti = NULL, *tj = NULL;
7249 proto_tree *sub_tree = NULL, *sub = NULL;
7250 int i;
7252 static int * const status_flags[] = {
7253 &hf_zbee_zcl_binary_output_basic_status_in_alarm,
7254 &hf_zbee_zcl_binary_output_basic_status_fault,
7255 &hf_zbee_zcl_binary_output_basic_status_overridden,
7256 &hf_zbee_zcl_binary_output_basic_status_out_of_service,
7257 NULL
7260 /* Dissect attribute data type and data */
7261 switch (attr_id) {
7263 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRIORITY_ARRAY:
7264 ti = proto_tree_add_item(tree,hf_zbee_zcl_binary_output_basic_priority_array, tvb, *offset, 80, ENC_NA);
7265 sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_binary_output_basic_priority_array);
7267 for(i = 1; i <= 16; i++)
7269 tj = proto_tree_add_item(sub_tree, hf_zbee_zcl_binary_output_basic_structure, tvb, *offset, 5, ENC_NA);
7270 proto_item_append_text(tj," %d",i);
7271 sub = proto_item_add_subtree(tj, ett_zbee_zcl_binary_output_basic_priority_array_structure);
7272 proto_tree_add_item(sub, hf_zbee_zcl_binary_output_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
7273 *offset += 1;
7274 proto_tree_add_item(sub, hf_zbee_zcl_binary_output_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
7275 *offset += 4;
7277 break;
7279 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_POLARITY:
7280 proto_tree_add_item(tree, hf_zbee_zcl_binary_output_basic_polarity, tvb, *offset, 1, ENC_NA);
7281 *offset += 1;
7282 break;
7284 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELIABILITY:
7285 proto_tree_add_item(tree, hf_zbee_zcl_binary_output_basic_reliability, tvb, *offset, 1, ENC_NA);
7286 *offset += 1;
7287 break;
7289 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_STATUS_FLAGS:
7290 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_binary_output_basic_status_flags, ett_zbee_zcl_binary_output_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN);
7291 *offset += 1;
7292 break;
7294 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_ACTIVE_TEXT:
7295 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_DESCRIPTION:
7296 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_INACTIVE_TEXT:
7297 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_OFF_TIME:
7298 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_ON_TIME:
7299 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_OUT_OF_SERVICE:
7300 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRESENT_VALUE:
7301 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELINQUISH_DEFAULT:
7302 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_APPLICATION_TYPE:
7303 default:
7304 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
7305 break;
7308 } /*dissect_zcl_binary_output_basic_attr_data*/
7311 /*FUNCTION:------------------------------------------------------
7312 * NAME
7313 * proto_register_zbee_zcl_binary_output_basic
7314 * DESCRIPTION
7315 * ZigBee ZCL Binary Output Basic cluster protocol registration routine.
7316 * PARAMETERS
7317 * none
7318 * RETURNS
7319 * none
7320 *---------------------------------------------------------------
7322 void
7323 proto_register_zbee_zcl_binary_output_basic(void)
7325 /* Setup list of header fields */
7326 static hf_register_info hf[] = {
7328 { &hf_zbee_zcl_binary_output_basic_attr_id,
7329 { "Attribute", "zbee_zcl_general.binary_output_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_binary_output_basic_attr_names),
7330 0x00, NULL, HFILL } },
7332 { &hf_zbee_zcl_binary_output_basic_reliability,
7333 { "Reliability", "zbee_zcl_general.binary_output_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names),
7334 0x00, NULL, HFILL } },
7336 /* start Status Flags fields */
7337 { &hf_zbee_zcl_binary_output_basic_status_flags,
7338 { "Status Flags", "zbee_zcl_general.binary_output_basic.attr.status", FT_UINT8, BASE_HEX, NULL,
7339 0x00, NULL, HFILL } },
7341 { &hf_zbee_zcl_binary_output_basic_status_in_alarm,
7342 { "In Alarm Status", "zbee_zcl_general.binary_output_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL,
7343 ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } },
7345 { &hf_zbee_zcl_binary_output_basic_status_fault,
7346 { "Fault Status", "zbee_zcl_general.binary_output_basic.attr.status.fault", FT_BOOLEAN, 8, NULL,
7347 ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } },
7349 { &hf_zbee_zcl_binary_output_basic_status_overridden,
7350 { "Overridden Status", "zbee_zcl_general.binary_output_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL,
7351 ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } },
7353 { &hf_zbee_zcl_binary_output_basic_status_out_of_service,
7354 { "Out of Service Status", "zbee_zcl_general.binary_output_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL,
7355 ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } },
7356 /* end Status Flags fields */
7358 { &hf_zbee_zcl_binary_output_basic_polarity,
7359 { "Polarity", "zbee_zcl_general.binary_output_basic.attr.polarity", FT_UINT8, BASE_HEX, VALS(zbee_zcl_binary_output_polarity_values),
7360 0x00, NULL, HFILL } },
7362 { &hf_zbee_zcl_binary_output_basic_priority_array_bool,
7363 { "Valid/Invalid", "zbee_zcl_general.binary_output_basic.attr.priority_array.bool", FT_BOOLEAN, BASE_NONE, TFS(&tfs_invalid_valid),
7364 0x00, NULL, HFILL } },
7366 { &hf_zbee_zcl_binary_output_basic_priority_array_sing_prec,
7367 { "Priority Value", "zbee_zcl_general.binary_output_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL,
7368 0x00, NULL, HFILL } },
7370 { &hf_zbee_zcl_binary_output_basic_priority_array,
7371 { "Priority Array", "zbee_zcl_general.binary_output_basic.priority_array", FT_NONE, BASE_NONE, NULL,
7372 0x00, NULL, HFILL } },
7374 { &hf_zbee_zcl_binary_output_basic_structure,
7375 { "Structure", "zbee_zcl_general.binary_output_basic.structure", FT_NONE, BASE_NONE, NULL,
7376 0x00, NULL, HFILL } }
7379 /* ZCL Binary Output Basic subtrees */
7380 static int *ett[] = {
7381 &ett_zbee_zcl_binary_output_basic,
7382 &ett_zbee_zcl_binary_output_basic_status_flags,
7383 &ett_zbee_zcl_binary_output_basic_priority_array,
7384 &ett_zbee_zcl_binary_output_basic_priority_array_structure
7387 /* Register the ZigBee ZCL Binary Output Basic cluster protocol name and description */
7388 proto_zbee_zcl_binary_output_basic = proto_register_protocol("ZigBee ZCL Binary Output Basic", "ZCL Binary Output Basic", ZBEE_PROTOABBREV_ZCL_BINARY_OUTPUT_BASIC);
7389 proto_register_field_array(proto_zbee_zcl_binary_output_basic, hf, array_length(hf));
7390 proto_register_subtree_array(ett, array_length(ett));
7392 /* Register the ZigBee ZCL Binary Output Basic dissector. */
7393 register_dissector(ZBEE_PROTOABBREV_ZCL_BINARY_OUTPUT_BASIC, dissect_zbee_zcl_binary_output_basic, proto_zbee_zcl_binary_output_basic);
7394 } /*proto_register_zbee_zcl_binary_output_basic*/
7396 /*FUNCTION:------------------------------------------------------
7397 * NAME
7398 * proto_reg_handoff_zbee_zcl_binary_output_basic
7399 * DESCRIPTION
7400 * Hands off the ZCL Binary Output Basic dissector.
7401 * PARAMETERS
7402 * none
7403 * RETURNS
7404 * none
7405 *---------------------------------------------------------------
7407 void
7408 proto_reg_handoff_zbee_zcl_binary_output_basic(void)
7410 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_BINARY_OUTPUT_BASIC,
7411 proto_zbee_zcl_binary_output_basic,
7412 ett_zbee_zcl_binary_output_basic,
7413 ZBEE_ZCL_CID_BINARY_OUTPUT_BASIC,
7414 ZBEE_MFG_CODE_NONE,
7415 hf_zbee_zcl_binary_output_basic_attr_id,
7416 hf_zbee_zcl_binary_output_basic_attr_id,
7417 -1, -1,
7418 (zbee_zcl_fn_attr_data)dissect_zcl_binary_output_basic_attr_data
7420 } /*proto_reg_handoff_zbee_zcl_binary_output_basic*/
7422 /* ########################################################################## */
7423 /* #### (0x0011) BINARY VALUE (BASIC) CLUSTER ############################### */
7424 /* ########################################################################## */
7426 /*************************/
7427 /* Defines */
7428 /*************************/
7430 /*Attributes*/
7431 #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_ACTIVE_TEXT 0x0004 /* Active Text */
7432 #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_DESCRIPTION 0x001C /* Description */
7433 #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_INACTIVE_TEXT 0x002E /* Inactive Text */
7434 #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_OFF_TIME 0x0042 /* Maximum Off Time */
7435 #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_ON_TIME 0x0043 /* Minimum On Time */
7436 #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */
7437 #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRESENT_VALUE 0x0055 /* Present Value */
7438 #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRIORITY_ARRAY 0x0057 /* Priority Array */
7439 #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELIABILITY 0x0067 /* Reliability */
7440 #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELINQUISH_DEFAULT 0x0068 /* Relinquish Default */
7441 #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_STATUS_FLAGS 0x006F /* Status Flags */
7442 #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */
7444 /*Server commands received - none*/
7446 /*Server commands generated - none*/
7448 /*************************/
7449 /* Function Declarations */
7450 /*************************/
7452 void proto_register_zbee_zcl_binary_value_basic(void);
7453 void proto_reg_handoff_zbee_zcl_binary_value_basic(void);
7455 /* Command Dissector Helpers */
7456 static void dissect_zcl_binary_value_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
7458 /* Private functions prototype */
7460 /*************************/
7461 /* Global Variables */
7462 /*************************/
7463 /* Initialize the protocol and registered fields */
7464 static int proto_zbee_zcl_binary_value_basic;
7466 static int hf_zbee_zcl_binary_value_basic_attr_id;
7467 static int hf_zbee_zcl_binary_value_basic_status_flags;
7468 static int hf_zbee_zcl_binary_value_basic_status_in_alarm;
7469 static int hf_zbee_zcl_binary_value_basic_status_fault;
7470 static int hf_zbee_zcl_binary_value_basic_status_overridden;
7471 static int hf_zbee_zcl_binary_value_basic_status_out_of_service;
7472 static int hf_zbee_zcl_binary_value_basic_priority_array_bool;
7473 static int hf_zbee_zcl_binary_value_basic_priority_array_sing_prec;
7474 static int hf_zbee_zcl_binary_value_basic_reliability;
7475 static int hf_zbee_zcl_binary_value_basic_priority_array;
7476 static int hf_zbee_zcl_binary_value_basic_structure;
7478 /* Initialize the subtree pointers */
7479 static int ett_zbee_zcl_binary_value_basic;
7480 static int ett_zbee_zcl_binary_value_basic_status_flags;
7481 static int ett_zbee_zcl_binary_value_basic_priority_array;
7482 static int ett_zbee_zcl_binary_value_basic_priority_array_structure;
7484 /* Attributes */
7485 static const value_string zbee_zcl_binary_value_basic_attr_names[] = {
7486 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_ACTIVE_TEXT, "Active Text" },
7487 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_DESCRIPTION, "Description" },
7488 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_INACTIVE_TEXT, "Inactive Text" },
7489 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_OFF_TIME, "Minimum Off Time" },
7490 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_ON_TIME, "Minimum On Time" },
7491 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_OUT_OF_SERVICE, "Out of Service" },
7492 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRESENT_VALUE, "Present Value" },
7493 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRIORITY_ARRAY, "Priority Array" },
7494 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELIABILITY, "Reliability" },
7495 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELINQUISH_DEFAULT, "Relinquish Default" },
7496 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_STATUS_FLAGS, "Status Flags" },
7497 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_APPLICATION_TYPE, "Application Type" },
7498 { 0, NULL }
7501 /*************************/
7502 /* Function Bodies */
7503 /*************************/
7505 /*FUNCTION:------------------------------------------------------
7506 * NAME
7507 * dissect_zbee_zcl_binary_value_basic
7508 * DESCRIPTION
7509 * ZigBee ZCL Binary Value Basic cluster dissector for wireshark.
7510 * PARAMETERS
7511 * tvbuff_t *tvb - pointer to buffer containing raw packet.
7512 * packet_info *pinfo - pointer to packet information fields
7513 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
7514 * RETURNS
7515 * int - length of parsed data.
7516 *---------------------------------------------------------------
7519 static int
7520 dissect_zbee_zcl_binary_value_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_)
7522 return tvb_captured_length(tvb);
7523 } /*dissect_zbee_zcl_binary_value_basic*/
7526 /*FUNCTION:------------------------------------------------------
7527 * NAME
7528 * dissect_zcl_binary_value_basic_attr_data
7529 * DESCRIPTION
7530 * this function is called by ZCL foundation dissector in order to decode
7531 * specific cluster attributes data.
7532 * PARAMETERS
7533 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
7534 * tvbuff_t *tvb - pointer to buffer containing raw packet.
7535 * unsigned *offset - pointer to buffer offset
7536 * uint16_t attr_id - attribute identifier
7537 * unsigned data_type - attribute data type
7538 * bool client_attr- ZCL client
7539 * RETURNS
7540 * none
7541 *---------------------------------------------------------------
7543 void
7544 dissect_zcl_binary_value_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
7546 proto_item *ti = NULL, *tj = NULL;
7547 proto_tree *sub_tree = NULL, *sub = NULL;
7548 int i;
7550 static int * const status_flags[] = {
7551 &hf_zbee_zcl_binary_value_basic_status_in_alarm,
7552 &hf_zbee_zcl_binary_value_basic_status_fault,
7553 &hf_zbee_zcl_binary_value_basic_status_overridden,
7554 &hf_zbee_zcl_binary_value_basic_status_out_of_service,
7555 NULL
7558 /* Dissect attribute data type and data */
7559 switch (attr_id) {
7561 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRIORITY_ARRAY:
7562 ti = proto_tree_add_item(tree,hf_zbee_zcl_binary_value_basic_priority_array, tvb, *offset, 80, ENC_NA);
7563 sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_binary_value_basic_priority_array);
7565 for( i = 1; i <= 16; i++)
7567 tj = proto_tree_add_item(sub_tree, hf_zbee_zcl_binary_value_basic_structure, tvb, *offset, 5, ENC_NA);
7568 proto_item_append_text(tj," %d",i);
7569 sub = proto_item_add_subtree(tj, ett_zbee_zcl_binary_value_basic_priority_array_structure);
7570 proto_tree_add_item(sub, hf_zbee_zcl_binary_value_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
7571 *offset += 1;
7572 proto_tree_add_item(sub, hf_zbee_zcl_binary_value_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
7573 *offset += 4;
7575 break;
7577 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELIABILITY:
7578 proto_tree_add_item(tree, hf_zbee_zcl_binary_value_basic_reliability, tvb, *offset, 1, ENC_NA);
7579 *offset += 1;
7580 break;
7582 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_STATUS_FLAGS:
7583 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_binary_value_basic_status_flags, ett_zbee_zcl_binary_value_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN);
7584 *offset += 1;
7585 break;
7587 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_ACTIVE_TEXT:
7588 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_DESCRIPTION:
7589 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_INACTIVE_TEXT:
7590 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_OFF_TIME:
7591 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_ON_TIME:
7592 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_OUT_OF_SERVICE:
7593 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRESENT_VALUE:
7594 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELINQUISH_DEFAULT:
7595 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_APPLICATION_TYPE:
7596 default:
7597 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
7598 break;
7601 } /*dissect_zcl_binary_value_basic_attr_data*/
7604 /*FUNCTION:------------------------------------------------------
7605 * NAME
7606 * proto_register_zbee_zcl_binary_value_basic
7607 * DESCRIPTION
7608 * ZigBee ZCL Binary Value Basic cluster protocol registration routine.
7609 * PARAMETERS
7610 * none
7611 * RETURNS
7612 * none
7613 *---------------------------------------------------------------
7615 void
7616 proto_register_zbee_zcl_binary_value_basic(void)
7618 /* Setup list of header fields */
7619 static hf_register_info hf[] = {
7621 { &hf_zbee_zcl_binary_value_basic_attr_id,
7622 { "Attribute", "zbee_zcl_general.binary_value_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_binary_value_basic_attr_names),
7623 0x00, NULL, HFILL } },
7625 { &hf_zbee_zcl_binary_value_basic_reliability,
7626 { "Reliability", "zbee_zcl_general.binary_value_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names),
7627 0x00, NULL, HFILL } },
7629 /* start Status Flags fields */
7630 { &hf_zbee_zcl_binary_value_basic_status_flags,
7631 { "Status Flags", "zbee_zcl_general.binary_value_basic.attr.status", FT_UINT8, BASE_HEX, NULL,
7632 0x00, NULL, HFILL } },
7634 { &hf_zbee_zcl_binary_value_basic_status_in_alarm,
7635 { "In Alarm Status", "zbee_zcl_general.binary_value_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL,
7636 ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } },
7638 { &hf_zbee_zcl_binary_value_basic_status_fault,
7639 { "Fault Status", "zbee_zcl_general.binary_value_basic.attr.status.fault", FT_BOOLEAN, 8, NULL,
7640 ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } },
7642 { &hf_zbee_zcl_binary_value_basic_status_overridden,
7643 { "Overridden Status", "zbee_zcl_general.binary_value_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL,
7644 ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } },
7646 { &hf_zbee_zcl_binary_value_basic_status_out_of_service,
7647 { "Out of Service Status", "zbee_zcl_general.binary_value_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL,
7648 ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } },
7649 /* end Status Flags fields */
7651 { &hf_zbee_zcl_binary_value_basic_priority_array_bool,
7652 { "Valid/Invalid", "zbee_zcl_general.binary_value_basic.attr.priority_array.bool", FT_BOOLEAN, BASE_NONE, TFS(&tfs_invalid_valid),
7653 0x00, NULL, HFILL } },
7655 { &hf_zbee_zcl_binary_value_basic_priority_array_sing_prec,
7656 { "Priority Value", "zbee_zcl_general.binary_value_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL,
7657 0x00, NULL, HFILL } },
7659 { &hf_zbee_zcl_binary_value_basic_priority_array,
7660 { "Priority Array", "zbee_zcl_general.binary_value_basic.priority_array", FT_NONE, BASE_NONE, NULL,
7661 0x00, NULL, HFILL } },
7663 { &hf_zbee_zcl_binary_value_basic_structure,
7664 { "Structure", "zbee_zcl_general.binary_value_basic.structure", FT_NONE, BASE_NONE, NULL,
7665 0x00, NULL, HFILL } }
7668 /* ZCL Binary Value Basic subtrees */
7669 static int *ett[] = {
7670 &ett_zbee_zcl_binary_value_basic,
7671 &ett_zbee_zcl_binary_value_basic_status_flags,
7672 &ett_zbee_zcl_binary_value_basic_priority_array,
7673 &ett_zbee_zcl_binary_value_basic_priority_array_structure
7676 /* Register the ZigBee ZCL Binary Value Basic cluster protocol name and description */
7677 proto_zbee_zcl_binary_value_basic = proto_register_protocol("ZigBee ZCL Binary Value Basic", "ZCL Binary Value Basic", ZBEE_PROTOABBREV_ZCL_BINARY_VALUE_BASIC);
7678 proto_register_field_array(proto_zbee_zcl_binary_value_basic, hf, array_length(hf));
7679 proto_register_subtree_array(ett, array_length(ett));
7681 /* Register the ZigBee ZCL Binary Value Basic dissector. */
7682 register_dissector(ZBEE_PROTOABBREV_ZCL_BINARY_VALUE_BASIC, dissect_zbee_zcl_binary_value_basic, proto_zbee_zcl_binary_value_basic);
7683 } /*proto_register_zbee_zcl_binary_value_basic*/
7685 /*FUNCTION:------------------------------------------------------
7686 * NAME
7687 * proto_reg_handoff_zbee_zcl_binary_value_basic
7688 * DESCRIPTION
7689 * Hands off the ZCL Binary Value Basic dissector.
7690 * PARAMETERS
7691 * none
7692 * RETURNS
7693 * none
7694 *---------------------------------------------------------------
7696 void
7697 proto_reg_handoff_zbee_zcl_binary_value_basic(void)
7699 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_BINARY_VALUE_BASIC,
7700 proto_zbee_zcl_binary_value_basic,
7701 ett_zbee_zcl_binary_value_basic,
7702 ZBEE_ZCL_CID_BINARY_VALUE_BASIC,
7703 ZBEE_MFG_CODE_NONE,
7704 hf_zbee_zcl_binary_value_basic_attr_id,
7705 hf_zbee_zcl_binary_value_basic_attr_id,
7706 -1, -1,
7707 (zbee_zcl_fn_attr_data)dissect_zcl_binary_value_basic_attr_data
7709 } /*proto_reg_handoff_zbee_zcl_binary_value_basic*/
7712 /* ########################################################################## */
7713 /* #### (0x0012) MULTISTATE INPUT (BASIC) CLUSTER ########################### */
7714 /* ########################################################################## */
7716 /*************************/
7717 /* Defines */
7718 /*************************/
7720 /*Attributes*/
7721 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_STATE_TEXT 0x000E /* State Text */
7722 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_DESCRIPTION 0x001C /* Description */
7723 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_NUMBER_OF_STATES 0x004A /* Number of States */
7724 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */
7725 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_PRESENT_VALUE 0x0055 /* Present Value */
7726 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_RELIABILITY 0x0067 /* Reliability */
7727 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_STATUS_FLAGS 0x006F /* Status Flags */
7728 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */
7730 /*Server commands received - none*/
7732 /*Server commands generated - none*/
7734 /*************************/
7735 /* Function Declarations */
7736 /*************************/
7738 void proto_register_zbee_zcl_multistate_input_basic(void);
7739 void proto_reg_handoff_zbee_zcl_multistate_input_basic(void);
7741 /* Command Dissector Helpers */
7742 static void dissect_zcl_multistate_input_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
7744 /* Private functions prototype */
7746 /*************************/
7747 /* Global Variables */
7748 /*************************/
7749 /* Initialize the protocol and registered fields */
7750 static int proto_zbee_zcl_multistate_input_basic;
7752 static int hf_zbee_zcl_multistate_input_basic_attr_id;
7753 static int hf_zbee_zcl_multistate_input_basic_status_flags;
7754 static int hf_zbee_zcl_multistate_input_basic_status_in_alarm;
7755 static int hf_zbee_zcl_multistate_input_basic_status_fault;
7756 static int hf_zbee_zcl_multistate_input_basic_status_overridden;
7757 static int hf_zbee_zcl_multistate_input_basic_status_out_of_service;
7758 static int hf_zbee_zcl_multistate_input_basic_reliability;
7760 /* Initialize the subtree pointers */
7761 static int ett_zbee_zcl_multistate_input_basic;
7762 static int ett_zbee_zcl_multistate_input_basic_status_flags;
7764 /* Attributes */
7765 static const value_string zbee_zcl_multistate_input_basic_attr_names[] = {
7766 { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_STATE_TEXT, "State Text" },
7767 { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_DESCRIPTION, "Description" },
7768 { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_NUMBER_OF_STATES, "Number of States" },
7769 { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_OUT_OF_SERVICE, "Out of Service" },
7770 { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_PRESENT_VALUE, "Present Value" },
7771 { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_RELIABILITY, "Reliability" },
7772 { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_STATUS_FLAGS, "Status Flags" },
7773 { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_APPLICATION_TYPE, "Application Type" },
7774 { 0, NULL }
7777 /*************************/
7778 /* Function Bodies */
7779 /*************************/
7781 /*FUNCTION:------------------------------------------------------
7782 * NAME
7783 * dissect_zbee_zcl_multistate_input_basic
7784 * DESCRIPTION
7785 * ZigBee ZCL Multistate Input Basic cluster dissector for wireshark.
7786 * PARAMETERS
7787 * tvbuff_t *tvb - pointer to buffer containing raw packet.
7788 * packet_info *pinfo - pointer to packet information fields
7789 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
7790 * RETURNS
7791 * none
7792 *---------------------------------------------------------------
7795 static int
7796 dissect_zbee_zcl_multistate_input_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_)
7798 return tvb_captured_length(tvb);
7799 } /*dissect_zbee_zcl_multistate_input_basic*/
7802 /*FUNCTION:------------------------------------------------------
7803 * NAME
7804 * dissect_zcl_multistate_input_basic_attr_data
7805 * DESCRIPTION
7806 * this function is called by ZCL foundation dissector in order to decode
7807 * specific cluster attributes data.
7808 * PARAMETERS
7809 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
7810 * tvbuff_t *tvb - pointer to buffer containing raw packet.
7811 * unsigned *offset - pointer to buffer offset
7812 * uint16_t attr_id - attribute identifier
7813 * unsigned data_type - attribute data type
7814 * bool client_attr- ZCL client
7815 * RETURNS
7816 * none
7817 *---------------------------------------------------------------
7819 void
7820 dissect_zcl_multistate_input_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
7822 static int * const status_flags[] = {
7823 &hf_zbee_zcl_multistate_input_basic_status_in_alarm,
7824 &hf_zbee_zcl_multistate_input_basic_status_fault,
7825 &hf_zbee_zcl_multistate_input_basic_status_overridden,
7826 &hf_zbee_zcl_multistate_input_basic_status_out_of_service,
7827 NULL
7830 /* Dissect attribute data type and data */
7831 switch (attr_id) {
7833 case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_RELIABILITY:
7834 proto_tree_add_item(tree, hf_zbee_zcl_multistate_input_basic_reliability, tvb, *offset, 1, ENC_NA);
7835 *offset += 1;
7836 break;
7838 case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_STATUS_FLAGS:
7839 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_multistate_input_basic_status_flags, ett_zbee_zcl_multistate_input_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN);
7840 *offset += 1;
7841 break;
7843 case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_DESCRIPTION:
7844 case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_NUMBER_OF_STATES:
7845 case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_OUT_OF_SERVICE:
7846 case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_PRESENT_VALUE:
7847 case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_APPLICATION_TYPE:
7848 default:
7849 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
7850 break;
7853 } /*dissect_zcl_multistate_input_basic_attr_data*/
7856 /*FUNCTION:------------------------------------------------------
7857 * NAME
7858 * proto_register_zbee_zcl_multistate_input_basic
7859 * DESCRIPTION
7860 * ZigBee ZCL Multistate Input Basic cluster protocol registration routine.
7861 * PARAMETERS
7862 * none
7863 * RETURNS
7864 * void
7865 *---------------------------------------------------------------
7867 void
7868 proto_register_zbee_zcl_multistate_input_basic(void)
7870 /* Setup list of header fields */
7871 static hf_register_info hf[] = {
7873 { &hf_zbee_zcl_multistate_input_basic_attr_id,
7874 { "Attribute", "zbee_zcl_general.multistate_input_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_multistate_input_basic_attr_names),
7875 0x00, NULL, HFILL } },
7877 { &hf_zbee_zcl_multistate_input_basic_reliability,
7878 { "Reliability", "zbee_zcl_general.multistate_input_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names),
7879 0x00, NULL, HFILL } },
7881 /* start Status Flags fields */
7882 { &hf_zbee_zcl_multistate_input_basic_status_flags,
7883 { "Status Flags", "zbee_zcl_general.multistate_input_basic.attr.status", FT_UINT8, BASE_HEX, NULL,
7884 0x00, NULL, HFILL } },
7886 { &hf_zbee_zcl_multistate_input_basic_status_in_alarm,
7887 { "In Alarm Status", "zbee_zcl_general.multistate_input_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL,
7888 ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } },
7890 { &hf_zbee_zcl_multistate_input_basic_status_fault,
7891 { "Fault Status", "zbee_zcl_general.multistate_input_basic.attr.status.fault", FT_BOOLEAN, 8, NULL,
7892 ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } },
7894 { &hf_zbee_zcl_multistate_input_basic_status_overridden,
7895 { "Overridden Status", "zbee_zcl_general.multistate_input_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL,
7896 ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } },
7898 { &hf_zbee_zcl_multistate_input_basic_status_out_of_service,
7899 { "Out of Service Status", "zbee_zcl_general.multistate_input_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL,
7900 ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } }
7901 /* end Status Flags fields */
7904 /* ZCL Multistate Input Basic subtrees */
7905 static int *ett[] = {
7906 &ett_zbee_zcl_multistate_input_basic,
7907 &ett_zbee_zcl_multistate_input_basic_status_flags
7910 /* Register the ZigBee ZCL Multistate Input Basic cluster protocol name and description */
7911 proto_zbee_zcl_multistate_input_basic = proto_register_protocol("ZigBee ZCL Multistate Input Basic", "ZCL Multistate Input Basic", ZBEE_PROTOABBREV_ZCL_MULTISTATE_INPUT_BASIC);
7912 proto_register_field_array(proto_zbee_zcl_multistate_input_basic, hf, array_length(hf));
7913 proto_register_subtree_array(ett, array_length(ett));
7915 /* Register the ZigBee ZCL Multistate Input Basic dissector. */
7916 register_dissector(ZBEE_PROTOABBREV_ZCL_MULTISTATE_INPUT_BASIC, dissect_zbee_zcl_multistate_input_basic, proto_zbee_zcl_multistate_input_basic);
7917 } /*proto_register_zbee_zcl_multistate_input_basic*/
7919 /*FUNCTION:------------------------------------------------------
7920 * NAME
7921 * proto_reg_handoff_zbee_zcl_multistate_input_basic
7922 * DESCRIPTION
7923 * Hands off the ZCL Multistate Input Basic dissector.
7924 * PARAMETERS
7925 * none
7926 * RETURNS
7927 * none
7928 *---------------------------------------------------------------
7930 void
7931 proto_reg_handoff_zbee_zcl_multistate_input_basic(void)
7933 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_MULTISTATE_INPUT_BASIC,
7934 proto_zbee_zcl_multistate_input_basic,
7935 ett_zbee_zcl_multistate_input_basic,
7936 ZBEE_ZCL_CID_MULTISTATE_INPUT_BASIC,
7937 ZBEE_MFG_CODE_NONE,
7938 hf_zbee_zcl_multistate_input_basic_attr_id,
7939 hf_zbee_zcl_multistate_input_basic_attr_id,
7940 -1, -1,
7941 (zbee_zcl_fn_attr_data)dissect_zcl_multistate_input_basic_attr_data
7943 } /*proto_reg_handoff_zbee_zcl_multistate_input_basic*/
7946 /* ########################################################################## */
7947 /* #### (0x0013) MULTISTATE OUTPUT (BASIC) CLUSTER ########################## */
7948 /* ########################################################################## */
7950 /*************************/
7951 /* Defines */
7952 /*************************/
7954 /*Attributes*/
7955 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_STATE_TEXT 0x000E /* State Text */
7956 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_DESCRIPTION 0x001C /* Description */
7957 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_NUMBER_OF_STATES 0x004A /* Number of States */
7958 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */
7959 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRESENT_VALUE 0x0055 /* Present Value */
7960 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRIORITY_ARRAY 0x0057 /* Priority Array */
7961 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELIABILITY 0x0067 /* Reliability */
7962 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELINQUISH_DEFAULT 0x0068 /* Relinquish Default */
7963 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_STATUS_FLAGS 0x006F /* Status Flags */
7964 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */
7966 /*Server commands received - none*/
7968 /*Server commands generated - none*/
7970 /*************************/
7971 /* Function Declarations */
7972 /*************************/
7974 void proto_register_zbee_zcl_multistate_output_basic(void);
7975 void proto_reg_handoff_zbee_zcl_multistate_output_basic(void);
7977 /* Command Dissector Helpers */
7978 static void dissect_zcl_multistate_output_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
7980 /* Private functions prototype */
7982 /*************************/
7983 /* Global Variables */
7984 /*************************/
7985 /* Initialize the protocol and registered fields */
7986 static int proto_zbee_zcl_multistate_output_basic;
7988 static int hf_zbee_zcl_multistate_output_basic_attr_id;
7989 static int hf_zbee_zcl_multistate_output_basic_status_flags;
7990 static int hf_zbee_zcl_multistate_output_basic_status_in_alarm;
7991 static int hf_zbee_zcl_multistate_output_basic_status_fault;
7992 static int hf_zbee_zcl_multistate_output_basic_status_overridden;
7993 static int hf_zbee_zcl_multistate_output_basic_status_out_of_service;
7994 static int hf_zbee_zcl_multistate_output_basic_reliability;
7995 static int hf_zbee_zcl_multistate_output_basic_priority_array_bool;
7996 static int hf_zbee_zcl_multistate_output_basic_priority_array_sing_prec;
7997 static int hf_zbee_zcl_multistate_output_basic_priority_array;
7998 static int hf_zbee_zcl_multistate_output_basic_structure;
8000 /* Initialize the subtree pointers */
8001 static int ett_zbee_zcl_multistate_output_basic;
8002 static int ett_zbee_zcl_multistate_output_basic_status_flags;
8003 static int ett_zbee_zcl_multistate_output_basic_priority_array;
8004 static int ett_zbee_zcl_multistate_output_basic_priority_array_structure;
8006 /* Attributes */
8007 static const value_string zbee_zcl_multistate_output_basic_attr_names[] = {
8008 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_STATE_TEXT, "State Text" },
8009 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_DESCRIPTION, "Description" },
8010 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_NUMBER_OF_STATES, "Number of States" },
8011 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_OUT_OF_SERVICE, "Out of Service" },
8012 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRESENT_VALUE, "Present Value" },
8013 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRIORITY_ARRAY, "Priority Array" },
8014 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELIABILITY, "Reliability" },
8015 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELINQUISH_DEFAULT, "Relinquish Default" },
8016 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_STATUS_FLAGS, "Status Flags" },
8017 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_APPLICATION_TYPE, "Application Type" },
8018 { 0, NULL }
8021 static const value_string zbee_zcl_multistate_output_basic_priority_array_bool_values[] = {
8022 { 0x01, "Valid" },
8023 { 0x00, "Invalid" },
8024 { 0, NULL }
8027 /*************************/
8028 /* Function Bodies */
8029 /*************************/
8031 /*FUNCTION:------------------------------------------------------
8032 * NAME
8033 * dissect_zbee_zcl_multistate_output_basic
8034 * DESCRIPTION
8035 * ZigBee ZCL Multistate Output Basic cluster dissector for wireshark.
8036 * PARAMETERS
8037 * tvbuff_t *tvb - pointer to buffer containing raw packet.
8038 * packet_info *pinfo - pointer to packet information fields
8039 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
8040 * RETURNS
8041 * none
8042 *---------------------------------------------------------------
8045 static int
8046 dissect_zbee_zcl_multistate_output_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_)
8048 return tvb_captured_length(tvb);
8049 } /*dissect_zbee_zcl_multistate_output_basic*/
8052 /*FUNCTION:------------------------------------------------------
8053 * NAME
8054 * dissect_zcl_multistate_output_basic_attr_data
8055 * DESCRIPTION
8056 * this function is called by ZCL foundation dissector in order to decode
8057 * specific cluster attributes data.
8058 * PARAMETERS
8059 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
8060 * tvbuff_t *tvb - pointer to buffer containing raw packet.
8061 * unsigned *offset - pointer to buffer offset
8062 * uint16_t attr_id - attribute identifier
8063 * unsigned data_type - attribute data type
8064 * bool client_attr- ZCL client
8065 * RETURNS
8066 * none
8067 *---------------------------------------------------------------
8069 void
8070 dissect_zcl_multistate_output_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
8072 proto_item *ti = NULL, *tj = NULL;
8073 proto_tree *sub_tree = NULL, *sub = NULL;
8074 int i;
8076 static int * const status_flags[] = {
8077 &hf_zbee_zcl_multistate_output_basic_status_in_alarm,
8078 &hf_zbee_zcl_multistate_output_basic_status_fault,
8079 &hf_zbee_zcl_multistate_output_basic_status_overridden,
8080 &hf_zbee_zcl_multistate_output_basic_status_out_of_service,
8081 NULL
8084 /* Dissect attribute data type and data */
8085 switch (attr_id) {
8087 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRIORITY_ARRAY:
8088 ti = proto_tree_add_item(tree,hf_zbee_zcl_multistate_output_basic_priority_array, tvb, *offset, 80, ENC_NA);
8089 sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_multistate_output_basic_priority_array);
8091 for( i = 1; i <= 16; i++)
8093 tj = proto_tree_add_item(sub_tree, hf_zbee_zcl_multistate_output_basic_structure, tvb, *offset, 5, ENC_NA);
8094 proto_item_append_text(tj," %d",i);
8095 sub = proto_item_add_subtree(tj, ett_zbee_zcl_multistate_output_basic_priority_array_structure);
8096 proto_tree_add_item(sub, hf_zbee_zcl_multistate_output_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
8097 *offset += 1;
8098 proto_tree_add_item(sub, hf_zbee_zcl_multistate_output_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
8099 *offset += 4;
8101 break;
8103 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELIABILITY:
8104 proto_tree_add_item(tree, hf_zbee_zcl_multistate_output_basic_reliability, tvb, *offset, 1, ENC_NA);
8105 *offset += 1;
8106 break;
8108 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_STATUS_FLAGS:
8109 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_multistate_output_basic_status_flags, ett_zbee_zcl_multistate_output_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN);
8110 *offset += 1;
8111 break;
8113 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_DESCRIPTION:
8114 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_NUMBER_OF_STATES:
8115 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_OUT_OF_SERVICE:
8116 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELINQUISH_DEFAULT:
8117 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRESENT_VALUE:
8118 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_APPLICATION_TYPE:
8119 default:
8120 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
8121 break;
8124 } /*dissect_zcl_multistate_output_basic_attr_data*/
8127 /*FUNCTION:------------------------------------------------------
8128 * NAME
8129 * proto_register_zbee_zcl_multistate_output_basic
8130 * DESCRIPTION
8131 * ZigBee ZCL Multistate Output Basic cluster protocol registration routine.
8132 * PARAMETERS
8133 * none
8134 * RETURNS
8135 * void
8136 *---------------------------------------------------------------
8138 void
8139 proto_register_zbee_zcl_multistate_output_basic(void)
8141 /* Setup list of header fields */
8142 static hf_register_info hf[] = {
8144 { &hf_zbee_zcl_multistate_output_basic_attr_id,
8145 { "Attribute", "zbee_zcl_general.multistate_output_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_multistate_output_basic_attr_names),
8146 0x00, NULL, HFILL } },
8148 { &hf_zbee_zcl_multistate_output_basic_reliability,
8149 { "Reliability", "zbee_zcl_general.multistate_output_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names),
8150 0x00, NULL, HFILL } },
8152 /* start Status Flags fields */
8153 { &hf_zbee_zcl_multistate_output_basic_status_flags,
8154 { "Status Flags", "zbee_zcl_general.multistate_output_basic.attr.status", FT_UINT8, BASE_HEX, NULL,
8155 0x00, NULL, HFILL } },
8157 { &hf_zbee_zcl_multistate_output_basic_status_in_alarm,
8158 { "In Alarm Status", "zbee_zcl_general.multistate_output_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL,
8159 ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } },
8161 { &hf_zbee_zcl_multistate_output_basic_status_fault,
8162 { "Fault Status", "zbee_zcl_general.multistate_output_basic.attr.status.fault", FT_BOOLEAN, 8, NULL,
8163 ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } },
8165 { &hf_zbee_zcl_multistate_output_basic_status_overridden,
8166 { "Overridden Status", "zbee_zcl_general.multistate_output_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL,
8167 ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } },
8169 { &hf_zbee_zcl_multistate_output_basic_status_out_of_service,
8170 { "Out of Service Status", "zbee_zcl_general.multistate_output_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL,
8171 ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } },
8172 /* end Status Flags fields */
8174 { &hf_zbee_zcl_multistate_output_basic_priority_array_bool,
8175 { "Valid/Invalid", "zbee_zcl_general.multistate_output_basic.attr.priority_array.bool", FT_UINT8, BASE_HEX, VALS(zbee_zcl_multistate_output_basic_priority_array_bool_values),
8176 0x00, NULL, HFILL } },
8178 { &hf_zbee_zcl_multistate_output_basic_priority_array_sing_prec,
8179 { "Priority Value", "zbee_zcl_general.multistate_output_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL,
8180 0x00, NULL, HFILL } } ,
8182 { &hf_zbee_zcl_multistate_output_basic_priority_array,
8183 { "Priority Array", "zbee_zcl_general.multistate_output_basic.priority_array", FT_NONE, BASE_NONE, NULL,
8184 0x00, NULL, HFILL } },
8186 { &hf_zbee_zcl_multistate_output_basic_structure,
8187 { "Structure", "zbee_zcl_general.multistate_output_basic.structure", FT_NONE, BASE_NONE, NULL,
8188 0x00, NULL, HFILL } }
8191 /* ZCL Multistate Output Basic subtrees */
8192 static int *ett[] = {
8193 &ett_zbee_zcl_multistate_output_basic,
8194 &ett_zbee_zcl_multistate_output_basic_status_flags,
8195 &ett_zbee_zcl_multistate_output_basic_priority_array,
8196 &ett_zbee_zcl_multistate_output_basic_priority_array_structure
8199 /* Register the ZigBee ZCL Multistate Output Basic cluster protocol name and description */
8200 proto_zbee_zcl_multistate_output_basic = proto_register_protocol("ZigBee ZCL Multistate Output Basic", "ZCL Multistate Output Basic", ZBEE_PROTOABBREV_ZCL_MULTISTATE_OUTPUT_BASIC);
8201 proto_register_field_array(proto_zbee_zcl_multistate_output_basic, hf, array_length(hf));
8202 proto_register_subtree_array(ett, array_length(ett));
8204 /* Register the ZigBee ZCL Multistate Output Basic dissector. */
8205 register_dissector(ZBEE_PROTOABBREV_ZCL_MULTISTATE_OUTPUT_BASIC, dissect_zbee_zcl_multistate_output_basic, proto_zbee_zcl_multistate_output_basic);
8206 } /*proto_register_zbee_zcl_multistate_output_basic*/
8208 /*FUNCTION:------------------------------------------------------
8209 * NAME
8210 * proto_reg_handoff_zbee_zcl_multistate_output_basic
8211 * DESCRIPTION
8212 * Hands off the ZCL Multistate Output Basic dissector.
8213 * PARAMETERS
8214 * none
8215 * RETURNS
8216 * none
8217 *---------------------------------------------------------------
8219 void
8220 proto_reg_handoff_zbee_zcl_multistate_output_basic(void)
8222 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_MULTISTATE_OUTPUT_BASIC,
8223 proto_zbee_zcl_multistate_output_basic,
8224 ett_zbee_zcl_multistate_output_basic,
8225 ZBEE_ZCL_CID_MULTISTATE_OUTPUT_BASIC,
8226 ZBEE_MFG_CODE_NONE,
8227 hf_zbee_zcl_multistate_output_basic_attr_id,
8228 hf_zbee_zcl_multistate_output_basic_attr_id,
8229 -1,-1,
8230 (zbee_zcl_fn_attr_data)dissect_zcl_multistate_output_basic_attr_data
8232 } /*proto_reg_handoff_zbee_zcl_multistate_output_basic*/
8235 /* ########################################################################## */
8236 /* #### (0x0014) MULTISTATE VALUE (BASIC) CLUSTER ########################### */
8237 /* ########################################################################## */
8239 /*************************/
8240 /* Defines */
8241 /*************************/
8243 /*Attributes*/
8244 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_STATE_TEXT 0x000E /* State Text */
8245 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_DESCRIPTION 0x001C /* Description */
8246 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_NUMBER_OF_STATES 0x004A /* Number of States */
8247 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */
8248 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_PRESENT_VALUE 0x0055 /* Present Value */
8249 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_PRIORITY_ARRAY 0x0057 /* Priority Array */
8250 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_RELIABILITY 0x0067 /* Reliability */
8251 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_RELINQUISH_DEFAULT 0x0068 /* Relinquish Default */
8252 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_STATUS_FLAGS 0x006F /* Status Flags */
8253 #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */
8255 /*Server commands received - none*/
8257 /*Server commands generated - none*/
8259 /*************************/
8260 /* Function Declarations */
8261 /*************************/
8263 void proto_register_zbee_zcl_multistate_value_basic(void);
8264 void proto_reg_handoff_zbee_zcl_multistate_value_basic(void);
8266 /* Command Dissector Helpers */
8267 static void dissect_zcl_multistate_value_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
8269 /* Private functions prototype */
8271 /*************************/
8272 /* Global Variables */
8273 /*************************/
8274 /* Initialize the protocol and registered fields */
8275 static int proto_zbee_zcl_multistate_value_basic;
8277 static int hf_zbee_zcl_multistate_value_basic_attr_id;
8278 static int hf_zbee_zcl_multistate_value_basic_status_flags;
8279 static int hf_zbee_zcl_multistate_value_basic_status_in_alarm;
8280 static int hf_zbee_zcl_multistate_value_basic_status_fault;
8281 static int hf_zbee_zcl_multistate_value_basic_status_overridden;
8282 static int hf_zbee_zcl_multistate_value_basic_status_out_of_service;
8283 static int hf_zbee_zcl_multistate_value_basic_reliability;
8284 static int hf_zbee_zcl_multistate_value_basic_priority_array_bool;
8285 static int hf_zbee_zcl_multistate_value_basic_priority_array_sing_prec;
8286 static int hf_zbee_zcl_multistate_value_basic_priority_array;
8287 static int hf_zbee_zcl_multistate_value_basic_structure;
8290 /* Initialize the subtree pointers */
8291 static int ett_zbee_zcl_multistate_value_basic;
8292 static int ett_zbee_zcl_multistate_value_basic_status_flags;
8293 static int ett_zbee_zcl_multistate_value_basic_priority_array;
8294 static int ett_zbee_zcl_multistate_value_basic_priority_array_structure;
8296 /* Attributes */
8297 static const value_string zbee_zcl_multistate_value_basic_attr_names[] = {
8298 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_STATE_TEXT, "State Text" },
8299 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_DESCRIPTION, "Description" },
8300 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_NUMBER_OF_STATES, "Number of States" },
8301 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_OUT_OF_SERVICE, "Out of Service" },
8302 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_PRESENT_VALUE, "Present Value" },
8303 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_PRIORITY_ARRAY, "Priority Array" },
8304 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_RELIABILITY, "Reliability" },
8305 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_RELINQUISH_DEFAULT, "Relinquish Default" },
8306 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_STATUS_FLAGS, "Status Flags" },
8307 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_APPLICATION_TYPE, "Application Type" },
8308 { 0, NULL }
8311 static const value_string zbee_zcl_multistate_value_basic_priority_array_bool_values[] = {
8312 { 0x01, "Valid" },
8313 { 0x00, "Invalid" },
8314 { 0, NULL }
8317 /*************************/
8318 /* Function Bodies */
8319 /*************************/
8321 /*FUNCTION:------------------------------------------------------
8322 * NAME
8323 * dissect_zbee_zcl_multistate_value_basic
8324 * DESCRIPTION
8325 * ZigBee ZCL Multistate Value Basic cluster dissector for wireshark.
8326 * PARAMETERS
8327 * tvbuff_t *tvb - pointer to buffer containing raw packet.
8328 * packet_info *pinfo - pointer to packet information fields
8329 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
8330 * RETURNS
8331 * none
8332 *---------------------------------------------------------------
8335 static int
8336 dissect_zbee_zcl_multistate_value_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_)
8338 return tvb_captured_length(tvb);
8339 } /*dissect_zbee_zcl_multistate_value_basic*/
8342 /*FUNCTION:------------------------------------------------------
8343 * NAME
8344 * dissect_zcl_multistate_value_basic_attr_data
8345 * DESCRIPTION
8346 * this function is called by ZCL foundation dissector in order to decode
8347 * specific cluster attributes data.
8348 * PARAMETERS
8349 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
8350 * tvbuff_t *tvb - pointer to buffer containing raw packet.
8351 * unsigned *offset - pointer to buffer offset
8352 * uint16_t attr_id - attribute identifier
8353 * unsigned data_type - attribute data type
8354 * bool client_attr- ZCL client
8355 * RETURNS
8356 * none
8357 *---------------------------------------------------------------
8359 void
8360 dissect_zcl_multistate_value_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
8362 proto_item *ti = NULL, *tj = NULL;
8363 proto_tree *sub_tree = NULL, *sub = NULL;
8364 int i;
8366 static int * const status_flags[] = {
8367 &hf_zbee_zcl_multistate_value_basic_status_in_alarm,
8368 &hf_zbee_zcl_multistate_value_basic_status_fault,
8369 &hf_zbee_zcl_multistate_value_basic_status_overridden,
8370 &hf_zbee_zcl_multistate_value_basic_status_out_of_service,
8371 NULL
8374 /* Dissect attribute data type and data */
8375 switch (attr_id) {
8377 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_PRIORITY_ARRAY:
8378 ti = proto_tree_add_item(tree,hf_zbee_zcl_multistate_value_basic_priority_array, tvb, *offset, 80, ENC_NA);
8379 sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_multistate_value_basic_priority_array);
8381 for( i = 1; i <= 16; i++)
8383 tj = proto_tree_add_item(sub_tree,hf_zbee_zcl_multistate_value_basic_structure, tvb, *offset, 5,ENC_NA);
8384 proto_item_append_text(tj," %d",i);
8385 sub = proto_item_add_subtree(tj, ett_zbee_zcl_multistate_value_basic_priority_array_structure);
8386 proto_tree_add_item(sub, hf_zbee_zcl_multistate_value_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
8387 *offset += 1;
8388 proto_tree_add_item(sub, hf_zbee_zcl_multistate_value_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
8389 *offset += 4;
8391 break;
8393 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_RELIABILITY:
8394 proto_tree_add_item(tree, hf_zbee_zcl_multistate_value_basic_reliability, tvb, *offset, 1, ENC_NA);
8395 *offset += 1;
8396 break;
8398 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_STATUS_FLAGS:
8399 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_multistate_value_basic_status_flags, ett_zbee_zcl_multistate_value_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN);
8400 *offset += 1;
8401 break;
8403 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_DESCRIPTION:
8404 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_NUMBER_OF_STATES:
8405 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_OUT_OF_SERVICE:
8406 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_RELINQUISH_DEFAULT:
8407 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_PRESENT_VALUE:
8408 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_APPLICATION_TYPE:
8409 default:
8410 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
8411 break;
8414 } /*dissect_zcl_multistate_value_basic_attr_data*/
8417 /*FUNCTION:------------------------------------------------------
8418 * NAME
8419 * proto_register_zbee_zcl_multistate_value_basic
8420 * DESCRIPTION
8421 * ZigBee ZCL Multistate Value Basic cluster protocol registration routine.
8422 * PARAMETERS
8423 * none
8424 * RETURNS
8425 * void
8426 *---------------------------------------------------------------
8428 void
8429 proto_register_zbee_zcl_multistate_value_basic(void)
8431 /* Setup list of header fields */
8432 static hf_register_info hf[] = {
8434 { &hf_zbee_zcl_multistate_value_basic_attr_id,
8435 { "Attribute", "zbee_zcl_general.multistate_value_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_multistate_value_basic_attr_names),
8436 0x00, NULL, HFILL } },
8438 { &hf_zbee_zcl_multistate_value_basic_reliability,
8439 { "Reliability", "zbee_zcl_general.multistate_value_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names),
8440 0x00, NULL, HFILL } },
8442 /* start Status Flags fields */
8443 { &hf_zbee_zcl_multistate_value_basic_status_flags,
8444 { "Status Flags", "zbee_zcl_general.multistate_value_basic.attr.status", FT_UINT8, BASE_HEX, NULL,
8445 0x00, NULL, HFILL } },
8447 { &hf_zbee_zcl_multistate_value_basic_status_in_alarm,
8448 { "In Alarm Status", "zbee_zcl_general.multistate_value_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL,
8449 ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } },
8451 { &hf_zbee_zcl_multistate_value_basic_status_fault,
8452 { "Fault Status", "zbee_zcl_general.multistate_value_basic.attr.status.fault", FT_BOOLEAN, 8, NULL,
8453 ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } },
8455 { &hf_zbee_zcl_multistate_value_basic_status_overridden,
8456 { "Overridden Status", "zbee_zcl_general.multistate_value_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL,
8457 ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } },
8459 { &hf_zbee_zcl_multistate_value_basic_status_out_of_service,
8460 { "Out of Service Status", "zbee_zcl_general.multistate_value_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL,
8461 ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } },
8462 /* end Status Flags fields */
8464 { &hf_zbee_zcl_multistate_value_basic_priority_array_bool,
8465 { "Valid/Invalid", "zbee_zcl_general.multistate_value_basic.attr.priority_array.bool", FT_UINT8, BASE_HEX, VALS(zbee_zcl_multistate_value_basic_priority_array_bool_values),
8466 0x00, NULL, HFILL } },
8468 { &hf_zbee_zcl_multistate_value_basic_priority_array_sing_prec,
8469 { "Priority Value", "zbee_zcl_general.multistate_value_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL,
8470 0x00, NULL, HFILL } },
8472 { &hf_zbee_zcl_multistate_value_basic_priority_array,
8473 { "Priority Array", "zbee_zcl_general.multistate_value_basic.priority_array", FT_NONE, BASE_NONE, NULL,
8474 0x00, NULL, HFILL } },
8476 { &hf_zbee_zcl_multistate_value_basic_structure,
8477 { "Structure", "zbee_zcl_general.multistate_value_basic.structure", FT_NONE, BASE_NONE, NULL,
8478 0x00, NULL, HFILL } }
8481 /* ZCL Multistate Value Basic subtrees */
8482 static int *ett[] = {
8483 &ett_zbee_zcl_multistate_value_basic,
8484 &ett_zbee_zcl_multistate_value_basic_status_flags,
8485 &ett_zbee_zcl_multistate_value_basic_priority_array,
8486 &ett_zbee_zcl_multistate_value_basic_priority_array_structure
8489 /* Register the ZigBee ZCL Multistate Value Basic cluster protocol name and description */
8490 proto_zbee_zcl_multistate_value_basic = proto_register_protocol("ZigBee ZCL Multistate Value Basic", "ZCL Multistate Value Basic", ZBEE_PROTOABBREV_ZCL_MULTISTATE_VALUE_BASIC);
8491 proto_register_field_array(proto_zbee_zcl_multistate_value_basic, hf, array_length(hf));
8492 proto_register_subtree_array(ett, array_length(ett));
8494 /* Register the ZigBee ZCL Multistate Value Basic dissector. */
8495 register_dissector(ZBEE_PROTOABBREV_ZCL_MULTISTATE_VALUE_BASIC, dissect_zbee_zcl_multistate_value_basic, proto_zbee_zcl_multistate_value_basic);
8496 } /*proto_register_zbee_zcl_multistate_value_basic*/
8498 /*FUNCTION:------------------------------------------------------
8499 * NAME
8500 * proto_reg_handoff_zbee_zcl_multistate_value_basic
8501 * DESCRIPTION
8502 * Hands off the ZCL Multistate Value Basic dissector.
8503 * PARAMETERS
8504 * none
8505 * RETURNS
8506 * none
8507 *---------------------------------------------------------------
8509 void
8510 proto_reg_handoff_zbee_zcl_multistate_value_basic(void)
8512 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_MULTISTATE_VALUE_BASIC,
8513 proto_zbee_zcl_multistate_value_basic,
8514 ett_zbee_zcl_multistate_value_basic,
8515 ZBEE_ZCL_CID_MULTISTATE_VALUE_BASIC,
8516 ZBEE_MFG_CODE_NONE,
8517 hf_zbee_zcl_multistate_value_basic_attr_id,
8518 hf_zbee_zcl_multistate_value_basic_attr_id,
8519 -1, -1,
8520 (zbee_zcl_fn_attr_data)dissect_zcl_multistate_value_basic_attr_data
8522 } /*proto_reg_handoff_zbee_zcl_multistate_value_basic*/
8524 /* ########################################################################## */
8525 /* #### (0x0015) COMMISSIONING CLUSTER ###################################### */
8526 /* ########################################################################## */
8528 /*************************/
8529 /* Defines */
8530 /*************************/
8532 /* Attributes */
8533 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_SHORT_ADDRESS 0x0000 /* Short Address */
8534 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_EXTENDED_PAN_ID 0x0001 /* Extended PAN Id */
8535 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_PAN_ID 0x0002 /* PAN Id */
8536 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_CHANNEL_MASK 0x0003 /* Channel Mask */
8537 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_PROTOCOL_VERSION 0x0004 /* Protocol Version */
8538 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_STACK_PROFILE 0x0005 /* Stack Profile */
8539 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_STARTUP_CONTROL 0x0006 /* Startup Control */
8540 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_ADDRESS 0x0010 /* Trust Center Address */
8541 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_MASTER_KEY 0x0011 /* Trust Center Master Key */
8542 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY 0x0012 /* Network Key */
8543 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_USE_INSECURE_JOIN 0x0013 /* Use Insecure Join */
8544 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_PRECONFIGURED_LINK_KEY 0x0014 /* Preconfigured Link Key */
8545 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_SEQ_NUM 0x0015 /* Network Key Sequence Number */
8546 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_TYPE 0x0016 /* Network Key Type */
8547 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_MANAGER_ADDRESS 0x0017 /* Network Manager Address */
8548 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_SCAN_ATTEMPTS 0x0020 /* Scan Attempts */
8549 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_TIME_BETWEEN_SCANS 0x0021 /* Time Between Scans */
8550 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_REJOIN_INTERVAL 0x0022 /* Rejoin Interval */
8551 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_MAX_REJOIN_INTERVAL 0x0023 /* Max Rejoin Interval */
8552 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_INDIRECT_POLL_RATE 0x0030 /* Indirect Poll Rate */
8553 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_PARENT_RETRY_THRESHOLD 0x0031 /* Parent Retry Threshold */
8554 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_FLAG 0x0040 /* Concentrator Flag */
8555 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_RADIUS 0x0041 /* Concentrator Radius */
8556 #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_DISCOVERY_TIME 0x0042 /* Concentrator Discovery Time */
8558 /* Server Commands Received */
8559 #define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE 0x00 /* Restart Device */
8560 #define ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS 0x01 /* Save Startup Parameters */
8561 #define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS 0x02 /* Restore Startup Parameters */
8562 #define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS 0x03 /* Reset Startup Parameters */
8564 /* Server Commands Generated */
8565 #define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE_RESPONSE 0x00 /* Restart Device Response */
8566 #define ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS_RESPONSE 0x01 /* Save Startup Parameters Response */
8567 #define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS_RESPONSE 0x02 /* Restore Startup Parameters Response */
8568 #define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS_RESPONSE 0x03 /* Reset Startup Parameters Response */
8570 /* Restart Device Options Field Mask Values */
8571 #define ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_STARTUP_MODE 0x07
8572 #define ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_IMMEDIATE 0x08
8573 #define ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_RESERVED 0xF0
8575 /* Reset Startup Parameters Options Field Mask Values */
8576 #define ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESET_CURRENT 0x01
8577 #define ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESET_ALL 0x02
8578 #define ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_ERASE_INDEX 0x04
8579 #define ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESERVED 0xFC
8582 /*************************/
8583 /* Function Declarations */
8584 /*************************/
8586 void proto_register_zbee_zcl_commissioning(void);
8587 void proto_reg_handoff_zbee_zcl_commissioning(void);
8589 /* Command Dissector Helpers */
8590 static void dissect_zcl_commissioning_restart_device (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
8591 static void dissect_zcl_commissioning_save_restore_startup_parameters (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
8592 static void dissect_zcl_commissioning_reset_startup_parameters (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
8593 static void dissect_zcl_commissioning_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
8595 static void dissect_zcl_commissioning_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
8597 /* Private functions prototype */
8599 /*************************/
8600 /* Global Variables */
8601 /*************************/
8602 /* Initialize the protocol and registered fields */
8603 static int proto_zbee_zcl_commissioning;
8605 static int hf_zbee_zcl_commissioning_attr_id;
8606 static int hf_zbee_zcl_commissioning_attr_stack_profile;
8607 static int hf_zbee_zcl_commissioning_attr_startup_control;
8608 static int hf_zbee_zcl_commissioning_restart_device_options;
8609 static int hf_zbee_zcl_commissioning_restart_device_options_startup_mode;
8610 static int hf_zbee_zcl_commissioning_restart_device_options_immediate;
8611 static int hf_zbee_zcl_commissioning_restart_device_options_reserved;
8612 static int hf_zbee_zcl_commissioning_delay;
8613 static int hf_zbee_zcl_commissioning_jitter;
8614 static int hf_zbee_zcl_commissioning_options;
8615 static int hf_zbee_zcl_commissioning_index;
8616 static int hf_zbee_zcl_commissioning_reset_startup_options;
8617 static int hf_zbee_zcl_commissioning_reset_startup_options_reset_current;
8618 static int hf_zbee_zcl_commissioning_reset_startup_options_reset_all;
8619 static int hf_zbee_zcl_commissioning_reset_startup_options_erase_index;
8620 static int hf_zbee_zcl_commissioning_reset_startup_options_reserved;
8621 static int hf_zbee_zcl_commissioning_status;
8622 static int hf_zbee_zcl_commissioning_srv_rx_cmd_id;
8623 static int hf_zbee_zcl_commissioning_srv_tx_cmd_id;
8625 /* Initialize the subtree pointers */
8626 static int ett_zbee_zcl_commissioning;
8627 static int ett_zbee_zcl_commissioning_restart_device_options;
8628 static int ett_zbee_zcl_commissioning_reset_startup_options;
8630 /* Attributes */
8631 static const value_string zbee_zcl_commissioning_attr_names[] = {
8632 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_SHORT_ADDRESS, "Short Address" },
8633 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_EXTENDED_PAN_ID, "Extended PAN Id" },
8634 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_PAN_ID, "PAN Id" },
8635 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_CHANNEL_MASK, "Channel Mask" },
8636 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_PROTOCOL_VERSION, "Protocol Version" },
8637 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_STACK_PROFILE, "Stack Profile" },
8638 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_STARTUP_CONTROL, "Startup Control" },
8639 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_ADDRESS, "Trust Center Address" },
8640 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_MASTER_KEY, "Trust Center Master Key" },
8641 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY, "Network Key" },
8642 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_USE_INSECURE_JOIN, "Use Insecure Join" },
8643 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_PRECONFIGURED_LINK_KEY, "Preconfigured Link Key" },
8644 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_SEQ_NUM, "Network Key Sequence Number" },
8645 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_TYPE, "Network Key Type" },
8646 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_MANAGER_ADDRESS, "Network Manager Address" },
8647 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_SCAN_ATTEMPTS, "Scan Attempts" },
8648 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_TIME_BETWEEN_SCANS, "Time Between Scans" },
8649 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_REJOIN_INTERVAL, "Rejoin Interval" },
8650 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_MAX_REJOIN_INTERVAL, "Max Rejoin Interval" },
8651 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_INDIRECT_POLL_RATE, "Indirect Poll Rate" },
8652 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_PARENT_RETRY_THRESHOLD, "Parent Retry Threshold" },
8653 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_FLAG, "Concentrator Flag" },
8654 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_RADIUS, "Concentrator Radius" },
8655 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_DISCOVERY_TIME, "Concentrator Discovery Time" },
8656 { 0, NULL }
8659 /* Server Commands Received */
8660 static const value_string zbee_zcl_commissioning_srv_rx_cmd_names[] = {
8661 { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE, "Commissioning - Restart Device" },
8662 { ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS, "Commissioning - Save Startup Parameters" },
8663 { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS, "Commissioning - Restore Startup Parameters" },
8664 { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS, "Commissioning - Reset Startup Parameters" },
8665 { 0, NULL }
8668 /* Server Commands Generated */
8669 static const value_string zbee_zcl_commissioning_srv_tx_cmd_names[] = {
8670 { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE_RESPONSE, "Commissioning - Restart Device Response" },
8671 { ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS_RESPONSE, "Commissioning - Save Startup Parameters Response" },
8672 { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS_RESPONSE, "Commissioning - Startup Parameters Response" },
8673 { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS_RESPONSE, "Commissioning - Reset Startup Parameters Response" },
8674 { 0, NULL }
8677 static const value_string zbee_zcl_commissioning_stack_profile_values[] = {
8678 {0x01, "ZigBee Stack Profile"},
8679 {0x02, "ZigBee PRO Stack Profile"},
8680 {0, NULL}
8683 static const value_string zbee_zcl_commissioning_startup_control_values[] = {
8684 {0x00, "Device is part of the network indicated by the Extended PAN Id"},
8685 {0x01, "Device should form a network with the Extended PAN Id"},
8686 {0x02, "Device should rejoin the network with Extended PAN Id"},
8687 {0x03, "Device should join the network using MAC Association"},
8688 {0, NULL}
8691 static const value_string zbee_zcl_commissioning_startup_mode_values[] ={
8692 {0, "Restart Device using current set of startup parameters"},
8693 {1, "Restart Device using current set of stack attributes"},
8694 {0, NULL}
8697 /*************************/
8698 /* Function Bodies */
8699 /*************************/
8701 /*FUNCTION:------------------------------------------------------
8702 * NAME
8703 * dissect_zbee_zcl_commissioning
8704 * DESCRIPTION
8705 * ZigBee ZCL Commissioning cluster dissector for wireshark.
8706 * PARAMETERS
8707 * tvbuff_t *tvb - pointer to buffer containing raw packet.
8708 * packet_info *pinfo - pointer to packet information fields
8709 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
8710 * RETURNS
8711 * none
8712 *---------------------------------------------------------------
8714 static int
8715 dissect_zbee_zcl_commissioning(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
8717 proto_tree *payload_tree;
8718 zbee_zcl_packet *zcl;
8719 unsigned offset = 0;
8720 uint8_t cmd_id;
8721 int rem_len;
8723 /* Reject the packet if data is NULL */
8724 if (data == NULL)
8725 return 0;
8726 zcl = (zbee_zcl_packet *)data;
8727 cmd_id = zcl->cmd_id;
8729 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
8730 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
8731 /* Append the command name to the info column. */
8732 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
8733 val_to_str_const(cmd_id, zbee_zcl_commissioning_srv_rx_cmd_names, "Unknown Command"),
8734 zcl->tran_seqno);
8736 /* Add the command ID. */
8737 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8739 /* Check if this command has a payload, then add the payload tree */
8740 rem_len = tvb_reported_length_remaining(tvb, ++offset);
8741 if (rem_len > 0) {
8742 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_commissioning, NULL, "Payload");
8744 /* Call the appropriate command dissector */
8745 switch (cmd_id) {
8746 case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE:
8747 dissect_zcl_commissioning_restart_device(tvb, payload_tree, &offset);
8748 break;
8750 case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS:
8751 dissect_zcl_commissioning_reset_startup_parameters(tvb, payload_tree, &offset);
8752 break;
8754 case ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS:
8755 case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS:
8756 dissect_zcl_commissioning_save_restore_startup_parameters(tvb, payload_tree, &offset);
8757 break;
8759 default:
8760 break;
8764 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
8765 /* Append the command name to the info column. */
8766 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
8767 val_to_str_const(cmd_id, zbee_zcl_commissioning_srv_tx_cmd_names, "Unknown Command"),
8768 zcl->tran_seqno);
8770 /* Add the command ID. */
8771 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
8773 /* Check if this command has a payload, then add the payload tree */
8774 rem_len = tvb_reported_length_remaining(tvb, ++offset);
8775 if (rem_len > 0) {
8776 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_commissioning, NULL, "Payload");
8778 /* Call the appropriate command dissector */
8779 switch (cmd_id) {
8780 case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE_RESPONSE:
8781 case ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS_RESPONSE:
8782 case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS_RESPONSE:
8783 case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS_RESPONSE:
8784 dissect_zcl_commissioning_response(tvb, payload_tree, &offset);
8785 break;
8787 default:
8788 break;
8793 return tvb_captured_length(tvb);
8794 } /*dissect_zbee_zcl_commissioning*/
8797 /*FUNCTION:------------------------------------------------------
8798 * NAME
8799 * dissect_zcl_commissioning_restart_device
8800 * DESCRIPTION
8801 * this function decodes the Restart Device payload.
8802 * PARAMETERS
8803 * tvb - the tv buffer of the current data_type
8804 * tree - the tree to append this item to
8805 * offset - offset of data in tvb
8806 * RETURNS
8807 * none
8808 *---------------------------------------------------------------
8810 static void
8811 dissect_zcl_commissioning_restart_device(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
8813 static int * const restart_device_mask[] = {
8814 &hf_zbee_zcl_commissioning_restart_device_options_startup_mode,
8815 &hf_zbee_zcl_commissioning_restart_device_options_immediate,
8816 &hf_zbee_zcl_commissioning_restart_device_options_reserved,
8817 NULL
8820 /* Retrieve "Options" field */
8821 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_commissioning_restart_device_options, ett_zbee_zcl_commissioning_restart_device_options, restart_device_mask, ENC_LITTLE_ENDIAN);
8822 *offset += 1;
8824 /* Retrieve "Delay" field */
8825 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_delay, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
8826 *offset += 1;
8828 /* Retrieve "Jitter" field */
8829 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_jitter, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
8830 *offset += 1;
8832 } /*dissect_zcl_commissioning_restart_device*/
8835 /*FUNCTION:------------------------------------------------------
8836 * NAME
8837 * dissect_zcl_commissioning_save_restore_startup_parameters
8838 * DESCRIPTION
8839 * this function decodes the Save and Restore payload.
8840 * PARAMETERS
8841 * tvb - the tv buffer of the current data_type
8842 * tree - the tree to append this item to
8843 * offset - offset of data in tvb
8844 * RETURNS
8845 * none
8846 *---------------------------------------------------------------
8848 static void
8849 dissect_zcl_commissioning_save_restore_startup_parameters(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
8851 /* Retrieve "Options" field */
8852 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_options, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
8853 *offset += 1;
8855 /* Retrieve "Index" field */
8856 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
8857 *offset += 1;
8859 } /*dissect_zcl_commissioning_save_restore_startup_parameters*/
8861 /*FUNCTION:------------------------------------------------------
8862 * NAME
8863 * dissect_zcl_commissioning_reset_startup_parameters
8864 * DESCRIPTION
8865 * this function decodes the Reset Startup Parameters payload.
8866 * PARAMETERS
8867 * tvb - the tv buffer of the current data_type
8868 * tree - the tree to append this item to
8869 * offset - offset of data in tvb
8870 * RETURNS
8871 * none
8872 *---------------------------------------------------------------
8874 static void
8875 dissect_zcl_commissioning_reset_startup_parameters(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
8877 static int * const reset_startup_mask[] = {
8878 &hf_zbee_zcl_commissioning_reset_startup_options_reset_current,
8879 &hf_zbee_zcl_commissioning_reset_startup_options_reset_all,
8880 &hf_zbee_zcl_commissioning_reset_startup_options_erase_index,
8881 &hf_zbee_zcl_commissioning_reset_startup_options_reserved,
8882 NULL
8885 /* Retrieve "Options" field */
8886 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_commissioning_reset_startup_options, ett_zbee_zcl_commissioning_reset_startup_options, reset_startup_mask, ENC_LITTLE_ENDIAN);
8887 *offset += 1;
8889 /* Retrieve "Index" field */
8890 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
8891 *offset += 1;
8893 } /*dissect_zcl_commissioning_reset_startup_parameters*/
8895 /*FUNCTION:------------------------------------------------------
8896 * NAME
8897 * dissect_zcl_commissioning_response
8898 * DESCRIPTION
8899 * this function decodes the Response payload.
8900 * PARAMETERS
8901 * tvb - the tv buffer of the current data_type
8902 * tree - the tree to append this item to
8903 * offset - offset of data in tvb
8904 * RETURNS
8905 * none
8906 *---------------------------------------------------------------
8908 static void
8909 dissect_zcl_commissioning_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
8911 /* Retrieve "Status" field */
8912 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
8913 *offset += 1;
8915 } /*dissect_zcl_commissioning_response*/
8918 /*FUNCTION:------------------------------------------------------
8919 * NAME
8920 * dissect_zcl_commissioning_attr_data
8921 * DESCRIPTION
8922 * this function is called by ZCL foundation dissector in order to decode
8923 * specific cluster attributes data.
8924 * PARAMETERS
8925 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
8926 * tvbuff_t *tvb - pointer to buffer containing raw packet.
8927 * unsigned *offset - pointer to buffer offset
8928 * uint16_t attr_id - attribute identifier
8929 * unsigned data_type - attribute data type
8930 * bool client_attr- ZCL client
8931 * RETURNS
8932 * none
8933 *---------------------------------------------------------------
8935 void
8936 dissect_zcl_commissioning_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
8938 /* Dissect attribute data type and data */
8939 switch ( attr_id ) {
8941 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_STACK_PROFILE:
8942 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_attr_stack_profile, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
8943 *offset += 1;
8944 break;
8946 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_STARTUP_CONTROL:
8947 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_attr_startup_control, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
8948 *offset += 1;
8949 break;
8951 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_SHORT_ADDRESS:
8952 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_EXTENDED_PAN_ID:
8953 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_PAN_ID:
8954 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_CHANNEL_MASK:
8955 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_PROTOCOL_VERSION:
8956 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_ADDRESS:
8957 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_MASTER_KEY:
8958 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY:
8959 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_USE_INSECURE_JOIN:
8960 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_PRECONFIGURED_LINK_KEY:
8961 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_SEQ_NUM:
8962 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_TYPE:
8963 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_MANAGER_ADDRESS:
8964 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_SCAN_ATTEMPTS:
8965 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_TIME_BETWEEN_SCANS:
8966 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_REJOIN_INTERVAL:
8967 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_MAX_REJOIN_INTERVAL:
8968 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_INDIRECT_POLL_RATE:
8969 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_PARENT_RETRY_THRESHOLD:
8970 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_FLAG:
8971 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_RADIUS:
8972 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_DISCOVERY_TIME:
8973 default:
8974 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
8975 break;
8978 } /*dissect_zcl_commissioning_attr_data*/
8981 /*FUNCTION:------------------------------------------------------
8982 * NAME
8983 * proto_register_zbee_zcl_commissioning
8984 * DESCRIPTION
8985 * ZigBee ZCL Commissioning cluster protocol registration routine.
8986 * PARAMETERS
8987 * none
8988 * RETURNS
8989 * void
8990 *---------------------------------------------------------------
8992 void
8993 proto_register_zbee_zcl_commissioning(void)
8995 /* Setup list of header fields */
8996 static hf_register_info hf[] = {
8998 { &hf_zbee_zcl_commissioning_attr_id,
8999 { "Attribute", "zbee_zcl_general.commissioning.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_commissioning_attr_names),
9000 0x00, NULL, HFILL } },
9002 { &hf_zbee_zcl_commissioning_attr_stack_profile,
9003 { "Stack Profile", "zbee_zcl_general.commissioning.attr.stack_profile", FT_UINT8, BASE_HEX, VALS(zbee_zcl_commissioning_stack_profile_values),
9004 0x00, NULL, HFILL } },
9006 { &hf_zbee_zcl_commissioning_attr_startup_control,
9007 { "Startup Control", "zbee_zcl_general.commissioning.attr.startup_control", FT_UINT8, BASE_HEX, VALS(zbee_zcl_commissioning_startup_control_values),
9008 0x00, NULL, HFILL } },
9010 /* start Restart Device Options fields */
9011 { &hf_zbee_zcl_commissioning_restart_device_options,
9012 { "Restart Device Options", "zbee_zcl_general.commissioning.restart_device_options", FT_UINT8, BASE_HEX, NULL,
9013 0x00, NULL, HFILL } },
9015 { &hf_zbee_zcl_commissioning_restart_device_options_startup_mode,
9016 { "Startup Mode", "zbee_zcl_general.commissioning.restart_device_options.startup_mode", FT_UINT8, BASE_HEX, VALS(zbee_zcl_commissioning_startup_mode_values),
9017 ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_STARTUP_MODE, NULL, HFILL } },
9019 { &hf_zbee_zcl_commissioning_restart_device_options_immediate,
9020 { "Immediate", "zbee_zcl_general.commissioning.restart_device_options.immediate", FT_BOOLEAN, 8, NULL,
9021 ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_IMMEDIATE, NULL, HFILL } },
9023 { &hf_zbee_zcl_commissioning_restart_device_options_reserved,
9024 { "Reserved", "zbee_zcl_general.commissioning.restart_device_options.reserved", FT_BOOLEAN, 8, NULL,
9025 ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_RESERVED, NULL, HFILL } },
9026 /* end Restart Device Options fields */
9028 { &hf_zbee_zcl_commissioning_delay,
9029 { "Delay", "zbee_zcl_general.commissioning.delay", FT_UINT8, BASE_DEC, NULL,
9030 0x0, NULL, HFILL } },
9032 { &hf_zbee_zcl_commissioning_jitter,
9033 { "Jitter", "zbee_zcl_general.commissioning.jitter", FT_UINT8, BASE_DEC, NULL,
9034 0x0, NULL, HFILL } },
9036 { &hf_zbee_zcl_commissioning_options,
9037 { "Options (Reserved)", "zbee_zcl_general.commissioning.options", FT_UINT8, BASE_HEX, NULL,
9038 0x0, NULL, HFILL } },
9040 { &hf_zbee_zcl_commissioning_index,
9041 { "Index", "zbee_zcl_general.commissioning.index", FT_UINT8, BASE_DEC, NULL,
9042 0x0, NULL, HFILL } },
9044 /* start Reset Startup Options fields */
9045 { &hf_zbee_zcl_commissioning_reset_startup_options,
9046 { "Reset Startup Options", "zbee_zcl_general.commissioning.reset_startup_options", FT_UINT8, BASE_HEX, NULL,
9047 0x00, NULL, HFILL } },
9049 { &hf_zbee_zcl_commissioning_reset_startup_options_reset_current,
9050 { "Reset Current", "zbee_zcl_general.commissioning.reset_startup_options.current", FT_BOOLEAN, 8, NULL,
9051 ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESET_CURRENT, NULL, HFILL } },
9053 { &hf_zbee_zcl_commissioning_reset_startup_options_reset_all,
9054 { "Reset All", "zbee_zcl_general.commissioning.reset_startup_options.reset_all", FT_BOOLEAN, 8, NULL,
9055 ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESET_ALL, NULL, HFILL } },
9057 { &hf_zbee_zcl_commissioning_reset_startup_options_erase_index,
9058 { "Erase Index", "zbee_zcl_general.commissioning.reset_startup_options.erase_index", FT_BOOLEAN, 8, NULL,
9059 ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_ERASE_INDEX, NULL, HFILL } },
9061 { &hf_zbee_zcl_commissioning_reset_startup_options_reserved,
9062 { "Reserved", "zbee_zcl_general.commissioning.reset_startup_options.reserved", FT_BOOLEAN, 8, NULL,
9063 ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESERVED, NULL, HFILL } },
9064 /* end Reset Startup Options fields */
9066 { &hf_zbee_zcl_commissioning_status,
9067 { "Status", "zbee_zcl_general.commissioning.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names),
9068 0x0, NULL, HFILL } },
9070 { &hf_zbee_zcl_commissioning_srv_rx_cmd_id,
9071 { "Command", "zbee_zcl_general.commissioning.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_commissioning_srv_rx_cmd_names),
9072 0x00, NULL, HFILL } },
9074 { &hf_zbee_zcl_commissioning_srv_tx_cmd_id,
9075 { "Command", "zbee_zcl_general.commissioning.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_commissioning_srv_tx_cmd_names),
9076 0x00, NULL, HFILL } }
9080 /* ZCL Commissioning subtrees */
9081 static int *ett[] = {
9082 &ett_zbee_zcl_commissioning,
9083 &ett_zbee_zcl_commissioning_restart_device_options,
9084 &ett_zbee_zcl_commissioning_reset_startup_options
9087 /* Register the ZigBee ZCL Commissioning cluster protocol name and description */
9088 proto_zbee_zcl_commissioning = proto_register_protocol("ZigBee ZCL Commissioning", "ZCL Commissioning", ZBEE_PROTOABBREV_ZCL_COMMISSIONING);
9089 proto_register_field_array(proto_zbee_zcl_commissioning, hf, array_length(hf));
9090 proto_register_subtree_array(ett, array_length(ett));
9092 /* Register the ZigBee ZCL Commissioning dissector. */
9093 register_dissector(ZBEE_PROTOABBREV_ZCL_COMMISSIONING, dissect_zbee_zcl_commissioning, proto_zbee_zcl_commissioning);
9095 } /*proto_register_zbee_zcl_commissioning*/
9098 /*FUNCTION:------------------------------------------------------
9099 * NAME
9100 * proto_reg_handoff_zbee_zcl_commissioning
9101 * DESCRIPTION
9102 * Hands off the ZCL Commissioning dissector.
9103 * PARAMETERS
9104 * none
9105 * RETURNS
9106 * none
9107 *---------------------------------------------------------------
9109 void
9110 proto_reg_handoff_zbee_zcl_commissioning(void)
9112 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_COMMISSIONING,
9113 proto_zbee_zcl_commissioning,
9114 ett_zbee_zcl_commissioning,
9115 ZBEE_ZCL_CID_COMMISSIONING,
9116 ZBEE_MFG_CODE_NONE,
9117 hf_zbee_zcl_commissioning_attr_id,
9118 hf_zbee_zcl_commissioning_attr_id,
9119 hf_zbee_zcl_commissioning_srv_rx_cmd_id,
9120 hf_zbee_zcl_commissioning_srv_tx_cmd_id,
9121 (zbee_zcl_fn_attr_data)dissect_zcl_commissioning_attr_data
9123 } /*proto_reg_handoff_zbee_zcl_commissioning*/
9126 /* ########################################################################## */
9127 /* #### (0x0016) PARTITION ################################################## */
9128 /* ########################################################################## */
9130 /*************************/
9131 /* Defines */
9132 /*************************/
9134 #define ZBEE_ZCL_PART_NUM_GENERIC_ETT 3
9135 #define ZBEE_ZCL_PART_NUM_NACK_ID_ETT 16
9136 #define ZBEE_ZCL_PART_NUM_ATTRS_ID_ETT 16
9137 #define ZBEE_ZCL_PART_NUM_ETT (ZBEE_ZCL_PART_NUM_GENERIC_ETT + \
9138 ZBEE_ZCL_PART_NUM_NACK_ID_ETT + \
9139 ZBEE_ZCL_PART_NUM_ATTRS_ID_ETT)
9141 #define ZBEE_ZCL_PART_OPT_1_BLOCK 0x01
9142 #define ZBEE_ZCL_PART_OPT_INDIC_LEN 0x02
9143 #define ZBEE_ZCL_PART_OPT_RESERVED 0xc0
9145 #define ZBEE_ZCL_PART_ACK_OPT_NACK_LEN 0x01
9146 #define ZBEE_ZCL_PART_ACK_OPT_RESERVED 0xFE
9148 /* Attributes */
9149 #define ZBEE_ZCL_ATTR_ID_PART_MAX_IN_TRANSF_SIZE 0x0000 /* Maximum Incoming Transfer Size */
9150 #define ZBEE_ZCL_ATTR_ID_PART_MAX_OUT_TRANSF_SIZE 0x0001 /* Maximum Outgoing Transfer Size */
9151 #define ZBEE_ZCL_ATTR_ID_PART_PARTITIONED_FRAME_SIZE 0x0002 /* Partitioned Frame Size */
9152 #define ZBEE_ZCL_ATTR_ID_PART_LARGE_FRAME_SIZE 0x0003 /* Large Frame Size */
9153 #define ZBEE_ZCL_ATTR_ID_PART_ACK_FRAME_NUM 0x0004 /* Number of Ack Frame*/
9154 #define ZBEE_ZCL_ATTR_ID_PART_NACK_TIMEOUT 0x0005 /* Nack Timeout */
9155 #define ZBEE_ZCL_ATTR_ID_PART_INTERFRAME_DELEAY 0x0006 /* Interframe Delay */
9156 #define ZBEE_ZCL_ATTR_ID_PART_SEND_RETRIES_NUM 0x0007 /* Number of Send Retries */
9157 #define ZBEE_ZCL_ATTR_ID_PART_SENDER_TIMEOUT 0x0008 /* Sender Timeout */
9158 #define ZBEE_ZCL_ATTR_ID_PART_RECEIVER_TIMEOUT 0x0009 /* Receiver Timeout */
9160 /* Server Commands Received */
9161 #define ZBEE_ZCL_CMD_ID_PART_TRANSF_PART_FRAME 0x00 /* Transfer Partitioned Frame */
9162 #define ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM 0x01 /* Read Handshake Param */
9163 #define ZBEE_ZCL_CMD_ID_PART_WR_HANDSHAKE_PARAM 0x02 /* Write Handshake Param */
9165 /* Server Commands Generated */
9166 #define ZBEE_ZCL_CMD_ID_PART_MULTI_ACK 0x00 /* Multiple Ack */
9167 #define ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM_RSP 0x01 /* Read Handshake Param Response */
9170 /*************************/
9171 /* Function Declarations */
9172 /*************************/
9174 void proto_register_zbee_zcl_part(void);
9175 void proto_reg_handoff_zbee_zcl_part(void);
9177 /* Command Dissector Helpers */
9178 static void dissect_zcl_part_trasfpartframe (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
9179 static void dissect_zcl_part_rdhandshakeparam (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool direction);
9180 static void dissect_zcl_part_wrhandshakeparam (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool direction);
9181 static void dissect_zcl_part_multiack (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
9182 static void dissect_zcl_part_rdhandshakeparamrsp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool direction);
9184 /* Private functions prototype */
9186 /*************************/
9187 /* Global Variables */
9188 /*************************/
9190 /* Initialize the protocol and registered fields */
9191 static int proto_zbee_zcl_part;
9193 static int hf_zbee_zcl_part_attr_id;
9194 static int hf_zbee_zcl_part_srv_tx_cmd_id;
9195 static int hf_zbee_zcl_part_srv_rx_cmd_id;
9196 static int hf_zbee_zcl_part_opt;
9197 static int hf_zbee_zcl_part_opt_first_block;
9198 static int hf_zbee_zcl_part_opt_indic_len;
9199 static int hf_zbee_zcl_part_opt_res;
9200 static int hf_zbee_zcl_part_first_frame_id;
9201 static int hf_zbee_zcl_part_part_indicator;
9202 static int hf_zbee_zcl_part_part_frame;
9203 static int hf_zbee_zcl_part_partitioned_cluster_id;
9204 static int hf_zbee_zcl_part_ack_opt;
9205 static int hf_zbee_zcl_part_ack_opt_nack_id_len;
9206 static int hf_zbee_zcl_part_ack_opt_res;
9207 static int hf_zbee_zcl_part_nack_id;
9209 /* Initialize the subtree pointers */
9210 static int ett_zbee_zcl_part;
9211 static int ett_zbee_zcl_part_fragm_options;
9212 static int ett_zbee_zcl_part_ack_opts;
9213 static int ett_zbee_zcl_part_nack_id_list[ZBEE_ZCL_PART_NUM_NACK_ID_ETT];
9214 static int ett_zbee_zcl_part_attrs_id_list[ZBEE_ZCL_PART_NUM_ATTRS_ID_ETT];
9216 /* Attributes */
9217 static const value_string zbee_zcl_part_attr_names[] = {
9218 { ZBEE_ZCL_ATTR_ID_PART_MAX_IN_TRANSF_SIZE, "Maximum Incoming Transfer Size" },
9219 { ZBEE_ZCL_ATTR_ID_PART_MAX_OUT_TRANSF_SIZE, "Maximum Outgoing Transfer Size" },
9220 { ZBEE_ZCL_ATTR_ID_PART_PARTITIONED_FRAME_SIZE, "Partitioned Frame Size" },
9221 { ZBEE_ZCL_ATTR_ID_PART_LARGE_FRAME_SIZE, "Large Frame Size" },
9222 { ZBEE_ZCL_ATTR_ID_PART_ACK_FRAME_NUM, "Number of Ack Frame" },
9223 { ZBEE_ZCL_ATTR_ID_PART_NACK_TIMEOUT, "Nack Timeout" },
9224 { ZBEE_ZCL_ATTR_ID_PART_INTERFRAME_DELEAY, "Interframe Delay" },
9225 { ZBEE_ZCL_ATTR_ID_PART_SEND_RETRIES_NUM, "Number of Send Retries" },
9226 { ZBEE_ZCL_ATTR_ID_PART_SENDER_TIMEOUT, "Sender Timeout" },
9227 { ZBEE_ZCL_ATTR_ID_PART_RECEIVER_TIMEOUT, "Receiver Timeout" },
9228 { 0, NULL }
9231 /* Server Commands Received */
9232 static const value_string zbee_zcl_part_srv_rx_cmd_names[] = {
9233 { ZBEE_ZCL_CMD_ID_PART_TRANSF_PART_FRAME, "Transfer Partitioned Frame" },
9234 { ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM, "Read Handshake Param" },
9235 { ZBEE_ZCL_CMD_ID_PART_WR_HANDSHAKE_PARAM, "Write Handshake Param" },
9236 { 0, NULL }
9239 /* Server Commands Generated */
9240 static const value_string zbee_zcl_part_srv_tx_cmd_names[] = {
9241 { ZBEE_ZCL_CMD_ID_PART_MULTI_ACK, "Multiple Ack" },
9242 { ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM_RSP, "Read Handshake Param Response" },
9243 { 0, NULL }
9246 /* ID Length */
9247 static const value_string zbee_zcl_part_id_length_names[] = {
9248 { 0, "1-Byte length" },
9249 { 1, "2-Bytes length" },
9250 { 0, NULL }
9253 /*************************/
9254 /* Function Bodies */
9255 /*************************/
9257 /*FUNCTION:------------------------------------------------------
9258 * NAME
9259 * dissect_zbee_zcl_part
9260 * DESCRIPTION
9261 * ZigBee ZCL Partition cluster dissector for wireshark.
9262 * PARAMETERS
9263 * tvbuff_t *tvb - pointer to buffer containing raw packet.
9264 * packet_info *pinfo - pointer to packet information fields
9265 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
9266 * void *data - pointer to ZCL packet structure.
9267 * RETURNS
9268 * int - length of parsed data.
9269 *---------------------------------------------------------------
9271 static int
9272 dissect_zbee_zcl_part(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
9274 proto_tree *payload_tree;
9275 zbee_zcl_packet *zcl;
9276 unsigned offset = 0;
9277 uint8_t cmd_id;
9278 int rem_len;
9280 /* Reject the packet if data is NULL */
9281 if (data == NULL)
9282 return 0;
9283 zcl = (zbee_zcl_packet *)data;
9284 cmd_id = zcl->cmd_id;
9286 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
9287 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
9288 /* Append the command name to the info column. */
9289 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
9290 val_to_str_const(cmd_id, zbee_zcl_part_srv_rx_cmd_names, "Unknown Command"),
9291 zcl->tran_seqno);
9293 /* Add the command ID. */
9294 proto_tree_add_item(tree, hf_zbee_zcl_part_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9296 /* Check is this command has a payload, than add the payload tree */
9297 rem_len = tvb_reported_length_remaining(tvb, ++offset);
9298 if (rem_len > 0) {
9299 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_part, NULL, "Payload");
9301 /* Call the appropriate command dissector */
9302 switch (cmd_id) {
9303 case ZBEE_ZCL_CMD_ID_PART_TRANSF_PART_FRAME:
9304 dissect_zcl_part_trasfpartframe(tvb, payload_tree, &offset);
9305 break;
9307 case ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM:
9308 dissect_zcl_part_rdhandshakeparam(tvb, pinfo, payload_tree, &offset, zcl->direction);
9309 break;
9311 case ZBEE_ZCL_CMD_ID_PART_WR_HANDSHAKE_PARAM:
9312 dissect_zcl_part_wrhandshakeparam(tvb, pinfo, payload_tree, &offset, zcl->direction);
9313 break;
9315 default:
9316 break;
9320 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
9321 /* Append the command name to the info column. */
9322 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
9323 val_to_str_const(cmd_id, zbee_zcl_part_srv_tx_cmd_names, "Unknown Command"),
9324 zcl->tran_seqno);
9326 /* Add the command ID. */
9327 proto_tree_add_item(tree, hf_zbee_zcl_part_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
9329 /* Check is this command has a payload, than add the payload tree */
9330 rem_len = tvb_reported_length_remaining(tvb, ++offset);
9331 if (rem_len > 0) {
9332 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_part, NULL, "Payload");
9334 /* Call the appropriate command dissector */
9335 switch (cmd_id) {
9336 case ZBEE_ZCL_CMD_ID_PART_MULTI_ACK:
9337 dissect_zcl_part_multiack(tvb, payload_tree, &offset);
9338 break;
9340 case ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM_RSP:
9341 dissect_zcl_part_rdhandshakeparamrsp(tvb, pinfo, payload_tree, &offset, zcl->direction);
9342 break;
9344 default:
9345 break;
9350 return tvb_captured_length(tvb);
9351 } /*dissect_zbee_zcl_part*/
9353 /*FUNCTION:------------------------------------------------------
9354 * NAME
9355 * dissect_zcl_part_trasfpartframe
9356 * DESCRIPTION
9357 * This function manages the Transfer Partition Frame payload
9358 * PARAMETERS
9359 * tvbuff_t *tvb - pointer to buffer containing raw packet.
9360 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
9361 * offset - pointer of buffer offset
9362 * RETURNS
9363 * none
9364 *---------------------------------------------------------------
9366 static void dissect_zcl_part_trasfpartframe(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
9369 uint8_t options;
9370 int frame_len;
9372 static int * const part_opt[] = {
9373 &hf_zbee_zcl_part_opt_first_block,
9374 &hf_zbee_zcl_part_opt_indic_len,
9375 &hf_zbee_zcl_part_opt_res,
9376 NULL
9379 /* Retrieve "Fragmentation Options" field */
9380 options = tvb_get_uint8(tvb, *offset);
9381 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_part_opt, ett_zbee_zcl_part_fragm_options, part_opt, ENC_NA);
9382 *offset += 1;
9384 /* Retrieve "PartitionIndicator" field */
9385 if ((options & ZBEE_ZCL_PART_OPT_INDIC_LEN) == 0)
9387 /* 1-byte length */
9388 proto_tree_add_item(tree, hf_zbee_zcl_part_part_indicator, tvb, *offset, 1, ENC_NA);
9389 *offset += 1;
9391 else {
9392 /* 2-bytes length */
9393 proto_tree_add_item(tree, hf_zbee_zcl_part_part_indicator, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
9394 *offset += 2;
9397 /* Retrieve "PartitionedFrame" field */
9398 proto_tree_add_item_ret_length(tree, hf_zbee_zcl_part_part_frame, tvb, *offset, 1, ENC_NA|ENC_ZIGBEE, &frame_len);
9399 *offset += frame_len;
9401 } /*dissect_zcl_part_trasfpartframe*/
9403 /*FUNCTION:------------------------------------------------------
9404 * NAME
9405 * dissect_zcl_part_rdhandshakeparam
9406 * DESCRIPTION
9407 * This function manages the ReadHandshakeParam payload
9408 * PARAMETERS
9409 * tvbuff_t *tvb - pointer to buffer containing raw packet.
9410 * packet_info *pinfo - pointer to packet information fields
9411 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
9412 * offset - offset
9413 * direction - ZCL direction
9414 * RETURNS
9415 * none
9416 *---------------------------------------------------------------
9418 static void
9419 dissect_zcl_part_rdhandshakeparam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool direction)
9421 /* Retrieve "Partitioned Cluster ID" field */
9422 proto_tree_add_item(tree, hf_zbee_zcl_part_partitioned_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
9423 *offset += 2;
9425 /* Dissect the attribute id list */
9426 dissect_zcl_read_attr(tvb, pinfo, tree, offset, ZBEE_ZCL_CID_PARTITION, ZBEE_MFG_CODE_NONE, direction);
9427 } /*dissect_zcl_part_rdhandshakeparam*/
9429 /*FUNCTION:------------------------------------------------------
9430 * NAME
9431 * dissect_zcl_part_wrhandshakeparam
9432 * DESCRIPTION
9433 * This function manages the WriteAndShakeParam payload
9434 * PARAMETERS
9435 * tvbuff_t *tvb - pointer to buffer containing raw packet.
9436 * packet_info *pinfo - pointer to packet information fields
9437 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
9438 * offset - offset
9439 * direction - ZCL direction
9440 * RETURNS
9441 * none
9442 *---------------------------------------------------------------
9444 static void
9445 dissect_zcl_part_wrhandshakeparam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool direction)
9447 /* Retrieve "Partitioned Cluster ID" field */
9448 proto_tree_add_item(tree, hf_zbee_zcl_part_partitioned_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
9449 *offset += 2;
9451 /* Dissect the attributes list */
9452 dissect_zcl_write_attr(tvb, pinfo, tree, offset, ZBEE_ZCL_CID_PARTITION, ZBEE_MFG_CODE_NONE, direction);
9454 } /*dissect_zcl_part_wrhandshakeparam*/
9457 /* Management of Cluster specific commands sent by the server */
9459 /*FUNCTION:------------------------------------------------------
9460 * NAME
9461 * dissect_zcl_part_multiack
9462 * DESCRIPTION
9463 * This function manages the MultipleACK payload
9464 * PARAMETERS
9465 * tvbuff_t *tvb - pointer to buffer containing raw packet.
9466 * packet_info *pinfo, -
9467 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
9468 * offset - offset
9469 * RETURNS
9470 * none
9471 *---------------------------------------------------------------
9473 static void
9474 dissect_zcl_part_multiack(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
9476 unsigned tvb_len = tvb_reported_length(tvb);
9477 unsigned i = 0;
9478 uint8_t options;
9480 static int * const ack_opts[] = {
9481 &hf_zbee_zcl_part_ack_opt_nack_id_len,
9482 &hf_zbee_zcl_part_ack_opt_res,
9483 NULL
9486 /* Retrieve "Ack Options" field */
9487 options = tvb_get_uint8(tvb, *offset);
9488 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_part_ack_opt, ett_zbee_zcl_part_ack_opts, ack_opts, ENC_NA);
9489 *offset += 1;
9491 /* Retrieve "First Frame ID" field */
9492 if ((options & ZBEE_ZCL_PART_ACK_OPT_NACK_LEN) == 0)
9494 /* 1-byte length */
9495 proto_tree_add_item(tree, hf_zbee_zcl_part_first_frame_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
9496 *offset += 1;
9498 else {
9499 /* 2-bytes length */
9500 proto_tree_add_item(tree, hf_zbee_zcl_part_first_frame_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
9501 *offset += 2;
9504 /* Dissect the nack id list */
9505 while ( *offset < tvb_len && i < ZBEE_ZCL_PART_NUM_NACK_ID_ETT )
9507 if ((options & ZBEE_ZCL_PART_ACK_OPT_NACK_LEN) == 0)
9509 /* 1-byte length */
9510 proto_tree_add_item(tree, hf_zbee_zcl_part_nack_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
9511 *offset += 1;
9513 else {
9514 /* 2-bytes length */
9515 proto_tree_add_item(tree, hf_zbee_zcl_part_nack_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
9516 *offset += 2;
9519 i++;
9521 } /*dissect_zcl_part_multiack*/
9523 /*FUNCTION:------------------------------------------------------
9524 * NAME
9525 * dissect_zcl_part_rdhandshakeparamrsp
9526 * DESCRIPTION
9527 * This function manages the ReadHandshakeParamResponse payload
9528 * PARAMETERS
9529 * tvbuff_t *tvb - pointer to buffer containing raw packet.
9530 * packet_info *pinfo - pointer to packet information fields
9531 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
9532 * offset - offset
9533 * direction - ZCL direction
9534 * RETURNS
9535 * none
9536 *---------------------------------------------------------------
9538 static void
9539 dissect_zcl_part_rdhandshakeparamrsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool direction)
9541 /* Retrieve "Partitioned Cluster ID" field */
9542 proto_tree_add_item(tree, hf_zbee_zcl_part_partitioned_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
9543 *offset += 2;
9545 /* Dissect the attributes list */
9546 dissect_zcl_read_attr_resp(tvb, pinfo, tree, offset, ZBEE_ZCL_CID_PARTITION, ZBEE_MFG_CODE_NONE, direction);
9547 } /*dissect_zcl_part_rdhandshakeparamrsp*/
9550 /*FUNCTION:------------------------------------------------------
9551 * NAME
9552 * proto_register_zbee_zcl_part
9553 * DESCRIPTION
9554 * this function is called by ZCL foundation dissector in order to decode
9555 * specific cluster attributes data.
9556 * PARAMETERS
9557 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
9558 * tvbuff_t *tvb - pointer to buffer containing raw packet.
9559 * unsigned *offset - pointer to buffer offset
9560 * uint16_t attr_id - attribute identifier
9561 * unsigned data_type - attribute data type
9562 * RETURNS
9563 * none
9564 *---------------------------------------------------------------
9566 void proto_register_zbee_zcl_part(void)
9568 uint8_t i, j;
9570 static hf_register_info hf[] = {
9572 { &hf_zbee_zcl_part_attr_id,
9573 { "Attribute", "zbee_zcl_general.part.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_part_attr_names),
9574 0x0, NULL, HFILL } },
9576 { &hf_zbee_zcl_part_srv_tx_cmd_id,
9577 { "Command", "zbee_zcl_general.part.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_part_srv_tx_cmd_names),
9578 0x0, NULL, HFILL } },
9580 { &hf_zbee_zcl_part_srv_rx_cmd_id,
9581 { "Command", "zbee_zcl_general.part.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_part_srv_rx_cmd_names),
9582 0x0, NULL, HFILL } },
9584 { &hf_zbee_zcl_part_opt,
9585 { "Fragmentation Options", "zbee_zcl_general.part.opt", FT_UINT8, BASE_HEX,
9586 NULL, 0x0, NULL, HFILL }},
9588 { &hf_zbee_zcl_part_opt_first_block,
9589 { "First Block", "zbee_zcl_general.part.opt.first_block", FT_UINT8, BASE_HEX, NULL,
9590 ZBEE_ZCL_PART_OPT_1_BLOCK, NULL, HFILL } },
9592 { &hf_zbee_zcl_part_opt_indic_len,
9593 { "Indicator length", "zbee_zcl_general.part.opt.indic_len", FT_UINT8, BASE_DEC, VALS(zbee_zcl_part_id_length_names),
9594 ZBEE_ZCL_PART_OPT_INDIC_LEN, NULL, HFILL } },
9596 { &hf_zbee_zcl_part_opt_res,
9597 { "Reserved", "zbee_zcl_general.part.opt.res", FT_UINT8, BASE_HEX, NULL,
9598 ZBEE_ZCL_PART_OPT_RESERVED, NULL, HFILL } },
9600 { &hf_zbee_zcl_part_first_frame_id,
9601 { "First Frame ID", "zbee_zcl_general.part.first_frame_id", FT_UINT16, BASE_DEC, NULL,
9602 0x00, NULL, HFILL } },
9604 { &hf_zbee_zcl_part_part_indicator,
9605 { "Partition Indicator", "zbee_zcl_general.part.part_indicator", FT_UINT16, BASE_DEC, NULL,
9606 0x00, NULL, HFILL } },
9608 { &hf_zbee_zcl_part_part_frame,
9609 { "Partition Frame", "zbee_zcl_general.part.part_frame", FT_UINT_BYTES, SEP_COLON, NULL,
9610 0x00, NULL, HFILL } },
9612 { &hf_zbee_zcl_part_partitioned_cluster_id,
9613 { "Partitioned Cluster ID", "zbee_zcl_general.part.part_cluster_id", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_aps_cid_names),
9614 0x00, NULL, HFILL } },
9616 { &hf_zbee_zcl_part_ack_opt,
9617 { "Ack Options", "zbee_zcl_general.ack_opt.part", FT_UINT8, BASE_HEX,
9618 NULL, 0x0, NULL, HFILL }},
9620 { &hf_zbee_zcl_part_ack_opt_nack_id_len,
9621 { "Nack Id Length", "zbee_zcl_general.ack_opt.part.nack_id.len", FT_UINT8, BASE_HEX, VALS(zbee_zcl_part_id_length_names),
9622 ZBEE_ZCL_PART_ACK_OPT_NACK_LEN, NULL, HFILL } },
9624 { &hf_zbee_zcl_part_ack_opt_res,
9625 { "Reserved", "zbee_zcl_general.part.ack_opt.reserved", FT_UINT8, BASE_HEX, NULL,
9626 ZBEE_ZCL_PART_ACK_OPT_RESERVED, NULL, HFILL } },
9628 { &hf_zbee_zcl_part_nack_id,
9629 { "Nack Id", "zbee_zcl_general.part.nack_id", FT_UINT16, BASE_DEC, NULL,
9630 0x0, NULL, HFILL } }
9634 /* ZCL Partition subtrees */
9635 int *ett[ZBEE_ZCL_PART_NUM_ETT] = {
9636 &ett_zbee_zcl_part,
9637 &ett_zbee_zcl_part_fragm_options,
9638 &ett_zbee_zcl_part_ack_opts
9641 /* initialize attribute subtree types */
9642 for ( i = 0, j = ZBEE_ZCL_PART_NUM_GENERIC_ETT; i < ZBEE_ZCL_PART_NUM_NACK_ID_ETT; i++, j++) {
9643 ett[j] = &ett_zbee_zcl_part_nack_id_list[i];
9646 for ( i = 0; i < ZBEE_ZCL_PART_NUM_ATTRS_ID_ETT; i++, j++) {
9647 ett[j] = &ett_zbee_zcl_part_attrs_id_list[i];
9650 /* Register ZigBee ZCL Partition protocol with Wireshark. */
9651 proto_zbee_zcl_part = proto_register_protocol("ZigBee ZCL Partition", "ZCL Partition", ZBEE_PROTOABBREV_ZCL_PART);
9652 proto_register_field_array(proto_zbee_zcl_part, hf, array_length(hf));
9653 proto_register_subtree_array(ett, array_length(ett));
9655 /* Register the ZigBee ZCL Partition dissector. */
9656 register_dissector(ZBEE_PROTOABBREV_ZCL_PART, dissect_zbee_zcl_part, proto_zbee_zcl_part);
9657 } /* proto_register_zbee_zcl_part */
9660 /*FUNCTION:------------------------------------------------------
9661 * NAME
9662 * proto_reg_handoff_zbee_zcl_part
9663 * DESCRIPTION
9664 * Registers the zigbee ZCL Partition cluster dissector with Wireshark.
9665 * PARAMETERS
9666 * none
9667 * RETURNS
9668 * void
9669 *---------------------------------------------------------------
9671 void proto_reg_handoff_zbee_zcl_part(void)
9673 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_PART,
9674 proto_zbee_zcl_part,
9675 ett_zbee_zcl_part,
9676 ZBEE_ZCL_CID_PARTITION,
9677 ZBEE_MFG_CODE_NONE,
9678 hf_zbee_zcl_part_attr_id,
9679 hf_zbee_zcl_part_attr_id,
9680 hf_zbee_zcl_part_srv_rx_cmd_id,
9681 hf_zbee_zcl_part_srv_tx_cmd_id,
9682 NULL
9685 } /*proto_reg_handoff_zbee_zcl_part*/
9687 /* ########################################################################## */
9688 /* #### (0x0019) OTA UPGRADE CLUSTER ######################################## */
9689 /* ########################################################################## */
9691 /*************************/
9692 /* Defines */
9693 /*************************/
9695 /* Attributes */
9696 #define ZBEE_ZCL_ATTR_ID_OTA_UPGRADE_SERVER_ID 0x0000 /* Upgrade Server ID */
9697 #define ZBEE_ZCL_ATTR_ID_OTA_FILE_OFFSET 0x0001 /* File Offset */
9698 #define ZBEE_ZCL_ATTR_ID_OTA_CURRENT_FILE_VERSION 0x0002 /* Current File Version */
9699 #define ZBEE_ZCL_ATTR_ID_OTA_CURRENT_ZB_STACK_VERSION 0x0003 /* Current ZigBee Stack Version */
9700 #define ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_FILE_VERSION 0x0004 /* Downloaded File Version */
9701 #define ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_ZB_STACK_VERSION 0x0005 /* Downloaded ZigBee Stack Version */
9702 #define ZBEE_ZCL_ATTR_ID_OTA_IMAGE_UPGRADE_STATUS 0x0006 /* Image Upgrade Status */
9703 #define ZBEE_ZCL_ATTR_ID_OTA_MANUFACTURER_ID 0x0007 /* Manufacturer ID */
9704 #define ZBEE_ZCL_ATTR_ID_OTA_IMAGE_TYPE_ID 0x0008 /* Image Type ID */
9705 #define ZBEE_ZCL_ATTR_ID_OTA_MIN_BLOCK_REQ_DELAY 0x0009 /* Minimum Block Request Delay */
9707 /* Server Commands Generated */
9708 #define ZBEE_ZCL_CMD_ID_OTA_IMAGE_NOTIFY 0x00 /* Image Notify */
9709 #define ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_RSP 0x02 /* Query Next Image Response */
9710 #define ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_RSP 0x05 /* Image Block Response */
9711 #define ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_RSP 0x07 /* Upgrade End Response */
9712 #define ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_RSP 0x09 /* Query Specific File Response */
9714 /* Server Commands Received */
9715 #define ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_REQ 0x01 /* Query Next Image Request */
9716 #define ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_REQ 0x03 /* Image Block Request */
9717 #define ZBEE_ZCL_CMD_ID_OTA_IMAGE_PAGE_REQ 0x04 /* Image Page Request */
9718 #define ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_REQ 0x06 /* Upgrade End Request */
9719 #define ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_REQ 0x08 /* Query Specific File Request */
9721 /* Payload Type */
9722 #define ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ 0x00 /* Query Jitter */
9723 #define ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC 0x01 /* Query Jitter and Manufacturer Code */
9724 #define ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT 0x02 /* Query Jitter, Manufacturer Code and Image Type */
9725 #define ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT_FV 0x03 /* Query Jitter, Manufacturer Code, Image Type and File Version */
9727 /* Image Type */
9728 #define ZBEE_ZCL_OTA_IMG_TYPE_MFR_LOW 0x0000 /* Manufacturer Specific (Low value) */
9729 #define ZBEE_ZCL_OTA_IMG_TYPE_MFR_HIGH 0xffbf /* Manufacturer Specific (High value) */
9730 #define ZBEE_ZCL_OTA_IMG_TYPE_SECURITY 0xffc0 /* Security Credential */
9731 #define ZBEE_ZCL_OTA_IMG_TYPE_CONFIG 0xffc1 /* Configuration */
9732 #define ZBEE_ZCL_OTA_IMG_TYPE_LOG 0xffc2 /* Log */
9733 #define ZBEE_ZCL_OTA_IMG_TYPE_UNASSIGNED_LOW 0xffc3 /* Reserved: Unassigned (Low value) */
9734 #define ZBEE_ZCL_OTA_IMG_TYPE_UNASSIGNED_HIGH 0xfffe /* Reserved: Unassigned (High value) */
9735 #define ZBEE_ZCL_OTA_IMG_TYPE_WILD_CARD 0xffff /* Reserved: Wild Card */
9737 /* ZigBee Stack Version */
9738 #define ZBEE_ZCL_OTA_ZB_STACK_VER_2006 0x0000 /* ZigBee 2006 */
9739 #define ZBEE_ZCL_OTA_ZB_STACK_VER_2007 0x0001 /* ZigBee 2007 */
9740 #define ZBEE_ZCL_OTA_ZB_STACK_VER_PRO 0x0002 /* ZigBee Pro */
9741 #define ZBEE_ZCL_OTA_ZB_STACK_VER_IP 0x0003 /* ZigBee IP */
9742 #define ZBEE_ZCL_OTA_ZB_STACK_VER_RESERVED_LO 0x0004 /* Reserved Low */
9743 #define ZBEE_ZCL_OTA_ZB_STACK_VER_RESERVED_HI 0xffff /* Reserved High */
9745 /* Image Upgrade Status */
9746 #define ZBEE_ZCL_OTA_STATUS_NORMAL 0x00 /* Normal */
9747 #define ZBEE_ZCL_OTA_STATUS_DOWNLOAD_IN_PROGRESS 0x01 /* Download in progress */
9748 #define ZBEE_ZCL_OTA_STATUS_DOWNLOAD_COMPLETE 0x02 /* Download complete */
9749 #define ZBEE_ZCL_OTA_STATUS_WAITING_TO_UPGRADE 0x03 /* Waiting to upgrade */
9750 #define ZBEE_ZCL_OTA_STATUS_COUNT_DOWN 0x04 /* Count down */
9751 #define ZBEE_ZCL_OTA_STATUS_WAIT_FOR_MORE 0x05 /* Wait for more */
9752 /* 0x06-0xff - Reserved */
9753 /* File Version mask */
9754 #define ZBEE_ZCL_OTA_FILE_VERS_APPL_RELEASE 0xFF000000 /* Application Release */
9755 #define ZBEE_ZCL_OTA_FILE_VERS_APPL_BUILD 0x00FF0000 /* Application Build */
9756 #define ZBEE_ZCL_OTA_FILE_VERS_STACK_RELEASE 0x0000FF00 /* Stack Release */
9757 #define ZBEE_ZCL_OTA_FILE_VERS_STACK_BUILD 0x000000FF /* Stack Build */
9759 /* Field Control bitmask field list for Query Next Image Request */
9760 #define ZBEE_ZCL_OTA_QUERY_NEXT_IMAGE_REQ_FIELD_CTRL_HW_VER_PRESENT 0x01 /* bit 0 */
9761 #define ZBEE_ZCL_OTA_QUERY_NEXT_IMAGE_REQ_FIELD_CTRL_RESERVED 0xfe /* bit 1-7 */
9763 /* Field Control bitmask field list for Image Block Request */
9764 #define ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT 0x01 /* bit 0 - Request node IEEE address Present */
9765 #define ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_MIN_BLOCK_PERIOD_PRESENT 0x02 /* bit 1 - Minimum block period Present */
9766 #define ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_RESERVED 0xfc /* bit 2-7 */
9768 /* Field Control bitmask field list for Image Page Request */
9769 #define ZBEE_ZCL_OTA_IMAGE_PAGE_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT 0x01 /* bit 0 - Request node IEEE address Present */
9770 #define ZBEE_ZCL_OTA_IMAGE_PAGE_REQ_FIELD_CTRL_RESERVED 0xfe /* bit 1-7 */
9772 /* OTA Time */
9773 #define ZBEE_ZCL_OTA_TIME_NOW 0x00000000 /* Now */
9774 #define ZBEE_ZCL_OTA_TIME_UTC_LO 0x00000001 /* UTC Low Boundary */
9775 #define ZBEE_ZCL_OTA_TIME_UTC_HI 0xfffffffe /* UTC High Boundary */
9776 #define ZBEE_ZCL_OTA_TIME_WAIT 0xffffffff /* Wait for a Upgrade command (not used for RequestTime) */
9778 /*************************/
9779 /* Function Declarations */
9780 /*************************/
9782 void proto_register_zbee_zcl_ota(void);
9783 void proto_reg_handoff_zbee_zcl_ota(void);
9785 /*************************/
9786 /* Global Variables */
9787 /*************************/
9788 /* Initialize the protocol and registered fields */
9789 static int proto_zbee_zcl_ota;
9791 static int hf_zbee_zcl_ota_attr_id;
9792 static int hf_zbee_zcl_ota_srv_tx_cmd_id;
9793 static int hf_zbee_zcl_ota_srv_rx_cmd_id;
9794 static int hf_zbee_zcl_ota_image_upgrade_status;
9795 static int hf_zbee_zcl_ota_zb_stack_ver;
9796 static int hf_zbee_zcl_ota_file_offset;
9797 static int hf_zbee_zcl_ota_payload_type;
9798 static int hf_zbee_zcl_ota_query_jitter;
9799 static int hf_zbee_zcl_ota_manufacturer_code;
9800 static int hf_zbee_zcl_ota_image_type;
9801 static int hf_zbee_zcl_ota_file_version;
9802 static int hf_zbee_zcl_ota_file_version_appl_release;
9803 static int hf_zbee_zcl_ota_file_version_appl_build;
9804 static int hf_zbee_zcl_ota_file_version_stack_release;
9805 static int hf_zbee_zcl_ota_file_version_stack_build;
9806 static int hf_zbee_zcl_ota_query_next_image_req_field_ctrl;
9807 static int hf_zbee_zcl_ota_query_next_image_req_field_ctrl_hw_ver_present;
9808 static int hf_zbee_zcl_ota_query_next_image_req_field_ctrl_reserved;
9809 static int hf_zbee_zcl_ota_image_block_req_field_ctrl;
9810 static int hf_zbee_zcl_ota_image_block_req_field_ctrl_ieee_addr_present;
9811 static int hf_zbee_zcl_ota_image_block_req_field_ctrl_min_block_period_present;
9812 static int hf_zbee_zcl_ota_image_block_req_field_ctrl_reserved;
9813 static int hf_zbee_zcl_ota_image_page_req_field_ctrl;
9814 static int hf_zbee_zcl_ota_image_page_req_field_ctrl_ieee_addr_present;
9815 static int hf_zbee_zcl_ota_image_page_req_field_ctrl_reserved;
9816 static int hf_zbee_zcl_ota_hw_version;
9817 static int hf_zbee_zcl_ota_status;
9818 static int hf_zbee_zcl_ota_image_size;
9819 static int hf_zbee_zcl_ota_max_data_size;
9820 static int hf_zbee_zcl_ota_min_block_period;
9821 static int hf_zbee_zcl_ota_req_node_addr;
9822 static int hf_zbee_zcl_ota_current_time;
9823 static int hf_zbee_zcl_ota_request_time;
9824 static int hf_zbee_zcl_ota_upgrade_time;
9825 static int hf_zbee_zcl_ota_upgrade_time_utc;
9826 static int hf_zbee_zcl_ota_data_size;
9827 static int hf_zbee_zcl_ota_image_data;
9828 static int hf_zbee_zcl_ota_page_size;
9829 static int hf_zbee_zcl_ota_rsp_spacing;
9831 /* Initialize the subtree pointers */
9832 static int ett_zbee_zcl_ota;
9833 static int ett_zbee_zcl_ota_query_next_image_req_field_ctrl;
9834 static int ett_zbee_zcl_ota_image_block_req_field_ctrl;
9835 static int ett_zbee_zcl_ota_image_page_req_field_ctrl;
9836 static int ett_zbee_zcl_ota_file_version;
9838 /* Attributes */
9839 static const value_string zbee_zcl_ota_attr_names[] = {
9840 { ZBEE_ZCL_ATTR_ID_OTA_UPGRADE_SERVER_ID, "Upgrade Server ID" },
9841 { ZBEE_ZCL_ATTR_ID_OTA_FILE_OFFSET, "File Offset" },
9842 { ZBEE_ZCL_ATTR_ID_OTA_CURRENT_FILE_VERSION, "Current File Version" },
9843 { ZBEE_ZCL_ATTR_ID_OTA_CURRENT_ZB_STACK_VERSION, "Current ZigBee Stack Version" },
9844 { ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_FILE_VERSION, "Downloaded File Version" },
9845 { ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_ZB_STACK_VERSION, "Downloaded ZigBee Stack Version" },
9846 { ZBEE_ZCL_ATTR_ID_OTA_IMAGE_UPGRADE_STATUS, "Image Upgrade Status" },
9847 { ZBEE_ZCL_ATTR_ID_OTA_MANUFACTURER_ID, "Manufacturer ID" },
9848 { ZBEE_ZCL_ATTR_ID_OTA_IMAGE_TYPE_ID, "Image Type ID" },
9849 { ZBEE_ZCL_ATTR_ID_OTA_MIN_BLOCK_REQ_DELAY, "Minimum Block Request Delay" },
9850 { 0, NULL }
9853 /* Server Commands Received */
9854 static const value_string zbee_zcl_ota_srv_rx_cmd_names[] = {
9855 { ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_REQ, "Query Next Image Request" },
9856 { ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_REQ, "Image Block Request" },
9857 { ZBEE_ZCL_CMD_ID_OTA_IMAGE_PAGE_REQ, "Image Page Request" },
9858 { ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_REQ, "Upgrade End Request" },
9859 { ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_REQ, "Query Specific File Request" },
9860 { 0, NULL }
9863 /* Server Commands Generated */
9864 static const value_string zbee_zcl_ota_srv_tx_cmd_names[] = {
9865 { ZBEE_ZCL_CMD_ID_OTA_IMAGE_NOTIFY, "Image Notify" },
9866 { ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_RSP, "Query Next Image Response" },
9867 { ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_RSP, "Image Block Response" },
9868 { ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_RSP, "Upgrade End Response" },
9869 { ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_RSP, "Query Specific File Response" },
9870 { 0, NULL }
9873 /* Payload Type */
9874 static const value_string zbee_zcl_ota_paylaod_type_names[] = {
9875 { ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ, "Query Jitter" },
9876 { ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC, "Query Jitter and Manufacturer Code" },
9877 { ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT, "Query Jitter, Manufacturer Code and Image Type" },
9878 { ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT_FV, "Query Jitter, Manufacturer Code, Image Type and File Version" },
9879 { 0, NULL }
9882 /* Image Upgrade Status */
9883 static const value_string zbee_zcl_ota_image_upgrade_attr_status_names[] = {
9884 { ZBEE_ZCL_OTA_STATUS_NORMAL, "Normal" },
9885 { ZBEE_ZCL_OTA_STATUS_DOWNLOAD_IN_PROGRESS, "Download in progress" },
9886 { ZBEE_ZCL_OTA_STATUS_DOWNLOAD_COMPLETE, "Download complete" },
9887 { ZBEE_ZCL_OTA_STATUS_WAITING_TO_UPGRADE, "Waiting to upgrade" },
9888 { ZBEE_ZCL_OTA_STATUS_COUNT_DOWN, "Count down" },
9889 { ZBEE_ZCL_OTA_STATUS_WAIT_FOR_MORE, "Wait for more" },
9890 { 0, NULL }
9893 /* ZigBee Stack Version */
9894 static const range_string zbee_zcl_ota_zb_stack_ver_names[] = {
9895 { ZBEE_ZCL_OTA_ZB_STACK_VER_2006, ZBEE_ZCL_OTA_ZB_STACK_VER_2006, "ZigBee 2006" },
9896 { ZBEE_ZCL_OTA_ZB_STACK_VER_2007, ZBEE_ZCL_OTA_ZB_STACK_VER_2007, "ZigBee 2007" },
9897 { ZBEE_ZCL_OTA_ZB_STACK_VER_PRO, ZBEE_ZCL_OTA_ZB_STACK_VER_PRO, "ZigBee Pro" },
9898 { ZBEE_ZCL_OTA_ZB_STACK_VER_IP, ZBEE_ZCL_OTA_ZB_STACK_VER_IP, "ZigBee IP" },
9899 { ZBEE_ZCL_OTA_ZB_STACK_VER_RESERVED_LO, ZBEE_ZCL_OTA_ZB_STACK_VER_RESERVED_HI, "Reserved" },
9900 { 0, 0, NULL },
9903 /* Image Type */
9904 static const range_string zbee_zcl_ota_image_type_names[] = {
9905 {ZBEE_ZCL_OTA_IMG_TYPE_MFR_LOW, ZBEE_ZCL_OTA_IMG_TYPE_MFR_HIGH, "Manufacturer Specific" },
9906 {ZBEE_ZCL_OTA_IMG_TYPE_SECURITY, ZBEE_ZCL_OTA_IMG_TYPE_SECURITY, "Security Credential" },
9907 {ZBEE_ZCL_OTA_IMG_TYPE_CONFIG, ZBEE_ZCL_OTA_IMG_TYPE_CONFIG, "Configuration" },
9908 {ZBEE_ZCL_OTA_IMG_TYPE_LOG, ZBEE_ZCL_OTA_IMG_TYPE_LOG, "Log" },
9909 {ZBEE_ZCL_OTA_IMG_TYPE_UNASSIGNED_LOW, ZBEE_ZCL_OTA_IMG_TYPE_UNASSIGNED_HIGH, "Reserved: Unassigned" },
9910 {ZBEE_ZCL_OTA_IMG_TYPE_WILD_CARD, ZBEE_ZCL_OTA_IMG_TYPE_WILD_CARD, "Reserved: Wild Card" },
9911 { 0, 0, NULL }
9914 /*************************/
9915 /* Function Bodies */
9916 /*************************/
9918 /*FUNCTION:------------------------------------------------------
9919 * NAME
9920 * decode_zcl_ota_curr_time
9921 * DESCRIPTION
9922 * this function decode the current time field
9923 * PARAMETERS
9924 * RETURNS
9925 * none
9926 *---------------------------------------------------------------
9928 static void
9929 decode_zcl_ota_curr_time(char *s, uint32_t value)
9931 if (value == ZBEE_ZCL_OTA_TIME_NOW) {
9932 snprintf(s, ITEM_LABEL_LENGTH, "Now");
9934 else {
9935 char *tmp;
9936 value += EPOCH_DELTA_2000_01_01_00_00_00_UTC;
9937 tmp = abs_time_secs_to_str(NULL, value, ABSOLUTE_TIME_LOCAL, 1);
9938 snprintf(s, ITEM_LABEL_LENGTH, "%s", tmp);
9939 wmem_free(NULL, tmp);
9942 return;
9943 } /*decode_zcl_ota_curr_time*/
9945 /*FUNCTION:------------------------------------------------------
9946 * NAME
9947 * decode_zcl_ota_req_time
9948 * DESCRIPTION
9949 * this function decode the request time field
9950 * PARAMETERS
9951 * RETURNS
9952 * none
9953 *---------------------------------------------------------------
9955 static void
9956 decode_zcl_ota_req_time(char *s, uint32_t value)
9958 if (value == ZBEE_ZCL_OTA_TIME_WAIT) {
9959 snprintf(s, ITEM_LABEL_LENGTH, "Wrong Value");
9961 else {
9962 /* offset from now */
9963 char *tmp = signed_time_secs_to_str(NULL, value);
9964 snprintf(s, ITEM_LABEL_LENGTH, "%s from now", tmp);
9965 wmem_free(NULL, tmp);
9968 return;
9969 } /*decode_zcl_ota_req_time*/
9971 /*FUNCTION:------------------------------------------------------
9972 * NAME
9973 * decode_zcl_ota_upgr_time
9974 * DESCRIPTION
9975 * this function decode the upgrade time field
9976 * PARAMETERS
9977 * RETURNS
9978 * none
9979 *---------------------------------------------------------------
9981 static void
9982 decode_zcl_ota_upgr_time(char *s, uint32_t value)
9984 if (value == ZBEE_ZCL_OTA_TIME_WAIT) {
9985 snprintf(s, ITEM_LABEL_LENGTH, "Wait for upgrade command");
9987 else {
9988 /* offset from now */
9989 char *tmp = signed_time_secs_to_str(NULL, value);
9990 snprintf(s, ITEM_LABEL_LENGTH, "%s from now", tmp);
9991 wmem_free(NULL, tmp);
9994 return;
9995 } /*decode_zcl_ota_upgr_time*/
9997 /*FUNCTION:------------------------------------------------------
9998 * NAME
9999 * decode_zcl_ota_upgr_time_utc
10000 * DESCRIPTION
10001 * this function decode the upgrade time field when it is UTC time
10002 * PARAMETERS
10003 * RETURNS
10004 * none
10005 *---------------------------------------------------------------
10007 static void
10008 decode_zcl_ota_upgr_time_utc(char *s, uint32_t value)
10010 if (value == ZBEE_ZCL_OTA_TIME_WAIT) {
10011 snprintf(s, ITEM_LABEL_LENGTH, "Wait for upgrade command");
10013 else {
10014 char *tmp;
10015 value += EPOCH_DELTA_2000_01_01_00_00_00_UTC;
10016 tmp = abs_time_secs_to_str(NULL, value, ABSOLUTE_TIME_LOCAL, 1);
10017 snprintf(s, ITEM_LABEL_LENGTH, "%s", tmp);
10018 wmem_free(NULL, tmp);
10021 return;
10022 } /*decode_zcl_ota_upgr_time_utc*/
10024 /*FUNCTION:------------------------------------------------------
10025 * NAME
10026 * decode_zcl_ota_size_in_bytes
10027 * DESCRIPTION
10028 * this function decodes size in bytes
10029 * PARAMETERS
10030 * RETURNS
10031 * none
10032 *---------------------------------------------------------------
10034 static void
10035 decode_zcl_ota_size_in_bytes(char *s, uint32_t value)
10037 snprintf(s, ITEM_LABEL_LENGTH, "%d [Bytes]", value);
10038 } /*decode_zcl_ota_size_in_bytes*/
10040 /*FUNCTION:------------------------------------------------------
10041 * NAME
10042 * dissect_zcl_ota_file_version_field
10043 * DESCRIPTION
10044 * this function is called in order to decode "FileVersion" field,
10045 * PARAMETERS
10046 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10047 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10048 * unsigned *offset - pointer to buffer offset
10049 * RETURNS
10050 * none
10051 *---------------------------------------------------------------
10053 static void
10054 dissect_zcl_ota_file_version_field(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10056 static int * const file_version[] = {
10057 &hf_zbee_zcl_ota_file_version_appl_release,
10058 &hf_zbee_zcl_ota_file_version_appl_build,
10059 &hf_zbee_zcl_ota_file_version_stack_release,
10060 &hf_zbee_zcl_ota_file_version_stack_build,
10061 NULL
10064 /* 'File Version' field present, retrieves it */
10065 /* File version is Little endian. as well as all ZigBee data structures:
10066 "The endianness used in each data field shall be little endian in order
10067 to be compliant with general ZigBee messages."
10068 File version A: 0x10053519 represents application release 1.0 build 05 with stack release 3.5 b19
10070 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_ota_file_version, ett_zbee_zcl_ota_file_version, file_version, ENC_LITTLE_ENDIAN);
10071 *offset += 4;
10072 } /*dissect_zcl_ota_file_version_field*/
10074 /*FUNCTION:------------------------------------------------------
10075 * NAME
10076 * dissect_zcl_ota_field_ctrl_field
10077 * DESCRIPTION
10078 * this function is called in order to decode "FileVersion" field,
10079 * PARAMETERS
10080 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10081 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10082 * unsigned *offset - pointer to buffer offset
10083 * int hf_hdr - hf_hdr
10084 * int ett - ett subtree index
10085 * int* const *fields - fields an array of pointers to int that lists all the fields of the bitmask
10086 * RETURNS
10087 * uint8_t - field ctrl value
10088 *---------------------------------------------------------------
10090 static uint8_t
10091 dissect_zcl_ota_field_ctrl_field(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, int hf_hdr, int ett, int * const *fields)
10093 uint8_t field;
10095 /* Retrieve 'Field Control' field */
10096 field = tvb_get_uint8(tvb, *offset);
10097 proto_tree_add_bitmask(tree, tvb, *offset, hf_hdr, ett, fields, ENC_NA);
10098 *offset += 1;
10100 return field;
10101 } /*dissect_zcl_ota_field_ctrl_field*/
10103 /*FUNCTION:------------------------------------------------------
10104 * NAME
10105 * dissect_zcl_ota_imagenotify
10106 * DESCRIPTION
10107 * this function is called in order to decode "ImageNotify",
10108 * PARAMETERS
10109 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10110 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10111 * unsigned *offset - pointer to buffer offset
10112 * RETURNS
10113 * none
10114 *---------------------------------------------------------------
10116 static void
10117 dissect_zcl_ota_imagenotify(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10119 uint8_t payload_type;
10121 /* Retrieve 'Payload type' field */
10122 payload_type = tvb_get_uint8(tvb, *offset);
10123 proto_tree_add_item(tree, hf_zbee_zcl_ota_payload_type, tvb, *offset, 1, ENC_NA);
10124 *offset += 1;
10126 /* Retrieve 'Query Jitter' field */
10127 proto_tree_add_item(tree, hf_zbee_zcl_ota_query_jitter, tvb, *offset, 1, ENC_NA);
10128 *offset += 1;
10130 /* Check if there are optional fields */
10132 if (payload_type >= ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC) {
10133 /* 'Manufacturer Code' field present, retrieves it */
10134 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10135 *offset += 2;
10138 if (payload_type >= ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT) {
10139 /* 'Image Type' field present, retrieves it */
10140 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10141 *offset += 2;
10144 if (payload_type >= ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT_FV) {
10145 /* 'File Version' field present, retrieves it */
10146 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10149 } /*dissect_zcl_ota_imagenotify*/
10151 /*FUNCTION:------------------------------------------------------
10152 * NAME
10153 * dissect_zcl_ota_querynextimagereq
10154 * DESCRIPTION
10155 * this function is called in order to decode "QueryNextImageRequest",
10156 * PARAMETERS
10157 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10158 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10159 * unsigned *offset - pointer to buffer offset
10160 * RETURNS
10161 * none
10162 *---------------------------------------------------------------
10164 static void
10165 dissect_zcl_ota_querynextimagereq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10167 static int * const fields[] = {
10168 &hf_zbee_zcl_ota_query_next_image_req_field_ctrl_hw_ver_present,
10169 &hf_zbee_zcl_ota_query_next_image_req_field_ctrl_reserved,
10170 NULL
10173 uint8_t field_ctrl;
10175 /* Retrieve 'Field Control' field */
10176 field_ctrl = dissect_zcl_ota_field_ctrl_field(tvb, tree, offset, hf_zbee_zcl_ota_query_next_image_req_field_ctrl, ett_zbee_zcl_ota_query_next_image_req_field_ctrl, fields);
10178 /* Retrieve 'Manufacturer Code' field */
10179 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10180 *offset += 2;
10182 /* Retrieve 'Image Type' field */
10183 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10184 *offset += 2;
10186 /* Retrieve 'File Version' field */
10187 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10189 /* Check if there are optional fields */
10190 if (field_ctrl & ZBEE_ZCL_OTA_QUERY_NEXT_IMAGE_REQ_FIELD_CTRL_HW_VER_PRESENT) {
10191 /* 'Hardware Version' field present, retrieves it */
10192 proto_tree_add_item(tree, hf_zbee_zcl_ota_hw_version, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10193 *offset += 2;
10195 } /*dissect_zcl_ota_querynextimagereq*/
10197 /*FUNCTION:------------------------------------------------------
10198 * NAME
10199 * dissect_zcl_ota_querynextimagersp
10200 * DESCRIPTION
10201 * this function is called in order to decode "QueryNextImageResponse",
10202 * PARAMETERS
10203 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10204 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10205 * unsigned *offset - pointer to buffer offset
10206 * RETURNS
10207 * none
10208 *---------------------------------------------------------------
10210 static void
10211 dissect_zcl_ota_querynextimagersp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10213 uint8_t status;
10215 /* Retrieve 'Status' field */
10216 status = tvb_get_uint8(tvb, *offset);
10217 proto_tree_add_item(tree, hf_zbee_zcl_ota_status, tvb, *offset, 1, ENC_NA);
10218 *offset += 1;
10220 /* Check if there are optional fields */
10221 if (status == ZBEE_ZCL_STAT_SUCCESS) {
10222 /* Retrieve 'Manufacturer Code' field */
10223 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10224 *offset += 2;
10226 /* Retrieve 'Image Type' field */
10227 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10228 *offset += 2;
10230 /* Retrieve 'File Version' field */
10231 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10233 /* Retrieve 'Image Size' field */
10234 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_size, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
10235 *offset += 4;
10238 } /*dissect_zcl_ota_querynextimagersp*/
10240 /*FUNCTION:------------------------------------------------------
10241 * NAME
10242 * dissect_zcl_ota_imageblockreq
10243 * DESCRIPTION
10244 * this function is called in order to decode "ImageBlockRequest",
10245 * PARAMETERS
10246 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10247 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10248 * unsigned *offset - pointer to buffer offset
10249 * RETURNS
10250 * none
10251 *---------------------------------------------------------------
10253 static void
10254 dissect_zcl_ota_imageblockreq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10256 static int * const fields[] = {
10257 &hf_zbee_zcl_ota_image_block_req_field_ctrl_ieee_addr_present,
10258 &hf_zbee_zcl_ota_image_block_req_field_ctrl_min_block_period_present,
10259 &hf_zbee_zcl_ota_image_block_req_field_ctrl_reserved,
10260 NULL
10263 uint8_t field_ctrl;
10265 /* Retrieve 'Field Control' field */
10266 field_ctrl = dissect_zcl_ota_field_ctrl_field(tvb, tree, offset, hf_zbee_zcl_ota_image_block_req_field_ctrl, ett_zbee_zcl_ota_image_block_req_field_ctrl, fields);
10268 /* Retrieve 'Manufacturer Code' field */
10269 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10270 *offset += 2;
10272 /* Retrieve 'Image Type' field */
10273 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10274 *offset += 2;
10276 /* Retrieve 'File Version' field */
10277 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10279 /* Retrieve 'File Offset' field */
10280 proto_tree_add_item(tree, hf_zbee_zcl_ota_file_offset, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
10281 *offset += 4;
10283 /* Retrieve 'Maximum Data Size' field */
10284 proto_tree_add_item(tree, hf_zbee_zcl_ota_max_data_size, tvb, *offset, 1, ENC_NA);
10285 *offset += 1;
10287 /* Check if there are optional fields */
10288 if (field_ctrl & ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT) {
10289 /* 'Request Node Address' field present, retrieve it */
10290 proto_tree_add_item(tree, hf_zbee_zcl_ota_req_node_addr, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
10291 *offset += 8;
10293 if (field_ctrl & ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_MIN_BLOCK_PERIOD_PRESENT) {
10294 /* 'Minimum Block Period' field present, retrieve it */
10295 proto_tree_add_item(tree, hf_zbee_zcl_ota_min_block_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10296 *offset += 2;
10298 } /*dissect_zcl_ota_imageblockreq*/
10300 /*FUNCTION:------------------------------------------------------
10301 * NAME
10302 * dissect_zcl_ota_imagepagereq
10303 * DESCRIPTION
10304 * this function is called in order to decode "ImagePageRequest",
10305 * PARAMETERS
10306 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10307 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10308 * unsigned *offset - pointer to buffer offset
10309 * RETURNS
10310 * none
10311 *---------------------------------------------------------------
10313 static void
10314 dissect_zcl_ota_imagepagereq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10316 static int * const fields[] = {
10317 &hf_zbee_zcl_ota_image_page_req_field_ctrl_ieee_addr_present,
10318 &hf_zbee_zcl_ota_image_page_req_field_ctrl_reserved,
10319 NULL
10322 uint8_t field_ctrl;
10324 /* Retrieve 'Field Control' field */
10325 field_ctrl = dissect_zcl_ota_field_ctrl_field(tvb, tree, offset, hf_zbee_zcl_ota_image_page_req_field_ctrl, ett_zbee_zcl_ota_image_page_req_field_ctrl, fields);
10327 /* Retrieve 'Manufacturer Code' field */
10328 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10329 *offset += 2;
10331 /* Retrieve 'Image Type' field */
10332 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10333 *offset += 2;
10335 /* Retrieve 'File Version' field */
10336 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10338 /* Retrieve 'File Offset' field */
10339 proto_tree_add_item(tree, hf_zbee_zcl_ota_file_offset, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
10340 *offset += 4;
10342 /* Retrieve 'Maximum Data Size' field */
10343 proto_tree_add_item(tree, hf_zbee_zcl_ota_max_data_size, tvb, *offset, 1, ENC_NA);
10344 *offset += 1;
10346 /* Retrieve 'Page Size' field */
10347 proto_tree_add_item(tree, hf_zbee_zcl_ota_page_size, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10348 *offset += 2;
10350 /* Retrieve 'Response Spacing' field */
10351 proto_tree_add_item(tree, hf_zbee_zcl_ota_rsp_spacing, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10352 *offset += 2;
10354 /* Check if there are optional fields */
10355 if (field_ctrl & ZBEE_ZCL_OTA_IMAGE_PAGE_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT) {
10356 /* 'Request Node Address' field present, retrieves it */
10357 proto_tree_add_item(tree, hf_zbee_zcl_ota_req_node_addr, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
10358 *offset += 8;
10360 } /*dissect_zcl_ota_imagepagereq*/
10362 /*FUNCTION:------------------------------------------------------
10363 * NAME
10364 * dissect_zcl_ota_imageblockrsp
10365 * DESCRIPTION
10366 * this function is called in order to decode "ImageBlockResponse",
10367 * PARAMETERS
10368 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10369 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10370 * unsigned *offset - pointer to buffer offset
10371 * RETURNS
10372 * none
10373 *---------------------------------------------------------------
10375 static void
10376 dissect_zcl_ota_imageblockrsp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10378 uint8_t status;
10379 uint8_t data_size;
10381 /* Retrieve 'Status' field */
10382 status = tvb_get_uint8(tvb, *offset);
10383 proto_tree_add_item(tree, hf_zbee_zcl_ota_status, tvb, *offset, 1, ENC_NA);
10384 *offset += 1;
10386 if (status == ZBEE_ZCL_STAT_SUCCESS) {
10387 /* Retrieve 'Manufacturer Code' field */
10388 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10389 *offset += 2;
10391 /* Retrieve 'Image Type' field */
10392 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10393 *offset += 2;
10395 /* Retrieve 'File Version' field */
10396 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10398 /* Retrieve 'File Offset' field */
10399 proto_tree_add_item(tree, hf_zbee_zcl_ota_file_offset, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
10400 *offset += 4;
10402 /* Retrieve 'Data Size' field */
10403 data_size = tvb_get_uint8(tvb, *offset);
10404 proto_tree_add_item(tree, hf_zbee_zcl_ota_data_size, tvb, *offset, 1, ENC_NA);
10405 *offset += 1;
10407 /* Retrieve 'Image Data' field */
10408 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_data, tvb, *offset, data_size, ENC_NA);
10409 *offset += data_size;
10411 else if (status == ZBEE_ZCL_STAT_OTA_WAIT_FOR_DATA) {
10412 /* Retrieve 'Current Time' field */
10413 proto_tree_add_item(tree, hf_zbee_zcl_ota_current_time, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
10414 *offset += 4;
10416 /* Retrieve 'Request Time' field */
10417 proto_tree_add_item(tree, hf_zbee_zcl_ota_request_time, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
10418 *offset += 4;
10420 else {
10421 /* */
10424 } /*dissect_zcl_ota_imageblockrsp*/
10426 /*FUNCTION:------------------------------------------------------
10427 * NAME
10428 * dissect_zcl_ota_upgradeendreq
10429 * DESCRIPTION
10430 * this function is called in order to decode "UpgradeEndRequest",
10431 * PARAMETERS
10432 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10433 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10434 * unsigned *offset - pointer to buffer offset
10435 * RETURNS
10436 * none
10437 *---------------------------------------------------------------
10439 static void
10440 dissect_zcl_ota_upgradeendreq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10442 /* Retrieve 'Status' field */
10443 proto_tree_add_item(tree, hf_zbee_zcl_ota_status, tvb, *offset, 1, ENC_NA);
10444 *offset += 1;
10446 /* Retrieve 'Manufacturer Code' field */
10447 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10448 *offset += 2;
10450 /* Retrieve 'Image Type' field */
10451 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10452 *offset += 2;
10454 /* Retrieve 'File Version' field */
10455 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10457 } /*dissect_zcl_ota_upgradeendreq*/
10459 /*FUNCTION:------------------------------------------------------
10460 * NAME
10461 * dissect_zcl_ota_upgradeendrsp
10462 * DESCRIPTION
10463 * this function is called in order to decode "UpgradeEndResponse",
10464 * PARAMETERS
10465 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10466 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10467 * unsigned *offset - pointer to buffer offset
10468 * RETURNS
10469 * none
10470 *---------------------------------------------------------------
10472 static void
10473 dissect_zcl_ota_upgradeendrsp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10475 uint32_t current_time = 0;
10477 /* Retrieve 'Manufacturer Code' field */
10478 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10479 *offset += 2;
10481 /* Retrieve 'Image Type' field */
10482 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10483 *offset += 2;
10485 /* Retrieve 'File Version' field */
10486 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10488 /* Retrieve 'Current Time' field */
10489 proto_tree_add_item_ret_uint(tree, hf_zbee_zcl_ota_current_time, tvb, *offset, 4, ENC_LITTLE_ENDIAN, &current_time);
10490 *offset += 4;
10492 /* Retrieve 'Upgrade Time' field */
10493 if (current_time == 0)
10495 /* Upgrade Time is offset time from now */
10496 proto_tree_add_item(tree, hf_zbee_zcl_ota_upgrade_time, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
10497 *offset += 4;
10499 else
10501 /* Upgrade Time is UTC time */
10502 proto_tree_add_item(tree, hf_zbee_zcl_ota_upgrade_time_utc, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
10503 *offset += 4;
10506 } /*dissect_zcl_ota_upgradeendrsp*/
10508 /*FUNCTION:------------------------------------------------------
10509 * NAME
10510 * dissect_zcl_ota_queryspecfilereq
10511 * DESCRIPTION
10512 * this function is called in order to decode "QuerySpecificFileRequest",
10513 * PARAMETERS
10514 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10515 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10516 * unsigned *offset - pointer to buffer offset
10517 * RETURNS
10518 * none
10519 *---------------------------------------------------------------
10521 static void
10522 dissect_zcl_ota_queryspecfilereq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10524 /* 'Request Node Address' field present, retrieves it */
10525 proto_tree_add_item(tree, hf_zbee_zcl_ota_req_node_addr, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
10526 *offset += 8;
10528 /* Retrieve 'Manufacturer Code' field */
10529 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10530 *offset += 2;
10532 /* Retrieve 'Image Type' field */
10533 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10534 *offset += 2;
10536 /* Retrieve 'File Version' field */
10537 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10539 /* Retrieve 'ZigBee Stack Version' field */
10540 proto_tree_add_item(tree, hf_zbee_zcl_ota_zb_stack_ver, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10541 *offset += 2;
10543 } /*dissect_zcl_ota_queryspecfilereq*/
10545 /*FUNCTION:------------------------------------------------------
10546 * NAME
10547 * dissect_zcl_ota_queryspecfilersp
10548 * DESCRIPTION
10549 * this function is called in order to decode "QuerySpecificFileResponse",
10550 * PARAMETERS
10551 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10552 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10553 * unsigned *offset - pointer to buffer offset
10554 * RETURNS
10555 * none
10556 *---------------------------------------------------------------
10558 static void
10559 dissect_zcl_ota_queryspecfilersp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10561 uint8_t status;
10563 /* Retrieve 'Status' field */
10564 status = tvb_get_uint8(tvb, *offset);
10565 proto_tree_add_item(tree, hf_zbee_zcl_ota_status, tvb, *offset, 1, ENC_NA);
10566 *offset += 1;
10568 if (status == ZBEE_ZCL_STAT_SUCCESS) {
10569 /* Retrieve 'Manufacturer Code' field */
10570 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10571 *offset += 2;
10573 /* Retrieve 'Image Type' field */
10574 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10575 *offset += 2;
10577 /* Retrieve 'File Version' field */
10578 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10580 /* Retrieve 'Image Size' field */
10581 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_size, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
10582 *offset += 4;
10585 } /*dissect_zcl_ota_queryspecfilersp*/
10588 /*FUNCTION:------------------------------------------------------
10589 * NAME
10590 * dissect_zcl_ota_attr_data
10591 * DESCRIPTION
10592 * this function is called by ZCL foundation dissector in order to decode
10593 * specific cluster attributes data.
10594 * PARAMETERS
10595 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10596 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10597 * unsigned *offset - pointer to buffer offset
10598 * uint16_t attr_id - attribute identifier
10599 * unsigned data_type - attribute data type
10600 * bool client_attr- ZCL client
10601 * RETURNS
10602 * none
10603 *---------------------------------------------------------------
10605 static void
10606 dissect_zcl_ota_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
10608 /* Dissect attribute data type and data */
10609 switch ( attr_id )
10611 case ZBEE_ZCL_ATTR_ID_OTA_CURRENT_FILE_VERSION:
10612 case ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_FILE_VERSION:
10613 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10614 break;
10616 case ZBEE_ZCL_ATTR_ID_OTA_CURRENT_ZB_STACK_VERSION:
10617 case ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_ZB_STACK_VERSION:
10618 proto_tree_add_item(tree, hf_zbee_zcl_ota_zb_stack_ver, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10619 *offset += 2;
10620 break;
10622 case ZBEE_ZCL_ATTR_ID_OTA_IMAGE_UPGRADE_STATUS:
10623 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_upgrade_status, tvb, *offset, 1, ENC_NA);
10624 *offset += 1;
10625 break;
10627 case ZBEE_ZCL_ATTR_ID_OTA_MANUFACTURER_ID:
10628 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10629 *offset += 2;
10630 break;
10632 case ZBEE_ZCL_ATTR_ID_OTA_IMAGE_TYPE_ID:
10633 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
10634 *offset += 2;
10635 break;
10637 case ZBEE_ZCL_ATTR_ID_OTA_MIN_BLOCK_REQ_DELAY:
10638 default:
10639 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
10640 break;
10642 } /*dissect_zcl_ota_attr_data*/
10645 /*FUNCTION:------------------------------------------------------
10646 * NAME
10647 * dissect_zbee_zcl_ota
10648 * DESCRIPTION
10649 * ZigBee ZCL OTA cluster dissector for wireshark.
10650 * PARAMETERS
10651 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10652 * packet_info *pinfo - pointer to packet information fields
10653 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10654 * void *data - pointer to ZCL packet structure.
10655 * RETURNS
10656 * int - length of parsed data.
10657 *---------------------------------------------------------------
10659 static int
10660 dissect_zbee_zcl_ota(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
10662 proto_tree *payload_tree;
10663 zbee_zcl_packet *zcl;
10664 unsigned offset = 0;
10665 uint8_t cmd_id;
10666 int rem_len;
10668 /* Reject the packet if data is NULL */
10669 if (data == NULL)
10670 return 0;
10671 zcl = (zbee_zcl_packet *)data;
10672 cmd_id = zcl->cmd_id;
10674 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
10675 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
10676 /* Append the command name to the info column. */
10677 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
10678 val_to_str_const(cmd_id, zbee_zcl_ota_srv_rx_cmd_names, "Unknown Command"),
10679 zcl->tran_seqno);
10681 /* Add the command ID. */
10682 proto_tree_add_item(tree, hf_zbee_zcl_ota_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
10684 /* Check is this command has a payload, than add the payload tree */
10685 rem_len = tvb_reported_length_remaining(tvb, ++offset);
10686 if (rem_len > 0) {
10687 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_ota, NULL, "Payload");
10689 /* Call the appropriate command dissector */
10690 switch (cmd_id) {
10691 case ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_REQ:
10692 dissect_zcl_ota_querynextimagereq(tvb, payload_tree, &offset);
10693 break;
10695 case ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_REQ:
10696 dissect_zcl_ota_imageblockreq(tvb, payload_tree, &offset);
10697 break;
10699 case ZBEE_ZCL_CMD_ID_OTA_IMAGE_PAGE_REQ:
10700 dissect_zcl_ota_imagepagereq(tvb, payload_tree, &offset);
10701 break;
10703 case ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_REQ:
10704 dissect_zcl_ota_upgradeendreq(tvb, payload_tree, &offset);
10705 break;
10707 case ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_REQ:
10708 dissect_zcl_ota_queryspecfilereq(tvb, payload_tree, &offset);
10709 break;
10711 default:
10712 break;
10716 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
10717 /* Append the command name to the info column. */
10718 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
10719 val_to_str_const(cmd_id, zbee_zcl_ota_srv_tx_cmd_names, "Unknown Command"),
10720 zcl->tran_seqno);
10722 /* Add the command ID. */
10723 proto_tree_add_item(tree, hf_zbee_zcl_ota_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
10725 /* Check is this command has a payload, than add the payload tree */
10726 rem_len = tvb_reported_length_remaining(tvb, ++offset);
10727 if (rem_len > 0) {
10728 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_ota, NULL, "Payload");
10730 /* Call the appropriate command dissector */
10731 switch (cmd_id) {
10732 case ZBEE_ZCL_CMD_ID_OTA_IMAGE_NOTIFY:
10733 dissect_zcl_ota_imagenotify(tvb, payload_tree, &offset);
10734 break;
10736 case ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_RSP:
10737 dissect_zcl_ota_querynextimagersp(tvb, payload_tree, &offset);
10738 break;
10740 case ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_RSP:
10741 dissect_zcl_ota_imageblockrsp(tvb, payload_tree, &offset);
10742 break;
10744 case ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_RSP:
10745 dissect_zcl_ota_upgradeendrsp(tvb, payload_tree, &offset);
10746 break;
10748 case ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_RSP:
10749 dissect_zcl_ota_queryspecfilersp(tvb, payload_tree, &offset);
10750 break;
10752 default:
10753 break;
10758 return tvb_captured_length(tvb);
10759 } /*dissect_zbee_zcl_ota*/
10761 /*FUNCTION:------------------------------------------------------
10762 * NAME
10763 * proto_register_zbee_zcl_ota
10764 * DESCRIPTION
10765 * this function is called by ZCL foundation dissector in order to decode
10766 * specific cluster attributes data.
10767 * PARAMETERS
10768 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10769 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10770 * unsigned *offset - pointer to buffer offset
10771 * uint16_t attr_id - attribute identifier
10772 * unsigned data_type - attribute data type
10773 * RETURNS
10774 * none
10775 *---------------------------------------------------------------
10777 void proto_register_zbee_zcl_ota(void)
10779 static hf_register_info hf[] = {
10781 { &hf_zbee_zcl_ota_attr_id,
10782 { "Attribute", "zbee_zcl_general.ota.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_ota_attr_names),
10783 0x0, NULL, HFILL } },
10785 { &hf_zbee_zcl_ota_srv_tx_cmd_id,
10786 { "Command", "zbee_zcl_general.ota.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ota_srv_tx_cmd_names),
10787 0x0, NULL, HFILL } },
10789 { &hf_zbee_zcl_ota_srv_rx_cmd_id,
10790 { "Command", "zbee_zcl_general.ota.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ota_srv_rx_cmd_names),
10791 0x0, NULL, HFILL } },
10793 { &hf_zbee_zcl_ota_image_upgrade_status,
10794 { "Image Upgrade Status", "zbee_zcl_general.ota.status_attr", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ota_image_upgrade_attr_status_names),
10795 0x0, NULL, HFILL } },
10797 { &hf_zbee_zcl_ota_zb_stack_ver,
10798 { "ZigBee Stack Version", "zbee_zcl_general.ota.zb_stack.ver", FT_UINT16, BASE_HEX | BASE_RANGE_STRING,
10799 RVALS(zbee_zcl_ota_zb_stack_ver_names), 0x0, NULL, HFILL } },
10801 { &hf_zbee_zcl_ota_payload_type,
10802 { "Payload Type", "zbee_zcl_general.ota.payload.type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ota_paylaod_type_names),
10803 0x0, NULL, HFILL } },
10805 { &hf_zbee_zcl_ota_query_jitter,
10806 { "Query Jitter", "zbee_zcl_general.ota.query_jitter", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_seconds),
10807 0x0, NULL, HFILL } },
10809 { &hf_zbee_zcl_ota_manufacturer_code,
10810 { "Manufacturer Code", "zbee_zcl_general.ota.manufacturer_code", FT_UINT16, BASE_HEX, VALS(zbee_mfr_code_names),
10811 0x0, NULL, HFILL } },
10813 { &hf_zbee_zcl_ota_image_type,
10814 { "Image Type", "zbee_zcl_general.ota.image.type", FT_UINT16, BASE_HEX | BASE_RANGE_STRING,
10815 RVALS(zbee_zcl_ota_image_type_names), 0x0, NULL, HFILL } },
10817 /* Begin FileVersion fields */
10818 { &hf_zbee_zcl_ota_file_version,
10819 { "File Version", "zbee_zcl_general.ota.file.version", FT_UINT32, BASE_HEX, NULL,
10820 0x0, NULL, HFILL } },
10822 { &hf_zbee_zcl_ota_file_version_appl_release,
10823 { "Application Release", "zbee_zcl_general.ota.file.version.appl.release", FT_UINT32, BASE_DEC, NULL,
10824 ZBEE_ZCL_OTA_FILE_VERS_APPL_RELEASE, NULL, HFILL } },
10826 { &hf_zbee_zcl_ota_file_version_appl_build,
10827 { "Application Build", "zbee_zcl_general.ota.file.version.appl.build", FT_UINT32, BASE_DEC, NULL,
10828 ZBEE_ZCL_OTA_FILE_VERS_APPL_BUILD, NULL, HFILL } },
10830 { &hf_zbee_zcl_ota_file_version_stack_release,
10831 { "Stack Release", "zbee_zcl_general.ota.file.version.stack.release", FT_UINT32, BASE_DEC, NULL,
10832 ZBEE_ZCL_OTA_FILE_VERS_STACK_RELEASE, NULL, HFILL } },
10834 { &hf_zbee_zcl_ota_file_version_stack_build,
10835 { "Stack Build", "zbee_zcl_general.ota.file.version.stack.build", FT_UINT32, BASE_DEC, NULL,
10836 ZBEE_ZCL_OTA_FILE_VERS_STACK_BUILD, NULL, HFILL } },
10837 /* End FileVersion fields */
10839 /* Begin FieldControl fields Query Next Image Request */
10840 { &hf_zbee_zcl_ota_query_next_image_req_field_ctrl,
10841 { "Field Control", "zbee_zcl_general.ota.query_next_image_req.field_ctrl",
10842 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
10844 { &hf_zbee_zcl_ota_query_next_image_req_field_ctrl_hw_ver_present,
10845 { "Hardware Version", "zbee_zcl_general.ota.query_next_image_req.field_ctrl.hw_ver_present",
10846 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), ZBEE_ZCL_OTA_QUERY_NEXT_IMAGE_REQ_FIELD_CTRL_HW_VER_PRESENT, NULL, HFILL } },
10848 { &hf_zbee_zcl_ota_query_next_image_req_field_ctrl_reserved,
10849 { "Reserved", "zbee_zcl_general.ota.query_next_image_req.field_ctrl.reserved", FT_UINT8, BASE_HEX, NULL,
10850 ZBEE_ZCL_OTA_QUERY_NEXT_IMAGE_REQ_FIELD_CTRL_RESERVED, NULL, HFILL } },
10851 /* End FieldControl fields Query Next Image Request */
10853 /* Begin FieldControl fields Image Block Request */
10854 { &hf_zbee_zcl_ota_image_block_req_field_ctrl,
10855 { "Field Control", "zbee_zcl_general.ota.image_block_req.field_ctrl",
10856 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
10858 { &hf_zbee_zcl_ota_image_block_req_field_ctrl_ieee_addr_present,
10859 { "Request Node Address", "zbee_zcl_general.ota.image_block_req.field_ctrl.request_node_addr_present",
10860 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT, NULL, HFILL } },
10862 { &hf_zbee_zcl_ota_image_block_req_field_ctrl_min_block_period_present,
10863 { "Minimum Block Period", "zbee_zcl_general.ota.image_block_req.field_ctrl.min_block_period",
10864 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_MIN_BLOCK_PERIOD_PRESENT, NULL, HFILL } },
10866 { &hf_zbee_zcl_ota_image_block_req_field_ctrl_reserved,
10867 { "Reserved", "zbee_zcl_general.ota.query_next_image_req.field_ctrl.reserved", FT_UINT8, BASE_HEX, NULL,
10868 ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_RESERVED, NULL, HFILL } },
10869 /* End FieldControl fields Image Block Request */
10871 /* Begin FieldControl fields Image Page Request */
10872 { &hf_zbee_zcl_ota_image_page_req_field_ctrl,
10873 { "Field Control", "zbee_zcl_general.ota.image_page_req.field_ctrl",
10874 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
10876 { &hf_zbee_zcl_ota_image_page_req_field_ctrl_ieee_addr_present,
10877 { "Request Node Address", "zbee_zcl_general.ota.query_next_image_req.field_ctrl.request_node_addr_present",
10878 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), ZBEE_ZCL_OTA_IMAGE_PAGE_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT, NULL, HFILL } },
10880 { &hf_zbee_zcl_ota_image_page_req_field_ctrl_reserved,
10881 { "Reserved", "zbee_zcl_general.ota.image_page_req.field_ctrl.reserved", FT_UINT8, BASE_HEX, NULL,
10882 ZBEE_ZCL_OTA_IMAGE_PAGE_REQ_FIELD_CTRL_RESERVED, NULL, HFILL } },
10883 /* End FieldControl fields Image Page Request */
10885 { &hf_zbee_zcl_ota_hw_version,
10886 { "Hardware Version", "zbee_zcl_general.ota.hw_ver", FT_UINT16, BASE_HEX, NULL,
10887 0x0, NULL, HFILL } },
10889 { &hf_zbee_zcl_ota_status,
10890 { "Status", "zbee_zcl_general.ota.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names),
10891 0x0, NULL, HFILL } },
10893 { &hf_zbee_zcl_ota_image_size,
10894 { "Image Size", "zbee_zcl_general.ota.image.size", FT_UINT32, BASE_CUSTOM, CF_FUNC(decode_zcl_ota_size_in_bytes),
10895 0x0, NULL, HFILL } },
10897 { &hf_zbee_zcl_ota_file_offset,
10898 { "File Offset", "zbee_zcl_general.ota.file.offset", FT_UINT32, BASE_DEC, NULL,
10899 0x0, NULL, HFILL } },
10901 { &hf_zbee_zcl_ota_max_data_size,
10902 { "Max Data Size", "zbee_zcl_general.ota.max_data_size", FT_UINT8, BASE_DEC, NULL,
10903 0x0, NULL, HFILL } },
10905 { &hf_zbee_zcl_ota_min_block_period,
10906 { "Minimum Block Period", "zbee_zcl_general.ota.min_block_period", FT_UINT16, BASE_DEC, NULL,
10907 0x0, NULL, HFILL } },
10909 { &hf_zbee_zcl_ota_req_node_addr,
10910 { "Ieee Address", "zbee_zcl_general.ota.ieee_addr", FT_UINT64, BASE_HEX, NULL,
10911 0x0, NULL, HFILL } },
10913 { &hf_zbee_zcl_ota_page_size,
10914 { "Page Size", "zbee_zcl_general.ota.page.size", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_ota_size_in_bytes),
10915 0x0, NULL, HFILL } },
10917 { &hf_zbee_zcl_ota_rsp_spacing,
10918 { "Response Spacing", "zbee_zcl_general.ota.rsp_spacing", FT_UINT16, BASE_HEX, NULL,
10919 0x0, NULL, HFILL } },
10921 { &hf_zbee_zcl_ota_current_time,
10922 { "Current Time", "zbee_zcl_general.ota.current_time", FT_UINT32, BASE_CUSTOM, CF_FUNC(decode_zcl_ota_curr_time),
10923 0x0, NULL, HFILL }},
10925 { &hf_zbee_zcl_ota_request_time,
10926 { "Request Time", "zbee_zcl_general.ota.request_time", FT_UINT32, BASE_CUSTOM, CF_FUNC(decode_zcl_ota_req_time),
10927 0x0, NULL, HFILL }},
10929 { &hf_zbee_zcl_ota_upgrade_time,
10930 { "Upgrade Time", "zbee_zcl_general.ota.upgrade_time", FT_UINT32, BASE_CUSTOM, CF_FUNC(decode_zcl_ota_upgr_time),
10931 0x0, NULL, HFILL }},
10933 { &hf_zbee_zcl_ota_upgrade_time_utc,
10934 { "Upgrade Time", "zbee_zcl_general.ota.upgrade_time_utc", FT_UINT32, BASE_CUSTOM, CF_FUNC(decode_zcl_ota_upgr_time_utc),
10935 0x0, NULL, HFILL }},
10937 { &hf_zbee_zcl_ota_data_size,
10938 { "Data Size", "zbee_zcl_general.ota.data_size", FT_UINT8, BASE_DEC, NULL,
10939 0x00, NULL, HFILL } },
10941 { &hf_zbee_zcl_ota_image_data,
10942 { "Image Data", "zbee_zcl_general.ota.image.data", FT_BYTES, SEP_COLON, NULL,
10943 0x00, NULL, HFILL } }
10946 /* ZCL OTA subtrees */
10947 int *ett[] = {
10948 &ett_zbee_zcl_ota,
10949 &ett_zbee_zcl_ota_query_next_image_req_field_ctrl,
10950 &ett_zbee_zcl_ota_image_block_req_field_ctrl,
10951 &ett_zbee_zcl_ota_image_page_req_field_ctrl,
10952 &ett_zbee_zcl_ota_file_version
10955 /* Register ZigBee ZCL Ota protocol with Wireshark. */
10956 proto_zbee_zcl_ota = proto_register_protocol("ZigBee ZCL OTA", "ZCL OTA", ZBEE_PROTOABBREV_ZCL_OTA);
10957 proto_register_field_array(proto_zbee_zcl_ota, hf, array_length(hf));
10958 proto_register_subtree_array(ett, array_length(ett));
10960 /* Register the ZigBee ZCL OTA dissector. */
10961 register_dissector(ZBEE_PROTOABBREV_ZCL_OTA, dissect_zbee_zcl_ota, proto_zbee_zcl_ota);
10963 } /* proto_register_zbee_zcl_ota */
10966 /*FUNCTION:------------------------------------------------------
10967 * NAME
10968 * proto_reg_handoff_zbee_zcl_ota
10969 * DESCRIPTION
10970 * Registers the zigbee ZCL OTA cluster dissector with Wireshark.
10971 * PARAMETERS
10972 * none
10973 * RETURNS
10974 * void
10975 *---------------------------------------------------------------
10977 void proto_reg_handoff_zbee_zcl_ota(void)
10979 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_OTA,
10980 proto_zbee_zcl_ota,
10981 ett_zbee_zcl_ota,
10982 ZBEE_ZCL_CID_OTA_UPGRADE,
10983 ZBEE_MFG_CODE_NONE,
10984 hf_zbee_zcl_ota_attr_id,
10985 hf_zbee_zcl_ota_attr_id,
10986 hf_zbee_zcl_ota_srv_rx_cmd_id,
10987 hf_zbee_zcl_ota_srv_tx_cmd_id,
10988 (zbee_zcl_fn_attr_data)dissect_zcl_ota_attr_data
10991 } /*proto_reg_handoff_zbee_zcl_ota*/
10993 /* ########################################################################## */
10994 /* #### (0x001A) POWER PROFILE CLUSTER ###################################### */
10995 /* ########################################################################## */
10997 /*************************/
10998 /* Defines */
10999 /*************************/
11001 #define ZBEE_ZCL_PWR_PROF_NUM_GENERIC_ETT 4
11002 #define ZBEE_ZCL_PWR_PROF_NUM_PWR_PROF_ETT 5
11003 #define ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT 16
11004 #define ZBEE_ZCL_PWR_PROF_NUM_ETT (ZBEE_ZCL_PWR_PROF_NUM_GENERIC_ETT + \
11005 ZBEE_ZCL_PWR_PROF_NUM_PWR_PROF_ETT + \
11006 ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT)
11008 /* Attributes */
11009 #define ZBEE_ZCL_ATTR_ID_PWR_PROF_TOT_PROF_NUM 0x0000 /* Total Profile Number */
11010 #define ZBEE_ZCL_ATTR_ID_PWR_PROF_MULTIPLE_SCHED 0x0001 /* Multiple Schedule */
11011 #define ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_FORMAT 0x0002 /* Energy Formatting */
11012 #define ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_REMOTE 0x0003 /* Energy Remote */
11013 #define ZBEE_ZCL_ATTR_ID_PWR_PROF_SCHED_MODE 0x0004 /* Schedule Mode */
11015 /* Server Commands Received */
11016 #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_REQ 0x00 /* Power Profile Request */
11017 #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_REQ 0x01 /* Power Profile State Request */
11018 #define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_RSP 0x02 /* Get Power Profile Price Response */
11019 #define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE_RSP 0x03 /* Get Overall Schedule Price Response */
11020 #define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_NOTIF 0x04 /* Energy Phases Schedule Notification */
11021 #define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_RSP 0x05 /* Energy Phases Schedule Response */
11022 #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_REQ 0x06 /* Power Profile Schedule Constraints Request */
11023 #define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_REQ 0x07 /* Energy Phases Schedule State Request */
11024 #define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT_RSP 0x08 /* Get Power Profile Price Extended Response */
11026 /* Server Commands Generated */
11027 #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_NOTIF 0x00 /* Power Profile Notification */
11028 #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_RSP 0x01 /* Power Profile Response */
11029 #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_RSP 0x02 /* Power Profile State Response */
11030 #define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE 0x03 /* Get Power Profile Price */
11031 #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_NOTIF 0x04 /* Power Profile State Notification */
11032 #define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE 0x05 /* Get Overall Schedule Price */
11033 #define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_REQ 0x06 /* Energy Phases Schedule Request */
11034 #define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_RSP 0x07 /* Energy Phases Schedule State Response */
11035 #define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_NOITIF 0x08 /* Energy Phases Schedule State Notification */
11036 #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_NOTIF 0x09 /* Power Profile Schedule Constraints Notification */
11037 #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_RSP 0x0A /* Power Profile Schedule Constraints Response */
11038 #define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT 0x0B /* Get Power Profile Price Extended */
11040 /* Power Profile StateId */
11041 #define ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_IDLE 0x00 /* Power Profile Idle */
11042 #define ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_PROGRAMMED 0x01 /* Power Profile Programmed */
11043 #define ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_RUNNING 0x03 /* Energy Phase Running */
11044 #define ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_PAUSE 0x04 /* Energy Phase Pause */
11045 #define ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_WAITING_TO_START 0x05 /* Energy Phase Waiting to Start */
11046 #define ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_WAITING_PAUSED 0x06 /* Energy Phase Waiting Pause */
11047 #define ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_ENDED 0x07 /* Power Profile Ended */
11049 /* Energy Formatting bitmask field list */
11050 #define ZBEE_ZCL_OPT_PWRPROF_NUM_R_DIGIT 0x07 /* bits 0..2 */
11051 #define ZBEE_ZCL_OPT_PWRPROF_NUM_L_DIGIT 0x78 /* bits 3..6 */
11052 #define ZBEE_ZCL_OPT_PWRPROF_NO_LEADING_ZERO 0x80 /* bit 7 */
11054 /* Schedule Mode bitmask field list */
11055 #define ZBEE_ZCL_OPT_PWRPROF_SCHED_CHEAPEST 0x01 /* bit 0 */
11056 #define ZBEE_ZCL_OPT_PWRPROF_SCHED_GREENEST 0x02 /* bit 1 */
11057 #define ZBEE_ZCL_OPT_PWRPROF_SCHED_RESERVED 0xfc /* bits 2..7 */
11059 /* Options bitmask field list */
11060 #define ZBEE_ZCL_OPT_PWRPROF_STIME_PRESENT 0x01 /* bit 0 */
11061 #define ZBEE_ZCL_OPT_PWRPROF_RESERVED 0xfe /* bits 1..7 */
11063 /*************************/
11064 /* Function Declarations */
11065 /*************************/
11067 void proto_register_zbee_zcl_pwr_prof(void);
11068 void proto_reg_handoff_zbee_zcl_pwr_prof(void);
11070 /* Command Dissector Helpers */
11071 static void dissect_zcl_pwr_prof_pwrprofreq (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11072 static void dissect_zcl_pwr_prof_getpwrprofpricersp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11073 static void dissect_zcl_pwr_prof_getoverallschedpricersp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11074 static void dissect_zcl_pwr_prof_enphsschednotif (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11076 static void dissect_zcl_energy_phase (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11077 static void dissect_zcl_pwr_prof_pwrprofnotif (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11078 static void dissect_zcl_power_profile (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11079 static void dissect_zcl_pwr_prof_pwrprofstatersp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11080 static void dissect_zcl_pwr_prof_pwrprofschedcontrsnotif (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11081 static void dissect_zcl_pwr_prof_pwrprofpriceext (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11083 static void dissect_zcl_pwr_prof_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
11085 /* Private functions prototype */
11086 static void decode_power_profile_id (char *s, uint8_t id);
11087 static void decode_price_in_cents (char *s, uint32_t value);
11088 static void decode_power_in_watt (char *s, uint16_t value);
11089 static void decode_energy (char *s, uint16_t value);
11091 /*************************/
11092 /* Global Variables */
11093 /*************************/
11094 /* Initialize the protocol and registered fields */
11095 static int proto_zbee_zcl_pwr_prof;
11097 static int hf_zbee_zcl_pwr_prof_attr_id;
11098 static int hf_zbee_zcl_pwr_prof_tot_prof_num;
11099 static int hf_zbee_zcl_pwr_prof_multiple_sched;
11100 static int hf_zbee_zcl_pwr_prof_energy_format;
11101 static int hf_zbee_zcl_pwr_prof_energy_format_rdigit;
11102 static int hf_zbee_zcl_pwr_prof_energy_format_ldigit;
11103 static int hf_zbee_zcl_pwr_prof_energy_format_noleadingzero;
11104 static int hf_zbee_zcl_pwr_prof_energy_remote;
11105 static int hf_zbee_zcl_pwr_prof_sched_mode;
11106 static int hf_zbee_zcl_pwr_prof_sched_mode_cheapest;
11107 static int hf_zbee_zcl_pwr_prof_sched_mode_greenest;
11108 static int hf_zbee_zcl_pwr_prof_sched_mode_reserved;
11109 static int hf_zbee_zcl_pwr_prof_srv_tx_cmd_id;
11110 static int hf_zbee_zcl_pwr_prof_srv_rx_cmd_id;
11111 static int hf_zbee_zcl_pwr_prof_pwr_prof_id;
11112 static int hf_zbee_zcl_pwr_prof_currency;
11113 static int hf_zbee_zcl_pwr_prof_price;
11114 static int hf_zbee_zcl_pwr_prof_price_trailing_digit;
11115 static int hf_zbee_zcl_pwr_prof_num_of_sched_phases;
11116 static int hf_zbee_zcl_pwr_prof_scheduled_time;
11117 static int hf_zbee_zcl_pwr_prof_pwr_prof_count;
11118 static int hf_zbee_zcl_pwr_prof_num_of_trans_phases;
11119 static int hf_zbee_zcl_pwr_prof_energy_phase_id;
11120 static int hf_zbee_zcl_pwr_prof_macro_phase_id;
11121 static int hf_zbee_zcl_pwr_prof_expect_duration;
11122 static int hf_zbee_zcl_pwr_prof_peak_power;
11123 static int hf_zbee_zcl_pwr_prof_energy;
11124 static int hf_zbee_zcl_pwr_prof_max_active_delay;
11125 static int hf_zbee_zcl_pwr_prof_pwr_prof_rem_ctrl;
11126 static int hf_zbee_zcl_pwr_prof_pwr_prof_state;
11127 static int hf_zbee_zcl_pwr_prof_start_after;
11128 static int hf_zbee_zcl_pwr_prof_stop_before;
11129 static int hf_zbee_zcl_pwr_prof_options;
11130 static int hf_zbee_zcl_pwr_prof_options_01;
11131 static int hf_zbee_zcl_pwr_prof_options_res;
11132 static int hf_zbee_zcl_pwr_prof_pwr_prof_stime;
11134 /* Initialize the subtree pointers */
11135 static int ett_zbee_zcl_pwr_prof;
11136 static int ett_zbee_zcl_pwr_prof_options;
11137 static int ett_zbee_zcl_pwr_prof_en_format;
11138 static int ett_zbee_zcl_pwr_prof_sched_mode;
11139 static int ett_zbee_zcl_pwr_prof_pwrprofiles[ZBEE_ZCL_PWR_PROF_NUM_PWR_PROF_ETT];
11140 static int ett_zbee_zcl_pwr_prof_enphases[ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT];
11142 /* Attributes */
11143 static const value_string zbee_zcl_pwr_prof_attr_names[] = {
11144 { ZBEE_ZCL_ATTR_ID_PWR_PROF_TOT_PROF_NUM, "Total Profile Number" },
11145 { ZBEE_ZCL_ATTR_ID_PWR_PROF_MULTIPLE_SCHED, "Multiple Scheduling" },
11146 { ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_FORMAT, "Energy Formatting" },
11147 { ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_REMOTE, "Energy Remote" },
11148 { ZBEE_ZCL_ATTR_ID_PWR_PROF_SCHED_MODE, "Schedule Mode" },
11149 { 0, NULL }
11152 /* Server Commands Received */
11153 static const value_string zbee_zcl_pwr_prof_srv_rx_cmd_names[] = {
11154 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_REQ, "Power Profile Request" },
11155 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_REQ, "Power Profile State Request" },
11156 { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_RSP, "Get Power Profile Price Response" },
11157 { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE_RSP, "Get Overall Schedule Price Response" },
11158 { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_NOTIF, "Energy Phases Schedule Notification" },
11159 { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_RSP, "Energy Phases Schedule Response" },
11160 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_REQ, "Power Profile Schedule Constraints Request" },
11161 { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_REQ, "Energy Phases Schedule State Request" },
11162 { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT_RSP, "Get Power Profile Price Extended Response" },
11163 { 0, NULL }
11166 /* Server Commands Generated */
11167 static const value_string zbee_zcl_pwr_prof_srv_tx_cmd_names[] = {
11168 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_NOTIF, "Power Profile Notification" },
11169 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_RSP, "Power Profile Response" },
11170 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_RSP, "Power Profile State Response" },
11171 { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE, "Get Power Profile Price" },
11172 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_NOTIF, "Power Profile State Notification" },
11173 { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE, "Get Overall Schedule Price" },
11174 { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_REQ, "Energy Phases Schedule Request" },
11175 { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_RSP, "Energy Phases Schedule State Response" },
11176 { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_NOITIF, "Energy Phases Schedule State Notification" },
11177 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_NOTIF, "Power Profile Schedule Constraints Notification" },
11178 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_RSP, "Power Profile Schedule Constraints Response" },
11179 { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT, "Get Power Profile Price Extended" },
11180 { 0, NULL }
11183 /* Currencies (values defined by ISO 4217) */
11184 static const value_string zbee_zcl_currecy_names[] = {
11185 { 0x03D2, "EUR" },
11186 { 0x033A, "GBP" },
11187 { 0x0348, "USD" },
11188 { 0, NULL }
11191 /* Power Profile State */
11192 static const value_string zbee_zcl_pwr_prof_state_names[] = {
11193 { ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_IDLE, "Power Profile Idle" },
11194 { ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_PROGRAMMED, "Power Profile Programmed" },
11195 { ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_RUNNING, "Energy Phase Running" },
11196 { ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_PAUSE, "Energy Phase Pause" },
11197 { ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_WAITING_TO_START, "Energy Phase Waiting to Start" },
11198 { ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_WAITING_PAUSED, "Energy Phase Waiting Paused" },
11199 { ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_ENDED, "Power Profile Ended" },
11200 { 0, NULL }
11203 /*************************/
11204 /* Function Bodies */
11205 /*************************/
11207 /*FUNCTION:------------------------------------------------------
11208 * NAME
11209 * dissect_zbee_zcl_pwr_prof
11210 * DESCRIPTION
11211 * ZigBee ZCL Power Profile cluster dissector for wireshark.
11212 * PARAMETERS
11213 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11214 * packet_info *pinfo - pointer to packet information fields
11215 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11216 * void *data - pointer to ZCL packet structure.
11217 * RETURNS
11218 * int - length of parsed data.
11219 *---------------------------------------------------------------
11221 static int
11222 dissect_zbee_zcl_pwr_prof (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
11224 proto_tree *payload_tree;
11225 zbee_zcl_packet *zcl;
11226 unsigned offset = 0;
11227 uint8_t cmd_id;
11228 int rem_len;
11230 /* Reject the packet if data is NULL */
11231 if (data == NULL)
11232 return 0;
11233 zcl = (zbee_zcl_packet *)data;
11234 cmd_id = zcl->cmd_id;
11236 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
11237 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
11238 /* Append the command name to the info column. */
11239 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
11240 val_to_str_const(cmd_id, zbee_zcl_pwr_prof_srv_rx_cmd_names, "Unknown Command"),
11241 zcl->tran_seqno);
11243 /* Add the command ID. */
11244 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
11246 /* Check is this command has a payload, than add the payload tree */
11247 rem_len = tvb_reported_length_remaining(tvb, ++offset);
11248 if (rem_len > 0) {
11249 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_pwr_prof, NULL, "Payload");
11251 /* Call the appropriate command dissector */
11252 switch (cmd_id) {
11253 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_REQ:
11254 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_REQ:
11255 case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_REQ:
11256 dissect_zcl_pwr_prof_pwrprofreq(tvb, payload_tree, &offset);
11257 break;
11259 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_REQ:
11260 /* No payload */
11261 break;
11263 case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_RSP:
11264 case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT_RSP:
11265 dissect_zcl_pwr_prof_getpwrprofpricersp(tvb, payload_tree, &offset);
11266 break;
11268 case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE_RSP:
11269 dissect_zcl_pwr_prof_getoverallschedpricersp(tvb, payload_tree, &offset);
11270 break;
11272 case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_NOTIF:
11273 case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_RSP:
11274 dissect_zcl_pwr_prof_enphsschednotif(tvb, payload_tree, &offset);
11275 break;
11277 default:
11278 break;
11282 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
11283 /* Append the command name to the info column. */
11284 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
11285 val_to_str_const(cmd_id, zbee_zcl_pwr_prof_srv_tx_cmd_names, "Unknown Command"),
11286 zcl->tran_seqno);
11288 /* Add the command ID. */
11289 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
11291 /* Check is this command has a payload, than add the payload tree */
11292 rem_len = tvb_reported_length_remaining(tvb, ++offset);
11293 if (rem_len > 0) {
11294 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_pwr_prof, NULL, "Payload");
11296 /* Call the appropriate command dissector */
11297 switch (cmd_id) {
11298 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_NOTIF:
11299 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_RSP:
11300 dissect_zcl_pwr_prof_pwrprofnotif(tvb, payload_tree, &offset);
11301 break;
11303 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_RSP:
11304 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_NOTIF:
11305 dissect_zcl_pwr_prof_pwrprofstatersp(tvb, payload_tree, &offset);
11306 break;
11308 case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE:
11309 /* no payload */
11310 break;
11312 case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_RSP:
11313 case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_NOITIF:
11314 dissect_zcl_pwr_prof_enphsschednotif(tvb, payload_tree, &offset);
11315 break;
11317 case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE:
11318 case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_REQ:
11319 dissect_zcl_pwr_prof_pwrprofreq(tvb, payload_tree, &offset);
11320 break;
11322 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_NOTIF:
11323 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_RSP:
11324 dissect_zcl_pwr_prof_pwrprofschedcontrsnotif(tvb, payload_tree, &offset);
11325 break;
11327 case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT:
11328 dissect_zcl_pwr_prof_pwrprofpriceext(tvb, payload_tree, &offset);
11329 break;
11331 default:
11332 break;
11337 return tvb_captured_length(tvb);
11338 } /*dissect_zbee_zcl_pwr_prof*/
11340 /*FUNCTION:------------------------------------------------------
11341 * NAME
11342 * dissect_zcl_pwr_prof_pwrprofreq
11343 * DESCRIPTION
11344 * this function is called in order to decode "PowerProfileRequest",
11345 * "PowerProfileScheduleConstraintsRequest", "EnergyPhasesScheduleStateRequest",
11346 * "GetPowerProfilePrice" and "EnergyPhasesScheduleRequest" payload.
11347 * PARAMETERS
11348 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11349 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11350 * unsigned *offset - pointer to buffer offset
11351 * RETURNS
11352 * none
11353 *---------------------------------------------------------------
11355 static void
11356 dissect_zcl_pwr_prof_pwrprofreq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11358 /* Retrieve "Power Profile Id" field */
11359 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA);
11360 *offset += 1;
11362 } /*dissect_zcl_pwr_prof_pwrprofreq*/
11365 /*FUNCTION:------------------------------------------------------
11366 * NAME
11367 * dissect_zcl_pwr_prof_getpwrprofpricersp
11368 * DESCRIPTION
11369 * this function is called in order to decode "GetPowerProfilePriceResponse"
11370 * and "PowerProfilePriceExtendedResponse" payload.
11371 * PARAMETERS
11372 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11373 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11374 * unsigned *offset - pointer to buffer offset
11375 * RETURNS
11376 * none
11377 *---------------------------------------------------------------
11379 static void
11380 dissect_zcl_pwr_prof_getpwrprofpricersp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11382 /* Retrieve "Power Profile Id" field */
11383 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA);
11384 *offset += 1;
11386 /* Retrieve "Currency" field */
11387 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_currency, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
11388 *offset += 2;
11390 /* Retrieve "Price" field */
11391 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_price, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
11392 *offset += 4;
11394 /* Retrieve "Price Trailing Digit" field */
11395 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_price_trailing_digit, tvb, *offset, 1, ENC_NA);
11396 *offset += 1;
11398 } /*dissect_zcl_pwr_prof_getpwrprofpricersp*/
11401 /*FUNCTION:------------------------------------------------------
11402 * NAME
11403 * dissect_zcl_pwr_prof_getoverallschedpricersp
11404 * DESCRIPTION
11405 * this function is called in order to decode "GetOverallSchedulePriceResponse"
11406 * payload.
11407 * PARAMETERS
11408 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11409 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11410 * unsigned *offset - pointer to buffer offset
11411 * RETURNS
11412 * none
11413 *---------------------------------------------------------------
11415 static void
11416 dissect_zcl_pwr_prof_getoverallschedpricersp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11418 /* Retrieve "Currency" field */
11419 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_currency, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
11420 *offset += 2;
11422 /* Retrieve "Price" field */
11423 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_price, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
11424 *offset += 4;
11426 /* Retrieve "Price Trailing Digit" field */
11427 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_price_trailing_digit, tvb, *offset, 1, ENC_NA);
11428 *offset += 1;
11430 } /*dissect_zcl_pwr_prof_getoverallschedpricersp*/
11433 /*FUNCTION:------------------------------------------------------
11434 * NAME
11435 * dissect_zcl_sched_energy_phase
11436 * DESCRIPTION
11437 * this function is called in order to decode "ScheduledEnergyPhases"
11438 * element.
11439 * PARAMETERS
11440 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11441 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11442 * unsigned *offset - pointer to buffer offset
11443 * RETURNS
11444 * none
11445 *---------------------------------------------------------------
11447 static void
11448 dissect_zcl_sched_energy_phase(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11450 /* Energy Phase ID */
11451 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_energy_phase_id, tvb, *offset, 1, ENC_NA);
11452 *offset += 1;
11454 /* Scheduled Time */
11455 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_scheduled_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
11456 *offset += 2;
11458 } /*dissect_zcl_sched_energy_phase*/
11461 /*FUNCTION:------------------------------------------------------
11462 * NAME
11463 * dissect_zcl_pwr_prof_enphsschednotif
11464 * DESCRIPTION
11465 * this function is called in order to decode "EnergyPhasesScheduleNotification"
11466 * and "EnergyPhasesScheduleResoponse" payload.
11467 * PARAMETERS
11468 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11469 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11470 * unsigned *offset - pointer to buffer offset
11471 * RETURNS
11472 * none
11473 *---------------------------------------------------------------
11475 static void
11476 dissect_zcl_pwr_prof_enphsschednotif(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11478 proto_tree *sub_tree = NULL;
11480 unsigned i;
11481 uint8_t num_of_sched_phases;
11483 /* Retrieve "Power Profile Id" field */
11484 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA);
11485 *offset += 1;
11487 /* Retrieve "Number of Scheduled Phases" field */
11488 num_of_sched_phases = tvb_get_uint8(tvb, *offset);
11489 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_num_of_sched_phases, tvb, *offset, 1, ENC_NA);
11490 *offset += 1;
11492 /* Scheduled Energy Phases decoding */
11493 for (i=0 ; (i<num_of_sched_phases && i < ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT); i++) {
11494 /* Create subtree */
11495 sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 1,
11496 ett_zbee_zcl_pwr_prof_enphases[i], NULL, "Energy Phase #%u", i);
11498 dissect_zcl_sched_energy_phase(tvb, sub_tree, offset);
11500 } /*dissect_zcl_pwr_prof_enphsschednotif*/
11503 /*FUNCTION:------------------------------------------------------
11504 * NAME
11505 * dissect_zcl_energy_phase
11506 * DESCRIPTION
11507 * this function is called in order to decode "EnergyPhases"
11508 * element.
11509 * PARAMETERS
11510 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11511 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11512 * unsigned *offset - pointer to buffer offset
11513 * RETURNS
11514 * none
11515 *---------------------------------------------------------------
11517 static void
11518 dissect_zcl_energy_phase(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11520 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_energy_phase_id, tvb, *offset, 1, ENC_NA);
11521 *offset += 1;
11523 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_macro_phase_id, tvb, *offset, 1, ENC_NA);
11524 *offset += 1;
11526 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_expect_duration, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
11527 *offset += 2;
11529 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_peak_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
11530 *offset += 2;
11532 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_energy, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
11533 *offset += 2;
11535 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_max_active_delay, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
11536 *offset += 2;
11538 } /*dissect_zcl_energy_phase*/
11541 /*FUNCTION:------------------------------------------------------
11542 * NAME
11543 * dissect_zcl_pwr_prof_pwrprofnotif
11544 * DESCRIPTION
11545 * this function is called in order to decode "PowerProfileNotification"
11546 * and "PowerProfileResponse" payload.
11547 * PARAMETERS
11548 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11549 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11550 * unsigned *offset - pointer to buffer offset
11551 * RETURNS
11552 * none
11553 *---------------------------------------------------------------
11555 static void
11556 dissect_zcl_pwr_prof_pwrprofnotif(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11558 proto_tree *sub_tree = NULL;
11560 unsigned i;
11561 uint8_t total_profile_number;
11562 uint8_t num_of_transferred_phases;
11564 /* Retrieve "Total Profile Number" field */
11565 total_profile_number = tvb_get_uint8(tvb, *offset);
11566 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_tot_prof_num, tvb, *offset, 1, ENC_NA);
11567 *offset += 1;
11569 if ( total_profile_number != 0 ) {
11570 /* Retrieve "Power Profile Id" field */
11571 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA);
11572 *offset += 1;
11574 /* Retrieve "Number of Transferred Phases" field */
11575 num_of_transferred_phases = tvb_get_uint8(tvb, *offset);
11576 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_num_of_trans_phases, tvb, *offset, 1, ENC_NA);
11577 *offset += 1;
11579 /* Energy Phases decoding */
11580 for ( i=0 ; (i<num_of_transferred_phases && i < ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT); i++) {
11581 /* Create subtree */
11582 sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 1,
11583 ett_zbee_zcl_pwr_prof_enphases[i], NULL, "Energy Phase #%u", i);
11585 dissect_zcl_energy_phase(tvb, sub_tree, offset);
11591 /*FUNCTION:------------------------------------------------------
11592 * NAME
11593 * dissect_zcl_power_profile
11594 * DESCRIPTION
11595 * this function is called in order to decode "PowerProfile"
11596 * element.
11597 * PARAMETERS
11598 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11599 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11600 * unsigned *offset - pointer to buffer offset
11601 * RETURNS
11602 * none
11603 *---------------------------------------------------------------
11605 static void
11606 dissect_zcl_power_profile(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11608 /* Power Profile Id */
11609 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA);
11610 *offset += 1;
11612 /* Energy Phase Id */
11613 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_energy_phase_id, tvb, *offset, 1, ENC_NA);
11614 *offset += 1;
11616 /* Power Profile Remote Control */
11617 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_rem_ctrl, tvb, *offset, 1, ENC_NA);
11618 *offset += 1;
11620 /* Power Profile State */
11621 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_state, tvb, *offset, 1, ENC_NA);
11622 *offset += 1;
11624 } /*dissect_zcl_power_profile*/
11627 /*FUNCTION:------------------------------------------------------
11628 * NAME
11629 * dissect_zcl_pwr_prof_pwrprofstatersp
11630 * DESCRIPTION
11631 * this function is called in order to decode "PowerProfileStateResponse"
11632 * and "PowerProfileStateNotification" payload.
11633 * PARAMETERS
11634 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11635 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11636 * unsigned *offset - pointer to buffer offset
11637 * RETURNS
11638 * none
11639 *---------------------------------------------------------------
11641 static void
11642 dissect_zcl_pwr_prof_pwrprofstatersp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11644 proto_tree *sub_tree = NULL;
11646 unsigned i;
11647 uint8_t power_profile_count;
11649 /* Retrieve "Total Profile Number" field */
11650 power_profile_count = MIN(tvb_get_uint8(tvb, *offset), ZBEE_ZCL_PWR_PROF_NUM_PWR_PROF_ETT);
11651 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_count, tvb, *offset, 1, ENC_NA);
11652 *offset += 1;
11654 /* Energy Phases decoding */
11655 for (i=0 ; i<power_profile_count ; i++) {
11656 /* Create subtree */
11657 sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 1,
11658 ett_zbee_zcl_pwr_prof_pwrprofiles[i], NULL, "Power Profile #%u", i);
11660 dissect_zcl_power_profile(tvb, sub_tree, offset);
11662 } /*dissect_zcl_pwr_prof_pwrprofstatersp*/
11665 /*FUNCTION:------------------------------------------------------
11666 * NAME
11667 * dissect_zcl_pwr_prof_pwrprofschedcontrsnotif
11668 * DESCRIPTION
11669 * this function is called in order to decode "PowerProfileScheduleConstraintsNotification"
11670 * and "PowerProfileScheduleConstraintsResponse" payload.
11671 * PARAMETERS
11672 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11673 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11674 * unsigned *offset - pointer to buffer offset
11675 * RETURNS
11676 * none
11677 *---------------------------------------------------------------
11679 static void
11680 dissect_zcl_pwr_prof_pwrprofschedcontrsnotif(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11682 /* Retrieve "Power Profile Id" field */
11683 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA);
11684 *offset += 1;
11686 /* Retrieve "Start After" field */
11687 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_start_after, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
11688 *offset += 2;
11690 /* Retrieve "Stop Before" field */
11691 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_stop_before, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
11692 *offset += 2;
11694 } /*dissect_zcl_pwr_prof_pwrprofschedcontrsnotif*/
11697 /*FUNCTION:------------------------------------------------------
11698 * NAME
11699 * dissect_zcl_pwr_prof_pwrprofpriceext
11700 * DESCRIPTION
11701 * this function is called in order to decode "GetPowerProfilePriceExtended"
11702 * and "PowerProfileScheduleConstraintsResponse" payload.
11703 * PARAMETERS
11704 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11705 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11706 * unsigned *offset - pointer to buffer offset
11707 * RETURNS
11708 * none
11709 *---------------------------------------------------------------
11711 static void
11712 dissect_zcl_pwr_prof_pwrprofpriceext(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11714 static int * const options[] = {
11715 &hf_zbee_zcl_pwr_prof_options_01,
11716 &hf_zbee_zcl_pwr_prof_options_res,
11717 NULL
11720 /* Retrieve "Options" field */
11721 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_pwr_prof_options, ett_zbee_zcl_pwr_prof_options, options, ENC_NA);
11722 *offset += 1;
11724 /* Retrieve "Power Profile Id" field */
11725 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA);
11726 *offset += 1;
11728 /* Retrieve "Power Profile Start Time" field */
11729 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_stime, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
11730 *offset += 2;
11732 } /*dissect_zcl_pwr_prof_pwrprofpriceext*/
11735 /*FUNCTION:------------------------------------------------------
11736 * NAME
11737 * dissect_zcl_pwr_prof_attr_data
11738 * DESCRIPTION
11739 * this function is called by ZCL foundation dissector in order to decode
11740 * specific cluster attributes data.
11741 * PARAMETERS
11742 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11743 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11744 * unsigned *offset - pointer to buffer offset
11745 * uint16_t attr_id - attribute identifier
11746 * unsigned data_type - attribute data type
11747 * bool client_attr- ZCL client
11748 * RETURNS
11749 * none
11750 *---------------------------------------------------------------
11752 static void
11753 dissect_zcl_pwr_prof_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
11755 static int * const format_fields[] = {
11756 &hf_zbee_zcl_pwr_prof_energy_format_rdigit,
11757 &hf_zbee_zcl_pwr_prof_energy_format_ldigit,
11758 &hf_zbee_zcl_pwr_prof_energy_format_noleadingzero,
11759 NULL
11761 static int * const modes[] = {
11762 &hf_zbee_zcl_pwr_prof_sched_mode_cheapest,
11763 &hf_zbee_zcl_pwr_prof_sched_mode_greenest,
11764 &hf_zbee_zcl_pwr_prof_sched_mode_reserved,
11765 NULL
11768 /* Dissect attribute data type and data */
11769 switch ( attr_id )
11771 case ZBEE_ZCL_ATTR_ID_PWR_PROF_TOT_PROF_NUM:
11772 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_tot_prof_num, tvb, *offset, 1, ENC_NA);
11773 *offset += 1;
11774 break;
11776 case ZBEE_ZCL_ATTR_ID_PWR_PROF_MULTIPLE_SCHED:
11777 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_multiple_sched, tvb, *offset, 1, ENC_NA);
11778 *offset += 1;
11779 break;
11781 case ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_FORMAT:
11782 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_pwr_prof_energy_format, ett_zbee_zcl_pwr_prof_en_format, format_fields, ENC_NA);
11783 *offset += 1;
11784 break;
11786 case ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_REMOTE:
11787 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_energy_remote, tvb, *offset, 1, ENC_NA);
11788 *offset += 1;
11789 break;
11791 case ZBEE_ZCL_ATTR_ID_PWR_PROF_SCHED_MODE:
11792 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_pwr_prof_sched_mode, ett_zbee_zcl_pwr_prof_sched_mode, modes, ENC_NA);
11793 *offset += 1;
11794 break;
11796 default:
11797 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
11798 break;
11800 } /*dissect_zcl_pwr_prof_attr_data*/
11803 /*FUNCTION:------------------------------------------------------
11804 * NAME
11805 * decode_power_profile_id
11806 * DESCRIPTION
11807 * this function decodes the power profile custom type
11808 * PARAMETERS
11809 * unsigned *s - string to display
11810 * uint16_t value - value to decode
11811 * RETURNS
11812 * none
11813 *---------------------------------------------------------------
11815 static void
11816 decode_power_profile_id(char *s, uint8_t id)
11818 if (id == 0) {
11819 snprintf(s, ITEM_LABEL_LENGTH, "%d (All)", id);
11821 else {
11822 snprintf(s, ITEM_LABEL_LENGTH, "%d", id);
11824 } /*decode_power_profile_id*/
11827 /*FUNCTION:------------------------------------------------------
11828 * NAME
11829 * decode_price_in_cents
11830 * DESCRIPTION
11831 * this function decodes price type variable
11832 * PARAMETERS
11833 * unsigned *s - string to display
11834 * uint16_t value - value to decode
11835 * RETURNS
11836 * none
11837 *---------------------------------------------------------------
11839 static void
11840 decode_price_in_cents(char *s, uint32_t value)
11842 snprintf(s, ITEM_LABEL_LENGTH, "%d cents", value);
11843 } /* decode_price_in_cents */
11846 /*FUNCTION:------------------------------------------------------
11847 * NAME
11848 * decode_power_in_watt
11849 * DESCRIPTION
11850 * this function decodes watt power type variable
11851 * PARAMETERS
11852 * unsigned *s - string to display
11853 * uint16_t value - value to decode
11854 * RETURNS
11855 * none
11856 *---------------------------------------------------------------
11858 static void
11859 decode_power_in_watt(char *s, uint16_t value)
11861 snprintf(s, ITEM_LABEL_LENGTH, "%d Watt", value);
11862 } /* decode_power_in_watt */
11864 /*FUNCTION:------------------------------------------------------
11865 * NAME
11866 * decode_energy
11867 * DESCRIPTION
11868 * this function decodes energy type variable
11869 * PARAMETERS
11870 * unsigned *s - string to display
11871 * uint16_t value - value to decode
11872 * RETURNS
11873 * none
11874 *---------------------------------------------------------------
11876 static void
11877 decode_energy(char *s, uint16_t value)
11879 snprintf(s, ITEM_LABEL_LENGTH, "%d Watt per hours", value);
11880 } /* decode_energy */
11882 /*FUNCTION:------------------------------------------------------
11883 * NAME
11884 * func_decode_delayinminute
11885 * DESCRIPTION
11886 * this function decodes minute delay type variable
11887 * PARAMETERS
11888 * unsigned *s - string to display
11889 * uint16_t value - value to decode
11890 * RETURNS
11891 * none
11892 *---------------------------------------------------------------
11894 static void
11895 func_decode_delayinminute(char *s, uint16_t value)
11897 if (value == 0) {
11898 snprintf(s, ITEM_LABEL_LENGTH, "%d minutes (Not permitted)", value);
11900 else {
11901 snprintf(s, ITEM_LABEL_LENGTH, "%d minutes", value);
11904 } /* func_decode_delayinminute*/
11907 /*FUNCTION:------------------------------------------------------
11908 * NAME
11909 * proto_register_zbee_zcl_pwr_prof
11910 * DESCRIPTION
11911 * ZigBee ZCL PowerProfile cluster protocol registration routine.
11912 * PARAMETERS
11913 * none
11914 * RETURNS
11915 * void
11916 *---------------------------------------------------------------
11918 void
11919 proto_register_zbee_zcl_pwr_prof(void)
11921 unsigned i, j;
11923 static hf_register_info hf[] = {
11925 { &hf_zbee_zcl_pwr_prof_tot_prof_num,
11926 { "Total Profile Number", "zbee_zcl_general.pwrprof.attr.totprofnum", FT_UINT8, BASE_DEC, NULL, 0x0,
11927 NULL, HFILL } },
11929 { &hf_zbee_zcl_pwr_prof_multiple_sched,
11930 { "Multiple Scheduling", "zbee_zcl_general.pwrprof.attr.multiplesched", FT_BOOLEAN, BASE_NONE,
11931 TFS(&tfs_supported_not_supported), 0x0, NULL, HFILL } },
11933 /* Begin EnergyFormatting fields */
11934 { &hf_zbee_zcl_pwr_prof_energy_format,
11935 { "Data", "zbee_zcl_general.pwrprof.attr.energyformat",
11936 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
11938 { &hf_zbee_zcl_pwr_prof_energy_format_rdigit,
11939 { "Number of Digits to the right of the Decimal Point", "zbee_zcl_general.pwrprof.attr.energyformat.rdigit",
11940 FT_UINT8, BASE_DEC, NULL, ZBEE_ZCL_OPT_PWRPROF_NUM_R_DIGIT, NULL, HFILL } },
11942 { &hf_zbee_zcl_pwr_prof_energy_format_ldigit,
11943 { "Number of Digits to the left of the Decimal Point", "zbee_zcl_general.pwrprof.attr.energyformat.ldigit",
11944 FT_UINT8, BASE_DEC, NULL, ZBEE_ZCL_OPT_PWRPROF_NUM_L_DIGIT, NULL, HFILL } },
11946 { &hf_zbee_zcl_pwr_prof_energy_format_noleadingzero,
11947 { "Suppress leading zeros.", "zbee_zcl_general.pwrprof.attr.energyformat.noleadingzero",
11948 FT_BOOLEAN, 8, NULL, ZBEE_ZCL_OPT_PWRPROF_NO_LEADING_ZERO, NULL, HFILL } },
11949 /* End EnergyFormatting fields */
11951 { &hf_zbee_zcl_pwr_prof_energy_remote,
11952 { "Energy Remote", "zbee_zcl_general.pwrprof.attr.energyremote", FT_BOOLEAN, BASE_NONE,
11953 TFS(&tfs_enabled_disabled), 0x0, NULL, HFILL } },
11955 /* Begin ScheduleMode fields */
11956 { &hf_zbee_zcl_pwr_prof_sched_mode,
11957 { "Schedule Mode", "zbee_zcl_general.pwrprof.attr.schedmode",
11958 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
11960 { &hf_zbee_zcl_pwr_prof_sched_mode_cheapest,
11961 { "Schedule Mode Cheapest", "zbee_zcl_general.pwrprof.attr.schedmode.cheapest",
11962 FT_BOOLEAN, 8, TFS(&tfs_active_inactive), ZBEE_ZCL_OPT_PWRPROF_SCHED_CHEAPEST, NULL, HFILL } },
11964 { &hf_zbee_zcl_pwr_prof_sched_mode_greenest,
11965 { "Schedule Mode Greenest", "zbee_zcl_general.pwrprof.attr.schedmode.greenest",
11966 FT_BOOLEAN, 8, TFS(&tfs_active_inactive), ZBEE_ZCL_OPT_PWRPROF_SCHED_GREENEST, NULL, HFILL } },
11968 { &hf_zbee_zcl_pwr_prof_sched_mode_reserved,
11969 { "Schedule Mode Reserved", "zbee_zcl_general.pwrprof.attr.schedmode.reserved",
11970 FT_UINT8, BASE_HEX, NULL, ZBEE_ZCL_OPT_PWRPROF_SCHED_RESERVED, NULL, HFILL } },
11971 /* End ScheduleMode fields */
11973 { &hf_zbee_zcl_pwr_prof_attr_id,
11974 { "Attribute", "zbee_zcl_general.pwrprof.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_pwr_prof_attr_names),
11975 0x0, NULL, HFILL } },
11977 { &hf_zbee_zcl_pwr_prof_srv_tx_cmd_id,
11978 { "Command", "zbee_zcl_general.pwrprof.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_pwr_prof_srv_tx_cmd_names),
11979 0x0, NULL, HFILL } },
11981 { &hf_zbee_zcl_pwr_prof_srv_rx_cmd_id,
11982 { "Command", "zbee_zcl_general.pwrprof.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_pwr_prof_srv_rx_cmd_names),
11983 0x0, NULL, HFILL } },
11985 { &hf_zbee_zcl_pwr_prof_pwr_prof_id,
11986 { "Power Profile ID", "zbee_zcl_general.pwrprof.pwrprofid", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_profile_id), 0x00,
11987 "Identifier of the specific profile", HFILL } },
11989 { &hf_zbee_zcl_pwr_prof_currency,
11990 { "Currency", "zbee_zcl_general.pwrprof.currency", FT_UINT16, BASE_HEX, VALS(zbee_zcl_currecy_names), 0x0,
11991 "Local unit of currency (ISO 4217) used in the price field.", HFILL } },
11993 { &hf_zbee_zcl_pwr_prof_price,
11994 { "Price", "zbee_zcl_general.pwrprof.price", FT_UINT32, BASE_CUSTOM, CF_FUNC(decode_price_in_cents), 0x0,
11995 "Price of the energy of a specific Power Profile.", HFILL } },
11997 { &hf_zbee_zcl_pwr_prof_price_trailing_digit,
11998 { "Price Trailing Digit", "zbee_zcl_general.pwrprof.pricetrailingdigit", FT_UINT8, BASE_DEC, NULL, 0x0,
11999 "Number of digits to the right of the decimal point.", HFILL } },
12001 { &hf_zbee_zcl_pwr_prof_num_of_sched_phases,
12002 { "Number of Scheduled Phases", "zbee_zcl_general.pwrprof.numofschedphases", FT_UINT8, BASE_DEC, NULL, 0x0,
12003 "Total number of the energy phases of the Power Profile that need to be scheduled.", HFILL } },
12005 { &hf_zbee_zcl_pwr_prof_energy_phase_id,
12006 { "Energy Phase ID", "zbee_zcl_general.pwrprof.energyphaseid", FT_UINT8, BASE_DEC, NULL, 0x0,
12007 "Identifier of the specific phase.", HFILL } },
12009 { &hf_zbee_zcl_pwr_prof_scheduled_time,
12010 { "Scheduled Time", "zbee_zcl_general.pwrprof.scheduledtime", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_minutes), 0x0,
12011 NULL, HFILL } },
12013 { &hf_zbee_zcl_pwr_prof_macro_phase_id,
12014 { "Macro Phase ID", "zbee_zcl_general.pwrprof.macrophaseid", FT_UINT8, BASE_DEC, NULL, 0x0,
12015 "Identifier of the specific energy phase.", HFILL } },
12017 { &hf_zbee_zcl_pwr_prof_expect_duration,
12018 { "Expected Duration", "zbee_zcl_general.pwrprof.expectduration", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_minutes), 0x0,
12019 "The estimated duration of the specific phase.", HFILL } },
12021 { &hf_zbee_zcl_pwr_prof_num_of_trans_phases,
12022 { "Number of Transferred Phases", "zbee_zcl_general.pwrprof.numoftransphases", FT_UINT8, BASE_DEC, NULL, 0x0,
12023 NULL, HFILL } },
12025 { &hf_zbee_zcl_pwr_prof_peak_power,
12026 { "Peak Power", "zbee_zcl_general.pwrprof.peakpower", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_power_in_watt), 0x0,
12027 "The estimated power for the specific phase.", HFILL } },
12029 { &hf_zbee_zcl_pwr_prof_energy,
12030 { "Energy", "zbee_zcl_general.pwrprof.energy", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_energy), 0x0,
12031 "The estimated energy consumption for the accounted phase.", HFILL } },
12033 { &hf_zbee_zcl_pwr_prof_max_active_delay,
12034 { "Max Activation Delay", "zbee_zcl_general.pwrprof.maxactivdelay", FT_UINT16, BASE_CUSTOM, CF_FUNC(func_decode_delayinminute), 0x0,
12035 "The maximum interruption time between the end of the previous phase and the beginning of the specific phase.", HFILL } },
12037 { &hf_zbee_zcl_pwr_prof_pwr_prof_count,
12038 { "Power Profile Count", "zbee_zcl_general.pwrprof.pwrprofcount", FT_UINT8, BASE_DEC, NULL, 0x0,
12039 NULL, HFILL } },
12041 { &hf_zbee_zcl_pwr_prof_pwr_prof_rem_ctrl,
12042 { "Power Profile Remote Control", "zbee_zcl_general.pwrprof.pwrprofremctrl", FT_BOOLEAN, BASE_NONE, TFS(&tfs_enabled_disabled), 0x00,
12043 "It indicates if the PowerProfile is currently remotely controllable or not.", HFILL } },
12045 { &hf_zbee_zcl_pwr_prof_pwr_prof_state,
12046 { "Power Profile State", "zbee_zcl_general.pwrprof.pwrprofstate", FT_UINT8, BASE_HEX, VALS(zbee_zcl_pwr_prof_state_names),
12047 0x0, NULL, HFILL } },
12049 { &hf_zbee_zcl_pwr_prof_start_after,
12050 { "Start After", "zbee_zcl_general.pwrprof.startafter", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_minutes), 0x0,
12051 NULL, HFILL } },
12053 { &hf_zbee_zcl_pwr_prof_stop_before,
12054 { "Stop Before", "zbee_zcl_general.pwrprof.stopbefore", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_minutes), 0x0,
12055 NULL, HFILL } },
12057 /* Begin Options fields */
12058 { &hf_zbee_zcl_pwr_prof_options,
12059 { "Options", "zbee_zcl_general.pwrprof.options", FT_UINT8, BASE_HEX, NULL,
12060 0x0, NULL, HFILL } },
12062 { &hf_zbee_zcl_pwr_prof_options_01,
12063 { "PowerProfileStartTime Field Present", "zbee_zcl_general.pwrprof.options.01", FT_BOOLEAN, 8, NULL,
12064 ZBEE_ZCL_OPT_PWRPROF_STIME_PRESENT, NULL, HFILL } },
12066 { &hf_zbee_zcl_pwr_prof_options_res,
12067 { "Reserved", "zbee_zcl_general.pwrprof.options.reserved", FT_UINT8, BASE_HEX, NULL,
12068 ZBEE_ZCL_OPT_PWRPROF_RESERVED, NULL, HFILL } },
12069 /* End Options fields */
12071 { &hf_zbee_zcl_pwr_prof_pwr_prof_stime,
12072 { "Power Profile Start Time", "zbee_zcl_general.pwrprof.pwrprofstime", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_minutes), 0x0,
12073 NULL, HFILL } }
12077 /* ZCL PowerProfile subtrees */
12078 static int *ett[ZBEE_ZCL_PWR_PROF_NUM_ETT] = {
12079 &ett_zbee_zcl_pwr_prof,
12080 &ett_zbee_zcl_pwr_prof_options,
12081 &ett_zbee_zcl_pwr_prof_en_format,
12082 &ett_zbee_zcl_pwr_prof_sched_mode
12085 /* initialize attribute subtree types */
12086 for ( i = 0, j = ZBEE_ZCL_PWR_PROF_NUM_GENERIC_ETT; i < ZBEE_ZCL_PWR_PROF_NUM_PWR_PROF_ETT; i++, j++ ) {
12087 ett[j] = &ett_zbee_zcl_pwr_prof_pwrprofiles[i];
12090 for ( i = 0; i < ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT; i++, j++ ) {
12091 ett[j] = &ett_zbee_zcl_pwr_prof_enphases[i];
12094 /* Register the ZigBee ZCL PowerProfile cluster protocol name and description */
12095 proto_zbee_zcl_pwr_prof = proto_register_protocol("ZigBee ZCL Power Profile", "ZCL Power Profile", ZBEE_PROTOABBREV_ZCL_PWRPROF);
12096 proto_register_field_array(proto_zbee_zcl_pwr_prof, hf, array_length(hf));
12097 proto_register_subtree_array(ett, array_length(ett));
12099 /* Register the ZigBee ZCL Power Profile dissector. */
12100 register_dissector(ZBEE_PROTOABBREV_ZCL_PWRPROF, dissect_zbee_zcl_pwr_prof, proto_zbee_zcl_pwr_prof);
12101 } /* proto_register_zbee_zcl_pwr_prof */
12104 /*FUNCTION:------------------------------------------------------
12105 * NAME
12106 * proto_reg_handoff_zbee_zcl_pwr_prof
12107 * DESCRIPTION
12108 * Hands off the Zcl Power Profile cluster dissector.
12109 * PARAMETERS
12110 * none
12111 * RETURNS
12112 * void
12113 *---------------------------------------------------------------
12115 void
12116 proto_reg_handoff_zbee_zcl_pwr_prof(void)
12118 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_PWRPROF,
12119 proto_zbee_zcl_pwr_prof,
12120 ett_zbee_zcl_pwr_prof,
12121 ZBEE_ZCL_CID_POWER_PROFILE,
12122 ZBEE_MFG_CODE_NONE,
12123 hf_zbee_zcl_pwr_prof_attr_id,
12124 hf_zbee_zcl_pwr_prof_attr_id,
12125 hf_zbee_zcl_pwr_prof_srv_rx_cmd_id,
12126 hf_zbee_zcl_pwr_prof_srv_tx_cmd_id,
12127 (zbee_zcl_fn_attr_data)dissect_zcl_pwr_prof_attr_data
12129 } /*proto_reg_handoff_zbee_zcl_pwr_prof*/
12131 /* ########################################################################## */
12132 /* #### (0x001B) APPLIANCE CONTROL CLUSTER ################################## */
12133 /* ########################################################################## */
12135 /*************************/
12136 /* Defines */
12137 /*************************/
12139 #define ZBEE_ZCL_APPL_CTRL_NUM_GENERIC_ETT 3
12140 #define ZBEE_ZCL_APPL_CTRL_NUM_FUNC_ETT 32
12141 #define ZBEE_ZCL_APPL_CTRL_NUM_ETT (ZBEE_ZCL_APPL_CTRL_NUM_GENERIC_ETT + \
12142 ZBEE_ZCL_APPL_CTRL_NUM_FUNC_ETT)
12144 /* Attributes */
12145 #define ZBEE_ZCL_ATTR_ID_APPL_CTRL_START_TIME 0x0000 /* Start Time */
12146 #define ZBEE_ZCL_ATTR_ID_APPL_CTRL_FINISH_TIME 0x0001 /* Finish Time */
12147 #define ZBEE_ZCL_ATTR_ID_APPL_CTRL_REMAINING_TIME 0x0002 /* Remaining Time */
12149 /* Server Commands Received */
12150 #define ZBEE_ZCL_CMD_ID_APPL_CTRL_EXECUTION_CMD 0x00 /* Execution of a Command */
12151 #define ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE 0x01 /* Signal State */
12152 #define ZBEE_ZCL_CMD_ID_APPL_CTRL_WRITE_FUNCS 0x02 /* Write Functions */
12153 #define ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE_RESUME 0x03 /* Overload Pause Resume */
12154 #define ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE 0x04 /* Overload Pause */
12155 #define ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_WARNING 0x05 /* Overload Warning */
12157 /* Server Commands Generated */
12158 #define ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_RSP 0x00 /* Signal State Response */
12159 #define ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_NOTIF 0x01 /* Signal State Notification */
12161 /* Execution Of a Command - Command Ids list */
12162 #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_RESERVED 0x00 /* Reserved */
12163 #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START 0x01 /* Start appliance cycle */
12164 #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP 0x02 /* Stop appliance cycle */
12165 #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_PAUSE 0x03 /* Pause appliance cycle */
12166 #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START_SUPERFREEZING 0x04 /* Start superfreezing cycle */
12167 #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP_SUPERFREEZING 0x05 /* Stop superfreezing cycle */
12168 #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START_SUPERCOOLING 0x06 /* Start supercooling cycle */
12169 #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP_SUPERCOOLING 0x07 /* Stop supercooling cycle */
12170 #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_DISABLE_GAS 0x08 /* Disable gas */
12171 #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_ENABLE_GAS 0x09 /* Enable gas */
12173 /* CECED Time mask */
12174 #define ZBEE_ZCL_APPL_CTRL_TIME_MM 0x003f /* Minutes */
12175 #define ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_TYPE 0x00c0 /* Encoding Type */
12176 #define ZBEE_ZCL_APPL_CTRL_TIME_HH 0xff00 /* Hours */
12178 /* Time encoding values */
12179 #define ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_REL 0x00
12180 #define ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_ABS 0x01
12182 /* Overload Warnings */
12183 #define ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_1 0x00
12184 #define ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_2 0x01
12185 #define ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_3 0x02
12186 #define ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_4 0x03
12187 #define ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_5 0x04
12189 /* Appliance Status Ids list */
12190 #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_RESERVED 0x00 /* Reserved */
12191 #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_OFF 0x01 /* Appliance in off state */
12192 #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_STANDBY 0x02 /* Appliance in stand-by */
12193 #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG 0x03 /* Appliance already programmed */
12194 #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG_WAITING_TO_START 0x04 /* Appliance already programmed and ready to start */
12195 #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_RUNNING 0x05 /* Appliance is running */
12196 #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_PAUSE 0x06 /* Appliance is in pause */
12197 #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_END_PRG 0x07 /* Appliance end programmed tasks */
12198 #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_FAILURE 0x08 /* Appliance is in a failure state */
12199 #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG_INTERRUPTED 0x09 /* The appliance programmed tasks have been interrupted */
12200 #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_IDLE 0x1a /* Appliance in idle state */
12201 #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_RINSE_HOLD 0x1b /* Appliance rinse hold */
12202 #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_SERVICE 0x1c /* Appliance in service state */
12203 #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERFREEZING 0x1d /* Appliance in superfreezing state */
12204 #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERCOOLING 0x1e /* Appliance in supercooling state */
12205 #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERHEATING 0x1f /* Appliance in superheating state */
12207 /* Remote Enable Flags mask */
12208 #define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_FLAGS 0x0f
12209 #define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_STATUS2 0xf0
12211 /* Remote Enable Flags values */
12212 #define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_DIS 0x00 /* Disabled */
12213 #define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_EN_REM_EN_CTRL 0x01 /* Enable Remote and Energy Control */
12214 #define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_TEMP_LOCK_DIS 0x07 /* Temporarily locked/disabled */
12215 #define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_EN_REM_CTRL 0x0f /* Enable Remote Control */
12217 /* Device Status 2 values */
12218 #define ZBEE_ZCL_APPL_CTRL_STATUS2_PROPRIETARY_0 0x00 /* Proprietary */
12219 #define ZBEE_ZCL_APPL_CTRL_STATUS2_PROPRIETARY_1 0x01 /* Proprietary */
12220 #define ZBEE_ZCL_APPL_CTRL_STATUS2_IRIS_SYMPTOM_CODE 0x02 /* Iris symptom code */
12222 /*************************/
12223 /* Function Declarations */
12224 /*************************/
12226 void proto_register_zbee_zcl_appl_ctrl(void);
12227 void proto_reg_handoff_zbee_zcl_appl_ctrl(void);
12229 /* Command Dissector Helpers */
12230 static void dissect_zcl_appl_ctrl_exec_cmd (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
12231 static void dissect_zcl_appl_ctrl_attr_func (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
12232 static void dissect_zcl_appl_ctrl_wr_funcs (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
12233 static void dissect_zcl_appl_ctrl_ovrl_warning (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
12234 static void dissect_zcl_appl_ctrl_signal_state_rsp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
12236 static void dissect_zcl_appl_ctrl_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
12238 /* Private functions prototype */
12240 /*************************/
12241 /* Global Variables */
12242 /*************************/
12243 /* Initialize the protocol and registered fields */
12244 static int proto_zbee_zcl_appl_ctrl;
12246 static int hf_zbee_zcl_appl_ctrl_attr_id;
12247 static int hf_zbee_zcl_appl_ctrl_time;
12248 static int hf_zbee_zcl_appl_ctrl_time_mm;
12249 static int hf_zbee_zcl_appl_ctrl_time_encoding_type;
12250 static int hf_zbee_zcl_appl_ctrl_time_hh;
12251 static int hf_zbee_zcl_appl_ctrl_srv_tx_cmd_id;
12252 static int hf_zbee_zcl_appl_ctrl_srv_rx_cmd_id;
12253 static int hf_zbee_zcl_appl_ctrl_exec_cmd_id;
12254 static int hf_zbee_zcl_appl_ctrl_attr_func_id;
12255 static int hf_zbee_zcl_appl_ctrl_attr_func_data_type;
12256 static int hf_zbee_zcl_appl_ctrl_warning_id;
12257 static int hf_zbee_zcl_appl_ctrl_appl_status;
12258 static int hf_zbee_zcl_appl_ctrl_rem_en_flags_raw;
12259 static int hf_zbee_zcl_appl_ctrl_rem_en_flags;
12260 static int hf_zbee_zcl_appl_ctrl_status2;
12261 static int hf_zbee_zcl_appl_ctrl_status2_array;
12263 /* Initialize the subtree pointers */
12264 static int ett_zbee_zcl_appl_ctrl;
12265 static int ett_zbee_zcl_appl_ctrl_flags;
12266 static int ett_zbee_zcl_appl_ctrl_time;
12267 static int ett_zbee_zcl_appl_ctrl_func[ZBEE_ZCL_APPL_CTRL_NUM_FUNC_ETT];
12269 /* Attributes */
12270 static const value_string zbee_zcl_appl_ctrl_attr_names[] = {
12271 { ZBEE_ZCL_ATTR_ID_APPL_CTRL_START_TIME, "Start Time" },
12272 { ZBEE_ZCL_ATTR_ID_APPL_CTRL_FINISH_TIME, "Finish Time" },
12273 { ZBEE_ZCL_ATTR_ID_APPL_CTRL_REMAINING_TIME, "Remaining Time" },
12274 { 0, NULL }
12276 static value_string_ext zbee_zcl_appl_ctrl_attr_names_ext = VALUE_STRING_EXT_INIT(zbee_zcl_appl_ctrl_attr_names);
12278 /* Server Commands Received */
12279 static const value_string zbee_zcl_appl_ctrl_srv_rx_cmd_names[] = {
12280 { ZBEE_ZCL_CMD_ID_APPL_CTRL_EXECUTION_CMD, "Execution of a Command" },
12281 { ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE, "Signal State" },
12282 { ZBEE_ZCL_CMD_ID_APPL_CTRL_WRITE_FUNCS, "Write Functions" },
12283 { ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE_RESUME, "Overload Pause Resume" },
12284 { ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE, "Overload Pause" },
12285 { ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_WARNING, "Overload Warning" },
12286 { 0, NULL }
12289 /* Server Commands Generated */
12290 static const value_string zbee_zcl_appl_ctrl_srv_tx_cmd_names[] = {
12291 { ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_RSP, "Signal State Response" },
12292 { ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_NOTIF, "Signal State Notification" },
12293 { 0, NULL }
12296 /* Execution Of a Command - Command Name */
12297 static const value_string zbee_zcl_appl_ctrl_exec_cmd_names[] = {
12298 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_RESERVED, "Reserved" },
12299 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START, "Start" },
12300 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP, "Stop" },
12301 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_PAUSE, "Pause" },
12302 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START_SUPERFREEZING, "Start Superfreezing" },
12303 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP_SUPERFREEZING, "Stop Superfreezing" },
12304 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START_SUPERCOOLING, "Start Supercooling" },
12305 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP_SUPERCOOLING, "Stop Supercooling" },
12306 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_DISABLE_GAS, "Disable Gas" },
12307 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_ENABLE_GAS, "Enable Gas" },
12308 { 0, NULL }
12311 /* Appliance Status Names list */
12312 static const value_string zbee_zcl_appl_ctrl_appl_status_names[] = {
12313 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_RESERVED, "Reserved" },
12314 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_OFF, "Off" },
12315 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_STANDBY, "Stand-by" },
12316 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG, "Programmed" },
12317 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG_WAITING_TO_START, "Waiting to Start" },
12318 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_RUNNING, "Running" },
12319 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_PAUSE, "Pause" },
12320 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_END_PRG, "End Programmed" },
12321 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_FAILURE, "Failure" },
12322 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG_INTERRUPTED, "Programming Interrupted" },
12323 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_IDLE, "Idle" },
12324 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_RINSE_HOLD, "Raise Hold" },
12325 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_SERVICE, "Service" },
12326 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERFREEZING, "Superfreezing" },
12327 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERCOOLING, "Supercooling" },
12328 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERHEATING, "Superheating" },
12329 { 0, NULL }
12332 /* Remote Enable Flags Names list */
12333 static const value_string zbee_zcl_appl_ctrl_rem_flags_names[] = {
12334 { ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_DIS, "Disable" },
12335 { ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_EN_REM_EN_CTRL, "Enable Remote and Energy Control" },
12336 { ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_TEMP_LOCK_DIS, "Temporarily locked/disabled" },
12337 { ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_EN_REM_CTRL, "Enable Remote Control" },
12338 { 0, NULL }
12341 /* Appliance Status 2 Names list */
12342 static const value_string zbee_zcl_appl_ctrl_status2_names[] = {
12343 { ZBEE_ZCL_APPL_CTRL_STATUS2_PROPRIETARY_0, "Proprietary" },
12344 { ZBEE_ZCL_APPL_CTRL_STATUS2_PROPRIETARY_1, "Proprietary" },
12345 { ZBEE_ZCL_APPL_CTRL_STATUS2_IRIS_SYMPTOM_CODE, "Iris symptom code" },
12346 { 0, NULL }
12349 /* Overload Warning Names list */
12350 static const value_string zbee_zcl_appl_ctrl_ovrl_warning_names[] = {
12351 { ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_1, "Overall power above 'available power' level" },
12352 { ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_2, "Overall power above 'power threshold' level" },
12353 { ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_3, "Overall power back below the 'available power' level" },
12354 { ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_4, "Overall power back below the 'power threshold' level" },
12355 { ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_5, "Overall power will be potentially above 'available power' level if the appliance starts" },
12356 { 0, NULL }
12359 /* CEDEC Time Encoding Names list */
12360 static const value_string zbee_zcl_appl_ctrl_time_encoding_type_names[] = {
12361 { ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_REL, "Relative" },
12362 { ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_ABS, "Absolute" },
12363 { 0, NULL }
12366 /*************************/
12367 /* Function Bodies */
12368 /*************************/
12370 /*FUNCTION:------------------------------------------------------
12371 * NAME
12372 * dissect_zbee_zcl_appl_ctrl
12373 * DESCRIPTION
12374 * ZigBee ZCL Appliance Control cluster dissector for wireshark.
12375 * PARAMETERS
12376 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12377 * packet_info *pinfo - pointer to packet information fields
12378 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12379 * void *data - pointer to ZCL packet structure.
12380 * RETURNS
12381 * int - length of parsed data.
12382 *---------------------------------------------------------------
12384 static int
12385 dissect_zbee_zcl_appl_ctrl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
12387 proto_tree *payload_tree;
12388 zbee_zcl_packet *zcl;
12389 unsigned offset = 0;
12390 uint8_t cmd_id;
12391 int rem_len;
12393 /* Reject the packet if data is NULL */
12394 if (data == NULL)
12395 return 0;
12396 zcl = (zbee_zcl_packet *)data;
12397 cmd_id = zcl->cmd_id;
12399 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
12400 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
12401 /* Append the command name to the info column. */
12402 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
12403 val_to_str_const(cmd_id, zbee_zcl_appl_ctrl_srv_rx_cmd_names, "Unknown Command"),
12404 zcl->tran_seqno);
12406 /* Add the command ID. */
12407 proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
12409 /* Check is this command has a payload, than add the payload tree */
12410 rem_len = tvb_reported_length_remaining(tvb, ++offset);
12411 if (rem_len > 0) {
12412 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_appl_ctrl, NULL, "Payload");
12414 /* Call the appropriate command dissector */
12415 switch (cmd_id) {
12416 case ZBEE_ZCL_CMD_ID_APPL_CTRL_EXECUTION_CMD:
12417 dissect_zcl_appl_ctrl_exec_cmd(tvb, payload_tree, &offset);
12418 break;
12420 case ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE:
12421 case ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE_RESUME:
12422 case ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE:
12423 /* No payload */
12424 break;
12426 case ZBEE_ZCL_CMD_ID_APPL_CTRL_WRITE_FUNCS:
12427 dissect_zcl_appl_ctrl_wr_funcs(tvb, payload_tree, &offset);
12428 break;
12430 case ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_WARNING:
12431 dissect_zcl_appl_ctrl_ovrl_warning(tvb, payload_tree, &offset);
12432 break;
12434 default:
12435 break;
12439 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
12440 /* Append the command name to the info column. */
12441 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
12442 val_to_str_const(cmd_id, zbee_zcl_appl_ctrl_srv_tx_cmd_names, "Unknown Command"),
12443 zcl->tran_seqno);
12445 /* Add the command ID. */
12446 proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
12448 /* Check is this command has a payload, than add the payload tree */
12449 rem_len = tvb_reported_length_remaining(tvb, ++offset);
12450 if (rem_len > 0) {
12451 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_appl_ctrl, NULL, "Payload");
12453 /* Call the appropriate command dissector */
12454 switch (cmd_id) {
12455 case ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_RSP:
12456 case ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_NOTIF:
12457 dissect_zcl_appl_ctrl_signal_state_rsp(tvb, payload_tree, &offset);
12458 break;
12460 default:
12461 break;
12466 return tvb_captured_length(tvb);
12470 /*FUNCTION:------------------------------------------------------
12471 * NAME
12472 * dissect_zcl_appl_ctrl_exec_cmd
12473 * DESCRIPTION
12474 * this function is called in order to decode "ExecutionOfACommand"
12475 * payload.
12476 * PARAMETERS
12477 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12478 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12479 * unsigned *offset - pointer to buffer offset
12480 * RETURNS
12481 * none
12482 *---------------------------------------------------------------
12484 static void
12485 dissect_zcl_appl_ctrl_exec_cmd(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
12487 /* Retrieve "Command Id" field */
12488 proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_exec_cmd_id, tvb, *offset, 1, ENC_NA);
12489 *offset += 1;
12490 } /*dissect_zcl_appl_ctrl_exec_cmd*/
12493 /*FUNCTION:------------------------------------------------------
12494 * NAME
12495 * dissect_zcl_appl_ctrl_attr_func
12496 * DESCRIPTION
12497 * this function is called in order to decode "Function" element.
12498 * PARAMETERS
12499 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12500 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12501 * unsigned *offset - pointer to buffer offset
12502 * RETURNS
12503 * none
12504 *---------------------------------------------------------------
12506 static void
12507 dissect_zcl_appl_ctrl_attr_func(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
12509 uint8_t func_data_type;
12510 uint16_t func_id;
12512 /* ID */
12513 func_id = tvb_get_letohs(tvb, *offset);
12514 proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_attr_func_id, tvb, *offset, 2,ENC_LITTLE_ENDIAN);
12515 *offset += 2;
12517 proto_item_append_text(tree, ", %s",
12518 val_to_str_ext_const(func_id, &zbee_zcl_appl_ctrl_attr_names_ext, "Reserved"));
12520 /* Data Type */
12521 func_data_type = tvb_get_uint8(tvb, *offset);
12522 proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_attr_func_data_type, tvb, *offset, 1, ENC_NA);
12523 *offset += 1;
12525 /* Function Data Dissector */
12526 dissect_zcl_appl_ctrl_attr_data(tree, tvb, offset, func_id, func_data_type, false);
12528 } /*dissect_zcl_appl_ctrl_attr_func*/
12531 /*FUNCTION:------------------------------------------------------
12532 * NAME
12533 * dissect_zcl_appl_ctrl_wr_funcs
12534 * DESCRIPTION
12535 * this function is called in order to decode "WriteFunctions"
12536 * payload.
12537 * PARAMETERS
12538 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12539 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12540 * unsigned *offset - pointer to buffer offset
12541 * RETURNS
12542 * none
12543 *---------------------------------------------------------------
12545 static void
12546 dissect_zcl_appl_ctrl_wr_funcs(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
12548 proto_tree *sub_tree = NULL;
12549 unsigned tvb_len;
12550 unsigned i = 0;
12552 tvb_len = tvb_reported_length(tvb);
12553 while ( *offset < tvb_len && i < ZBEE_ZCL_APPL_CTRL_NUM_FUNC_ETT ) {
12554 /* Create subtree for attribute status field */
12555 sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 0,
12556 ett_zbee_zcl_appl_ctrl_func[i], NULL, "Function #%d", i);
12557 i++;
12559 /* Dissect the attribute identifier */
12560 dissect_zcl_appl_ctrl_attr_func(tvb, sub_tree, offset);
12563 } /*dissect_zcl_appl_ctrl_wr_funcs*/
12566 /*FUNCTION:------------------------------------------------------
12567 * NAME
12568 * dissect_zcl_appl_ctrl_ovrl_warning
12569 * DESCRIPTION
12570 * this function is called in order to decode "OverloadWarning"
12571 * payload.
12572 * PARAMETERS
12573 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12574 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12575 * unsigned *offset - pointer to buffer offset
12576 * RETURNS
12577 * none
12578 *---------------------------------------------------------------
12580 static void
12581 dissect_zcl_appl_ctrl_ovrl_warning(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
12583 /* Retrieve "Warning Id" field */
12584 proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_warning_id, tvb, *offset, 1, ENC_NA);
12585 *offset += 1;
12587 } /*dissect_zcl_appl_ctrl_ovrl_warning*/
12590 /*FUNCTION:------------------------------------------------------
12591 * NAME
12592 * dissect_zcl_appl_ctrl_signal_state_rsp
12593 * DESCRIPTION
12594 * this function is called in order to decode "SignalStateResponse"
12595 * "SignalStateNotification" payload.
12596 * PARAMETERS
12597 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12598 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12599 * unsigned *offset - pointer to buffer offset
12600 * RETURNS
12601 * none
12602 *---------------------------------------------------------------
12604 static void
12605 dissect_zcl_appl_ctrl_signal_state_rsp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
12607 static int * const flags[] = {
12608 &hf_zbee_zcl_appl_ctrl_rem_en_flags,
12609 &hf_zbee_zcl_appl_ctrl_status2,
12610 NULL
12613 /* Retrieve "Appliance Status" field */
12614 proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_appl_status, tvb, *offset, 1, ENC_NA);
12615 *offset += 1;
12617 /* Retrieve "Remote Enable" field */
12618 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_appl_ctrl_rem_en_flags_raw, ett_zbee_zcl_appl_ctrl_flags, flags, ENC_NA);
12619 *offset += 1;
12621 /* Retrieve "Appliance Status 2" field */
12622 proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_status2_array, tvb, *offset, 3, ENC_BIG_ENDIAN);
12623 } /*dissect_zcl_appl_ctrl_signal_state_rsp*/
12625 /*FUNCTION:------------------------------------------------------
12626 * NAME
12627 * dissect_zcl_appl_ctrl_attr_data
12628 * DESCRIPTION
12629 * this function is called by ZCL foundation dissector in order to decode
12630 * specific cluster attributes data.
12631 * PARAMETERS
12632 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12633 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12634 * unsigned *offset - pointer to buffer offset
12635 * uint16_t attr_id - attribute identifier
12636 * unsigned data_type - attribute data type
12637 * bool client_attr- ZCL client
12638 * RETURNS
12639 * none
12640 *---------------------------------------------------------------
12642 static void
12643 dissect_zcl_appl_ctrl_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
12645 static int * const flags[] = {
12646 &hf_zbee_zcl_appl_ctrl_time_mm,
12647 &hf_zbee_zcl_appl_ctrl_time_encoding_type,
12648 &hf_zbee_zcl_appl_ctrl_time_hh,
12649 NULL
12652 /* Dissect attribute data type and data */
12653 switch (attr_id) {
12655 case ZBEE_ZCL_ATTR_ID_APPL_CTRL_START_TIME:
12656 case ZBEE_ZCL_ATTR_ID_APPL_CTRL_FINISH_TIME:
12657 case ZBEE_ZCL_ATTR_ID_APPL_CTRL_REMAINING_TIME:
12658 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_appl_ctrl_time, ett_zbee_zcl_appl_ctrl_time, flags, ENC_LITTLE_ENDIAN);
12659 *offset += 2;
12660 break;
12662 default:
12663 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
12664 break;
12666 } /*dissect_zcl_appl_ctrl_attr_data*/
12669 /*FUNCTION:------------------------------------------------------
12670 * NAME
12671 * proto_register_zbee_zcl_appl_ctrl
12672 * DESCRIPTION
12673 * this function registers the ZCL Appliance Control dissector
12674 * and all its information.
12675 * PARAMETERS
12676 * none
12677 * RETURNS
12678 * none
12679 *---------------------------------------------------------------
12681 void
12682 proto_register_zbee_zcl_appl_ctrl(void)
12684 unsigned i, j;
12686 static hf_register_info hf[] = {
12688 { &hf_zbee_zcl_appl_ctrl_attr_id,
12689 { "Attribute", "zbee_zcl_general.applctrl.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_appl_ctrl_attr_names),
12690 0x0, NULL, HFILL } },
12692 { &hf_zbee_zcl_appl_ctrl_time,
12693 { "Data", "zbee_zcl_general.applctrl.time", FT_UINT16, BASE_HEX, NULL, 0x0,
12694 NULL, HFILL } },
12696 { &hf_zbee_zcl_appl_ctrl_time_mm,
12697 { "Minutes", "zbee_zcl_general.applctrl.time.mm", FT_UINT16, BASE_DEC, NULL, ZBEE_ZCL_APPL_CTRL_TIME_MM,
12698 NULL, HFILL } },
12700 { &hf_zbee_zcl_appl_ctrl_time_encoding_type,
12701 { "Encoding Type", "zbee_zcl_general.applctrl.time.encoding_type", FT_UINT16, BASE_HEX, VALS(zbee_zcl_appl_ctrl_time_encoding_type_names),
12702 ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_TYPE, NULL, HFILL } },
12704 { &hf_zbee_zcl_appl_ctrl_time_hh,
12705 { "Hours", "zbee_zcl_general.applctrl.time.hh", FT_UINT16, BASE_DEC, NULL, ZBEE_ZCL_APPL_CTRL_TIME_HH,
12706 NULL, HFILL } },
12708 { &hf_zbee_zcl_appl_ctrl_srv_tx_cmd_id,
12709 { "Command", "zbee_zcl_general.applctrl.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_srv_tx_cmd_names),
12710 0x0, NULL, HFILL } },
12712 { &hf_zbee_zcl_appl_ctrl_srv_rx_cmd_id,
12713 { "Command", "zbee_zcl_general.applctrl.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_srv_rx_cmd_names),
12714 0x0, NULL, HFILL } },
12716 { &hf_zbee_zcl_appl_ctrl_appl_status,
12717 { "Appliance Status", "zbee_zcl_general.applctrl.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_appl_status_names),
12718 0x0, NULL, HFILL } },
12720 { &hf_zbee_zcl_appl_ctrl_rem_en_flags_raw,
12721 { "Remote Enable Flags", "zbee_zcl_general.applctrl.remote_enable_flags", FT_UINT8, BASE_HEX, NULL,
12722 0x0, NULL, HFILL } },
12724 { &hf_zbee_zcl_appl_ctrl_rem_en_flags,
12725 { "Remote Enable Flags", "zbee_zcl_general.applctrl.remenflags", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_rem_flags_names),
12726 ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_FLAGS, NULL, HFILL } },
12728 { &hf_zbee_zcl_appl_ctrl_status2,
12729 { "Appliance Status 2", "zbee_zcl_general.applctrl.status2", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_status2_names),
12730 ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_STATUS2, NULL, HFILL } },
12732 { &hf_zbee_zcl_appl_ctrl_status2_array,
12733 { "Appliance Status 2", "zbee_zcl_general.applctrl.status2.array", FT_UINT24, BASE_HEX, NULL,
12734 0x00, NULL, HFILL } },
12736 { &hf_zbee_zcl_appl_ctrl_exec_cmd_id,
12737 { "Command", "zbee_zcl_general.applctrl.execcmd.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_exec_cmd_names),
12738 0x0, NULL, HFILL } },
12740 { &hf_zbee_zcl_appl_ctrl_attr_func_id,
12741 { "ID", "zbee_zcl_general.applctrl.attr_func.id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_appl_ctrl_attr_names),
12742 0x0, NULL, HFILL } },
12744 { &hf_zbee_zcl_appl_ctrl_attr_func_data_type,
12745 { "Data Type", "zbee_zcl_general.applctrl.attr_func.datatype", FT_UINT8, BASE_HEX, VALS(zbee_zcl_short_data_type_names),
12746 0x0, NULL, HFILL } },
12748 { &hf_zbee_zcl_appl_ctrl_warning_id,
12749 { "Warning", "zbee_zcl_general.applctrl.ovrlwarning.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_ovrl_warning_names),
12750 0x0, NULL, HFILL } }
12754 /* ZCL ApplianceControl subtrees */
12755 int *ett[ZBEE_ZCL_APPL_CTRL_NUM_ETT] = {
12756 &ett_zbee_zcl_appl_ctrl,
12757 &ett_zbee_zcl_appl_ctrl_flags,
12758 &ett_zbee_zcl_appl_ctrl_time
12761 /* initialize attribute subtree types */
12762 for ( i = 0, j = ZBEE_ZCL_APPL_CTRL_NUM_GENERIC_ETT; i < ZBEE_ZCL_APPL_CTRL_NUM_FUNC_ETT; i++, j++) {
12763 ett[j] = &ett_zbee_zcl_appl_ctrl_func[i];
12766 /* Register the ZigBee ZCL ApplianceControl cluster protocol name and description */
12767 proto_zbee_zcl_appl_ctrl = proto_register_protocol("ZigBee ZCL Appliance Control", "ZCL Appliance Control", ZBEE_PROTOABBREV_ZCL_APPLCTRL);
12768 proto_register_field_array(proto_zbee_zcl_appl_ctrl, hf, array_length(hf));
12769 proto_register_subtree_array(ett, array_length(ett));
12771 /* Register the ZigBee ZCL Appliance Control dissector. */
12772 register_dissector(ZBEE_PROTOABBREV_ZCL_APPLCTRL, dissect_zbee_zcl_appl_ctrl, proto_zbee_zcl_appl_ctrl);
12773 } /*proto_register_zbee_zcl_appl_ctrl*/
12776 /*FUNCTION:------------------------------------------------------
12777 * NAME
12778 * proto_reg_handoff_zbee_zcl_appl_ctrl
12779 * DESCRIPTION
12780 * Hands off the Zcl Appliance Control dissector.
12781 * PARAMETERS
12782 * none
12783 * RETURNS
12784 * void
12785 *---------------------------------------------------------------
12787 void
12788 proto_reg_handoff_zbee_zcl_appl_ctrl(void)
12790 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_APPLCTRL,
12791 proto_zbee_zcl_appl_ctrl,
12792 ett_zbee_zcl_appl_ctrl,
12793 ZBEE_ZCL_CID_APPLIANCE_CONTROL,
12794 ZBEE_MFG_CODE_NONE,
12795 hf_zbee_zcl_appl_ctrl_attr_id,
12796 hf_zbee_zcl_appl_ctrl_attr_id,
12797 hf_zbee_zcl_appl_ctrl_srv_rx_cmd_id,
12798 hf_zbee_zcl_appl_ctrl_srv_tx_cmd_id,
12799 (zbee_zcl_fn_attr_data)dissect_zcl_appl_ctrl_attr_data
12801 } /*proto_reg_handoff_zbee_zcl_appl_ctrl*/
12803 /* ########################################################################## */
12804 /* #### (0x0020) POLL CONTROL CLUSTER ####################################### */
12805 /* ########################################################################## */
12807 /*************************/
12808 /* Defines */
12809 /*************************/
12811 /* Poll Control Attributes */
12812 #define ZBEE_ZCL_ATTR_ID_POLL_CTRL_CHECK_IN 0x0000
12813 #define ZBEE_ZCL_ATTR_ID_POLL_CTRL_LONG_POLL 0x0001
12814 #define ZBEE_ZCL_ATTR_ID_POLL_CTRL_SHORT_POLL 0x0002
12815 #define ZBEE_ZCL_ATTR_ID_POLL_CTRL_FAST_POLL 0x0003
12816 #define ZBEE_ZCL_ATTR_ID_POLL_CTRL_CHECK_IN_MIN 0x0004
12817 #define ZBEE_ZCL_ATTR_ID_POLL_CTRL_LONG_POLL_MIN 0x0005
12818 #define ZBEE_ZCL_ATTR_ID_POLL_CTRL_FAST_POLL_TIMEOUT 0x0006
12820 static const value_string zbee_zcl_poll_ctrl_attr_names[] = {
12821 { ZBEE_ZCL_ATTR_ID_POLL_CTRL_CHECK_IN, "Check-inInterval" },
12822 { ZBEE_ZCL_ATTR_ID_POLL_CTRL_LONG_POLL, "LongPollInterval" },
12823 { ZBEE_ZCL_ATTR_ID_POLL_CTRL_SHORT_POLL, "ShortPollInterval" },
12824 { ZBEE_ZCL_ATTR_ID_POLL_CTRL_FAST_POLL, "FastPollTimeout" },
12825 { ZBEE_ZCL_ATTR_ID_POLL_CTRL_CHECK_IN_MIN, "Check-inIntervalMin" },
12826 { ZBEE_ZCL_ATTR_ID_POLL_CTRL_LONG_POLL_MIN, "LongPollIntervalMin" },
12827 { ZBEE_ZCL_ATTR_ID_POLL_CTRL_FAST_POLL_TIMEOUT, "FastPollTimeoutMax" },
12828 { 0, NULL }
12831 /* Server-to-client command IDs. */
12832 #define ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN 0x00
12833 static const value_string zbee_zcl_poll_ctrl_srv_tx_cmd_names[] = {
12834 { ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN, "Check-in" },
12835 { 0, NULL }
12838 /* Client-to-server command IDs. */
12839 #define ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN_RESPONSE 0x00
12840 #define ZBEE_ZCL_CMD_ID_POLL_CTRL_FAST_POLL_STOP 0x01
12841 #define ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_LONG_POLL 0x02
12842 #define ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_SHORT_POLL 0x03
12843 static const value_string zbee_zcl_poll_ctrl_srv_rx_cmd_names[] = {
12844 { ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN_RESPONSE, "Check-in Response" },
12845 { ZBEE_ZCL_CMD_ID_POLL_CTRL_FAST_POLL_STOP, "Fast Poll Stop" },
12846 { ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_LONG_POLL, "Set Long Poll Interval" },
12847 { ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_SHORT_POLL, "Set Short Poll Interval" },
12848 { 0, NULL }
12851 /*************************/
12852 /* Global Variables */
12853 /*************************/
12854 /* Initialize the protocol and registered fields */
12855 static int proto_zbee_zcl_poll_ctrl;
12857 static int hf_zbee_zcl_poll_ctrl_attr_id;
12858 static int hf_zbee_zcl_poll_ctrl_srv_rx_cmd_id;
12859 static int hf_zbee_zcl_poll_ctrl_srv_tx_cmd_id;
12860 static int hf_zbee_zcl_poll_ctrl_start_fast_polling;
12861 static int hf_zbee_zcl_poll_ctrl_fast_poll_timeout;
12862 static int hf_zbee_zcl_poll_ctrl_new_long_poll_interval;
12863 static int hf_zbee_zcl_poll_ctrl_new_short_poll_interval;
12865 static int ett_zbee_zcl_poll_ctrl;
12867 /*************************/
12868 /* Function Declarations */
12869 /*************************/
12870 void proto_register_zbee_zcl_poll_ctrl(void);
12871 void proto_reg_handoff_zbee_zcl_poll_ctrl(void);
12873 /*FUNCTION:------------------------------------------------------
12874 * NAME
12875 * dissect_zbee_zcl_poll_ctrl
12876 * DESCRIPTION
12877 * ZigBee ZCL Poll Control cluster dissector for wireshark.
12878 * PARAMETERS
12879 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12880 * packet_info *pinfo - pointer to packet information fields
12881 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12882 * void *data - pointer to ZCL packet structure.
12883 * RETURNS
12884 * int - length of parsed data.
12885 *---------------------------------------------------------------
12887 static int
12888 dissect_zbee_zcl_poll_ctrl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
12890 zbee_zcl_packet *zcl;
12891 unsigned offset = 0;
12892 uint8_t cmd_id;
12894 /* Reject the packet if data is NULL */
12895 if (data == NULL)
12896 return 0;
12897 zcl = (zbee_zcl_packet *)data;
12898 cmd_id = zcl->cmd_id;
12900 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
12901 /* Append the command name to the info column. */
12902 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
12903 val_to_str_const(cmd_id, zbee_zcl_poll_ctrl_srv_rx_cmd_names, "Unknown Command"),
12904 zcl->tran_seqno);
12906 /* Add the command ID. */
12907 proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
12908 offset++;
12910 /* Handle the command dissection. */
12911 switch (cmd_id) {
12912 case ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN_RESPONSE:
12913 proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_start_fast_polling, tvb, offset, 1, ENC_NA);
12914 offset++;
12915 proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_fast_poll_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN);
12916 break;
12918 case ZBEE_ZCL_CMD_ID_POLL_CTRL_FAST_POLL_STOP:
12919 /* no payload. */
12920 break;
12922 case ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_LONG_POLL:
12923 proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_new_long_poll_interval, tvb, offset, 4, ENC_LITTLE_ENDIAN);
12924 break;
12926 case ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_SHORT_POLL:
12927 proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_new_short_poll_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
12928 break;
12930 default:
12931 break;
12932 } /* switch */
12933 } else {
12934 /* Append the command name to the info column. */
12935 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
12936 val_to_str_const(cmd_id, zbee_zcl_poll_ctrl_srv_tx_cmd_names, "Unknown Command"),
12937 zcl->tran_seqno);
12939 /* Add the command ID. */
12940 proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_srv_tx_cmd_id, tvb, offset, 1, ENC_NA);
12941 offset++;
12943 /* Handle the command dissection. */
12944 switch (cmd_id) {
12945 case ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN:
12946 /* No payload - fall through. */
12947 default:
12948 break;
12949 } /* switch */
12952 return tvb_captured_length(tvb);
12953 } /* dissect_zbee_zcl_poll_ctrl */
12956 /*FUNCTION:------------------------------------------------------
12957 * NAME
12958 * dissect_zcl_poll_ctrl_attr_data
12959 * DESCRIPTION
12960 * this function is called by ZCL foundation dissector in order to decode
12961 * specific cluster attributes data.
12962 * PARAMETERS
12963 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12964 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12965 * unsigned *offset - pointer to buffer offset
12966 * uint16_t attr_id - attribute identifier
12967 * unsigned data_type - attribute data type
12968 * bool client_attr- ZCL client
12969 * RETURNS
12970 * none
12971 *---------------------------------------------------------------
12973 static void
12974 dissect_zcl_poll_ctrl_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id _U_, unsigned data_type, bool client_attr)
12976 /* Dissect attribute data type and data */
12977 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
12979 } /*dissect_zcl_poll_ctrl_attr_data*/
12981 /*FUNCTION:------------------------------------------------------
12982 * NAME
12983 * proto_register_zbee_zcl_poll_ctrl
12984 * DESCRIPTION
12985 * ZigBee ZCL Poll Control cluster protocol registration.
12986 * PARAMETERS
12987 * none
12988 * RETURNS
12989 * void
12990 *---------------------------------------------------------------
12992 void
12993 proto_register_zbee_zcl_poll_ctrl(void)
12995 /* Setup list of header fields */
12996 static hf_register_info hf[] = {
12998 { &hf_zbee_zcl_poll_ctrl_attr_id,
12999 { "Attribute", "zbee_zcl_general.poll.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_poll_ctrl_attr_names),
13000 0x0, NULL, HFILL } },
13002 { &hf_zbee_zcl_poll_ctrl_srv_rx_cmd_id,
13003 { "Command", "zbee_zcl_general.poll.cmd.srv_rx.id", FT_UINT8, BASE_HEX,
13004 VALS(zbee_zcl_poll_ctrl_srv_rx_cmd_names), 0x0, NULL, HFILL }},
13006 { &hf_zbee_zcl_poll_ctrl_srv_tx_cmd_id,
13007 { "Command", "zbee_zcl_general.poll.cmd.srv_tx.id", FT_UINT8, BASE_HEX,
13008 VALS(zbee_zcl_poll_ctrl_srv_tx_cmd_names), 0x0, NULL, HFILL }},
13010 { &hf_zbee_zcl_poll_ctrl_start_fast_polling,
13011 { "Start Fast Polling", "zbee_zcl_general.poll.start", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
13012 NULL, HFILL }},
13014 { &hf_zbee_zcl_poll_ctrl_fast_poll_timeout,
13015 { "Fast Poll Timeout (quarterseconds)", "zbee_zcl_general.poll.fast_timeout", FT_UINT16, BASE_DEC, NULL,
13016 0x0, NULL, HFILL }},
13018 { &hf_zbee_zcl_poll_ctrl_new_long_poll_interval,
13019 { "New Long Poll Interval", "zbee_zcl_general.poll.new_long_interval", FT_UINT32, BASE_DEC, NULL, 0x0, NULL,
13020 HFILL }},
13022 { &hf_zbee_zcl_poll_ctrl_new_short_poll_interval,
13023 { "New Short Poll Interval", "zbee_zcl_general.poll.new_short_interval", FT_UINT16, BASE_DEC, NULL, 0x0, NULL,
13024 HFILL }}
13027 /* ZCL Poll Control subtrees */
13028 static int *ett[] = {
13029 &ett_zbee_zcl_poll_ctrl
13032 /* Register the ZigBee ZCL Poll Control cluster protocol name and description */
13033 proto_zbee_zcl_poll_ctrl = proto_register_protocol("ZigBee ZCL Poll Control", "ZCL Poll Control", ZBEE_PROTOABBREV_ZCL_POLL);
13034 proto_register_field_array(proto_zbee_zcl_poll_ctrl, hf, array_length(hf));
13035 proto_register_subtree_array(ett, array_length(ett));
13037 /* Register the ZigBee ZCL Poll Control dissector. */
13038 register_dissector(ZBEE_PROTOABBREV_ZCL_POLL, dissect_zbee_zcl_poll_ctrl, proto_zbee_zcl_poll_ctrl);
13039 } /*proto_register_zbee_zcl_poll_ctrl*/
13041 /*FUNCTION:------------------------------------------------------
13042 * NAME
13043 * proto_reg_handoff_zbee_zcl_poll_ctrl
13044 * DESCRIPTION
13045 * Hands off the ZCL Poll Control dissector.
13046 * PARAMETERS
13047 * none
13048 * RETURNS
13049 * none
13050 *---------------------------------------------------------------
13052 void
13053 proto_reg_handoff_zbee_zcl_poll_ctrl(void)
13055 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_POLL,
13056 proto_zbee_zcl_poll_ctrl,
13057 ett_zbee_zcl_poll_ctrl,
13058 ZBEE_ZCL_CID_POLL_CONTROL,
13059 ZBEE_MFG_CODE_NONE,
13060 hf_zbee_zcl_poll_ctrl_attr_id,
13061 hf_zbee_zcl_poll_ctrl_attr_id,
13062 hf_zbee_zcl_poll_ctrl_srv_rx_cmd_id,
13063 hf_zbee_zcl_poll_ctrl_srv_tx_cmd_id,
13064 (zbee_zcl_fn_attr_data)dissect_zcl_poll_ctrl_attr_data
13066 } /*proto_reg_handoff_zbee_zcl_poll_ctrl*/
13070 /* ########################################################################## */
13071 /* #### (0x0021) GREEN POWER CLUSTER ######################################## */
13072 /* ########################################################################## */
13074 /*************************/
13075 /* Defines */
13076 /*************************/
13078 /* Green Power Attributes */
13080 #define ZBEE_ZCL_ATTR_GPS_MAX_SINK_TABLE_ENTRIES 0x0000
13081 #define ZBEE_ZCL_ATTR_GPS_SINK_TABLE 0x0001
13082 #define ZBEE_ZCL_ATTR_GPS_COMMUNICATION_MODE 0x0002
13083 #define ZBEE_ZCL_ATTR_GPS_COMMISSIONING_EXIT_MODE 0x0003
13084 #define ZBEE_ZCL_ATTR_GPS_COMMISSIONING_WINDOW 0x0004
13085 #define ZBEE_ZCL_ATTR_GPS_SECURITY_LEVEL 0x0005
13086 #define ZBEE_ZCL_ATTR_GPS_FUNCTIONALITY 0x0006
13087 #define ZBEE_ZCL_ATTR_GPS_ACTIVE_FUNCTIONALITY 0x0007
13088 #define ZBEE_ZCL_ATTR_GPP_MAX_PROXY_TABLE_ENTRIES 0x0010
13089 #define ZBEE_ZCL_ATTR_GPP_PROXY_TABLE 0x0011
13090 #define ZBEE_ZCL_ATTR_GPP_NOTIFICATION_RETRY_NUMBER 0x0012
13091 #define ZBEE_ZCL_ATTR_GPP_NOTIFICATION_RETRY_TIMER 0x0013
13092 #define ZBEE_ZCL_ATTR_GPP_MAX_SEARCH_COUNTER 0x0014
13093 #define ZBEE_ZCL_ATTR_GPP_BLOCKED_GPDID 0x0015
13094 #define ZBEE_ZCL_ATTR_GPP_FUNCTIONALITY 0x0016
13095 #define ZBEE_ZCL_ATTR_GPP_ACTIVE_FUNCTIONALITY 0x0017
13096 #define ZBEE_ZCL_ATTR_GP_SHARED_SECURITY_KEY_TYPE 0x0020
13097 #define ZBEE_ZCL_ATTR_GP_SHARED_SECURITY_KEY 0x0021
13098 #define ZBEE_ZCL_ATTR_GP_LINK_KEY 0x0022
13100 static const value_string zbee_zcl_gp_attr_names[] = {
13101 { ZBEE_ZCL_ATTR_GPS_MAX_SINK_TABLE_ENTRIES, "gpsMaxSinkTableEntries" },
13102 { ZBEE_ZCL_ATTR_GPS_SINK_TABLE, "SinkTable" },
13103 { ZBEE_ZCL_ATTR_GPS_COMMUNICATION_MODE, "gpsCommunicationMode" },
13104 { ZBEE_ZCL_ATTR_GPS_COMMISSIONING_EXIT_MODE, "gpsCommissioningExitMode" },
13105 { ZBEE_ZCL_ATTR_GPS_COMMISSIONING_WINDOW, "gpsCommissioningWindow" },
13106 { ZBEE_ZCL_ATTR_GPS_SECURITY_LEVEL, "gpsSecurityLevel" },
13107 { ZBEE_ZCL_ATTR_GPS_FUNCTIONALITY, "gpsFunctionality" },
13108 { ZBEE_ZCL_ATTR_GPS_ACTIVE_FUNCTIONALITY, "gpsActiveFunctionality" },
13109 { ZBEE_ZCL_ATTR_GPP_MAX_PROXY_TABLE_ENTRIES, "gppMaxProxyTableEntries" },
13110 { ZBEE_ZCL_ATTR_GPP_PROXY_TABLE, "ProxyTable" },
13111 { ZBEE_ZCL_ATTR_GPP_NOTIFICATION_RETRY_NUMBER, "gppNotificationRetryNumber" },
13112 { ZBEE_ZCL_ATTR_GPP_NOTIFICATION_RETRY_TIMER, "gppNotificationRetryTimer" },
13113 { ZBEE_ZCL_ATTR_GPP_MAX_SEARCH_COUNTER, "gppMaxSearchCounter" },
13114 { ZBEE_ZCL_ATTR_GPP_BLOCKED_GPDID, "gppBlockedGPDID" },
13115 { ZBEE_ZCL_ATTR_GPP_FUNCTIONALITY, "gppFunctionality" },
13116 { ZBEE_ZCL_ATTR_GPP_ACTIVE_FUNCTIONALITY, "gppActiveFunctionality" },
13117 { ZBEE_ZCL_ATTR_GP_SHARED_SECURITY_KEY_TYPE, "gpSharedSecurityKeyType" },
13118 { ZBEE_ZCL_ATTR_GP_SHARED_SECURITY_KEY, "gpSharedSecurityKey" },
13119 { ZBEE_ZCL_ATTR_GP_LINK_KEY, "gpLinkKey" },
13120 { 0, NULL }
13123 /* Server-to-client command IDs. */
13124 #define ZBEE_ZCL_CMD_ID_GP_NOTIFICATION_RESPONSE 0x00
13125 #define ZBEE_ZCL_CMD_ID_GP_PAIRING 0x01
13126 #define ZBEE_ZCL_CMD_ID_GP_PROXY_COMMISSIONING_MODE 0x02
13127 #define ZBEE_ZCL_CMD_ID_GP_RESPONSE 0x06
13128 #define ZBEE_ZCL_CMD_ID_GP_TRANS_TBL_RESPONSE 0x08
13129 #define ZBEE_ZCL_CMD_ID_GP_SINK_TABLE_RESPONSE 0x0a
13130 #define ZBEE_ZCL_CMD_ID_GP_PROXY_TABLE_REQUEST 0x0b
13132 static const value_string zbee_zcl_gp_srv_tx_cmd_names[] = {
13133 { ZBEE_ZCL_CMD_ID_GP_NOTIFICATION_RESPONSE, "GP Notification Response" },
13134 { ZBEE_ZCL_CMD_ID_GP_PAIRING, "GP Pairing" },
13135 { ZBEE_ZCL_CMD_ID_GP_PROXY_COMMISSIONING_MODE, "GP Proxy Commissioning Mode" },
13136 { ZBEE_ZCL_CMD_ID_GP_RESPONSE, "GP Response" },
13137 { ZBEE_ZCL_CMD_ID_GP_TRANS_TBL_RESPONSE, "GP Translation Table Response" },
13138 { ZBEE_ZCL_CMD_ID_GP_SINK_TABLE_RESPONSE, "GP Sink Table Response" },
13139 { ZBEE_ZCL_CMD_ID_GP_PROXY_TABLE_REQUEST, "GP Proxy Table Request" },
13140 { 0, NULL }
13143 /* Client-to-server command IDs. */
13144 #define ZBEE_CMD_ID_GP_NOTIFICATION 0x00
13145 #define ZBEE_CMD_ID_GP_PAIRING_SEARCH 0x01
13146 #define ZBEE_CMD_ID_GP_TUNNELING_STOP 0x03
13147 #define ZBEE_CMD_ID_GP_COMMISSIONING_NOTIFICATION 0x04
13148 #define ZBEE_CMD_ID_GP_SINK_COMMISSIONING_MODE 0x05
13149 #define ZBEE_CMD_ID_GP_TRANSLATION_TABLE_UPDATE_COMMAND 0x07
13150 #define ZBEE_CMD_ID_GP_TRANSLATION_TABLE_REQUEST 0x08
13151 #define ZBEE_CMD_ID_GP_PAIRING_CONFIGURATION 0x09
13152 #define ZBEE_CMD_ID_GP_SINK_TABLE_REQUEST 0x0a
13153 #define ZBEE_CMD_ID_GP_PROXY_TABLE_RESPONSE 0x0b
13155 static const value_string zbee_zcl_gp_srv_rx_cmd_names[] = {
13156 { ZBEE_CMD_ID_GP_NOTIFICATION, "GP Notification" },
13157 { ZBEE_CMD_ID_GP_PAIRING_SEARCH, "GP Pairing Search" },
13158 { ZBEE_CMD_ID_GP_TUNNELING_STOP, "GP Tunneling Stop" },
13159 { ZBEE_CMD_ID_GP_COMMISSIONING_NOTIFICATION, "GP Commissioning Notification" },
13160 { ZBEE_CMD_ID_GP_SINK_COMMISSIONING_MODE, "GP Sink Commissioning Mode" },
13161 { ZBEE_CMD_ID_GP_TRANSLATION_TABLE_UPDATE_COMMAND, "GP Translation Table Update" },
13162 { ZBEE_CMD_ID_GP_TRANSLATION_TABLE_REQUEST, "GP Translation Table Request" },
13163 { ZBEE_CMD_ID_GP_PAIRING_CONFIGURATION, "GP Pairing Configuration" },
13164 { ZBEE_CMD_ID_GP_SINK_TABLE_REQUEST, "GP Sink Table Request" },
13165 { ZBEE_CMD_ID_GP_PROXY_TABLE_RESPONSE, "GP Proxy Table Response" },
13166 { 0, NULL }
13169 static const value_string zbee_zcl_gp_comm_mode_actions[] = {
13170 { 0, "Exit commissioning mode" },
13171 { 1, "Enter commissioning mode" },
13172 { 0, NULL }
13175 static const value_string zbee_zcl_gp_app_ids[] = {
13176 { 0, "0b000 4b SrcID; no Endpoint" },
13177 { 2, "0b010 8b IEEE; Endpoint presents" },
13178 { 0, NULL }
13181 static const value_string zbee_zcl_gp_secur_levels[] = {
13182 { 0, "No security" },
13183 { 1, "Reserved" },
13184 { 2, "4B frame counter and 4B MIC only" },
13185 { 3, "Encryption & 4B frame counter and 4B MIC" },
13186 { 0, NULL }
13189 static const value_string zbee_zcl_gp_secur_key_types[] = {
13190 { 0, "No key" },
13191 { 1, "ZigBee NWK key" },
13192 { 2, "GPD group key" },
13193 { 3, "NWK-key derived GPD group key" },
13194 { 4, "(individual) out-of-the-box GPD key" },
13195 { 7, "Derived individual GPD key" },
13196 { 0, NULL }
13199 static const value_string zbee_zcl_gp_communication_modes[] = {
13200 { 0, "Full unicast" },
13201 { 1, "Groupcast to DGroupID" },
13202 { 2, "Groupcast to pre-commissioned GroupID" },
13203 { 3, "Lightweight unicast" },
13204 { 0, NULL }
13207 static const value_string zbee_zcl_gp_lqi_vals[] = {
13208 { 0, "Poor" },
13209 { 1, "Moderate" },
13210 { 2, "High" },
13211 { 3, "Excellent" },
13212 { 0, NULL }
13215 static const value_string zbee_zcl_gp_channels[] = {
13216 { 0, "Channel 11" },
13217 { 1, "Channel 12" },
13218 { 2, "Channel 13" },
13219 { 3, "Channel 14" },
13220 { 4, "Channel 15" },
13221 { 5, "Channel 16" },
13222 { 6, "Channel 17" },
13223 { 7, "Channel 18" },
13224 { 8, "Channel 19" },
13225 { 9, "Channel 20" },
13226 { 10, "Channel 21" },
13227 { 11, "Channel 22" },
13228 { 12, "Channel 23" },
13229 { 13, "Channel 24" },
13230 { 14, "Channel 25" },
13231 { 15, "Channel 26" },
13232 { 0, NULL }
13235 static const value_string zbee_gp_pc_actions[] = {
13236 { 0, "No action" },
13237 { 1, "Extend Sink Table entry" },
13238 { 2, "Replace Sink Table entry" },
13239 { 3, "Remove a pairing" },
13240 { 4, "Remove GPD" },
13241 { 0, NULL }
13244 static const value_string zbee_zcl_gp_proxy_sink_tbl_req_type[] = {
13245 { 0, "Request table entries by GPD ID" },
13246 { 1, "Request table entries by Index" },
13247 { 0, NULL }
13250 #define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ACTION 1
13251 #define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_EXIT_MODE (7<<1)
13252 #define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_COMMISSIONING_WINDOW_EXPIRATION ((1<<0)<<1)
13253 #define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_PAIRING_SUCCESS ((1<<1)<<1)
13254 #define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_GP_PROXY_COMM_MODE ((1<<2)<<1)
13255 #define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_CHANNEL_PRESENT (1<<4)
13256 #define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_UNICAST (1<<5)
13259 #define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_APP_ID (7<<0)
13260 #define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_RX_AFTER_TX (1<<3)
13261 #define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_LEVEL (3<<4)
13262 #define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_KEY_TYPE (7<<6)
13263 #define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_FAILED (1<<9)
13264 #define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_BIDIR_CAP (1<<10)
13265 #define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_PROXY_INFO_PRESENT (1<<11)
13267 #define ZBEE_ZCL_GP_GPP_GPD_LINK_RSSI 0x3f
13268 #define ZBEE_ZCL_GP_GPP_GPD_LINK_LQI (3<<6)
13270 #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_APP_ID (7<<0)
13271 #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_UNICAST (1<<3)
13272 #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_DERIVED_GROUP (1<<4)
13273 #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_COMMISSIONED_GROUP (1<<5)
13274 #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_SECUR_LEVEL (3<<6)
13275 #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_SECUR_KEY_TYPE (7<<8)
13276 #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_RX_AFTER_TX (1<<11)
13277 #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_TX_Q_FULL (1<<12)
13278 #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_BIDIR_CAP (1<<13)
13279 #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_PROXY_INFO_PRESENT (1<<14)
13281 #define ZBEE_ZCL_GP_PAIRING_OPTION_APP_ID (7<<0)
13282 #define ZBEE_ZCL_GP_PAIRING_OPTION_ADD_SINK (1<<3)
13283 #define ZBEE_ZCL_GP_PAIRING_OPTION_REMOVE_GPD (1<<4)
13284 #define ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE (3<<5)
13285 #define ZBEE_ZCL_GP_PAIRING_OPTION_GPD_FIXED (1<<7)
13286 #define ZBEE_ZCL_GP_PAIRING_OPTION_GPD_MAC_SEQ_NUM_CAP (1<<8)
13287 #define ZBEE_ZCL_GP_PAIRING_OPTION_SECUR_LEVEL (3<<9)
13288 #define ZBEE_ZCL_GP_PAIRING_OPTION_SECUR_KEY_TYPE (7<<11)
13289 #define ZBEE_ZCL_GP_PAIRING_OPTION_GPD_FRAME_CNT_PRESENT (1<<14)
13290 #define ZBEE_ZCL_GP_PAIRING_OPTION_GPD_SECUR_KEY_PRESENT (1<<15)
13291 #define ZBEE_ZCL_GP_PAIRING_OPTION_ASSIGNED_ALIAS_PRESENT (1<<16)
13292 #define ZBEE_ZCL_GP_PAIRING_OPTION_FWD_RADIUS_PRESENT (1<<17)
13294 #define ZBEE_ZCL_GP_RESPONSE_OPTION_APP_ID (7<<0)
13295 #define ZBEE_ZCL_GP_RESPONSE_OPTION_TX_ON_ENDPOINT_MATCH (1<<3)
13297 #define ZBEE_ZCL_GP_RESPONSE_TX_CHANNEL (0xf<<0)
13299 #define ZBEE_ZCL_GP_CMD_PC_ACTIONS_ACTION (7<<0)
13300 #define ZBEE_ZCL_GP_CMD_PC_ACTIONS_SEND_GP_PAIRING (1<<3)
13302 #define ZBEE_ZCL_GP_CMD_PC_OPT_APP_ID (7<<0)
13303 #define ZBEE_ZCL_GP_CMD_PC_OPT_COMMUNICATION_MODE (3<<3)
13304 #define ZBEE_ZCL_GP_CMD_PC_OPT_SEQ_NUMBER_CAP (1<<5)
13305 #define ZBEE_ZCL_GP_CMD_PC_OPT_RX_ON_CAP (1<<6)
13306 #define ZBEE_ZCL_GP_CMD_PC_OPT_FIXED_LOCATION (1<<7)
13307 #define ZBEE_ZCL_GP_CMD_PC_OPT_ASSIGNED_ALIAS (1<<8)
13308 #define ZBEE_ZCL_GP_CMD_PC_OPT_SECURITY_USE (1<<9)
13309 #define ZBEE_ZCL_GP_CMD_PC_OPT_APP_INFO_PRESENT (1<<10)
13310 #define ZBEE_ZCL_GP_COMMUNICATION_MODE_GROUPCAST_PRECOMMISSIONED 2
13311 #define ZBEE_ZCL_GP_PAIRING_CONFIGURATION_OPTION_COMMUNICATION_MODE_SHIFT 3
13312 #define ZBEE_ZCL_GP_CMD_PC_SECUR_LEVEL (3<<0)
13313 #define ZBEE_ZCL_GP_CMD_PC_SECUR_KEY_TYPE (7<<2)
13314 #define ZBEE_ZCL_GP_CMD_PC_APP_INFO_MANUF_ID_PRESENT (1<<0)
13315 #define ZBEE_ZCL_GP_CMD_PC_APP_INFO_MODEL_ID_PRESENT (1<<1)
13316 #define ZBEE_ZCL_GP_CMD_PC_APP_INFO_GPD_COMMANDS_PRESENT (1<<2)
13317 #define ZBEE_ZCL_GP_CMD_PC_APP_INFO_CLUSTER_LIST_PRESENT (1<<3)
13318 #define ZBEE_ZCL_GP_CLUSTER_LIST_LEN_SRV (0xf<<0)
13319 #define ZBEE_ZCL_GP_CLUSTER_LIST_LEN_CLI (0xf<<4)
13320 #define ZBEE_ZCL_GP_CLUSTER_LIST_LEN_CLI_SHIFT 4
13322 #define ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_APP_ID (0x07<<0)
13323 #define ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_REQ_TYPE (0x03<<3)
13324 #define ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_REQ_TYPE_SHIFT 3
13326 #define ZBEE_ZCL_GP_SINK_TBL_OPT_APP_ID (7<<0)
13327 #define ZBEE_ZCL_GP_SINK_TBL_OPT_COMMUNICATION_MODE (3<<3)
13328 #define ZBEE_ZCL_GP_SINK_TBL_OPT_SEQ_NUMBER_CAP (1<<5)
13329 #define ZBEE_ZCL_GP_SINK_TBL_OPT_RX_ON_CAP (1<<6)
13330 #define ZBEE_ZCL_GP_SINK_TBL_OPT_FIXED_LOCATION (1<<7)
13331 #define ZBEE_ZCL_GP_SINK_TBL_OPT_ASSIGNED_ALIAS (1<<8)
13332 #define ZBEE_ZCL_GP_SINK_TBL_OPT_SECURITY_USE (1<<9)
13334 #define ZBEE_ZCL_GP_PROXY_TBL_OPT_APP_ID (7<<0)
13335 #define ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_ACTIVE (1<<3)
13336 #define ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_VALID (1<<4)
13337 #define ZBEE_ZCL_GP_PROXY_TBL_OPT_SEQ_NUMBER_CAP (1<<5)
13338 #define ZBEE_ZCL_GP_PROXY_TBL_OPT_LW_UCAST_GPS (1<<6)
13339 #define ZBEE_ZCL_GP_PROXY_TBL_OPT_DERIVED_GROUP_GPS (1<<7)
13340 #define ZBEE_ZCL_GP_PROXY_TBL_OPT_COMM_GROUP_GPS (1<<8)
13341 #define ZBEE_ZCL_GP_PROXY_TBL_OPT_FIRST_TO_FORWARD (1<<9)
13342 #define ZBEE_ZCL_GP_PROXY_TBL_OPT_IN_RANGE (1<<10)
13343 #define ZBEE_ZCL_GP_PROXY_TBL_OPT_GPD_FIXED (1<<11)
13344 #define ZBEE_ZCL_GP_PROXY_TBL_OPT_HAS_ALL_UCAST_ROUTES (1<<12)
13345 #define ZBEE_ZCL_GP_PROXY_TBL_OPT_ASSIGNED_ALIAS (1<<13)
13346 #define ZBEE_ZCL_GP_PROXY_TBL_OPT_SECURITY_USE (1<<14)
13347 #define ZBEE_ZCL_GP_PROXY_TBL_OPT_OPTIONS_EXTENTIONS (1<<15)
13349 #define ZBEE_ZCL_GP_PROXY_TBL_EXT_OPT_FULL_UCAST_GPS (1<<0)
13351 #define ZBEE_ZCL_GP_SECUR_OPT_SECUR_LEVEL (3<<0)
13352 #define ZBEE_ZCL_GP_SECUR_OPT_SECUR_KEY_TYPE (7<<2)
13354 /* Sink Commissioning Mode command */
13355 #define ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_ACTION (1<<0)
13356 #define ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_GPM_IN_SECUR (1<<1)
13357 #define ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_GPM_IN_PAIRING (1<<2)
13358 #define ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_PROXIES (1<<3)
13360 /* gppFunctionality attribute */
13361 #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GP_FEATURE (1<<0)
13362 #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_DIRECT_COMM (1<<1)
13363 #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_DERIVED_GCAST_COMM (1<<2)
13364 #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_PRE_COMMISSIONED_GCAST_COMM (1<<3)
13365 #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_FULL_UCAST_COMM (1<<4)
13366 #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_LW_UCAST_COMM (1<<5)
13367 #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_BIDIR_OP (1<<7)
13368 #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_PROXY_TBL_MAINTENANCE (1<<8)
13369 #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GP_COMMISSIONING (1<<10)
13370 #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_CT_BASED_COMMISSIONING (1<<11)
13371 #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_MAINTENANCE_OF_GPD (1<<12)
13372 #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_00 (1<<13)
13373 #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_01 (1<<14)
13374 #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_10 (1<<15)
13375 #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_11 (1<<16)
13376 #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_IEEE_ADDRESS (1<<19)
13377 /* gppActiveFunctionality attribute */
13378 #define ZBEE_ZCL_GP_ATTR_GPP_ACTIVE_FUNC_FLD_GP_FUNCTIONALITY (1<<0)
13380 /* gpsFunctionality attribute */
13381 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GP_FEATURE (1<<0)
13382 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_DIRECT_COMM (1<<1)
13383 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_DERIVED_GCAST_COMM (1<<2)
13384 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PRE_COMMISSIONED_GCAST_COMM (1<<3)
13385 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_FULL_UCAST_COMM (1<<4)
13386 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_LW_UCAST_COMM (1<<5)
13387 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXIMITY_BIDIR_OP (1<<6)
13388 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MULTI_HOP_BIDIR_OP (1<<7)
13389 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXY_TBL_MAINTENANCE (1<<8)
13390 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXIMITY_COMMISSIONING (1<<9)
13391 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MULTI_HOP_COMMISSIONING (1<<10)
13392 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_CT_BASED_COMMISSIONING (1<<11)
13393 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MAINTENANCE_OF_GPD (1<<12)
13394 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_00 (1<<13)
13395 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_01 (1<<14)
13396 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_10 (1<<15)
13397 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_11 (1<<16)
13398 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_SINK_TBL_BASED_GCAST_FORWARDING (1<<17)
13399 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_TRANSLATION_TABLE (1<<18)
13400 #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_IEEE_ADDRESS (1<<19)
13401 /* gpsActiveFunctionality attribute */
13402 #define ZBEE_ZCL_GP_ATTR_GPS_ACTIVE_FUNC_FLD_GP_FUNCTIONALITY (1<<0)
13404 /* gpsCommissioningExitMode attribute */
13405 #define ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_COMM_WINDOW_EXPIRE (1<<0)
13406 #define ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_PAIRING_SUCCESS (1<<1)
13407 #define ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_GP_PROXY_COMM_MODE (1<<2)
13409 /* gpsCommunicationMode attribute */
13410 #define ZBEE_ZCL_GP_ATTR_GPS_COMMUNICATION_MODE_FLD_MODE (3<<0)
13412 /* gpsSecurityLevel attribute */
13413 #define ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_MIN_GPD_SECUR_LVL (3<<0)
13414 #define ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_PROTECTION_WITH_GP_LINK_KEY (1<<2)
13415 #define ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_INVOLVE_TC (1<<3)
13417 /* Definitions for application IDs. */
13418 #define ZBEE_ZCL_GP_APP_ID_DEFAULT 0x00
13419 #define ZBEE_ZCL_GP_APP_ID_ZGP 0x02
13421 /** Definitions for Request type sub-field of the Options field of the
13422 * GP Sink Table Request and GP Proxy Table request commands
13424 #define ZBEE_ZCL_GP_PROXY_SINK_TABLE_REQ_CMD_REQUSET_BY_GPD_ID 0
13425 #define ZBEE_ZCL_GP_PROXY_SINK_TABLE_REQ_CMD_REQUSET_BY_INDEX 1
13427 /*************************/
13428 /* Global Variables */
13429 /*************************/
13430 /* Initialize the protocol and registered fields */
13431 static int proto_zbee_zcl_gp;
13433 static int hf_zbee_zcl_gp_attr_id;
13434 static int hf_zbee_zcl_gp_srv_rx_cmd_id;
13435 static int hf_zbee_zcl_gp_srv_tx_cmd_id;
13437 static int ett_zbee_zcl_gp;
13439 /* GP_PROXY_COMMISSIONING_MODE */
13440 static int ett_zbee_gp_cmd_proxy_commissioning_mode_options;
13441 static int ett_zbee_gp_cmd_proxy_commissioning_mode_exit_mode;
13442 static int hf_zbee_gp_cmd_proxy_commissioning_mode_options;
13443 static int hf_zbee_gp_cmd_pcm_opt_action;
13444 static int hf_zbee_gp_cmd_pcm_opt_exit_mode;
13445 static int hf_zbee_gp_cmd_pcm_opt_channel_present;
13446 static int hf_zbee_gp_cmd_pcm_opt_unicast_comm;
13447 static int hf_zbee_gp_cmd_proxy_commissioning_mode_exit_mode;
13448 static int hf_zbee_gp_cmd_pcm_exit_mode_on_comm_window_expire;
13449 static int hf_zbee_gp_cmd_pcm_exit_mode_on_pairing_success;
13450 static int hf_zbee_gp_cmd_pcm_exit_mode_on_gp_proxy_comm_mode;
13451 static int hf_zbee_zcl_gp_commissioning_window;
13452 static int hf_zbee_zcl_gp_channel;
13454 /* GP_COMMISSIONING_NOTIFICATION */
13455 static int hf_zbee_gp_cmd_comm_notif_opt_app_id;
13456 static int hf_zbee_gp_cmd_comm_notif_opt_rx_after_tx;
13457 static int hf_zbee_gp_cmd_comm_notif_opt_secur_level;
13458 static int hf_zbee_gp_cmd_comm_notif_opt_secur_key_type;
13459 static int hf_zbee_gp_cmd_comm_notif_opt_secur_fail;
13460 static int hf_zbee_gp_cmd_comm_notif_opt_bidir_cap;
13461 static int hf_zbee_gp_cmd_comm_notif_opt_proxy_info_present;
13462 static int hf_zbee_gp_cmd_commissioning_notification_options;
13463 static int ett_zbee_gp_cmd_commissioning_notification_options;
13464 static int hf_zbee_gp_src_id;
13465 static int hf_zbee_gp_ieee;
13466 static int hf_zbee_gp_endpoint;
13467 static int hf_zbee_gp_secur_frame_counter;
13468 static int hf_zbee_gp_gpd_command_id;
13469 static int hf_zbee_gp_short_addr;
13470 static int hf_zbee_gp_gpp_gpd_link;
13471 static int hf_zbee_gp_mic;
13472 static int ett_zbee_gp_gpp_gpd_link;
13473 static int hf_zbee_gpp_gpd_link_rssi;
13474 static int hf_zbee_gpp_gpd_link_lqi;
13475 static int hf_zbee_gp_gpd_payload_size;
13478 /* GP_NOTIFICATION */
13479 static int hf_zbee_gp_cmd_notification_options;
13480 static int ett_zbee_gp_cmd_notification_options;
13481 static int hf_zbee_gp_cmd_notif_opt_app_id;
13482 static int hf_zbee_gp_cmd_notif_opt_also_unicast;
13483 static int hf_zbee_gp_cmd_notif_opt_also_derived_group;
13484 static int hf_zbee_gp_cmd_notif_opt_also_comm_group;
13485 static int hf_zbee_gp_cmd_notif_opt_secur_level;
13486 static int hf_zbee_gp_cmd_notif_opt_secur_key_type;
13487 static int hf_zbee_gp_cmd_notif_opt_rx_after_tx;
13488 static int hf_zbee_gp_cmd_notif_opt_tx_q_full;
13489 static int hf_zbee_gp_cmd_notif_opt_bidir_cap;
13490 static int hf_zbee_gp_cmd_notif_opt_proxy_info_present;
13492 /* GP_PAIRING */
13493 static int hf_zbee_gp_cmd_pairing_opt_app_id;
13494 static int hf_zbee_gp_cmd_pairing_opt_add_sink;
13495 static int hf_zbee_gp_cmd_pairing_opt_remove_gpd;
13496 static int hf_zbee_gp_cmd_pairing_opt_communication_mode;
13497 static int hf_zbee_gp_cmd_pairing_opt_gpd_fixed;
13498 static int hf_zbee_gp_cmd_pairing_opt_gpd_mac_seq_num_cap;
13499 static int hf_zbee_gp_cmd_pairing_opt_secur_level;
13500 static int hf_zbee_gp_cmd_pairing_opt_secur_key_type;
13501 static int hf_zbee_gp_cmd_pairing_opt_gpd_frame_cnt_present;
13502 static int hf_zbee_gp_cmd_pairing_opt_gpd_secur_key_present;
13503 static int hf_zbee_gp_cmd_pairing_opt_assigned_alias_present;
13504 static int hf_zbee_gp_cmd_pairing_opt_fwd_radius_present;
13505 static int hf_zbee_gp_cmd_pairing_options;
13506 static int ett_zbee_gp_cmd_pairing_options;
13507 static int hf_zbee_gp_sink_ieee;
13508 static int hf_zbee_gp_sink_nwk;
13509 static int hf_zbee_gp_sink_group_id;
13510 static int hf_zbee_gp_device_id;
13511 static int hf_zbee_gp_assigned_alias;
13512 static int hf_zbee_gp_forwarding_radius;
13513 static int hf_zbee_gp_gpd_key;
13514 static int hf_zbee_gp_groupcast_radius;
13516 /* GP Response */
13517 static int hf_zbee_gp_cmd_response_options;
13518 static int ett_zbee_gp_cmd_response_options;
13519 static int hf_zbee_gp_cmd_response_tx_channel;
13520 static int ett_zbee_gp_cmd_response_tx_channel;
13521 static int hf_zbee_gp_cmd_resp_opt_app_id;
13522 static int hf_zbee_gp_cmd_resp_opt_tx_on_ep_match;
13523 static int hf_zbee_gp_tmp_master_short_addr;
13524 static int hf_zbee_gp_cmd_resp_tx_channel;
13526 /* GP_PAIRING_CONFIGURATION */
13527 static int hf_zbee_gp_cmd_pc_actions_action;
13528 static int hf_zbee_gp_cmd_pc_actions_send_gp_pairing;
13529 static int hf_zbee_gp_cmd_pc_opt_app_id;
13530 static int hf_zbee_gp_cmd_pc_opt_communication_mode;
13531 static int hf_zbee_gp_cmd_pc_opt_seq_number_cap;
13532 static int hf_zbee_gp_cmd_px_opt_rx_on_cap;
13533 static int hf_zbee_gp_cmd_pc_opt_fixed_location;
13534 static int hf_zbee_gp_cmd_pc_opt_assigned_alias;
13535 static int hf_zbee_gp_cmd_pc_opt_security_use;
13536 static int hf_zbee_gp_cmd_pc_opt_app_info_present;
13537 static int hf_zbee_gp_cmd_pc_secur_level;
13538 static int hf_zbee_gp_cmd_pc_secur_key_type;
13539 static int hf_zbee_gp_cmd_pc_app_info_manuf_id_present;
13540 static int hf_zbee_gp_cmd_pc_app_info_model_id_present;
13541 static int hf_zbee_gp_cmd_pc_app_info_gpd_commands_present;
13542 static int hf_zbee_gp_cmd_pc_app_info_cluster_list_present;
13543 static int hf_zbee_gp_cmd_pc_actions;
13544 static int ett_zbee_gp_cmd_pc_actions;
13545 static int hf_zbee_gp_cmd_pc_options;
13546 static int ett_zbee_gp_cmd_pc_options;
13547 static int ett_zbee_zcl_gp_group_list;
13548 static int hf_zbee_gp_group_list_len;
13549 static int hf_zbee_gp_group_list_group_id;
13550 static int hf_zbee_gp_group_list_alias;
13551 static int hf_zbee_gp_cmd_pc_secur_options;
13552 static int ett_zbee_gp_cmd_pc_secur_options;
13553 static int hf_zbee_gp_n_paired_endpoints;
13554 static int hf_zbee_gp_paired_endpoint;
13555 static int hf_zbee_gp_cmd_pc_app_info;
13556 static int ett_zbee_gp_cmd_pc_app_info;
13557 static int hf_zbee_zcl_gp_manufacturer_id;
13558 static int hf_zbee_zcl_gp_model_id;
13559 static int hf_zbee_gp_n_gpd_commands;
13560 static int hf_zbee_gp_gpd_command;
13561 static int hf_zbee_gp_n_srv_clusters;
13562 static int hf_zbee_gp_n_cli_clusters;
13563 static int hf_zbee_gp_gpd_cluster_id;
13564 static int ett_zbee_zcl_gp_ep;
13565 static int ett_zbee_zcl_gp_cmds;
13566 static int ett_zbee_zcl_gp_clusters;
13567 static int ett_zbee_zcl_gp_srv_clusters;
13568 static int ett_zbee_zcl_gp_cli_clusters;
13570 /* GP_SINK_TABLE_REQUEST and GP_PROXY_TABLE_REQUEST */
13571 static int ett_zbee_zcl_proxy_sink_tbl_req_options;
13572 static int hf_zbee_zcl_proxy_sink_tbl_req_options;
13573 static int hf_zbee_zcl_proxy_sink_tbl_req_fld_app_id;
13574 static int hf_zbee_zcl_proxy_sink_tbl_req_fld_req_type;
13575 static int hf_zbee_zcl_proxy_sink_tbl_req_index;
13577 /* GP_SINK_TABLE_RESPONSE and GP_PROXY_TABLE_RESPONSE */
13578 static int hf_zbee_zcl_proxy_sink_tbl_resp_status;
13579 static int hf_zbee_zcl_proxy_sink_tbl_resp_entries_total;
13580 static int hf_zbee_zcl_proxy_sink_tbl_resp_start_index;
13581 static int hf_zbee_zcl_proxy_sink_tbl_resp_entries_count;
13583 /* GP SINK_COMMISSIONING_MODE */
13584 static int ett_zbee_zcl_gp_cmd_sink_comm_mode_options;
13585 static int hf_zbee_zcl_gp_cmd_sink_comm_mode_options;
13587 static int hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_action;
13588 static int hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_secur;
13589 static int hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_pairing;
13590 static int hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_proxies;
13592 static int hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_secur;
13593 static int hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_pairing;
13594 static int hf_zbee_gp_zcl_cmd_sink_comm_mode_sink_ep;
13596 /* GP Sink Table Attribute */
13597 static int ett_zbee_gp_sink_tbl;
13598 static int ett_zbee_gp_sink_tbl_entry;
13599 static int ett_zbee_gp_sink_tbl_entry_options;
13601 static int hf_zbee_gp_sink_tbl_length;
13602 static int hf_zbee_gp_sink_tbl_entry_options;
13604 static int hf_zbee_gp_sink_tbl_entry_options_app_id;
13605 static int hf_zbee_gp_sink_tbl_entry_options_comm_mode;
13606 static int hf_zbee_gp_sink_tbl_entry_options_seq_num_cap;
13607 static int hf_zbee_gp_sink_tbl_entry_options_rx_on_cap;
13608 static int hf_zbee_gp_sink_tbl_entry_options_fixed_loc;
13609 static int hf_zbee_gp_sink_tbl_entry_options_assigned_alias;
13610 static int hf_zbee_gp_sink_tbl_entry_options_sec_use;
13612 static int ett_zbee_gp_sec_options;
13613 static int hf_zbee_gp_sec_options;
13614 static int hf_zbee_gp_sec_options_sec_level;
13615 static int hf_zbee_gp_sec_options_sec_key_type;
13617 /* GP Proxy Table Attribute */
13618 static int ett_zbee_gp_proxy_tbl;
13619 static int ett_zbee_gp_proxy_tbl_entry;
13620 static int ett_zbee_gp_proxy_tbl_entry_options;
13621 static int ett_zbee_gp_proxy_tbl_entry_ext_options;
13623 static int hf_zbee_gp_proxy_tbl_length;
13624 static int hf_zbee_gp_proxy_tbl_entry_options;
13625 static int hf_zbee_gp_proxy_tbl_entry_ext_options;
13627 static int hf_zbee_gp_proxy_tbl_entry_options_app_id;
13628 static int hf_zbee_gp_proxy_tbl_entry_options_entry_active;
13629 static int hf_zbee_gp_proxy_tbl_entry_options_entry_valid;
13630 static int hf_zbee_gp_proxy_tbl_entry_options_seq_num_cap;
13631 static int hf_zbee_gp_proxy_tbl_entry_options_lw_ucast_gps;
13632 static int hf_zbee_gp_proxy_tbl_entry_options_derived_group_gps;
13633 static int hf_zbee_gp_proxy_tbl_entry_options_comm_group_gps;
13634 static int hf_zbee_gp_proxy_tbl_entry_options_first_to_forward;
13635 static int hf_zbee_gp_proxy_tbl_entry_options_in_range;
13636 static int hf_zbee_gp_proxy_tbl_entry_options_gpd_fixed;
13637 static int hf_zbee_gp_proxy_tbl_entry_options_has_all_ucast_routes;
13638 static int hf_zbee_gp_proxy_tbl_entry_options_assigned_alias;
13639 static int hf_zbee_gp_proxy_tbl_entry_options_sec_use;
13640 static int hf_zbee_gp_proxy_tbl_entry_options_opt_ext;
13642 static int hf_zbee_gp_proxy_tbl_entry_search_counter;
13644 static int hf_zbee_gp_proxy_tbl_entry_ext_options_full_ucast_gps;
13646 static int ett_zbee_gp_sink_address_list;
13647 static int hf_zbee_gp_sink_address_list_length;
13649 /* GP gppFunctionality Attribute */
13650 static int ett_zbee_zcl_gp_attr_gpp_func;
13651 static int hf_zbee_zcl_gp_attr_gpp_func;
13653 static int hf_zbee_zcl_gp_attr_gpp_func_fld_gp_feature;
13654 static int hf_zbee_zcl_gp_attr_gpp_func_fld_direct_comm;
13655 static int hf_zbee_zcl_gp_attr_gpp_func_fld_derived_gcast_comm;
13656 static int hf_zbee_zcl_gp_attr_gpp_func_fld_pre_commissioned_gcast_comm;
13657 static int hf_zbee_zcl_gp_attr_gpp_func_fld_full_ucast_comm;
13658 static int hf_zbee_zcl_gp_attr_gpp_func_fld_lw_ucast_comm;
13659 static int hf_zbee_zcl_gp_attr_gpp_func_fld_bidir_op;
13660 static int hf_zbee_zcl_gp_attr_gpp_func_fld_proxy_tbl_maintenance;
13661 static int hf_zbee_zcl_gp_attr_gpp_func_fld_gp_commissioning;
13662 static int hf_zbee_zcl_gp_attr_gpp_func_fld_ct_based_commissioning;
13663 static int hf_zbee_zcl_gp_attr_gpp_func_fld_maintenance_of_gpd;
13664 static int hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_00;
13665 static int hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_01;
13666 static int hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_10;
13667 static int hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_11;
13668 static int hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_ieee_address;
13670 /* GP gppActiveFunctionality Attribute */
13671 static int ett_zbee_zcl_gp_attr_gpp_active_func;
13672 static int hf_zbee_zcl_gp_attr_gpp_active_func;
13673 static int hf_zbee_zcl_gp_attr_gpp_active_func_fld_gp_functionality;
13675 /* GP gpsFunctionality Attribute */
13676 static int ett_zbee_zcl_gp_attr_gps_func;
13677 static int hf_zbee_zcl_gp_attr_gps_func;
13679 static int hf_zbee_zcl_gp_attr_gps_func_fld_gp_feature;
13680 static int hf_zbee_zcl_gp_attr_gps_func_fld_direct_comm;
13681 static int hf_zbee_zcl_gp_attr_gps_func_fld_derived_gcast_comm;
13682 static int hf_zbee_zcl_gp_attr_gps_func_fld_pre_commissioned_gcast_comm;
13683 static int hf_zbee_zcl_gp_attr_gps_func_fld_full_ucast_comm;
13684 static int hf_zbee_zcl_gp_attr_gps_func_fld_lw_ucast_comm;
13685 static int hf_zbee_zcl_gp_attr_gps_func_fld_proximity_bidir_op;
13686 static int hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_bidir_op;
13687 static int hf_zbee_zcl_gp_attr_gps_func_fld_proxy_tbl_maintenance;
13688 static int hf_zbee_zcl_gp_attr_gps_func_fld_proximity_commissioning;
13689 static int hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_commissioning;
13690 static int hf_zbee_zcl_gp_attr_gps_func_fld_ct_based_commissioning;
13691 static int hf_zbee_zcl_gp_attr_gps_func_fld_maintenance_of_gpd;
13692 static int hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_00;
13693 static int hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_01;
13694 static int hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_10;
13695 static int hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_11;
13696 static int hf_zbee_zcl_gp_attr_gps_func_fld_sink_tbl_based_gcast_forwarding;
13697 static int hf_zbee_zcl_gp_attr_gps_func_fld_translation_table;
13698 static int hf_zbee_zcl_gp_attr_gps_func_fld_gpd_ieee_address;
13700 /* GP gppActiveFunctionality Attribute */
13701 static int ett_zbee_zcl_gp_attr_gps_active_func;
13702 static int hf_zbee_zcl_gp_attr_gps_active_func;
13703 static int hf_zbee_zcl_gp_attr_gps_active_func_fld_gp_functionality;
13705 /* GP gpsCommissioningExitMode Attribute */
13706 static int ett_zbee_zcl_gp_attr_gps_comm_exit_mode;
13707 static int hf_zbee_zcl_gp_attr_gps_comm_exit_mode;
13708 static int hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_comm_window_expire;
13709 static int hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_pairing_success;
13710 static int hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_gp_proxy_comm_mode;
13712 /* GP gpsCommunicationMode Attribute */
13713 static int ett_zbee_zcl_gp_attr_gps_communication_mode;
13714 static int hf_zbee_zcl_gp_attr_gps_communication_mode;
13715 static int hf_zbee_zcl_gp_attr_gps_communication_mode_fld_mode;
13717 /* GP gpsSecurityLevel Attribute */
13718 static int ett_zbee_zcl_gp_attr_gps_secur_lvl;
13719 static int hf_zbee_zcl_gp_attr_gps_secur_lvl;
13720 static int hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_min_gpd_secur_lvl;
13721 static int hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_protection_with_gp_link_key;
13722 static int hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_involve_tc;
13724 /* reuse ZGPD command names */
13725 extern value_string_ext zbee_nwk_gp_cmd_names_ext;
13726 /* reuse devices table from ZGPD parser */
13727 extern const value_string zbee_nwk_gp_device_ids_names[];
13729 /*************************/
13730 /* Function Declarations */
13731 /*************************/
13732 void proto_register_zbee_zcl_gp(void);
13733 void proto_reg_handoff_zbee_zcl_gp(void);
13735 static dissector_handle_t zgp_handle;
13739 * dissect_zbee_zcl_gp_payload
13741 * ZigBee ZCL Green Power data payload cluster dissector for wireshark.
13743 * @param tvb - pointer to buffer containing raw packet.
13744 * @param pinfo - pointer to packet information fields
13745 * @param tree - pointer to data tree Wireshark uses to display packet.
13746 * @param offset - offset in a buffer
13748 * @return new offset.
13750 static int
13751 dissect_zbee_zcl_gp_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
13753 unsigned payload_size;
13755 proto_tree_add_item(tree, hf_zbee_gp_gpd_command_id, tvb, offset, 1, ENC_NA);
13756 offset += 1;
13758 payload_size = tvb_get_uint8(tvb, offset);
13759 proto_tree_add_item(tree, hf_zbee_gp_gpd_payload_size, tvb, offset, 1, ENC_NA);
13760 offset += 1;
13762 if (payload_size != 0 && payload_size != 0xff) {
13763 tvbuff_t *gtvb = tvb_new_composite();
13764 bool writable = col_get_writable(pinfo->cinfo, COL_INFO);
13766 /* remove payload length and put command id instead */
13767 tvb_composite_append(gtvb, tvb_new_subset_length(tvb, offset-2, 1));
13768 tvb_composite_append(gtvb, tvb_new_subset_length(tvb, offset, payload_size));
13769 tvb_composite_finalize(gtvb);
13770 /* prevent overwriting COL_INFO */
13771 col_set_writable(pinfo->cinfo, COL_INFO, false);
13772 call_dissector_only(zgp_handle, gtvb, pinfo, tree, NULL);
13773 col_set_writable(pinfo->cinfo, COL_INFO, writable);
13774 offset += payload_size;
13776 return offset;
13780 * dissect_zbee_zcl_gp_group_list
13782 * ZigBee ZCL Green Power Group List dissector for wireshark.
13784 * @param tvb - pointer to buffer containing raw packet.
13785 * @param tree - pointer to data tree Wireshark uses to display packet.
13786 * @param offset - offset in a buffer
13787 * @param text - string attached to Group list subtree
13788 * @return new offset.
13790 static int
13791 dissect_zbee_zcl_gp_group_list(tvbuff_t *tvb, proto_tree *tree, unsigned offset, const char* text)
13793 uint8_t len = tvb_get_uint8(tvb, offset);
13794 proto_tree *gl_tree = proto_tree_add_subtree_format(tree, tvb, offset, len*4+1,
13795 ett_zbee_zcl_gp_group_list, NULL, "%s #%d", text, len);
13797 proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_len, tvb, offset, 1, ENC_NA);
13798 offset += 1;
13799 while (len) {
13800 proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_group_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
13801 offset += 2;
13802 proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_alias, tvb, offset, 2, ENC_LITTLE_ENDIAN);
13803 offset += 2;
13804 len--;
13807 return offset;
13808 } /*dissect_zbee_zcl_gp_group_list*/
13811 * dissect_zbee_zcl_gp_sink_address_list
13813 * ZigBee ZCL Green Power Sink Address List dissector for wireshark.
13815 * @param tvb - pointer to buffer containing raw packet.
13816 * @param tree - pointer to data tree Wireshark uses to display packet.
13817 * @param offset - offset in a buffer
13818 * @param text - string attached to Sink Address list subtree
13819 * @return new offset.
13821 static int
13822 dissect_zbee_zcl_gp_sink_address_list(tvbuff_t *tvb, proto_tree *tree, unsigned offset, const char* text)
13824 uint8_t len = tvb_get_uint8(tvb, offset);
13825 proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, offset, len*10+1,
13826 ett_zbee_gp_sink_address_list, NULL, "%s #%d", text, len);
13828 proto_tree_add_item(subtree, hf_zbee_gp_sink_address_list_length, tvb, offset, 1, ENC_NA);
13829 offset += 1;
13830 while (len) {
13831 proto_tree_add_item(subtree, hf_zbee_gp_sink_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN);
13832 offset += 8;
13833 proto_tree_add_item(subtree, hf_zbee_gp_sink_nwk, tvb, offset, 2, ENC_LITTLE_ENDIAN);
13834 offset += 2;
13835 len--;
13838 return offset;
13839 } /*dissect_zbee_zcl_gp_sink_address_list*/
13842 * dissect_zbee_zcl_gp_sink_table_entry
13844 * ZigBee ZCL Green Power Sink Table entry dissector for wireshark.
13846 * @param tvb - pointer to buffer containing raw packet.
13847 * @param tree - pointer to data tree Wireshark uses to display packet.
13848 * @param offset - offset in a buffer
13849 * @param idx - entry index
13851 * @return 1 if entry parsed, 0 - otherwise.
13853 static int
13854 dissect_zbee_zcl_gp_sink_table_entry(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, unsigned idx)
13856 uint16_t options = 0;
13857 uint16_t app_id, comm_mode;
13858 proto_tree *subtree;
13859 static int * const n_options[] = {
13860 &hf_zbee_gp_sink_tbl_entry_options_app_id,
13861 &hf_zbee_gp_sink_tbl_entry_options_comm_mode,
13862 &hf_zbee_gp_sink_tbl_entry_options_seq_num_cap,
13863 &hf_zbee_gp_sink_tbl_entry_options_rx_on_cap,
13864 &hf_zbee_gp_sink_tbl_entry_options_fixed_loc,
13865 &hf_zbee_gp_sink_tbl_entry_options_assigned_alias,
13866 &hf_zbee_gp_sink_tbl_entry_options_sec_use,
13867 NULL
13869 static int * const n_secur_options[] = {
13870 &hf_zbee_gp_sec_options_sec_level,
13871 &hf_zbee_gp_sec_options_sec_key_type,
13872 NULL
13875 subtree = proto_tree_add_subtree_format(tree, tvb, *offset, -1, ett_zbee_gp_sink_tbl_entry,
13876 NULL, "Sink Table Entry #%d", idx);
13878 /* Options - 2 bytes */
13879 options = tvb_get_uint16(tvb, *offset, ENC_LITTLE_ENDIAN);
13880 proto_tree_add_bitmask(subtree, tvb, *offset, hf_zbee_gp_sink_tbl_entry_options,
13881 ett_zbee_gp_sink_tbl_entry_options, n_options, ENC_LITTLE_ENDIAN);
13882 *offset += 2;
13884 app_id = (options & ZBEE_ZCL_GP_SINK_TBL_OPT_APP_ID) >> ws_ctz(ZBEE_ZCL_GP_SINK_TBL_OPT_APP_ID);
13885 switch (app_id) {
13886 case ZBEE_ZCL_GP_APP_ID_DEFAULT:
13887 /* Add 4 byte SRC ID */
13888 proto_tree_add_item(subtree, hf_zbee_gp_src_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
13889 *offset += 4;
13890 break;
13891 case ZBEE_ZCL_GP_APP_ID_ZGP:
13892 /* Add IEEE address and endpoint (9 bytes) */
13893 proto_tree_add_item(subtree, hf_zbee_gp_ieee, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
13894 *offset += 8;
13895 proto_tree_add_item(subtree, hf_zbee_gp_endpoint, tvb, *offset, 1, ENC_NA);
13896 *offset += 1;
13897 break;
13898 default:
13899 /* Bad entry - stop Sink Table Entry parsing */
13900 return 0;
13903 /* Device ID - 1 byte */
13904 proto_tree_add_item(subtree, hf_zbee_gp_device_id, tvb, *offset, 1, ENC_NA);
13905 *offset += 1;
13907 /* Group list */
13908 comm_mode = (options & ZBEE_ZCL_GP_SINK_TBL_OPT_COMMUNICATION_MODE) >>
13909 ws_ctz(ZBEE_ZCL_GP_SINK_TBL_OPT_COMMUNICATION_MODE);
13910 if (comm_mode == ZBEE_ZCL_GP_COMMUNICATION_MODE_GROUPCAST_PRECOMMISSIONED) {
13911 *offset = dissect_zbee_zcl_gp_group_list(tvb, subtree, *offset, "GroupList");
13914 /* GPD Assigned Alias: 2 bytes */
13915 if (options & ZBEE_ZCL_GP_SINK_TBL_OPT_ASSIGNED_ALIAS) {
13916 proto_tree_add_item(subtree, hf_zbee_gp_assigned_alias, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
13917 *offset += 2;
13920 /* Groupcast radius: 1 byte */
13921 proto_tree_add_item(subtree, hf_zbee_gp_groupcast_radius, tvb, *offset, 1, ENC_NA);
13922 *offset += 1;
13924 /* Security options: 1 byte */
13925 if (options & ZBEE_ZCL_GP_SINK_TBL_OPT_SECURITY_USE) {
13926 proto_tree_add_bitmask(subtree, tvb, *offset, hf_zbee_gp_sec_options,
13927 ett_zbee_gp_sec_options, n_secur_options, ENC_NA);
13928 *offset += 1;
13931 /* GPD Frame Counter: 4 bytes */
13932 if ((options & ZBEE_ZCL_GP_SINK_TBL_OPT_SECURITY_USE) || (options & ZBEE_ZCL_GP_SINK_TBL_OPT_SEQ_NUMBER_CAP)) {
13933 proto_tree_add_item(subtree, hf_zbee_gp_secur_frame_counter, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
13934 *offset += 4;
13937 /* GPD key: 16 bytes */
13938 if (options & ZBEE_ZCL_GP_SINK_TBL_OPT_SECURITY_USE) {
13939 proto_tree_add_item(subtree, hf_zbee_gp_gpd_key, tvb, *offset, 16, ENC_NA);
13940 *offset += 16;
13943 return 1;
13947 * dissect_zbee_zcl_gp_sink_table
13949 * ZigBee ZCL Green Power Sink Table dissector for wireshark.
13951 * @param tvb - pointer to buffer containing raw packet.
13952 * @param tree - pointer to data tree Wireshark uses to display packet.
13953 * @param offset - offset in a buffer
13955 * @return new offset.
13957 static int
13958 dissect_zbee_zcl_gp_sink_table(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
13960 uint16_t sink_tbl_len, n_parsed_octets;
13961 uint8_t n_tbl_entries;
13962 proto_tree *sink_tbl_tree;
13964 n_parsed_octets = 0;
13965 n_tbl_entries = 0;
13966 sink_tbl_len = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN);
13968 sink_tbl_tree = proto_tree_add_subtree_format(tree, tvb, offset, sink_tbl_len,
13969 ett_zbee_gp_sink_tbl, NULL, "Sink Table: length = %d", sink_tbl_len);
13970 proto_tree_add_item(sink_tbl_tree, hf_zbee_gp_sink_tbl_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
13971 offset += 2;
13972 if (sink_tbl_len == 0) {
13973 return offset;
13976 while (n_parsed_octets < sink_tbl_len) {
13977 unsigned old_offset = offset;
13978 if (dissect_zbee_zcl_gp_sink_table_entry(tvb, sink_tbl_tree, &offset, n_tbl_entries + 1)) {
13979 n_parsed_octets += offset - old_offset;
13981 else {
13982 /* Bad Sink Table Entry - stop Sink Table attribute dissection */
13983 break;
13986 ++n_tbl_entries;
13989 return offset;
13990 } /*dissect_zbee_zcl_gp_sink_table*/
13993 * dissect_zbee_zcl_gp_proxy_table_entry
13995 * ZigBee ZCL Green Power Proxy Table entry dissector for wireshark.
13997 * @param tvb - pointer to buffer containing raw packet.
13998 * @param tree - pointer to data tree Wireshark uses to display packet.
13999 * @param offset - offset in a buffer
14000 * @param idx - entry index
14002 * @return 1 if entry parsed, 0 - otherwise.
14004 static int
14005 dissect_zbee_zcl_gp_proxy_table_entry(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, unsigned idx)
14007 uint16_t options = 0;
14008 uint16_t ext_options = 0;
14009 uint16_t app_id;
14010 proto_tree *subtree;
14011 static int * const n_options[] = {
14012 &hf_zbee_gp_proxy_tbl_entry_options_app_id,
14013 &hf_zbee_gp_proxy_tbl_entry_options_entry_active,
14014 &hf_zbee_gp_proxy_tbl_entry_options_entry_valid,
14015 &hf_zbee_gp_proxy_tbl_entry_options_seq_num_cap,
14016 &hf_zbee_gp_proxy_tbl_entry_options_lw_ucast_gps,
14017 &hf_zbee_gp_proxy_tbl_entry_options_derived_group_gps,
14018 &hf_zbee_gp_proxy_tbl_entry_options_comm_group_gps,
14019 &hf_zbee_gp_proxy_tbl_entry_options_first_to_forward,
14020 &hf_zbee_gp_proxy_tbl_entry_options_in_range,
14021 &hf_zbee_gp_proxy_tbl_entry_options_gpd_fixed,
14022 &hf_zbee_gp_proxy_tbl_entry_options_has_all_ucast_routes,
14023 &hf_zbee_gp_proxy_tbl_entry_options_assigned_alias,
14024 &hf_zbee_gp_proxy_tbl_entry_options_sec_use,
14025 &hf_zbee_gp_proxy_tbl_entry_options_opt_ext,
14026 NULL
14028 static int * const n_ext_options[] = {
14029 &hf_zbee_gp_proxy_tbl_entry_ext_options_full_ucast_gps,
14030 NULL
14032 static int * const n_secur_options[] = {
14033 &hf_zbee_gp_sec_options_sec_level,
14034 &hf_zbee_gp_sec_options_sec_key_type,
14035 NULL
14038 subtree = proto_tree_add_subtree_format(tree, tvb, *offset, -1,
14039 ett_zbee_gp_proxy_tbl_entry, NULL, "Proxy Table Entry #%d", idx);
14041 /* Options - 2 bytes */
14042 options = tvb_get_uint16(tvb, *offset, ENC_LITTLE_ENDIAN);
14043 proto_tree_add_bitmask(subtree, tvb, *offset, hf_zbee_gp_proxy_tbl_entry_options,
14044 ett_zbee_gp_proxy_tbl_entry_options, n_options, ENC_LITTLE_ENDIAN);
14045 *offset += 2;
14047 app_id = (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_APP_ID) >> ws_ctz(ZBEE_ZCL_GP_PROXY_TBL_OPT_APP_ID);
14048 switch (app_id) {
14049 case ZBEE_ZCL_GP_APP_ID_DEFAULT:
14050 /* Add 4 byte SRC ID */
14051 proto_tree_add_item(subtree, hf_zbee_gp_src_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
14052 *offset += 4;
14053 break;
14054 case ZBEE_ZCL_GP_APP_ID_ZGP:
14055 /* Add IEEE address and endpoint (9 bytes) */
14056 proto_tree_add_item(subtree, hf_zbee_gp_ieee, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
14057 *offset += 8;
14058 proto_tree_add_item(subtree, hf_zbee_gp_endpoint, tvb, *offset, 1, ENC_NA);
14059 *offset += 1;
14060 break;
14061 default:
14062 /* Bad entry - stop Proxy Table entry parsing */
14063 return 0;
14067 /* Assigned Alias - 2 bytes */
14068 if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_ASSIGNED_ALIAS) {
14069 proto_tree_add_item(subtree, hf_zbee_gp_assigned_alias, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
14070 *offset += 2;
14073 /* Security Options - 1 byte */
14074 if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_SECURITY_USE) {
14075 proto_tree_add_bitmask(subtree, tvb, *offset, hf_zbee_gp_sec_options,
14076 ett_zbee_gp_sec_options, n_secur_options, ENC_NA);
14077 *offset += 1;
14080 /* GPD Frame Counter: 4 bytes */
14081 if ((options & ZBEE_ZCL_GP_PROXY_TBL_OPT_SECURITY_USE) || (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_SEQ_NUMBER_CAP)) {
14082 proto_tree_add_item(subtree, hf_zbee_gp_secur_frame_counter, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
14083 *offset += 4;
14086 /* GPD key: 16 bytes */
14087 if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_SECURITY_USE) {
14088 proto_tree_add_item(subtree, hf_zbee_gp_gpd_key, tvb, *offset, 16, ENC_NA);
14089 *offset += 16;
14092 if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_LW_UCAST_GPS) {
14093 *offset = dissect_zbee_zcl_gp_sink_address_list(tvb, subtree, *offset, "Lightweight Sink Address list");
14096 /* Sink Group list */
14097 if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_COMM_GROUP_GPS) {
14098 *offset = dissect_zbee_zcl_gp_group_list(tvb, subtree, *offset, "Sink GroupList");
14101 /* Groupcast radius: 1 byte */
14102 proto_tree_add_item(subtree, hf_zbee_gp_groupcast_radius, tvb, *offset, 1, ENC_NA);
14103 *offset += 1;
14105 /* Search Counter: 1 byte */
14106 if (!(options & ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_ACTIVE) || !(options & ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_VALID)) {
14107 proto_tree_add_item(subtree, hf_zbee_gp_proxy_tbl_entry_search_counter, tvb, *offset, 1, ENC_NA);
14108 *offset += 1;
14111 /* Extended Options: 2 bytes */
14112 if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_OPTIONS_EXTENTIONS) {
14113 ext_options = tvb_get_uint16(tvb, *offset, ENC_LITTLE_ENDIAN);
14114 proto_tree_add_bitmask(subtree, tvb, *offset, hf_zbee_gp_proxy_tbl_entry_ext_options,
14115 ett_zbee_gp_proxy_tbl_entry_ext_options, n_ext_options, ENC_LITTLE_ENDIAN);
14116 *offset += 1;
14119 /* Full unicast sink address list */
14120 if (ext_options & ZBEE_ZCL_GP_PROXY_TBL_EXT_OPT_FULL_UCAST_GPS) {
14121 *offset = dissect_zbee_zcl_gp_sink_address_list(tvb, subtree, *offset, "Full unicast Sink Address list");
14124 return 1;
14128 * dissect_zbee_zcl_gp_proxy_table
14130 * ZigBee ZCL Green Power Proxy Table dissector for wireshark.
14132 * @param tvb - pointer to buffer containing raw packet.
14133 * @param tree - pointer to data tree Wireshark uses to display packet.
14134 * @param offset - offset in a buffer
14136 * @return new offset.
14138 static int
14139 dissect_zbee_zcl_gp_proxy_table(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
14141 uint16_t proxy_tbl_len, n_parsed_octets;
14142 uint8_t n_tbl_entries;
14143 proto_tree *proxy_tbl_tree;
14145 n_parsed_octets = 0;
14146 n_tbl_entries = 0;
14147 proxy_tbl_len = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN);
14149 proxy_tbl_tree = proto_tree_add_subtree_format(tree, tvb, offset, proxy_tbl_len,
14150 ett_zbee_gp_proxy_tbl, NULL, "Proxy Table: length = %d", proxy_tbl_len);
14151 proto_tree_add_item(proxy_tbl_tree, hf_zbee_gp_proxy_tbl_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
14152 offset += 2;
14153 if (proxy_tbl_len == 0) {
14154 return offset;
14157 while (n_parsed_octets < proxy_tbl_len) {
14158 unsigned old_offset = offset;
14159 if (dissect_zbee_zcl_gp_proxy_table_entry(tvb, proxy_tbl_tree, &offset, n_tbl_entries + 1)) {
14160 n_parsed_octets += offset - old_offset;
14162 else {
14163 /* Bad Proxy Table entry - stop Proxy Table attribute dissection */
14164 break;
14167 ++n_tbl_entries;
14170 return offset;
14171 } /*dissect_zbee_zcl_gp_proxy_table*/
14174 * dissect_zbee_zcl_gp_attr_gpp_functionality
14176 * ZigBee ZCL Green Power gppFunctionality dissector for wireshark.
14178 * @param tvb - pointer to buffer containing raw packet.
14179 * @param tree - pointer to data tree Wireshark uses to display packet.
14180 * @param offset - offset in a buffer
14182 * @return new offset.
14184 static int
14185 dissect_zbee_zcl_gp_attr_gpp_functionality(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
14187 static int * const n_fields[] = {
14188 &hf_zbee_zcl_gp_attr_gpp_func_fld_gp_feature,
14189 &hf_zbee_zcl_gp_attr_gpp_func_fld_direct_comm,
14190 &hf_zbee_zcl_gp_attr_gpp_func_fld_derived_gcast_comm,
14191 &hf_zbee_zcl_gp_attr_gpp_func_fld_pre_commissioned_gcast_comm,
14192 &hf_zbee_zcl_gp_attr_gpp_func_fld_full_ucast_comm,
14193 &hf_zbee_zcl_gp_attr_gpp_func_fld_lw_ucast_comm,
14194 &hf_zbee_zcl_gp_attr_gpp_func_fld_bidir_op,
14195 &hf_zbee_zcl_gp_attr_gpp_func_fld_proxy_tbl_maintenance,
14196 &hf_zbee_zcl_gp_attr_gpp_func_fld_gp_commissioning,
14197 &hf_zbee_zcl_gp_attr_gpp_func_fld_ct_based_commissioning,
14198 &hf_zbee_zcl_gp_attr_gpp_func_fld_maintenance_of_gpd,
14199 &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_00,
14200 &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_01,
14201 &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_10,
14202 &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_11,
14203 &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_ieee_address,
14204 NULL
14207 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gpp_func,
14208 ett_zbee_zcl_gp_attr_gpp_func, n_fields, ENC_LITTLE_ENDIAN);
14209 offset += 3;
14211 return offset;
14212 } /*dissect_zbee_zcl_gp_attr_gpp_functionality*/
14215 * dissect_zbee_zcl_gp_attr_gpp_active_functionality
14217 * ZigBee ZCL Green Power gppActiveFunctionality dissector for wireshark.
14219 * @param tvb - pointer to buffer containing raw packet.
14220 * @param tree - pointer to data tree Wireshark uses to display packet.
14221 * @param offset - offset in a buffer
14223 * @return new offset.
14225 static int
14226 dissect_zbee_zcl_gp_attr_gpp_active_functionality(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
14228 static int * const n_fields[] = {
14229 &hf_zbee_zcl_gp_attr_gpp_active_func_fld_gp_functionality,
14230 NULL
14233 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gpp_active_func,
14234 ett_zbee_zcl_gp_attr_gpp_active_func, n_fields, ENC_LITTLE_ENDIAN);
14235 offset += 3;
14237 return offset;
14238 } /*dissect_zbee_zcl_gp_attr_gpp_active_functionality*/
14241 * dissect_zbee_zcl_gp_attr_gps_functionality
14243 * ZigBee ZCL Green Power gpsFunctionality dissector for wireshark.
14245 * @param tvb - pointer to buffer containing raw packet.
14246 * @param tree - pointer to data tree Wireshark uses to display packet.
14247 * @param offset - offset in a buffer
14249 * @return new offset.
14251 static int
14252 dissect_zbee_zcl_gp_attr_gps_functionality(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
14254 static int * const n_fields[] = {
14255 &hf_zbee_zcl_gp_attr_gps_func_fld_gp_feature,
14256 &hf_zbee_zcl_gp_attr_gps_func_fld_direct_comm,
14257 &hf_zbee_zcl_gp_attr_gps_func_fld_derived_gcast_comm,
14258 &hf_zbee_zcl_gp_attr_gps_func_fld_pre_commissioned_gcast_comm,
14259 &hf_zbee_zcl_gp_attr_gps_func_fld_full_ucast_comm,
14260 &hf_zbee_zcl_gp_attr_gps_func_fld_lw_ucast_comm,
14261 &hf_zbee_zcl_gp_attr_gps_func_fld_proximity_bidir_op,
14262 &hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_bidir_op,
14263 &hf_zbee_zcl_gp_attr_gps_func_fld_proxy_tbl_maintenance,
14264 &hf_zbee_zcl_gp_attr_gps_func_fld_proximity_commissioning,
14265 &hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_commissioning,
14266 &hf_zbee_zcl_gp_attr_gps_func_fld_ct_based_commissioning,
14267 &hf_zbee_zcl_gp_attr_gps_func_fld_maintenance_of_gpd,
14268 &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_00,
14269 &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_01,
14270 &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_10,
14271 &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_11,
14272 &hf_zbee_zcl_gp_attr_gps_func_fld_sink_tbl_based_gcast_forwarding,
14273 &hf_zbee_zcl_gp_attr_gps_func_fld_translation_table,
14274 &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_ieee_address,
14275 NULL
14278 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gps_func,
14279 ett_zbee_zcl_gp_attr_gps_func, n_fields, ENC_LITTLE_ENDIAN);
14280 offset += 3;
14282 return offset;
14283 } /*dissect_zbee_zcl_gp_attr_gps_functionality*/
14286 * dissect_zbee_zcl_gp_attr_gps_active_functionality
14288 * ZigBee ZCL Green Power gpsActiveFunctionality dissector for wireshark.
14290 * @param tvb - pointer to buffer containing raw packet.
14291 * @param tree - pointer to data tree Wireshark uses to display packet.
14292 * @param offset - offset in a buffer
14294 * @return new offset.
14296 static int
14297 dissect_zbee_zcl_gp_attr_gps_active_functionality(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
14299 static int * const n_fields[] = {
14300 &hf_zbee_zcl_gp_attr_gps_active_func_fld_gp_functionality,
14301 NULL
14304 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gps_active_func,
14305 ett_zbee_zcl_gp_attr_gps_active_func, n_fields, ENC_LITTLE_ENDIAN);
14306 offset += 3;
14308 return offset;
14309 } /*dissect_zbee_zcl_gp_attr_gps_active_functionality*/
14312 * dissect_zbee_zcl_gp_attr_gps_communication_mode
14314 * ZigBee ZCL Green Power gpsCommunicationMode dissector for wireshark.
14316 * @param tvb - pointer to buffer containing raw packet.
14317 * @param tree - pointer to data tree Wireshark uses to display packet.
14318 * @param offset - offset in a buffer
14320 * @return new offset.
14322 static int
14323 dissect_zbee_zcl_gp_attr_gps_communication_mode(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
14325 static int * const n_fields[] = {
14326 &hf_zbee_zcl_gp_attr_gps_communication_mode_fld_mode,
14327 NULL
14330 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gps_communication_mode,
14331 ett_zbee_zcl_gp_attr_gps_communication_mode, n_fields, ENC_NA);
14332 offset += 1;
14334 return offset;
14335 } /*dissect_zbee_zcl_gp_attr_gps_communication_mode*/
14338 * dissect_zbee_zcl_gp_attr_gps_comm_exit_mode
14340 * ZigBee ZCL Green Power gpsCommissioningExitMode dissector for wireshark.
14342 * @param tvb - pointer to buffer containing raw packet.
14343 * @param tree - pointer to data tree Wireshark uses to display packet.
14344 * @param offset - offset in a buffer
14346 * @return new offset.
14348 static int
14349 dissect_zbee_zcl_gp_attr_gps_comm_exit_mode(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
14351 static int * const n_fields[] = {
14352 &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_comm_window_expire,
14353 &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_pairing_success,
14354 &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_gp_proxy_comm_mode,
14355 NULL
14358 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gps_comm_exit_mode,
14359 ett_zbee_zcl_gp_attr_gps_comm_exit_mode, n_fields, ENC_NA);
14360 offset += 1;
14362 return offset;
14363 } /*dissect_zbee_zcl_gp_attr_gps_comm_exit_mode*/
14366 * dissect_zbee_zcl_gp_attr_gps_secur_lvl
14368 * ZigBee ZCL Green Power gpsSecurityLevel dissector for wireshark.
14370 * @param tvb - pointer to buffer containing raw packet.
14371 * @param tree - pointer to data tree Wireshark uses to display packet.
14372 * @param offset - offset in a buffer
14374 * @return new offset.
14376 static int
14377 dissect_zbee_zcl_gp_attr_gps_secur_lvl(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
14379 static int * const n_fields[] = {
14380 &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_min_gpd_secur_lvl,
14381 &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_protection_with_gp_link_key,
14382 &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_involve_tc,
14383 NULL
14386 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gps_secur_lvl,
14387 ett_zbee_zcl_gp_attr_gps_secur_lvl, n_fields, ENC_NA);
14388 offset += 1;
14390 return offset;
14391 } /*dissect_zbee_zcl_gp_attr_gps_secur_lvl*/
14394 * dissect_zcl_gp_proxy_sink_table_request
14396 * ZigBee ZCL Green Power cluster dissector for Proxy Table Request
14397 * and Sink Table Request commands
14399 * @param tree - pointer to data tree Wireshark uses to display packet.
14400 * @param tvb - pointer to buffer containing raw packet.
14401 * @param offset - pointer to buffer offset
14403 static void
14404 dissect_zcl_gp_proxy_sink_table_request(proto_tree *tree, tvbuff_t *tvb, unsigned *offset)
14406 /* get Options field */
14407 uint8_t options = tvb_get_uint8(tvb, *offset);
14408 uint8_t app_id, req_type;
14409 static int * const n_options[] = {
14410 &hf_zbee_zcl_proxy_sink_tbl_req_fld_app_id,
14411 &hf_zbee_zcl_proxy_sink_tbl_req_fld_req_type,
14412 NULL
14415 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_proxy_sink_tbl_req_options,
14416 ett_zbee_zcl_proxy_sink_tbl_req_options, n_options, ENC_NA);
14417 *offset += 1;
14418 app_id = options & ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_APP_ID;
14419 req_type = (options & ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_REQ_TYPE) >>
14420 ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_REQ_TYPE_SHIFT;
14421 if (req_type == ZBEE_ZCL_GP_PROXY_SINK_TABLE_REQ_CMD_REQUSET_BY_GPD_ID) {
14422 /* Include GPD ID and/or Endpoint */
14423 if (app_id == ZBEE_ZCL_GP_APP_ID_DEFAULT) {
14424 /* App_id = 000: GPD SRC ID only */
14425 proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
14426 *offset += 4;
14428 else if (app_id == ZBEE_ZCL_GP_APP_ID_ZGP) {
14429 /* App_id = 010: MAC address + Endpoint */
14430 proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
14431 *offset += 8;
14432 proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, *offset, 1, ENC_NA);
14433 *offset += 1;
14436 else if (req_type == ZBEE_ZCL_GP_PROXY_SINK_TABLE_REQ_CMD_REQUSET_BY_INDEX) {
14437 /* Include index only */
14438 proto_tree_add_item(tree, hf_zbee_zcl_proxy_sink_tbl_req_index, tvb, *offset, 1, ENC_NA);
14439 *offset += 1;
14441 } /*dissect_zcl_gp_proxy_sink_table_request*/
14444 * dissect_zcl_gp_proxy_sink_table_response
14446 * ZigBee ZCL Green Power cluster dissector for Proxy Table response
14447 * and Sink Table Request commands
14449 * @param tree - pointer to data tree Wireshark uses to display packet.
14450 * @param tvb - pointer to buffer containing raw packet.
14451 * @param offset - pointer to buffer offset
14452 * @param attr_id - attribute (should be ZBEE_ZCL_ATTR_GPS_SINK_TABLE or
14453 * ZBEE_ZCL_ATTR_GPP_PROXY_TABLE) that will be reported
14455 static void
14456 dissect_zcl_gp_proxy_sink_table_response(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id)
14458 uint8_t entries_count, start_index;
14459 unsigned i, stop;
14461 if ( !((attr_id == ZBEE_ZCL_ATTR_GPS_SINK_TABLE) || (attr_id == ZBEE_ZCL_ATTR_GPP_PROXY_TABLE)) ) {
14462 return;
14465 proto_tree_add_item(tree, hf_zbee_zcl_proxy_sink_tbl_resp_status, tvb, *offset, 1, ENC_NA);
14466 *offset += 1;
14467 proto_tree_add_item(tree, hf_zbee_zcl_proxy_sink_tbl_resp_entries_total, tvb, *offset, 1, ENC_NA);
14468 *offset += 1;
14469 start_index = tvb_get_uint8(tvb, *offset);
14470 proto_tree_add_item(tree, hf_zbee_zcl_proxy_sink_tbl_resp_start_index, tvb, *offset, 1, ENC_NA);
14471 *offset += 1;
14472 entries_count = tvb_get_uint8(tvb, *offset);
14473 proto_tree_add_item(tree, hf_zbee_zcl_proxy_sink_tbl_resp_entries_count, tvb, *offset, 1, ENC_NA);
14474 *offset += 1;
14476 for (i = 0, stop = 0; i < entries_count && !stop; i++) {
14477 switch (attr_id) {
14478 case ZBEE_ZCL_ATTR_GPS_SINK_TABLE:
14479 stop = !dissect_zbee_zcl_gp_sink_table_entry(tvb, tree, (unsigned*) offset, start_index + i);
14480 break;
14481 case ZBEE_ZCL_ATTR_GPP_PROXY_TABLE:
14482 stop = !dissect_zbee_zcl_gp_proxy_table_entry(tvb, tree, (unsigned*) offset, start_index + i);
14483 break;
14486 } /*dissect_zcl_gp_proxy_sink_table_response*/
14489 * dissect_zcl_gp_sink_comm_mode
14491 * ZigBee ZCL Green Power cluster dissector for Sink Commissioning Mode
14492 * and Sink Table Request commands
14494 * @param tree - pointer to data tree Wireshark uses to display packet.
14495 * @param tvb - pointer to buffer containing raw packet.
14496 * @param offset - pointer to buffer offset
14498 static void
14499 dissect_zcl_gp_sink_comm_mode(proto_tree *tree, tvbuff_t *tvb, unsigned *offset)
14501 static int * const n_options[] = {
14502 &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_action,
14503 &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_secur,
14504 &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_pairing,
14505 &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_proxies,
14506 NULL
14509 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_gp_cmd_sink_comm_mode_options,
14510 ett_zbee_zcl_gp_cmd_sink_comm_mode_options, n_options, ENC_NA);
14511 *offset += 1;
14512 proto_tree_add_item(tree, hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_secur, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
14513 *offset += 2;
14514 proto_tree_add_item(tree, hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_pairing, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
14515 *offset += 2;
14516 proto_tree_add_item(tree, hf_zbee_gp_zcl_cmd_sink_comm_mode_sink_ep, tvb, *offset, 1, ENC_NA);
14517 *offset += 1;
14518 } /*dissect_zcl_gp_sink_comm_mode*/
14521 * dissect_zbee_zcl_gp
14523 * ZigBee ZCL Green Power cluster dissector for wireshark.
14525 * @param tvb - pointer to buffer containing raw packet.
14526 * @param pinfo - pointer to packet information fields
14527 * @param tree - pointer to data tree Wireshark uses to display packet.
14528 * @param data - pointer to ZCL packet structure.
14530 * @return length of parsed data.
14532 static int
14533 dissect_zbee_zcl_gp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
14535 static int * const gpp_gpd_link[] = {
14536 &hf_zbee_gpp_gpd_link_rssi,
14537 &hf_zbee_gpp_gpd_link_lqi,
14538 NULL
14541 zbee_zcl_packet *zcl;
14542 unsigned offset = 0;
14543 uint8_t cmd_id;
14545 /* Reject the packet if data is NULL */
14546 if (data == NULL)
14547 return 0;
14548 zcl = (zbee_zcl_packet *)data;
14549 cmd_id = zcl->cmd_id;
14551 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
14552 /* Append the command name to the info column. */
14553 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
14554 val_to_str_const(cmd_id, zbee_zcl_gp_srv_rx_cmd_names, "Unknown Command"),
14555 zcl->tran_seqno);
14557 /* Add the command ID. */
14558 proto_tree_add_item(tree, hf_zbee_zcl_gp_srv_rx_cmd_id, tvb, offset, 1, ENC_NA);
14559 offset++;
14561 /* Handle the command dissection. */
14562 switch (cmd_id) {
14563 case ZBEE_CMD_ID_GP_NOTIFICATION:
14565 static int * const n_options[] = {
14566 &hf_zbee_gp_cmd_notif_opt_app_id,
14567 &hf_zbee_gp_cmd_notif_opt_also_unicast,
14568 &hf_zbee_gp_cmd_notif_opt_also_derived_group,
14569 &hf_zbee_gp_cmd_notif_opt_also_comm_group,
14570 &hf_zbee_gp_cmd_notif_opt_secur_level,
14571 &hf_zbee_gp_cmd_notif_opt_secur_key_type,
14572 &hf_zbee_gp_cmd_notif_opt_rx_after_tx,
14573 &hf_zbee_gp_cmd_notif_opt_tx_q_full,
14574 &hf_zbee_gp_cmd_notif_opt_bidir_cap,
14575 &hf_zbee_gp_cmd_notif_opt_proxy_info_present,
14576 NULL
14578 uint16_t options = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN);
14580 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_notification_options,
14581 ett_zbee_gp_cmd_notification_options, n_options, ENC_LITTLE_ENDIAN);
14582 offset += 2;
14583 if ((options & ZBEE_ZCL_GP_NOTIFICATION_OPTION_APP_ID) == 0) {
14584 proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
14585 offset += 4;
14587 else {
14588 proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN);
14589 offset += 8;
14590 proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, offset, 1, ENC_NA);
14591 offset += 1;
14593 proto_tree_add_item(tree, hf_zbee_gp_secur_frame_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
14594 offset += 4;
14596 offset = dissect_zbee_zcl_gp_payload(tvb, pinfo, tree, offset);
14598 if (options & ZBEE_ZCL_GP_NOTIFICATION_OPTION_PROXY_INFO_PRESENT) {
14599 proto_tree_add_item(tree, hf_zbee_gp_short_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN);
14600 offset += 2;
14601 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_gpp_gpd_link,
14602 ett_zbee_gp_gpp_gpd_link,
14603 gpp_gpd_link, ENC_LITTLE_ENDIAN);
14604 offset += 1;
14606 break;
14609 case ZBEE_CMD_ID_GP_PAIRING_SEARCH:
14610 case ZBEE_CMD_ID_GP_TUNNELING_STOP:
14611 /* TODO: add commands parse */
14612 break;
14614 case ZBEE_CMD_ID_GP_COMMISSIONING_NOTIFICATION:
14616 static int * const commn_options[] = {
14617 &hf_zbee_gp_cmd_comm_notif_opt_app_id,
14618 &hf_zbee_gp_cmd_comm_notif_opt_rx_after_tx,
14619 &hf_zbee_gp_cmd_comm_notif_opt_secur_level,
14620 &hf_zbee_gp_cmd_comm_notif_opt_secur_key_type,
14621 &hf_zbee_gp_cmd_comm_notif_opt_secur_fail,
14622 &hf_zbee_gp_cmd_comm_notif_opt_bidir_cap,
14623 &hf_zbee_gp_cmd_comm_notif_opt_proxy_info_present,
14624 NULL
14626 uint16_t options = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN);
14628 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_commissioning_notification_options,
14629 ett_zbee_gp_cmd_commissioning_notification_options, commn_options, ENC_LITTLE_ENDIAN);
14630 offset += 2;
14631 if ((options & ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_APP_ID) == 0) {
14632 proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
14633 offset += 4;
14635 else {
14636 proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN);
14637 offset += 8;
14638 proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, offset, 1, ENC_NA);
14639 offset += 1;
14641 proto_tree_add_item(tree, hf_zbee_gp_secur_frame_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
14642 offset += 4;
14644 offset = dissect_zbee_zcl_gp_payload(tvb, pinfo, tree, offset);
14646 if (options & ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_PROXY_INFO_PRESENT) {
14647 proto_tree_add_item(tree, hf_zbee_gp_short_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN);
14648 offset += 2;
14649 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_gpp_gpd_link,
14650 ett_zbee_gp_gpp_gpd_link,
14651 gpp_gpd_link, ENC_LITTLE_ENDIAN);
14652 offset += 1;
14654 if (options & ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_FAILED) {
14655 proto_tree_add_item(tree, hf_zbee_gp_mic, tvb, offset, 4, ENC_LITTLE_ENDIAN);
14656 offset += 4;
14658 break;
14661 case ZBEE_CMD_ID_GP_PAIRING_CONFIGURATION:
14663 static int * const pc_actions[] = {
14664 &hf_zbee_gp_cmd_pc_actions_action,
14665 &hf_zbee_gp_cmd_pc_actions_send_gp_pairing,
14666 NULL
14668 static int * const pc_options[] = {
14669 &hf_zbee_gp_cmd_pc_opt_app_id,
14670 &hf_zbee_gp_cmd_pc_opt_communication_mode,
14671 &hf_zbee_gp_cmd_pc_opt_seq_number_cap,
14672 &hf_zbee_gp_cmd_px_opt_rx_on_cap,
14673 &hf_zbee_gp_cmd_pc_opt_fixed_location,
14674 &hf_zbee_gp_cmd_pc_opt_assigned_alias,
14675 &hf_zbee_gp_cmd_pc_opt_security_use,
14676 &hf_zbee_gp_cmd_pc_opt_app_info_present,
14677 NULL
14679 uint16_t options;
14681 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_pc_actions,
14682 ett_zbee_gp_cmd_pc_actions, pc_actions, ENC_NA);
14683 offset += 1;
14685 options = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN);
14687 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_pc_options,
14688 ett_zbee_gp_cmd_pc_options, pc_options, ENC_LITTLE_ENDIAN);
14689 offset += 2;
14691 if ((options & ZBEE_ZCL_GP_CMD_PC_OPT_APP_ID) == 0) {
14692 proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
14693 offset += 4;
14695 else {
14696 proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN);
14697 offset += 8;
14698 proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, offset, 1, ENC_NA);
14699 offset += 1;
14702 proto_tree_add_item(tree, hf_zbee_gp_device_id, tvb, offset, 1, ENC_NA);
14703 offset += 1;
14705 if (((options & ZBEE_ZCL_GP_CMD_PC_OPT_COMMUNICATION_MODE) >> ZBEE_ZCL_GP_PAIRING_CONFIGURATION_OPTION_COMMUNICATION_MODE_SHIFT)
14706 == ZBEE_ZCL_GP_COMMUNICATION_MODE_GROUPCAST_PRECOMMISSIONED) {
14707 uint8_t len = tvb_get_uint8(tvb, offset);
14708 proto_tree *gl_tree = proto_tree_add_subtree_format(tree, tvb, offset, len*4+1, ett_zbee_zcl_gp_group_list, NULL, "GroupList #%d", len);
14710 proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_len, tvb, offset, 1, ENC_NA);
14711 offset += 1;
14712 while (len)
14714 proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_group_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
14715 offset += 2;
14716 proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_alias, tvb, offset, 2, ENC_LITTLE_ENDIAN);
14717 offset += 2;
14718 len--;
14722 if (options & ZBEE_ZCL_GP_CMD_PC_OPT_ASSIGNED_ALIAS) {
14723 proto_tree_add_item(tree, hf_zbee_gp_assigned_alias, tvb, offset, 2, ENC_LITTLE_ENDIAN);
14724 offset += 2;
14727 proto_tree_add_item(tree, hf_zbee_gp_forwarding_radius, tvb, offset, 1, ENC_NA);
14728 offset += 1;
14730 if (options & ZBEE_ZCL_GP_CMD_PC_OPT_SECURITY_USE) {
14731 static int * const secur_options[] = {
14732 &hf_zbee_gp_cmd_pc_secur_level,
14733 &hf_zbee_gp_cmd_pc_secur_key_type,
14734 NULL
14736 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_pc_secur_options,
14737 ett_zbee_gp_cmd_pc_secur_options, secur_options, ENC_NA);
14738 offset += 1;
14739 proto_tree_add_item(tree, hf_zbee_gp_secur_frame_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
14740 offset += 4;
14741 proto_tree_add_item(tree, hf_zbee_gp_gpd_key, tvb, offset, 16, ENC_NA);
14742 offset += 16;
14745 uint8_t n_paired_endpoints = tvb_get_uint8(tvb, offset);
14746 proto_tree *ep_tree = proto_tree_add_subtree_format(tree, tvb, offset, n_paired_endpoints+1, ett_zbee_zcl_gp_ep, NULL, "Paired Endpoints #%d", n_paired_endpoints);
14747 proto_tree_add_item(ep_tree, hf_zbee_gp_n_paired_endpoints, tvb, offset, 1, ENC_NA);
14748 offset += 1;
14749 if (n_paired_endpoints != 0 && n_paired_endpoints != 0xfd
14750 && n_paired_endpoints != 0xfe && n_paired_endpoints != 0xff)
14752 while (n_paired_endpoints)
14754 proto_tree_add_item(ep_tree, hf_zbee_gp_paired_endpoint, tvb, offset, 1, ENC_NA);
14755 offset += 1;
14756 n_paired_endpoints--;
14760 if (options & ZBEE_ZCL_GP_CMD_PC_OPT_APP_INFO_PRESENT) {
14761 static int * const app_info[] = {
14762 &hf_zbee_gp_cmd_pc_app_info_manuf_id_present,
14763 &hf_zbee_gp_cmd_pc_app_info_model_id_present,
14764 &hf_zbee_gp_cmd_pc_app_info_gpd_commands_present,
14765 &hf_zbee_gp_cmd_pc_app_info_cluster_list_present,
14766 NULL
14768 uint8_t appi = tvb_get_uint8(tvb, offset);
14770 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_pc_app_info,
14771 ett_zbee_gp_cmd_pc_app_info, app_info, ENC_NA);
14772 offset += 1;
14773 if (appi & ZBEE_ZCL_GP_CMD_PC_APP_INFO_MANUF_ID_PRESENT) {
14774 proto_tree_add_item(tree, hf_zbee_zcl_gp_manufacturer_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
14775 offset += 2;
14777 if (appi & ZBEE_ZCL_GP_CMD_PC_APP_INFO_MODEL_ID_PRESENT) {
14778 proto_tree_add_item(tree, hf_zbee_zcl_gp_model_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
14779 offset += 2;
14781 if (appi & ZBEE_ZCL_GP_CMD_PC_APP_INFO_GPD_COMMANDS_PRESENT) {
14782 uint8_t n_commands = tvb_get_uint8(tvb, offset);
14783 proto_tree *c_tree = proto_tree_add_subtree_format(tree, tvb, offset, n_commands+1, ett_zbee_zcl_gp_cmds, NULL, "GPD CommandID list #%d", n_commands);
14784 proto_tree_add_item(c_tree, hf_zbee_gp_n_gpd_commands, tvb, offset, 1, ENC_NA);
14785 offset += 1;
14786 while (n_commands)
14788 proto_tree_add_item(c_tree, hf_zbee_gp_gpd_command, tvb, offset, 1, ENC_NA);
14789 offset += 1;
14790 n_commands--;
14793 if (appi & ZBEE_ZCL_GP_CMD_PC_APP_INFO_CLUSTER_LIST_PRESENT) {
14794 uint8_t n = tvb_get_uint8(tvb, offset);
14795 uint8_t n_srv_clusters = n & ZBEE_ZCL_GP_CLUSTER_LIST_LEN_SRV;
14796 uint8_t n_cli_clusters = (n & ZBEE_ZCL_GP_CLUSTER_LIST_LEN_CLI) >> ZBEE_ZCL_GP_CLUSTER_LIST_LEN_CLI_SHIFT;
14797 proto_tree *cl_tree = proto_tree_add_subtree_format(tree, tvb, offset, n*2+1, ett_zbee_zcl_gp_clusters, NULL, "Cluster List #%d/%d", n_srv_clusters, n_cli_clusters);
14798 proto_tree_add_item(cl_tree, hf_zbee_gp_n_srv_clusters, tvb, offset, 1, ENC_NA);
14799 proto_tree_add_item(cl_tree, hf_zbee_gp_n_cli_clusters, tvb, offset, 1, ENC_NA);
14800 offset += 1;
14801 if (n_srv_clusters)
14803 proto_tree *s_tree = proto_tree_add_subtree_format(cl_tree, tvb, offset, n_srv_clusters*2, ett_zbee_zcl_gp_srv_clusters, NULL, "Server clusters #%d", n_srv_clusters);
14804 while (n_srv_clusters)
14806 proto_tree_add_item(s_tree, hf_zbee_gp_gpd_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
14807 offset += 2;
14808 n_srv_clusters--;
14811 if (n_cli_clusters)
14813 proto_tree *c_tree = proto_tree_add_subtree_format(cl_tree, tvb, offset, n_cli_clusters*2, ett_zbee_zcl_gp_cli_clusters, NULL, "Client clusters #%d", n_cli_clusters);
14814 while (n_cli_clusters)
14816 proto_tree_add_item(c_tree, hf_zbee_gp_gpd_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
14817 offset += 2;
14818 n_cli_clusters--;
14823 break;
14826 case ZBEE_CMD_ID_GP_SINK_COMMISSIONING_MODE:
14827 dissect_zcl_gp_sink_comm_mode(tree, tvb, &offset);
14828 break;
14829 case ZBEE_CMD_ID_GP_TRANSLATION_TABLE_UPDATE_COMMAND:
14830 case ZBEE_CMD_ID_GP_TRANSLATION_TABLE_REQUEST:
14831 /* TODO: add commands parse */
14832 break;
14833 case ZBEE_CMD_ID_GP_SINK_TABLE_REQUEST:
14834 dissect_zcl_gp_proxy_sink_table_request(tree, tvb, &offset);
14835 break;
14836 case ZBEE_CMD_ID_GP_PROXY_TABLE_RESPONSE:
14837 dissect_zcl_gp_proxy_sink_table_response(tree, tvb, &offset, ZBEE_ZCL_ATTR_GPP_PROXY_TABLE);
14838 break;
14840 default:
14841 break;
14842 } /* switch */
14843 } else {
14844 /* Append the command name to the info column. */
14845 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
14846 val_to_str_const(cmd_id, zbee_zcl_gp_srv_tx_cmd_names, "Unknown Command"),
14847 zcl->tran_seqno);
14849 /* Add the command ID. */
14850 proto_tree_add_item(tree, hf_zbee_zcl_gp_srv_tx_cmd_id, tvb, offset, 1, ENC_NA);
14851 offset++;
14853 /* Handle the command dissection. */
14854 switch (cmd_id) {
14855 case ZBEE_ZCL_CMD_ID_GP_NOTIFICATION_RESPONSE:
14856 /* TODO: add commands parse */
14857 break;
14859 case ZBEE_ZCL_CMD_ID_GP_PAIRING:
14861 static int * const p_options[] = {
14862 &hf_zbee_gp_cmd_pairing_opt_app_id,
14863 &hf_zbee_gp_cmd_pairing_opt_add_sink,
14864 &hf_zbee_gp_cmd_pairing_opt_remove_gpd,
14865 &hf_zbee_gp_cmd_pairing_opt_communication_mode,
14866 &hf_zbee_gp_cmd_pairing_opt_gpd_fixed,
14867 &hf_zbee_gp_cmd_pairing_opt_gpd_mac_seq_num_cap,
14868 &hf_zbee_gp_cmd_pairing_opt_secur_level,
14869 &hf_zbee_gp_cmd_pairing_opt_secur_key_type,
14870 &hf_zbee_gp_cmd_pairing_opt_gpd_frame_cnt_present,
14871 &hf_zbee_gp_cmd_pairing_opt_gpd_secur_key_present,
14872 &hf_zbee_gp_cmd_pairing_opt_assigned_alias_present,
14873 &hf_zbee_gp_cmd_pairing_opt_fwd_radius_present,
14874 NULL
14876 uint32_t options = tvb_get_uint24(tvb, offset, ENC_LITTLE_ENDIAN);
14878 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_pairing_options,
14879 ett_zbee_gp_cmd_pairing_options, p_options, ENC_LITTLE_ENDIAN);
14880 offset += 3;
14881 if ((options & ZBEE_ZCL_GP_PAIRING_OPTION_APP_ID) == 0) {
14882 proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
14883 offset += 4;
14885 else {
14886 proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN);
14887 offset += 8;
14888 proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, offset, 1, ENC_NA);
14889 offset += 1;
14891 if ((options & ZBEE_ZCL_GP_PAIRING_OPTION_REMOVE_GPD) == 0 &&
14892 /* see Table 37 */
14893 (options & ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE) == ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE) {
14894 proto_tree_add_item(tree, hf_zbee_gp_sink_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN);
14895 offset += 8;
14896 proto_tree_add_item(tree, hf_zbee_gp_sink_nwk, tvb, offset, 2, ENC_LITTLE_ENDIAN);
14897 offset += 2;
14899 if ((options & ZBEE_ZCL_GP_PAIRING_OPTION_REMOVE_GPD) == 0 &&
14900 (options & ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE) != ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE &&
14901 (options & ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE) != 0) {
14902 proto_tree_add_item(tree, hf_zbee_gp_sink_group_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
14903 offset += 2;
14905 if (options & ZBEE_ZCL_GP_PAIRING_OPTION_ADD_SINK) {
14906 proto_tree_add_item(tree, hf_zbee_gp_device_id, tvb, offset, 1, ENC_NA);
14907 offset += 1;
14909 if (options & ZBEE_ZCL_GP_PAIRING_OPTION_GPD_FRAME_CNT_PRESENT) {
14910 proto_tree_add_item(tree, hf_zbee_gp_secur_frame_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
14911 offset += 4;
14913 if (options & ZBEE_ZCL_GP_PAIRING_OPTION_GPD_SECUR_KEY_PRESENT) {
14914 proto_tree_add_item(tree, hf_zbee_gp_gpd_key, tvb, offset, 16, ENC_NA);
14915 offset += 16;
14917 if (options & ZBEE_ZCL_GP_PAIRING_OPTION_ASSIGNED_ALIAS_PRESENT) {
14918 proto_tree_add_item(tree, hf_zbee_gp_assigned_alias, tvb, offset, 2, ENC_LITTLE_ENDIAN);
14919 offset += 2;
14921 if (options & ZBEE_ZCL_GP_PAIRING_OPTION_FWD_RADIUS_PRESENT) {
14922 proto_tree_add_item(tree, hf_zbee_gp_forwarding_radius, tvb, offset, 1, ENC_NA);
14923 offset += 1;
14925 break;
14928 case ZBEE_ZCL_CMD_ID_GP_PROXY_COMMISSIONING_MODE:
14930 static int * const pcm_options[] = {
14931 &hf_zbee_gp_cmd_pcm_opt_action,
14932 &hf_zbee_gp_cmd_pcm_opt_exit_mode,
14933 &hf_zbee_gp_cmd_pcm_opt_channel_present,
14934 &hf_zbee_gp_cmd_pcm_opt_unicast_comm,
14935 NULL
14937 uint8_t options = tvb_get_uint8(tvb, offset);
14938 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_proxy_commissioning_mode_options,
14939 ett_zbee_gp_cmd_proxy_commissioning_mode_options, pcm_options, ENC_NA);
14940 if (options & ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ACTION) {
14941 static int * const exit_mode[] = {
14942 &hf_zbee_gp_cmd_pcm_exit_mode_on_comm_window_expire,
14943 &hf_zbee_gp_cmd_pcm_exit_mode_on_pairing_success,
14944 &hf_zbee_gp_cmd_pcm_exit_mode_on_gp_proxy_comm_mode,
14945 NULL
14947 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_proxy_commissioning_mode_exit_mode,
14948 ett_zbee_gp_cmd_proxy_commissioning_mode_exit_mode, exit_mode, ENC_NA);
14950 offset += 1;
14951 if (options & ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_COMMISSIONING_WINDOW_EXPIRATION) {
14952 proto_tree_add_item(tree, hf_zbee_zcl_gp_commissioning_window, tvb, offset, 2, ENC_LITTLE_ENDIAN);
14953 offset += 2;
14955 if (options & ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_CHANNEL_PRESENT) {
14956 proto_tree_add_item(tree, hf_zbee_zcl_gp_channel, tvb, offset, 1, ENC_NA);
14957 offset += 1;
14959 break;
14962 case ZBEE_ZCL_CMD_ID_GP_RESPONSE:
14964 static int * const rsp_options[] = {
14965 &hf_zbee_gp_cmd_resp_opt_app_id,
14966 &hf_zbee_gp_cmd_resp_opt_tx_on_ep_match,
14967 NULL
14969 static int * const tx_ch[] = {
14970 &hf_zbee_gp_cmd_resp_tx_channel,
14971 NULL
14973 uint8_t options = tvb_get_uint8(tvb, offset);
14975 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_response_options,
14976 ett_zbee_gp_cmd_response_options, rsp_options, ENC_LITTLE_ENDIAN);
14977 offset += 1;
14978 proto_tree_add_item(tree, hf_zbee_gp_tmp_master_short_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN);
14979 offset += 2;
14980 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_response_tx_channel,
14981 ett_zbee_gp_cmd_response_tx_channel, tx_ch, ENC_LITTLE_ENDIAN);
14982 offset += 1;
14984 if ((options & ZBEE_ZCL_GP_RESPONSE_OPTION_APP_ID) == 0) {
14985 proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
14986 offset += 4;
14988 else {
14989 proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN);
14990 offset += 8;
14991 proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, offset, 1, ENC_NA);
14992 offset += 1;
14995 offset = dissect_zbee_zcl_gp_payload(tvb, pinfo, tree, offset);
14996 break;
14998 case ZBEE_ZCL_CMD_ID_GP_TRANS_TBL_RESPONSE:
14999 /* TODO: add commands parse */
15000 break;
15001 case ZBEE_ZCL_CMD_ID_GP_SINK_TABLE_RESPONSE:
15002 dissect_zcl_gp_proxy_sink_table_response(tree, tvb, &offset, ZBEE_ZCL_ATTR_GPS_SINK_TABLE);
15003 break;
15004 case ZBEE_ZCL_CMD_ID_GP_PROXY_TABLE_REQUEST:
15005 dissect_zcl_gp_proxy_sink_table_request(tree, tvb, &offset);
15006 break;
15007 default:
15008 break;
15009 } /* switch */
15012 /* Call the data dissector for any leftover bytes. */
15013 if (tvb_captured_length(tvb) > offset) {
15014 call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree);
15017 return tvb_captured_length(tvb);
15018 } /* dissect_zbee_zcl_gp */
15022 * dissect_zcl_gp_attr_data
15024 * this function is called by ZCL foundation dissector in order to decode
15025 * specific cluster attributes data.
15027 * @param tree - pointer to data tree Wireshark uses to display packet.
15028 * @param tvb - pointer to buffer containing raw packet.
15029 * @param offset - pointer to buffer offset
15030 * @param attr_id - attribute identifier
15031 * @param data_type - attribute data type
15032 * @param client_attr - ZCL client
15034 static void
15035 dissect_zcl_gp_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id _U_, unsigned data_type, bool client_attr)
15037 /* Dissect attribute data type and data */
15038 switch (attr_id) {
15039 case ZBEE_ZCL_ATTR_GPS_SINK_TABLE:
15040 *offset = dissect_zbee_zcl_gp_sink_table(tvb, tree, *offset);
15041 break;
15042 case ZBEE_ZCL_ATTR_GPS_COMMUNICATION_MODE:
15043 *offset = dissect_zbee_zcl_gp_attr_gps_communication_mode(tvb, tree, *offset);
15044 break;
15045 case ZBEE_ZCL_ATTR_GPS_COMMISSIONING_EXIT_MODE:
15046 *offset = dissect_zbee_zcl_gp_attr_gps_comm_exit_mode(tvb, tree, *offset);
15047 break;
15048 case ZBEE_ZCL_ATTR_GPS_SECURITY_LEVEL:
15049 *offset = dissect_zbee_zcl_gp_attr_gps_secur_lvl(tvb, tree, *offset);
15050 break;
15051 case ZBEE_ZCL_ATTR_GPS_FUNCTIONALITY:
15052 *offset = dissect_zbee_zcl_gp_attr_gps_functionality(tvb, tree, *offset);
15053 break;
15054 case ZBEE_ZCL_ATTR_GPS_ACTIVE_FUNCTIONALITY:
15055 *offset = dissect_zbee_zcl_gp_attr_gps_active_functionality(tvb, tree, *offset);
15056 break;
15057 case ZBEE_ZCL_ATTR_GPP_PROXY_TABLE:
15058 *offset = dissect_zbee_zcl_gp_proxy_table(tvb, tree, *offset);
15059 break;
15060 case ZBEE_ZCL_ATTR_GPP_FUNCTIONALITY:
15061 *offset = dissect_zbee_zcl_gp_attr_gpp_functionality(tvb, tree, *offset);
15062 break;
15063 case ZBEE_ZCL_ATTR_GPP_ACTIVE_FUNCTIONALITY:
15064 *offset = dissect_zbee_zcl_gp_attr_gpp_active_functionality(tvb, tree, *offset);
15065 break;
15066 default:
15067 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
15071 } /*dissect_zcl_gp_attr_data*/
15074 * proto_register_zbee_zcl_gp
15076 * ZigBee ZCL Green Power cluster protocol registration.
15078 void
15079 proto_register_zbee_zcl_gp(void)
15081 /* Setup list of header fields */
15082 static hf_register_info hf[] = {
15084 { &hf_zbee_zcl_gp_attr_id,
15085 { "Attribute", "zbee_zcl_general.gp.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_gp_attr_names),
15086 0x0, NULL, HFILL } },
15088 { &hf_zbee_zcl_gp_srv_rx_cmd_id,
15089 { "Command", "zbee_zcl_general.gp.cmd.srv_rx.id", FT_UINT8, BASE_HEX,
15090 VALS(zbee_zcl_gp_srv_rx_cmd_names), 0x0, NULL, HFILL }},
15092 { &hf_zbee_zcl_gp_srv_tx_cmd_id,
15093 { "Command", "zbee_zcl_general.gp.cmd.srv_tx.id", FT_UINT8, BASE_HEX,
15094 VALS(zbee_zcl_gp_srv_tx_cmd_names), 0x0, NULL, HFILL }},
15096 /* GP Proxy Commissioning Mode command */
15097 { &hf_zbee_gp_cmd_proxy_commissioning_mode_options,
15098 { "Options", "zbee_zcl_general.gp.proxy_comm_mode.options", FT_UINT8, BASE_HEX,
15099 NULL, 0x0, NULL, HFILL }},
15100 { &hf_zbee_zcl_gp_commissioning_window,
15101 { "Commissioning window", "zbee_zcl_general.gp.proxy_comm_mode.comm_window", FT_UINT16, BASE_DEC,
15102 NULL, 0x0, "Commissioning window in seconds", HFILL }},
15103 { &hf_zbee_zcl_gp_channel,
15104 { "Channel", "zbee_zcl_general.gp.proxy_comm_mode.channel", FT_UINT8, BASE_DEC,
15105 NULL, 0x0, "Identifier of the channel the devices SHOULD switch to on reception", HFILL }},
15106 { &hf_zbee_gp_cmd_pcm_opt_action,
15107 { "Action", "zbee_zcl_general.gp.proxy_comm_mode.opt.action", FT_UINT8, BASE_DEC,
15108 VALS(zbee_zcl_gp_comm_mode_actions), ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ACTION, NULL, HFILL }},
15109 { &hf_zbee_gp_cmd_pcm_opt_exit_mode,
15110 { "Exit mode", "zbee_zcl_general.gp.proxy_comm_mode.opt.exit_mode", FT_UINT8, BASE_HEX,
15111 NULL, ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_EXIT_MODE, "Commissioning mode exit requirements", HFILL }},
15112 { &hf_zbee_gp_cmd_pcm_opt_channel_present,
15113 { "Channel present", "zbee_zcl_general.gp.proxy_comm_mode.opt.ch_present", FT_BOOLEAN, 8,
15114 NULL, ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_CHANNEL_PRESENT, "If set to 0b1, it indicates that the Channel field is present", HFILL }},
15115 { &hf_zbee_gp_cmd_pcm_opt_unicast_comm,
15116 { "Unicast", "zbee_zcl_general.gp.proxy_comm_mode.opt.unicast", FT_BOOLEAN, 8,
15117 NULL, ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_UNICAST, "Send the GP Commissioning Notification commands in broadcast (0) vs unicast (1)", HFILL }},
15118 { &hf_zbee_gp_cmd_proxy_commissioning_mode_exit_mode,
15119 { "Exit mode", "zbee_zcl_general.gp.proxy_comm_mode.opt.exit_mode", FT_UINT8, BASE_HEX,
15120 NULL, ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_EXIT_MODE, "Commissioning mode exit requirements", HFILL }},
15121 { &hf_zbee_gp_cmd_pcm_exit_mode_on_comm_window_expire,
15122 { "On Window expire", "zbee_zcl_general.gp.proxy_comm_mode.opt.exit_mode.win_expire", FT_BOOLEAN, 8,
15123 NULL, ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_COMMISSIONING_WINDOW_EXPIRATION, "On CommissioningWindow expiration", HFILL }},
15124 { &hf_zbee_gp_cmd_pcm_exit_mode_on_pairing_success,
15125 { "On first Pairing success", "zbee_zcl_general.gp.proxy_comm_mode.opt.exit_mode.pair_succs", FT_BOOLEAN, 8,
15126 NULL, ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_PAIRING_SUCCESS, NULL, HFILL }},
15127 { &hf_zbee_gp_cmd_pcm_exit_mode_on_gp_proxy_comm_mode,
15128 { "On GP Proxy Commissioning Mode", "zbee_zcl_general.gp.proxy_comm_mode.opt.exit_mode.proxy_comm_mode", FT_BOOLEAN, 8,
15129 NULL, ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_GP_PROXY_COMM_MODE, "On GP Proxy Commissioning Mode (exit)", HFILL }},
15131 /* GP Commissioning Notification command */
15132 { &hf_zbee_gp_cmd_commissioning_notification_options,
15133 { "Options", "zbee_zcl_general.gp.comm_notif.options", FT_UINT16, BASE_HEX,
15134 NULL, 0x0, NULL, HFILL }},
15135 { &hf_zbee_gp_cmd_comm_notif_opt_app_id,
15136 { "ApplicationID", "zbee_zcl_general.gp.comm_notif.opt.app_id", FT_UINT16, BASE_HEX,
15137 VALS(zbee_zcl_gp_app_ids), ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_APP_ID, NULL, HFILL }},
15138 { &hf_zbee_gp_cmd_comm_notif_opt_rx_after_tx,
15139 { "RxAfterTx", "zbee_zcl_general.gp.comm_notif.opt.rx_after_tx", FT_BOOLEAN, 16,
15140 NULL, ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_RX_AFTER_TX, NULL, HFILL }},
15141 { &hf_zbee_gp_cmd_comm_notif_opt_secur_level,
15142 { "SecurityLevel", "zbee_zcl_general.gp.comm_notif.opt.secur_lev", FT_UINT16, BASE_HEX,
15143 VALS(zbee_zcl_gp_secur_levels), ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_LEVEL, NULL, HFILL }},
15144 { &hf_zbee_gp_cmd_comm_notif_opt_secur_key_type,
15145 { "SecurityKeyType", "zbee_zcl_general.gp.comm_notif.opt.secur_key_type", FT_UINT16, BASE_HEX,
15146 VALS(zbee_zcl_gp_secur_key_types), ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_KEY_TYPE, NULL, HFILL }},
15147 { &hf_zbee_gp_cmd_comm_notif_opt_secur_fail,
15148 { "Security processing failed", "zbee_zcl_general.gp.comm_notif.opt.secur_failed", FT_BOOLEAN, 16,
15149 NULL, ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_FAILED, NULL, HFILL }},
15150 { &hf_zbee_gp_cmd_comm_notif_opt_bidir_cap,
15151 { "Bidirectional Capability", "zbee_zcl_general.gp.comm_notif.opt.bidir_cap", FT_BOOLEAN, 16,
15152 NULL, ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_BIDIR_CAP, NULL, HFILL }},
15153 { &hf_zbee_gp_cmd_comm_notif_opt_proxy_info_present,
15154 { "Proxy info present", "zbee_zcl_general.gp.comm_notif.opt.proxy_info", FT_BOOLEAN, 16,
15155 NULL, ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_PROXY_INFO_PRESENT, NULL, HFILL }},
15156 { &hf_zbee_gp_src_id,
15157 { "SrcID", "zbee_zcl_general.gp.src_id", FT_UINT32, BASE_HEX,
15158 NULL, 0, "GPD Source identifier", HFILL }},
15159 { &hf_zbee_gp_ieee,
15160 { "GPD IEEE", "zbee_zcl_general.gp.gpd_ieee", FT_EUI64, BASE_NONE,
15161 NULL, 0, "GPD IEEE address", HFILL }},
15162 { &hf_zbee_gp_endpoint,
15163 { "Endpoint", "zbee_zcl_general.gp.endpoint", FT_UINT8, BASE_HEX,
15164 NULL, 0, NULL, HFILL }},
15165 { &hf_zbee_gp_secur_frame_counter,
15166 { "Frame counter", "zbee_zcl_general.gp.frame_cnt", FT_UINT32, BASE_DEC,
15167 NULL, 0, "GPD security frame counter", HFILL }},
15168 { &hf_zbee_gp_gpd_command_id,
15169 { "ZGPD CommandID", "zbee_zcl_general.gp.command_id", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
15170 &zbee_nwk_gp_cmd_names_ext, 0x0, NULL, HFILL }},
15171 { &hf_zbee_gp_short_addr,
15172 { "GPP short address", "zbee_zcl_general.gp.gpp_short", FT_UINT16, BASE_HEX,
15173 NULL, 0, NULL, HFILL }},
15174 { &hf_zbee_gp_gpp_gpd_link,
15175 { "GPP-GPD link", "zbee_zcl_general.gp.gpd_gpp_link", FT_UINT8, BASE_HEX,
15176 NULL, 0, NULL, HFILL }},
15177 { &hf_zbee_gp_mic,
15178 { "MIC", "zbee_zcl_general.gp.mic", FT_UINT32, BASE_HEX,
15179 NULL, 0, NULL, HFILL }},
15180 { &hf_zbee_gpp_gpd_link_rssi,
15181 { "RSSI", "zbee_zcl_general.gp.gpp_gpd_link.rssi", FT_UINT8, BASE_HEX,
15182 NULL, ZBEE_ZCL_GP_GPP_GPD_LINK_RSSI, NULL, HFILL }},
15183 { &hf_zbee_gpp_gpd_link_lqi,
15184 { "LQI", "zbee_zcl_general.gp.gpp_gpd_link.lqi", FT_UINT8, BASE_HEX,
15185 VALS(zbee_zcl_gp_lqi_vals), ZBEE_ZCL_GP_GPP_GPD_LINK_LQI, NULL, HFILL }},
15186 { &hf_zbee_gp_gpd_payload_size,
15187 { "Payload size", "zbee_zcl_general.gp.payload_size", FT_UINT8, BASE_DEC,
15188 NULL, 0, NULL, HFILL }},
15190 /* GP Notification */
15191 { &hf_zbee_gp_cmd_notification_options,
15192 { "Options", "zbee_zcl_general.gp.notif.opt", FT_UINT16, BASE_HEX,
15193 NULL, 0, NULL, HFILL }},
15194 { &hf_zbee_gp_cmd_notif_opt_app_id,
15195 { "ApplicationID", "zbee_zcl_general.gp.notif.opt.app_id", FT_UINT16, BASE_HEX,
15196 VALS(zbee_zcl_gp_app_ids), ZBEE_ZCL_GP_NOTIFICATION_OPTION_APP_ID, NULL, HFILL }},
15197 { &hf_zbee_gp_cmd_notif_opt_also_unicast,
15198 { "Also Unicast", "zbee_zcl_general.gp.notif.opt.also_unicast", FT_BOOLEAN, 16,
15199 NULL, ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_UNICAST, NULL, HFILL }},
15200 { &hf_zbee_gp_cmd_notif_opt_also_derived_group,
15201 { "Also Derived Group", "zbee_zcl_general.gp.notif.opt.also_derived_grp", FT_BOOLEAN, 16,
15202 NULL, ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_DERIVED_GROUP, NULL, HFILL }},
15203 { &hf_zbee_gp_cmd_notif_opt_also_comm_group,
15204 { "Also Commissioned Group", "zbee_zcl_general.gp.notif.opt.also_comm_grp", FT_BOOLEAN, 16,
15205 NULL, ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_COMMISSIONED_GROUP, NULL, HFILL }},
15206 { &hf_zbee_gp_cmd_notif_opt_secur_level,
15207 { "SecurityLevel", "zbee_zcl_general.gp.notif.opt.secur_lev", FT_UINT16, BASE_HEX,
15208 VALS(zbee_zcl_gp_secur_levels), ZBEE_ZCL_GP_NOTIFICATION_OPTION_SECUR_LEVEL, NULL, HFILL }},
15209 { &hf_zbee_gp_cmd_notif_opt_secur_key_type,
15210 { "SecurityKeyType", "zbee_zcl_general.gp.notif.opt.secur_key_type", FT_UINT16, BASE_HEX,
15211 VALS(zbee_zcl_gp_secur_key_types), ZBEE_ZCL_GP_NOTIFICATION_OPTION_SECUR_KEY_TYPE, NULL, HFILL }},
15212 { &hf_zbee_gp_cmd_notif_opt_rx_after_tx,
15213 { "RxAfterTx", "zbee_zcl_general.gp.comm_notif.opt.rx_after_tx", FT_BOOLEAN, 16,
15214 NULL, ZBEE_ZCL_GP_NOTIFICATION_OPTION_RX_AFTER_TX, NULL, HFILL }},
15215 { &hf_zbee_gp_cmd_notif_opt_tx_q_full,
15216 { "gpTxQueueFull", "zbee_zcl_general.gp.comm_notif.opt.tx_q_full", FT_BOOLEAN, 16,
15217 NULL, ZBEE_ZCL_GP_NOTIFICATION_OPTION_TX_Q_FULL, NULL, HFILL }},
15218 { &hf_zbee_gp_cmd_notif_opt_bidir_cap,
15219 { "Bidirectional Capability", "zbee_zcl_general.gp.notif.opt.bidir_cap", FT_BOOLEAN, 16,
15220 NULL, ZBEE_ZCL_GP_NOTIFICATION_OPTION_BIDIR_CAP, NULL, HFILL }},
15221 { &hf_zbee_gp_cmd_notif_opt_proxy_info_present,
15222 { "Proxy info present", "zbee_zcl_general.gp.notif.opt.proxy_info", FT_BOOLEAN, 16,
15223 NULL, ZBEE_ZCL_GP_NOTIFICATION_OPTION_PROXY_INFO_PRESENT, NULL, HFILL }},
15226 /* GP Pairing */
15227 { &hf_zbee_gp_cmd_pairing_opt_app_id,
15228 { "ApplicationID", "zbee_zcl_general.gp.pairing.opt.app_id", FT_UINT24, BASE_HEX,
15229 VALS(zbee_zcl_gp_app_ids), ZBEE_ZCL_GP_PAIRING_OPTION_APP_ID, NULL, HFILL }},
15230 { &hf_zbee_gp_cmd_pairing_opt_add_sink,
15231 { "Add Sink", "zbee_zcl_general.gp.pairing.opt.add_sink", FT_BOOLEAN, 24,
15232 NULL, ZBEE_ZCL_GP_PAIRING_OPTION_ADD_SINK, NULL, HFILL }},
15233 { &hf_zbee_gp_cmd_pairing_opt_remove_gpd,
15234 { "Remove GPD", "zbee_zcl_general.gp.pairing.opt.remove_gpd", FT_BOOLEAN, 24,
15235 NULL, ZBEE_ZCL_GP_PAIRING_OPTION_REMOVE_GPD, NULL, HFILL }},
15236 { &hf_zbee_gp_cmd_pairing_opt_communication_mode,
15237 { "Communication mode", "zbee_zcl_general.gp.pairing.opt.comm_mode", FT_UINT24, BASE_HEX,
15238 VALS(zbee_zcl_gp_communication_modes), ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE, NULL, HFILL }},
15239 { &hf_zbee_gp_cmd_pairing_opt_gpd_fixed,
15240 { "GPD Fixed", "zbee_zcl_general.gp.pairing.opt.gpd_fixed", FT_BOOLEAN, 24,
15241 NULL, ZBEE_ZCL_GP_PAIRING_OPTION_GPD_FIXED, NULL, HFILL }},
15242 { &hf_zbee_gp_cmd_pairing_opt_gpd_mac_seq_num_cap,
15243 { "MAC Seq number cap", "zbee_zcl_general.gp.pairing.opt.seq_num_cap", FT_BOOLEAN, 24,
15244 NULL, ZBEE_ZCL_GP_PAIRING_OPTION_GPD_MAC_SEQ_NUM_CAP, "GPD MAC sequence number capabilities", HFILL }},
15245 { &hf_zbee_gp_cmd_pairing_opt_secur_level,
15246 { "SecurityLevel", "zbee_zcl_general.gp.pairing.opt.secur_lev", FT_UINT24, BASE_HEX,
15247 VALS(zbee_zcl_gp_secur_levels), ZBEE_ZCL_GP_PAIRING_OPTION_SECUR_LEVEL, NULL, HFILL }},
15248 { &hf_zbee_gp_cmd_pairing_opt_secur_key_type,
15249 { "SecurityKeyType", "zbee_zcl_general.gp.pairing.opt.secur_key_type", FT_UINT24, BASE_HEX,
15250 VALS(zbee_zcl_gp_secur_key_types), ZBEE_ZCL_GP_PAIRING_OPTION_SECUR_KEY_TYPE, NULL, HFILL }},
15251 { &hf_zbee_gp_cmd_pairing_opt_gpd_frame_cnt_present,
15252 { "Frame Counter present", "zbee_zcl_general.gp.pairing.opt.frame_counter_present", FT_BOOLEAN, 24,
15253 NULL, ZBEE_ZCL_GP_PAIRING_OPTION_GPD_FRAME_CNT_PRESENT, "GPD security Frame Counter present", HFILL }},
15254 { &hf_zbee_gp_cmd_pairing_opt_gpd_secur_key_present,
15255 { "Key present", "zbee_zcl_general.gp.pairing.opt.key_present", FT_BOOLEAN, 24,
15256 NULL, ZBEE_ZCL_GP_PAIRING_OPTION_GPD_SECUR_KEY_PRESENT, "GPD security key present", HFILL }},
15257 { &hf_zbee_gp_cmd_pairing_opt_assigned_alias_present,
15258 { "Assigned Alias present", "zbee_zcl_general.gp.pairing.opt.asn_alias_present", FT_BOOLEAN, 24,
15259 NULL, ZBEE_ZCL_GP_PAIRING_OPTION_ASSIGNED_ALIAS_PRESENT, NULL, HFILL }},
15260 { &hf_zbee_gp_cmd_pairing_opt_fwd_radius_present,
15261 { "Forwarding Radius present", "zbee_zcl_general.gp.pairing.opt.fwd_radius_present", FT_BOOLEAN, 24,
15262 NULL, ZBEE_ZCL_GP_PAIRING_OPTION_FWD_RADIUS_PRESENT, NULL, HFILL }},
15263 { &hf_zbee_gp_cmd_pairing_options,
15264 { "Options", "zbee_zcl_general.gp.pairing.opt", FT_UINT24, BASE_HEX,
15265 NULL, 0, NULL, HFILL }},
15266 { &hf_zbee_gp_sink_ieee,
15267 { "Sink IEEE", "zbee_zcl_general.gp.sink_ieee", FT_EUI64, BASE_NONE,
15268 NULL, 0, "Sink IEEE address", HFILL }},
15269 { &hf_zbee_gp_sink_nwk,
15270 { "Sink NWK", "zbee_zcl_general.gp.sink_nwk", FT_UINT16, BASE_HEX,
15271 NULL, 0, "Sink NWK address", HFILL }},
15272 { &hf_zbee_gp_sink_group_id,
15273 { "Sink GroupID", "zbee_zcl_general.gp.sink_grp", FT_UINT16, BASE_HEX,
15274 NULL, 0, NULL, HFILL }},
15275 { &hf_zbee_gp_device_id,
15276 { "DeviceID", "zbee_zcl_general.gp.dev_id", FT_UINT8, BASE_HEX,
15277 VALS(zbee_nwk_gp_device_ids_names), 0, NULL, HFILL }},
15278 { &hf_zbee_gp_assigned_alias,
15279 { "Assigned alias", "zbee_zcl_general.gp.asn_alias", FT_UINT16, BASE_HEX,
15280 NULL, 0, NULL, HFILL }},
15281 { &hf_zbee_gp_forwarding_radius,
15282 { "Forwarding Radius", "zbee_zcl_general.gp.fw_radius", FT_UINT8, BASE_HEX,
15283 NULL, 0, NULL, HFILL }},
15284 { &hf_zbee_gp_gpd_key,
15285 { "GPD key", "zbee_zcl_general.gp.gpd_key", FT_BYTES, BASE_NONE,
15286 NULL, 0, NULL, HFILL }},
15287 { &hf_zbee_gp_groupcast_radius,
15288 { "Groupcast radius", "zbee_zcl_general.gp.groupcast_radius", FT_UINT8, BASE_DEC,
15289 NULL, 0, NULL, HFILL }},
15291 /* GP Response */
15292 { &hf_zbee_gp_cmd_response_options,
15293 { "Options", "zbee_zcl_general.gp.response.opt", FT_UINT8, BASE_HEX,
15294 NULL, 0, NULL, HFILL }},
15295 { &hf_zbee_gp_cmd_resp_opt_app_id,
15296 { "ApplicationID", "zbee_zcl_general.gp.response.opt.app_id", FT_UINT8, BASE_HEX,
15297 NULL, ZBEE_ZCL_GP_RESPONSE_OPTION_APP_ID, NULL, HFILL }},
15298 { &hf_zbee_gp_cmd_resp_opt_tx_on_ep_match,
15299 { "Transmit on endpoint match", "zbee_zcl_general.gp.response.opt.tx_on_ep_match", FT_UINT8, BASE_HEX,
15300 NULL, ZBEE_ZCL_GP_RESPONSE_OPTION_TX_ON_ENDPOINT_MATCH, NULL, HFILL }},
15301 { &hf_zbee_gp_cmd_response_tx_channel,
15302 { "TempMaster Tx channel", "zbee_zcl_general.gp.response.tmpmaster_tx_chan", FT_UINT8, BASE_HEX,
15303 NULL, 0, NULL, HFILL }},
15304 { &hf_zbee_gp_cmd_resp_tx_channel,
15305 { "Transmit channel", "zbee_zcl_general.gp.response.opt.tx_chan", FT_UINT8, BASE_HEX,
15306 VALS(zbee_zcl_gp_channels), ZBEE_ZCL_GP_RESPONSE_TX_CHANNEL, NULL, HFILL }},
15307 { &hf_zbee_gp_tmp_master_short_addr,
15308 { "TempMaster short address", "zbee_zcl_general.gp.response.tmpmaster_addr", FT_UINT16, BASE_HEX,
15309 NULL, 0, NULL, HFILL }},
15311 /* GP Pairing Configuration */
15312 { &hf_zbee_gp_cmd_pc_actions_action,
15313 { "Action", "zbee_zcl_general.gp.pc.action.action", FT_UINT8, BASE_HEX,
15314 VALS(zbee_gp_pc_actions), ZBEE_ZCL_GP_CMD_PC_ACTIONS_ACTION, NULL, HFILL }},
15315 { &hf_zbee_gp_cmd_pc_actions_send_gp_pairing,
15316 { "Send GP Pairing", "zbee_zcl_general.gp.pc.action.send_gp_pairing", FT_BOOLEAN, 8,
15317 NULL, ZBEE_ZCL_GP_CMD_PC_ACTIONS_SEND_GP_PAIRING, NULL, HFILL }},
15318 { &hf_zbee_gp_cmd_pc_opt_app_id,
15319 { "ApplicationID", "zbee_zcl_general.gp.pp.opt.app_id", FT_UINT16, BASE_HEX,
15320 NULL, ZBEE_ZCL_GP_CMD_PC_OPT_APP_ID, NULL, HFILL }},
15321 { &hf_zbee_gp_cmd_pc_opt_communication_mode,
15322 { "Communication mode", "zbee_zcl_general.gp.pc.opt.comm_mode", FT_UINT16, BASE_HEX,
15323 VALS(zbee_zcl_gp_communication_modes), ZBEE_ZCL_GP_CMD_PC_OPT_COMMUNICATION_MODE, NULL, HFILL }},
15324 { &hf_zbee_gp_cmd_pc_opt_seq_number_cap,
15325 { "Sequence number capabilities", "zbee_zcl_general.gp.pc.opt.seq_num_cap", FT_BOOLEAN, 16,
15326 NULL, ZBEE_ZCL_GP_CMD_PC_OPT_SEQ_NUMBER_CAP, NULL, HFILL }},
15327 { &hf_zbee_gp_cmd_px_opt_rx_on_cap,
15328 { "RxOnCapability", "zbee_zcl_general.gp.pc.opt.rx_on_cap", FT_BOOLEAN, 16,
15329 NULL, ZBEE_ZCL_GP_CMD_PC_OPT_RX_ON_CAP, NULL, HFILL }},
15330 { &hf_zbee_gp_cmd_pc_opt_fixed_location,
15331 { "FixedLocation", "zbee_zcl_general.gp.pc.opt.fixed_loc", FT_BOOLEAN, 16,
15332 NULL, ZBEE_ZCL_GP_CMD_PC_OPT_FIXED_LOCATION, NULL, HFILL }},
15333 { &hf_zbee_gp_cmd_pc_opt_assigned_alias,
15334 { "AssignedAlias", "zbee_zcl_general.gp.pc.opt.asn_alias", FT_BOOLEAN, 16,
15335 NULL, ZBEE_ZCL_GP_CMD_PC_OPT_ASSIGNED_ALIAS, NULL, HFILL }},
15336 { &hf_zbee_gp_cmd_pc_opt_security_use,
15337 { "Security use", "zbee_zcl_general.gp.pc.opt.secur_use", FT_BOOLEAN, 16,
15338 NULL, ZBEE_ZCL_GP_CMD_PC_OPT_SECURITY_USE, NULL, HFILL }},
15339 { &hf_zbee_gp_cmd_pc_opt_app_info_present,
15340 { "Application in-formation present", "zbee_zcl_general.gp.pc.opt.app_info_present", FT_BOOLEAN, 16,
15341 NULL, ZBEE_ZCL_GP_CMD_PC_OPT_APP_INFO_PRESENT, NULL, HFILL }},
15342 { &hf_zbee_gp_cmd_pc_secur_level,
15343 { "SecurityLevel", "zbee_zcl_general.gp.pc.secur.secur_lev", FT_UINT8, BASE_HEX,
15344 VALS(zbee_zcl_gp_secur_levels), ZBEE_ZCL_GP_CMD_PC_SECUR_LEVEL, NULL, HFILL }},
15345 { &hf_zbee_gp_cmd_pc_secur_key_type,
15346 { "SecurityKeyType", "zbee_zcl_general.gp.pc.secur.secur_key_type", FT_UINT8, BASE_HEX,
15347 VALS(zbee_zcl_gp_secur_key_types), ZBEE_ZCL_GP_CMD_PC_SECUR_KEY_TYPE, NULL, HFILL }},
15348 { &hf_zbee_gp_cmd_pc_app_info_manuf_id_present,
15349 { "ManufacturerID present", "zbee_zcl_general.gp.pc.app.manuf_id_present", FT_BOOLEAN, 8,
15350 NULL, ZBEE_ZCL_GP_CMD_PC_APP_INFO_MANUF_ID_PRESENT, NULL, HFILL }},
15351 { &hf_zbee_gp_cmd_pc_app_info_model_id_present,
15352 { "ModelID present", "zbee_zcl_general.gp.pc.app.model_id_present", FT_BOOLEAN, 8,
15353 NULL, ZBEE_ZCL_GP_CMD_PC_APP_INFO_MODEL_ID_PRESENT, NULL, HFILL }},
15354 { &hf_zbee_gp_cmd_pc_app_info_gpd_commands_present,
15355 { "GPD commands present", "zbee_zcl_general.gp.pc.app.gpd_cmds_present", FT_BOOLEAN, 8,
15356 NULL, ZBEE_ZCL_GP_CMD_PC_APP_INFO_GPD_COMMANDS_PRESENT, NULL, HFILL }},
15357 { &hf_zbee_gp_cmd_pc_app_info_cluster_list_present,
15358 { "Cluster list present", "zbee_zcl_general.gp.pc.app.cluster_list_present", FT_BOOLEAN, 8,
15359 NULL, ZBEE_ZCL_GP_CMD_PC_APP_INFO_CLUSTER_LIST_PRESENT, NULL, HFILL }},
15360 { &hf_zbee_gp_cmd_pc_actions,
15361 { "Actions", "zbee_zcl_general.gp.pc.actions", FT_UINT8, BASE_HEX,
15362 NULL, 0, NULL, HFILL }},
15363 { &hf_zbee_gp_cmd_pc_options,
15364 { "Options", "zbee_zcl_general.gp.pc.options", FT_UINT16, BASE_HEX,
15365 NULL, 0, NULL, HFILL }},
15366 { &hf_zbee_gp_group_list_len,
15367 { "Group list length", "zbee_zcl_general.gp.group_list.len", FT_UINT8, BASE_DEC,
15368 NULL, 0, NULL, HFILL }},
15369 { &hf_zbee_gp_group_list_group_id,
15370 { "Group id", "zbee_zcl_general.gp.group_list.group", FT_UINT16, BASE_HEX,
15371 NULL, 0, NULL, HFILL }},
15372 { &hf_zbee_gp_group_list_alias,
15373 { "Alias", "zbee_zcl_general.gp.group_list.alias", FT_UINT16, BASE_HEX,
15374 NULL, 0, NULL, HFILL }},
15375 { &hf_zbee_gp_cmd_pc_secur_options,
15376 { "Security Options", "zbee_zcl_general.gp.pc.secur_options", FT_UINT8, BASE_HEX,
15377 NULL, 0, NULL, HFILL }},
15378 { &hf_zbee_gp_n_paired_endpoints,
15379 { "Number of paired endpoints", "zbee_zcl_general.gp.pc.n_ep", FT_UINT8, BASE_DEC,
15380 NULL, 0, NULL, HFILL }},
15381 { &hf_zbee_gp_paired_endpoint,
15382 { "Paired endpoint", "zbee_zcl_general.gp.pc.endpoint", FT_UINT8, BASE_HEX,
15383 NULL, 0, NULL, HFILL }},
15384 { &hf_zbee_gp_cmd_pc_app_info,
15385 { "Application information", "zbee_zcl_general.gp.pc.app_info", FT_UINT8, BASE_HEX,
15386 NULL, 0, NULL, HFILL }},
15387 { &hf_zbee_zcl_gp_manufacturer_id,
15388 { "Manufacturer ID", "zbee_zcl_general.gp.pc.manufacturer_id", FT_UINT16, BASE_HEX,
15389 VALS(zbee_mfr_code_names), 0x0, NULL, HFILL }},
15390 { &hf_zbee_zcl_gp_model_id,
15391 { "Model ID", "zbee_zcl_general.gp.pc.model_id", FT_UINT16, BASE_HEX,
15392 NULL, 0, NULL, HFILL }},
15393 { &hf_zbee_gp_n_gpd_commands,
15394 { "Number of GPD commands", "zbee_zcl_general.gp.pc.n_gpd_commands", FT_UINT8, BASE_DEC,
15395 NULL, 0, NULL, HFILL }},
15396 { &hf_zbee_gp_gpd_command,
15397 { "ZGPD Command ID", "zbee_zcl_general.gp.pc.gpd_command", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
15398 &zbee_nwk_gp_cmd_names_ext, 0x0, NULL, HFILL }},
15399 { &hf_zbee_gp_n_srv_clusters,
15400 { "Number of Server clusters", "zbee_zcl_general.gp.pc.n_srv_clusters", FT_UINT8, BASE_DEC,
15401 NULL, ZBEE_ZCL_GP_CLUSTER_LIST_LEN_SRV, NULL, HFILL }},
15402 { &hf_zbee_gp_n_cli_clusters,
15403 { "Number of Client clusters", "zbee_zcl_general.gp.pc.n_clnt_clusters", FT_UINT8, BASE_DEC,
15404 NULL, ZBEE_ZCL_GP_CLUSTER_LIST_LEN_CLI, NULL, HFILL }},
15405 { &hf_zbee_gp_gpd_cluster_id,
15406 { "Cluster ID", "zbee_zcl_general.gp.pc.cluster", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_aps_cid_names),
15407 0x0, NULL, HFILL }},
15409 /* GP Sink Table Request and GP Proxy Table Request commands */
15410 { &hf_zbee_zcl_proxy_sink_tbl_req_options,
15411 { "Options", "zbee_zcl_general.gp.proxy_sink_tbl_req.options", FT_UINT8, BASE_HEX,
15412 NULL, 0, NULL, HFILL }},
15413 { &hf_zbee_zcl_proxy_sink_tbl_req_fld_app_id,
15414 { "Application ID", "zbee_zcl_general.gp.proxy_sink_tbl_req.options.app_id", FT_UINT8, BASE_HEX,
15415 NULL, ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_APP_ID, NULL, HFILL }},
15416 { &hf_zbee_zcl_proxy_sink_tbl_req_fld_req_type,
15417 { "Request type", "zbee_zcl_general.gp.proxy_sink_tbl_req.options.req_type", FT_UINT8, BASE_HEX,
15418 VALS(zbee_zcl_gp_proxy_sink_tbl_req_type), ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_REQ_TYPE, NULL, HFILL }},
15419 { &hf_zbee_zcl_proxy_sink_tbl_req_index,
15420 { "Index", "zbee_zcl_general.gp.proxy_sink_tbl_req.index", FT_UINT8, BASE_DEC,
15421 NULL, 0, NULL, HFILL }},
15423 /* GP Sink Table Response and GP Proxy Table Response commands */
15424 { &hf_zbee_zcl_proxy_sink_tbl_resp_status,
15425 { "Status", "zbee_zcl_general.gp.proxy_sink_tbl_resp.status", FT_UINT8, BASE_HEX,
15426 VALS(zbee_zcl_status_names), 0, NULL, HFILL }},
15427 { &hf_zbee_zcl_proxy_sink_tbl_resp_entries_total,
15428 { "Total number of non-empty entries", "zbee_zcl_general.gp.proxy_sink_tbl_resp.entries_total", FT_UINT8, BASE_DEC,
15429 NULL, 0, NULL, HFILL }},
15430 { &hf_zbee_zcl_proxy_sink_tbl_resp_start_index,
15431 { "Start index", "zbee_zcl_general.gp.proxy_sink_tbl_resp.start_index", FT_UINT8, BASE_DEC,
15432 NULL, 0, NULL, HFILL }},
15433 { &hf_zbee_zcl_proxy_sink_tbl_resp_entries_count,
15434 { "Entries count", "zbee_zcl_general.gp.proxy_sink_tbl_resp.entries_count", FT_UINT8, BASE_DEC,
15435 NULL, 0, NULL, HFILL }},
15437 /* GP Sink Commissioning Mode command */
15438 { &hf_zbee_zcl_gp_cmd_sink_comm_mode_options,
15439 { "Options", "zbee_zcl_general.gp.sink_comm_mode.options", FT_UINT8, BASE_HEX,
15440 NULL, 0, NULL, HFILL }},
15442 { &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_action,
15443 { "Action", "zbee_zcl_general.gp.sink_comm_mode.options.action", FT_BOOLEAN, 8,
15444 NULL, ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_ACTION, NULL, HFILL }},
15445 { &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_secur,
15446 { "Involve GPM in security", "zbee_zcl_general.gp.sink_comm_mode.options.inv_gpm_in_secur", FT_BOOLEAN, 8,
15447 NULL, ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_GPM_IN_SECUR, NULL, HFILL }},
15448 { &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_pairing,
15449 { "Involve GPM in pairing", "zbee_zcl_general.gp.sink_comm_mode.options.inv_gpm_in_pairing", FT_BOOLEAN, 8,
15450 NULL, ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_GPM_IN_PAIRING, NULL, HFILL }},
15451 { &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_proxies,
15452 { "Involve proxies", "zbee_zcl_general.gp.sink_comm_mode.options.inv_proxies", FT_BOOLEAN, 8,
15453 NULL, ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_PROXIES, NULL, HFILL }},
15455 { &hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_secur,
15456 { "GPM address for security", "zbee_zcl_general.gp.sink_comm_mode.gpm_addr_for_secur", FT_UINT16, BASE_HEX,
15457 NULL, 0, NULL, HFILL }},
15458 { &hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_pairing,
15459 { "GPM address for pairing", "zbee_zcl_general.gp.sink_comm_mode.gpm_addr_for_pairing", FT_UINT16, BASE_HEX,
15460 NULL, 0, NULL, HFILL }},
15461 { &hf_zbee_gp_zcl_cmd_sink_comm_mode_sink_ep,
15462 { "Sink Endpoint", "zbee_zcl_general.gp.sink_comm_mode.sink_ep", FT_UINT8, BASE_DEC,
15463 NULL, 0, NULL, HFILL }},
15465 /* GP Sink Table attribute */
15466 { &hf_zbee_gp_sink_tbl_length,
15467 { "Sink Table length", "zbee_zcl_general.gp.sink_tbl_len", FT_UINT16, BASE_DEC,
15468 NULL, 0, NULL, HFILL }},
15469 { &hf_zbee_gp_sink_tbl_entry_options,
15470 { "Options", "zbee_zcl_general.gp.sink_tbl.entry.opt", FT_UINT16, BASE_HEX,
15471 NULL, 0, NULL, HFILL }},
15472 { &hf_zbee_gp_sec_options,
15473 { "Security Options", "zbee_zcl_general.gp.secur", FT_UINT8, BASE_HEX,
15474 NULL, 0, NULL, HFILL }},
15476 { &hf_zbee_gp_sink_tbl_entry_options_app_id,
15477 { "ApplicationID", "zbee_zcl_general.gp.sink_tbl.entry.opt.app_id", FT_UINT16, BASE_HEX,
15478 NULL, ZBEE_ZCL_GP_SINK_TBL_OPT_APP_ID, NULL, HFILL }},
15479 { &hf_zbee_gp_sink_tbl_entry_options_comm_mode,
15480 { "Communication Mode", "zbee_zcl_general.gp.sink_tbl.entry.opt.comm_mode", FT_UINT16, BASE_HEX,
15481 VALS(zbee_zcl_gp_communication_modes), ZBEE_ZCL_GP_SINK_TBL_OPT_COMMUNICATION_MODE, NULL, HFILL }},
15482 { &hf_zbee_gp_sink_tbl_entry_options_seq_num_cap,
15483 { "Sequence number capabilities", "zbee_zcl_general.gp.sink_tbl.entry.opt.seq_num_cap", FT_BOOLEAN, 16,
15484 NULL, ZBEE_ZCL_GP_SINK_TBL_OPT_SEQ_NUMBER_CAP, NULL, HFILL }},
15485 { &hf_zbee_gp_sink_tbl_entry_options_rx_on_cap,
15486 { "Rx On Capability", "zbee_zcl_general.gp.sink_tbl.entry.opt.rx_on_cap", FT_BOOLEAN, 16,
15487 NULL, ZBEE_ZCL_GP_SINK_TBL_OPT_RX_ON_CAP, NULL, HFILL }},
15488 { &hf_zbee_gp_sink_tbl_entry_options_fixed_loc,
15489 { "Fixed Location", "zbee_zcl_general.gp.sink_tbl.entry.opt.fixed_loc", FT_BOOLEAN, 16,
15490 NULL, ZBEE_ZCL_GP_SINK_TBL_OPT_FIXED_LOCATION, NULL, HFILL }},
15491 { &hf_zbee_gp_sink_tbl_entry_options_assigned_alias,
15492 { "Assigned Alias", "zbee_zcl_general.gp.sink_tbl.entry.opt.asn_alias", FT_BOOLEAN, 16,
15493 NULL, ZBEE_ZCL_GP_SINK_TBL_OPT_ASSIGNED_ALIAS, NULL, HFILL }},
15494 { &hf_zbee_gp_sink_tbl_entry_options_sec_use,
15495 { "Security use", "zbee_zcl_general.gp.sink_tbl.entry.opt.secur_use", FT_BOOLEAN, 16,
15496 NULL, ZBEE_ZCL_GP_SINK_TBL_OPT_SECURITY_USE, NULL, HFILL }},
15498 { &hf_zbee_gp_sec_options_sec_level,
15499 { "Security Level", "zbee_zcl_general.gp.secur.secur_lev", FT_UINT8, BASE_HEX,
15500 VALS(zbee_zcl_gp_secur_levels), ZBEE_ZCL_GP_SECUR_OPT_SECUR_LEVEL, NULL, HFILL }},
15501 { &hf_zbee_gp_sec_options_sec_key_type,
15502 { "Security Key Type", "zbee_zcl_general.gp.secur.secur_key_type", FT_UINT8, BASE_HEX,
15503 VALS(zbee_zcl_gp_secur_key_types), ZBEE_ZCL_GP_SECUR_OPT_SECUR_KEY_TYPE, NULL, HFILL }},
15505 /* GP Proxy Table attribute */
15506 { &hf_zbee_gp_proxy_tbl_length,
15507 { "Proxy Table length", "zbee_zcl_general.gp.proxy_tbl_len", FT_UINT16, BASE_DEC,
15508 NULL, 0, NULL, HFILL }},
15509 { &hf_zbee_gp_proxy_tbl_entry_options,
15510 { "Options", "zbee_zcl_general.gp.proxy_tbl.entry.opt", FT_UINT16, BASE_HEX,
15511 NULL, 0, NULL, HFILL }},
15512 { &hf_zbee_gp_proxy_tbl_entry_ext_options,
15513 { "Extended Options", "zbee_zcl_general.gp.proxy_tbl.entry.ext_opt", FT_UINT8, BASE_HEX,
15514 NULL, 0, NULL, HFILL }},
15516 { &hf_zbee_gp_proxy_tbl_entry_options_app_id,
15517 { "ApplicationID", "zbee_zcl_general.gp.proxy_tbl.entry.opt.app_id", FT_UINT16, BASE_HEX,
15518 NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_APP_ID, NULL, HFILL }},
15519 { &hf_zbee_gp_proxy_tbl_entry_options_entry_active,
15520 { "EntryActive", "zbee_zcl_general.gp.proxy_tbl.entry.opt.entry_active", FT_BOOLEAN, 16,
15521 NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_ACTIVE, NULL, HFILL }},
15522 { &hf_zbee_gp_proxy_tbl_entry_options_entry_valid,
15523 { "EntryValid", "zbee_zcl_general.gp.proxy_tbl.entry.opt.entry_valid", FT_BOOLEAN, 16,
15524 NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_VALID, NULL, HFILL }},
15525 { &hf_zbee_gp_proxy_tbl_entry_options_seq_num_cap,
15526 { "Sequence number capabilities", "zbee_zcl_general.gp.proxy_tbl.entry.opt.seq_num_cap", FT_BOOLEAN, 16,
15527 NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_SEQ_NUMBER_CAP, NULL, HFILL }},
15528 { &hf_zbee_gp_proxy_tbl_entry_options_lw_ucast_gps,
15529 { "Lightweight Unicast GPS", "zbee_zcl_general.gp.proxy_tbl.entry.opt.lw_ucast_gps", FT_BOOLEAN, 16,
15530 NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_LW_UCAST_GPS, NULL, HFILL }},
15531 { &hf_zbee_gp_proxy_tbl_entry_options_derived_group_gps,
15532 { "Derived Group GPS", "zbee_zcl_general.gp.proxy_tbl.entry.opt.derived_group_gps", FT_BOOLEAN, 16,
15533 NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_DERIVED_GROUP_GPS, NULL, HFILL }},
15534 { &hf_zbee_gp_proxy_tbl_entry_options_comm_group_gps,
15535 { "Commissioned Group GPS", "zbee_zcl_general.gp.proxy_tbl.entry.opt.comm_group_gps", FT_BOOLEAN, 16,
15536 NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_COMM_GROUP_GPS, NULL, HFILL }},
15537 { &hf_zbee_gp_proxy_tbl_entry_options_first_to_forward,
15538 { "FirstToForward", "zbee_zcl_general.gp.proxy_tbl.entry.opt.first_to_forward", FT_BOOLEAN, 16,
15539 NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_FIRST_TO_FORWARD, NULL, HFILL }},
15540 { &hf_zbee_gp_proxy_tbl_entry_options_in_range,
15541 { "InRange", "zbee_zcl_general.gp.proxy_tbl.entry.opt.in_range", FT_BOOLEAN, 16,
15542 NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_IN_RANGE, NULL, HFILL }},
15543 { &hf_zbee_gp_proxy_tbl_entry_options_gpd_fixed,
15544 { "GPD Fixed", "zbee_zcl_general.gp.proxy_tbl.entry.opt.gpd_fixed", FT_BOOLEAN, 16,
15545 NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_GPD_FIXED, NULL, HFILL }},
15546 { &hf_zbee_gp_proxy_tbl_entry_options_has_all_ucast_routes,
15547 { "HasAllUnicastRoutes", "zbee_zcl_general.gp.proxy_tbl.entry.opt.has_all_ucast_routes", FT_BOOLEAN, 16,
15548 NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_HAS_ALL_UCAST_ROUTES, NULL, HFILL }},
15549 { &hf_zbee_gp_proxy_tbl_entry_options_assigned_alias,
15550 { "AssignedAlias", "zbee_zcl_general.gp.proxy_tbl.entry.opt.asn_alias", FT_BOOLEAN, 16,
15551 NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_ASSIGNED_ALIAS, NULL, HFILL }},
15552 { &hf_zbee_gp_proxy_tbl_entry_options_sec_use,
15553 { "SecurityUse", "zbee_zcl_general.gp.proxy_tbl.entry.opt.secur_use", FT_BOOLEAN, 16,
15554 NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_SECURITY_USE, NULL, HFILL }},
15555 { &hf_zbee_gp_proxy_tbl_entry_options_opt_ext,
15556 { "Options Extension", "zbee_zcl_general.gp.proxy_tbl.entry.opt.ext_opt", FT_BOOLEAN, 16,
15557 NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_OPTIONS_EXTENTIONS, NULL, HFILL }},
15559 { &hf_zbee_gp_proxy_tbl_entry_search_counter,
15560 { "Search Counter", "zbee_zcl_general.gp.proxy_tbl.entry.search_counter", FT_UINT8, BASE_DEC,
15561 NULL, 0, NULL, HFILL }},
15563 { &hf_zbee_gp_proxy_tbl_entry_ext_options_full_ucast_gps,
15564 { "Full unicast GPS", "zbee_zcl_general.gp.proxy_tbl.entry.ext_opt.full_ucast_gps", FT_BOOLEAN, 16,
15565 NULL, ZBEE_ZCL_GP_PROXY_TBL_EXT_OPT_FULL_UCAST_GPS, NULL, HFILL }},
15567 { &hf_zbee_gp_sink_address_list_length,
15568 { "Sink Address list length", "zbee_zcl_general.gp.sink_addr_list_len", FT_UINT8, BASE_DEC,
15569 NULL, 0, NULL, HFILL }},
15571 /* gppFunctionality attribute */
15572 { &hf_zbee_zcl_gp_attr_gpp_func,
15573 { "gppFunctionality", "zbee_zcl_general.gp.attr.gpp_func", FT_UINT24, BASE_HEX,
15574 NULL, 0, NULL, HFILL }},
15576 { &hf_zbee_zcl_gp_attr_gpp_func_fld_gp_feature,
15577 { "GP feature", "zbee_zcl_general.gp.attr.gpp_func.gp_feature", FT_BOOLEAN, 24,
15578 NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GP_FEATURE, NULL, HFILL }},
15579 { &hf_zbee_zcl_gp_attr_gpp_func_fld_direct_comm,
15580 { "Direct communication", "zbee_zcl_general.gp.attr.gpp_func.direct_comm", FT_BOOLEAN, 24,
15581 NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_DIRECT_COMM, NULL, HFILL }},
15582 { &hf_zbee_zcl_gp_attr_gpp_func_fld_derived_gcast_comm,
15583 { "Derived groupcast communication", "zbee_zcl_general.gp.attr.gpp_func.derived_gcast_comm", FT_BOOLEAN, 24,
15584 NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_DERIVED_GCAST_COMM, NULL, HFILL }},
15585 { &hf_zbee_zcl_gp_attr_gpp_func_fld_pre_commissioned_gcast_comm,
15586 { "Pre-commissioned groupcast communication", "zbee_zcl_general.gp.attr.gpp_func.pre_commissioned_gcast_comm", FT_BOOLEAN, 24,
15587 NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_PRE_COMMISSIONED_GCAST_COMM, NULL, HFILL }},
15588 { &hf_zbee_zcl_gp_attr_gpp_func_fld_full_ucast_comm,
15589 { "Full unicast communication", "zbee_zcl_general.gp.attr.gpp_func.full_ucast_comm", FT_BOOLEAN, 24,
15590 NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_FULL_UCAST_COMM, NULL, HFILL }},
15591 { &hf_zbee_zcl_gp_attr_gpp_func_fld_lw_ucast_comm,
15592 { "Lightweight unicast communication", "zbee_zcl_general.gp.attr.gpp_func.lw_ucast_comm", FT_BOOLEAN, 24,
15593 NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_LW_UCAST_COMM, NULL, HFILL }},
15594 { &hf_zbee_zcl_gp_attr_gpp_func_fld_bidir_op,
15595 { "Bidirectional operation", "zbee_zcl_general.gp.attr.gpp_func.bidir_op", FT_BOOLEAN, 24,
15596 NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_BIDIR_OP, NULL, HFILL }},
15597 { &hf_zbee_zcl_gp_attr_gpp_func_fld_proxy_tbl_maintenance,
15598 { "Proxy Table maintenance", "zbee_zcl_general.gp.attr.gpp_func.proxy_tbl_maintenance", FT_BOOLEAN, 24,
15599 NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_PROXY_TBL_MAINTENANCE, NULL, HFILL }},
15600 { &hf_zbee_zcl_gp_attr_gpp_func_fld_gp_commissioning,
15601 { "GP commissioning", "zbee_zcl_general.gp.attr.gpp_func.gp_commissioning", FT_BOOLEAN, 24,
15602 NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GP_COMMISSIONING, NULL, HFILL }},
15603 { &hf_zbee_zcl_gp_attr_gpp_func_fld_ct_based_commissioning,
15604 { "CT-based commissioning", "zbee_zcl_general.gp.attr.gpp_func.ct_based_commissioning", FT_BOOLEAN, 24,
15605 NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_CT_BASED_COMMISSIONING, NULL, HFILL }},
15606 { &hf_zbee_zcl_gp_attr_gpp_func_fld_maintenance_of_gpd,
15607 { "Maintenance of GPD", "zbee_zcl_general.gp.attr.gpp_func.maintenance_of_gpd", FT_BOOLEAN, 24,
15608 NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_MAINTENANCE_OF_GPD, NULL, HFILL }},
15609 { &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_00,
15610 { "gpdSecurityLevel = 0b00", "zbee_zcl_general.gp.attr.gpp_func.gpd_secur_lvl_00", FT_BOOLEAN, 24,
15611 NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_00, NULL, HFILL }},
15612 { &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_01,
15613 { "Deprecated: gpdSecurityLevel = 0b01", "zbee_zcl_general.gp.attr.gpp_func.gpd_secur_lvl_01", FT_BOOLEAN, 24,
15614 NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_01, NULL, HFILL }},
15615 { &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_10,
15616 { "gpdSecurityLevel = 0b10", "zbee_zcl_general.gp.attr.gpp_func.gpd_secur_lvl_10", FT_BOOLEAN, 24,
15617 NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_10, NULL, HFILL }},
15618 { &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_11,
15619 { "gpdSecurityLevel = 0b11", "zbee_zcl_general.gp.attr.gpp_func.gpd_secur_lvl_11", FT_BOOLEAN, 24,
15620 NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_11, NULL, HFILL }},
15621 { &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_ieee_address,
15622 { "GPD IEEE address", "zbee_zcl_general.gp.attr.gpp_func.gpd_ieee_address", FT_BOOLEAN, 24,
15623 NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_IEEE_ADDRESS, NULL, HFILL }},
15625 /* gppActiveFunctionality attribute */
15626 { &hf_zbee_zcl_gp_attr_gpp_active_func,
15627 { "gppActiveFunctionality", "zbee_zcl_general.gp.attr.gpp_active_func", FT_UINT24, BASE_HEX,
15628 NULL, 0, NULL, HFILL }},
15630 { &hf_zbee_zcl_gp_attr_gpp_active_func_fld_gp_functionality,
15631 { "GP functionality", "zbee_zcl_general.gp.attr.gpp_active_func.gp_functionality", FT_BOOLEAN, 24,
15632 NULL, ZBEE_ZCL_GP_ATTR_GPP_ACTIVE_FUNC_FLD_GP_FUNCTIONALITY, NULL, HFILL }},
15634 /* gpsFunctionality attribute */
15635 { &hf_zbee_zcl_gp_attr_gps_func,
15636 { "gpsFunctionality", "zbee_zcl_general.gp.attr.gps_func", FT_UINT24, BASE_HEX,
15637 NULL, 0, NULL, HFILL }},
15639 { &hf_zbee_zcl_gp_attr_gps_func_fld_gp_feature,
15640 { "GP feature", "zbee_zcl_general.gp.attr.gps_func.gp_feature", FT_BOOLEAN, 24,
15641 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GP_FEATURE, NULL, HFILL }},
15642 { &hf_zbee_zcl_gp_attr_gps_func_fld_direct_comm,
15643 { "Direct communication", "zbee_zcl_general.gp.attr.gps_func.direct_comm", FT_BOOLEAN, 24,
15644 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_DIRECT_COMM, NULL, HFILL }},
15645 { &hf_zbee_zcl_gp_attr_gps_func_fld_derived_gcast_comm,
15646 { "Derived groupcast communication", "zbee_zcl_general.gp.attr.gps_func.derived_gcast_comm", FT_BOOLEAN, 24,
15647 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_DERIVED_GCAST_COMM, NULL, HFILL }},
15648 { &hf_zbee_zcl_gp_attr_gps_func_fld_pre_commissioned_gcast_comm,
15649 { "Pre-commissioned groupcast communication", "zbee_zcl_general.gp.attr.gps_func.pre_commissioned_gcast_comm", FT_BOOLEAN, 24,
15650 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PRE_COMMISSIONED_GCAST_COMM, NULL, HFILL }},
15651 { &hf_zbee_zcl_gp_attr_gps_func_fld_full_ucast_comm,
15652 { "Full unicast communication", "zbee_zcl_general.gp.attr.gps_func.full_ucast_comm", FT_BOOLEAN, 24,
15653 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_FULL_UCAST_COMM, NULL, HFILL }},
15654 { &hf_zbee_zcl_gp_attr_gps_func_fld_lw_ucast_comm,
15655 { "Lightweight unicast communication", "zbee_zcl_general.gp.attr.gps_func.lw_ucast_comm", FT_BOOLEAN, 24,
15656 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_LW_UCAST_COMM, NULL, HFILL }},
15657 { &hf_zbee_zcl_gp_attr_gps_func_fld_proximity_bidir_op,
15658 { "Proximity bidirectional operation", "zbee_zcl_general.gp.attr.gps_func.proximity_bidir_op", FT_BOOLEAN, 24,
15659 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXIMITY_BIDIR_OP, NULL, HFILL }},
15660 { &hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_bidir_op,
15661 { "Multi-hop bidirectional operation", "zbee_zcl_general.gp.attr.gps_func.multi_hop_bidir_op", FT_BOOLEAN, 24,
15662 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MULTI_HOP_BIDIR_OP, NULL, HFILL }},
15663 { &hf_zbee_zcl_gp_attr_gps_func_fld_proxy_tbl_maintenance,
15664 { "Proxy Table maintenance", "zbee_zcl_general.gp.attr.gps_func.proxy_tbl_maintenance", FT_BOOLEAN, 24,
15665 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXY_TBL_MAINTENANCE, NULL, HFILL }},
15666 { &hf_zbee_zcl_gp_attr_gps_func_fld_proximity_commissioning,
15667 { "Proximity commissioning", "zbee_zcl_general.gp.attr.gps_func.proximity_commissioning", FT_BOOLEAN, 24,
15668 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXIMITY_COMMISSIONING, NULL, HFILL }},
15669 { &hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_commissioning,
15670 { "Multi-hop commissioning","zbee_zcl_general.gp.attr.gps_func.multi_hop_commissioning", FT_BOOLEAN, 24,
15671 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MULTI_HOP_COMMISSIONING, NULL, HFILL }},
15672 { &hf_zbee_zcl_gp_attr_gps_func_fld_ct_based_commissioning,
15673 { "CT-based commissioning", "zbee_zcl_general.gp.attr.gps_func.ct_based_commissioning", FT_BOOLEAN, 24,
15674 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_CT_BASED_COMMISSIONING, NULL, HFILL }},
15675 { &hf_zbee_zcl_gp_attr_gps_func_fld_maintenance_of_gpd,
15676 { "Maintenance of GPD", "zbee_zcl_general.gp.attr.gps_func.maintenance_of_gpd", FT_BOOLEAN, 24,
15677 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MAINTENANCE_OF_GPD, NULL, HFILL }},
15678 { &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_00,
15679 { "gpdSecurityLevel = 0b00", "zbee_zcl_general.gp.attr.gps_func.gpd_secur_lvl_00", FT_BOOLEAN, 24,
15680 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_00, NULL, HFILL }},
15681 { &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_01,
15682 { "Deprecated: gpdSecurityLevel = 0b01", "zbee_zcl_general.gp.attr.gps_func.gpd_secur_lvl_01", FT_BOOLEAN, 24,
15683 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_01, NULL, HFILL }},
15684 { &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_10,
15685 { "gpdSecurityLevel = 0b10", "zbee_zcl_general.gp.attr.gps_func.gpd_secur_lvl_10", FT_BOOLEAN, 24,
15686 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_10, NULL, HFILL }},
15687 { &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_11,
15688 { "gpdSecurityLevel = 0b11", "zbee_zcl_general.gp.attr.gps_func.gpd_secur_lvl_11", FT_BOOLEAN, 24,
15689 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_11, NULL, HFILL }},
15690 { &hf_zbee_zcl_gp_attr_gps_func_fld_sink_tbl_based_gcast_forwarding,
15691 { "Sink Table-based groupcast forwarding", "zbee_zcl_general.gp.attr.gps_func.sink_tbl_based_gcast_forwarding", FT_BOOLEAN, 24,
15692 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_SINK_TBL_BASED_GCAST_FORWARDING, NULL, HFILL }},
15693 { &hf_zbee_zcl_gp_attr_gps_func_fld_translation_table,
15694 { "Translation Table", "zbee_zcl_general.gp.attr.gps_func.translation_table", FT_BOOLEAN, 24,
15695 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_TRANSLATION_TABLE, NULL, HFILL }},
15696 { &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_ieee_address,
15697 { "GPD IEEE address", "zbee_zcl_general.gp.attr.gps_func.gpd_ieee_address", FT_BOOLEAN, 24,
15698 NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_IEEE_ADDRESS, NULL, HFILL }},
15700 /* gpsActiveFunctionality attribute */
15701 { &hf_zbee_zcl_gp_attr_gps_active_func,
15702 { "gpsActiveFunctionality", "zbee_zcl_general.gp.attr.gps_active_func", FT_UINT24, BASE_HEX,
15703 NULL, 0, NULL, HFILL }},
15705 { &hf_zbee_zcl_gp_attr_gps_active_func_fld_gp_functionality,
15706 { "GP functionality", "zbee_zcl_general.gp.attr.gps_active_func.gp_functionality", FT_BOOLEAN, 24,
15707 NULL, ZBEE_ZCL_GP_ATTR_GPS_ACTIVE_FUNC_FLD_GP_FUNCTIONALITY, NULL, HFILL }},
15709 /* gpsCommunicationMode attribute */
15710 { &hf_zbee_zcl_gp_attr_gps_communication_mode,
15711 { "gpsCommunicationMode", "zbee_zcl_general.gp.attr.gps_communication_mode", FT_UINT8, BASE_HEX,
15712 NULL, 0, NULL, HFILL }},
15714 { &hf_zbee_zcl_gp_attr_gps_communication_mode_fld_mode,
15715 { "Mode", "zbee_zcl_general.gp.attr.gps_communication_mode.mode", FT_UINT8, BASE_HEX,
15716 VALS(zbee_zcl_gp_communication_modes), ZBEE_ZCL_GP_ATTR_GPS_COMMUNICATION_MODE_FLD_MODE, NULL, HFILL }},
15718 /* gpsCommissioningExitMode attribute */
15719 { &hf_zbee_zcl_gp_attr_gps_comm_exit_mode,
15720 { "gpsCommissioningExitMode", "zbee_zcl_general.gp.attr.gps_comm_exit_mode", FT_UINT8, BASE_HEX,
15721 NULL, 0, NULL, HFILL }},
15723 { &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_comm_window_expire,
15724 { "On CommissioningWindow expiration", "zbee_zcl_general.gp.attr.gps_comm_exit_mode.on_comm_window_expire",
15725 FT_BOOLEAN, 8, NULL, ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_COMM_WINDOW_EXPIRE, NULL, HFILL }},
15726 { &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_pairing_success,
15727 { "On first Pairing success", "zbee_zcl_general.gp.attr.gps_comm_exit_mode.on_pairing_success",
15728 FT_BOOLEAN, 8, NULL, ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_PAIRING_SUCCESS, NULL, HFILL }},
15729 { &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_gp_proxy_comm_mode,
15730 { "On GP Proxy Commissioning Mode (exit)", "zbee_zcl_general.gp.attr.gps_comm_exit_mode.on_gp_proxy_comm_mode",
15731 FT_BOOLEAN, 8, NULL, ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_GP_PROXY_COMM_MODE, NULL, HFILL }},
15733 /* gpsSecurityLevel attribute */
15734 { &hf_zbee_zcl_gp_attr_gps_secur_lvl,
15735 { "gpsSecurityLevel", "zbee_zcl_general.gp.attr.gps_secur_lvl", FT_UINT8, BASE_HEX,
15736 NULL, 0, NULL, HFILL }},
15738 { &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_min_gpd_secur_lvl,
15739 { "Minimal GPD Security Level", "zbee_zcl_general.gp.attr.gps_secur_lvl.min_gpd_secur_lvl", FT_UINT8, BASE_HEX,
15740 VALS(zbee_zcl_gp_secur_levels), ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_MIN_GPD_SECUR_LVL, NULL, HFILL }},
15741 { &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_protection_with_gp_link_key,
15742 { "Protection with gpLinkKey", "zbee_zcl_general.gp.attr.gps_secur_lvl.protection_with_gp_link_key", FT_BOOLEAN, 8,
15743 NULL, ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_PROTECTION_WITH_GP_LINK_KEY, NULL, HFILL }},
15744 { &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_involve_tc,
15745 { "Involve TC", "zbee_zcl_general.gp.attr.gps_secur_lvl.involve_tc", FT_BOOLEAN, 8,
15746 NULL, ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_INVOLVE_TC, NULL, HFILL }}
15749 /* ZCL Green Power subtrees */
15750 static int *ett[] = {
15751 &ett_zbee_zcl_gp,
15752 &ett_zbee_gp_cmd_proxy_commissioning_mode_options,
15753 &ett_zbee_gp_cmd_proxy_commissioning_mode_exit_mode,
15754 &ett_zbee_gp_cmd_commissioning_notification_options,
15755 &ett_zbee_gp_gpp_gpd_link,
15756 &ett_zbee_gp_cmd_notification_options,
15757 &ett_zbee_gp_cmd_pairing_options,
15758 &ett_zbee_gp_cmd_response_options,
15759 &ett_zbee_gp_cmd_response_tx_channel,
15760 &ett_zbee_gp_cmd_pc_actions,
15761 &ett_zbee_gp_cmd_pc_options,
15762 &ett_zbee_zcl_gp_group_list,
15763 &ett_zbee_gp_cmd_pc_secur_options,
15764 &ett_zbee_gp_cmd_pc_app_info,
15765 &ett_zbee_zcl_gp_ep,
15766 &ett_zbee_zcl_gp_cmds,
15767 &ett_zbee_zcl_gp_clusters,
15768 &ett_zbee_zcl_gp_srv_clusters,
15769 &ett_zbee_zcl_gp_cli_clusters,
15770 &ett_zbee_zcl_proxy_sink_tbl_req_options,
15771 &ett_zbee_zcl_gp_cmd_sink_comm_mode_options,
15772 &ett_zbee_gp_sink_tbl,
15773 &ett_zbee_gp_sink_tbl_entry,
15774 &ett_zbee_gp_sink_tbl_entry_options,
15775 &ett_zbee_gp_sec_options,
15776 &ett_zbee_gp_proxy_tbl,
15777 &ett_zbee_gp_proxy_tbl_entry,
15778 &ett_zbee_gp_proxy_tbl_entry_options,
15779 &ett_zbee_gp_proxy_tbl_entry_ext_options,
15780 &ett_zbee_gp_sink_address_list,
15781 &ett_zbee_zcl_gp_attr_gpp_func,
15782 &ett_zbee_zcl_gp_attr_gpp_active_func,
15783 &ett_zbee_zcl_gp_attr_gps_func,
15784 &ett_zbee_zcl_gp_attr_gps_active_func,
15785 &ett_zbee_zcl_gp_attr_gps_communication_mode,
15786 &ett_zbee_zcl_gp_attr_gps_comm_exit_mode,
15787 &ett_zbee_zcl_gp_attr_gps_secur_lvl
15791 /* Register the ZigBee ZCL Green Power cluster protocol name and description */
15792 proto_zbee_zcl_gp = proto_register_protocol("ZigBee ZCL Green Power", "ZCL Green Power", ZBEE_PROTOABBREV_ZCL_GP);
15793 proto_register_field_array(proto_zbee_zcl_gp, hf, array_length(hf));
15794 proto_register_subtree_array(ett, array_length(ett));
15796 /* Register the ZigBee ZCL Green Power dissector. */
15797 register_dissector(ZBEE_PROTOABBREV_ZCL_GP, dissect_zbee_zcl_gp, proto_zbee_zcl_gp);
15798 } /*proto_register_zbee_zcl_gp*/
15801 * proto_reg_handoff_zbee_zcl_gp
15803 * Hands off the ZCL Green Power dissector.
15805 void
15806 proto_reg_handoff_zbee_zcl_gp(void)
15808 zgp_handle = find_dissector(ZBEE_PROTOABBREV_NWK_GP_CMD);
15810 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_GP,
15811 proto_zbee_zcl_gp,
15812 ett_zbee_zcl_gp,
15813 ZBEE_ZCL_CID_GP,
15814 ZBEE_MFG_CODE_NONE,
15815 hf_zbee_zcl_gp_attr_id,
15816 hf_zbee_zcl_gp_attr_id,
15817 hf_zbee_zcl_gp_srv_rx_cmd_id,
15818 hf_zbee_zcl_gp_srv_tx_cmd_id,
15819 (zbee_zcl_fn_attr_data)dissect_zcl_gp_attr_data
15821 } /*proto_reg_handoff_zbee_zcl_gp*/
15823 /* ########################################################################## */
15824 /* #### (0x1000) TOUCHLINK COMMISSIONING CLUSTER ############################ */
15825 /* ########################################################################## */
15827 /*************************/
15828 /* Defines */
15829 /*************************/
15830 /*Server commands received*/
15831 #define ZBEE_ZCL_CMD_ID_SCAN_REQUEST 0x00
15832 #define ZBEE_ZCL_CMD_ID_DEVICE_INFO_REQUEST 0x02
15833 #define ZBEE_ZCL_CMD_ID_IDENTIFY_REQUEST 0x06
15834 #define ZBEE_ZCL_CMD_ID_FACTORT_RESET_REQUEST 0x07
15835 #define ZBEE_ZCL_CMD_ID_NETWORK_START_REQUEST 0x10
15836 #define ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_REQUEST 0x12
15837 #define ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_REQUEST 0x14
15838 #define ZBEE_ZCL_CMD_ID_NETWORK_UPDATE_REQUEST 0x16
15839 #define ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_REQUEST 0x41
15840 #define ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_REQUEST 0x42
15842 /*Server commands generated*/
15843 #define ZBEE_ZCL_CMD_ID_SCAN_RESPONSE 0x01
15844 #define ZBEE_ZCL_CMD_ID_DEVICE_INFO_RESPONSE 0x03
15845 #define ZBEE_ZCL_CMD_ID_NETWORK_START_RESPONSE 0x11
15846 #define ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_RESPONSE 0x13
15847 #define ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_RESPONSE 0x15
15848 #define ZBEE_ZCL_CMD_ID_ENDPOINT_INFORMATION 0x40
15849 #define ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_RESPONSE 0x41
15850 #define ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_RESPONSE 0x42
15852 /*ZigBee Information Mask Value*/
15853 #define ZBEE_ZCL_TOUCHLINK_ZBEE_INFO_TYPE 0x03
15854 #define ZBEE_ZCL_TOUCHLINK_ZBEE_INFO_RXIDLE 0x04
15856 /*Touchlink Information Mask Values*/
15857 #define ZBEE_ZCL_TOUCHLINK_INFO_FACTORY 0x01
15858 #define ZBEE_ZCL_TOUCHLINK_INFO_ASSIGNMENT 0x02
15859 #define ZBEE_ZCL_TOUCHLINK_INFO_INITIATOR 0x10
15860 #define ZBEE_ZCL_TOUCHLINK_INFO_UNDEFINED 0x20
15861 #define ZBEE_ZCL_TOUCHLINK_INFO_PROFILE_INTEROP 0x80
15863 /*Touchlink Key Indices*/
15864 #define ZBEE_ZCL_TOUCHLINK_KEYID_DEVELOPMENT 0
15865 #define ZBEE_ZCL_TOUCHLINK_KEYID_MASTER 4
15866 #define ZBEE_ZCL_TOUCHLINK_KEYID_CERTIFICATION 15
15868 /*************************/
15869 /* Function Declarations */
15870 /*************************/
15871 void proto_register_zbee_zcl_touchlink(void);
15872 void proto_reg_handoff_zbee_zcl_touchlink(void);
15874 /*************************/
15875 /* Global Variables */
15876 /*************************/
15877 /* Initialize the protocol and registered fields */
15878 static int proto_zbee_zcl_touchlink;
15880 static int hf_zbee_zcl_touchlink_rx_cmd_id;
15881 static int hf_zbee_zcl_touchlink_tx_cmd_id;
15882 static int hf_zbee_zcl_touchlink_transaction_id;
15883 static int hf_zbee_zcl_touchlink_zbee;
15884 static int hf_zbee_zcl_touchlink_zbee_type;
15885 static int hf_zbee_zcl_touchlink_zbee_rxidle;
15886 static int hf_zbee_zcl_touchlink_info;
15887 static int hf_zbee_zcl_touchlink_info_factory;
15888 static int hf_zbee_zcl_touchlink_info_assignment;
15889 static int hf_zbee_zcl_touchlink_info_initiator;
15890 static int hf_zbee_zcl_touchlink_info_undefined;
15891 static int hf_zbee_zcl_touchlink_info_profile_introp;
15892 static int hf_zbee_zcl_touchlink_start_index;
15893 static int hf_zbee_zcl_touchlink_ident_duration;
15895 static int hf_zbee_zcl_touchlink_rssi_correction;
15896 static int hf_zbee_zcl_touchlink_response_id;
15897 static int hf_zbee_zcl_touchlink_ext_panid;
15898 static int hf_zbee_zcl_touchlink_nwk_update_id;
15899 static int hf_zbee_zcl_touchlink_channel;
15900 static int hf_zbee_zcl_touchlink_nwk_addr;
15901 static int hf_zbee_zcl_touchlink_ext_addr;
15902 static int hf_zbee_zcl_touchlink_panid;
15903 static int hf_zbee_zcl_touchlink_sub_devices;
15904 static int hf_zbee_zcl_touchlink_total_groups;
15905 static int hf_zbee_zcl_touchlink_endpoint;
15906 static int hf_zbee_zcl_touchlink_profile_id;
15907 static int hf_zbee_zcl_touchlink_device_id;
15908 static int hf_zbee_zcl_touchlink_version;
15909 static int hf_zbee_zcl_touchlink_group_count;
15910 static int hf_zbee_zcl_touchlink_group_begin;
15911 static int hf_zbee_zcl_touchlink_group_end;
15912 static int hf_zbee_zcl_touchlink_group_type;
15913 static int hf_zbee_zcl_touchlink_group_id;
15914 static int hf_zbee_zcl_touchlink_addr_range_begin;
15915 static int hf_zbee_zcl_touchlink_addr_range_end;
15916 static int hf_zbee_zcl_touchlink_group_range_begin;
15917 static int hf_zbee_zcl_touchlink_group_range_end;
15918 static int hf_zbee_zcl_touchlink_key_bitmask;
15919 static int hf_zbee_zcl_touchlink_key_bit_dev;
15920 static int hf_zbee_zcl_touchlink_key_bit_master;
15921 static int hf_zbee_zcl_touchlink_key_bit_cert;
15922 static int hf_zbee_zcl_touchlink_key_index;
15923 static int hf_zbee_zcl_touchlink_key;
15924 static int hf_zbee_zcl_touchlink_init_addr;
15925 static int hf_zbee_zcl_touchlink_init_eui64;
15926 static int hf_zbee_zcl_touchlink_status;
15928 /* Initialize the subtree pointers */
15929 static int ett_zbee_zcl_touchlink;
15930 static int ett_zbee_zcl_touchlink_zbee;
15931 static int ett_zbee_zcl_touchlink_info;
15932 static int ett_zbee_zcl_touchlink_keybits;
15933 static int ett_zbee_zcl_touchlink_groups;
15935 /* Command names */
15936 static const value_string zbee_zcl_touchlink_rx_cmd_names[] = {
15937 { ZBEE_ZCL_CMD_ID_SCAN_REQUEST, "Scan Request" },
15938 { ZBEE_ZCL_CMD_ID_DEVICE_INFO_REQUEST, "Device Information Request" },
15939 { ZBEE_ZCL_CMD_ID_IDENTIFY_REQUEST, "Identify Request" },
15940 { ZBEE_ZCL_CMD_ID_FACTORT_RESET_REQUEST, "Reset to Factory New Request" },
15941 { ZBEE_ZCL_CMD_ID_NETWORK_START_REQUEST, "Network Start Request" },
15942 { ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_REQUEST, "Network Join Router Request" },
15943 { ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_REQUEST, "Network Join End Device Request" },
15944 { ZBEE_ZCL_CMD_ID_NETWORK_UPDATE_REQUEST, "Network Update Request" },
15945 { ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_REQUEST, "Get Group Identifiers Request" },
15946 { ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_REQUEST, "Get Endpoint List Request" },
15947 { 0, NULL }
15949 static const value_string zbee_zcl_touchlink_tx_cmd_names[] = {
15950 { ZBEE_ZCL_CMD_ID_SCAN_RESPONSE, "Scan Response" },
15951 { ZBEE_ZCL_CMD_ID_DEVICE_INFO_RESPONSE, "Device Information Response" },
15952 { ZBEE_ZCL_CMD_ID_NETWORK_START_RESPONSE, "Network Start Response" },
15953 { ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_RESPONSE, "Network Join Router Response" },
15954 { ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_RESPONSE, "Network Join End Device Response" },
15955 { ZBEE_ZCL_CMD_ID_ENDPOINT_INFORMATION, "Endpoint Information" },
15956 { ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_RESPONSE, "Get Group Identifiers Response" },
15957 { ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_RESPONSE, "Get Endpoint List Response" },
15958 { 0, NULL }
15961 /* ZigBee logical types */
15962 static const value_string zbee_zcl_touchlink_zbee_type_names[] = {
15963 { 0, "coordinator" },
15964 { 1, "router" },
15965 { 2, "end device" },
15966 { 0, NULL }
15969 static const value_string zbee_zcl_touchlink_status_names[] = {
15970 { 0x00, "Success" },
15971 { 0x01, "Failure" },
15972 { 0, NULL }
15975 static const value_string zbee_zcl_touchlink_profile_interop_names[] = {
15976 { 0, "ZLL" },
15977 { 1, "Zigbee 3.0" },
15978 { 0, NULL }
15981 static const value_string zbee_zcl_touchlink_keyid_names[] = {
15982 { ZBEE_ZCL_TOUCHLINK_KEYID_DEVELOPMENT, "Development Key" },
15983 { ZBEE_ZCL_TOUCHLINK_KEYID_MASTER, "Master Key" },
15984 { ZBEE_ZCL_TOUCHLINK_KEYID_CERTIFICATION, "Certification Key" },
15985 { 0, NULL }
15988 #define ZBEE_ZCL_TOUCHLINK_NUM_KEYID 16
15989 #define ZBEE_ZCL_TOUCHLINK_KEY_SIZE 16
15991 /*************************/
15992 /* Function Bodies */
15993 /*************************/
15995 *This function decodes the Scan Request payload.
15997 *@param tvb the tv buffer of the current data_type
15998 *@param tree the tree to append this item to
15999 *@param offset offset of data in tvb
16001 static void
16002 dissect_zcl_touchlink_scan_request(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
16004 static int * const zbee_info_flags[] = {
16005 &hf_zbee_zcl_touchlink_zbee_type,
16006 &hf_zbee_zcl_touchlink_zbee_rxidle,
16007 NULL
16009 static int * const zll_info_flags[] = {
16010 &hf_zbee_zcl_touchlink_info_factory,
16011 &hf_zbee_zcl_touchlink_info_assignment,
16012 &hf_zbee_zcl_touchlink_info_initiator,
16013 &hf_zbee_zcl_touchlink_info_undefined,
16014 &hf_zbee_zcl_touchlink_info_profile_introp,
16015 NULL
16017 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_touchlink_zbee, ett_zbee_zcl_touchlink_zbee, zbee_info_flags, ENC_LITTLE_ENDIAN);
16018 *offset += 1;
16019 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_touchlink_info, ett_zbee_zcl_touchlink_info, zll_info_flags, ENC_LITTLE_ENDIAN);
16020 *offset += 1;
16021 } /*dissect_zcl_touchlink_scan_request*/
16024 *This function decodes the Identify Request payload.
16026 *@param tvb the tv buffer of the current data_type
16027 *@param tree the tree to append this item to
16028 *@param offset offset of data in tvb
16030 static void
16031 dissect_zcl_touchlink_identify_request(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
16033 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ident_duration, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16034 *offset += 2;
16035 } /*dissect_zcl_touchlink_identify_request*/
16038 *This function decodes the Network Start Request payload.
16040 *@param tvb the tv buffer of the current data_type
16041 *@param tree the tree to append this item to
16042 *@param offset offset of data in tvb
16044 static void
16045 dissect_zcl_touchlink_network_start_request(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
16047 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_panid, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
16048 *offset += 8;
16049 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_key_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16050 *offset += 1;
16051 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_key, tvb, *offset, 16, ENC_NA);
16052 *offset += 16;
16053 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_channel, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16054 *offset += 1;
16055 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_panid, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16056 *offset += 2;
16057 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16058 *offset += 2;
16059 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16060 *offset += 2;
16061 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16062 *offset += 2;
16063 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_addr_range_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16064 *offset += 2;
16065 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_addr_range_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16066 *offset += 2;
16067 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_range_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16068 *offset += 2;
16069 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_range_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16070 *offset += 2;
16071 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_init_eui64, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
16072 *offset += 8;
16073 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_init_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16074 *offset += 2;
16075 } /*dissect_zcl_touchlink_network_start_request*/
16078 *This function decodes the Network Join Router/EndDevice Request payloads.
16080 *@param tvb the tv buffer of the current data_type
16081 *@param tree the tree to append this item to
16082 *@param offset offset of data in tvb
16084 static void
16085 dissect_zcl_touchlink_network_join_request(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
16087 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_panid, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
16088 *offset += 8;
16089 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_key_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16090 *offset += 1;
16091 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_key, tvb, *offset, 16, ENC_NA);
16092 *offset += 16;
16093 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_update_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16094 *offset += 1;
16095 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_channel, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16096 *offset += 1;
16097 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_panid, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16098 *offset += 2;
16099 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16100 *offset += 2;
16101 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16102 *offset += 2;
16103 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16104 *offset += 2;
16105 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_addr_range_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16106 *offset += 2;
16107 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_addr_range_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16108 *offset += 2;
16109 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_range_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16110 *offset += 2;
16111 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_range_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16112 *offset += 2;
16113 } /*dissect_zcl_touchlink_network_join_request*/
16116 *This function decodes the Scan Response payload.
16118 *@param tvb the tv buffer of the current data_type
16119 *@param tree the tree to append this item to
16120 *@param offset offset of data in tvb
16122 static void
16123 dissect_zcl_touchlink_network_update_request(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
16125 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_panid, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
16126 *offset += 8;
16127 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_update_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16128 *offset += 1;
16129 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_channel, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16130 *offset += 1;
16131 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_panid, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16132 *offset += 2;
16133 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16134 *offset += 2;
16135 } /*dissect_zcl_touchlink_network_update_request*/
16138 *This function decodes the Scan Response payload.
16140 *@param tvb the tv buffer of the current data_type
16141 *@param tree the tree to append this item to
16142 *@param offset offset of data in tvb
16144 static void
16145 dissect_zcl_touchlink_scan_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
16147 static int * const zbee_info_flags[] = {
16148 &hf_zbee_zcl_touchlink_zbee_type,
16149 &hf_zbee_zcl_touchlink_zbee_rxidle,
16150 NULL
16152 static int * const zll_info_flags[] = {
16153 &hf_zbee_zcl_touchlink_info_factory,
16154 &hf_zbee_zcl_touchlink_info_assignment,
16155 &hf_zbee_zcl_touchlink_info_initiator,
16156 &hf_zbee_zcl_touchlink_info_undefined,
16157 &hf_zbee_zcl_touchlink_info_profile_introp,
16158 NULL
16160 static int * const zll_keybit_flags[] = {
16161 &hf_zbee_zcl_touchlink_key_bit_dev,
16162 &hf_zbee_zcl_touchlink_key_bit_master,
16163 &hf_zbee_zcl_touchlink_key_bit_cert,
16164 NULL
16166 uint8_t subdev;
16168 /* Parse out the fixed-format stuff */
16169 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_rssi_correction, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16170 *offset += 1;
16171 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_touchlink_zbee, ett_zbee_zcl_touchlink_zbee, zbee_info_flags, ENC_LITTLE_ENDIAN);
16172 *offset += 1;
16173 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_touchlink_info, ett_zbee_zcl_touchlink_info, zll_info_flags, ENC_LITTLE_ENDIAN);
16174 *offset += 1;
16175 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_touchlink_key_bitmask, ett_zbee_zcl_touchlink_keybits, zll_keybit_flags, ENC_LITTLE_ENDIAN);
16176 *offset += 2;
16177 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_response_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
16178 *offset += 4;
16179 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_panid, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
16180 *offset += 8;
16181 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_update_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16182 *offset += 1;
16183 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_channel, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16184 *offset += 1;
16185 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_panid, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16186 *offset += 2;
16187 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16188 *offset += 2;
16189 subdev = tvb_get_uint8(tvb, *offset);
16190 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_sub_devices, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16191 *offset += 1;
16192 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_total_groups, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16193 *offset += 1;
16195 /* The remaining fields are only present when sub-devices is one. */
16196 if (subdev == 1) {
16197 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_endpoint, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16198 *offset += 1;
16199 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_profile_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16200 *offset += 2;
16201 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_device_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16202 *offset += 2;
16203 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_version, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16204 *offset += 1;
16205 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_count, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16206 *offset += 1;
16208 } /*dissect_zcl_touchlink_scan_response*/
16211 *This function decodes the Network Start Response payload.
16213 *@param tvb the tv buffer of the current data_type
16214 *@param tree the tree to append this item to
16215 *@param offset offset of data in tvb
16217 static void
16218 dissect_zcl_touchlink_network_start_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
16220 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16221 *offset += 1;
16222 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_panid, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
16223 *offset += 8;
16224 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_update_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16225 *offset += 1;
16226 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_channel, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16227 *offset += 1;
16228 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_panid, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16229 *offset += 2;
16230 } /* dissect_zcl_touchlink_network_start_response */
16233 *This function decodes the Endpoint Information payload.
16235 *@param tvb the tv buffer of the current data_type
16236 *@param tree the tree to append this item to
16237 *@param offset offset of data in tvb
16239 static void
16240 dissect_zcl_touchlink_endpoint_info(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
16242 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_addr, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
16243 *offset += 8;
16244 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16245 *offset += 2;
16246 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_endpoint, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16247 *offset += 1;
16248 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_profile_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16249 *offset += 2;
16250 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_device_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16251 *offset += 2;
16252 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_version, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16253 *offset += 1;
16254 } /* dissect_zcl_touchlink_endpoint_info */
16257 *This function decodes the Get Group Identifiers Response payload.
16259 *@param tvb the tv buffer of the current data_type
16260 *@param tree the tree to append this item to
16261 *@param offset offset of data in tvb
16263 static void
16264 dissect_zcl_touchlink_group_id_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
16266 proto_tree *list_tree;
16267 uint8_t count;
16268 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_total_groups, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16269 *offset += 1;
16270 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_start_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16271 *offset += 1;
16272 count = tvb_get_uint8(tvb, *offset);
16273 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_count, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16274 *offset += 1;
16276 list_tree = proto_tree_add_subtree(tree, tvb, *offset, count * 3, ett_zbee_zcl_touchlink_groups, NULL, "Group Information Records");
16277 while (count--) {
16278 proto_tree_add_item(list_tree, hf_zbee_zcl_touchlink_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
16279 *offset += 2;
16280 proto_tree_add_item(list_tree, hf_zbee_zcl_touchlink_group_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
16281 *offset += 1;
16283 } /* dissect_zcl_touchlink_group_id_response */
16286 *ZigBee ZCL Touchlink Commissioining cluster dissector for wireshark.
16288 *@param tvb pointer to buffer containing raw packet.
16289 *@param pinfo pointer to packet information fields
16290 *@param tree pointer to data tree Wireshark uses to display packet.
16292 static int
16293 dissect_zbee_zcl_touchlink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
16295 zbee_zcl_packet *zcl;
16296 unsigned offset = 0;
16297 uint8_t cmd_id;
16298 int hf_cmd_id;
16299 const value_string *vals_cmd_id;
16301 /* Reject the packet if data is NULL */
16302 if (data == NULL)
16303 return 0;
16304 zcl = (zbee_zcl_packet *)data;
16305 cmd_id = zcl->cmd_id;
16307 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
16308 hf_cmd_id = hf_zbee_zcl_touchlink_rx_cmd_id;
16309 vals_cmd_id = zbee_zcl_touchlink_rx_cmd_names;
16310 } else {
16311 hf_cmd_id = hf_zbee_zcl_touchlink_tx_cmd_id;
16312 vals_cmd_id = zbee_zcl_touchlink_tx_cmd_names;
16315 /* Append the command name to the info column. */
16316 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
16317 val_to_str_const(cmd_id, vals_cmd_id, "Unknown Command"),
16318 zcl->tran_seqno);
16319 /* Add the command ID. */
16320 if (tree) {
16321 proto_tree_add_item(tree, hf_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
16323 offset++;
16325 /* All touchlink commands begin with a transaction identifier. */
16326 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_transaction_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
16327 offset += 4;
16329 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
16330 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
16331 /* Call the appropriate command dissector */
16332 switch (cmd_id) {
16333 case ZBEE_ZCL_CMD_ID_SCAN_REQUEST:
16334 dissect_zcl_touchlink_scan_request(tvb, tree, &offset);
16335 break;
16337 case ZBEE_ZCL_CMD_ID_IDENTIFY_REQUEST:
16338 dissect_zcl_touchlink_identify_request(tvb, tree, &offset);
16339 break;
16341 case ZBEE_ZCL_CMD_ID_FACTORT_RESET_REQUEST:
16342 /* No payload */
16343 break;
16345 case ZBEE_ZCL_CMD_ID_NETWORK_START_REQUEST:
16346 dissect_zcl_touchlink_network_start_request(tvb, tree, &offset);
16347 break;
16349 case ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_REQUEST:
16350 case ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_REQUEST:
16351 dissect_zcl_touchlink_network_join_request(tvb, tree, &offset);
16352 break;
16354 case ZBEE_ZCL_CMD_ID_NETWORK_UPDATE_REQUEST:
16355 dissect_zcl_touchlink_network_update_request(tvb, tree, &offset);
16356 break;
16358 case ZBEE_ZCL_CMD_ID_DEVICE_INFO_REQUEST:
16359 case ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_REQUEST:
16360 case ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_REQUEST:
16361 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_start_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
16362 offset++;
16363 break;
16365 default:
16366 break;
16369 else {
16370 /* Call the appropriate command dissector */
16371 switch (cmd_id) {
16372 case ZBEE_ZCL_CMD_ID_SCAN_RESPONSE:
16373 dissect_zcl_touchlink_scan_response(tvb, tree, &offset);
16374 break;
16376 case ZBEE_ZCL_CMD_ID_NETWORK_START_RESPONSE:
16377 dissect_zcl_touchlink_network_start_response(tvb, tree, &offset);
16378 break;
16380 case ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_RESPONSE:
16381 case ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_RESPONSE:
16382 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
16383 offset++;
16384 break;
16386 case ZBEE_ZCL_CMD_ID_DEVICE_INFO_RESPONSE:
16387 break;
16389 case ZBEE_ZCL_CMD_ID_ENDPOINT_INFORMATION:
16390 dissect_zcl_touchlink_endpoint_info(tvb, tree, &offset);
16391 break;
16393 case ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_RESPONSE:
16394 dissect_zcl_touchlink_group_id_response(tvb, tree, &offset);
16395 break;
16397 case ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_RESPONSE:
16398 /* No payload */
16399 break;
16401 default:
16402 break;
16406 /* Dump leftover data. */
16407 if (tvb_captured_length_remaining(tvb, offset) > 0) {
16408 tvbuff_t *excess = tvb_new_subset_remaining(tvb, offset);
16409 call_data_dissector(excess, pinfo, proto_tree_get_root(tree));
16411 return offset;
16412 } /*dissect_zbee_zcl_touchlink*/
16415 *ZigBee ZCL Touchlink Commissioning cluster protocol registration routine.
16418 void
16419 proto_register_zbee_zcl_touchlink(void)
16421 /* Setup list of header fields */
16422 static hf_register_info hf[] = {
16423 { &hf_zbee_zcl_touchlink_rx_cmd_id,
16424 { "Command", "zbee_zcl_general.touchlink.rx_cmd_id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_touchlink_rx_cmd_names),
16425 0x00, NULL, HFILL } },
16426 { &hf_zbee_zcl_touchlink_tx_cmd_id,
16427 { "Command", "zbee_zcl_general.touchlink.tx_cmd_id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_touchlink_tx_cmd_names),
16428 0x00, NULL, HFILL } },
16429 { &hf_zbee_zcl_touchlink_transaction_id,
16430 { "Transaction ID", "zbee_zcl_general.touchlink.transaction_id", FT_UINT32, BASE_HEX, NULL,
16431 0x00, NULL, HFILL } },
16433 /* ZigBee Information Bitmask */
16434 { &hf_zbee_zcl_touchlink_zbee,
16435 { "ZigBee Information", "zbee_zcl_general.touchlink.zbee", FT_UINT8, BASE_HEX, NULL,
16436 0x0, NULL, HFILL }},
16438 { &hf_zbee_zcl_touchlink_zbee_type,
16439 { "Logical type", "zbee_zcl_general.touchlink.zbee.type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_touchlink_zbee_type_names),
16440 ZBEE_ZCL_TOUCHLINK_ZBEE_INFO_TYPE, NULL, HFILL } },
16442 { &hf_zbee_zcl_touchlink_zbee_rxidle,
16443 { "Rx on when idle", "zbee_zcl_general.touchlink.zbee.rxidle", FT_BOOLEAN, 8, TFS(&tfs_yes_no),
16444 ZBEE_ZCL_TOUCHLINK_ZBEE_INFO_RXIDLE, NULL, HFILL } },
16446 /* Touchlink Information Bitmask */
16447 { &hf_zbee_zcl_touchlink_info,
16448 { "Touchlink Information", "zbee_zcl_general.touchlink.info", FT_UINT8, BASE_HEX, NULL,
16449 0x0, NULL, HFILL }},
16451 { &hf_zbee_zcl_touchlink_info_factory,
16452 { "Factory new", "zbee_zcl_general.touchlink.info.factory", FT_BOOLEAN, 8, TFS(&tfs_yes_no),
16453 ZBEE_ZCL_TOUCHLINK_INFO_FACTORY, NULL, HFILL } },
16455 { &hf_zbee_zcl_touchlink_info_assignment,
16456 { "Address assignment", "zbee_zcl_general.touchlink.info.assignment", FT_BOOLEAN, 8, TFS(&tfs_yes_no),
16457 ZBEE_ZCL_TOUCHLINK_INFO_ASSIGNMENT, NULL, HFILL } },
16459 { &hf_zbee_zcl_touchlink_info_initiator,
16460 { "Link initiator", "zbee_zcl_general.touchlink.info.initiator", FT_BOOLEAN, 8, TFS(&tfs_yes_no),
16461 ZBEE_ZCL_TOUCHLINK_INFO_INITIATOR, NULL, HFILL } },
16463 { &hf_zbee_zcl_touchlink_info_undefined,
16464 { "Undefined", "zbee_zcl_general.touchlink.info.undefined", FT_BOOLEAN, 8, NULL,
16465 ZBEE_ZCL_TOUCHLINK_INFO_UNDEFINED, NULL, HFILL } },
16467 { &hf_zbee_zcl_touchlink_info_profile_introp,
16468 { "Profile Interop", "zbee_zcl_general.touchlink.info.profile.interop", FT_UINT8, BASE_HEX, VALS(zbee_zcl_touchlink_profile_interop_names),
16469 ZBEE_ZCL_TOUCHLINK_INFO_PROFILE_INTEROP, NULL, HFILL } },
16471 /* Touchlink Key Information Bitmask */
16472 { &hf_zbee_zcl_touchlink_key_bitmask,
16473 { "Key Bitmask", "zbee_zcl_general.touchlink.key_bitmask", FT_UINT16, BASE_HEX, NULL,
16474 0x00, NULL, HFILL } },
16476 { &hf_zbee_zcl_touchlink_key_bit_dev,
16477 { "Development Key", "zbee_zcl_general.touchlink.key_bitmask.dev", FT_BOOLEAN, 16, TFS(&tfs_yes_no),
16478 (1<<ZBEE_ZCL_TOUCHLINK_KEYID_DEVELOPMENT), NULL, HFILL } },
16480 { &hf_zbee_zcl_touchlink_key_bit_master,
16481 { "Master Key", "zbee_zcl_general.touchlink.key_bitmask.master", FT_BOOLEAN, 16, TFS(&tfs_yes_no),
16482 (1<<ZBEE_ZCL_TOUCHLINK_KEYID_MASTER), NULL, HFILL } },
16484 { &hf_zbee_zcl_touchlink_key_bit_cert,
16485 { "Certification Key", "zbee_zcl_general.touchlink.key_bitmask.cert", FT_BOOLEAN, 16, TFS(&tfs_yes_no),
16486 (1<<ZBEE_ZCL_TOUCHLINK_KEYID_CERTIFICATION), NULL, HFILL } },
16488 { &hf_zbee_zcl_touchlink_start_index,
16489 { "Start index", "zbee_zcl_general.touchlink.index", FT_UINT8, BASE_DEC, NULL,
16490 0x00, NULL, HFILL } },
16492 { &hf_zbee_zcl_touchlink_ident_duration,
16493 { "Identify duration", "zbee_zcl_general.touchlink.duration", FT_UINT16, BASE_DEC, NULL,
16494 0x00, NULL, HFILL } },
16496 { &hf_zbee_zcl_touchlink_rssi_correction,
16497 { "RSSI Correction", "zbee_zcl_general.touchlink.rssi_correction", FT_UINT8, BASE_DEC, NULL,
16498 0x00, NULL, HFILL } },
16500 { &hf_zbee_zcl_touchlink_response_id,
16501 { "Response ID", "zbee_zcl_general.touchlink.response_id", FT_UINT32, BASE_HEX, NULL,
16502 0x00, NULL, HFILL } },
16504 { &hf_zbee_zcl_touchlink_ext_panid,
16505 { "Extended PAN ID", "zbee_zcl_general.touchlink.ext_panid", FT_EUI64, BASE_NONE, NULL,
16506 0x0, NULL, HFILL } },
16508 { &hf_zbee_zcl_touchlink_nwk_update_id,
16509 { "Network Update ID", "zbee_zcl_general.touchlink.nwk_update_id", FT_UINT8, BASE_DEC, NULL,
16510 0x00, NULL, HFILL } },
16512 { &hf_zbee_zcl_touchlink_channel,
16513 { "Logical Channel", "zbee_zcl_general.touchlink.channel", FT_UINT8, BASE_DEC, NULL,
16514 0x00, NULL, HFILL } },
16516 { &hf_zbee_zcl_touchlink_nwk_addr,
16517 { "Network Address", "zbee_zcl_general.touchlink.nwk_addr", FT_UINT16, BASE_DEC, NULL,
16518 0x00, NULL, HFILL } },
16520 { &hf_zbee_zcl_touchlink_ext_addr,
16521 { "Extended Address", "zbee_zcl_general.touchlink.ext_addr", FT_EUI64, BASE_NONE, NULL,
16522 0x00, NULL, HFILL } },
16524 { &hf_zbee_zcl_touchlink_panid,
16525 { "PAN ID", "zbee_zcl_general.touchlink.panid", FT_UINT16, BASE_HEX, NULL,
16526 0x00, NULL, HFILL } },
16528 { &hf_zbee_zcl_touchlink_sub_devices,
16529 { "Sub-devices", "zbee_zcl_general.touchlink.sub_devices", FT_UINT8, BASE_DEC, NULL,
16530 0x00, NULL, HFILL } },
16532 { &hf_zbee_zcl_touchlink_total_groups,
16533 { "Total Group Identifiers", "zbee_zcl_general.touchlink.total_groups", FT_UINT8, BASE_DEC, NULL,
16534 0x00, NULL, HFILL } },
16536 { &hf_zbee_zcl_touchlink_endpoint,
16537 { "Endpoint", "zbee_zcl_general.touchlink.endpoint", FT_UINT8, BASE_DEC, NULL,
16538 0x00, NULL, HFILL } },
16540 { &hf_zbee_zcl_touchlink_profile_id,
16541 { "Profile ID", "zbee_zcl_general.touchlink.profile_id", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_aps_apid_names),
16542 0x00, NULL, HFILL } },
16544 { &hf_zbee_zcl_touchlink_device_id,
16545 { "Device ID", "zbee_zcl_general.touchlink.device_id", FT_UINT16, BASE_HEX, NULL,
16546 0x00, NULL, HFILL } },
16548 { &hf_zbee_zcl_touchlink_version,
16549 { "Version", "zbee_zcl_general.touchlink.version", FT_UINT8, BASE_HEX, NULL,
16550 0x00, NULL, HFILL } },
16552 { &hf_zbee_zcl_touchlink_group_count,
16553 { "Group ID Count", "zbee_zcl_general.touchlink.group_count", FT_UINT8, BASE_DEC, NULL,
16554 0x00, NULL, HFILL } },
16556 { &hf_zbee_zcl_touchlink_group_begin,
16557 { "Group ID Begin", "zbee_zcl_general.touchlink.group_begin", FT_UINT16, BASE_HEX, NULL,
16558 0x00, NULL, HFILL } },
16560 { &hf_zbee_zcl_touchlink_group_end,
16561 { "Group ID End", "zbee_zcl_general.touchlink.group_end", FT_UINT16, BASE_HEX, NULL,
16562 0x00, NULL, HFILL } },
16564 { &hf_zbee_zcl_touchlink_group_type,
16565 { "Group Type", "zbee_zcl_general.touchlink.group_type", FT_UINT8, BASE_HEX, NULL,
16566 0x00, NULL, HFILL } },
16568 { &hf_zbee_zcl_touchlink_group_id,
16569 { "Group ID", "zbee_zcl_general.touchlink.group_id", FT_UINT16, BASE_HEX, NULL,
16570 0x00, NULL, HFILL } },
16572 { &hf_zbee_zcl_touchlink_addr_range_begin,
16573 { "Free Address Range Begin", "zbee_zcl_general.touchlink.addr_range_begin", FT_UINT16, BASE_HEX, NULL,
16574 0x00, NULL, HFILL } },
16576 { &hf_zbee_zcl_touchlink_addr_range_end,
16577 { "Free Address Range End", "zbee_zcl_general.touchlink.addr_range_end", FT_UINT16, BASE_HEX, NULL,
16578 0x00, NULL, HFILL } },
16580 { &hf_zbee_zcl_touchlink_group_range_begin,
16581 { "Free Group ID Range Begin", "zbee_zcl_general.touchlink.group_range_begin", FT_UINT16, BASE_HEX, NULL,
16582 0x00, NULL, HFILL } },
16584 { &hf_zbee_zcl_touchlink_group_range_end,
16585 { "Free Group ID Range End", "zbee_zcl_general.touchlink.group_range_end", FT_UINT16, BASE_HEX, NULL,
16586 0x00, NULL, HFILL } },
16588 { &hf_zbee_zcl_touchlink_key_index,
16589 { "Key Index", "zbee_zcl_general.touchlink.key_index", FT_UINT8, BASE_DEC, VALS(zbee_zcl_touchlink_keyid_names),
16590 0x00, NULL, HFILL } },
16592 { &hf_zbee_zcl_touchlink_key,
16593 { "Encrypted Network Key", "zbee_zcl_general.touchlink.key", FT_BYTES, BASE_NONE, NULL,
16594 0x0, NULL, HFILL } },
16596 { &hf_zbee_zcl_touchlink_init_eui64,
16597 { "Initiator Extended Address", "zbee_zcl_general.touchlink.init_eui", FT_EUI64, BASE_NONE, NULL,
16598 0x00, NULL, HFILL } },
16600 { &hf_zbee_zcl_touchlink_init_addr,
16601 { "Initiator Network Address", "zbee_zcl_general.touchlink.init_addr", FT_UINT16, BASE_HEX, NULL,
16602 0x00, NULL, HFILL } },
16604 { &hf_zbee_zcl_touchlink_status,
16605 { "Status", "zbee_zcl_general.touchlink.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_touchlink_status_names),
16606 0x00, NULL, HFILL } },
16609 /* ZCL Touchlink subtrees */
16610 static int *ett[] = {
16611 &ett_zbee_zcl_touchlink,
16612 &ett_zbee_zcl_touchlink_zbee,
16613 &ett_zbee_zcl_touchlink_info,
16614 &ett_zbee_zcl_touchlink_keybits,
16615 &ett_zbee_zcl_touchlink_groups,
16618 /* Register the ZigBee ZCL Touchlink cluster protocol name and description */
16619 proto_zbee_zcl_touchlink = proto_register_protocol("ZigBee ZCL Touchlink", "ZCL Touchlink", ZBEE_PROTOABBREV_ZCL_TOUCHLINK);
16620 proto_register_field_array(proto_zbee_zcl_touchlink, hf, array_length(hf));
16621 proto_register_subtree_array(ett, array_length(ett));
16623 /* Register the ZigBee ZCL Touchlink Commissioning dissector. */
16624 register_dissector(ZBEE_PROTOABBREV_ZCL_TOUCHLINK, dissect_zbee_zcl_touchlink, proto_zbee_zcl_touchlink);
16625 } /*proto_register_zbee_zcl_touchlink*/
16628 *Hands off the ZCL Touchlink Commissioning dissector.
16631 void
16632 proto_reg_handoff_zbee_zcl_touchlink(void)
16634 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_TOUCHLINK,
16635 proto_zbee_zcl_touchlink,
16636 ett_zbee_zcl_touchlink,
16637 ZBEE_ZCL_CID_ZLL,
16638 ZBEE_MFG_CODE_NONE,
16639 -1, -1,
16640 hf_zbee_zcl_touchlink_rx_cmd_id, hf_zbee_zcl_touchlink_tx_cmd_id,
16641 NULL
16643 } /*proto_reg_handoff_zbee_zcl_touchlink*/
16646 * Editor modelines - https://www.wireshark.org/tools/modelines.html
16648 * Local variables:
16649 * c-basic-offset: 4
16650 * tab-width: 8
16651 * indent-tabs-mode: nil
16652 * End:
16654 * vi: set shiftwidth=4 tabstop=8 expandtab:
16655 * :indentSize=4:tabSize=8:noTabs=true: