Bug Summary

File:epan/dissectors/packet-zbee-zcl-general.c
Warning:line 16018, column 5
Value stored to 'hash' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name packet-zbee-zcl-general.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -fno-delete-null-pointer-checks -mframe-pointer=all -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -ffloat16-excess-precision=fast -fbfloat16-excess-precision=fast -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/builds/wireshark/wireshark/build -fcoverage-compilation-dir=/builds/wireshark/wireshark/build -resource-dir /usr/lib/llvm-20/lib/clang/20 -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /usr/include/mit-krb5 -isystem /usr/include/libxml2 -isystem /builds/wireshark/wireshark/build/epan/dissectors -isystem /builds/wireshark/wireshark/epan/dissectors -isystem /builds/wireshark/wireshark/epan -D G_DISABLE_DEPRECATED -D G_DISABLE_SINGLE_INCLUDES -D WS_BUILD_DLL -D WS_DEBUG -D WS_DEBUG_UTF_8 -I /builds/wireshark/wireshark/build -I /builds/wireshark/wireshark -I /builds/wireshark/wireshark/include -D _GLIBCXX_ASSERTIONS -internal-isystem /usr/lib/llvm-20/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fmacro-prefix-map=/builds/wireshark/wireshark/= -fmacro-prefix-map=/builds/wireshark/wireshark/build/= -fmacro-prefix-map=../= -Wno-format-truncation -Wno-format-nonliteral -Wno-pointer-sign -std=gnu11 -ferror-limit 19 -fvisibility=hidden -fwrapv -fwrapv-pointer -fstrict-flex-arrays=3 -stack-protector 2 -fstack-clash-protection -fcf-protection=full -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fexceptions -fcolor-diagnostics -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /builds/wireshark/wireshark/sbout/2025-07-30-100434-3867-1 -x c /builds/wireshark/wireshark/epan/dissectors/packet-zbee-zcl-general.c
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.
6 *
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
10 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 */
13
14/* Include Files */
15#include "config.h"
16
17#define WS_LOG_DOMAIN"zcl" "zcl"
18
19#include <wireshark.h>
20#include <epan/packet.h>
21#include <epan/expert.h>
22#include <epan/to_str.h>
23#include <epan/tfs.h>
24#include <wsutil/array.h>
25#include <wsutil/bits_ctz.h>
26#include <wsutil/utf8_entities.h>
27#include <wsutil/wsgcrypt.h>
28
29#include "packet-zbee.h"
30#include "packet-zbee-aps.h"
31#include "packet-zbee-zcl.h"
32#include "packet-zbee-security.h"
33
34/* ########################################################################## */
35/* #### (0x0000) BASIC CLUSTER ############################################## */
36/* ########################################################################## */
37
38/*************************/
39/* Defines */
40/*************************/
41
42/* Attributes */
43#define ZBEE_ZCL_ATTR_ID_BASIC_ZCL_VERSION0x0000 0x0000 /* ZCL Version */
44#define ZBEE_ZCL_ATTR_ID_BASIC_APPL_VERSION0x0001 0x0001 /* Application Version */
45#define ZBEE_ZCL_ATTR_ID_BASIC_STACK_VERSION0x0002 0x0002 /* Stack Version */
46#define ZBEE_ZCL_ATTR_ID_BASIC_HW_VERSION0x0003 0x0003 /* HW Version */
47#define ZBEE_ZCL_ATTR_ID_BASIC_MANUFACTURER_NAME0x0004 0x0004 /* Manufacturer Name */
48#define ZBEE_ZCL_ATTR_ID_BASIC_MODEL_ID0x0005 0x0005 /* Model Identifier */
49#define ZBEE_ZCL_ATTR_ID_BASIC_DATE_CODE0x0006 0x0006 /* Date Code */
50#define ZBEE_ZCL_ATTR_ID_BASIC_POWER_SOURCE0x0007 0x0007 /* Power Source */
51#define ZBEE_ZCL_ATTR_ID_BASIC_LOCATION_DESCR0x0010 0x0010 /* Location Description */
52#define ZBEE_ZCL_ATTR_ID_BASIC_PHY_ENVIRONMENT0x0011 0x0011 /* Physical Environment */
53#define ZBEE_ZCL_ATTR_ID_BASIC_DEVICE_ENABLED0x0012 0x0012 /* Device Enabled */
54#define ZBEE_ZCL_ATTR_ID_BASIC_ALARM_MASK0x0013 0x0013 /* Alarm Mask */
55#define ZBEE_ZCL_ATTR_ID_BASIC_DISABLE_LOCAL_CFG0x0014 0x0014 /* Disable Local Config */
56#define ZBEE_ZCL_ATTR_ID_BASIC_SW_BUILD_ID0x4000 0x4000 /* SW Build Id */
57
58/* Server Commands Received */
59#define ZBEE_ZCL_CMD_ID_BASIC_RESET_FACTORY_DEFAULTS0x00 0x00 /* Reset to Factory Defaults */
60
61/* Server Commands Generated - None */
62
63/* Power Source Id */
64#define ZBEE_ZCL_BASIC_PWR_SRC_UNKNOWN0x00 0x00 /* Unknown */
65#define ZBEE_ZCL_BASIC_PWR_SRC_MAINS_1PH0x01 0x01 /* Mains (single phase) */
66#define ZBEE_ZCL_BASIC_PWR_SRC_MAINS_3PH0x02 0x02 /* Mains (3 phase) */
67#define ZBEE_ZCL_BASIC_PWR_SRC_BATTERY0x03 0x03 /* Battery */
68#define ZBEE_ZCL_BASIC_PWR_SRC_DC_SRC0x04 0x04 /* DC source */
69#define ZBEE_ZCL_BASIC_PWR_SRC_EMERGENCY_10x05 0x05 /* Emergency mains constantly powered */
70#define ZBEE_ZCL_BASIC_PWR_SRC_EMERGENCY_20x06 0x06 /* Emergency mains and transfer switch */
71
72/* Device Enable Values */
73#define ZBEE_ZCL_BASIC_DISABLED0x00 0x00 /* Disabled */
74#define ZBEE_ZCL_BASIC_ENABLED0x01 0x01 /* Enabled */
75
76/* Alarm Mask bit-mask */
77#define ZBEE_ZCL_BASIC_ALARM_GEN_HW_FAULT0x01 0x01 /* General hardware fault */
78#define ZBEE_ZCL_BASIC_ALARM_GEN_SW_FAULT0x02 0x02 /* General software fault */
79#define ZBEE_ZCL_BASIC_ALARM_RESERVED0xfc 0xfc /* Reserved */
80
81/* Disable Local Config bit-mask */
82#define ZBEE_ZCL_BASIC_DIS_LOC_CFG_RESET0x01 0x01 /* Reset (to factory defaults) */
83#define ZBEE_ZCL_BASIC_DIS_LOC_CFG_DEV_CFG0x02 0x02 /* Device configuration */
84#define ZBEE_ZCL_BASIC_DIS_LOC_CFG_RESERVED0xfc 0xfc /* Reserved */
85
86/*************************/
87/* Function Declarations */
88/*************************/
89
90void proto_register_zbee_zcl_basic(void);
91void proto_reg_handoff_zbee_zcl_basic(void);
92
93/* Command Dissector Helpers */
94static void dissect_zcl_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
95
96/* Private functions prototype */
97
98/*************************/
99/* Global Variables */
100/*************************/
101/* Initialize the protocol and registered fields */
102static int proto_zbee_zcl_basic;
103
104static int hf_zbee_zcl_basic_attr_id;
105static int hf_zbee_zcl_basic_pwr_src;
106static int hf_zbee_zcl_basic_dev_en;
107static int hf_zbee_zcl_basic_alarm_mask;
108static int hf_zbee_zcl_basic_alarm_mask_gen_hw_fault;
109static int hf_zbee_zcl_basic_alarm_mask_gen_sw_fault;
110static int hf_zbee_zcl_basic_alarm_mask_reserved;
111static int hf_zbee_zcl_basic_disable_local_cfg;
112static int hf_zbee_zcl_basic_disable_local_cfg_reset;
113static int hf_zbee_zcl_basic_disable_local_cfg_device_cfg;
114static int hf_zbee_zcl_basic_disable_local_cfg_reserved;
115static int hf_zbee_zcl_basic_srv_rx_cmd_id;
116
117/* Initialize the subtree pointers */
118static int ett_zbee_zcl_basic;
119static int ett_zbee_zcl_basic_alarm_mask;
120static int ett_zbee_zcl_basic_dis_local_cfg;
121
122/* Attributes */
123static const value_string zbee_zcl_basic_attr_names[] = {
124 { ZBEE_ZCL_ATTR_ID_BASIC_ZCL_VERSION0x0000, "ZCL Version" },
125 { ZBEE_ZCL_ATTR_ID_BASIC_APPL_VERSION0x0001, "Application Version" },
126 { ZBEE_ZCL_ATTR_ID_BASIC_STACK_VERSION0x0002, "Stack Version" },
127 { ZBEE_ZCL_ATTR_ID_BASIC_HW_VERSION0x0003, "HW Version" },
128 { ZBEE_ZCL_ATTR_ID_BASIC_MANUFACTURER_NAME0x0004, "Manufacturer Name" },
129 { ZBEE_ZCL_ATTR_ID_BASIC_MODEL_ID0x0005, "Model Identifier" },
130 { ZBEE_ZCL_ATTR_ID_BASIC_DATE_CODE0x0006, "Date Code" },
131 { ZBEE_ZCL_ATTR_ID_BASIC_POWER_SOURCE0x0007, "Power Source" },
132 { ZBEE_ZCL_ATTR_ID_BASIC_LOCATION_DESCR0x0010, "Location Description" },
133 { ZBEE_ZCL_ATTR_ID_BASIC_PHY_ENVIRONMENT0x0011, "Physical Environment" },
134 { ZBEE_ZCL_ATTR_ID_BASIC_DEVICE_ENABLED0x0012, "Device Enabled" },
135 { ZBEE_ZCL_ATTR_ID_BASIC_ALARM_MASK0x0013, "Alarm Mask" },
136 { ZBEE_ZCL_ATTR_ID_BASIC_DISABLE_LOCAL_CFG0x0014, "Disable Local Config" },
137 { ZBEE_ZCL_ATTR_ID_BASIC_SW_BUILD_ID0x4000, "Software Build Id" },
138 { 0, NULL((void*)0) }
139};
140
141/* Server Commands Received */
142static const value_string zbee_zcl_basic_srv_rx_cmd_names[] = {
143 { ZBEE_ZCL_CMD_ID_BASIC_RESET_FACTORY_DEFAULTS0x00, "Reset to Factory Defaults" },
144 { 0, NULL((void*)0) }
145};
146
147/* Power Source Names */
148static const value_string zbee_zcl_basic_pwr_src_names[] = {
149 { ZBEE_ZCL_BASIC_PWR_SRC_UNKNOWN0x00, "Unknown" },
150 { ZBEE_ZCL_BASIC_PWR_SRC_MAINS_1PH0x01, "Mains (single phase)" },
151 { ZBEE_ZCL_BASIC_PWR_SRC_MAINS_3PH0x02, "Mains (3 phase)" },
152 { ZBEE_ZCL_BASIC_PWR_SRC_BATTERY0x03, "Battery" },
153 { ZBEE_ZCL_BASIC_PWR_SRC_DC_SRC0x04, "DC source" },
154 { ZBEE_ZCL_BASIC_PWR_SRC_EMERGENCY_10x05, "Emergency mains constantly powered" },
155 { ZBEE_ZCL_BASIC_PWR_SRC_EMERGENCY_20x06, "Emergency mains and transfer switch" },
156 { 0, NULL((void*)0) }
157};
158
159/* Device Enable Names */
160static const value_string zbee_zcl_basic_dev_en_names[] = {
161 { ZBEE_ZCL_BASIC_DISABLED0x00, "Disabled" },
162 { ZBEE_ZCL_BASIC_ENABLED0x01, "Enabled" },
163 { 0, NULL((void*)0) }
164};
165
166/*************************/
167/* Function Bodies */
168/*************************/
169
170/*FUNCTION:------------------------------------------------------
171 * NAME
172 * dissect_zbee_zcl_basic
173 * DESCRIPTION
174 * ZigBee ZCL Basic cluster dissector for wireshark.
175 * PARAMETERS
176 * tvbuff_t *tvb - pointer to buffer containing raw packet.
177 * packet_info *pinfo - pointer to packet information fields
178 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
179 * void *data - pointer to ZCL packet structure.
180 * RETURNS
181 * int - length of parsed data.
182 *---------------------------------------------------------------
183 */
184static int
185dissect_zbee_zcl_basic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
186{
187 zbee_zcl_packet *zcl;
188 unsigned offset = 0;
189 uint8_t cmd_id;
190
191 /* Reject the packet if data is NULL */
192 if (data == NULL((void*)0))
193 return 0;
194 zcl = (zbee_zcl_packet *)data;
195 cmd_id = zcl->cmd_id;
196
197 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
198 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER0x00) {
199 /* Append the command name to the info column. */
200 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
201 val_to_str_const(cmd_id, zbee_zcl_basic_srv_rx_cmd_names, "Unknown Command"),
202 zcl->tran_seqno);
203
204 if (tree) {
205 /* Add the command ID. */
206 proto_tree_add_item(tree, hf_zbee_zcl_basic_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
207 }
208 /*offset++;*/
209
210 /* Call the appropriate command dissector */
211 switch (cmd_id) {
212
213 case ZBEE_ZCL_CMD_ID_BASIC_RESET_FACTORY_DEFAULTS0x00:
214 /* No payload */
215 break;
216
217 default:
218 break;
219 }
220 }
221
222 return tvb_captured_length(tvb);
223} /*dissect_zbee_zcl_basic*/
224
225
226/*FUNCTION:------------------------------------------------------
227 * NAME
228 * dissect_zcl_basic_attr_data
229 * DESCRIPTION
230 * this function is called by ZCL foundation dissector in order to decode
231 * specific cluster attributes data.
232 * PARAMETERS
233 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
234 * tvbuff_t *tvb - pointer to buffer containing raw packet.
235 * unsigned *offset - pointer to buffer offset
236 * uint16_t attr_id - attribute identifier
237 * unsigned data_type - attribute data type
238 * bool client_attr- ZCL client
239 * RETURNS
240 * none
241 *---------------------------------------------------------------
242 */
243void
244dissect_zcl_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
245{
246
247 static int * const alarm_mask[] = {
248 &hf_zbee_zcl_basic_alarm_mask_gen_hw_fault,
249 &hf_zbee_zcl_basic_alarm_mask_gen_sw_fault,
250 &hf_zbee_zcl_basic_alarm_mask_reserved,
251 NULL((void*)0)
252 };
253
254 static int * const local_cfg[] = {
255 &hf_zbee_zcl_basic_disable_local_cfg_reset,
256 &hf_zbee_zcl_basic_disable_local_cfg_device_cfg,
257 &hf_zbee_zcl_basic_disable_local_cfg_reserved,
258 NULL((void*)0)
259 };
260
261 /* Dissect attribute data type and data */
262 switch (attr_id) {
263
264 case ZBEE_ZCL_ATTR_ID_BASIC_POWER_SOURCE0x0007:
265 proto_tree_add_item(tree, hf_zbee_zcl_basic_pwr_src, tvb, *offset, 1, ENC_NA0x00000000);
266 *offset += 1;
267 break;
268
269 case ZBEE_ZCL_ATTR_ID_BASIC_DEVICE_ENABLED0x0012:
270 proto_tree_add_item(tree, hf_zbee_zcl_basic_dev_en, tvb, *offset, 1, ENC_NA0x00000000);
271 *offset += 1;
272 break;
273
274 case ZBEE_ZCL_ATTR_ID_BASIC_ALARM_MASK0x0013:
275 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_basic_alarm_mask , ett_zbee_zcl_basic_alarm_mask, alarm_mask, ENC_NA0x00000000);
276 *offset += 1;
277 break;
278
279 case ZBEE_ZCL_ATTR_ID_BASIC_DISABLE_LOCAL_CFG0x0014:
280 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_basic_disable_local_cfg , ett_zbee_zcl_basic_dis_local_cfg, local_cfg, ENC_NA0x00000000);
281 *offset += 1;
282 break;
283
284 case ZBEE_ZCL_ATTR_ID_BASIC_ZCL_VERSION0x0000:
285 case ZBEE_ZCL_ATTR_ID_BASIC_APPL_VERSION0x0001:
286 case ZBEE_ZCL_ATTR_ID_BASIC_STACK_VERSION0x0002:
287 case ZBEE_ZCL_ATTR_ID_BASIC_HW_VERSION0x0003:
288 case ZBEE_ZCL_ATTR_ID_BASIC_MANUFACTURER_NAME0x0004:
289 case ZBEE_ZCL_ATTR_ID_BASIC_MODEL_ID0x0005:
290 case ZBEE_ZCL_ATTR_ID_BASIC_DATE_CODE0x0006:
291 case ZBEE_ZCL_ATTR_ID_BASIC_PHY_ENVIRONMENT0x0011:
292 case ZBEE_ZCL_ATTR_ID_BASIC_LOCATION_DESCR0x0010:
293 case ZBEE_ZCL_ATTR_ID_BASIC_SW_BUILD_ID0x4000:
294 default:
295 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
296 break;
297 }
298
299} /*dissect_zcl_basic_attr_data*/
300
301
302/*FUNCTION:------------------------------------------------------
303 * NAME
304 * proto_register_zbee_zcl_basic
305 * DESCRIPTION
306 * ZigBee ZCL Basic cluster protocol registration routine.
307 * PARAMETERS
308 * none
309 * RETURNS
310 * void
311 *---------------------------------------------------------------
312 */
313void
314proto_register_zbee_zcl_basic(void)
315{
316 /* Setup list of header fields */
317 static hf_register_info hf[] = {
318
319 { &hf_zbee_zcl_basic_attr_id,
320 { "Attribute", "zbee_zcl_general.basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_basic_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_basic_attr_names
))))
,
321 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
322
323 { &hf_zbee_zcl_basic_pwr_src,
324 { "Power Source", "zbee_zcl_general.basic.attr.pwr_src", FT_UINT8, BASE_HEX, VALS(zbee_zcl_basic_pwr_src_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_basic_pwr_src_names
))))
,
325 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
326
327 { &hf_zbee_zcl_basic_dev_en,
328 { "Device Enabled", "zbee_zcl_general.basic.attr.dev_en", FT_UINT8, BASE_HEX, VALS(zbee_zcl_basic_dev_en_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_basic_dev_en_names
))))
,
329 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
330
331 /* start Alarm Mask fields */
332 { &hf_zbee_zcl_basic_alarm_mask,
333 { "Alarm Mask", "zbee_zcl_general.basic.attr.alarm_mask", FT_UINT8, BASE_HEX, NULL((void*)0),
334 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
335
336 { &hf_zbee_zcl_basic_alarm_mask_gen_hw_fault,
337 { "General hardware fault", "zbee_zcl_general.basic.attr.alarm_mask.gen_hw_fault", FT_UINT8, BASE_DEC, NULL((void*)0),
338 ZBEE_ZCL_BASIC_ALARM_GEN_HW_FAULT0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
339
340 { &hf_zbee_zcl_basic_alarm_mask_gen_sw_fault,
341 { "General software fault", "zbee_zcl_general.basic.attr.alarm_mask.gen_sw_fault", FT_UINT8, BASE_DEC, NULL((void*)0),
342 ZBEE_ZCL_BASIC_ALARM_GEN_SW_FAULT0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
343
344 { &hf_zbee_zcl_basic_alarm_mask_reserved,
345 { "Reserved", "zbee_zcl_general.basic.attr.alarm_mask.reserved", FT_UINT8, BASE_DEC, NULL((void*)0),
346 ZBEE_ZCL_BASIC_ALARM_RESERVED0xfc, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
347 /* end Alarm Mask fields */
348
349 /* start Disable Local Config fields */
350 { &hf_zbee_zcl_basic_disable_local_cfg,
351 { "Disable Local Config", "zbee_zcl_general.basic.attr.dis_loc_cfg", FT_UINT8, BASE_HEX, NULL((void*)0),
352 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
353
354 { &hf_zbee_zcl_basic_disable_local_cfg_reset,
355 { "Reset (to factory defaults)", "zbee_zcl_general.basic.attr.dis_loc_cfg.reset", FT_UINT8, BASE_DEC, NULL((void*)0),
356 ZBEE_ZCL_BASIC_DIS_LOC_CFG_RESET0x01 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
357
358 { &hf_zbee_zcl_basic_disable_local_cfg_device_cfg,
359 { "Device configuration", "zbee_zcl_general.basic.attr.dis_loc_cfg.dev_cfg", FT_UINT8, BASE_DEC, NULL((void*)0),
360 ZBEE_ZCL_BASIC_DIS_LOC_CFG_DEV_CFG0x02 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
361
362 { &hf_zbee_zcl_basic_disable_local_cfg_reserved,
363 { "Reserved", "zbee_zcl_general.basic.attr.dis_loc_cfg.reserved", FT_UINT8, BASE_DEC, NULL((void*)0),
364 ZBEE_ZCL_BASIC_DIS_LOC_CFG_RESERVED0xfc , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
365 /* end Disable Local Config fields */
366
367 { &hf_zbee_zcl_basic_srv_rx_cmd_id,
368 { "Command", "zbee_zcl_general.basic.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_basic_srv_rx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_basic_srv_rx_cmd_names
))))
,
369 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
370
371 };
372
373 /* ZCL Basic subtrees */
374 static int *ett[] = {
375 &ett_zbee_zcl_basic,
376 &ett_zbee_zcl_basic_alarm_mask,
377 &ett_zbee_zcl_basic_dis_local_cfg
378 };
379
380 /* Register the ZigBee ZCL Basic cluster protocol name and description */
381 proto_zbee_zcl_basic = proto_register_protocol("ZigBee ZCL Basic", "ZCL Basic", ZBEE_PROTOABBREV_ZCL_BASIC"zbee_zcl_general.basic");
382 proto_register_field_array(proto_zbee_zcl_basic, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
383 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
384
385 /* Register the ZigBee ZCL Basic dissector. */
386 register_dissector(ZBEE_PROTOABBREV_ZCL_BASIC"zbee_zcl_general.basic", dissect_zbee_zcl_basic, proto_zbee_zcl_basic);
387} /*proto_register_zbee_zcl_basic*/
388
389/*FUNCTION:------------------------------------------------------
390 * NAME
391 * proto_reg_handoff_zbee_zcl_basic
392 * DESCRIPTION
393 * Hands off the ZCL Basic dissector.
394 * PARAMETERS
395 * none
396 * RETURNS
397 * none
398 *---------------------------------------------------------------
399 */
400void
401proto_reg_handoff_zbee_zcl_basic(void)
402{
403 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_BASIC"zbee_zcl_general.basic",
404 proto_zbee_zcl_basic,
405 ett_zbee_zcl_basic,
406 ZBEE_ZCL_CID_BASIC0x0000,
407 ZBEE_MFG_CODE_NONE0x0000,
408 hf_zbee_zcl_basic_attr_id,
409 hf_zbee_zcl_basic_attr_id,
410 hf_zbee_zcl_basic_srv_rx_cmd_id,
411 -1,
412 (zbee_zcl_fn_attr_data)dissect_zcl_basic_attr_data
413 );
414} /*proto_reg_handoff_zbee_zcl_basic*/
415
416
417
418/* ########################################################################## */
419/* #### (0x0001) POWER CONFIGURATION CLUSTER ################################ */
420/* ########################################################################## */
421
422/*************************/
423/* Defines */
424/*************************/
425
426/* Attributes */
427#define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE0x0000 0x0000 /* Mains voltage */
428#define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_FREQUENCY0x0001 0x0001 /* Mains frequency */
429#define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_ALARM_MASK0x0010 0x0010 /* Mains Alarm Mask */
430#define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MIN_THR0x0011 0x0011 /* Mains Voltage Min Threshold */
431#define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MAX_THR0x0012 0x0012 /* Mains Voltage Max Threshold */
432#define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_DWELL_TP0x0013 0x0013 /* Mains Voltage Dwell Trip Point */
433#define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE0x0020 0x0020 /* Battery Voltage */
434#define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_PERCENTAGE0x0021 0x0021 /* Battery Percentage Remaining */
435#define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_MANUFACTURER0x0030 0x0030 /* Battery Manufacturer */
436#define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_SIZE0x0031 0x0031 /* Battery Size */
437#define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_AH_RATING0x0032 0x0032 /* Battery AHr Rating */
438#define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_QUANTITY0x0033 0x0033 /* Battery Quantity */
439#define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_RATED_VOLTAGE0x0034 0x0034 /* Battery Rated Voltage */
440#define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_ALARM_MASK0x0035 0x0035 /* Battery Alarm Mask */
441#define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE_MIN_THR0x0036 0x0036 /* Battery Voltage Min Threshold */
442
443/* Server Commands Received - None */
444
445/* Server Commands Generated - None */
446
447/* Mains Alarm Mask bit-mask */
448#define ZBEE_ZCL_POWER_CONF_MAINS_ALARM_LOW0x01 0x01 /* Mains voltage too low */
449#define ZBEE_ZCL_POWER_CONF_MAINS_ALARM_HIGH0x02 0x02 /* Mains voltage too high */
450#define ZBEE_ZCL_POWER_CONF_MAINS_ALARM_RESERVED0xfc 0xfc /* Reserved */
451
452/* Battery Size values */
453#define ZBEE_ZCL_POWER_CONF_BAT_TYPE_NO_BAT0x00 0x00 /* No battery */
454#define ZBEE_ZCL_POWER_CONF_BAT_TYPE_BUILT_IN0x01 0x01 /* Built in */
455#define ZBEE_ZCL_POWER_CONF_BAT_TYPE_OTHER0x02 0x02 /* Other */
456#define ZBEE_ZCL_POWER_CONF_BAT_TYPE_AA0x03 0x03 /* AA */
457#define ZBEE_ZCL_POWER_CONF_BAT_TYPE_AAA0x04 0x04 /* AAA */
458#define ZBEE_ZCL_POWER_CONF_BAT_TYPE_C0x05 0x05 /* C */
459#define ZBEE_ZCL_POWER_CONF_BAT_TYPE_D0x06 0x06 /* D */
460#define ZBEE_ZCL_POWER_CONF_BAT_TYPE_UNKNOWN0xFF 0xFF /* Unknown */
461
462/* Battery alarm mask bit-mask */
463#define ZBEE_ZCL_POWER_CONF_BATTERY_ALARM_LOW0x01 0x01 /* Battery voltage too low */
464#define ZBEE_ZCL_POWER_CONF_BATTERY_ALARM_RESERVED0xfe 0xfe /* Reserved */
465
466/*************************/
467/* Function Declarations */
468/*************************/
469
470void proto_register_zbee_zcl_power_config(void);
471void proto_reg_handoff_zbee_zcl_power_config(void);
472
473/* Command Dissector Helpers */
474static void dissect_zcl_power_config_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
475
476/* Private functions prototype */
477
478/*************************/
479/* Global Variables */
480/*************************/
481/* Initialize the protocol and registered fields */
482static int proto_zbee_zcl_power_config;
483static int hf_zbee_zcl_power_config_attr_id;
484static int hf_zbee_zcl_power_config_batt_type;
485static int hf_zbee_zcl_power_config_mains_alarm_mask;
486static int hf_zbee_zcl_power_config_mains_alarm_mask_low;
487static int hf_zbee_zcl_power_config_mains_alarm_mask_high;
488static int hf_zbee_zcl_power_config_mains_alarm_mask_reserved;
489static int hf_zbee_zcl_power_config_batt_alarm_mask;
490static int hf_zbee_zcl_power_config_batt_alarm_mask_low;
491static int hf_zbee_zcl_power_config_batt_alarm_mask_reserved;
492static int hf_zbee_zcl_power_config_mains_voltage;
493static int hf_zbee_zcl_power_config_mains_frequency;
494static int hf_zbee_zcl_power_config_mains_voltage_min_thr;
495static int hf_zbee_zcl_power_config_mains_voltage_max_thr;
496static int hf_zbee_zcl_power_config_mains_voltage_dwell_tp;
497static int hf_zbee_zcl_power_config_batt_voltage;
498static int hf_zbee_zcl_power_config_batt_percentage;
499static int hf_zbee_zcl_power_config_batt_ah_rating;
500static int hf_zbee_zcl_power_config_batt_rated_voltage;
501static int hf_zbee_zcl_power_config_batt_voltage_min_thr;
502/* Initialize the subtree pointers */
503static int ett_zbee_zcl_power_config;
504static int ett_zbee_zcl_power_config_mains_alarm_mask;
505static int ett_zbee_zcl_power_config_batt_alarm_mask;
506
507/* Attributes */
508static const value_string zbee_zcl_power_config_attr_names[] = {
509 { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE0x0000, "Mains Voltage" },
510 { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_FREQUENCY0x0001, "Mains Frequency" },
511 { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_ALARM_MASK0x0010, "Mains Alarm Mask" },
512 { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MIN_THR0x0011, "Mains Voltage Min Threshold" },
513 { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MAX_THR0x0012, "Mains Voltage Max Threshold" },
514 { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_DWELL_TP0x0013, "Mains Voltage Dwell Trip Point" },
515 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE0x0020, "Battery Voltage" },
516 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_PERCENTAGE0x0021, "Battery Percentage Remaining" },
517 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_MANUFACTURER0x0030, "Battery Manufacturer" },
518 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_SIZE0x0031, "Battery Size" },
519 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_AH_RATING0x0032, "Battery AHr Rating" },
520 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_QUANTITY0x0033, "Battery Quantity" },
521 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_RATED_VOLTAGE0x0034, "Battery Rated Voltage" },
522 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_ALARM_MASK0x0035, "Battery Alarm Mask" },
523 { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE_MIN_THR0x0036, "Battery Voltage Minimum Threshold" },
524 { 0, NULL((void*)0) }
525};
526
527
528/* Battery size Names */
529static const value_string zbee_zcl_power_config_batt_type_names[] = {
530 { ZBEE_ZCL_POWER_CONF_BAT_TYPE_NO_BAT0x00, "No battery" },
531 { ZBEE_ZCL_POWER_CONF_BAT_TYPE_BUILT_IN0x01, "Built in" },
532 { ZBEE_ZCL_POWER_CONF_BAT_TYPE_OTHER0x02, "Other" },
533 { ZBEE_ZCL_POWER_CONF_BAT_TYPE_AA0x03, "AA" },
534 { ZBEE_ZCL_POWER_CONF_BAT_TYPE_AAA0x04, "AAA" },
535 { ZBEE_ZCL_POWER_CONF_BAT_TYPE_C0x05, "C" },
536 { ZBEE_ZCL_POWER_CONF_BAT_TYPE_D0x06, "D" },
537 { ZBEE_ZCL_POWER_CONF_BAT_TYPE_UNKNOWN0xFF, "Unknown" },
538 { 0, NULL((void*)0) }
539};
540
541
542/*************************/
543/* Function Bodies */
544/*************************/
545
546/*FUNCTION:------------------------------------------------------
547 * NAME
548 * dissect_zbee_zcl_power_config
549 * DESCRIPTION
550 * ZigBee ZCL power configuration cluster dissector for wireshark.
551 * PARAMETERS
552 * tvbuff_t *tvb - pointer to buffer containing raw packet.
553 * packet_info *pinfo - pointer to packet information fields
554 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
555 * RETURNS
556 * none
557 *---------------------------------------------------------------
558 */
559static int
560dissect_zbee_zcl_power_config(tvbuff_t *tvb _U___attribute__((unused)), packet_info *pinfo _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), void* data _U___attribute__((unused)))
561{
562 return tvb_captured_length(tvb);
563} /*dissect_zbee_zcl_power_config*/
564
565/*FUNCTION:------------------------------------------------------
566 * NAME
567 * decode_power_conf_voltage
568 * DESCRIPTION
569 * this function decodes voltage values
570 * PARAMETERS
571 * unsigned *s - string to display
572 * uint32_t value - value to decode
573 * RETURNS
574 * none
575 *---------------------------------------------------------------
576 */
577static void
578decode_power_conf_voltage(char *s, uint32_t value)
579{
580 snprintf(s, ITEM_LABEL_LENGTH240, "%d.%d [V]", value/10, value%10);
581 return;
582} /*decode_power_conf_voltage*/
583
584 /*FUNCTION:------------------------------------------------------
585 * NAME
586 * decode_power_conf_percentage
587 * DESCRIPTION
588 * this function decodes percentage values
589 * PARAMETERS
590 * unsigned *s - string to display
591 * uint32_t value - value to decode
592 * RETURNS
593 * none
594 *---------------------------------------------------------------
595 */
596static void
597decode_power_conf_percentage(char *s, uint32_t value)
598{
599 snprintf(s, ITEM_LABEL_LENGTH240, "%.1f [%%]", value/2.0);
600 return;
601} /*decode_power_conf_percentage*/
602
603 /*FUNCTION:------------------------------------------------------
604 * NAME
605 * decode_power_conf_frequency
606 * DESCRIPTION
607 * this function decodes mains frequency values
608 * PARAMETERS
609 * unsigned *s - string to display
610 * uint32_t value - value to decode
611 * RETURNS
612 * none
613 *---------------------------------------------------------------
614 */
615static void
616decode_power_conf_frequency(char *s, uint32_t value)
617{
618 if(value == 0x00)
619 snprintf(s, ITEM_LABEL_LENGTH240, "Frequency too low to be measured (or DC supply)");
620 else if(value == 0xfe)
621 snprintf(s, ITEM_LABEL_LENGTH240, "Frequency too high to be measured");
622 else if (value == 0xff)
623 snprintf(s, ITEM_LABEL_LENGTH240, "Frequency could not be measured");
624 else
625 snprintf(s, ITEM_LABEL_LENGTH240, "%d [Hz]", value*2);
626 return;
627} /*decode_power_conf_frequency*/
628
629/*FUNCTION:------------------------------------------------------
630 * NAME
631 * decode_power_conf_batt_AHr
632 * DESCRIPTION
633 * this function decodes battery capacity values
634 * PARAMETERS
635 * unsigned *s - string to display
636 * uint32_t value - value to decode
637 * RETURNS
638 * none
639 *---------------------------------------------------------------
640 */
641static void
642decode_power_conf_batt_AHr(char *s, uint32_t value)
643{
644 snprintf(s, ITEM_LABEL_LENGTH240, "%d [mAHr]", value*10);
645 return;
646} /*decode_power_conf_batt_AHr*/
647
648/*FUNCTION:------------------------------------------------------
649 * NAME
650 * dissect_zcl_power_config_attr_data
651 * DESCRIPTION
652 * this function is called by ZCL foundation dissector in order to decode
653 * specific cluster attributes data.
654 * PARAMETERS
655 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
656 * tvbuff_t *tvb - pointer to buffer containing raw packet.
657 * unsigned *offset - pointer to buffer offset
658 * uint16_t attr_id - attribute identifier
659 * unsigned data_type - attribute data type
660 * bool client_attr- ZCL client
661 * RETURNS
662 * none
663 *---------------------------------------------------------------
664 */
665void
666dissect_zcl_power_config_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
667{
668 proto_item *it;
669 static int * const mains_alarm_mask[] = {
670 &hf_zbee_zcl_power_config_mains_alarm_mask_low,
671 &hf_zbee_zcl_power_config_mains_alarm_mask_high,
672 &hf_zbee_zcl_power_config_mains_alarm_mask_reserved,
673 NULL((void*)0)
674 };
675
676 static int * const batt_alarm_mask[] = {
677 &hf_zbee_zcl_power_config_batt_alarm_mask_low,
678 &hf_zbee_zcl_power_config_batt_alarm_mask_reserved,
679 NULL((void*)0)
680 };
681
682 /* Dissect attribute data type and data */
683 switch (attr_id) {
684 case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE0x0000:
685 proto_tree_add_item(tree, hf_zbee_zcl_power_config_mains_voltage, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
686 *offset += 2;
687 break;
688 case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_FREQUENCY0x0001:
689 proto_tree_add_item(tree, hf_zbee_zcl_power_config_mains_frequency, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
690 *offset += 1;
691 break;
692 case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_ALARM_MASK0x0010:
693 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_ENDIAN0x80000000);
694 *offset += 1;
695 break;
696 case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MIN_THR0x0011:
697 proto_tree_add_item(tree, hf_zbee_zcl_power_config_mains_voltage_min_thr, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
698 *offset += 2;
699 break;
700 case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MAX_THR0x0012:
701 proto_tree_add_item(tree, hf_zbee_zcl_power_config_mains_voltage_max_thr, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
702 *offset += 2;
703 break;
704 case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_DWELL_TP0x0013:
705 it = proto_tree_add_item(tree, hf_zbee_zcl_power_config_mains_voltage_dwell_tp, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
706 proto_item_append_text(it, " [s]");
707 *offset += 2;
708 break;
709 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_SIZE0x0031:
710 proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
711 *offset += 1;
712 break;
713 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE0x0020:
714 proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_voltage, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
715 *offset += 1;
716 break;
717 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_PERCENTAGE0x0021:
718 proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_percentage, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
719 *offset += 1;
720 break;
721 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_AH_RATING0x0032:
722 proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_ah_rating, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
723 *offset += 2;
724 break;
725 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_RATED_VOLTAGE0x0034:
726 proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_rated_voltage, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
727 *offset += 1;
728 break;
729 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_ALARM_MASK0x0035:
730 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_ENDIAN0x80000000);
731 *offset += 1;
732 break;
733 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE_MIN_THR0x0036:
734 proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_voltage_min_thr, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
735 *offset += 1;
736 break;
737
738 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_MANUFACTURER0x0030:
739 case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_QUANTITY0x0033:
740 default:
741 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
742 break;
743 }
744
745} /*dissect_zcl_power_config_attr_data*/
746
747
748/*FUNCTION:------------------------------------------------------
749 * NAME
750 * proto_register_zbee_zcl_power_config
751 * DESCRIPTION
752 * ZigBee ZCL power configuration cluster protocol registration routine.
753 * PARAMETERS
754 * none
755 * RETURNS
756 * void
757 *---------------------------------------------------------------
758 */
759void
760proto_register_zbee_zcl_power_config(void)
761{
762 /* Setup list of header fields */
763 static hf_register_info hf[] = {
764
765 { &hf_zbee_zcl_power_config_attr_id,
766 { "Attribute", "zbee_zcl_general.power_config.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_power_config_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_power_config_attr_names
))))
,
767 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
768
769 { &hf_zbee_zcl_power_config_batt_type,
770 { "Battery Type", "zbee_zcl_general.power_config.attr.batt_type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_power_config_batt_type_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_power_config_batt_type_names
))))
,
771 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
772
773 /* start mains Alarm Mask fields */
774 { &hf_zbee_zcl_power_config_mains_alarm_mask,
775 { "Mains Alarm Mask", "zbee_zcl_general.power_config.attr.mains_alarm_mask", FT_UINT8, BASE_HEX, NULL((void*)0),
776 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
777
778 { &hf_zbee_zcl_power_config_mains_alarm_mask_low,
779 { "Mains Voltage too low", "zbee_zcl_general.power_config.attr.mains_alarm_mask.mains_too_low", FT_UINT8, BASE_DEC, NULL((void*)0),
780 ZBEE_ZCL_POWER_CONF_MAINS_ALARM_LOW0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
781
782 { &hf_zbee_zcl_power_config_mains_alarm_mask_high,
783 { "Mains Voltage too high", "zbee_zcl_general.power_config.attr.mains_alarm_mask.mains_too_high", FT_UINT8, BASE_DEC, NULL((void*)0),
784 ZBEE_ZCL_POWER_CONF_MAINS_ALARM_HIGH0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
785
786 { &hf_zbee_zcl_power_config_mains_alarm_mask_reserved,
787 { "Reserved", "zbee_zcl_general.power_config.attr.mains_alarm_mask.reserved", FT_UINT8, BASE_DEC, NULL((void*)0),
788 ZBEE_ZCL_POWER_CONF_MAINS_ALARM_RESERVED0xfc, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
789 /* end mains Alarm Mask fields */
790
791 /* start battery Alarm Mask fields */
792 { &hf_zbee_zcl_power_config_batt_alarm_mask,
793 { "Battery Alarm Mask", "zbee_zcl_general.power_config.attr.batt_alarm_mask", FT_UINT8, BASE_HEX, NULL((void*)0),
794 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
795
796 { &hf_zbee_zcl_power_config_batt_alarm_mask_low,
797 { "Battery Voltage too low", "zbee_zcl_general.power_config.batt_attr.alarm_mask.batt_too_low", FT_UINT8, BASE_DEC, NULL((void*)0),
798 ZBEE_ZCL_POWER_CONF_BATTERY_ALARM_LOW0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
799
800 { &hf_zbee_zcl_power_config_batt_alarm_mask_reserved,
801 { "Reserved", "zbee_zcl_general.power_config.attr.batt_alarm_mask.reserved", FT_UINT8, BASE_DEC, NULL((void*)0),
802 ZBEE_ZCL_POWER_CONF_BATTERY_ALARM_RESERVED0xfe, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
803 /* end battery Alarm Mask fields */
804
805 { &hf_zbee_zcl_power_config_mains_voltage,
806 { "Measured Mains Voltage", "zbee_zcl_general.power_config.attr.mains_voltage", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage)((const void *) (size_t) (decode_power_conf_voltage)),
807 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
808
809 { &hf_zbee_zcl_power_config_mains_frequency,
810 { "Measured Mains Frequency", "zbee_zcl_general.power_config.attr.mains_frequency", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_conf_frequency)((const void *) (size_t) (decode_power_conf_frequency)),
811 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
812
813 { &hf_zbee_zcl_power_config_mains_voltage_min_thr,
814 { "Mains Voltage Minimum Threshold", "zbee_zcl_general.power_config.attr.mains_volt_min", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage)((const void *) (size_t) (decode_power_conf_voltage)),
815 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
816
817 { &hf_zbee_zcl_power_config_mains_voltage_max_thr,
818 { "Mains Voltage Maximum Threshold", "zbee_zcl_general.power_config.attr.mains_volt_max", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage)((const void *) (size_t) (decode_power_conf_voltage)),
819 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
820
821 { &hf_zbee_zcl_power_config_batt_voltage,
822 { "Measured Battery Voltage", "zbee_zcl_general.power_config.attr.batt_voltage", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage)((const void *) (size_t) (decode_power_conf_voltage)),
823 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
824
825 { &hf_zbee_zcl_power_config_batt_percentage,
826 { "Remaining Battery Percentage", "zbee_zcl_general.power_config.attr.batt_percentage", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_conf_percentage)((const void *) (size_t) (decode_power_conf_percentage)),
827 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
828
829 { &hf_zbee_zcl_power_config_batt_ah_rating,
830 { "Battery Capacity", "zbee_zcl_general.power_config.attr.batt_AHr", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_power_conf_batt_AHr)((const void *) (size_t) (decode_power_conf_batt_AHr)),
831 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
832
833 { &hf_zbee_zcl_power_config_batt_rated_voltage,
834 { "Battery Rated Voltage", "zbee_zcl_general.power_config.attr.batt_rated_voltage", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage)((const void *) (size_t) (decode_power_conf_voltage)),
835 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
836
837 { &hf_zbee_zcl_power_config_batt_voltage_min_thr,
838 { "Battery Voltage Minimum Threshold", "zbee_zcl_general.power_config.attr.batt_voltage_min_thr", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage)((const void *) (size_t) (decode_power_conf_voltage)),
839 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
840
841 { &hf_zbee_zcl_power_config_mains_voltage_dwell_tp,
842 { "Mains Voltage Dwell Trip Point", "zbee_zcl_general.power_config.attr.mains_dwell_tp", FT_UINT16, BASE_DEC, NULL((void*)0),
843 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
844 };
845
846 /* ZCL power configuration subtrees */
847 static int *ett[] = {
848 &ett_zbee_zcl_power_config,
849 &ett_zbee_zcl_power_config_mains_alarm_mask,
850 &ett_zbee_zcl_power_config_batt_alarm_mask
851 };
852
853 /* Register the ZigBee ZCL power configuration cluster protocol name and description */
854 proto_zbee_zcl_power_config = proto_register_protocol("ZigBee ZCL Power Configuration", "ZCL Power Configuration", ZBEE_PROTOABBREV_ZCL_POWER_CONFIG"zbee_zcl_general.power_config");
855 proto_register_field_array(proto_zbee_zcl_power_config, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
856 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
857
858 /* Register the ZigBee ZCL power configuration dissector. */
859 register_dissector(ZBEE_PROTOABBREV_ZCL_POWER_CONFIG"zbee_zcl_general.power_config", dissect_zbee_zcl_power_config, proto_zbee_zcl_power_config);
860} /*proto_register_zbee_zcl_power_config*/
861
862/*FUNCTION:------------------------------------------------------
863 * NAME
864 * proto_reg_handoff_zbee_zcl_power_config
865 * DESCRIPTION
866 * Hands off the ZCL power configuration dissector.
867 * PARAMETERS
868 * none
869 * RETURNS
870 * none
871 *---------------------------------------------------------------
872 */
873void
874proto_reg_handoff_zbee_zcl_power_config(void)
875{
876 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_POWER_CONFIG"zbee_zcl_general.power_config",
877 proto_zbee_zcl_power_config,
878 ett_zbee_zcl_power_config,
879 ZBEE_ZCL_CID_POWER_CONFIG0x0001,
880 ZBEE_MFG_CODE_NONE0x0000,
881 hf_zbee_zcl_power_config_attr_id,
882 hf_zbee_zcl_power_config_attr_id,
883 -1, -1,
884 (zbee_zcl_fn_attr_data)dissect_zcl_power_config_attr_data
885 );
886} /*proto_reg_handoff_zbee_zcl_power_config*/
887
888
889/* ########################################################################## */
890/* #### (0x0002) DEVICE TEMPERATURE CONFIGURATION CLUSTER ################### */
891/* ########################################################################## */
892
893/*************************/
894/* Defines */
895/*************************/
896
897/*Attributes*/
898#define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_CURRENT_TEMP0x0000 0x0000 /*Current Temperature*/
899#define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MIN_TEMP_EXP0x0001 0x0001 /*Min Temperature Experienced*/
900#define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MAX_TEMP_EXP0x0002 0x0002 /*Max Temperature Experienced*/
901#define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_OVER_TEMP_TOTAL_DWELL0x0003 0x0003 /*Over Temperature Total Dwell*/
902
903#define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK0x0010 0x0010 /*Device Temperature Alarm Mask*/
904#define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_THRESHOLD0x0011 0x0011 /*Low Temperature Threshold*/
905#define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_THRESHOLD0x0012 0x0012 /*High Temperature Threshold*/
906#define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_DWELL_TRIP_POINT0x0013 0x0013 /*Low Temperature Dwell Trip Point*/
907#define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_DWELL_TRIP_POINT0x0014 0x0014 /*High Temperature Dwell Trip Point*/
908
909/*Server commands received - none*/
910
911/*Server commands generated - none*/
912
913/*Device Temperature Alarm Mask Value*/
914#define ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_TOO_LOW0x01 0x01 /*Mains Voltage too low*/
915#define ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_TOO_HIGH0x02 0x02 /*Mains Voltage too high*/
916#define ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_RESERVED0xfc 0xfc /*Mains Voltage reserved*/
917
918/*************************/
919/* Function Declarations */
920/*************************/
921
922void proto_register_zbee_zcl_device_temperature_configuration(void);
923void proto_reg_handoff_zbee_zcl_device_temperature_configuration(void);
924
925/* Command Dissector Helpers */
926static void dissect_zcl_device_temperature_configuration_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
927
928/* Private functions prototype */
929
930/*************************/
931/* Global Variables */
932/*************************/
933/* Initialize the protocol and registered fields */
934static int proto_zbee_zcl_device_temperature_configuration;
935
936static int hf_zbee_zcl_device_temperature_configuration_attr_id;
937static int hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask;
938static int hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_low;
939static int hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_high;
940static int hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_reserved;
941
942/* Initialize the subtree pointers */
943static int ett_zbee_zcl_device_temperature_configuration;
944static int ett_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask;
945
946/* Attributes */
947static const value_string zbee_zcl_device_temperature_configuration_attr_names[] = {
948 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_CURRENT_TEMP0x0000, "Current Temperature" },
949 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MIN_TEMP_EXP0x0001, "Min Temperature Experienced" },
950 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MAX_TEMP_EXP0x0002, "Max Temperature Experienced" },
951 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_OVER_TEMP_TOTAL_DWELL0x0003, "Over Temperature Total Dwell" },
952 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK0x0010, "Device Temperature Alarm Mask" },
953 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_THRESHOLD0x0011, "Low Temperature Threshold" },
954 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_THRESHOLD0x0012, "High Temperature Threshold" },
955 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_DWELL_TRIP_POINT0x0013, "Low Temperature Dwell Trip Point" },
956 { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_DWELL_TRIP_POINT0x0014, "High Temperature Dwell Trip Point" },
957 { 0, NULL((void*)0) }
958};
959
960/*************************/
961/* Function Bodies */
962/*************************/
963
964/*FUNCTION:------------------------------------------------------
965 * NAME
966 * dissect_zbee_zcl_device_temperature_configuration
967 * DESCRIPTION
968 * ZigBee ZCL Device Temperature Configuration cluster dissector for wireshark.
969 * PARAMETERS
970 * tvbuff_t *tvb - pointer to buffer containing raw packet.
971 * packet_info *pinfo - pointer to packet information fields
972 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
973 * RETURNS
974 * int - length of parsed data.
975 *---------------------------------------------------------------
976 */
977
978static int
979dissect_zbee_zcl_device_temperature_configuration(tvbuff_t *tvb _U___attribute__((unused)), packet_info *pinfo _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), void* data _U___attribute__((unused)))
980{
981 return tvb_captured_length(tvb);
982} /*dissect_zbee_zcl_device_temperature_configuration*/
983
984
985/*FUNCTION:------------------------------------------------------
986 * NAME
987 * dissect_zcl_device_temperature_configuration_attr_data
988 * DESCRIPTION
989 * this function is called by ZCL foundation dissector in order to decode
990 * specific cluster attributes data.
991 * PARAMETERS
992 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
993 * tvbuff_t *tvb - pointer to buffer containing raw packet.
994 * unsigned *offset - pointer to buffer offset
995 * uint16_t attr_id - attribute identifier
996 * unsigned data_type - attribute data type
997 * bool client_attr- ZCL client
998 * RETURNS
999 * none
1000 *---------------------------------------------------------------
1001 */
1002void
1003dissect_zcl_device_temperature_configuration_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
1004{
1005 static int * const device_temp_alarm_mask[] = {
1006 &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_low,
1007 &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_high,
1008 &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_reserved,
1009 NULL((void*)0)
1010 };
1011
1012 /* Dissect attribute data type and data */
1013 switch (attr_id) {
1014
1015 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK0x0010:
1016 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_ENDIAN0x80000000);
1017 *offset += 1;
1018 break;
1019
1020 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_CURRENT_TEMP0x0000:
1021 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MIN_TEMP_EXP0x0001:
1022 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MAX_TEMP_EXP0x0002:
1023 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_OVER_TEMP_TOTAL_DWELL0x0003:
1024 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_THRESHOLD0x0011:
1025 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_THRESHOLD0x0012:
1026 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_DWELL_TRIP_POINT0x0013:
1027 case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_DWELL_TRIP_POINT0x0014:
1028 default:
1029 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
1030 break;
1031 }
1032
1033} /*dissect_zcl_device_temperature_configuration_attr_data*/
1034
1035
1036/*FUNCTION:------------------------------------------------------
1037 * NAME
1038 * proto_register_zbee_zcl_device_temperature_configuration
1039 * DESCRIPTION
1040 * ZigBee ZCL Device Temperature Configuration cluster protocol registration routine.
1041 * PARAMETERS
1042 * none
1043 * RETURNS
1044 * none
1045 *---------------------------------------------------------------
1046 */
1047void
1048proto_register_zbee_zcl_device_temperature_configuration(void)
1049{
1050 /* Setup list of header fields */
1051 static hf_register_info hf[] = {
1052
1053 { &hf_zbee_zcl_device_temperature_configuration_attr_id,
1054 { "Attribute", "zbee_zcl_general.device_temperature_configuration.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_device_temperature_configuration_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_device_temperature_configuration_attr_names
))))
,
1055 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1056
1057 /* start Device Temperature Alarm Mask fields */
1058 { &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask,
1059 { "Device Temperature Alarm Mask", "zbee_zcl_general.device_temperature_configuration.attr.device_temp_alarm_mask", FT_UINT8, BASE_HEX, NULL((void*)0),
1060 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1061
1062 { &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_low,
1063 { "Device Temperature too low", "zbee_zcl_general.device_temperature_configuration.attr.device_temp_alarm_mask.too_low", FT_UINT8, BASE_DEC, NULL((void*)0),
1064 ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_TOO_LOW0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1065
1066 { &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_high,
1067 { "Device Temperature too high", "zbee_zcl_general.device_temperature_configuration.attr.device_temp_alarm_mask.too_high", FT_UINT8, BASE_DEC, NULL((void*)0),
1068 ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_TOO_HIGH0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1069
1070 { &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_reserved,
1071 { "Reserved", "zbee_zcl_general.device_temperature_configuration.attr.device_temp_alarm_mask.reserved", FT_UINT8, BASE_DEC, NULL((void*)0),
1072 ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_RESERVED0xfc, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
1073 /* end Device Temperature Alarm Mask fields */
1074 };
1075
1076 /* ZCL Device Temperature Configuration subtrees */
1077 static int *ett[] = {
1078 &ett_zbee_zcl_device_temperature_configuration,
1079 &ett_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask
1080 };
1081
1082 /* Register the ZigBee ZCL Device Temperature Configuration cluster protocol name and description */
1083 proto_zbee_zcl_device_temperature_configuration = proto_register_protocol("ZigBee ZCL Device Temperature Configuration", "ZCL Device Temperature Configuration", ZBEE_PROTOABBREV_ZCL_DEVICE_TEMP_CONFIG"zbee_zcl_general.device_temperature_config");
1084 proto_register_field_array(proto_zbee_zcl_device_temperature_configuration, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
1085 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
1086
1087 /* Register the ZigBee ZCL Device Temperature Configuration dissector. */
1088 register_dissector(ZBEE_PROTOABBREV_ZCL_DEVICE_TEMP_CONFIG"zbee_zcl_general.device_temperature_config", dissect_zbee_zcl_device_temperature_configuration, proto_zbee_zcl_device_temperature_configuration);
1089} /*proto_register_zbee_zcl_device_temperature_configuration*/
1090
1091/*FUNCTION:------------------------------------------------------
1092 * NAME
1093 * proto_reg_handoff_zbee_zcl_device_temperature_configuration
1094 * DESCRIPTION
1095 * Hands off the ZCL Device Temperature Configuration dissector.
1096 * PARAMETERS
1097 * none
1098 * RETURNS
1099 * none
1100 *---------------------------------------------------------------
1101 */
1102void
1103proto_reg_handoff_zbee_zcl_device_temperature_configuration(void)
1104{
1105 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_DEVICE_TEMP_CONFIG"zbee_zcl_general.device_temperature_config",
1106 proto_zbee_zcl_device_temperature_configuration,
1107 ett_zbee_zcl_device_temperature_configuration,
1108 ZBEE_ZCL_CID_DEVICE_TEMP_CONFIG0x0002,
1109 ZBEE_MFG_CODE_NONE0x0000,
1110 hf_zbee_zcl_device_temperature_configuration_attr_id,
1111 hf_zbee_zcl_device_temperature_configuration_attr_id,
1112 -1, -1,
1113 (zbee_zcl_fn_attr_data)dissect_zcl_device_temperature_configuration_attr_data
1114 );
1115} /*proto_reg_handoff_zbee_zcl_device_temperature_configuration*/
1116
1117
1118/* ########################################################################## */
1119/* #### (0x0003) IDENTIFY CLUSTER ########################################### */
1120/* ########################################################################## */
1121
1122/*************************/
1123/* Defines */
1124/*************************/
1125
1126/* Attributes */
1127#define ZBEE_ZCL_ATTR_ID_IDENTIFY_IDENTIFY_TIME0x0000 0x0000 /* Identify Time */
1128
1129/* Server Commands Received */
1130#define ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY0x00 0x00 /* Identify */
1131#define ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY0x01 0x01 /* Identify Query */
1132#define ZBEE_ZCL_CMD_ID_IDENTIFY_TRIGGER_EFFECT0x40 0x40 /* Trigger Effect */
1133
1134/* Server Commands Generated */
1135#define ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY_RSP0x00 0x00 /* Identify Query Response */
1136
1137
1138/*************************/
1139/* Function Declarations */
1140/*************************/
1141
1142void proto_register_zbee_zcl_identify(void);
1143void proto_reg_handoff_zbee_zcl_identify(void);
1144
1145/* Command Dissector Helpers */
1146static void dissect_zcl_identify_identify (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1147static void dissect_zcl_identify_identifyqueryrsp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1148static void dissect_zcl_identify_triggereffect (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1149static void dissect_zcl_identify_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
1150
1151/* Private functions prototype */
1152
1153/*************************/
1154/* Global Variables */
1155/*************************/
1156/* Initialize the protocol and registered fields */
1157static int proto_zbee_zcl_identify;
1158
1159static int hf_zbee_zcl_identify_attr_id;
1160static int hf_zbee_zcl_identify_identify_time;
1161static int hf_zbee_zcl_identify_identify_timeout;
1162static int hf_zbee_zcl_identify_effect_id;
1163static int hf_zbee_zcl_identify_effect_variant;
1164static int hf_zbee_zcl_identify_srv_rx_cmd_id;
1165static int hf_zbee_zcl_identify_srv_tx_cmd_id;
1166
1167/* Initialize the subtree pointers */
1168static int ett_zbee_zcl_identify;
1169
1170/* Attributes */
1171static const value_string zbee_zcl_identify_attr_names[] = {
1172 { ZBEE_ZCL_ATTR_ID_IDENTIFY_IDENTIFY_TIME0x0000, "Identify Time" },
1173 { 0, NULL((void*)0) }
1174};
1175
1176/* Server Commands Received */
1177static const value_string zbee_zcl_identify_srv_rx_cmd_names[] = {
1178 { ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY0x00, "Identify" },
1179 { ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY0x01, "Identify Query" },
1180 { ZBEE_ZCL_CMD_ID_IDENTIFY_TRIGGER_EFFECT0x40, "Trigger Effect" },
1181 { 0, NULL((void*)0) }
1182};
1183
1184/* Server Commands Generated */
1185static const value_string zbee_zcl_identify_srv_tx_cmd_names[] = {
1186 { ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY_RSP0x00, "Identify Query Response" },
1187 { 0, NULL((void*)0) }
1188};
1189
1190/* Trigger Effects */
1191static const value_string zbee_zcl_identify_effect_id_names[] = {
1192 { 0x00, "Blink" },
1193 { 0x01, "Breathe" },
1194 { 0x02, "Okay" },
1195 { 0x0b, "Channel change" },
1196 { 0xfe, "Finish" },
1197 { 0xff, "Stop" },
1198 { 0, NULL((void*)0) }
1199};
1200
1201/*************************/
1202/* Function Bodies */
1203/*************************/
1204
1205/*FUNCTION:------------------------------------------------------
1206 * NAME
1207 * dissect_zbee_zcl_identify
1208 * DESCRIPTION
1209 * ZigBee ZCL Identify cluster dissector for wireshark.
1210 * PARAMETERS
1211 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1212 * packet_info *pinfo - pointer to packet information fields
1213 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1214 * void *data - pointer to ZCL packet structure.
1215 * RETURNS
1216 * int - length of parsed data.
1217 *---------------------------------------------------------------
1218 */
1219static int
1220dissect_zbee_zcl_identify(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1221{
1222 proto_tree *payload_tree;
1223 zbee_zcl_packet *zcl;
1224 unsigned offset = 0;
1225 uint8_t cmd_id;
1226 int rem_len;
1227
1228 /* Reject the packet if data is NULL */
1229 if (data == NULL((void*)0))
1230 return 0;
1231 zcl = (zbee_zcl_packet *)data;
1232 cmd_id = zcl->cmd_id;
1233
1234 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
1235 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER0x00) {
1236 /* Append the command name to the info column. */
1237 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
1238 val_to_str_const(cmd_id, zbee_zcl_identify_srv_rx_cmd_names, "Unknown Command"),
1239 zcl->tran_seqno);
1240
1241 /* Add the command ID. */
1242 proto_tree_add_item(tree, hf_zbee_zcl_identify_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1243
1244 /* Check is this command has a payload, than add the payload tree */
1245 rem_len = tvb_reported_length_remaining(tvb, ++offset);
1246 if (rem_len > 0) {
1247 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_identify, NULL((void*)0), "Payload");
1248
1249 /* Call the appropriate command dissector */
1250 switch (cmd_id) {
1251 case ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY0x00:
1252 dissect_zcl_identify_identify(tvb, payload_tree, &offset);
1253 break;
1254
1255 case ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY0x01:
1256 /* without payload*/
1257 break;
1258
1259 case ZBEE_ZCL_CMD_ID_IDENTIFY_TRIGGER_EFFECT0x40:
1260 dissect_zcl_identify_triggereffect(tvb, payload_tree, &offset);
1261 break;
1262
1263 default:
1264 break;
1265 }
1266 }
1267 }
1268 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
1269 /* Append the command name to the info column. */
1270 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
1271 val_to_str_const(cmd_id, zbee_zcl_identify_srv_tx_cmd_names, "Unknown Command"),
1272 zcl->tran_seqno);
1273
1274 /* Add the command ID. */
1275 proto_tree_add_item(tree, hf_zbee_zcl_identify_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1276
1277 /* Check is this command has a payload, than add the payload tree */
1278 rem_len = tvb_reported_length_remaining(tvb, ++offset);
1279 if (rem_len > 0) {
1280 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_identify, NULL((void*)0), "Payload");
1281
1282 /* Call the appropriate command dissector */
1283 switch (cmd_id) {
1284 case ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY_RSP0x00:
1285 dissect_zcl_identify_identifyqueryrsp(tvb, payload_tree, &offset);
1286 break;
1287
1288 default:
1289 break;
1290 }
1291 }
1292 }
1293
1294 return tvb_captured_length(tvb);
1295} /*dissect_zbee_zcl_identify*/
1296
1297
1298 /*FUNCTION:------------------------------------------------------
1299 * NAME
1300 * dissect_zcl_identify_identify
1301 * DESCRIPTION
1302 * this function decodes the Identify payload.
1303 * PARAMETERS
1304 * tvb - the tv buffer of the current data_type
1305 * tree - the tree to append this item to
1306 * offset - offset of data in tvb
1307 * RETURNS
1308 * none
1309 *---------------------------------------------------------------
1310 */
1311static void
1312dissect_zcl_identify_identify(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1313{
1314 /* Retrieve "Identify Time" field */
1315 proto_tree_add_item(tree, hf_zbee_zcl_identify_identify_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1316 *offset += 2;
1317
1318} /*dissect_zcl_identify_identify*/
1319
1320
1321 /*FUNCTION:------------------------------------------------------
1322 * NAME
1323 * dissect_zcl_identify_identifyqueryrsp
1324 * DESCRIPTION
1325 * this function decodes the IdentifyQueryResponse payload.
1326 * PARAMETERS
1327 * tvb - the tv buffer of the current data_type
1328 * tree - the tree to append this item to
1329 * offset - offset of data in tvb
1330 * RETURNS
1331 * none
1332 *---------------------------------------------------------------
1333 */
1334static void
1335dissect_zcl_identify_identifyqueryrsp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1336{
1337 /* Retrieve "Identify Timeout" field */
1338 proto_tree_add_item(tree, hf_zbee_zcl_identify_identify_timeout, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1339 *offset += 2;
1340
1341} /*dissect_zcl_identify_identifyqueryrsp*/
1342
1343 /*FUNCTION:------------------------------------------------------
1344 * NAME
1345 * dissect_zcl_identify_triggereffect
1346 * DESCRIPTION
1347 * this function decodes the Trigger Effect payload.
1348 * PARAMETERS
1349 * tvb - the tv buffer of the current data_type
1350 * tree - the tree to append this item to
1351 * offset - offset of data in tvb
1352 * RETURNS
1353 * none
1354 *---------------------------------------------------------------
1355 */
1356static void
1357dissect_zcl_identify_triggereffect(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1358{
1359 /* Retrieve "Trigger Effect Id" field */
1360 proto_tree_add_item(tree, hf_zbee_zcl_identify_effect_id, tvb, *offset, 1, ENC_NA0x00000000);
1361 *offset += 1;
1362
1363 /* Retrieve "Trigger Effect Variant" field */
1364 proto_tree_add_item(tree, hf_zbee_zcl_identify_effect_variant, tvb, *offset, 1, ENC_NA0x00000000);
1365 *offset += 1;
1366
1367} /*dissect_zcl_identify_triggereffect*/
1368
1369
1370/*FUNCTION:------------------------------------------------------
1371 * NAME
1372 * dissect_zcl_identify_attr_data
1373 * DESCRIPTION
1374 * this function is called by ZCL foundation dissector in order to decode
1375 * specific cluster attributes data.
1376 * PARAMETERS
1377 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1378 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1379 * unsigned *offset - pointer to buffer offset
1380 * uint16_t attr_id - attribute identifier
1381 * unsigned data_type - attribute data type
1382 * bool client_attr- ZCL client
1383 * RETURNS
1384 * none
1385 *---------------------------------------------------------------
1386 */
1387void
1388dissect_zcl_identify_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
1389{
1390 /* Dissect attribute data type and data */
1391 switch ( attr_id ) {
1392
1393 case ZBEE_ZCL_ATTR_ID_IDENTIFY_IDENTIFY_TIME0x0000:
1394 proto_tree_add_item(tree, hf_zbee_zcl_identify_identify_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1395 *offset += 2;
1396 break;
1397
1398 default:
1399 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
1400 break;
1401 }
1402
1403} /*dissect_zcl_identify_attr_data*/
1404
1405
1406/*FUNCTION:------------------------------------------------------
1407 * NAME
1408 * proto_register_zbee_zcl_identify
1409 * DESCRIPTION
1410 * ZigBee ZCL Identify cluster protocol registration routine.
1411 * PARAMETERS
1412 * none
1413 * RETURNS
1414 * void
1415 *---------------------------------------------------------------
1416 */
1417void
1418proto_register_zbee_zcl_identify(void)
1419{
1420 /* Setup list of header fields */
1421 static hf_register_info hf[] = {
1422
1423 { &hf_zbee_zcl_identify_attr_id,
1424 { "Attribute", "zbee_zcl_general.identify.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_identify_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_identify_attr_names
))))
,
1425 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1426
1427 { &hf_zbee_zcl_identify_identify_time,
1428 { "Identify Time", "zbee_zcl_general.identify.attr.identify_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_seconds)((const void *) (size_t) (decode_zcl_time_in_seconds)),
1429 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1430
1431 { &hf_zbee_zcl_identify_identify_timeout,
1432 { "Identify Timeout", "zbee_zcl_general.identify.identify_timeout", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_seconds)((const void *) (size_t) (decode_zcl_time_in_seconds)),
1433 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1434
1435 { &hf_zbee_zcl_identify_effect_id,
1436 { "Effect", "zbee_zcl_general.identify.effect_id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_identify_effect_id_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_identify_effect_id_names
))))
,
1437 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1438
1439 { &hf_zbee_zcl_identify_effect_variant,
1440 { "Variant", "zbee_zcl_general.identify.effect_variant", FT_UINT8, BASE_DEC, NULL((void*)0),
1441 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1442
1443 { &hf_zbee_zcl_identify_srv_rx_cmd_id,
1444 { "Command", "zbee_zcl_general.identify.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_identify_srv_rx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_identify_srv_rx_cmd_names
))))
,
1445 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
1446
1447 { &hf_zbee_zcl_identify_srv_tx_cmd_id,
1448 { "Command", "zbee_zcl_general.identify.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_identify_srv_tx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_identify_srv_tx_cmd_names
))))
,
1449 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
1450
1451 };
1452
1453 /* ZCL Identify subtrees */
1454 static int *ett[] = {
1455 &ett_zbee_zcl_identify
1456 };
1457
1458 /* Register the ZigBee ZCL Identify cluster protocol name and description */
1459 proto_zbee_zcl_identify = proto_register_protocol("ZigBee ZCL Identify", "ZCL Identify", ZBEE_PROTOABBREV_ZCL_IDENTIFY"zbee_zcl_general.identify");
1460 proto_register_field_array(proto_zbee_zcl_identify, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
1461 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
1462
1463 /* Register the ZigBee ZCL Identify dissector. */
1464 register_dissector(ZBEE_PROTOABBREV_ZCL_IDENTIFY"zbee_zcl_general.identify", dissect_zbee_zcl_identify, proto_zbee_zcl_identify);
1465
1466} /*proto_register_zbee_zcl_identify*/
1467
1468
1469/*FUNCTION:------------------------------------------------------
1470 * NAME
1471 * proto_reg_handoff_zbee_zcl_identify
1472 * DESCRIPTION
1473 * Hands off the ZCL Identify dissector.
1474 * PARAMETERS
1475 * none
1476 * RETURNS
1477 * none
1478 *---------------------------------------------------------------
1479 */
1480void
1481proto_reg_handoff_zbee_zcl_identify(void)
1482{
1483 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_IDENTIFY"zbee_zcl_general.identify",
1484 proto_zbee_zcl_identify,
1485 ett_zbee_zcl_identify,
1486 ZBEE_ZCL_CID_IDENTIFY0x0003,
1487 ZBEE_MFG_CODE_NONE0x0000,
1488 hf_zbee_zcl_identify_attr_id,
1489 hf_zbee_zcl_identify_attr_id,
1490 hf_zbee_zcl_identify_srv_rx_cmd_id,
1491 hf_zbee_zcl_identify_srv_tx_cmd_id,
1492 (zbee_zcl_fn_attr_data)dissect_zcl_identify_attr_data
1493 );
1494} /*proto_reg_handoff_zbee_zcl_identify*/
1495
1496
1497/* ########################################################################## */
1498/* #### (0x0004) GROUPS CLUSTER ############################################# */
1499/* ########################################################################## */
1500
1501/*************************/
1502/* Defines */
1503/*************************/
1504
1505#define ZBEE_ZCL_CMD_ID_GROUPS_NAME_SUPPORT_MASK0x80 0x80 /*Name support Mask*/
1506/* Attributes */
1507#define ZBEE_ZCL_ATTR_ID_GROUPS_NAME_SUPPORT0x0000 0x0000 /* Groups Name Support*/
1508
1509/* Server Commands Received */
1510#define ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP0x00 0x00 /* Add Group */
1511#define ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP0x01 0x01 /* View Group */
1512#define ZBEE_ZCL_CMD_ID_GROUPS_ADD_GET_GROUP_MEMBERSHIP0x02 0x02 /* Get Group Membership */
1513#define ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP0x03 0x03 /* Remove a Group */
1514#define ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_ALL_GROUPS0x04 0x04 /* Remove all Groups */
1515#define ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_IF_IDENTIFYING0x05 0x05 /* Add Group if Identifying */
1516
1517
1518/* Server Commands Generated */
1519#define ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_RESPONSE0x00 0x00 /* Add Group Response */
1520#define ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP_RESPONSE0x01 0x01 /* View Group Response */
1521#define ZBEE_ZCL_CMD_ID_GROUPS_GET_GROUP_MEMBERSHIP_RESPONSE0x02 0x02 /* Get Group Membership Response */
1522#define ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP_RESPONSE0x03 0x03 /* Remove a Group Response */
1523
1524/*************************/
1525/* Function Declarations */
1526/*************************/
1527
1528void proto_register_zbee_zcl_groups(void);
1529void proto_reg_handoff_zbee_zcl_groups(void);
1530
1531/* Command Dissector Helpers */
1532static void dissect_zcl_groups_add_group_or_if_identifying (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1533static void dissect_zcl_groups_view_group (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1534static void dissect_zcl_groups_get_group_membership (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1535static void dissect_zcl_groups_remove_group (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1536static void dissect_zcl_groups_add_remove_group_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1537static void dissect_zcl_groups_view_group_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1538static void dissect_zcl_groups_get_group_membership_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
1539
1540static void dissect_zcl_groups_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
1541
1542/* Private functions prototype */
1543
1544/*************************/
1545/* Global Variables */
1546/*************************/
1547/* Initialize the protocol and registered fields */
1548static int proto_zbee_zcl_groups;
1549
1550static int hf_zbee_zcl_groups_attr_id;
1551static int hf_zbee_zcl_groups_group_name_support;
1552static int hf_zbee_zcl_groups_group_id;
1553static int hf_zbee_zcl_groups_group_count;
1554static int hf_zbee_zcl_groups_group_capacity;
1555static int hf_zbee_zcl_groups_status;
1556static int hf_zbee_zcl_groups_attr_str_len;
1557static int hf_zbee_zcl_groups_attr_str;
1558static int hf_zbee_zcl_groups_srv_rx_cmd_id;
1559static int hf_zbee_zcl_groups_srv_tx_cmd_id;
1560static int hf_zbee_zcl_groups_group_list;
1561
1562/* Initialize the subtree pointers */
1563static int ett_zbee_zcl_groups;
1564static int ett_zbee_zcl_groups_grp_ctrl;
1565
1566/* Attributes */
1567static const value_string zbee_zcl_groups_attr_names[] = {
1568 { ZBEE_ZCL_ATTR_ID_GROUPS_NAME_SUPPORT0x0000, "Groups Name Support" },
1569 { 0, NULL((void*)0) }
1570};
1571
1572/* Server Commands Received */
1573static const value_string zbee_zcl_groups_srv_rx_cmd_names[] = {
1574 { ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP0x00, "Add Group" },
1575 { ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP0x01, "View Group" },
1576 { ZBEE_ZCL_CMD_ID_GROUPS_ADD_GET_GROUP_MEMBERSHIP0x02, "Get Group Membership" },
1577 { ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP0x03, "Remove a Group" },
1578 { ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_ALL_GROUPS0x04, "Remove all Groups" },
1579 { ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_IF_IDENTIFYING0x05, "Add Group if Identifying" },
1580 { 0, NULL((void*)0) }
1581};
1582
1583/* Server Commands Generated */
1584static const value_string zbee_zcl_groups_srv_tx_cmd_names[] = {
1585 { ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_RESPONSE0x00, "Add Group Response" },
1586 { ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP_RESPONSE0x01, "View Group Response" },
1587 { ZBEE_ZCL_CMD_ID_GROUPS_GET_GROUP_MEMBERSHIP_RESPONSE0x02, "Get Group Membership Response" },
1588 { ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP_RESPONSE0x03, "Remove a Group Response" },
1589 { 0, NULL((void*)0) }
1590};
1591
1592
1593/*************************/
1594/* Function Bodies */
1595/*************************/
1596
1597/*FUNCTION:------------------------------------------------------
1598 * NAME
1599 * dissect_zbee_zcl_groups
1600 * DESCRIPTION
1601 * ZigBee ZCL Groups cluster dissector for wireshark.
1602 * PARAMETERS
1603 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1604 * packet_info *pinfo - pointer to packet information fields
1605 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1606 * RETURNS
1607 * none
1608 *---------------------------------------------------------------
1609 */
1610static int
1611dissect_zbee_zcl_groups(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1612{
1613 proto_tree *payload_tree;
1614 zbee_zcl_packet *zcl;
1615 unsigned offset = 0;
1616 uint8_t cmd_id;
1617 int rem_len;
1618
1619 /* Reject the packet if data is NULL */
1620 if (data == NULL((void*)0))
1621 return 0;
1622 zcl = (zbee_zcl_packet *)data;
1623 cmd_id = zcl->cmd_id;
1624
1625 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
1626 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER0x00) {
1627 /* Append the command name to the info column. */
1628 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
1629 val_to_str_const(cmd_id, zbee_zcl_groups_srv_rx_cmd_names, "Unknown Command"),
1630 zcl->tran_seqno);
1631
1632 /* Add the command ID. */
1633 proto_tree_add_item(tree, hf_zbee_zcl_groups_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1634
1635 /* Check if this command has a payload, then add the payload tree */
1636 rem_len = tvb_reported_length_remaining(tvb, ++offset);
1637 if (rem_len > 0) {
1638 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_groups, NULL((void*)0), "Payload");
1639
1640 /* Call the appropriate command dissector */
1641 switch (cmd_id) {
1642 case ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP0x00:
1643 dissect_zcl_groups_add_group_or_if_identifying(tvb, payload_tree, &offset);
1644 break;
1645
1646 case ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP0x01:
1647 dissect_zcl_groups_view_group(tvb, payload_tree, &offset);
1648 break;
1649
1650 case ZBEE_ZCL_CMD_ID_GROUPS_ADD_GET_GROUP_MEMBERSHIP0x02:
1651 dissect_zcl_groups_get_group_membership(tvb, payload_tree, &offset);
1652 break;
1653
1654 case ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP0x03:
1655 dissect_zcl_groups_remove_group(tvb, payload_tree, &offset);
1656 break;
1657
1658 case ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_ALL_GROUPS0x04:
1659 /* without payload*/
1660 break;
1661
1662 case ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_IF_IDENTIFYING0x05:
1663 dissect_zcl_groups_add_group_or_if_identifying(tvb, payload_tree, &offset);
1664 break;
1665
1666 default:
1667 break;
1668 }
1669 }
1670 }
1671 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
1672 /* Append the command name to the info column. */
1673 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
1674 val_to_str_const(cmd_id, zbee_zcl_groups_srv_tx_cmd_names, "Unknown Command"),
1675 zcl->tran_seqno);
1676
1677 /* Add the command ID. */
1678 proto_tree_add_item(tree, hf_zbee_zcl_groups_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1679
1680 /* Check if this command has a payload, then add the payload tree */
1681 rem_len = tvb_reported_length_remaining(tvb, ++offset);
1682 if (rem_len > 0) {
1683 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_groups, NULL((void*)0), "Payload");
1684
1685 /* Call the appropriate command dissector */
1686 switch (cmd_id) {
1687 case ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_RESPONSE0x00:
1688 dissect_zcl_groups_add_remove_group_response(tvb, payload_tree, &offset);
1689 break;
1690
1691 case ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP_RESPONSE0x01:
1692 dissect_zcl_groups_view_group_response(tvb, payload_tree, &offset);
1693 break;
1694
1695 case ZBEE_ZCL_CMD_ID_GROUPS_GET_GROUP_MEMBERSHIP_RESPONSE0x02:
1696 dissect_zcl_groups_get_group_membership_response(tvb, payload_tree, &offset);
1697 break;
1698
1699 case ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP_RESPONSE0x03:
1700 dissect_zcl_groups_add_remove_group_response(tvb, payload_tree, &offset);
1701 break;
1702
1703 default:
1704 break;
1705 }
1706 }
1707 }
1708
1709 return tvb_captured_length(tvb);
1710} /*dissect_zbee_zcl_groups*/
1711
1712
1713 /*FUNCTION:------------------------------------------------------
1714 * NAME
1715 * dissect_zcl_groups_add_group_or_if_identifying
1716 * DESCRIPTION
1717 * this function decodes the Add Group or Add Group If
1718 * Identifying payload.
1719 * PARAMETERS
1720 * tvb - the tv buffer of the current data_type
1721 * tree - the tree to append this item to
1722 * offset - offset of data in tvb
1723 * RETURNS
1724 * none
1725 *---------------------------------------------------------------
1726 */
1727static void
1728dissect_zcl_groups_add_group_or_if_identifying(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1729{
1730 unsigned attr_uint;
1731 uint8_t *attr_string;
1732
1733 /* Retrieve "Group ID" field */
1734 proto_tree_add_item(tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1735 *offset += 2;
1736
1737 /* Retrieve "Group Name" field */
1738 attr_uint = tvb_get_uint8(tvb, *offset); /* string length */
1739 if (attr_uint == 0xff) attr_uint = 0;
1740
1741 proto_tree_add_uint(tree, hf_zbee_zcl_groups_attr_str_len, tvb, *offset, 1, attr_uint);
1742
1743 *offset += 1;
1744
1745 attr_string = tvb_get_string_enc(wmem_packet_scope(), tvb, *offset, attr_uint, ENC_ASCII0x00000000);
1746
1747 proto_item_append_text(tree, ", String: %s", attr_string);
1748 proto_tree_add_string(tree, hf_zbee_zcl_groups_attr_str, tvb, *offset, attr_uint, attr_string);
1749
1750 *offset += attr_uint;
1751
1752} /*dissect_zcl_groups_add_group*/
1753
1754
1755 /*FUNCTION:------------------------------------------------------
1756 * NAME
1757 * dissect_zcl_groups_view_group
1758 * DESCRIPTION
1759 * this function decodes the View Group payload.
1760 * PARAMETERS
1761 * tvb - the tv buffer of the current data_type
1762 * tree - the tree to append this item to
1763 * offset - offset of data in tvb
1764 * RETURNS
1765 * none
1766 *---------------------------------------------------------------
1767 */
1768static void
1769dissect_zcl_groups_view_group(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1770{
1771 /* Retrieve "Groups Timeout" field */
1772 proto_tree_add_item(tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1773 *offset += 2;
1774
1775} /*dissect_zcl_groups_view_group*/
1776
1777
1778/*FUNCTION:------------------------------------------------------
1779* NAME
1780* dissect_zcl_groups_get_group_membership
1781* DESCRIPTION
1782* this function decodes the Get Group Membership payload.
1783* PARAMETERS
1784* tvb - the tv buffer of the current data_type
1785* tree - the tree to append this item to
1786* offset - offset of data in tvb
1787* RETURNS
1788* none
1789*---------------------------------------------------------------
1790*/
1791static void
1792dissect_zcl_groups_get_group_membership(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1793{
1794 proto_item *grp_list;
1795 proto_tree *grp_list_tree;
1796 uint8_t count, i;
1797 /* Retrieve "Group Count" field */
1798 count = tvb_get_uint8(tvb, *offset);
1799 proto_tree_add_uint(tree, hf_zbee_zcl_groups_group_count, tvb, *offset, 1, count);
1800 *offset += 1;
1801
1802 if(count > 0)
1803 {
1804 grp_list = proto_tree_add_item(tree, hf_zbee_zcl_groups_group_list, tvb, *offset, 2*count, ENC_NA0x00000000);
1805 grp_list_tree = proto_item_add_subtree(grp_list, ett_zbee_zcl_groups_grp_ctrl);
1806 /* Retrieve "Group List" members */
1807 for( i = 0; i < count; i++)
1808 {
1809 proto_tree_add_item(grp_list_tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1810 *offset += 2;
1811 }
1812 }
1813
1814} /*dissect_zcl_groups_get_group_membership*/
1815
1816
1817/*FUNCTION:------------------------------------------------------
1818* NAME
1819* dissect_zcl_groups_remove_group
1820* DESCRIPTION
1821* this function decodes the Remove Group payload.
1822* PARAMETERS
1823* tvb - the tv buffer of the current data_type
1824* tree - the tree to append this item to
1825* offset - offset of data in tvb
1826* RETURNS
1827* none
1828*---------------------------------------------------------------
1829*/
1830static void
1831dissect_zcl_groups_remove_group(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1832{
1833 /* Retrieve "Groups ID" field */
1834 proto_tree_add_item(tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1835 *offset += 2;
1836
1837} /*dissect_zcl_groups_remove_group*/
1838
1839
1840/*FUNCTION:------------------------------------------------------
1841* NAME
1842* dissect_zcl_groups_add_group_response
1843* DESCRIPTION
1844* this function decodes the Add Group Response payload.
1845* PARAMETERS
1846* tvb - the tv buffer of the current data_type
1847* tree - the tree to append this item to
1848* offset - offset of data in tvb
1849* RETURNS
1850* none
1851*---------------------------------------------------------------
1852*/
1853static void
1854dissect_zcl_groups_add_remove_group_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1855{
1856 /* Retrieve "Status" field */
1857 proto_tree_add_item(tree, hf_zbee_zcl_groups_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1858 *offset += 1;
1859
1860 /* Retrieve "Groups ID" field */
1861 proto_tree_add_item(tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1862 *offset += 2;
1863
1864} /*dissect_zcl_groups_remove_group*/
1865
1866
1867/*FUNCTION:------------------------------------------------------
1868* NAME
1869* dissect_zcl_groups_view_group_response
1870* DESCRIPTION
1871* this function decodes the View Group Response payload
1872* PARAMETERS
1873* tvb - the tv buffer of the current data_type
1874* tree - the tree to append this item to
1875* offset - offset of data in tvb
1876* RETURNS
1877* none
1878*---------------------------------------------------------------
1879*/
1880static void
1881dissect_zcl_groups_view_group_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1882{
1883 unsigned attr_uint;
1884 uint8_t *attr_string;
1885 /* Retrieve "Status" field */
1886 proto_tree_add_item(tree, hf_zbee_zcl_groups_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1887 *offset += 1;
1888
1889 /* Retrieve "Group ID" field */
1890 proto_tree_add_item(tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1891 *offset += 2;
1892
1893 /* Retrieve "Group Name" field */
1894 attr_uint = tvb_get_uint8(tvb, *offset); /* string length */
1895 if (attr_uint == 0xff) attr_uint = 0;
1896
1897 proto_tree_add_uint(tree, hf_zbee_zcl_groups_attr_str_len, tvb, *offset, 1, attr_uint);
1898
1899 *offset += 1;
1900
1901 attr_string = tvb_get_string_enc(wmem_packet_scope(), tvb, *offset, attr_uint, ENC_ASCII0x00000000);
1902
1903 proto_item_append_text(tree, ", String: %s", attr_string);
1904 proto_tree_add_string(tree, hf_zbee_zcl_groups_attr_str, tvb, *offset, attr_uint, attr_string);
1905
1906 *offset += attr_uint;
1907} /*dissect_zcl_groups_add_group*/
1908
1909
1910/*FUNCTION:------------------------------------------------------
1911* NAME
1912* dissect_zcl_groups_get_group_membership_response
1913* DESCRIPTION
1914* this function decodes the Get Group Membership Response payload.
1915* PARAMETERS
1916* tvb - the tv buffer of the current data_type
1917* tree - the tree to append this item to
1918* offset - offset of data in tvb
1919* RETURNS
1920* none
1921*---------------------------------------------------------------
1922*/
1923static void
1924dissect_zcl_groups_get_group_membership_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1925{
1926 proto_item *grp_list;
1927 proto_tree *grp_list_tree;
1928 uint8_t count, i;
1929
1930 /* Retrieve "Capacity" field */
1931 proto_tree_add_item(tree, hf_zbee_zcl_groups_group_capacity, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1932 *offset += 1;
1933
1934 /* Retrieve "Group Count" field */
1935 count = tvb_get_uint8(tvb, *offset);
1936 proto_tree_add_uint(tree, hf_zbee_zcl_groups_group_count, tvb, *offset, 1, count);
1937 *offset += 1;
1938 if(count > 0)
1939 {
1940 grp_list = proto_tree_add_item(tree, hf_zbee_zcl_groups_group_list, tvb, *offset, 2*count, ENC_NA0x00000000);
1941 grp_list_tree = proto_item_add_subtree(grp_list, ett_zbee_zcl_groups_grp_ctrl);
1942 /* Retrieve "Group List" members */
1943 for( i = 0; i < count; i++)
1944 {
1945 proto_tree_add_item(grp_list_tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1946 *offset += 2;
1947 }
1948 }
1949
1950} /*dissect_zcl_groups_get_group_membership*/
1951
1952
1953/*FUNCTION:------------------------------------------------------
1954 * NAME
1955 * dissect_zcl_groups_attr_data
1956 * DESCRIPTION
1957 * this function is called by ZCL foundation dissector in order to decode
1958 * specific cluster attributes data.
1959 * PARAMETERS
1960 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1961 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1962 * unsigned *offset - pointer to buffer offset
1963 * uint16_t attr_id - attribute identifier
1964 * unsigned data_type - attribute data type
1965 * bool client_attr- ZCL client
1966 * RETURNS
1967 * none
1968 *---------------------------------------------------------------
1969 */
1970void
1971dissect_zcl_groups_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
1972{
1973 /* Dissect attribute data type and data */
1974 switch ( attr_id ) {
1975
1976 case ZBEE_ZCL_ATTR_ID_GROUPS_NAME_SUPPORT0x0000:
1977 proto_tree_add_item(tree, hf_zbee_zcl_groups_group_name_support, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1978 *offset += 1;
1979 break;
1980
1981 default:
1982 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
1983 break;
1984 }
1985
1986} /*dissect_zcl_groups_attr_data*/
1987
1988
1989/*FUNCTION:------------------------------------------------------
1990 * NAME
1991 * proto_register_zbee_zcl_groups
1992 * DESCRIPTION
1993 * ZigBee ZCL Groups cluster protocol registration routine.
1994 * PARAMETERS
1995 * none
1996 * RETURNS
1997 * void
1998 *---------------------------------------------------------------
1999 */
2000void
2001proto_register_zbee_zcl_groups(void)
2002{
2003 /* Setup list of header fields */
2004 static hf_register_info hf[] = {
2005
2006 { &hf_zbee_zcl_groups_attr_id,
2007 { "Attribute", "zbee_zcl_general.groups.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_groups_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_groups_attr_names
))))
,
2008 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
2009
2010 { &hf_zbee_zcl_groups_group_name_support,
2011 { "Group Name Support", "zbee_zcl_general.groups.attr.group_name_support", FT_BOOLEAN, 8, NULL((void*)0),
2012 ZBEE_ZCL_CMD_ID_GROUPS_NAME_SUPPORT_MASK0x80, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
2013
2014 { &hf_zbee_zcl_groups_group_id,
2015 { "Group ID", "zbee_zcl_general.groups.group_id", FT_UINT16, BASE_HEX, NULL((void*)0),
2016 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
2017
2018 { &hf_zbee_zcl_groups_group_list,
2019 {"Group List", "zbee_zcl_general.groups.group_list",FT_NONE,BASE_NONE, NULL((void*)0),
2020 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
2021
2022 { &hf_zbee_zcl_groups_group_count,
2023 { "Group Count", "zbee_zcl_general.groups.group_count", FT_UINT8, BASE_DEC, NULL((void*)0),
2024 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
2025
2026 { &hf_zbee_zcl_groups_group_capacity,
2027 { "Group Capacity", "zbee_zcl_general.groups.group_capacity", FT_UINT8, BASE_DEC, NULL((void*)0),
2028 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
2029
2030 { &hf_zbee_zcl_groups_status,
2031 { "Group Status", "zbee_zcl_general.groups.group_status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_status_names
))))
,
2032 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
2033
2034 { &hf_zbee_zcl_groups_attr_str_len,
2035 { "Length", "zbee_zcl_general.groups.attr_str_len", FT_UINT8, BASE_DEC, NULL((void*)0),
2036 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2037
2038 { &hf_zbee_zcl_groups_attr_str,
2039 { "String", "zbee_zcl_general.groups_attr_str", FT_STRING, BASE_NONE, NULL((void*)0),
2040 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2041
2042 { &hf_zbee_zcl_groups_srv_rx_cmd_id,
2043 { "Command", "zbee_zcl_general.groups.cmd_srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_groups_srv_rx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_groups_srv_rx_cmd_names
))))
,
2044 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
2045
2046 { &hf_zbee_zcl_groups_srv_tx_cmd_id,
2047 { "Command", "zbee_zcl_general.groups.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_groups_srv_tx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_groups_srv_tx_cmd_names
))))
,
2048 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
2049
2050 };
2051
2052 /* ZCL Groups subtrees */
2053 static int *ett[] = {
2054 &ett_zbee_zcl_groups,
2055 &ett_zbee_zcl_groups_grp_ctrl
2056 };
2057
2058 /* Register the ZigBee ZCL Groups cluster protocol name and description */
2059 proto_zbee_zcl_groups = proto_register_protocol("ZigBee ZCL Groups", "ZCL Groups", ZBEE_PROTOABBREV_ZCL_GROUPS"zbee_zcl_general.groups");
2060 proto_register_field_array(proto_zbee_zcl_groups, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
2061 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
2062
2063 /* Register the ZigBee ZCL Groups dissector. */
2064 register_dissector(ZBEE_PROTOABBREV_ZCL_GROUPS"zbee_zcl_general.groups", dissect_zbee_zcl_groups, proto_zbee_zcl_groups);
2065
2066} /*proto_register_zbee_zcl_groups*/
2067
2068
2069/*FUNCTION:------------------------------------------------------
2070 * NAME
2071 * proto_reg_handoff_zbee_zcl_groups
2072 * DESCRIPTION
2073 * Hands off the ZCL Groups dissector.
2074 * PARAMETERS
2075 * none
2076 * RETURNS
2077 * none
2078 *---------------------------------------------------------------
2079 */
2080void
2081proto_reg_handoff_zbee_zcl_groups(void)
2082{
2083 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_GROUPS"zbee_zcl_general.groups",
2084 proto_zbee_zcl_groups,
2085 ett_zbee_zcl_groups,
2086 ZBEE_ZCL_CID_GROUPS0x0004,
2087 ZBEE_MFG_CODE_NONE0x0000,
2088 hf_zbee_zcl_groups_attr_id,
2089 hf_zbee_zcl_groups_attr_id,
2090 hf_zbee_zcl_groups_srv_rx_cmd_id,
2091 hf_zbee_zcl_groups_srv_tx_cmd_id,
2092 (zbee_zcl_fn_attr_data)dissect_zcl_groups_attr_data
2093 );
2094} /*proto_reg_handoff_zbee_zcl_groups*/
2095
2096
2097/* ########################################################################## */
2098/* #### (0x0005) SCENES CLUSTER ############################################# */
2099/* ########################################################################## */
2100
2101/*************************/
2102/* Defines */
2103/*************************/
2104
2105#define ZBEE_ZCL_ATTR_SCENES_SCENE_VALID_MASK0x01 0x01 /* bit 0 */
2106
2107/* Attributes */
2108#define ZBEE_ZCL_ATTR_ID_SCENES_SCENE_COUNT0x0000 0x0000 /* Scene Count */
2109#define ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_SCENE0x0001 0x0001 /* Current Scene */
2110#define ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_GROUP0x0002 0x0002 /* Current Group */
2111#define ZBEE_ZCL_ATTR_ID_SCENES_SCENE_VALID0x0003 0x0003 /* Scene Valid */
2112#define ZBEE_ZCL_ATTR_ID_SCENES_NAME_SUPPORT0x0004 0x0004 /* Name Support */
2113#define ZBEE_ZCL_ATTR_ID_SCENES_LAST_CONFIGURED_BY0x0005 0x0005 /* Last Configured By */
2114
2115/* Scene Name Support */
2116#define ZBEE_ZCL_SCENES_NAME_NOT_SUPPORTED0x00 0x00 /* Scene Names Not Supported */
2117#define ZBEE_ZCL_SCENES_NAME_SUPPORTED0x01 0x01 /* Scene Names Supported */
2118
2119/* Copy Mode */
2120#define ZBEE_ZCL_SCENES_COPY_SPECIFIED0x00 0x00 /* Copy Specified Scenes */
2121#define ZBEE_ZCL_SCENES_COPY_ALL0x01 0x01 /* Copy All Scenes */
2122
2123/* Server Commands Received */
2124#define ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE0x00 0x00 /* Add Scene */
2125#define ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE0x01 0x01 /* View Scene */
2126#define ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE0x02 0x02 /* Remove a Scene */
2127#define ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES0x03 0x03 /* Remove all Scenes */
2128#define ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE0x04 0x04 /* Store Scene */
2129#define ZBEE_ZCL_CMD_ID_SCENES_RECALL_SCENE0x05 0x05 /* Recall Scene */
2130#define ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP0x06 0x06 /* Get Scene Membership */
2131#define ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE0x40 0x40 /* Enhanced Add Scene */
2132#define ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE0x41 0x41 /* Enhanced View Scene */
2133#define ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE0x42 0x42 /* Copy Scene */
2134#define ZBEE_ZCL_CMD_ID_SCENES_NAME_SUPPORT_MASK0x80 0x80
2135
2136/* Server Commands Generated */
2137#define ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE_RESPONSE0x00 0x00 /* Add Scene Response */
2138#define ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE_RESPONSE0x01 0x01 /* View Scene Response */
2139#define ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE_RESPONSE0x02 0x02 /* Remove a Scene Response */
2140#define ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES_RESPONSE0x03 0x03 /* Remove all Scenes Response */
2141#define ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE_RESPONSE0x04 0x04 /* Store Scene Response */
2142#define ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP_RESPONSE0x06 0x06 /* Get Scene Membership Response */
2143#define ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE_RESPONSE0x40 0x40 /* Enhanced Add Scene Response */
2144#define ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE_RESPONSE0x41 0x41 /* Enhanced View Scene Response */
2145#define ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE_RESPONSE0x42 0x42 /* Copy Scene Response */
2146
2147/* Enhanced */
2148#define IS_ENHANCED1 true1
2149#define IS_NOT_ENHANCED0 false0
2150
2151/*************************/
2152/* Function Declarations */
2153/*************************/
2154
2155void proto_register_zbee_zcl_scenes(void);
2156void proto_reg_handoff_zbee_zcl_scenes(void);
2157
2158/* Command Dissector Helpers */
2159static void dissect_zcl_scenes_add_scene (tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool_Bool enhanced);
2160static void dissect_zcl_scenes_view_remove_store_recall_scene (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
2161static void dissect_zcl_scenes_remove_all_get_scene_membership (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
2162static void dissect_zcl_scenes_copy_scene (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
2163static void dissect_zcl_scenes_add_remove_store_scene_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
2164static void dissect_zcl_scenes_view_scene_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool_Bool enhanced);
2165static void dissect_zcl_scenes_remove_all_scenes_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
2166static void dissect_zcl_scenes_get_scene_membership_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
2167static void dissect_zcl_scenes_copy_scene_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
2168
2169static void dissect_zcl_scenes_extension_fields (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
2170static void dissect_zcl_scenes_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
2171
2172/* Private functions prototype */
2173
2174/*************************/
2175/* Global Variables */
2176/*************************/
2177/* Initialize the protocol and registered fields */
2178static int proto_zbee_zcl_scenes;
2179
2180static int hf_zbee_zcl_scenes_attr_id;
2181static int hf_zbee_zcl_scenes_attr_id_scene_valid;
2182static int hf_zbee_zcl_scenes_attr_id_name_support;
2183static int hf_zbee_zcl_scenes_group_id;
2184static int hf_zbee_zcl_scenes_group_id_from;
2185static int hf_zbee_zcl_scenes_group_id_to;
2186static int hf_zbee_zcl_scenes_scene_id;
2187static int hf_zbee_zcl_scenes_scene_id_from;
2188static int hf_zbee_zcl_scenes_scene_id_to;
2189static int hf_zbee_zcl_scenes_transit_time;
2190static int hf_zbee_zcl_scenes_enh_transit_time;
2191static int hf_zbee_zcl_scenes_extension_set_cluster;
2192static int hf_zbee_zcl_scenes_extension_set_onoff;
2193static int hf_zbee_zcl_scenes_extension_set_level;
2194static int hf_zbee_zcl_scenes_extension_set_x;
2195static int hf_zbee_zcl_scenes_extension_set_y;
2196static int hf_zbee_zcl_scenes_extension_set_hue;
2197static int hf_zbee_zcl_scenes_extension_set_saturation;
2198static int hf_zbee_zcl_scenes_extension_set_color_loop_active;
2199static int hf_zbee_zcl_scenes_extension_set_color_loop_direction;
2200static int hf_zbee_zcl_scenes_extension_set_color_loop_time;
2201static int hf_zbee_zcl_scenes_extension_set_cooling_setpoint;
2202static int hf_zbee_zcl_scenes_extension_set_heating_setpoint;
2203static int hf_zbee_zcl_scenes_extension_set_system_mode;
2204static int hf_zbee_zcl_scenes_extension_set_lock_state;
2205static int hf_zbee_zcl_scenes_extension_set_lift_percentage;
2206static int hf_zbee_zcl_scenes_extension_set_tilt_percentage;
2207
2208static int hf_zbee_zcl_scenes_status;
2209static int hf_zbee_zcl_scenes_capacity;
2210static int hf_zbee_zcl_scenes_scene_count;
2211static int hf_zbee_zcl_scenes_attr_str_len;
2212static int hf_zbee_zcl_scenes_attr_str;
2213static int hf_zbee_zcl_scenes_srv_rx_cmd_id;
2214static int hf_zbee_zcl_scenes_srv_tx_cmd_id;
2215static int hf_zbee_zcl_scenes_scene_list;
2216static int hf_zbee_zcl_scenes_copy_mode;
2217
2218/* Initialize the subtree pointers */
2219static int ett_zbee_zcl_scenes;
2220static int ett_zbee_zcl_scenes_scene_ctrl;
2221static int ett_zbee_zcl_scenes_extension_field_set;
2222
2223/* Attributes */
2224static const value_string zbee_zcl_scenes_attr_names[] = {
2225 { ZBEE_ZCL_ATTR_ID_SCENES_SCENE_COUNT0x0000, "Scene Count" },
2226 { ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_SCENE0x0001, "Current Scene" },
2227 { ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_GROUP0x0002, "Current Group" },
2228 { ZBEE_ZCL_ATTR_ID_SCENES_SCENE_VALID0x0003, "Scene Valid" },
2229 { ZBEE_ZCL_ATTR_ID_SCENES_NAME_SUPPORT0x0004, "Name Support" },
2230 { ZBEE_ZCL_ATTR_ID_SCENES_LAST_CONFIGURED_BY0x0005, "Last Configured By" },
2231 { 0, NULL((void*)0) }
2232};
2233
2234/* Server Commands Received */
2235static const value_string zbee_zcl_scenes_srv_rx_cmd_names[] = {
2236 { ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE0x00, "Add Scene" },
2237 { ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE0x01, "View Scene" },
2238 { ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE0x02, "Remove a Scene" },
2239 { ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES0x03, "Remove all Scenes" },
2240 { ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE0x04, "Store Scene" },
2241 { ZBEE_ZCL_CMD_ID_SCENES_RECALL_SCENE0x05, "Recall Scene" },
2242 { ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP0x06, "Get Scene Membership" },
2243 { ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE0x40, "Enhanced Add Scene" },
2244 { ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE0x41, "Enhanced View Scene" },
2245 { ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE0x42, "Copy Scene" },
2246 { 0, NULL((void*)0) }
2247};
2248
2249/* Server Commands Generated */
2250static const value_string zbee_zcl_scenes_srv_tx_cmd_names[] = {
2251 { ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE_RESPONSE0x00, "Add Scene Response" },
2252 { ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE_RESPONSE0x01, "View Scene Response" },
2253 { ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE_RESPONSE0x02, "Remove a Scene Response" },
2254 { ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES_RESPONSE0x03, "Remove all Scene Response" },
2255 { ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE_RESPONSE0x04, "Store Scene Response" },
2256 { ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP_RESPONSE0x06, "Get Scene Membership Response" },
2257 { ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE_RESPONSE0x40, "Enhanced Add Scene Response" },
2258 { ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE_RESPONSE0x41, "Enhanced View Scene Response" },
2259 { ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE_RESPONSE0x42, "Copy Scene Response" },
2260 { 0, NULL((void*)0) }
2261};
2262
2263/* Scene Names Support Values */
2264static const value_string zbee_zcl_scenes_group_names_support_values[] = {
2265 { ZBEE_ZCL_SCENES_NAME_NOT_SUPPORTED0x00, "Scene names not supported" },
2266 { ZBEE_ZCL_SCENES_NAME_SUPPORTED0x01, "Scene names supported" },
2267 { 0, NULL((void*)0) }
2268};
2269
2270/* Scene Copy Mode Values */
2271static const value_string zbee_zcl_scenes_copy_mode_values[] = {
2272 { ZBEE_ZCL_SCENES_COPY_SPECIFIED0x00, "Copy Specified Scenes" },
2273 { ZBEE_ZCL_SCENES_COPY_ALL0x01, "Copy All Scenes" },
2274 { 0, NULL((void*)0) }
2275};
2276
2277/* Color Loop Directions */
2278static const value_string zbee_zcl_scenes_color_loop_direction_values[] = {
2279 { 0x00, "Hue is Decrementing" },
2280 { 0x01, "Hue is Incrementing" },
2281 { 0, NULL((void*)0) }
2282};
2283
2284
2285/*************************/
2286/* Function Bodies */
2287/*************************/
2288
2289/*FUNCTION:------------------------------------------------------
2290 * NAME
2291 * decode_color_xy
2292 * DESCRIPTION
2293 * this function decodes color xy values
2294 * PARAMETERS
2295 * unsigned *s - string to display
2296 * uint16_t value - value to decode
2297 * RETURNS
2298 * none
2299 *---------------------------------------------------------------
2300 */
2301static void
2302decode_color_xy(char *s, uint16_t value)
2303{
2304 snprintf(s, ITEM_LABEL_LENGTH240, "%.4lf", value/65535.0);
2305}
2306
2307/*FUNCTION:------------------------------------------------------
2308 * NAME
2309 * decode_setpoint
2310 * DESCRIPTION
2311 * this function decodes the setpoint
2312 * PARAMETERS
2313 * unsigned *s - string to display
2314 * uint16_t value - value to decode
2315 * RETURNS
2316 * none
2317 *---------------------------------------------------------------
2318 */
2319static void decode_setpoint(char *s, int16_t value)
2320{
2321 snprintf(s, ITEM_LABEL_LENGTH240, "%.2lf [" UTF8_DEGREE_SIGN"\u00b0" "C]", value/100.0);
2322}
2323
2324/*FUNCTION:------------------------------------------------------
2325 * NAME
2326 * dissect_zbee_zcl_scenes
2327 * DESCRIPTION
2328 * ZigBee ZCL Scenes cluster dissector for wireshark.
2329 * PARAMETERS
2330 * tvbuff_t *tvb - pointer to buffer containing raw packet.
2331 * packet_info *pinfo - pointer to packet information fields
2332 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
2333 * RETURNS
2334 * none
2335 *---------------------------------------------------------------
2336 */
2337static int
2338dissect_zbee_zcl_scenes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
2339{
2340 proto_tree *payload_tree;
2341 zbee_zcl_packet *zcl;
2342 unsigned offset = 0;
2343 uint8_t cmd_id;
2344 int rem_len;
2345
2346 /* Reject the packet if data is NULL */
2347 if (data == NULL((void*)0))
2348 return 0;
2349 zcl = (zbee_zcl_packet *)data;
2350 cmd_id = zcl->cmd_id;
2351
2352 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
2353 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER0x00) {
2354 /* Append the command name to the info column. */
2355 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
2356 val_to_str_const(cmd_id, zbee_zcl_scenes_srv_rx_cmd_names, "Unknown Command"),
2357 zcl->tran_seqno);
2358
2359 /* Add the command ID. */
2360 proto_tree_add_item(tree, hf_zbee_zcl_scenes_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
2361
2362 /* Check if this command has a payload, then add the payload tree */
2363 rem_len = tvb_reported_length_remaining(tvb, ++offset);
2364 if (rem_len > 0) {
2365 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_scenes, NULL((void*)0), "Payload");
2366
2367 /* Call the appropriate command dissector */
2368 switch (cmd_id) {
2369 case ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE0x00:
2370 dissect_zcl_scenes_add_scene(tvb, payload_tree, &offset, IS_NOT_ENHANCED0);
2371 break;
2372
2373 case ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE0x40:
2374 dissect_zcl_scenes_add_scene(tvb, payload_tree, &offset, IS_ENHANCED1);
2375 break;
2376
2377 case ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE0x01:
2378 case ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE0x02:
2379 case ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE0x04:
2380 case ZBEE_ZCL_CMD_ID_SCENES_RECALL_SCENE0x05:
2381 case ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE0x41:
2382 dissect_zcl_scenes_view_remove_store_recall_scene(tvb, payload_tree, &offset);
2383 break;
2384
2385 case ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES0x03:
2386 case ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP0x06:
2387 dissect_zcl_scenes_remove_all_get_scene_membership(tvb, payload_tree, &offset);
2388 break;
2389
2390 case ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE0x42:
2391 dissect_zcl_scenes_copy_scene(tvb, payload_tree, &offset);
2392 break;
2393
2394 default:
2395 break;
2396 }
2397 }
2398 }
2399 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
2400 /* Append the command name to the info column. */
2401 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
2402 val_to_str_const(cmd_id, zbee_zcl_scenes_srv_tx_cmd_names, "Unknown Command"),
2403 zcl->tran_seqno);
2404
2405 /* Add the command ID. */
2406 proto_tree_add_item(tree, hf_zbee_zcl_scenes_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
2407
2408 /* Check if this command has a payload, then add the payload tree */
2409 rem_len = tvb_reported_length_remaining(tvb, ++offset);
2410 if (rem_len > 0) {
2411 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_scenes, NULL((void*)0), "Payload");
2412
2413 /* Call the appropriate command dissector */
2414 switch (cmd_id) {
2415 case ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE_RESPONSE0x00:
2416 case ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE_RESPONSE0x02:
2417 case ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE_RESPONSE0x04:
2418 case ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE_RESPONSE0x40:
2419 dissect_zcl_scenes_add_remove_store_scene_response(tvb, payload_tree, &offset);
2420 break;
2421
2422 case ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE_RESPONSE0x01:
2423 dissect_zcl_scenes_view_scene_response(tvb, payload_tree, &offset, IS_NOT_ENHANCED0);
2424 break;
2425
2426 case ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE_RESPONSE0x41:
2427 dissect_zcl_scenes_view_scene_response(tvb, payload_tree, &offset, IS_ENHANCED1);
2428 break;
2429
2430 case ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES_RESPONSE0x03:
2431 dissect_zcl_scenes_remove_all_scenes_response(tvb, payload_tree, &offset);
2432 break;
2433
2434 case ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP_RESPONSE0x06:
2435 dissect_zcl_scenes_get_scene_membership_response(tvb, payload_tree, &offset);
2436 break;
2437
2438 case ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE_RESPONSE0x42:
2439 dissect_zcl_scenes_copy_scene_response(tvb, payload_tree, &offset);
2440 break;
2441
2442 default:
2443 break;
2444 }
2445 }
2446 }
2447
2448 return tvb_captured_length(tvb);
2449} /*dissect_zbee_zcl_scenes*/
2450
2451
2452 /*FUNCTION:------------------------------------------------------
2453 * NAME
2454 * dissect_zcl_scenes_add_scene
2455 * DESCRIPTION
2456 * this function decodes the Add Scene payload.
2457 * PARAMETERS
2458 * tvb - the tv buffer of the current data_type
2459 * tree - the tree to append this item to
2460 * offset - offset of data in tvb
2461 * enhanced - use enhanced transition time
2462 * RETURNS
2463 * none
2464 *---------------------------------------------------------------
2465 */
2466static void
2467dissect_zcl_scenes_add_scene(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool_Bool enhanced)
2468{
2469 unsigned attr_uint;
2470 uint8_t *attr_string;
2471
2472 /* Retrieve "Group ID" field */
2473 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2474 *offset += 2;
2475
2476 /* Retrieve "Scene ID" field */
2477 proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
2478 *offset += 1;
2479
2480 /* Retrieve "Transition Time" field */
2481 proto_tree_add_item(tree, enhanced ? hf_zbee_zcl_scenes_enh_transit_time : hf_zbee_zcl_scenes_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2482 *offset += 2;
2483
2484 /* Retrieve Scene Name */
2485 attr_uint = tvb_get_uint8(tvb, *offset); /* string length */
2486 if (attr_uint == 0xff) attr_uint = 0;
2487
2488 proto_tree_add_uint(tree, hf_zbee_zcl_scenes_attr_str_len, tvb, *offset, 1, attr_uint);
2489
2490 *offset += 1;
2491
2492 attr_string = tvb_get_string_enc(wmem_packet_scope(), tvb, *offset, attr_uint, ENC_ASCII0x00000000);
2493
2494 proto_item_append_text(tree, ", String: %s", attr_string);
2495 proto_tree_add_string(tree, hf_zbee_zcl_scenes_attr_str, tvb, *offset, attr_uint, attr_string);
2496
2497 *offset += attr_uint;
2498
2499 /* Retrieve "Extension Set" field */
2500 dissect_zcl_scenes_extension_fields(tvb, tree, offset);
2501
2502} /*dissect_zcl_scenes_add_scene*/
2503
2504
2505 /*FUNCTION:--------------------------------------------------------------------
2506 * NAME
2507 * dissect_zcl_scenes_view_remove_store_recall_scene
2508 * DESCRIPTION
2509 * this function decodes the View, Remove, Store and Recall Scene payload.
2510 * PARAMETERS
2511 * tvb - the tv buffer of the current data_type
2512 * tree - the tree to append this item to
2513 * offset - offset of data in tvb
2514 * RETURNS
2515 * none
2516 *------------------------------------------------------------------------------
2517 */
2518static void
2519dissect_zcl_scenes_view_remove_store_recall_scene(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2520{
2521 /* Retrieve "Group ID" field */
2522 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2523 *offset += 2;
2524
2525 /* Retrieve "Scene ID" field */
2526 proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
2527 *offset += 1;
2528
2529} /*dissect_zcl_scenes_view_remove_store_recall_scene*/
2530
2531
2532/*FUNCTION:-------------------------------------------------------------------
2533* NAME
2534* dissect_zcl_scenes_remove_all_get_scene_membership
2535* DESCRIPTION
2536* this function decodes the Remove all and Get Scene Membership payload.
2537* PARAMETERS
2538* tvb - the tv buffer of the current data_type
2539* tree - the tree to append this item to
2540* offset - offset of data in tvb
2541* RETURNS
2542* none
2543*-----------------------------------------------------------------------------
2544*/
2545static void
2546dissect_zcl_scenes_remove_all_get_scene_membership(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2547{
2548 /* Retrieve "Group ID" field */
2549 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2550 *offset += 2;
2551
2552} /*dissect_zcl_scenes_remove_all_get_scene_membership*/
2553
2554
2555/*FUNCTION:--------------------------------------------------------------------
2556 * NAME
2557 * dissect_zcl_scenes_copy_scene
2558 * DESCRIPTION
2559 * this function decodes the Copy Scene payload.
2560 * PARAMETERS
2561 * tvb - the tv buffer of the current data_type
2562 * tree - the tree to append this item to
2563 * offset - offset of data in tvb
2564 * RETURNS
2565 * none
2566 *------------------------------------------------------------------------------
2567 */
2568static void
2569dissect_zcl_scenes_copy_scene(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2570{
2571 /* Retrieve "Mode" field */
2572 proto_tree_add_item(tree, hf_zbee_zcl_scenes_copy_mode, tvb, *offset, 1, ENC_NA0x00000000);
2573 *offset += 1;
2574
2575 /* Retrieve "Group ID From" field */
2576 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id_from, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2577 *offset += 2;
2578
2579 /* Retrieve "Scene ID From" field */
2580 proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id_from, tvb, *offset, 1, ENC_NA0x00000000);
2581 *offset += 1;
2582
2583 /* Retrieve "Group ID To" field */
2584 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id_to, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2585 *offset += 2;
2586
2587 /* Retrieve "Scene ID To" field */
2588 proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id_to, tvb, *offset, 1, ENC_NA0x00000000);
2589 *offset += 1;
2590
2591} /*dissect_zcl_scenes_copy_scene*/
2592
2593
2594/*FUNCTION:------------------------------------------------------
2595* NAME
2596* dissect_zcl_scenes_add_remove_store_scene_response
2597* DESCRIPTION
2598* this function decodes the Add, Remove, Store Scene payload.
2599* PARAMETERS
2600* tvb - the tv buffer of the current data_type
2601* tree - the tree to append this item to
2602* offset - offset of data in tvb
2603* RETURNS
2604* none
2605*---------------------------------------------------------------
2606*/
2607static void
2608dissect_zcl_scenes_add_remove_store_scene_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2609{
2610 /* Retrieve "Status" field */
2611 proto_tree_add_item(tree, hf_zbee_zcl_scenes_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
2612 *offset += 1;
2613
2614 /* Retrieve "Group ID" field */
2615 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2616 *offset += 2;
2617
2618 /* Retrieve "Scene ID" field */
2619 proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
2620 *offset += 1;
2621
2622} /*dissect_zcl_scenes_add_remove_store_scene_response*/
2623
2624
2625/*FUNCTION:------------------------------------------------------
2626* NAME
2627* dissect_zcl_scenes_view_scene_response
2628* DESCRIPTION
2629* this function decodes the View Scene Response payload.
2630* PARAMETERS
2631* tvb - the tv buffer of the current data_type
2632* tree - the tree to append this item to
2633* offset - offset of data in tvb
2634* enhanced - use enhanced transition time
2635* RETURNS
2636* none
2637*---------------------------------------------------------------
2638*/
2639static void
2640dissect_zcl_scenes_view_scene_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool_Bool enhanced)
2641{
2642 uint8_t status, *attr_string;
2643 unsigned attr_uint;
2644
2645 /* Retrieve "Status" field */
2646 status = tvb_get_uint8(tvb, *offset);
2647 proto_tree_add_item(tree, hf_zbee_zcl_scenes_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
2648 *offset += 1;
2649
2650 /* Retrieve "Group ID" field */
2651 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2652 *offset += 2;
2653
2654 /* Retrieve "Scene ID" field */
2655 proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
2656 *offset += 1;
2657
2658 if(status == ZBEE_ZCL_STAT_SUCCESS0x00)
2659 {
2660 /* Retrieve "Transition Time" field */
2661 proto_tree_add_item(tree, enhanced ? hf_zbee_zcl_scenes_enh_transit_time : hf_zbee_zcl_scenes_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2662 *offset += 2;
2663
2664 /* Retrieve Scene Name */
2665 attr_uint = tvb_get_uint8(tvb, *offset); /* string length */
2666 if (attr_uint == 0xff) attr_uint = 0;
2667
2668 proto_tree_add_uint(tree, hf_zbee_zcl_scenes_attr_str_len, tvb, *offset, 1, attr_uint);
2669
2670 *offset += 1;
2671
2672 attr_string = tvb_get_string_enc(wmem_packet_scope(), tvb, *offset, attr_uint, ENC_ASCII0x00000000);
2673
2674 proto_item_append_text(tree, ", String: %s", attr_string);
2675 proto_tree_add_string(tree, hf_zbee_zcl_scenes_attr_str, tvb, *offset, attr_uint, attr_string);
2676
2677 *offset += attr_uint;
2678
2679 /* Retrieve "Extension Set" field */
2680 dissect_zcl_scenes_extension_fields(tvb, tree, offset);
2681
2682 }
2683
2684} /*dissect_zcl_scenes_view_scene_response*/
2685
2686
2687/*FUNCTION:------------------------------------------------------
2688* NAME
2689* dissect_zcl_scenes_remove_all_scenes_response
2690* DESCRIPTION
2691* this function decodes the Remove All Scenes Response payload
2692* PARAMETERS
2693* tvb - the tv buffer of the current data_type
2694* tree - the tree to append this item to
2695* offset - offset of data in tvb
2696* RETURNS
2697* none
2698*---------------------------------------------------------------
2699*/
2700static void
2701dissect_zcl_scenes_remove_all_scenes_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2702{
2703 /* Retrieve "Status" field */
2704 proto_tree_add_item(tree, hf_zbee_zcl_scenes_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
2705 *offset += 1;
2706
2707 /* Retrieve "Group ID" field */
2708 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2709 *offset += 2;
2710
2711} /*dissect_zcl_scenes_remove_all_scenes_response*/
2712
2713
2714/*FUNCTION:------------------------------------------------------
2715* NAME
2716* dissect_zcl_scenes_get_scene_membership_response
2717* DESCRIPTION
2718* this function decodes the Get Scene Membership Response payload.
2719* PARAMETERS
2720* tvb - the tv buffer of the current data_type
2721* tree - the tree to append this item to
2722* offset - offset of data in tvb
2723* RETURNS
2724* none
2725*---------------------------------------------------------------
2726*/
2727static void
2728dissect_zcl_scenes_get_scene_membership_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2729{
2730 proto_item *scene_list;
2731 proto_tree *scene_list_tree;
2732 uint8_t status, count, i;
2733
2734 /* Retrieve "Status" field */
2735 status = tvb_get_uint8(tvb, *offset);
2736 proto_tree_add_item(tree, hf_zbee_zcl_scenes_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
2737 *offset += 1;
2738
2739 /* Retrieve "Capacity" field */
2740 proto_tree_add_item(tree, hf_zbee_zcl_scenes_capacity, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
2741 *offset += 1;
2742
2743 /* Retrieve "Group ID" field */
2744 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2745 *offset += 2;
2746
2747 if(status == ZBEE_ZCL_STAT_SUCCESS0x00)
2748 {
2749 /* Retrieve "Scene Count" field */
2750 count = tvb_get_uint8(tvb, *offset);
2751 proto_tree_add_uint(tree, hf_zbee_zcl_scenes_scene_count, tvb, *offset, 1, count);
2752 *offset += 1;
2753
2754 if(count>0)
2755 {
2756 scene_list=proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_list, tvb, *offset, count, ENC_NA0x00000000);
2757 scene_list_tree = proto_item_add_subtree(scene_list, ett_zbee_zcl_scenes_scene_ctrl);
2758 /* Retrieve "Scene List" */
2759 for( i = 0; i < count; i++)
2760 {
2761 proto_tree_add_item(scene_list_tree, hf_zbee_zcl_scenes_scene_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
2762 *offset += 1;
2763 }
2764 }
2765 }
2766
2767} /*dissect_zcl_scenes_get_scene_membership_response*/
2768
2769
2770/*FUNCTION:------------------------------------------------------
2771 * NAME
2772 * dissect_zcl_scenes_copy_scene_response
2773 * DESCRIPTION
2774 * this function decodes the Copy Scene payload.
2775 * PARAMETERS
2776 * tvb - the tv buffer of the current data_type
2777 * tree - the tree to append this item to
2778 * offset - offset of data in tvb
2779 * RETURNS
2780 * none
2781 *---------------------------------------------------------------
2782 */
2783static void
2784dissect_zcl_scenes_copy_scene_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2785{
2786 /* Retrieve "Status" field */
2787 proto_tree_add_item(tree, hf_zbee_zcl_scenes_status, tvb, *offset, 1, ENC_NA0x00000000);
2788 *offset += 1;
2789
2790 /* Retrieve "Group ID From" field */
2791 proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id_from, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2792 *offset += 2;
2793
2794 /* Retrieve "Scene ID From" field */
2795 proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id_from, tvb, *offset, 1, ENC_NA0x00000000);
2796 *offset += 1;
2797
2798} /*dissect_zcl_scenes_copy_scene_response*/
2799
2800
2801/*FUNCTION:------------------------------------------------------
2802 * NAME
2803 * dissect_zcl_scenes_extension_fields
2804 * DESCRIPTION
2805 * this function decodes the extension set fields
2806 * PARAMETERS
2807 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
2808 * tvbuff_t *tvb - pointer to buffer containing raw packet.
2809 * unsigned *offset - pointer to buffer offset
2810 * RETURNS
2811 * none
2812 *---------------------------------------------------------------
2813 */
2814static void dissect_zcl_scenes_extension_fields(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2815{
2816 uint8_t set = 1;
2817 proto_tree *subtree;
2818
2819 // Is there an extension field?
2820 bool_Bool hasExtensionField = tvb_offset_exists(tvb, *offset+2);
2821
2822 while (hasExtensionField)
2823 {
2824 // Retrieve the cluster and the length
2825 uint32_t cluster = tvb_get_uint16(tvb, *offset, ENC_LITTLE_ENDIAN0x80000000);
2826 uint8_t length = tvb_get_uint8 (tvb, *offset+2);
2827
2828 // Create a subtree
2829 subtree = proto_tree_add_subtree_format(tree, tvb, *offset, length, ett_zbee_zcl_scenes_extension_field_set, NULL((void*)0), "Extension field set %d", set++);
2830 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_cluster, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2831 *offset += 3;
2832
2833 switch (cluster)
2834 {
2835 case ZBEE_ZCL_CID_ON_OFF0x0006:
2836 if (length >= 1)
2837 {
2838 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_onoff, tvb, *offset, 1, ENC_NA0x00000000);
2839 length -= 1;
2840 *offset += 1;
2841 }
2842 break;
2843
2844 case ZBEE_ZCL_CID_LEVEL_CONTROL0x0008:
2845 if (length >= 1)
2846 {
2847 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_level, tvb, *offset, 1, ENC_NA0x00000000);
2848 length -= 1;
2849 *offset += 1;
2850 }
2851 break;
2852
2853 case ZBEE_ZCL_CID_COLOR_CONTROL0x0300:
2854 if (length >= 2)
2855 {
2856 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_x, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2857 length -= 2;
2858 *offset += 2;
2859 }
2860 if (length >= 2)
2861 {
2862 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_y, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2863 length -= 2;
2864 *offset += 2;
2865 }
2866 if (length >= 2)
2867 {
2868 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_hue, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2869 length -= 2;
2870 *offset += 2;
2871 }
2872 if (length >= 1)
2873 {
2874 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_saturation, tvb, *offset, 1, ENC_NA0x00000000);
2875 length -= 1;
2876 *offset += 1;
2877 }
2878 if (length >= 1)
2879 {
2880 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_color_loop_active, tvb, *offset, 1, ENC_NA0x00000000);
2881 length -= 1;
2882 *offset += 1;
2883 }
2884 if (length >= 1)
2885 {
2886 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_color_loop_direction, tvb, *offset, 1, ENC_NA0x00000000);
2887 length -= 1;
2888 *offset += 1;
2889 }
2890 if (length >= 2)
2891 {
2892 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_color_loop_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2893 length -= 2;
2894 *offset += 2;
2895 }
2896 break;
2897
2898 case ZBEE_ZCL_CID_DOOR_LOCK0X0101:
2899 if (length >= 1)
2900 {
2901 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_lock_state, tvb, *offset, 1, ENC_NA0x00000000);
2902 length -= 1;
2903 *offset += 1;
2904 }
2905 break;
2906
2907 case ZBEE_ZCL_CID_WINDOW_COVERING0X0102:
2908 if (length >= 1)
2909 {
2910 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_lift_percentage, tvb, *offset, 1, ENC_NA0x00000000);
2911 length -= 1;
2912 *offset += 1;
2913 }
2914 if (length >= 1)
2915 {
2916 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_tilt_percentage, tvb, *offset, 1, ENC_NA0x00000000);
2917 length -= 1;
2918 *offset += 1;
2919 }
2920 break;
2921
2922 case ZBEE_ZCL_CID_THERMOSTAT0x0201:
2923 if (length >= 2)
2924 {
2925 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_cooling_setpoint, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2926 length -= 2;
2927 *offset += 2;
2928 }
2929 if (length >= 2)
2930 {
2931 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_heating_setpoint, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2932 length -= 2;
2933 *offset += 2;
2934 }
2935 if (length >= 1)
2936 {
2937 proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_system_mode, tvb, *offset, 1, ENC_NA0x00000000);
2938 length -= 1;
2939 *offset += 1;
2940 }
2941 break;
2942 }
2943
2944 *offset += length;
2945 hasExtensionField = tvb_offset_exists(tvb, *offset+2);
2946 }
2947}
2948
2949
2950/*FUNCTION:------------------------------------------------------
2951 * NAME
2952 * dissect_zcl_scenes_attr_data
2953 * DESCRIPTION
2954 * this function is called by ZCL foundation dissector in order to decode
2955 * specific cluster attributes data.
2956 * PARAMETERS
2957 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
2958 * tvbuff_t *tvb - pointer to buffer containing raw packet.
2959 * unsigned *offset - pointer to buffer offset
2960 * uint16_t attr_id - attribute identifier
2961 * unsigned data_type - attribute data type
2962 * bool client_attr- ZCL client
2963 * RETURNS
2964 * none
2965 *---------------------------------------------------------------
2966 */
2967void
2968dissect_zcl_scenes_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
2969{
2970 /* Dissect attribute data type and data */
2971 switch ( attr_id ) {
2972
2973 case ZBEE_ZCL_ATTR_ID_SCENES_SCENE_VALID0x0003:
2974 proto_tree_add_item(tree, hf_zbee_zcl_scenes_attr_id_scene_valid, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
2975 *offset += 1;
2976 break;
2977
2978 case ZBEE_ZCL_ATTR_ID_SCENES_NAME_SUPPORT0x0004:
2979 proto_tree_add_item(tree, hf_zbee_zcl_scenes_attr_id_name_support, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
2980 *offset += 1;
2981 break;
2982
2983 case ZBEE_ZCL_ATTR_ID_SCENES_SCENE_COUNT0x0000:
2984 case ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_SCENE0x0001:
2985 case ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_GROUP0x0002:
2986 case ZBEE_ZCL_ATTR_ID_SCENES_LAST_CONFIGURED_BY0x0005:
2987 default:
2988 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
2989 break;
2990 }
2991
2992} /*dissect_zcl_scenes_attr_data*/
2993
2994
2995/*FUNCTION:------------------------------------------------------
2996 * NAME
2997 * proto_register_zbee_zcl_scenes
2998 * DESCRIPTION
2999 * ZigBee ZCL Scenes cluster protocol registration routine.
3000 * PARAMETERS
3001 * none
3002 * RETURNS
3003 * void
3004 *---------------------------------------------------------------
3005 */
3006void
3007proto_register_zbee_zcl_scenes(void)
3008{
3009 /* Setup list of header fields */
3010 static hf_register_info hf[] = {
3011
3012 { &hf_zbee_zcl_scenes_attr_id,
3013 { "Attribute", "zbee_zcl_general.scenes.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_scenes_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_scenes_attr_names
))))
,
3014 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3015
3016 { &hf_zbee_zcl_scenes_scene_list,
3017 {"Scene List", "zbee_zcl_general.groups.scene_list",FT_NONE,BASE_NONE, NULL((void*)0),
3018 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3019
3020 { &hf_zbee_zcl_scenes_group_id,
3021 { "Group ID", "zbee_zcl_general.scenes.group_id", FT_UINT16, BASE_HEX, NULL((void*)0),
3022 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3023
3024 { &hf_zbee_zcl_scenes_group_id_from,
3025 { "Group ID From", "zbee_zcl_general.scenes.group_id_from", FT_UINT16, BASE_HEX, NULL((void*)0),
3026 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3027
3028 { &hf_zbee_zcl_scenes_group_id_to,
3029 { "Group ID To", "zbee_zcl_general.scenes.group_id_to", FT_UINT16, BASE_HEX, NULL((void*)0),
3030 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3031
3032 { &hf_zbee_zcl_scenes_scene_id,
3033 { "Scene ID", "zbee_zcl_general.scenes.scene_id", FT_UINT8, BASE_HEX, NULL((void*)0),
3034 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3035
3036 { &hf_zbee_zcl_scenes_scene_id_from,
3037 { "Scene ID From", "zbee_zcl_general.scenes.scene_id_from", FT_UINT8, BASE_HEX, NULL((void*)0),
3038 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3039
3040 { &hf_zbee_zcl_scenes_scene_id_to,
3041 { "Scene ID To", "zbee_zcl_general.scenes.scene_id_to", FT_UINT8, BASE_HEX, NULL((void*)0),
3042 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3043
3044 { &hf_zbee_zcl_scenes_transit_time,
3045 { "Transition Time", "zbee_zcl_general.scenes.transit_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_seconds)((const void *) (size_t) (decode_zcl_time_in_seconds)),
3046 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3047
3048 { &hf_zbee_zcl_scenes_enh_transit_time,
3049 { "Transition Time", "zbee_zcl_general.scenes.enh_transit_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms)((const void *) (size_t) (decode_zcl_time_in_100ms)),
3050 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3051
3052 { &hf_zbee_zcl_scenes_status,
3053 { "Scenes Status", "zbee_zcl_general.scenes.scenes_status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_status_names
))))
,
3054 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3055
3056 { &hf_zbee_zcl_scenes_capacity,
3057 { "Scene Capacity", "zbee_zcl_general.scenes.scene_capacity", FT_UINT8, BASE_DEC, NULL((void*)0),
3058 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3059
3060 { &hf_zbee_zcl_scenes_scene_count,
3061 { "Scene Count", "zbee_zcl_general.scenes.scene_count", FT_UINT8, BASE_DEC, NULL((void*)0),
3062 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3063
3064 { &hf_zbee_zcl_scenes_attr_id_name_support,
3065 { "Scene Name Support", "zbee_zcl_general.scenes.attr.name_support", FT_UINT8, BASE_HEX, VALS(zbee_zcl_scenes_group_names_support_values)((0 ? (const struct _value_string*)0 : ((zbee_zcl_scenes_group_names_support_values
))))
,
3066 ZBEE_ZCL_CMD_ID_SCENES_NAME_SUPPORT_MASK0x80, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3067
3068 { &hf_zbee_zcl_scenes_attr_id_scene_valid,
3069 { "Scene Valid", "zbee_zcl_general.scenes.scene_valid", FT_BOOLEAN, 8, NULL((void*)0),
3070 ZBEE_ZCL_ATTR_SCENES_SCENE_VALID_MASK0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3071
3072 { &hf_zbee_zcl_scenes_attr_str_len,
3073 { "Length", "zbee_zcl_general.scenes.attr_str_len", FT_UINT8, BASE_DEC, NULL((void*)0),
3074 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3075
3076 { &hf_zbee_zcl_scenes_attr_str,
3077 { "String", "zbee_zcl_general.scenes.attr_str", FT_STRING, BASE_NONE, NULL((void*)0),
3078 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3079
3080 { &hf_zbee_zcl_scenes_extension_set_cluster,
3081 { "Cluster", "zbee_zcl_general.scenes.extension_set.cluster", FT_UINT16, BASE_HEX | BASE_RANGE_STRING0x00000100, RVALS(zbee_aps_cid_names)((0 ? (const struct _range_string*)0 : ((zbee_aps_cid_names))
))
,
3082 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3083
3084 { &hf_zbee_zcl_scenes_extension_set_onoff,
3085 { "On/Off", "zbee_zcl_general.scenes.extension_set.onoff", FT_UINT8, BASE_DEC, NULL((void*)0),
3086 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3087
3088 { &hf_zbee_zcl_scenes_extension_set_level,
3089 { "Level", "zbee_zcl_general.scenes.extension_set.level", FT_UINT8, BASE_DEC, NULL((void*)0),
3090 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3091
3092 { &hf_zbee_zcl_scenes_extension_set_x,
3093 { "Color X", "zbee_zcl_general.scenes.extension_set.color_x", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy)((const void *) (size_t) (decode_color_xy)),
3094 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3095
3096 { &hf_zbee_zcl_scenes_extension_set_y,
3097 { "Color Y", "zbee_zcl_general.scenes.extension_set.color_y", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy)((const void *) (size_t) (decode_color_xy)),
3098 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3099
3100 { &hf_zbee_zcl_scenes_extension_set_hue,
3101 { "Enhanced Hue", "zbee_zcl_general.scenes.extension_set.hue", FT_UINT16, BASE_DEC, NULL((void*)0),
3102 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3103
3104 { &hf_zbee_zcl_scenes_extension_set_saturation,
3105 { "Saturation", "zbee_zcl_general.scenes.extension_set.saturation", FT_UINT8, BASE_DEC, NULL((void*)0),
3106 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3107
3108 { &hf_zbee_zcl_scenes_extension_set_color_loop_active,
3109 { "Color Loop Active", "zbee_zcl_general.scenes.extension_set.color_loop_active", FT_BOOLEAN, BASE_NONE, NULL((void*)0),
3110 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3111
3112 { &hf_zbee_zcl_scenes_extension_set_color_loop_direction,
3113 { "Color Loop Direction", "zbee_zcl_general.scenes.extension_set.color_loop_direction", FT_UINT8, BASE_DEC, VALS(zbee_zcl_scenes_color_loop_direction_values)((0 ? (const struct _value_string*)0 : ((zbee_zcl_scenes_color_loop_direction_values
))))
,
3114 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3115
3116 { &hf_zbee_zcl_scenes_extension_set_color_loop_time,
3117 { "Color Loop Time", "zbee_zcl_general.scenes.extension_set.color_loop_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_seconds)((const void *) (size_t) (decode_zcl_time_in_seconds)),
3118 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3119
3120 { &hf_zbee_zcl_scenes_extension_set_lock_state,
3121 { "Lock State", "zbee_zcl_general.scenes.extension_set.lock_state", FT_UINT8, BASE_DEC, NULL((void*)0),
3122 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3123
3124 { &hf_zbee_zcl_scenes_extension_set_lift_percentage,
3125 { "Current Position Lift Percentage", "zbee_zcl_general.scenes.extension_set.current_position_lift_percentage", FT_UINT8, BASE_DEC, NULL((void*)0),
3126 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3127
3128 { &hf_zbee_zcl_scenes_extension_set_tilt_percentage,
3129 { "Current Position Tilt Percentage", "zbee_zcl_general.scenes.extension_set.current_position_tilt_percentage", FT_UINT8, BASE_DEC, NULL((void*)0),
3130 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3131
3132 { &hf_zbee_zcl_scenes_extension_set_cooling_setpoint,
3133 { "Occupied Cooling Setpoint", "zbee_zcl_general.scenes.extension_set.occupied_cooling_setpoint", FT_INT16, BASE_CUSTOM, CF_FUNC(decode_setpoint)((const void *) (size_t) (decode_setpoint)),
3134 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3135
3136 { &hf_zbee_zcl_scenes_extension_set_heating_setpoint,
3137 { "Occupied Heating Setpoint", "zbee_zcl_general.scenes.extension_set.occupied_heating_setpoint", FT_INT16, BASE_CUSTOM, CF_FUNC(decode_setpoint)((const void *) (size_t) (decode_setpoint)),
3138 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3139
3140 { &hf_zbee_zcl_scenes_extension_set_system_mode,
3141 { "System Mode", "zbee_zcl_general.scenes.extension_set.system_mode", FT_UINT8, BASE_DEC, NULL((void*)0),
3142 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3143
3144 { &hf_zbee_zcl_scenes_copy_mode,
3145 { "Scene Copy Mode", "zbee_zcl_general.scenes.copy_mode", FT_UINT8, BASE_DEC, VALS(zbee_zcl_scenes_copy_mode_values)((0 ? (const struct _value_string*)0 : ((zbee_zcl_scenes_copy_mode_values
))))
,
3146 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3147
3148 { &hf_zbee_zcl_scenes_srv_rx_cmd_id,
3149 { "Command", "zbee_zcl_general.scenes.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_scenes_srv_rx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_scenes_srv_rx_cmd_names
))))
,
3150 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3151
3152 { &hf_zbee_zcl_scenes_srv_tx_cmd_id,
3153 { "Command", "zbee_zcl_general.scenes.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_scenes_srv_tx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_scenes_srv_tx_cmd_names
))))
,
3154 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
3155
3156 };
3157
3158 /* ZCL Scenes subtrees */
3159 static int *ett[] = {
3160 &ett_zbee_zcl_scenes,
3161 &ett_zbee_zcl_scenes_scene_ctrl,
3162 &ett_zbee_zcl_scenes_extension_field_set
3163 };
3164
3165 /* Register the ZigBee ZCL Scenes cluster protocol name and description */
3166 proto_zbee_zcl_scenes = proto_register_protocol("ZigBee ZCL Scenes", "ZCL Scenes", ZBEE_PROTOABBREV_ZCL_SCENES"zbee_zcl_general.scenes");
3167 proto_register_field_array(proto_zbee_zcl_scenes, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
3168 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
3169
3170 /* Register the ZigBee ZCL Scenes dissector. */
3171 register_dissector(ZBEE_PROTOABBREV_ZCL_SCENES"zbee_zcl_general.scenes", dissect_zbee_zcl_scenes, proto_zbee_zcl_scenes);
3172
3173} /*proto_register_zbee_zcl_scenes*/
3174
3175
3176/*FUNCTION:------------------------------------------------------
3177 * NAME
3178 * proto_reg_handoff_zbee_zcl_scenes
3179 * DESCRIPTION
3180 * Hands off the ZCL Scenes dissector.
3181 * PARAMETERS
3182 * none
3183 * RETURNS
3184 * none
3185 *---------------------------------------------------------------
3186 */
3187void
3188proto_reg_handoff_zbee_zcl_scenes(void)
3189{
3190
3191 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_SCENES"zbee_zcl_general.scenes",
3192 proto_zbee_zcl_scenes,
3193 ett_zbee_zcl_scenes,
3194 ZBEE_ZCL_CID_SCENES0x0005,
3195 ZBEE_MFG_CODE_NONE0x0000,
3196 hf_zbee_zcl_scenes_attr_id,
3197 hf_zbee_zcl_scenes_attr_id,
3198 hf_zbee_zcl_scenes_srv_rx_cmd_id,
3199 hf_zbee_zcl_scenes_srv_tx_cmd_id,
3200 (zbee_zcl_fn_attr_data)dissect_zcl_scenes_attr_data
3201 );
3202} /*proto_reg_handoff_zbee_zcl_scenes*/
3203
3204
3205/* ########################################################################## */
3206/* #### (0x0006) ON/OFF CLUSTER ############################################# */
3207/* ########################################################################## */
3208
3209/*************************/
3210/* Defines */
3211/*************************/
3212
3213/* Attributes */
3214#define ZBEE_ZCL_ON_OFF_ATTR_ID_ONOFF0x0000 0x0000
3215#define ZBEE_ZCL_ON_OFF_ATTR_ID_GLOBALSCENECONTROL0x4000 0x4000
3216#define ZBEE_ZCL_ON_OFF_ATTR_ID_ONTIME0x4001 0x4001
3217#define ZBEE_ZCL_ON_OFF_ATTR_ID_OFFWAITTIME0x4002 0x4002
3218#define ZBEE_ZCL_ON_OFF_ATTR_ID_STARTUPONOFF0x4003 0x4003
3219
3220/* Server Commands Received */
3221#define ZBEE_ZCL_ON_OFF_CMD_OFF0x00 0x00 /* Off */
3222#define ZBEE_ZCL_ON_OFF_CMD_ON0x01 0x01 /* On */
3223#define ZBEE_ZCL_ON_OFF_CMD_TOGGLE0x02 0x02 /* Toggle */
3224#define ZBEE_ZCL_ON_OFF_CMD_OFF_WITH_EFFECT0x40 0x40 /* Off with effect */
3225#define ZBEE_ZCL_ON_OFF_CMD_ON_WITH_RECALL_GLOBAL_SCENE0x41 0x41 /* On with recall global scene */
3226#define ZBEE_ZCL_ON_OFF_CMD_ON_WITH_TIMED_OFF0x42 0x42 /* On with timed off */
3227
3228/* On/Off Control Field */
3229#define ZBEE_ZCL_ON_OFF_TIMED_OFF_CONTROL_MASK_ACCEPT_ONLY_WHEN_ON0x01 0x01
3230#define ZBEE_ZCL_ON_OFF_TIMED_OFF_CONTROL_MASK_RESERVED0xFE 0xFE
3231
3232/*************************/
3233/* Function Declarations */
3234/*************************/
3235
3236void proto_register_zbee_zcl_on_off(void);
3237void proto_reg_handoff_zbee_zcl_on_off(void);
3238
3239/* Command Dissector Helpers */
3240static void dissect_zcl_on_off_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
3241
3242/* Private functions prototype */
3243
3244/*************************/
3245/* Global Variables */
3246/*************************/
3247
3248/* Initialize the protocol and registered fields */
3249static int proto_zbee_zcl_on_off;
3250
3251static int hf_zbee_zcl_on_off_attr_id;
3252static int hf_zbee_zcl_on_off_attr_onoff;
3253static int hf_zbee_zcl_on_off_attr_globalscenecontrol;
3254static int hf_zbee_zcl_on_off_attr_ontime;
3255static int hf_zbee_zcl_on_off_attr_offwaittime;
3256static int hf_zbee_zcl_on_off_attr_startuponoff;
3257static int hf_zbee_zcl_on_off_srv_rx_cmd_id;
3258
3259static int hf_zbee_zcl_on_off_effect_identifier;
3260static int hf_zbee_zcl_on_off_effect_variant_delayed_all_off;
3261static int hf_zbee_zcl_on_off_effect_variant_dying_light;
3262static int hf_zbee_zcl_on_off_effect_variant_reserved;
3263
3264static int hf_zbee_zcl_on_off_timed_off_control_mask;
3265static int hf_zbee_zcl_on_off_timed_off_control_mask_accept_only_when_on;
3266static int hf_zbee_zcl_on_off_timed_off_control_mask_reserved;
3267
3268/* Initialize the subtree pointers */
3269static int ett_zbee_zcl_on_off;
3270static int ett_zbee_zcl_on_off_timed_off_control_mask;
3271
3272/* Attributes */
3273static const value_string zbee_zcl_on_off_attr_names[] = {
3274 { ZBEE_ZCL_ON_OFF_ATTR_ID_ONOFF0x0000, "OnOff" },
3275 { ZBEE_ZCL_ON_OFF_ATTR_ID_GLOBALSCENECONTROL0x4000, "GlobalSceneControl" },
3276 { ZBEE_ZCL_ON_OFF_ATTR_ID_ONTIME0x4001, "OnTime" },
3277 { ZBEE_ZCL_ON_OFF_ATTR_ID_OFFWAITTIME0x4002, "OffWaitTime" },
3278 { ZBEE_ZCL_ON_OFF_ATTR_ID_STARTUPONOFF0x4003, "StartUpOnOff" },
3279 { 0, NULL((void*)0) }
3280};
3281
3282/* Server Commands Generated */
3283static const value_string zbee_zcl_on_off_srv_rx_cmd_names[] = {
3284 { ZBEE_ZCL_ON_OFF_CMD_OFF0x00, "Off" },
3285 { ZBEE_ZCL_ON_OFF_CMD_ON0x01, "On" },
3286 { ZBEE_ZCL_ON_OFF_CMD_TOGGLE0x02, "Toggle" },
3287 { ZBEE_ZCL_ON_OFF_CMD_OFF_WITH_EFFECT0x40, "Off with effect" },
3288 { ZBEE_ZCL_ON_OFF_CMD_ON_WITH_RECALL_GLOBAL_SCENE0x41, "On with recall global scene" },
3289 { ZBEE_ZCL_ON_OFF_CMD_ON_WITH_TIMED_OFF0x42, "On with timed off" },
3290 { 0, NULL((void*)0) }
3291};
3292
3293static const range_string zbee_zcl_on_off_effect_identifier_names[] = {
3294 { 0x00, 0x00, "Delayed All Off" },
3295 { 0x01, 0x01, "Dying Light" },
3296 { 0x02, 0xFF, "Reserved" },
3297 { 0, 0, NULL((void*)0) }
3298};
3299
3300static const range_string zbee_zcl_on_off_effect_variant_delayed_all_off_names[] = {
3301 { 0x00, 0x00, "Fade to off in 0.8 seconds" },
3302 { 0x01, 0x01, "No fade" },
3303 { 0x02, 0x02, "50% dim down in 0.8 seconds then fade to off in 12 seconds" },
3304 { 0x03, 0xFF, "Reserved" },
3305 { 0, 0, NULL((void*)0) }
3306};
3307
3308static const range_string zbee_zcl_on_off_effect_variant_dying_light_names[] = {
3309 { 0x00, 0x00, "20% dim up in 0.5s then fade to off in 1 second" },
3310 { 0x01, 0xFF, "Reserved" },
3311 { 0, 0, NULL((void*)0) }
3312};
3313
3314static const range_string zbee_zcl_on_off_effect_variant_reserved_names[] = {
3315 { 0x00, 0xFF, "Reserved" },
3316 { 0, 0, NULL((void*)0) }
3317};
3318
3319static const range_string zbee_zcl_on_off_startup_on_off_names[] = {
3320 { 0x00, 0x00, "Set the OnOff attribute to Off" },
3321 { 0x01, 0x01, "Set the OnOff attribute to On" },
3322 { 0x02, 0x02, "Toggle the OnOff attribute" },
3323 { 0x03, 0xFE, "Reserved" },
3324 { 0xFF, 0xFF, "Set the OnOff attribute to its previous value" },
3325 { 0, 0, NULL((void*)0) }
3326};
3327
3328/*************************/
3329/* Function Bodies */
3330/*************************/
3331
3332/*FUNCTION:------------------------------------------------------
3333 * NAME
3334 * dissect_zbee_zcl_onoff
3335 * DESCRIPTION
3336 * ZigBee ZCL OnOff cluster dissector for wireshark.
3337 * PARAMETERS
3338 * tvbuff_t *tvb - pointer to buffer containing raw packet.
3339 * packet_info *pinfo - pointer to packet information fields
3340 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
3341 * void *data - pointer to ZCL packet structure.
3342 * RETURNS
3343 * int - length of parsed data.
3344 *---------------------------------------------------------------
3345 */
3346static int
3347dissect_zbee_zcl_on_off(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
3348{
3349 proto_tree *payload_tree;
3350 zbee_zcl_packet *zcl;
3351 unsigned offset = 0;
3352 uint8_t cmd_id;
3353 int rem_len;
3354 uint8_t effect_identifier = 0;
3355
3356 static int * const onoff_control_mask[] = {
3357 &hf_zbee_zcl_on_off_timed_off_control_mask_accept_only_when_on,
3358 &hf_zbee_zcl_on_off_timed_off_control_mask_reserved,
3359 NULL((void*)0)
3360 };
3361
3362 /* Reject the packet if data is NULL */
3363 if (data == NULL((void*)0))
3364 return 0;
3365 zcl = (zbee_zcl_packet *)data;
3366 cmd_id = zcl->cmd_id;
3367
3368 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
3369 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER0x00) {
3370 /* Append the command name to the info column. */
3371 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
3372 val_to_str_const(cmd_id, zbee_zcl_on_off_srv_rx_cmd_names, "Unknown Command"),
3373 zcl->tran_seqno);
3374
3375 /* Add the command ID. */
3376 proto_tree_add_item(tree, hf_zbee_zcl_on_off_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
3377 rem_len = tvb_reported_length_remaining(tvb, ++offset);
3378 if (rem_len > 0) {
3379 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_on_off, NULL((void*)0), "Payload");
3380
3381 switch (cmd_id) {
3382 case ZBEE_ZCL_ON_OFF_CMD_OFF_WITH_EFFECT0x40:
3383 proto_tree_add_item(payload_tree, hf_zbee_zcl_on_off_effect_identifier, tvb, offset, 1, ENC_NA0x00000000);
3384 effect_identifier = tvb_get_uint8(tvb, offset);
3385 offset += 1;
3386 switch (effect_identifier) {
3387 case 0x00:
3388 proto_tree_add_item(payload_tree, hf_zbee_zcl_on_off_effect_variant_delayed_all_off, tvb, offset, 1, ENC_NA0x00000000);
3389 break;
3390 case 0x01:
3391 proto_tree_add_item(payload_tree, hf_zbee_zcl_on_off_effect_variant_dying_light, tvb, offset, 1, ENC_NA0x00000000);
3392 break;
3393 default:
3394 proto_tree_add_item(payload_tree, hf_zbee_zcl_on_off_effect_variant_reserved, tvb, offset, 1, ENC_NA0x00000000);
3395 break;
3396 }
3397 break;
3398
3399 case ZBEE_ZCL_ON_OFF_CMD_ON_WITH_TIMED_OFF0x42:
3400 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_ENDIAN0x80000000);
3401 offset += 1;
3402
3403 dissect_zcl_on_off_attr_data(payload_tree, tvb, &offset, ZBEE_ZCL_ON_OFF_ATTR_ID_ONTIME0x4001, FT_UINT16, false0);
3404 dissect_zcl_on_off_attr_data(payload_tree, tvb, &offset, ZBEE_ZCL_ON_OFF_ATTR_ID_OFFWAITTIME0x4002, FT_UINT16, false0);
3405 break;
3406
3407 default:
3408 break;
3409 }
3410 }
3411 }
3412
3413 return tvb_captured_length(tvb);
3414} /*dissect_zbee_zcl_on_off*/
3415
3416
3417/*FUNCTION:------------------------------------------------------
3418 * NAME
3419 * dissect_zcl_on_off_attr_data
3420 * DESCRIPTION
3421 * this function is called by ZCL foundation dissector in order to decode
3422 * specific cluster attributes data.
3423 * PARAMETERS
3424 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
3425 * tvbuff_t *tvb - pointer to buffer containing raw packet.
3426 * unsigned *offset - pointer to buffer offset
3427 * uint16_t attr_id - attribute identifier
3428 * unsigned data_type - attribute data type
3429 * bool client_attr- ZCL client
3430 * RETURNS
3431 * none
3432 *---------------------------------------------------------------
3433 */
3434void
3435dissect_zcl_on_off_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
3436{
3437 /* Dissect attribute data type and data */
3438 switch (attr_id) {
3439
3440 case ZBEE_ZCL_ON_OFF_ATTR_ID_ONOFF0x0000:
3441 proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_onoff, tvb, *offset, 1, ENC_NA0x00000000);
3442 *offset += 1;
3443 break;
3444
3445 case ZBEE_ZCL_ON_OFF_ATTR_ID_GLOBALSCENECONTROL0x4000:
3446 proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_globalscenecontrol, tvb, *offset, 1, ENC_NA0x00000000);
3447 *offset += 1;
3448 break;
3449
3450 case ZBEE_ZCL_ON_OFF_ATTR_ID_ONTIME0x4001:
3451 proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_ontime, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
3452 *offset += 2;
3453 break;
3454
3455 case ZBEE_ZCL_ON_OFF_ATTR_ID_OFFWAITTIME0x4002:
3456 proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_offwaittime, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
3457 *offset += 2;
3458 break;
3459
3460 case ZBEE_ZCL_ON_OFF_ATTR_ID_STARTUPONOFF0x4003:
3461 proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_startuponoff, tvb, *offset, 1, ENC_NA0x00000000);
3462 *offset += 1;
3463 break;
3464
3465 default:
3466 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
3467 break;
3468 }
3469
3470} /*dissect_zcl_on_off_attr_data*/
3471
3472/*FUNCTION:------------------------------------------------------
3473 * NAME
3474 * proto_register_zbee_zcl_on_off
3475 * DESCRIPTION
3476 * ZigBee ZCL OnOff cluster protocol registration routine.
3477 * PARAMETERS
3478 * none
3479 * RETURNS
3480 * void
3481 *---------------------------------------------------------------
3482 */
3483void
3484proto_register_zbee_zcl_on_off(void)
3485{
3486 /* Setup list of header fields */
3487 static hf_register_info hf[] = {
3488
3489 { &hf_zbee_zcl_on_off_attr_id,
3490 { "Attribute", "zbee_zcl_general.onoff.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_on_off_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_on_off_attr_names
))))
,
3491 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3492
3493 { &hf_zbee_zcl_on_off_attr_onoff,
3494 { "On/off Control", "zbee_zcl_general.onoff.attr.onoff", FT_BOOLEAN, BASE_NONE, TFS(&tfs_on_off)((0 ? (const struct true_false_string*)0 : ((&tfs_on_off)
)))
,
3495 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3496
3497 { &hf_zbee_zcl_on_off_attr_globalscenecontrol,
3498 { "Global Scene Control", "zbee_zcl_general.onoff.attr.globalscenecontrol", FT_BOOLEAN, BASE_NONE, NULL((void*)0),
3499 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3500
3501 { &hf_zbee_zcl_on_off_attr_ontime,
3502 { "On Time", "zbee_zcl_general.onoff.attr.ontime", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms)((const void *) (size_t) (decode_zcl_time_in_100ms)),
3503 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3504
3505 { &hf_zbee_zcl_on_off_attr_offwaittime,
3506 { "Off Wait Time", "zbee_zcl_general.onoff.attr.offwaittime", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms)((const void *) (size_t) (decode_zcl_time_in_100ms)),
3507 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3508
3509 { &hf_zbee_zcl_on_off_attr_startuponoff,
3510 { "Startup On Off", "zbee_zcl_general.onoff.attr.startuponoff", FT_UINT8, BASE_HEX | BASE_RANGE_STRING0x00000100, RVALS(zbee_zcl_on_off_startup_on_off_names)((0 ? (const struct _range_string*)0 : ((zbee_zcl_on_off_startup_on_off_names
))))
,
3511 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3512
3513 { &hf_zbee_zcl_on_off_effect_identifier,
3514 { "Effect Identifier", "zbee_zcl_general.onoff.effect_identifier", FT_UINT8, BASE_HEX | BASE_RANGE_STRING0x00000100, RVALS(zbee_zcl_on_off_effect_identifier_names)((0 ? (const struct _range_string*)0 : ((zbee_zcl_on_off_effect_identifier_names
))))
,
3515 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3516
3517 { &hf_zbee_zcl_on_off_effect_variant_delayed_all_off,
3518 { "Effect Variant", "zbee_zcl_general.onoff.effect_variant", FT_UINT8, BASE_HEX | BASE_RANGE_STRING0x00000100, RVALS(zbee_zcl_on_off_effect_variant_delayed_all_off_names)((0 ? (const struct _range_string*)0 : ((zbee_zcl_on_off_effect_variant_delayed_all_off_names
))))
,
3519 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3520
3521 { &hf_zbee_zcl_on_off_effect_variant_dying_light,
3522 { "Effect Variant", "zbee_zcl_general.onoff.effect_variant", FT_UINT8, BASE_HEX | BASE_RANGE_STRING0x00000100, RVALS(zbee_zcl_on_off_effect_variant_dying_light_names)((0 ? (const struct _range_string*)0 : ((zbee_zcl_on_off_effect_variant_dying_light_names
))))
,
3523 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3524
3525 { &hf_zbee_zcl_on_off_effect_variant_reserved,
3526 { "Effect Variant", "zbee_zcl_general.onoff.effect_variant", FT_UINT8, BASE_HEX | BASE_RANGE_STRING0x00000100, RVALS(zbee_zcl_on_off_effect_variant_reserved_names)((0 ? (const struct _range_string*)0 : ((zbee_zcl_on_off_effect_variant_reserved_names
))))
,
3527 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3528
3529 { &hf_zbee_zcl_on_off_timed_off_control_mask,
3530 { "On/Off Control Mask", "zbee_zcl_general.onoff.onoff_control_mask", FT_UINT8, BASE_HEX, NULL((void*)0),
3531 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3532
3533 { &hf_zbee_zcl_on_off_timed_off_control_mask_accept_only_when_on,
3534 { "Accept Only When On", "zbee_zcl_general.onoff.onoff_control_mask.accept_only_when_on", FT_UINT8, BASE_DEC, NULL((void*)0),
3535 ZBEE_ZCL_ON_OFF_TIMED_OFF_CONTROL_MASK_ACCEPT_ONLY_WHEN_ON0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3536
3537 { &hf_zbee_zcl_on_off_timed_off_control_mask_reserved,
3538 { "Reserved", "zbee_zcl_general.onoff.onoff_control_mask.reserved", FT_UINT8, BASE_DEC, NULL((void*)0),
3539 ZBEE_ZCL_ON_OFF_TIMED_OFF_CONTROL_MASK_RESERVED0xFE, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3540
3541 { &hf_zbee_zcl_on_off_srv_rx_cmd_id,
3542 { "Command", "zbee_zcl_general.onoff.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_on_off_srv_rx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_on_off_srv_rx_cmd_names
))))
,
3543 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
3544
3545 };
3546
3547 /* ZCL OnOff subtrees */
3548 static int *ett[] = { &ett_zbee_zcl_on_off,
3549 &ett_zbee_zcl_on_off_timed_off_control_mask };
3550
3551 /* Register the ZigBee ZCL OnOff cluster protocol name and description */
3552 proto_zbee_zcl_on_off = proto_register_protocol("ZigBee ZCL OnOff", "ZCL OnOff", ZBEE_PROTOABBREV_ZCL_ONOFF"zbee_zcl_general.onoff");
3553 proto_register_field_array(proto_zbee_zcl_on_off, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
3554 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
3555
3556 /* Register the ZigBee ZCL OnOff dissector. */
3557 register_dissector(ZBEE_PROTOABBREV_ZCL_ONOFF"zbee_zcl_general.onoff", dissect_zbee_zcl_on_off, proto_zbee_zcl_on_off);
3558} /* proto_register_zbee_zcl_on_off */
3559
3560/*FUNCTION:------------------------------------------------------
3561 * NAME
3562 * proto_reg_handoff_zbee_zcl_on_off
3563 * DESCRIPTION
3564 * Hands off the Zcl OnOff cluster dissector.
3565 * PARAMETERS
3566 * none
3567 * RETURNS
3568 * void
3569 *---------------------------------------------------------------
3570 */
3571void
3572proto_reg_handoff_zbee_zcl_on_off(void)
3573{
3574 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ONOFF"zbee_zcl_general.onoff",
3575 proto_zbee_zcl_on_off,
3576 ett_zbee_zcl_on_off,
3577 ZBEE_ZCL_CID_ON_OFF0x0006,
3578 ZBEE_MFG_CODE_NONE0x0000,
3579 hf_zbee_zcl_on_off_attr_id,
3580 hf_zbee_zcl_on_off_attr_id,
3581 hf_zbee_zcl_on_off_srv_rx_cmd_id,
3582 -1,
3583 (zbee_zcl_fn_attr_data)dissect_zcl_on_off_attr_data
3584 );
3585} /*proto_reg_handoff_zbee_zcl_on_off*/
3586
3587/* ############################################################################################### */
3588/* #### (0x0007) ON/OFF SWITCH CONFIGURATION CLUSTER ############################################# */
3589/* ############################################################################################### */
3590
3591/*************************/
3592/* Defines */
3593/*************************/
3594
3595/* Attributes */
3596#define ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_TYPE0x0000 0x0000 /* Switch Type */
3597#define ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_ACTIONS0x0010 0x0010 /* Switch Actions */
3598
3599/* No Server Commands Received */
3600
3601/*************************/
3602/* Function Declarations */
3603/*************************/
3604
3605void proto_register_zbee_zcl_on_off_switch_configuration(void);
3606void proto_reg_handoff_zbee_zcl_on_off_switch_configuration(void);
3607
3608/* Command Dissector Helpers */
3609static 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_Bool client_attr);
3610
3611/* Private functions prototype */
3612
3613/*************************/
3614/* Global Variables */
3615/*************************/
3616
3617/* Initialize the protocol and registered fields */
3618static int proto_zbee_zcl_on_off_switch_configuration;
3619
3620static int hf_zbee_zcl_on_off_switch_configuration_attr_id;
3621static int hf_zbee_zcl_on_off_switch_configuration_attr_switch_type;
3622static int hf_zbee_zcl_on_off_switch_configuration_attr_switch_actions;
3623
3624/* Initialize the subtree pointers */
3625static int ett_zbee_zcl_on_off_switch_configuration;
3626
3627/* Attributes */
3628static const value_string zbee_zcl_on_off_switch_configuration_attr_names[] = {
3629 { ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_TYPE0x0000, "Switch Type" },
3630 { ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_ACTIONS0x0010, "Switch Actions" },
3631 { 0, NULL((void*)0) }
3632};
3633
3634/* Switch Type Names */
3635static const value_string zbee_zcl_on_off_switch_configuration_switch_type_names[] = {
3636 { 0x00, "Toggle" },
3637 { 0x01, "Momentary" },
3638 { 0, NULL((void*)0) }
3639};
3640
3641/* Switch Actions Names */
3642static const value_string zbee_zcl_on_off_switch_configuration_switch_actions_names[] = {
3643 { 0x00, "On" },
3644 { 0x01, "Off" },
3645 { 0x02, "Toggle" },
3646 { 0, NULL((void*)0) }
3647};
3648
3649/*************************/
3650/* Function Bodies */
3651/*************************/
3652
3653/*FUNCTION:------------------------------------------------------
3654 * NAME
3655 * dissect_zbee_zcl_on_off_switch_configuration
3656 * DESCRIPTION
3657 * ZigBee ZCL OnOff Switch Configuration cluster dissector for wireshark.
3658 * PARAMETERS
3659 * tvbuff_t *tvb - pointer to buffer containing raw packet.
3660 * packet_info *pinfo - pointer to packet information fields
3661 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
3662 * RETURNS
3663 * int - length of parsed data.
3664 *---------------------------------------------------------------
3665 */
3666static int
3667dissect_zbee_zcl_on_off_switch_configuration(tvbuff_t *tvb _U___attribute__((unused)), packet_info *pinfo _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), void* data _U___attribute__((unused)))
3668{
3669 return tvb_captured_length(tvb);
3670} /*dissect_zbee_zcl_on_off_switch_configuration*/
3671
3672
3673/*FUNCTION:------------------------------------------------------
3674 * NAME
3675 * dissect_zcl_on_off_switch_configuration_attr_data
3676 * DESCRIPTION
3677 * this function is called by ZCL foundation dissector in order to decode
3678 * specific cluster attributes data.
3679 * PARAMETERS
3680 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
3681 * tvbuff_t *tvb - pointer to buffer containing raw packet.
3682 * unsigned *offset - pointer to buffer offset
3683 * uint16_t attr_id - attribute identifier
3684 * unsigned data_type - attribute data type
3685 * bool client_attr- ZCL client
3686 * RETURNS
3687 * none
3688 *---------------------------------------------------------------
3689 */
3690void
3691dissect_zcl_on_off_switch_configuration_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
3692{
3693 /* Dissect attribute data type and data */
3694 switch (attr_id) {
3695
3696 case ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_TYPE0x0000:
3697 proto_tree_add_item(tree, hf_zbee_zcl_on_off_switch_configuration_attr_switch_type, tvb, *offset, 1, ENC_NA0x00000000);
3698 *offset += 1;
3699 break;
3700
3701 case ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_ACTIONS0x0010:
3702 proto_tree_add_item(tree, hf_zbee_zcl_on_off_switch_configuration_attr_switch_actions, tvb, *offset, 1, ENC_NA0x00000000);
3703 *offset += 1;
3704 break;
3705
3706 default:
3707 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
3708 break;
3709 }
3710
3711} /*dissect_zcl_on_off_switch_configuration_attr_data*/
3712
3713
3714/*FUNCTION:------------------------------------------------------
3715 * NAME
3716 * proto_register_zbee_zcl_on_off_switch_configuration
3717 * DESCRIPTION
3718 * ZigBee ZCL OnOff cluster protocol registration routine.
3719 * PARAMETERS
3720 * none
3721 * RETURNS
3722 * void
3723 *---------------------------------------------------------------
3724 */
3725void
3726proto_register_zbee_zcl_on_off_switch_configuration(void)
3727{
3728 /* Setup list of header fields */
3729 static hf_register_info hf[] = {
3730
3731 { &hf_zbee_zcl_on_off_switch_configuration_attr_id,
3732 { "Attribute", "zbee_zcl_general.onoff_switch_configuration.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_on_off_switch_configuration_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_on_off_switch_configuration_attr_names
))))
,
3733 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3734
3735 { &hf_zbee_zcl_on_off_switch_configuration_attr_switch_type,
3736 { "Switch Type", "zbee_zcl_general.onoff.attr.switch_type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_on_off_switch_configuration_switch_type_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_on_off_switch_configuration_switch_type_names
))))
,
3737 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3738
3739 { &hf_zbee_zcl_on_off_switch_configuration_attr_switch_actions,
3740 { "Switch Action", "zbee_zcl_general.onoff.attr.switch_actions", FT_UINT8, BASE_HEX, VALS(zbee_zcl_on_off_switch_configuration_switch_actions_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_on_off_switch_configuration_switch_actions_names
))))
,
3741 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
3742
3743 };
3744
3745 /* ZCL Identify subtrees */
3746 static int *ett[] = {
3747 &ett_zbee_zcl_on_off_switch_configuration
3748 };
3749
3750 /* Register the ZigBee ZCL OnOff Switch Configuration cluster protocol name and description */
3751 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"zbee_zcl_general.onoff.switch.configuration");
3752 proto_register_field_array(proto_zbee_zcl_on_off_switch_configuration, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
3753 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
3754
3755 /* Register the ZigBee ZCL OnOff dissector. */
3756 register_dissector(ZBEE_PROTOABBREV_ZCL_ONOFF_SWITCH_CONFIG"zbee_zcl_general.onoff.switch.configuration", dissect_zbee_zcl_on_off_switch_configuration, proto_zbee_zcl_on_off_switch_configuration);
3757} /* proto_register_zbee_zcl_on_off_switch_configuration */
3758
3759/*FUNCTION:------------------------------------------------------
3760 * NAME
3761 * proto_reg_handoff_zbee_zcl_on_off_switch_configuration
3762 * DESCRIPTION
3763 * Hands off the Zcl OnOff cluster dissector.
3764 * PARAMETERS
3765 * none
3766 * RETURNS
3767 * none
3768 *---------------------------------------------------------------
3769 */
3770void
3771proto_reg_handoff_zbee_zcl_on_off_switch_configuration(void)
3772{
3773 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ONOFF_SWITCH_CONFIG"zbee_zcl_general.onoff.switch.configuration",
3774 proto_zbee_zcl_on_off_switch_configuration,
3775 ett_zbee_zcl_on_off_switch_configuration,
3776 ZBEE_ZCL_CID_ON_OFF_SWITCH_CONFIG0x0007,
3777 ZBEE_MFG_CODE_NONE0x0000,
3778 hf_zbee_zcl_on_off_switch_configuration_attr_id,
3779 hf_zbee_zcl_on_off_switch_configuration_attr_id,
3780 -1, -1,
3781 (zbee_zcl_fn_attr_data)dissect_zcl_on_off_switch_configuration_attr_data
3782 );
3783} /*proto_reg_handoff_zbee_zcl_on_off_switch_configuration*/
3784
3785/* ########################################################################## */
3786/* #### (0x0009) ALARMS CLUSTER ############################################# */
3787/* ########################################################################## */
3788
3789/*************************/
3790/* Defines */
3791/*************************/
3792
3793/* Attributes */
3794#define ZBEE_ZCL_ATTR_ID_ALARMS_ALARM_COUNT0x0000 0x0000 /* Alarm Count */
3795
3796/* Server Commands Received */
3797#define ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM0x00 0x00 /* Reset Alarm */
3798#define ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALL_ALARMS0x01 0x01 /* Reset All Alarms */
3799#define ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM0x02 0x02 /* Get Alarm */
3800#define ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM_LOG0x03 0x03 /* Reset Alarm Log */
3801
3802/* Server Commands Generated */
3803#define ZBEE_ZCL_CMD_ID_ALARMS_ALARM0x00 0x00 /* Alarm */
3804#define ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM_RESPONSE0x01 0x01 /* Get Alarm Response */
3805
3806/*************************/
3807/* Function Declarations */
3808/*************************/
3809
3810void proto_register_zbee_zcl_alarms(void);
3811void proto_reg_handoff_zbee_zcl_alarms(void);
3812
3813/* Private functions prototype */
3814
3815/*************************/
3816/* Global Variables */
3817/*************************/
3818/* Initialize the protocol and registered fields */
3819static int proto_zbee_zcl_alarms;
3820
3821static int hf_zbee_zcl_alarms_attr_id;
3822static int hf_zbee_zcl_alarms_alarm_code;
3823static int hf_zbee_zcl_alarms_cluster_id;
3824static int hf_zbee_zcl_alarms_status;
3825static int hf_zbee_zcl_alarms_timestamp;
3826static int hf_zbee_zcl_alarms_srv_rx_cmd_id;
3827static int hf_zbee_zcl_alarms_srv_tx_cmd_id;
3828
3829/* Initialize the subtree pointers */
3830static int ett_zbee_zcl_alarms;
3831
3832/* Attributes */
3833static const value_string zbee_zcl_alarms_attr_names[] = {
3834 { ZBEE_ZCL_ATTR_ID_ALARMS_ALARM_COUNT0x0000, "Alarm Count" },
3835 { 0, NULL((void*)0) }
3836};
3837
3838/* Server Commands Received */
3839static const value_string zbee_zcl_alarms_srv_rx_cmd_names[] = {
3840 { ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM0x00, "Reset Alarm" },
3841 { ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALL_ALARMS0x01, "Reset All Alarms" },
3842 { ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM0x02, "Get Alarm" },
3843 { ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM_LOG0x03, "Reset Alarm Log" },
3844 { 0, NULL((void*)0) }
3845};
3846
3847/* Server Commands Generated */
3848static const value_string zbee_zcl_alarms_srv_tx_cmd_names[] = {
3849 { ZBEE_ZCL_CMD_ID_ALARMS_ALARM0x00, "Alarm" },
3850 { ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM_RESPONSE0x01,"Get Alarm Response" },
3851 { 0, NULL((void*)0) }
3852};
3853
3854/*************************/
3855/* Function Bodies */
3856/*************************/
3857
3858/*FUNCTION:------------------------------------------------------
3859 * NAME
3860 * dissect_zcl_alarms_attr_data
3861 * DESCRIPTION
3862 * this function is called by ZCL foundation dissector in order to decode
3863 * specific cluster attributes data.
3864 * PARAMETERS
3865 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
3866 * tvbuff_t *tvb - pointer to buffer containing raw packet.
3867 * unsigned *offset - pointer to buffer offset
3868 * uint16_t attr_id - attribute identifier
3869 * unsigned data_type - attribute data type
3870 * bool client_attr- ZCL client
3871 * RETURNS
3872 * none
3873 *--------------------------------------------------------------- */
3874static void
3875dissect_zcl_alarms_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
3876{
3877 /* Dissect attribute data type and data */
3878 switch ( attr_id ) {
3879 case ZBEE_ZCL_ATTR_ID_ALARMS_ALARM_COUNT0x0000:
3880 default:
3881 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
3882 break;
3883 }
3884
3885} /*dissect_zcl_alarms_attr_data*/
3886
3887/*FUNCTION:------------------------------------------------------
3888 * NAME
3889 * dissect_zcl_alarms_alarm_and_reset_alarm
3890 * DESCRIPTION
3891 * this function decodes the Alarm and Reset Alarm payload.
3892 * PARAMETERS
3893 * tvb - the tv buffer of the current data_type
3894 * tree - the tree to append this item to
3895 * offset - offset of data in tvb
3896 * RETURNS
3897 * none
3898 *---------------------------------------------------------------
3899 */
3900static void
3901dissect_zcl_alarms_alarm_and_reset_alarm(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
3902{
3903 /* Retrieve "Alarm Code" field */
3904 proto_tree_add_item(tree, hf_zbee_zcl_alarms_alarm_code, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
3905 *offset += 1;
3906
3907 /* Retrieve "Cluster ID" field */
3908 proto_tree_add_item(tree, hf_zbee_zcl_alarms_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
3909 *offset += 2;
3910
3911} /*dissect_zcl_alarms_alarm_and_reset_alarm*/
3912
3913
3914 /*FUNCTION:--------------------------------------------------------------------
3915 * NAME
3916 * dissect_zcl_alarms_get_alarm_response
3917 * DESCRIPTION
3918 * this function decodes the Get Alarm Response payload
3919 * PARAMETERS
3920 * tvb - the tv buffer of the current data_type
3921 * tree - the tree to append this item to
3922 * offset - offset of data in tvb
3923 * RETURNS
3924 * none
3925 *------------------------------------------------------------------------------
3926 */
3927
3928static void
3929dissect_zcl_alarms_get_alarm_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
3930{
3931 uint8_t status;
3932
3933 /* Retrieve "Status" field */
3934 status = tvb_get_uint8(tvb, *offset);
3935 proto_tree_add_item(tree, hf_zbee_zcl_alarms_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
3936 *offset += 1;
3937
3938 if(status == ZBEE_ZCL_STAT_SUCCESS0x00)
3939 {
3940 /* Retrieve "Alarm Code" field */
3941 proto_tree_add_item(tree, hf_zbee_zcl_alarms_alarm_code, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
3942 *offset += 1;
3943
3944 /* Retrieve "Cluster ID" field */
3945 proto_tree_add_item(tree, hf_zbee_zcl_alarms_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
3946 *offset += 2;
3947
3948 /* Retrieve "Timestamp" field */
3949 proto_tree_add_item(tree, hf_zbee_zcl_alarms_timestamp, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
3950 *offset += 4;
3951 }
3952
3953} /*dissect_zcl_alarms_get_alarm_response*/
3954
3955
3956
3957/*FUNCTION:------------------------------------------------------
3958 * NAME
3959 * dissect_zbee_zcl_alarms
3960 * DESCRIPTION
3961 * ZigBee ZCL Alarms cluster dissector for wireshark.
3962 * PARAMETERS
3963 * tvbuff_t *tvb - pointer to buffer containing raw packet.
3964 * packet_info *pinfo - pointer to packet information fields
3965 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
3966 * RETURNS
3967 * none
3968 *---------------------------------------------------------------
3969 */
3970static int
3971dissect_zbee_zcl_alarms(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
3972{
3973 proto_tree *payload_tree;
3974 zbee_zcl_packet *zcl;
3975 unsigned offset = 0;
3976 uint8_t cmd_id;
3977 int rem_len;
3978
3979 /* Reject the packet if data is NULL */
3980 if (data == NULL((void*)0))
3981 return 0;
3982 zcl = (zbee_zcl_packet *)data;
3983 cmd_id = zcl->cmd_id;
3984
3985 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
3986 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER0x00) {
3987 /* Append the command name to the info column. */
3988 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
3989 val_to_str_const(cmd_id, zbee_zcl_alarms_srv_rx_cmd_names, "Unknown Command"),
3990 zcl->tran_seqno);
3991
3992 /* Add the command ID. */
3993 proto_tree_add_item(tree, hf_zbee_zcl_alarms_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
3994
3995 /* Check if this command has a payload, then add the payload tree */
3996 rem_len = tvb_reported_length_remaining(tvb, ++offset);
3997 if (rem_len > 0) {
3998 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_alarms, NULL((void*)0), "Payload");
3999
4000 /* Call the appropriate command dissector */
4001 switch (cmd_id) {
4002 case ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM0x00:
4003 dissect_zcl_alarms_alarm_and_reset_alarm(tvb, payload_tree, &offset);
4004 break;
4005
4006 case ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALL_ALARMS0x01:
4007 case ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM0x02:
4008 case ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM_LOG0x03:
4009 /* No Payload */
4010 default:
4011 break;
4012 }
4013 }
4014 }
4015 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
4016 /* Append the command name to the info column. */
4017 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
4018 val_to_str_const(cmd_id, zbee_zcl_alarms_srv_tx_cmd_names, "Unknown Command"),
4019 zcl->tran_seqno);
4020
4021 /* Add the command ID. */
4022 proto_tree_add_item(tree, hf_zbee_zcl_alarms_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
4023
4024 /* Check if this command has a payload, then add the payload tree */
4025 rem_len = tvb_reported_length_remaining(tvb, ++offset);
4026 if (rem_len > 0) {
4027 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_alarms, NULL((void*)0), "Payload");
4028
4029 /* Call the appropriate command dissector */
4030 switch (cmd_id) {
4031 case ZBEE_ZCL_CMD_ID_ALARMS_ALARM0x00:
4032 dissect_zcl_alarms_alarm_and_reset_alarm(tvb, payload_tree, &offset);
4033 break;
4034
4035 case ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM_RESPONSE0x01:
4036 dissect_zcl_alarms_get_alarm_response(tvb, payload_tree, &offset);
4037 break;
4038
4039 default:
4040 break;
4041 }
4042 }
4043 }
4044
4045 return tvb_captured_length(tvb);
4046} /*dissect_zbee_zcl_alarms*/
4047
4048
4049
4050
4051
4052/*FUNCTION:------------------------------------------------------
4053 * NAME
4054 * proto_register_zbee_zcl_alarms
4055 * DESCRIPTION
4056 * ZigBee ZCL Alarms cluster protocol registration routine.
4057 * PARAMETERS
4058 * none
4059 * RETURNS
4060 * void
4061 *---------------------------------------------------------------
4062 */
4063void
4064proto_register_zbee_zcl_alarms(void)
4065{
4066 /* Setup list of header fields */
4067 static hf_register_info hf[] = {
4068
4069 { &hf_zbee_zcl_alarms_attr_id,
4070 { "Attribute", "zbee_zcl_general.alarms.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_alarms_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_alarms_attr_names
))))
,
4071 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4072
4073 { &hf_zbee_zcl_alarms_alarm_code,
4074 { "Alarm Code", "zbee_zcl_general.alarms.alarm_code", FT_UINT8, BASE_HEX, NULL((void*)0),
4075 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4076
4077 { &hf_zbee_zcl_alarms_cluster_id,
4078 { "Cluster ID", "zbee_zcl_general.alarms.cluster_id", FT_UINT16, BASE_HEX, NULL((void*)0),
4079 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4080
4081 { &hf_zbee_zcl_alarms_status,
4082 { "Status", "zbee_zcl_general.alarms.status", FT_UINT8, BASE_DEC, VALS(zbee_zcl_status_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_status_names
))))
,
4083 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4084
4085 { &hf_zbee_zcl_alarms_timestamp,
4086 { "Timestamp", "zbee_zcl_general.alarms.timestamp", FT_UINT32, BASE_HEX, NULL((void*)0),
4087 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4088
4089 { &hf_zbee_zcl_alarms_srv_rx_cmd_id,
4090 { "Command", "zbee_zcl_general.alarms.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_alarms_srv_rx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_alarms_srv_rx_cmd_names
))))
,
4091 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4092
4093 { &hf_zbee_zcl_alarms_srv_tx_cmd_id,
4094 { "Command", "zbee_zcl_general.alarms.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_alarms_srv_tx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_alarms_srv_tx_cmd_names
))))
,
4095 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
4096
4097 };
4098
4099 /* ZCL Alarms subtrees */
4100 static int *ett[] = {
4101 &ett_zbee_zcl_alarms
4102 };
4103
4104 /* Register the ZigBee ZCL Alarms cluster protocol name and description */
4105 proto_zbee_zcl_alarms = proto_register_protocol("ZigBee ZCL Alarms", "ZCL Alarms", ZBEE_PROTOABBREV_ZCL_ALARMS"zbee_zcl_general.alarms");
4106 proto_register_field_array(proto_zbee_zcl_alarms, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
4107 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
4108
4109 /* Register the ZigBee ZCL Alarms dissector. */
4110 register_dissector(ZBEE_PROTOABBREV_ZCL_ALARMS"zbee_zcl_general.alarms", dissect_zbee_zcl_alarms, proto_zbee_zcl_alarms);
4111
4112} /*proto_register_zbee_zcl_alarms*/
4113
4114
4115/*FUNCTION:------------------------------------------------------
4116 * NAME
4117 * proto_reg_handoff_zbee_zcl_alarms
4118 * DESCRIPTION
4119 * Hands off the ZCL Alarms dissector.
4120 * PARAMETERS
4121 * none
4122 * RETURNS
4123 * none
4124 *---------------------------------------------------------------
4125 */
4126void
4127proto_reg_handoff_zbee_zcl_alarms(void)
4128{
4129 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ALARMS"zbee_zcl_general.alarms",
4130 proto_zbee_zcl_alarms,
4131 ett_zbee_zcl_alarms,
4132 ZBEE_ZCL_CID_ALARMS0x0009,
4133 ZBEE_MFG_CODE_NONE0x0000,
4134 hf_zbee_zcl_alarms_attr_id,
4135 hf_zbee_zcl_alarms_attr_id,
4136 hf_zbee_zcl_alarms_srv_rx_cmd_id,
4137 hf_zbee_zcl_alarms_srv_tx_cmd_id,
4138 (zbee_zcl_fn_attr_data)dissect_zcl_alarms_attr_data
4139 );
4140} /*proto_reg_handoff_zbee_zcl_alarms*/
4141
4142
4143/* ########################################################################## */
4144/* #### (0x000A) TIME CLUSTER ############################################### */
4145/* ########################################################################## */
4146
4147/*************************/
4148/* Defines */
4149/*************************/
4150
4151/* Attributes */
4152#define ZBEE_ZCL_ATTR_ID_TIME_TIME0x0000 0x0000 /* Time */
4153#define ZBEE_ZCL_ATTR_ID_TIME_TIME_STATUS0x0001 0x0001 /* Time Status */
4154#define ZBEE_ZCL_ATTR_ID_TIME_TIME_ZONE0x0002 0x0002 /* Time Zone */
4155#define ZBEE_ZCL_ATTR_ID_TIME_DST_START0x0003 0x0003 /* Daylight Saving Time Start*/
4156#define ZBEE_ZCL_ATTR_ID_TIME_DST_END0x0004 0x0004 /* Daylight Saving Time End */
4157#define ZBEE_ZCL_ATTR_ID_TIME_DST_SHIFT0x0005 0x0005 /* Daylight Saving Time Shift */
4158#define ZBEE_ZCL_ATTR_ID_TIME_STD_TIME0x0006 0x0006 /* Standard Time */
4159#define ZBEE_ZCL_ATTR_ID_TIME_LOCAL_TIME0x0007 0x0007 /* Local Time */
4160#define ZBEE_ZCL_ATTR_ID_TIME_LAST_SET_TIME0x0008 0x0008 /* Last Set Time */
4161#define ZBEE_ZCL_ATTR_ID_TIME_VALID_UNTIL_TIME0x0009 0x0009 /* Valid Until Time */
4162
4163/* Server commands received - none */
4164
4165/* Server commands generated - none */
4166
4167/* Time Status Mask Value */
4168#define ZBEE_ZCL_TIME_MASTER0x01 0x01 /* Master Clock */
4169#define ZBEE_ZCL_TIME_SYNCHRONIZED0x02 0x02 /* Synchronized */
4170#define ZBEE_ZCL_TIME_MASTER_ZONE_DST0x04 0x04 /* Master for Time Zone and DST */
4171#define ZBEE_ZCL_TIME_SUPERSEDING0x08 0x08 /* Superseded */
4172
4173/*************************/
4174/* Function Declarations */
4175/*************************/
4176
4177void proto_register_zbee_zcl_time(void);
4178void proto_reg_handoff_zbee_zcl_time(void);
4179
4180
4181/*************************/
4182/* Global Variables */
4183/*************************/
4184/* Initialize the protocol and registered fields */
4185static int proto_zbee_zcl_time;
4186
4187static int hf_zbee_zcl_time_attr_id;
4188static int hf_zbee_zcl_time_status;
4189static int hf_zbee_zcl_time_status_master;
4190static int hf_zbee_zcl_time_status_synchronized;
4191static int hf_zbee_zcl_time_status_master_zone_dst;
4192static int hf_zbee_zcl_time_status_superseding;
4193
4194/* Initialize the subtree pointers */
4195static int ett_zbee_zcl_time;
4196static int ett_zbee_zcl_time_status_mask;
4197
4198/* Attributes */
4199static const value_string zbee_zcl_time_attr_names[] = {
4200 { ZBEE_ZCL_ATTR_ID_TIME_TIME0x0000, "Time" },
4201 { ZBEE_ZCL_ATTR_ID_TIME_TIME_STATUS0x0001, "Time Status" },
4202 { ZBEE_ZCL_ATTR_ID_TIME_TIME_ZONE0x0002, "Time Zone" },
4203 { ZBEE_ZCL_ATTR_ID_TIME_DST_START0x0003, "Daylight Saving Time Start" },
4204 { ZBEE_ZCL_ATTR_ID_TIME_DST_END0x0004, "Daylight Saving Time End" },
4205 { ZBEE_ZCL_ATTR_ID_TIME_DST_SHIFT0x0005, "Daylight Saving Time Shift" },
4206 { ZBEE_ZCL_ATTR_ID_TIME_STD_TIME0x0006, "Standard Time" },
4207 { ZBEE_ZCL_ATTR_ID_TIME_LOCAL_TIME0x0007, "Local Time" },
4208 { ZBEE_ZCL_ATTR_ID_TIME_LAST_SET_TIME0x0008, "Last Set Time" },
4209 { ZBEE_ZCL_ATTR_ID_TIME_VALID_UNTIL_TIME0x0009, "Valid Until Time" },
4210 { 0, NULL((void*)0) }
4211};
4212
4213/*************************/
4214/* Function Bodies */
4215/*************************/
4216
4217/*FUNCTION:------------------------------------------------------
4218 * NAME
4219 * dissect_zcl_time_attr_data
4220 * DESCRIPTION
4221 * this function is called by ZCL foundation dissector in order to decode
4222 * specific cluster attributes data.
4223 * PARAMETERS
4224 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
4225 * tvbuff_t *tvb - pointer to buffer containing raw packet.
4226 * unsigned *offset - pointer to buffer offset
4227 * uint16_t attr_id - attribute identifier
4228 * unsigned data_type - attribute data type
4229 * bool client_attr- ZCL client
4230 * RETURNS
4231 * none
4232 *--------------------------------------------------------------- */
4233static void
4234dissect_zcl_time_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
4235{
4236 static int * const time_status_mask[] = {
4237 &hf_zbee_zcl_time_status_master,
4238 &hf_zbee_zcl_time_status_synchronized,
4239 &hf_zbee_zcl_time_status_master_zone_dst,
4240 &hf_zbee_zcl_time_status_superseding,
4241 NULL((void*)0)
4242 };
4243
4244 /* Dissect attribute data type and data */
4245 switch (attr_id) {
4246
4247 case ZBEE_ZCL_ATTR_ID_TIME_TIME_STATUS0x0001:
4248 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_time_status, ett_zbee_zcl_time_status_mask, time_status_mask, ENC_LITTLE_ENDIAN0x80000000);
4249 *offset += 1;
4250 break;
4251
4252 case ZBEE_ZCL_ATTR_ID_TIME_TIME0x0000:
4253 case ZBEE_ZCL_ATTR_ID_TIME_TIME_ZONE0x0002:
4254 case ZBEE_ZCL_ATTR_ID_TIME_DST_START0x0003:
4255 case ZBEE_ZCL_ATTR_ID_TIME_DST_END0x0004:
4256 case ZBEE_ZCL_ATTR_ID_TIME_DST_SHIFT0x0005:
4257 case ZBEE_ZCL_ATTR_ID_TIME_STD_TIME0x0006:
4258 case ZBEE_ZCL_ATTR_ID_TIME_LOCAL_TIME0x0007:
4259 case ZBEE_ZCL_ATTR_ID_TIME_LAST_SET_TIME0x0008:
4260 case ZBEE_ZCL_ATTR_ID_TIME_VALID_UNTIL_TIME0x0009:
4261 default:
4262 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
4263 break;
4264 }
4265
4266} /*dissect_zcl_time_attr_data*/
4267/*FUNCTION:------------------------------------------------------
4268 * NAME
4269 * dissect_zbee_zcl_time
4270 * DESCRIPTION
4271 * ZigBee ZCL Time cluster dissector for wireshark.
4272 * PARAMETERS
4273 * tvbuff_t *tvb - pointer to buffer containing raw packet.
4274 * packet_info *pinfo - pointer to packet information fields
4275 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
4276 * RETURNS
4277 * none
4278 *---------------------------------------------------------------
4279 */
4280
4281static int
4282dissect_zbee_zcl_time(tvbuff_t _U___attribute__((unused)) *tvb, packet_info _U___attribute__((unused)) * pinfo, proto_tree _U___attribute__((unused))* tree, void _U___attribute__((unused))* data)
4283{
4284 /* No commands is being received and generated by server
4285 * No cluster specific commands are received by client
4286 */
4287 return 0;
4288} /*dissect_zbee_zcl_time*/
4289
4290/*FUNCTION:------------------------------------------------------
4291 * NAME
4292 * proto_register_zbee_zcl_time
4293 * DESCRIPTION
4294 * ZigBee ZCL Time cluster protocol registration routine.
4295 * PARAMETERS
4296 * none
4297 * RETURNS
4298 * void
4299 *---------------------------------------------------------------
4300 */
4301void
4302proto_register_zbee_zcl_time(void)
4303{
4304 /* Setup list of header fields */
4305 static hf_register_info hf[] = {
4306
4307 { &hf_zbee_zcl_time_attr_id,
4308 { "Attribute", "zbee_zcl_general.time.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_time_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_time_attr_names
))))
,
4309 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4310
4311 /* start Time Status Mask fields */
4312 { &hf_zbee_zcl_time_status,
4313 { "Time Status", "zbee_zcl_general.time.attr.time_status", FT_UINT8, BASE_HEX, NULL((void*)0),
4314 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4315
4316 { &hf_zbee_zcl_time_status_master,
4317 { "Master", "zbee_zcl_general.time.attr.time_status.master", FT_BOOLEAN, 8, NULL((void*)0),
4318 ZBEE_ZCL_TIME_MASTER0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4319
4320 { &hf_zbee_zcl_time_status_synchronized,
4321 { "Synchronized", "zbee_zcl_general.time.attr.time_status.synchronized", FT_BOOLEAN, 8, NULL((void*)0),
4322 ZBEE_ZCL_TIME_SYNCHRONIZED0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4323
4324 { &hf_zbee_zcl_time_status_master_zone_dst,
4325 { "Master for Time Zone and DST", "zbee_zcl_general.time.attr.time_status.master_zone_dst", FT_BOOLEAN, 8, NULL((void*)0),
4326 ZBEE_ZCL_TIME_MASTER_ZONE_DST0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4327
4328 { &hf_zbee_zcl_time_status_superseding,
4329 { "Superseded", "zbee_zcl_general.time.attr.time_status.superseding", FT_BOOLEAN, 8, NULL((void*)0),
4330 ZBEE_ZCL_TIME_SUPERSEDING0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
4331 /* end Time Status Mask fields */
4332 };
4333
4334 /* ZCL Time subtrees */
4335 static int *ett[] = {
4336 &ett_zbee_zcl_time,
4337 &ett_zbee_zcl_time_status_mask
4338 };
4339
4340 /* Register the ZigBee ZCL Time cluster protocol name and description */
4341 proto_zbee_zcl_time = proto_register_protocol("ZigBee ZCL Time", "ZCL Time", ZBEE_PROTOABBREV_ZCL_TIME"zbee_zcl_general.time");
4342 proto_register_field_array(proto_zbee_zcl_time, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
4343 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
4344
4345 /* Register the ZigBee ZCL Time dissector. */
4346 register_dissector(ZBEE_PROTOABBREV_ZCL_TIME"zbee_zcl_general.time", dissect_zbee_zcl_time, proto_zbee_zcl_time);
4347} /*proto_register_zbee_zcl_time*/
4348
4349/*FUNCTION:------------------------------------------------------
4350 * NAME
4351 * proto_reg_handoff_zbee_zcl_time
4352 * DESCRIPTION
4353 * Hands off the ZCL Time dissector.
4354 * PARAMETERS
4355 * none
4356 * RETURNS
4357 * none
4358 *---------------------------------------------------------------
4359 */
4360void
4361proto_reg_handoff_zbee_zcl_time(void)
4362{
4363 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_TIME"zbee_zcl_general.time",
4364 proto_zbee_zcl_time,
4365 ett_zbee_zcl_time,
4366 ZBEE_ZCL_CID_TIME0x000a,
4367 ZBEE_MFG_CODE_NONE0x0000,
4368 hf_zbee_zcl_time_attr_id,
4369 hf_zbee_zcl_time_attr_id,
4370 -1, -1,
4371 (zbee_zcl_fn_attr_data)dissect_zcl_time_attr_data
4372 );
4373} /*proto_reg_handoff_zbee_zcl_time*/
4374
4375
4376
4377
4378/* ########################################################################## */
4379/* #### (0x0008) LEVEL_CONTROL CLUSTER ###################################### */
4380/* ########################################################################## */
4381
4382/*************************/
4383/* Defines */
4384/*************************/
4385
4386/* Attributes */
4387#define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_CURRENT_LEVEL0x0000 0x0000 /* Current Level */
4388#define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_REMAINING_TIME0x0001 0x0001 /* Remaining Time */
4389#define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ONOFF_TRANSIT_TIME0x0010 0x0010 /* OnOff Transition Time */
4390#define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ON_LEVEL0x0011 0x0011 /* On Level */
4391#define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_STARTUP_LEVEL0x4000 0x4000 /* Startup Level */
4392
4393/* Server Commands Received */
4394#define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL0x00 0x00 /* Move to Level */
4395#define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE0x01 0x01 /* Move */
4396#define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP0x02 0x02 /* Step */
4397#define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP0x03 0x03 /* Stop */
4398#define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL_WITH_ONOFF0x04 0x04 /* Move to Level with OnOff */
4399#define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_WITH_ONOFF0x05 0x05 /* Move with OnOff */
4400#define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP_WITH_ONOFF0x06 0x06 /* Step with OnOff */
4401#define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP_WITH_ONOFF0x07 0x07 /* Stop with OnOff */
4402
4403/*************************/
4404/* Function Declarations */
4405/*************************/
4406
4407void proto_register_zbee_zcl_level_control(void);
4408void proto_reg_handoff_zbee_zcl_level_control(void);
4409
4410/* Private functions prototype */
4411
4412/*************************/
4413/* Global Variables */
4414/*************************/
4415/* Initialize the protocol and registered fields */
4416static int proto_zbee_zcl_level_control;
4417
4418static int hf_zbee_zcl_level_control_attr_id;
4419static int hf_zbee_zcl_level_control_attr_current_level;
4420static int hf_zbee_zcl_level_control_attr_remaining_time;
4421static int hf_zbee_zcl_level_control_attr_onoff_transmit_time;
4422static int hf_zbee_zcl_level_control_attr_on_level;
4423static int hf_zbee_zcl_level_control_attr_startup_level;
4424static int hf_zbee_zcl_level_control_level;
4425static int hf_zbee_zcl_level_control_move_mode;
4426static int hf_zbee_zcl_level_control_rate;
4427static int hf_zbee_zcl_level_control_step_mode;
4428static int hf_zbee_zcl_level_control_step_size;
4429static int hf_zbee_zcl_level_control_transit_time;
4430static int hf_zbee_zcl_level_control_srv_rx_cmd_id;
4431
4432/* Initialize the subtree pointers */
4433static int ett_zbee_zcl_level_control;
4434
4435/* Attributes */
4436static const value_string zbee_zcl_level_control_attr_names[] = {
4437 { ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_CURRENT_LEVEL0x0000, "Current Level" },
4438 { ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_REMAINING_TIME0x0001, "Remaining Time" },
4439 { ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ONOFF_TRANSIT_TIME0x0010, "OnOff Transition Time" },
4440 { ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ON_LEVEL0x0011, "On Level" },
4441 { ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_STARTUP_LEVEL0x4000, "Startup Level" },
4442 { 0, NULL((void*)0) }
4443};
4444
4445/* Server Commands Received */
4446static const value_string zbee_zcl_level_control_srv_rx_cmd_names[] = {
4447 { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL0x00, "Move to Level" },
4448 { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE0x01, "Move" },
4449 { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP0x02, "Step" },
4450 { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP0x03, "Stop" },
4451 { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL_WITH_ONOFF0x04, "Move to Level with OnOff" },
4452 { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_WITH_ONOFF0x05, "Move with OnOff" },
4453 { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP_WITH_ONOFF0x06, "Step with OnOff" },
4454 { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP_WITH_ONOFF0x07, "Stop with OnOff" },
4455 { 0, NULL((void*)0) }
4456};
4457
4458/* Move Mode Values */
4459static const value_string zbee_zcl_level_control_move_step_mode_values[] = {
4460 { 0x00, "Up" },
4461 { 0x01, "Down" },
4462 { 0, NULL((void*)0) }
4463};
4464
4465static const range_string zbee_zcl_level_control_startup_level_names[] = {
4466 { 0x00, 0x00, "Set the CurrentLevel attribute to the minimum" },
4467 { 0x01, 0xFE, "Set the CurrentLevel attribute to this value" },
4468 { 0xFF, 0xFF, "Set the CurrentLevel attribute to its previous value" },
4469 { 0, 0, NULL((void*)0) }
4470};
4471
4472/*************************/
4473/* Function Bodies */
4474/*************************/
4475/*FUNCTION:------------------------------------------------------
4476 * NAME
4477 * dissect_zcl_level_control_move_to_level
4478 * DESCRIPTION
4479 * this function decodes the Move to Level payload.
4480 * PARAMETERS
4481 * tvb - the tv buffer of the current data_type
4482 * tree - the tree to append this item to
4483 * offset - offset of data in tvb
4484 * RETURNS
4485 * none
4486 *---------------------------------------------------------------
4487 */
4488static void
4489dissect_zcl_level_control_move_to_level(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
4490{
4491 /* Retrieve "Level" field */
4492 proto_tree_add_item(tree, hf_zbee_zcl_level_control_level, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
4493 *offset += 1;
4494
4495 /* Retrieve "Transition Time" field */
4496 proto_tree_add_item(tree, hf_zbee_zcl_level_control_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
4497 *offset += 2;
4498
4499} /*dissect_zcl_level_control_move_to_level*/
4500
4501
4502 /*FUNCTION:--------------------------------------------------------------------
4503 * NAME
4504 * dissect_zcl_level_control_move
4505 * DESCRIPTION
4506 * this function decodes the Move payload
4507 * PARAMETERS
4508 * tvb - the tv buffer of the current data_type
4509 * tree - the tree to append this item to
4510 * offset - offset of data in tvb
4511 * RETURNS
4512 * none
4513 *------------------------------------------------------------------------------
4514 */
4515
4516static void
4517dissect_zcl_level_control_move(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
4518{
4519 /* Retrieve "Move Mode" field */
4520 proto_tree_add_item(tree, hf_zbee_zcl_level_control_move_mode, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
4521 *offset += 1;
4522
4523 /* Retrieve "Rate" field */
4524 proto_tree_add_item(tree, hf_zbee_zcl_level_control_rate, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
4525 *offset += 1;
4526
4527} /*dissect_zcl_level_control_move*/
4528
4529
4530/*FUNCTION:-------------------------------------------------------------------
4531* NAME
4532* dissect_zcl_level_control_step
4533* DESCRIPTION
4534* this function decodes the Step payload.
4535* PARAMETERS
4536* tvb - the tv buffer of the current data_type
4537* tree - the tree to append this item to
4538* offset - offset of data in tvb
4539* RETURNS
4540* none
4541*-----------------------------------------------------------------------------
4542*/
4543static void
4544dissect_zcl_level_control_step(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
4545{
4546 /* Retrieve "Step Mode" field */
4547 proto_tree_add_item(tree, hf_zbee_zcl_level_control_step_mode, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
4548 *offset += 1;
4549
4550 /* Retrieve "Step Size" field */
4551 proto_tree_add_item(tree, hf_zbee_zcl_level_control_step_size, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
4552 *offset += 1;
4553
4554 /* Retrieve "Transition Time" field */
4555 proto_tree_add_item(tree, hf_zbee_zcl_level_control_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
4556 *offset += 2;
4557
4558} /*dissect_zcl_level_control_step*/
4559
4560
4561/*FUNCTION:------------------------------------------------------
4562 * NAME
4563 * dissect_zcl_level_control_attr_data
4564 * DESCRIPTION
4565 * this function is called by ZCL foundation dissector in order to decode
4566 * specific cluster attributes data.
4567 * PARAMETERS
4568 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
4569 * tvbuff_t *tvb - pointer to buffer containing raw packet.
4570 * unsigned *offset - pointer to buffer offset
4571 * uint16_t attr_id - attribute identifier
4572 * unsigned data_type - attribute data type
4573 * RETURNS
4574 * none
4575 *---------------------------------------------------------------
4576 */
4577
4578/*FUNCTION:------------------------------------------------------
4579 * NAME
4580 * dissect_zbee_zcl_level_control
4581 * DESCRIPTION
4582 * ZigBee ZCL Level Control cluster dissector for wireshark.
4583 * PARAMETERS
4584 * tvbuff_t *tvb - pointer to buffer containing raw packet.
4585 * packet_info *pinfo - pointer to packet information fields
4586 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
4587 * RETURNS
4588 * none
4589 *---------------------------------------------------------------
4590 */
4591static int
4592dissect_zbee_zcl_level_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
4593{
4594 proto_tree *payload_tree;
4595 zbee_zcl_packet *zcl;
4596 unsigned offset = 0;
4597 uint8_t cmd_id;
4598 int rem_len;
4599
4600 /* Reject the packet if data is NULL */
4601 if (data == NULL((void*)0))
4602 return 0;
4603 zcl = (zbee_zcl_packet *)data;
4604 cmd_id = zcl->cmd_id;
4605
4606 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
4607 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER0x00) {
4608 /* Append the command name to the info column. */
4609 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
4610 val_to_str_const(cmd_id, zbee_zcl_level_control_srv_rx_cmd_names, "Unknown Command"),
4611 zcl->tran_seqno);
4612
4613 /* Add the command ID. */
4614 proto_tree_add_item(tree, hf_zbee_zcl_level_control_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
4615
4616 /* Check if this command has a payload, then add the payload tree */
4617 rem_len = tvb_reported_length_remaining(tvb, ++offset);
4618 if (rem_len > 0) {
4619 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_level_control, NULL((void*)0), "Payload");
4620
4621 /* Call the appropriate command dissector */
4622 switch (cmd_id) {
4623 case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL0x00:
4624 case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL_WITH_ONOFF0x04:
4625 dissect_zcl_level_control_move_to_level(tvb, payload_tree, &offset);
4626 break;
4627
4628 case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE0x01:
4629 case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_WITH_ONOFF0x05:
4630 dissect_zcl_level_control_move(tvb, payload_tree, &offset);
4631 break;
4632
4633 case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP0x02:
4634 case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP_WITH_ONOFF0x06:
4635 dissect_zcl_level_control_step(tvb, payload_tree, &offset);
4636 break;
4637
4638 case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP0x03:
4639 case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP_WITH_ONOFF0x07:
4640 /* No Payload */
4641 default:
4642 break;
4643 }
4644 }
4645 }
4646
4647 return tvb_captured_length(tvb);
4648} /*dissect_zbee_zcl_level_control*/
4649
4650
4651
4652static void
4653dissect_zcl_level_control_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
4654{
4655 /* Dissect attribute data type and data */
4656 switch ( attr_id ) {
4657 case ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_CURRENT_LEVEL0x0000:
4658 proto_tree_add_item(tree, hf_zbee_zcl_level_control_attr_current_level, tvb, *offset, 1, ENC_NA0x00000000);
4659 *offset += 1;
4660 break;
4661
4662 case ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_REMAINING_TIME0x0001:
4663 proto_tree_add_item(tree, hf_zbee_zcl_level_control_attr_remaining_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
4664 *offset += 2;
4665 break;
4666
4667 case ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ONOFF_TRANSIT_TIME0x0010:
4668 proto_tree_add_item(tree, hf_zbee_zcl_level_control_attr_onoff_transmit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
4669 *offset += 2;
4670 break;
4671
4672 case ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ON_LEVEL0x0011:
4673 proto_tree_add_item(tree, hf_zbee_zcl_level_control_attr_on_level, tvb, *offset, 1, ENC_NA0x00000000);
4674 *offset += 1;
4675 break;
4676
4677 case ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_STARTUP_LEVEL0x4000:
4678 proto_tree_add_item(tree, hf_zbee_zcl_level_control_attr_startup_level, tvb, *offset, 1, ENC_NA0x00000000);
4679 *offset += 1;
4680 break;
4681
4682 default:
4683 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
4684 break;
4685 }
4686
4687} /*dissect_zcl_level_control_attr_data*/
4688
4689
4690/*FUNCTION:------------------------------------------------------
4691 * NAME
4692 * proto_register_zbee_zcl_level_control
4693 * DESCRIPTION
4694 * ZigBee ZCL Level Control cluster protocol registration routine.
4695 * PARAMETERS
4696 * none
4697 * RETURNS
4698 * void
4699 *---------------------------------------------------------------
4700 */
4701void
4702proto_register_zbee_zcl_level_control(void)
4703{
4704 /* Setup list of header fields */
4705 static hf_register_info hf[] = {
4706
4707 { &hf_zbee_zcl_level_control_attr_id,
4708 { "Attribute", "zbee_zcl_general.level_control.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_level_control_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_level_control_attr_names
))))
,
4709 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4710
4711 { &hf_zbee_zcl_level_control_attr_current_level,
4712 { "Current Level", "zbee_zcl_general.level_control.attr.current_level", FT_UINT8, BASE_DEC, NULL((void*)0),
4713 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4714
4715 { &hf_zbee_zcl_level_control_attr_remaining_time,
4716 { "Remaining Time", "zbee_zcl_general.level_control.attr.remaining_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms)((const void *) (size_t) (decode_zcl_time_in_100ms)),
4717 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4718
4719 { &hf_zbee_zcl_level_control_attr_onoff_transmit_time,
4720 { "Current Level", "zbee_zcl_general.level_control.attr.onoff_transmit_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms)((const void *) (size_t) (decode_zcl_time_in_100ms)),
4721 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4722
4723 { &hf_zbee_zcl_level_control_attr_on_level,
4724 { "On Level", "zbee_zcl_general.level_control.attr.on_level", FT_UINT8, BASE_DEC, NULL((void*)0),
4725 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4726
4727 { &hf_zbee_zcl_level_control_attr_startup_level,
4728 { "Startup Level", "zbee_zcl_general.level_control.attr.startup_level", FT_UINT8, BASE_HEX | BASE_RANGE_STRING0x00000100, RVALS(zbee_zcl_level_control_startup_level_names)((0 ? (const struct _range_string*)0 : ((zbee_zcl_level_control_startup_level_names
))))
,
4729 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4730
4731 { &hf_zbee_zcl_level_control_level,
4732 { "Level", "zbee_zcl_general.level_control.level", FT_UINT8, BASE_DEC, NULL((void*)0),
4733 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4734
4735 { &hf_zbee_zcl_level_control_move_mode,
4736 { "Move Mode", "zbee_zcl_general.level_control.move_mode", FT_UINT8, BASE_HEX, VALS(zbee_zcl_level_control_move_step_mode_values)((0 ? (const struct _value_string*)0 : ((zbee_zcl_level_control_move_step_mode_values
))))
,
4737 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4738
4739 { &hf_zbee_zcl_level_control_rate,
4740 { "Rate", "zbee_zcl_general.level_control.rate", FT_UINT8, BASE_DEC, NULL((void*)0),
4741 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4742
4743 { &hf_zbee_zcl_level_control_step_mode,
4744 { "Step Mode", "zbee_zcl_general.level_control.step_mode", FT_UINT8, BASE_HEX, VALS(zbee_zcl_level_control_move_step_mode_values)((0 ? (const struct _value_string*)0 : ((zbee_zcl_level_control_move_step_mode_values
))))
,
4745 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4746
4747 { &hf_zbee_zcl_level_control_step_size,
4748 { "Step Size", "zbee_zcl_general.level_control.step_size", FT_UINT8, BASE_DEC, NULL((void*)0),
4749 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4750
4751 { &hf_zbee_zcl_level_control_transit_time,
4752 { "Transition Time", "zbee_zcl_general.level_control.transit_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms)((const void *) (size_t) (decode_zcl_time_in_100ms)),
4753 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
4754
4755 { &hf_zbee_zcl_level_control_srv_rx_cmd_id,
4756 { "Command", "zbee_zcl_general.level_control.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_level_control_srv_rx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_level_control_srv_rx_cmd_names
))))
,
4757 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
4758
4759 };
4760
4761 /* ZCL Identify subtrees */
4762 static int *ett[] = {
4763 &ett_zbee_zcl_level_control
4764 };
4765
4766 /* Register the ZigBee ZCL Level Control cluster protocol name and description */
4767 proto_zbee_zcl_level_control = proto_register_protocol("ZigBee ZCL Level Control", "ZCL Level Control", ZBEE_PROTOABBREV_ZCL_LEVEL_CONTROL"zbee_zcl_general.level_control");
4768 proto_register_field_array(proto_zbee_zcl_level_control, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
4769 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
4770
4771 /* Register the ZigBee ZCL Level Control dissector. */
4772 register_dissector(ZBEE_PROTOABBREV_ZCL_LEVEL_CONTROL"zbee_zcl_general.level_control", dissect_zbee_zcl_level_control, proto_zbee_zcl_level_control);
4773
4774} /*proto_register_zbee_zcl_level_control*/
4775
4776
4777/*FUNCTION:------------------------------------------------------
4778 * NAME
4779 * proto_reg_handoff_zbee_zcl_level_control
4780 * DESCRIPTION
4781 * Hands off the ZCL Level Control dissector.
4782 * PARAMETERS
4783 * none
4784 * RETURNS
4785 * none
4786 *---------------------------------------------------------------
4787 */
4788void
4789proto_reg_handoff_zbee_zcl_level_control(void)
4790{
4791 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_LEVEL_CONTROL"zbee_zcl_general.level_control",
4792 proto_zbee_zcl_level_control,
4793 ett_zbee_zcl_level_control,
4794 ZBEE_ZCL_CID_LEVEL_CONTROL0x0008,
4795 ZBEE_MFG_CODE_NONE0x0000,
4796 hf_zbee_zcl_level_control_attr_id,
4797 hf_zbee_zcl_level_control_attr_id,
4798 hf_zbee_zcl_level_control_srv_rx_cmd_id,
4799 -1,
4800 (zbee_zcl_fn_attr_data)dissect_zcl_level_control_attr_data
4801 );
4802} /*proto_reg_handoff_zbee_zcl_level_control*/
4803
4804
4805/* ########################################################################## */
4806/* #### (0x000B) RSSI LOCATION CLUSTER ###################################### */
4807/* ########################################################################## */
4808
4809/*************************/
4810/* Defines */
4811/*************************/
4812
4813/* Attributes */
4814#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE0x0000 0x0000 /* Location Type */
4815#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD0x0001 0x0001 /* Location Method */
4816#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_AGE0x0002 0x0002 /* Location Age */
4817#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_QUALITY_MEASURE0x0003 0x0003 /* Quality Measure */
4818#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_OF_DEVICES0x0004 0x0004 /* Number of Devices */
4819#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_10x0010 0x0010 /* Coordinate 1 */
4820#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_20x0011 0x0011 /* Coordinate 2 */
4821#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_30x0012 0x0012 /* Coordinate 3 */
4822#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_POWER0x0013 0x0013 /* Power */
4823#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_PATH_LOSS_EXPONENT0x0014 0x0014 /* Path Loss Exponent */
4824#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_REPORTING_PERIOD0x0015 0x0015 /* Reporting Period */
4825#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_CALCULATION_PERIOD0x0016 0x0016 /* Calculation Period */
4826#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_RSSI_MEAS0x0017 0x0017 /* Number RSSI Measurements */
4827
4828/* Location Type Mask Values */
4829#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_ABSOLUTE0x01 0x01 /* Absolute/Measured */
4830#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_2D0x02 0x02 /* 2D/3D */
4831#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_COORDINATE0x0C 0x0C /* Coordinate System */
4832#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_RESERVED0xF0 0xF0 /* Coordinate System */
4833
4834/* Location Method Values */
4835#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_LATERATION0x00 0x00 /* Lateration */
4836#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_SIGNPOSTING0x01 0x01 /* Signposting */
4837#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_RF_FINGERPRINTING0x02 0x02 /* RF Fingerprinting */
4838#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_OUT_OF_BAND0x03 0x03 /* Out of Band */
4839#define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_CENTRALIZED0x04 0x04 /* Centralized */
4840
4841/* Server Commands Received */
4842#define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_ABSOLUTE_LOCATION0x00 0x00 /* Set Absolute Location */
4843#define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_DEVICE_CONFIG0x01 0x01 /* Set Device Configuration */
4844#define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_DEVICE_CONFIG0x02 0x02 /* Get Device Configuration */
4845#define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_LOCATION_DATA0x03 0x03 /* Get Location Data */
4846#define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_RESPONSE0x04 0x04 /* RSSI Response */
4847#define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SEND_PINGS0x05 0x05 /* Send Pings */
4848#define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_ANCHOR_NODE_ANNOUNCE0x06 0x06 /* Anchor Node Announce */
4849
4850
4851/* Server Commands Generated */
4852#define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_DEVICE_CONFIG_RESPONSE0x00 0x00 /* Device Configuration Response */
4853#define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_RESPONSE0x01 0x01 /* Location Data Response */
4854#define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_NOTIF0x02 0x02 /* Location Data Notification */
4855#define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_COMPACT_LOCATION_DATA_NOTIF0x03 0x03 /* Compact Location Data Notification */
4856#define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_PING0x04 0x04 /* RSSI Ping */
4857#define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_REQUEST0x05 0x05 /* RSSI Request */
4858#define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REPORT_RSSI_MEAS0x06 0x06 /* Report RSSI Measurements */
4859#define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REQUEST_OWN_LOCATION0x07 0x07 /* Request Own Location */
4860
4861
4862/*************************/
4863/* Function Declarations */
4864/*************************/
4865
4866void proto_register_zbee_zcl_rssi_location(void);
4867void proto_reg_handoff_zbee_zcl_rssi_location(void);
4868
4869/* Command Dissector Helpers */
4870static void dissect_zcl_rssi_location_set_absolute_location (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4871static void dissect_zcl_rssi_location_set_device_config (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4872static void dissect_zcl_rssi_location_get_device_config (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4873static void dissect_zcl_rssi_location_get_location_data (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4874static void dissect_zcl_rssi_location_rssi_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4875static void dissect_zcl_rssi_location_send_pings (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4876static void dissect_zcl_rssi_location_anchor_node_announce (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4877
4878static void dissect_zcl_rssi_location_device_config_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4879static void dissect_zcl_rssi_location_location_data_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4880static void dissect_zcl_rssi_location_location_data_notif (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4881static void dissect_zcl_rssi_location_compact_location_data_notif (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4882static void dissect_zcl_rssi_location_rssi_ping (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4883static void dissect_zcl_rssi_location_report_rssi_meas (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4884static void dissect_zcl_rssi_location_request_own_location (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
4885
4886static void dissect_zcl_rssi_location_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
4887
4888/* Private functions prototype */
4889
4890/*************************/
4891/* Global Variables */
4892/*************************/
4893/* Initialize the protocol and registered fields */
4894static int proto_zbee_zcl_rssi_location;
4895
4896static int hf_zbee_zcl_rssi_location_attr_id;
4897static int hf_zbee_zcl_rssi_location_location_type;
4898static int hf_zbee_zcl_rssi_location_location_type_absolute;
4899static int hf_zbee_zcl_rssi_location_location_type_2D;
4900static int hf_zbee_zcl_rssi_location_location_type_coordinate_system;
4901static int hf_zbee_zcl_rssi_location_location_type_reserved;
4902static int hf_zbee_zcl_rssi_location_attr_id_location_method;
4903static int hf_zbee_zcl_rssi_location_coordinate1;
4904static int hf_zbee_zcl_rssi_location_coordinate2;
4905static int hf_zbee_zcl_rssi_location_coordinate3;
4906static int hf_zbee_zcl_rssi_location_power;
4907static int hf_zbee_zcl_rssi_location_path_loss_expo;
4908static int hf_zbee_zcl_rssi_location_calc_period;
4909static int hf_zbee_zcl_rssi_location_number_rssi_meas;
4910static int hf_zbee_zcl_rssi_location_reporting_period;
4911static int hf_zbee_zcl_rssi_location_target_add;
4912static int hf_zbee_zcl_rssi_location_header;
4913static int hf_zbee_zcl_rssi_location_header_abs_only;
4914static int hf_zbee_zcl_rssi_location_header_recalc;
4915static int hf_zbee_zcl_rssi_location_header_bcast_ind;
4916static int hf_zbee_zcl_rssi_location_header_bcast_res;
4917static int hf_zbee_zcl_rssi_location_header_compact_res;
4918static int hf_zbee_zcl_rssi_location_header_res;
4919static int hf_zbee_zcl_rssi_location_number_responses;
4920static int hf_zbee_zcl_rssi_location_replaying_device;
4921static int hf_zbee_zcl_rssi_location_rssi;
4922static int hf_zbee_zcl_rssi_location_anchor_node_add;
4923static int hf_zbee_zcl_rssi_location_status;
4924static int hf_zbee_zcl_rssi_location_quality_measure;
4925static int hf_zbee_zcl_rssi_location_location_age;
4926static int hf_zbee_zcl_rssi_location_reporting_add;
4927static int hf_zbee_zcl_rssi_location_no_of_neigh;
4928static int hf_zbee_zcl_rssi_location_neighbour_add;
4929static int hf_zbee_zcl_rssi_location_request_add;
4930static int hf_zbee_zcl_rssi_location_srv_rx_cmd_id;
4931static int hf_zbee_zcl_rssi_location_srv_tx_cmd_id;
4932
4933/* Initialize the subtree pointers */
4934static int ett_zbee_zcl_rssi_location;
4935static int ett_zbee_zcl_rssi_location_location_type;
4936static int ett_zbee_zcl_rssi_location_header;
4937
4938/* Attributes */
4939static const value_string zbee_zcl_rssi_location_attr_names[] = {
4940 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE0x0000, "Location Type" },
4941 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD0x0001, "Location Method" },
4942 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_AGE0x0002, "Location Age" },
4943 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_QUALITY_MEASURE0x0003, "Quality Measure" },
4944 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_OF_DEVICES0x0004, "Number of Devices" },
4945 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_10x0010, "Coordinate 1" },
4946 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_20x0011, "Coordinate 2" },
4947 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_30x0012, "Coordinate 3" },
4948 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_POWER0x0013, "Power" },
4949 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_PATH_LOSS_EXPONENT0x0014, "Path Loss Exponent" },
4950 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_REPORTING_PERIOD0x0015, "Reporting Period" },
4951 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_CALCULATION_PERIOD0x0016, "Calculation Period" },
4952 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_RSSI_MEAS0x0017, "Number RSSI Measurements" },
4953 { 0, NULL((void*)0) }
4954};
4955
4956/* Server Commands Received */
4957static const value_string zbee_zcl_rssi_location_srv_rx_cmd_names[] = {
4958 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_ABSOLUTE_LOCATION0x00, "Set Absolute Location" },
4959 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_DEVICE_CONFIG0x01, "Set Device Configuration" },
4960 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_DEVICE_CONFIG0x02, "Get Device Configuration" },
4961 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_LOCATION_DATA0x03, "Get Location Data" },
4962 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_RESPONSE0x04, "RSSI Response" },
4963 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SEND_PINGS0x05, "Send Pings" },
4964 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_ANCHOR_NODE_ANNOUNCE0x06, "Anchor Node Announce" },
4965 { 0, NULL((void*)0) }
4966};
4967
4968/* Server Commands Generated */
4969static const value_string zbee_zcl_rssi_location_srv_tx_cmd_names[] = {
4970 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_DEVICE_CONFIG_RESPONSE0x00, "Device Configuration Response" },
4971 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_RESPONSE0x01, "Location Data Response" },
4972 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_NOTIF0x02, "Location Data Notification" },
4973 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_COMPACT_LOCATION_DATA_NOTIF0x03, "Compact Location Data Notification" },
4974 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_PING0x04, "RSSI Ping" },
4975 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_REQUEST0x05, "RSSI Request" },
4976 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REPORT_RSSI_MEAS0x06, "Report RSSI Measurements" },
4977 { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REQUEST_OWN_LOCATION0x07, "Request Own Location" },
4978 { 0, NULL((void*)0) }
4979};
4980
4981/* Location Method Values */
4982static const value_string zbee_zcl_rssi_location_location_method_values[] = {
4983 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_LATERATION0x00, "Lateration" },
4984 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_SIGNPOSTING0x01, "Signposting" },
4985 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_RF_FINGERPRINTING0x02, "RF Fingerprinting" },
4986 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_OUT_OF_BAND0x03, "Out of Band" },
4987 { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_CENTRALIZED0x04, "Centralized" },
4988 { 0, NULL((void*)0) }
4989};
4990
4991/* Location type absolute values*/
4992static const value_string zbee_zcl_rssi_location_location_type_abs_values[] = {
4993 {0, "Measured Location"},
4994 {1, "Absolute Location"},
4995 {0, NULL((void*)0)}
4996};
4997
4998/* Location type 2D/3D values*/
4999static const value_string zbee_zcl_rssi_location_location_type_2D_values[] = {
5000 {0, "Three Dimensional"},
5001 {1, "Two Dimensional"},
5002 {0, NULL((void*)0)}
5003};
5004
5005/* Location type Coordinate System values*/
5006static const value_string zbee_zcl_rssi_location_location_type_coordinate_values[] = {
5007 {0, "Rectangular"},
5008 {1, "Reserved"},
5009 {2, "Reserved"},
5010 {3, "Reserved"},
5011 {0, NULL((void*)0)}
5012};
5013
5014/*************************/
5015/* Function Bodies */
5016/*************************/
5017
5018/*FUNCTION:------------------------------------------------------
5019 * NAME
5020 * dissect_zbee_zcl_rssi_location
5021 * DESCRIPTION
5022 * ZigBee ZCL RSSI Location cluster dissector for wireshark.
5023 * PARAMETERS
5024 * tvbuff_t *tvb - pointer to buffer containing raw packet.
5025 * packet_info *pinfo - pointer to packet information fields
5026 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
5027 * RETURNS
5028 * none
5029 *---------------------------------------------------------------
5030 */
5031static int
5032dissect_zbee_zcl_rssi_location(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
5033{
5034 proto_tree *payload_tree;
5035 zbee_zcl_packet *zcl;
5036 unsigned offset = 0;
5037 uint8_t cmd_id;
5038 int rem_len;
5039
5040 /* Reject the packet if data is NULL */
5041 if (data == NULL((void*)0))
5042 return 0;
5043 zcl = (zbee_zcl_packet *)data;
5044 cmd_id = zcl->cmd_id;
5045
5046 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
5047 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER0x00) {
5048 /* Append the command name to the info column. */
5049 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
5050 val_to_str_const(cmd_id, zbee_zcl_rssi_location_srv_rx_cmd_names, "Unknown Command"),
5051 zcl->tran_seqno);
5052
5053 /* Add the command ID. */
5054 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5055
5056 /* Check if this command has a payload, then add the payload tree */
5057 rem_len = tvb_reported_length_remaining(tvb, ++offset);
5058 if (rem_len > 0) {
5059 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_rssi_location, NULL((void*)0), "Payload");
5060
5061 /* Call the appropriate command dissector */
5062 switch (cmd_id) {
5063 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_ABSOLUTE_LOCATION0x00:
5064 dissect_zcl_rssi_location_set_absolute_location(tvb, payload_tree, &offset);
5065 break;
5066
5067 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_DEVICE_CONFIG0x01:
5068 dissect_zcl_rssi_location_set_device_config(tvb, payload_tree, &offset);
5069 break;
5070
5071 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_DEVICE_CONFIG0x02:
5072 dissect_zcl_rssi_location_get_device_config(tvb, payload_tree, &offset);
5073 break;
5074
5075 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_LOCATION_DATA0x03:
5076 dissect_zcl_rssi_location_get_location_data(tvb, payload_tree, &offset);
5077 break;
5078
5079 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_RESPONSE0x04:
5080 dissect_zcl_rssi_location_rssi_response(tvb, payload_tree, &offset);
5081 break;
5082
5083 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SEND_PINGS0x05:
5084 dissect_zcl_rssi_location_send_pings(tvb, payload_tree, &offset);
5085 break;
5086
5087 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_ANCHOR_NODE_ANNOUNCE0x06:
5088 dissect_zcl_rssi_location_anchor_node_announce(tvb, payload_tree, &offset);
5089 break;
5090
5091 default:
5092 break;
5093 }
5094 }
5095 }
5096 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
5097 /* Append the command name to the info column. */
5098 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
5099 val_to_str_const(cmd_id, zbee_zcl_rssi_location_srv_tx_cmd_names, "Unknown Command"),
5100 zcl->tran_seqno);
5101
5102 /* Add the command ID. */
5103 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5104
5105 /* Check if this command has a payload, then add the payload tree */
5106 rem_len = tvb_reported_length_remaining(tvb, ++offset);
5107 if (rem_len > 0) {
5108 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_rssi_location, NULL((void*)0), "Payload");
5109
5110 /* Call the appropriate command dissector */
5111 switch (cmd_id) {
5112 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_DEVICE_CONFIG_RESPONSE0x00:
5113 dissect_zcl_rssi_location_device_config_response(tvb, payload_tree, &offset);
5114 break;
5115 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_RESPONSE0x01:
5116 dissect_zcl_rssi_location_location_data_response(tvb, payload_tree, &offset);
5117 break;
5118
5119 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_NOTIF0x02:
5120 dissect_zcl_rssi_location_location_data_notif(tvb, payload_tree, &offset);
5121 break;
5122
5123 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_COMPACT_LOCATION_DATA_NOTIF0x03:
5124 dissect_zcl_rssi_location_compact_location_data_notif(tvb, payload_tree, &offset);
5125 break;
5126
5127 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_PING0x04:
5128 dissect_zcl_rssi_location_rssi_ping(tvb, payload_tree, &offset);
5129 break;
5130
5131 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_REQUEST0x05:
5132 /* No Payload */
5133 break;
5134
5135 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REPORT_RSSI_MEAS0x06:
5136 dissect_zcl_rssi_location_report_rssi_meas(tvb, payload_tree, &offset);
5137 break;
5138
5139 case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REQUEST_OWN_LOCATION0x07:
5140 dissect_zcl_rssi_location_request_own_location(tvb, payload_tree, &offset);
5141 break;
5142
5143 default:
5144 break;
5145 }
5146 }
5147 }
5148
5149 return tvb_captured_length(tvb);
5150} /*dissect_zbee_zcl_rssi_location*/
5151
5152
5153 /*FUNCTION:------------------------------------------------------
5154 * NAME
5155 * dissect_zcl_rssi_location_set_absolute_location
5156 * DESCRIPTION
5157 * this function decodes the Set Absolute Location payload.
5158 * PARAMETERS
5159 * tvb - the tv buffer of the current data_type
5160 * tree - the tree to append this item to
5161 * offset - offset of data in tvb
5162 * RETURNS
5163 * none
5164 *---------------------------------------------------------------
5165 */
5166static void
5167dissect_zcl_rssi_location_set_absolute_location(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5168{
5169 /* Retrieve "Coordinate 1" field */
5170 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5171 *offset += 2;
5172
5173 /* Retrieve "Coordinate 2" field */
5174 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5175 *offset += 2;
5176
5177 /* Retrieve "Coordinate 3" field */
5178 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5179 *offset += 2;
5180
5181 /* Retrieve "Power" field */
5182 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5183 *offset += 2;
5184
5185 /* Retrieve "Path Loss Exponent" field */
5186 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_path_loss_expo, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5187 *offset += 2;
5188
5189} /*dissect_zcl_rssi_location_set_absolute_location*/
5190
5191
5192 /*FUNCTION:--------------------------------------------------------------------
5193 * NAME
5194 * dissect_zcl_rssi_location_set_device_config
5195 * DESCRIPTION
5196 * this function decodes the Set Device Configuration payload.
5197 * PARAMETERS
5198 * tvb - the tv buffer of the current data_type
5199 * tree - the tree to append this item to
5200 * offset - offset of data in tvb
5201 * RETURNS
5202 * none
5203 *------------------------------------------------------------------------------
5204 */
5205static void
5206dissect_zcl_rssi_location_set_device_config(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5207{
5208 /* Retrieve "Power" field */
5209 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5210 *offset += 2;
5211
5212 /* Retrieve "Path Loss Exponent" field */
5213 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_path_loss_expo, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5214 *offset += 2;
5215
5216 /* Retrieve "Calculation Period" field */
5217 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_calc_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5218 *offset += 2;
5219
5220 /* Retrieve "Number RSSI Measurements" field */
5221 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_rssi_meas, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5222 *offset += 1;
5223
5224 /* Retrieve "Reporting Period" field */
5225 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_reporting_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5226 *offset += 2;
5227
5228} /*dissect_zcl_rssi_location_set_device_config*/
5229
5230
5231/*FUNCTION:-------------------------------------------------------------------
5232* NAME
5233* dissect_zcl_rssi_location_get_device_config
5234* DESCRIPTION
5235* this function decodes the Get Device Configuration payload.
5236* PARAMETERS
5237* tvb - the tv buffer of the current data_type
5238* tree - the tree to append this item to
5239* offset - offset of data in tvb
5240* RETURNS
5241* none
5242*-----------------------------------------------------------------------------
5243*/
5244static void
5245dissect_zcl_rssi_location_get_device_config(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5246{
5247 /* Retrieve "Target Address" field */
5248 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_target_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
5249 *offset += 8;
5250
5251} /*dissect_zcl_rssi_location_get_device_config*/
5252
5253
5254/*FUNCTION:-------------------------------------------------------------------
5255* NAME
5256* dissect_zcl_rssi_location_get_location_data
5257* DESCRIPTION
5258* this function decodes the Get Location Data payload.
5259* PARAMETERS
5260* tvb - the tv buffer of the current data_type
5261* tree - the tree to append this item to
5262* offset - offset of data in tvb
5263* RETURNS
5264* none
5265*-----------------------------------------------------------------------------
5266*/
5267static void
5268dissect_zcl_rssi_location_get_location_data(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5269{
5270 uint8_t header;
5271
5272 static int * const location_header_fields[] = {
5273 &hf_zbee_zcl_rssi_location_header_abs_only,
5274 &hf_zbee_zcl_rssi_location_header_recalc,
5275 &hf_zbee_zcl_rssi_location_header_bcast_ind,
5276 &hf_zbee_zcl_rssi_location_header_bcast_res,
5277 &hf_zbee_zcl_rssi_location_header_compact_res,
5278 &hf_zbee_zcl_rssi_location_header_res,
5279 NULL((void*)0)
5280 };
5281
5282 /* Retrieve "8-bit header" field */
5283 header = tvb_get_uint8(tvb, *offset);
5284 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_rssi_location_header, ett_zbee_zcl_rssi_location_header, location_header_fields, ENC_LITTLE_ENDIAN0x80000000);
5285 *offset += 1;
5286
5287 /* Retrieve the number responses field */
5288 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_responses, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5289 *offset += 1;
5290
5291 /* Retrieve the IEEE address field */
5292 if(header & 0x04)
5293 {
5294 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_target_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
5295 *offset += 8;
5296 }
5297
5298} /*dissect_zcl_rssi_location_get_location_data*/
5299
5300
5301/*FUNCTION:--------------------------------------------------------------------
5302* NAME
5303* dissect_zcl_rssi_location_rssi_response
5304* DESCRIPTION
5305* this function decodes the RSSI Response payload.
5306* PARAMETERS
5307* tvb - the tv buffer of the current data_type
5308* tree - the tree to append this item to
5309* offset - offset of data in tvb
5310* RETURNS
5311* none
5312*------------------------------------------------------------------------------
5313*/
5314static void
5315dissect_zcl_rssi_location_rssi_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5316{
5317 /* Retrieve "Replaying Device" field */
5318 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_replaying_device, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
5319 *offset += 8;
5320
5321 /* Retrieve "Coordinate 1" field */
5322 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5323 *offset += 2;
5324
5325 /* Retrieve "Coordinate 2" field */
5326 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5327 *offset += 2;
5328
5329 /* Retrieve "Coordinate 3" field */
5330 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5331 *offset += 2;
5332
5333 /* Retrieve "RSSI" field */
5334 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_rssi, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5335 *offset += 1;
5336
5337 /* Retrieve "Number RSSI Measurements" field */
5338 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_rssi_meas, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5339 *offset += 1;
5340
5341} /*dissect_zcl_rssi_location_rssi_response*/
5342
5343
5344/*FUNCTION:------------------------------------------------------
5345* NAME
5346* dissect_zcl_rssi_location_send_pings
5347* DESCRIPTION
5348* this function decodes the Send Pings payload.
5349* PARAMETERS
5350* tvb - the tv buffer of the current data_type
5351* tree - the tree to append this item to
5352* offset - offset of data in tvb
5353* RETURNS
5354* none
5355*---------------------------------------------------------------
5356*/
5357static void
5358dissect_zcl_rssi_location_send_pings(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5359{
5360 /* Retrieve "Target Address" field */
5361 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_target_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
5362 *offset += 8;
5363
5364 /* Retrieve "Number RSSI Measurements" field */
5365 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_rssi_meas, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5366 *offset += 1;
5367
5368 /* Retrieve "Calculation Period" field */
5369 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_calc_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5370 *offset += 2;
5371
5372} /*dissect_zcl_rssi_location_send_pings*/
5373
5374
5375/*FUNCTION:------------------------------------------------------
5376* NAME
5377* dissect_zcl_rssi_location_anchor_node_announce
5378* DESCRIPTION
5379* this function decodes the Anchor Node Announce payload
5380* PARAMETERS
5381* tvb - the tv buffer of the current data_type
5382* tree - the tree to append this item to
5383* offset - offset of data in tvb
5384* RETURNS
5385* none
5386*---------------------------------------------------------------
5387*/
5388static void
5389dissect_zcl_rssi_location_anchor_node_announce(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5390{
5391 /* Retrieve "Anchor Node Address" field */
5392 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_anchor_node_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
5393 *offset += 8;
5394
5395 /* Retrieve "Coordinate 1" field */
5396 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5397 *offset += 2;
5398
5399 /* Retrieve "Coordinate 2" field */
5400 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5401 *offset += 2;
5402
5403 /* Retrieve "Coordinate 3" field */
5404 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5405 *offset += 2;
5406
5407} /*dissect_zcl_rssi_location_anchor_node_announce*/
5408
5409
5410/*FUNCTION:--------------------------------------------------------------------
5411* NAME
5412* dissect_zcl_rssi_location_device_config_response
5413* DESCRIPTION
5414* this function decodes the Device Configuration Response payload.
5415* PARAMETERS
5416* tvb - the tv buffer of the current data_type
5417* tree - the tree to append this item to
5418* offset - offset of data in tvb
5419* RETURNS
5420* none
5421*------------------------------------------------------------------------------
5422*/
5423static void
5424dissect_zcl_rssi_location_device_config_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5425{
5426 uint8_t status;
5427
5428 /* Retrieve "Status" field */
5429 status = tvb_get_uint8(tvb, *offset);
5430 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5431 *offset += 1;
5432
5433 if(status == ZBEE_ZCL_STAT_SUCCESS0x00)
5434 {
5435 /* Retrieve "Power" field */
5436 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5437 *offset += 2;
5438
5439 /* Retrieve "Path Loss Exponent" field */
5440 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_path_loss_expo, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5441 *offset += 2;
5442
5443 /* Retrieve "Calculation Period" field */
5444 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_calc_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5445 *offset += 2;
5446
5447 /* Retrieve "Number RSSI Measurements" field */
5448 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_rssi_meas, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5449 *offset += 1;
5450
5451 /* Retrieve "Reporting Period" field */
5452 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_reporting_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5453 *offset += 2;
5454 }
5455
5456} /*dissect_zcl_rssi_location_device_config_response*/
5457
5458
5459/*FUNCTION:------------------------------------------------------
5460* NAME
5461* dissect_zcl_rssi_location_location_data_response
5462* DESCRIPTION
5463* this function decodes the Location Data Response payload.
5464* PARAMETERS
5465* tvb - the tv buffer of the current data_type
5466* tree - the tree to append this item to
5467* offset - offset of data in tvb
5468* RETURNS
5469* none
5470*---------------------------------------------------------------
5471*/
5472static void
5473dissect_zcl_rssi_location_location_data_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5474{
5475 uint8_t status;
5476
5477 /* Retrieve "Status" field */
5478 status = tvb_get_uint8(tvb, *offset);
5479 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5480 *offset += 1;
5481
5482 if(status == ZBEE_ZCL_STAT_SUCCESS0x00)
5483 {
5484 /* Retrieve "Location Type" field */
5485 dissect_zcl_rssi_location_attr_data(tree, tvb, offset, ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE0x0000, ZBEE_ZCL_8_BIT_DATA0x08, false0);
5486
5487 /* Retrieve "Coordinate 1" field */
5488 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5489 *offset += 2;
5490
5491 /* Retrieve "Coordinate 2" field */
5492 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5493 *offset += 2;
5494
5495 /* Retrieve "Coordinate 3" field */
5496 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5497 *offset += 2;
5498
5499 /* Retrieve "Power" field */
5500 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5501 *offset += 2;
5502
5503 /* Retrieve "Path Loss Exponent" field */
5504 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_path_loss_expo, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5505 *offset += 2;
5506
5507 /* Retrieve "Location Method" field */
5508 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_attr_id_location_method, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5509 *offset += 1;
5510
5511 /* Retrieve "Quality Measure" field */
5512 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_quality_measure, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5513 *offset += 1;
5514
5515 /* Retrieve "Location Age" field */
5516 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_location_age, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5517 *offset += 2;
5518 }
5519
5520} /*dissect_zcl_rssi_location_location_data_response*/
5521
5522
5523/*FUNCTION:------------------------------------------------------
5524* NAME
5525* dissect_zcl_rssi_location_location_data_notif
5526* DESCRIPTION
5527* this function decodes the Location Data Notification payload.
5528* PARAMETERS
5529* tvb - the tv buffer of the current data_type
5530* tree - the tree to append this item to
5531* offset - offset of data in tvb
5532* RETURNS
5533* none
5534*---------------------------------------------------------------
5535*/
5536static void
5537dissect_zcl_rssi_location_location_data_notif(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5538{
5539 uint8_t temp;
5540
5541 /* Retrieve "Location Type" field */
5542 temp = tvb_get_uint8(tvb, *offset);
5543 dissect_zcl_rssi_location_attr_data(tree, tvb, offset, ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE0x0000, ZBEE_ZCL_8_BIT_DATA0x08, false0);
5544
5545 /* Retrieve "Coordinate 1" field */
5546 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5547 *offset += 2;
5548
5549 /* Retrieve "Coordinate 2" field */
5550 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5551 *offset += 2;
5552
5553 if((temp & ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_2D0x02) != 0x02)
5554 {
5555 /* Retrieve "Coordinate 3" field */
5556 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5557 *offset += 2;
5558 }
5559
5560 /* Retrieve "Power" field */
5561 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5562 *offset += 2;
5563
5564 /* Retrieve "Path Loss Exponent" field */
5565 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_path_loss_expo, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5566 *offset += 2;
5567
5568 if((temp & ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_COORDINATE0x0C) != 0x0C)
5569 {
5570 /* Retrieve "Location Method" field */
5571 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_attr_id_location_method, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5572 *offset += 1;
5573
5574 /* Retrieve "Quality Measure" field */
5575 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_quality_measure, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5576 *offset += 1;
5577
5578 /* Retrieve "Location Age" field */
5579 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_location_age, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5580 *offset += 2;
5581
5582 }
5583
5584} /*dissect_zcl_rssi_location_location_data_notif*/
5585
5586
5587/*FUNCTION:------------------------------------------------------
5588* NAME
5589* dissect_zcl_rssi_location_compact_location_data_notif
5590* DESCRIPTION
5591* this function decodes the Location Data Notification payload.
5592* PARAMETERS
5593* tvb - the tv buffer of the current data_type
5594* tree - the tree to append this item to
5595* offset - offset of data in tvb
5596* RETURNS
5597* none
5598*---------------------------------------------------------------
5599*/
5600static void
5601dissect_zcl_rssi_location_compact_location_data_notif(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5602{
5603 uint8_t temp;
5604
5605 /* Retrieve "Location Type" field */
5606 temp = tvb_get_uint8(tvb, *offset);
5607 dissect_zcl_rssi_location_attr_data(tree, tvb, offset, ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE0x0000, ZBEE_ZCL_8_BIT_DATA0x08, false0);
5608
5609 /* Retrieve "Coordinate 1" field */
5610 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5611 *offset += 2;
5612
5613 /* Retrieve "Coordinate 2" field */
5614 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5615 *offset += 2;
5616
5617 if((temp & ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_2D0x02) != 0x02)
5618 {
5619 /* Retrieve "Coordinate 3" field */
5620 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5621 *offset += 2;
5622 }
5623
5624 if((temp & ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_COORDINATE0x0C) != 0x0C)
5625 {
5626 /* Retrieve "Quality Measure" field */
5627 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_quality_measure, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5628 *offset += 1;
5629
5630 /* Retrieve "Location Age" field */
5631 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_location_age, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5632 *offset += 2;
5633
5634 }
5635
5636} /*dissect_zcl_rssi_location_compact_location_data_notif*/
5637
5638/*FUNCTION:------------------------------------------------------
5639* NAME
5640* dissect_zcl_rssi_location_rssi_ping
5641* DESCRIPTION
5642* this function decodes the RSSI Ping payload.
5643* PARAMETERS
5644* tvb - the tv buffer of the current data_type
5645* tree - the tree to append this item to
5646* offset - offset of data in tvb
5647* RETURNS
5648* none
5649*---------------------------------------------------------------
5650*/
5651static void
5652dissect_zcl_rssi_location_rssi_ping(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5653{
5654 /* Retrieve "Location Type" field */
5655 dissect_zcl_rssi_location_attr_data(tree, tvb, offset, ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE0x0000, ZBEE_ZCL_8_BIT_DATA0x08, false0);
5656
5657
5658} /*dissect_zcl_rssi_location_rssi_ping*/
5659
5660
5661/*FUNCTION:------------------------------------------------------
5662* NAME
5663* dissect_zcl_rssi_location_report_rssi_meas
5664* DESCRIPTION
5665* this function decodes the Report RSSI Measurements payload
5666* PARAMETERS
5667* tvb - the tv buffer of the current data_type
5668* tree - the tree to append this item to
5669* offset - offset of data in tvb
5670* RETURNS
5671* none
5672*---------------------------------------------------------------
5673*/
5674static void
5675dissect_zcl_rssi_location_report_rssi_meas(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5676{
5677 uint8_t count, i;
5678 /* Retrieve "Reporting Address" field */
5679 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_reporting_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
5680 *offset += 8;
5681
5682 /* Retrieve "Number of Neighbours" field */
5683 count = tvb_get_uint8(tvb, *offset);
5684 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_no_of_neigh, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5685 *offset += 1;
5686
5687 for( i = 0; i < count; i++)
5688 {
5689 /* Retrieve "Neighbour Address" field */
5690 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_neighbour_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
5691 *offset += 8;
5692
5693 /* Retrieve "Coordinate 1" field */
5694 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5695 *offset += 2;
5696
5697 /* Retrieve "Coordinate 2" field */
5698 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5699 *offset += 2;
5700
5701 /* Retrieve "Coordinate 3" field */
5702 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
5703 *offset += 2;
5704
5705 /* Retrieve "RSSI" field */
5706 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_rssi, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5707 *offset += 1;
5708
5709 /* Retrieve "Number RSSI Measurements" field */
5710 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_rssi_meas, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5711 *offset += 1;
5712 }
5713
5714} /*dissect_zcl_rssi_location_report_rssi_meas*/
5715
5716
5717/*FUNCTION:-------------------------------------------------------------------
5718* NAME
5719* dissect_zcl_rssi_location_request_own_location
5720* DESCRIPTION
5721* this function decodes the Request Own Location payload.
5722* PARAMETERS
5723* tvb - the tv buffer of the current data_type
5724* tree - the tree to append this item to
5725* offset - offset of data in tvb
5726* RETURNS
5727* none
5728*-----------------------------------------------------------------------------
5729*/
5730static void
5731dissect_zcl_rssi_location_request_own_location(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
5732{
5733 /* Retrieve "Requesting Address Address" field */
5734 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_request_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
5735 *offset += 8;
5736
5737} /*dissect_zcl_rssi_location_request_own_location*/
5738
5739
5740/*FUNCTION:------------------------------------------------------
5741 * NAME
5742 * dissect_zcl_rssi_location_attr_data
5743 * DESCRIPTION
5744 * this function is called by ZCL foundation dissector in order to decode
5745 * specific cluster attributes data.
5746 * PARAMETERS
5747 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
5748 * tvbuff_t *tvb - pointer to buffer containing raw packet.
5749 * unsigned *offset - pointer to buffer offset
5750 * uint16_t attr_id - attribute identifier
5751 * unsigned data_type - attribute data type
5752 * bool client_attr- ZCL client
5753 * RETURNS
5754 * none
5755 *---------------------------------------------------------------
5756 */
5757void
5758dissect_zcl_rssi_location_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
5759{
5760 static int * const location_type[] = {
5761 &hf_zbee_zcl_rssi_location_location_type_absolute,
5762 &hf_zbee_zcl_rssi_location_location_type_2D,
5763 &hf_zbee_zcl_rssi_location_location_type_coordinate_system,
5764 &hf_zbee_zcl_rssi_location_location_type_reserved,
5765 NULL((void*)0)
5766 };
5767
5768 /* Dissect attribute data type and data */
5769 switch ( attr_id ) {
5770
5771 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE0x0000:
5772 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_ENDIAN0x80000000);
5773 *offset += 1;
5774 break;
5775
5776 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD0x0001:
5777 proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_attr_id_location_method, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
5778 *offset += 1;
5779 break;
5780
5781 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_AGE0x0002:
5782 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_QUALITY_MEASURE0x0003:
5783 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_OF_DEVICES0x0004:
5784 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_10x0010:
5785 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_20x0011:
5786 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_30x0012:
5787 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_POWER0x0013:
5788 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_PATH_LOSS_EXPONENT0x0014:
5789 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_REPORTING_PERIOD0x0015:
5790 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_CALCULATION_PERIOD0x0016:
5791 case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_RSSI_MEAS0x0017:
5792 default:
5793 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
5794 break;
5795 }
5796
5797} /*dissect_zcl_rssi_location_attr_data*/
5798
5799
5800/*FUNCTION:------------------------------------------------------
5801 * NAME
5802 * proto_register_zbee_zcl_rssi_location
5803 * DESCRIPTION
5804 * ZigBee ZCL RSSI Location cluster protocol registration routine.
5805 * PARAMETERS
5806 * none
5807 * RETURNS
5808 * void
5809 *---------------------------------------------------------------
5810 */
5811void
5812proto_register_zbee_zcl_rssi_location(void)
5813{
5814 /* Setup list of header fields */
5815 static hf_register_info hf[] = {
5816
5817 { &hf_zbee_zcl_rssi_location_attr_id,
5818 { "Attribute", "zbee_zcl_general.rssi_location.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_rssi_location_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_rssi_location_attr_names
))))
,
5819 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5820
5821 /* start Location Type fields */
5822 { &hf_zbee_zcl_rssi_location_location_type,
5823 { "Location Type", "zbee_zcl_general.rssi_location.attr_id.location_type", FT_UINT8, BASE_HEX, NULL((void*)0),
5824 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5825
5826 { &hf_zbee_zcl_rssi_location_location_type_absolute,
5827 { "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)((0 ? (const struct _value_string*)0 : ((zbee_zcl_rssi_location_location_type_abs_values
))))
,
5828 ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_ABSOLUTE0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5829
5830 { &hf_zbee_zcl_rssi_location_location_type_2D,
5831 { "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)((0 ? (const struct _value_string*)0 : ((zbee_zcl_rssi_location_location_type_2D_values
))))
,
5832 ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_2D0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5833
5834 { &hf_zbee_zcl_rssi_location_location_type_coordinate_system,
5835 { "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)((0 ? (const struct _value_string*)0 : ((zbee_zcl_rssi_location_location_type_coordinate_values
))))
,
5836 ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_COORDINATE0x0C, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5837
5838 { &hf_zbee_zcl_rssi_location_location_type_reserved,
5839 { "Reserved", "zbee_zcl_general.rssi_location.attr_id.location_type.reserved", FT_BOOLEAN, 8, NULL((void*)0),
5840 ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_RESERVED0xF0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5841 /* end Location Type fields */
5842
5843 { &hf_zbee_zcl_rssi_location_attr_id_location_method,
5844 { "Location Method", "zbee_zcl_general.rssi_location.attr_id.location_method", FT_UINT8, BASE_HEX, VALS(zbee_zcl_rssi_location_location_method_values)((0 ? (const struct _value_string*)0 : ((zbee_zcl_rssi_location_location_method_values
))))
,
5845 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5846
5847 { &hf_zbee_zcl_rssi_location_coordinate1,
5848 { "Coordinate 1", "zbee_zcl_general.rssi_location.coordinate1", FT_UINT16, BASE_HEX, NULL((void*)0),
5849 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5850
5851 { &hf_zbee_zcl_rssi_location_coordinate2,
5852 { "Coordinate 2", "zbee_zcl_general.rssi_location.coordinate2", FT_UINT16, BASE_HEX, NULL((void*)0),
5853 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5854
5855 { &hf_zbee_zcl_rssi_location_coordinate3,
5856 { "Coordinate 3", "zbee_zcl_general.rssi_location.coordinate3", FT_UINT16, BASE_HEX, NULL((void*)0),
5857 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5858
5859 { &hf_zbee_zcl_rssi_location_power,
5860 { "Power", "zbee_zcl_general.rssi_location.power", FT_UINT16, BASE_HEX, NULL((void*)0),
5861 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5862
5863 { &hf_zbee_zcl_rssi_location_path_loss_expo,
5864 { "Path Loss Exponent", "zbee_zcl_general.rssi_location.path_loss_exponent", FT_UINT16, BASE_HEX, NULL((void*)0),
5865 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5866
5867 { &hf_zbee_zcl_rssi_location_calc_period,
5868 { "Calculation Period", "zbee_zcl_general.rssi_location.calc_period", FT_UINT16, BASE_HEX, NULL((void*)0),
5869 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5870
5871 { &hf_zbee_zcl_rssi_location_number_rssi_meas,
5872 { "Number RSSI Measurements", "zbee_zcl_general.rssi_location.number_rssi_meas", FT_UINT8, BASE_HEX, NULL((void*)0),
5873 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5874
5875 { &hf_zbee_zcl_rssi_location_reporting_period,
5876 { "Reporting Period", "zbee_zcl_general.rssi_location.reporting_period", FT_UINT16, BASE_HEX, NULL((void*)0),
5877 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5878
5879 { &hf_zbee_zcl_rssi_location_target_add,
5880 { "Target Address", "zbee_zcl_general.rssi_location.target_add", FT_UINT64, BASE_HEX, NULL((void*)0),
5881 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5882
5883 { &hf_zbee_zcl_rssi_location_header,
5884 { "Header Data", "zbee_zcl_general.rssi_location.location_header", FT_UINT8, BASE_HEX, NULL((void*)0),
5885 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5886
5887 { &hf_zbee_zcl_rssi_location_header_abs_only,
5888 { "Absolute Only", "zbee_zcl_general.rssi_location.header.abs_only", FT_BOOLEAN, 8, NULL((void*)0),
5889 0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5890
5891 { &hf_zbee_zcl_rssi_location_header_recalc,
5892 { "Recalculate", "zbee_zcl_general.rssi_location.header.recalc", FT_BOOLEAN, 8, NULL((void*)0),
5893 0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5894
5895 { &hf_zbee_zcl_rssi_location_header_bcast_ind,
5896 { "Broadcast Indicator", "zbee_zcl_general.rssi_location.header.bcast_ind", FT_BOOLEAN, 8, NULL((void*)0),
5897 0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5898
5899 { &hf_zbee_zcl_rssi_location_header_bcast_res,
5900 { "Broadcast Response", "zbee_zcl_general.rssi_location.header.bcast_response", FT_BOOLEAN, 8, NULL((void*)0),
5901 0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5902
5903 { &hf_zbee_zcl_rssi_location_header_compact_res,
5904 { "Compact Response", "zbee_zcl_general.rssi_location.compact_res", FT_BOOLEAN, 8, NULL((void*)0),
5905 0x10, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5906
5907 { &hf_zbee_zcl_rssi_location_header_res,
5908 { "Reserved", "zbee_zcl_general.rssi_location.reserved", FT_BOOLEAN, 8, NULL((void*)0),
5909 0xE0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5910
5911 { &hf_zbee_zcl_rssi_location_number_responses,
5912 { "Number Responses", "zbee_zcl_general.rssi_location.number_responses", FT_UINT8, BASE_HEX, NULL((void*)0),
5913 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5914
5915 { &hf_zbee_zcl_rssi_location_replaying_device,
5916 { "Replying Device", "zbee_zcl_general.rssi_location.replying_device", FT_UINT64, BASE_HEX, NULL((void*)0),
5917 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5918
5919 { &hf_zbee_zcl_rssi_location_rssi,
5920 { "RSSI", "zbee_zcl_general.rssi_location.rssi", FT_UINT8, BASE_DEC, NULL((void*)0),
5921 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5922
5923 { &hf_zbee_zcl_rssi_location_anchor_node_add,
5924 { "Anchor Node Address", "zbee_zcl_general.rssi_location.anchor_node_add", FT_UINT64, BASE_HEX, NULL((void*)0),
5925 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5926
5927 { &hf_zbee_zcl_rssi_location_status,
5928 { "Status", "zbee_zcl_general.rssi_location.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_status_names
))))
,
5929 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5930
5931 { &hf_zbee_zcl_rssi_location_quality_measure,
5932 { "Quality Measure", "zbee_zcl_general.rssi_location.quality_measure", FT_UINT8, BASE_HEX, NULL((void*)0),
5933 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5934
5935 { &hf_zbee_zcl_rssi_location_location_age,
5936 { "Location Age", "zbee_zcl_general.rssi_location.location_age", FT_UINT16, BASE_HEX, NULL((void*)0),
5937 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5938
5939 { &hf_zbee_zcl_rssi_location_reporting_add,
5940 { "Reporting Address", "zbee_zcl_general.rssi_location.reporting_add", FT_UINT64, BASE_HEX, NULL((void*)0),
5941 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5942
5943 { &hf_zbee_zcl_rssi_location_no_of_neigh,
5944 { "Number of Neighbours", "zbee_zcl_general.rssi_location.no_of_neigh", FT_UINT8, BASE_DEC, NULL((void*)0),
5945 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5946
5947 { &hf_zbee_zcl_rssi_location_neighbour_add,
5948 { "Neighbour Address", "zbee_zcl_general.rssi_location.neighbour_add", FT_UINT64, BASE_HEX, NULL((void*)0),
5949 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5950
5951 { &hf_zbee_zcl_rssi_location_request_add,
5952 { "Requesting Address", "zbee_zcl_general.rssi_location.request_add", FT_UINT64, BASE_HEX, NULL((void*)0),
5953 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5954
5955 { &hf_zbee_zcl_rssi_location_srv_rx_cmd_id,
5956 { "Command", "zbee_zcl_general.rssi_location.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_rssi_location_srv_rx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_rssi_location_srv_rx_cmd_names
))))
,
5957 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
5958
5959 { &hf_zbee_zcl_rssi_location_srv_tx_cmd_id,
5960 { "Command", "zbee_zcl_general.rssi_location.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_rssi_location_srv_tx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_rssi_location_srv_tx_cmd_names
))))
,
5961 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
5962
5963 };
5964
5965 /* ZCL RSSI Location subtrees */
5966 static int *ett[] = {
5967 &ett_zbee_zcl_rssi_location,
5968 &ett_zbee_zcl_rssi_location_location_type,
5969 &ett_zbee_zcl_rssi_location_header
5970 };
5971
5972 /* Register the ZigBee ZCL RSSI Location cluster protocol name and description */
5973 proto_zbee_zcl_rssi_location = proto_register_protocol("ZigBee ZCL RSSI Location", "ZCL RSSI Location", ZBEE_PROTOABBREV_ZCL_RSSI_LOCATION"zbee_zcl_general.rssi_location");
5974 proto_register_field_array(proto_zbee_zcl_rssi_location, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
5975 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
5976
5977 /* Register the ZigBee ZCL RSSI Location dissector. */
5978 register_dissector(ZBEE_PROTOABBREV_ZCL_RSSI_LOCATION"zbee_zcl_general.rssi_location", dissect_zbee_zcl_rssi_location, proto_zbee_zcl_rssi_location);
5979
5980} /*proto_register_zbee_zcl_rssi_location*/
5981
5982
5983/*FUNCTION:------------------------------------------------------
5984 * NAME
5985 * proto_reg_handoff_zbee_zcl_rssi_location
5986 * DESCRIPTION
5987 * Hands off the ZCL RSSI Location dissector.
5988 * PARAMETERS
5989 * none
5990 * RETURNS
5991 * none
5992 *---------------------------------------------------------------
5993 */
5994void
5995proto_reg_handoff_zbee_zcl_rssi_location(void)
5996{
5997 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_RSSI_LOCATION"zbee_zcl_general.rssi_location",
5998 proto_zbee_zcl_rssi_location,
5999 ett_zbee_zcl_rssi_location,
6000 ZBEE_ZCL_CID_RSSI_LOCATION0x000b,
6001 ZBEE_MFG_CODE_NONE0x0000,
6002 hf_zbee_zcl_rssi_location_attr_id,
6003 hf_zbee_zcl_rssi_location_attr_id,
6004 hf_zbee_zcl_rssi_location_srv_rx_cmd_id,
6005 hf_zbee_zcl_rssi_location_srv_tx_cmd_id,
6006 (zbee_zcl_fn_attr_data)dissect_zcl_rssi_location_attr_data
6007 );
6008} /*proto_reg_handoff_zbee_zcl_rssi_location*/
6009
6010/****************************************************************************************************/
6011/****************************************************************************************************/
6012/****************************************************************************************************/
6013
6014
6015/* Reliability Enumeration Values */
6016#define ZBEE_ZCL_RELIABILITY_NO_FAULT_DETECTED0x00 0x00 /* No Fault Detected */
6017#define ZBEE_ZCL_RELIABILITY_NO_SENSOR0x01 0x01 /* No Sensor */
6018#define ZBEE_ZCL_RELIABILITY_OVER_RANGE0x02 0x02 /* Over Range */
6019#define ZBEE_ZCL_RELIABILITY_UNDER_RANGE0x03 0x03 /* Under Range */
6020#define ZBEE_ZCL_RELIABILITY_OPEN_LOOP0x04 0x04 /* Open Loop */
6021#define ZBEE_ZCL_RELIABILITY_SHORTED_LOOP0x05 0x05 /* Shorted Loop */
6022#define ZBEE_ZCL_RELIABILITY_NO_OUTPUT0x06 0x06 /* No Output */
6023#define ZBEE_ZCL_RELIABILITY_UNRELIABLE_OTHER0x07 0x07 /* Unreliable Other */
6024#define ZBEE_ZCL_RELIABILITY_PROCESS_ERROR0x08 0x08 /* Process Error */
6025#define ZBEE_ZCL_RELIABILITY_MULTI_STATE_FAULT0x09 0x09 /* Multi-State Fault */
6026#define ZBEE_ZCL_RELIABILITY_CONFIGURATION_ERROR0x0A 0x0A /* Configuration Error */
6027
6028static const value_string zbee_zcl_reliability_names[] = {
6029 {ZBEE_ZCL_RELIABILITY_NO_FAULT_DETECTED0x00, "No Fault Detected"},
6030 {ZBEE_ZCL_RELIABILITY_NO_SENSOR0x01, "No Sensor"},
6031 {ZBEE_ZCL_RELIABILITY_OVER_RANGE0x02, "Over Range"},
6032 {ZBEE_ZCL_RELIABILITY_UNDER_RANGE0x03, "Under Range"},
6033 {ZBEE_ZCL_RELIABILITY_OPEN_LOOP0x04, "Open Loop"},
6034 {ZBEE_ZCL_RELIABILITY_SHORTED_LOOP0x05, "Shorted Loop"},
6035 {ZBEE_ZCL_RELIABILITY_NO_OUTPUT0x06, "No Output"},
6036 {ZBEE_ZCL_RELIABILITY_UNRELIABLE_OTHER0x07, "Unreliable Other"},
6037 {ZBEE_ZCL_RELIABILITY_PROCESS_ERROR0x08, "Process Error"},
6038 {ZBEE_ZCL_RELIABILITY_MULTI_STATE_FAULT0x09, "Multi-State Fault"},
6039 {ZBEE_ZCL_RELIABILITY_CONFIGURATION_ERROR0x0A, "Configuration Error"},
6040 {0, NULL((void*)0)}
6041};
6042
6043/* Status Flags Mask Values */
6044#define ZBEE_ZCL_STATUS_IN_ALARM0x01 0x01 /* In Alarm Flag */
6045#define ZBEE_ZCL_STATUS_FAULT0x02 0x02 /* Fault Flag */
6046#define ZBEE_ZCL_STATUS_OVERRIDDEN0x04 0x04 /* Overridden Flag */
6047#define ZBEE_ZCL_STATUS_OUT_OF_SERVICE0x08 0x08 /* Out of Service Flag */
6048
6049
6050/* ########################################################################## */
6051/* #### (0x000C) ANALOG INPUT (BASIC) CLUSTER ############################### */
6052/* ########################################################################## */
6053
6054/*************************/
6055/* Defines */
6056/*************************/
6057
6058/*Attributes*/
6059#define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_DESCRIPTION0x001C 0x001C /* Description */
6060#define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MAX_PRESENT_VALUE0x0041 0x0041 /* Max Present Value */
6061#define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MIN_PRESENT_VALUE0x0045 0x0045 /* Min Present Value */
6062#define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_OUT_OF_SERVICE0x0051 0x0051 /* Out of Service */
6063#define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_PRESENT_VALUE0x0055 0x0055 /* Present Value */
6064#define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RELIABILITY0x0067 0x0067 /* Reliability */
6065#define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RESOLUTION0x006A 0x006A /* Resolution */
6066#define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_STATUS_FLAGS0x006F 0x006F /* Status Flags */
6067#define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_ENGINEERING_UNITS0x0075 0x0075 /* Engineering Units */
6068#define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_APPLICATION_TYPE0x0100 0x0100 /* Application Type */
6069
6070/*Server commands received - none*/
6071
6072/*Server commands generated - none*/
6073
6074/*************************/
6075/* Function Declarations */
6076/*************************/
6077
6078void proto_register_zbee_zcl_analog_input_basic(void);
6079void proto_reg_handoff_zbee_zcl_analog_input_basic(void);
6080
6081/* Command Dissector Helpers */
6082static void dissect_zcl_analog_input_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
6083
6084/* Private functions prototype */
6085
6086/*************************/
6087/* Global Variables */
6088/*************************/
6089/* Initialize the protocol and registered fields */
6090static int proto_zbee_zcl_analog_input_basic;
6091
6092static int hf_zbee_zcl_analog_input_basic_attr_id;
6093static int hf_zbee_zcl_analog_input_basic_reliability;
6094static int hf_zbee_zcl_analog_input_basic_status_flags;
6095static int hf_zbee_zcl_analog_input_basic_status_in_alarm;
6096static int hf_zbee_zcl_analog_input_basic_status_fault;
6097static int hf_zbee_zcl_analog_input_basic_status_overridden;
6098static int hf_zbee_zcl_analog_input_basic_status_out_of_service;
6099
6100/* Initialize the subtree pointers */
6101static int ett_zbee_zcl_analog_input_basic;
6102static int ett_zbee_zcl_analog_input_basic_status_flags;
6103
6104/* Attributes */
6105static const value_string zbee_zcl_analog_input_basic_attr_names[] = {
6106 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_DESCRIPTION0x001C, "Description" },
6107 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MAX_PRESENT_VALUE0x0041, "Max Present Value" },
6108 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MIN_PRESENT_VALUE0x0045, "Min Present Value" },
6109 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_OUT_OF_SERVICE0x0051, "Out of Service" },
6110 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_PRESENT_VALUE0x0055, "Present Value" },
6111 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RELIABILITY0x0067, "Reliability" },
6112 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RESOLUTION0x006A, "Resolution" },
6113 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_STATUS_FLAGS0x006F, "Status Flags" },
6114 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_ENGINEERING_UNITS0x0075, "Engineering Units" },
6115 { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_APPLICATION_TYPE0x0100, "Application Type" },
6116 { 0, NULL((void*)0) }
6117};
6118
6119/*************************/
6120/* Function Bodies */
6121/*************************/
6122
6123/*FUNCTION:------------------------------------------------------
6124 * NAME
6125 * dissect_zbee_zcl_analog_input_basic
6126 * DESCRIPTION
6127 * ZigBee ZCL Analog Input Basic cluster dissector for wireshark.
6128 * PARAMETERS
6129 * tvbuff_t *tvb - pointer to buffer containing raw packet.
6130 * packet_info *pinfo - pointer to packet information fields
6131 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
6132 * RETURNS
6133 * int - length of parsed data.
6134 *---------------------------------------------------------------
6135 */
6136
6137static int
6138dissect_zbee_zcl_analog_input_basic(tvbuff_t *tvb _U___attribute__((unused)), packet_info *pinfo _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), void* data _U___attribute__((unused)))
6139{
6140 return tvb_captured_length(tvb);
6141} /*dissect_zbee_zcl_analog_input_basic*/
6142
6143
6144/*FUNCTION:------------------------------------------------------
6145 * NAME
6146 * dissect_zcl_analog_input_basic_attr_data
6147 * DESCRIPTION
6148 * this function is called by ZCL foundation dissector in order to decode
6149 * specific cluster attributes data.
6150 * PARAMETERS
6151 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
6152 * tvbuff_t *tvb - pointer to buffer containing raw packet.
6153 * unsigned *offset - pointer to buffer offset
6154 * uint16_t attr_id - attribute identifier
6155 * unsigned data_type - attribute data type
6156 * bool client_attr- ZCL client
6157 * RETURNS
6158 * none
6159 *---------------------------------------------------------------
6160 */
6161void
6162dissect_zcl_analog_input_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
6163{
6164 static int * const status_flags[] = {
6165 &hf_zbee_zcl_analog_input_basic_status_in_alarm,
6166 &hf_zbee_zcl_analog_input_basic_status_fault,
6167 &hf_zbee_zcl_analog_input_basic_status_overridden,
6168 &hf_zbee_zcl_analog_input_basic_status_out_of_service,
6169 NULL((void*)0)
6170 };
6171
6172 /* Dissect attribute data type and data */
6173 switch (attr_id) {
6174
6175 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RELIABILITY0x0067:
6176 proto_tree_add_item(tree, hf_zbee_zcl_analog_input_basic_reliability, tvb, *offset, 1, ENC_NA0x00000000);
6177 *offset += 1;
6178 break;
6179
6180 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_STATUS_FLAGS0x006F:
6181 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_ENDIAN0x80000000);
6182 *offset += 1;
6183 break;
6184
6185 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_DESCRIPTION0x001C:
6186 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MAX_PRESENT_VALUE0x0041:
6187 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MIN_PRESENT_VALUE0x0045:
6188 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_OUT_OF_SERVICE0x0051:
6189 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_PRESENT_VALUE0x0055:
6190 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RESOLUTION0x006A:
6191 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_ENGINEERING_UNITS0x0075:
6192 case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_APPLICATION_TYPE0x0100:
6193 default:
6194 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
6195 break;
6196 }
6197
6198} /*dissect_zcl_analog_input_basic_attr_data*/
6199
6200
6201/*FUNCTION:------------------------------------------------------
6202 * NAME
6203 * proto_register_zbee_zcl_analog_input_basic
6204 * DESCRIPTION
6205 * ZigBee ZCL Analog Input Basic cluster protocol registration routine.
6206 * PARAMETERS
6207 * none
6208 * RETURNS
6209 * none
6210 *---------------------------------------------------------------
6211 */
6212void
6213proto_register_zbee_zcl_analog_input_basic(void)
6214{
6215 /* Setup list of header fields */
6216 static hf_register_info hf[] = {
6217
6218 { &hf_zbee_zcl_analog_input_basic_attr_id,
6219 { "Attribute", "zbee_zcl_general.analog_input_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_analog_input_basic_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_analog_input_basic_attr_names
))))
,
6220 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6221
6222 { &hf_zbee_zcl_analog_input_basic_reliability,
6223 { "Reliability", "zbee_zcl_general.analog_input_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_reliability_names
))))
,
6224 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6225
6226 /* start Status Flags fields */
6227 { &hf_zbee_zcl_analog_input_basic_status_flags,
6228 { "Status Flags", "zbee_zcl_general.analog_input_basic.attr.status", FT_UINT8, BASE_HEX, NULL((void*)0),
6229 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6230
6231 { &hf_zbee_zcl_analog_input_basic_status_in_alarm,
6232 { "In Alarm Status", "zbee_zcl_general.analog_input_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL((void*)0),
6233 ZBEE_ZCL_STATUS_IN_ALARM0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6234
6235 { &hf_zbee_zcl_analog_input_basic_status_fault,
6236 { "Fault Status", "zbee_zcl_general.analog_input_basic.attr.status.fault",FT_BOOLEAN, 8, NULL((void*)0),
6237 ZBEE_ZCL_STATUS_FAULT0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6238
6239 { &hf_zbee_zcl_analog_input_basic_status_overridden,
6240 { "Overridden Status", "zbee_zcl_general.analog_input_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL((void*)0),
6241 ZBEE_ZCL_STATUS_OVERRIDDEN0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6242
6243 { &hf_zbee_zcl_analog_input_basic_status_out_of_service,
6244 { "Out of Service Status", "zbee_zcl_general.analog_input_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL((void*)0),
6245 ZBEE_ZCL_STATUS_OUT_OF_SERVICE0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
6246 /* end Status Flags fields */
6247 };
6248
6249 /* ZCL Analog Input Basic subtrees */
6250 static int *ett[] = {
6251 &ett_zbee_zcl_analog_input_basic,
6252 &ett_zbee_zcl_analog_input_basic_status_flags
6253 };
6254
6255
6256
6257 /* Register the ZigBee ZCL Analog Input Basic cluster protocol name and description */
6258 proto_zbee_zcl_analog_input_basic = proto_register_protocol("ZigBee ZCL Analog Input Basic", "ZCL Analog Input Basic", ZBEE_PROTOABBREV_ZCL_ANALOG_INPUT_BASIC"zbee_zcl_general.analog.input.basic");
6259 proto_register_field_array(proto_zbee_zcl_analog_input_basic, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
6260 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
6261
6262 /* Register the ZigBee ZCL Analog Input Basic dissector. */
6263 register_dissector(ZBEE_PROTOABBREV_ZCL_ANALOG_INPUT_BASIC"zbee_zcl_general.analog.input.basic", dissect_zbee_zcl_analog_input_basic, proto_zbee_zcl_analog_input_basic);
6264} /*proto_register_zbee_zcl_analog_input_basic*/
6265
6266/*FUNCTION:------------------------------------------------------
6267 * NAME
6268 * proto_reg_handoff_zbee_zcl_analog_input_basic
6269 * DESCRIPTION
6270 * Hands off the ZCL Analog Input Basic dissector.
6271 * PARAMETERS
6272 * none
6273 * RETURNS
6274 * none
6275 *---------------------------------------------------------------
6276 */
6277void
6278proto_reg_handoff_zbee_zcl_analog_input_basic(void)
6279{
6280 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ANALOG_INPUT_BASIC"zbee_zcl_general.analog.input.basic",
6281 proto_zbee_zcl_analog_input_basic,
6282 ett_zbee_zcl_analog_input_basic,
6283 ZBEE_ZCL_CID_ANALOG_INPUT_BASIC0x000c,
6284 ZBEE_MFG_CODE_NONE0x0000,
6285 hf_zbee_zcl_analog_input_basic_attr_id,
6286 hf_zbee_zcl_analog_input_basic_attr_id,
6287 -1, -1,
6288 (zbee_zcl_fn_attr_data)dissect_zcl_analog_input_basic_attr_data
6289 );
6290} /*proto_reg_handoff_zbee_zcl_analog_input_basic*/
6291
6292
6293/* ########################################################################## */
6294/* #### (0x000D) ANALOG OUTPUT (BASIC) CLUSTER ############################## */
6295/* ########################################################################## */
6296
6297/*************************/
6298/* Defines */
6299/*************************/
6300
6301/*Attributes*/
6302#define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_DESCRIPTION0x001C 0x001C /* Description */
6303#define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MAX_PRESENT_VALUE0x0041 0x0041 /* Max Present Value */
6304#define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MIN_PRESENT_VALUE0x0045 0x0045 /* Min Present Value */
6305#define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_OUT_OF_SERVICE0x0051 0x0051 /* Out of Service */
6306#define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRESENT_VALUE0x0055 0x0055 /* Present Value */
6307#define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRIORITY_ARRAY0x0057 0x0057 /* Priority Array */
6308#define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELIABILITY0x0067 0x0067 /* Reliability */
6309#define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELINQUISH_DEFAULT0x0068 0x0068 /* Relinquish Default */
6310#define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RESOLUTION0x006A 0x006A /* Resolution */
6311#define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_STATUS_FLAGS0x006F 0x006F /* Status Flags */
6312#define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_ENGINEERING_UNITS0x0075 0x0075 /* Engineering Units */
6313#define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_APPLICATION_TYPE0x0100 0x0100 /* Application Type */
6314
6315/*Server commands received - none*/
6316
6317/*Server commands generated - none*/
6318
6319/*************************/
6320/* Function Declarations */
6321/*************************/
6322
6323void proto_register_zbee_zcl_analog_output_basic(void);
6324void proto_reg_handoff_zbee_zcl_analog_output_basic(void);
6325
6326/* Command Dissector Helpers */
6327static void dissect_zcl_analog_output_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
6328
6329/* Private functions prototype */
6330
6331/*************************/
6332/* Global Variables */
6333/*************************/
6334/* Initialize the protocol and registered fields */
6335static int proto_zbee_zcl_analog_output_basic;
6336
6337static int hf_zbee_zcl_analog_output_basic_attr_id;
6338static int hf_zbee_zcl_analog_output_basic_reliability;
6339static int hf_zbee_zcl_analog_output_basic_status_flags;
6340static int hf_zbee_zcl_analog_output_basic_status_in_alarm;
6341static int hf_zbee_zcl_analog_output_basic_status_fault;
6342static int hf_zbee_zcl_analog_output_basic_status_overridden;
6343static int hf_zbee_zcl_analog_output_basic_status_out_of_service;
6344static int hf_zbee_zcl_analog_output_basic_priority_array_bool;
6345static int hf_zbee_zcl_analog_output_basic_priority_array_sing_prec;
6346static int hf_zbee_zcl_analog_output_basic_priority_array;
6347static int hf_zbee_zcl_analog_output_basic_structure;
6348
6349/* Initialize the subtree pointers */
6350static int ett_zbee_zcl_analog_output_basic;
6351static int ett_zbee_zcl_analog_output_basic_status_flags;
6352static int ett_zbee_zcl_analog_output_basic_priority_array;
6353static int ett_zbee_zcl_analog_output_basic_priority_array_structure;
6354
6355/* Attributes */
6356static const value_string zbee_zcl_analog_output_basic_attr_names[] = {
6357 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_DESCRIPTION0x001C, "Description" },
6358 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MAX_PRESENT_VALUE0x0041, "Max Present Value" },
6359 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MIN_PRESENT_VALUE0x0045, "Min Present Value" },
6360 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_OUT_OF_SERVICE0x0051, "Out of Service" },
6361 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRESENT_VALUE0x0055, "Present Value" },
6362 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRIORITY_ARRAY0x0057, "Priority Array" },
6363 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELIABILITY0x0067, "Reliability" },
6364 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELINQUISH_DEFAULT0x0068, "Relinquish Default" },
6365 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RESOLUTION0x006A, "Resolution" },
6366 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_STATUS_FLAGS0x006F, "Status Flags" },
6367 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_ENGINEERING_UNITS0x0075, "Engineering Units" },
6368 { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_APPLICATION_TYPE0x0100, "Application Type" },
6369 { 0, NULL((void*)0) }
6370};
6371
6372/*************************/
6373/* Function Bodies */
6374/*************************/
6375
6376/*FUNCTION:------------------------------------------------------
6377 * NAME
6378 * dissect_zbee_zcl_analog_output_basic
6379 * DESCRIPTION
6380 * ZigBee ZCL Analog Output Basic cluster dissector for wireshark.
6381 * PARAMETERS
6382 * tvbuff_t *tvb - pointer to buffer containing raw packet.
6383 * packet_info *pinfo - pointer to packet information fields
6384 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
6385 * RETURNS
6386 * int - length of parsed data.
6387 *---------------------------------------------------------------
6388 */
6389
6390static int
6391dissect_zbee_zcl_analog_output_basic(tvbuff_t *tvb _U___attribute__((unused)), packet_info *pinfo _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), void* data _U___attribute__((unused)))
6392{
6393 return tvb_captured_length(tvb);
6394} /*dissect_zbee_zcl_analog_output_basic*/
6395
6396
6397/*FUNCTION:------------------------------------------------------
6398 * NAME
6399 * dissect_zcl_analog_output_basic_attr_data
6400 * DESCRIPTION
6401 * this function is called by ZCL foundation dissector in order to decode
6402 * specific cluster attributes data.
6403 * PARAMETERS
6404 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
6405 * tvbuff_t *tvb - pointer to buffer containing raw packet.
6406 * unsigned *offset - pointer to buffer offset
6407 * uint16_t attr_id - attribute identifier
6408 * unsigned data_type - attribute data type
6409 * bool client_attr- ZCL client
6410 * RETURNS
6411 * none
6412 *---------------------------------------------------------------
6413 */
6414void
6415dissect_zcl_analog_output_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
6416{
6417 proto_item *ti = NULL((void*)0), *tj = NULL((void*)0);
6418 proto_tree *sub_tree = NULL((void*)0), *sub = NULL((void*)0);
6419 int i;
6420
6421 static int * const status_flags[] = {
6422 &hf_zbee_zcl_analog_output_basic_status_in_alarm,
6423 &hf_zbee_zcl_analog_output_basic_status_fault,
6424 &hf_zbee_zcl_analog_output_basic_status_overridden,
6425 &hf_zbee_zcl_analog_output_basic_status_out_of_service,
6426 NULL((void*)0)
6427 };
6428
6429 /* Dissect attribute data type and data */
6430 switch (attr_id) {
6431
6432 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRIORITY_ARRAY0x0057:
6433 ti = proto_tree_add_item(tree,hf_zbee_zcl_analog_output_basic_priority_array, tvb, *offset, 80, ENC_NA0x00000000);
6434 sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_analog_output_basic_priority_array);
6435
6436 for(i = 1; i <= 16; i++)
6437 {
6438 tj = proto_tree_add_item(sub_tree, hf_zbee_zcl_analog_output_basic_structure, tvb, *offset, 5, ENC_NA0x00000000);
6439 proto_item_append_text(tj," %d",i);
6440 sub = proto_item_add_subtree(tj, ett_zbee_zcl_analog_output_basic_priority_array_structure);
6441 proto_tree_add_item(sub, hf_zbee_zcl_analog_output_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
6442 *offset += 1;
6443 proto_tree_add_item(sub, hf_zbee_zcl_analog_output_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
6444 *offset += 4;
6445 }
6446 break;
6447
6448 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELIABILITY0x0067:
6449 proto_tree_add_item(tree, hf_zbee_zcl_analog_output_basic_reliability, tvb, *offset, 1, ENC_NA0x00000000);
6450 *offset += 1;
6451 break;
6452
6453 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_STATUS_FLAGS0x006F:
6454 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_ENDIAN0x80000000);
6455 *offset += 1;
6456 break;
6457
6458 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_DESCRIPTION0x001C:
6459 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MAX_PRESENT_VALUE0x0041:
6460 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MIN_PRESENT_VALUE0x0045:
6461 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_OUT_OF_SERVICE0x0051:
6462 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRESENT_VALUE0x0055:
6463 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELINQUISH_DEFAULT0x0068:
6464 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RESOLUTION0x006A:
6465 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_ENGINEERING_UNITS0x0075:
6466 case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_APPLICATION_TYPE0x0100:
6467 default:
6468 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
6469 break;
6470 }
6471
6472} /*dissect_zcl_analog_output_basic_attr_data*/
6473
6474
6475/*FUNCTION:------------------------------------------------------
6476 * NAME
6477 * proto_register_zbee_zcl_analog_output_basic
6478 * DESCRIPTION
6479 * ZigBee ZCL Analog Output Basic cluster protocol registration routine.
6480 * PARAMETERS
6481 * none
6482 * RETURNS
6483 * none
6484 *---------------------------------------------------------------
6485 */
6486void
6487proto_register_zbee_zcl_analog_output_basic(void)
6488{
6489 /* Setup list of header fields */
6490 static hf_register_info hf[] = {
6491
6492 { &hf_zbee_zcl_analog_output_basic_attr_id,
6493 { "Attribute", "zbee_zcl_general.analog_output_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_analog_output_basic_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_analog_output_basic_attr_names
))))
,
6494 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6495
6496 { &hf_zbee_zcl_analog_output_basic_reliability,
6497 { "Reliability", "zbee_zcl_general.analog_output_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_reliability_names
))))
,
6498 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6499
6500 /* start Status Flags fields */
6501 { &hf_zbee_zcl_analog_output_basic_status_flags,
6502 { "Status Flags", "zbee_zcl_general.analog_output_basic.attr.status", FT_UINT8, BASE_HEX, NULL((void*)0),
6503 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6504
6505 { &hf_zbee_zcl_analog_output_basic_status_in_alarm,
6506 { "In Alarm Status", "zbee_zcl_general.analog_output_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL((void*)0),
6507 ZBEE_ZCL_STATUS_IN_ALARM0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6508
6509 { &hf_zbee_zcl_analog_output_basic_status_fault,
6510 { "Fault Status", "zbee_zcl_general.analog_output_basic.attr.status.fault", FT_BOOLEAN, 8, NULL((void*)0),
6511 ZBEE_ZCL_STATUS_FAULT0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6512
6513 { &hf_zbee_zcl_analog_output_basic_status_overridden,
6514 { "Overridden Status", "zbee_zcl_general.analog_output_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL((void*)0),
6515 ZBEE_ZCL_STATUS_OVERRIDDEN0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6516
6517 { &hf_zbee_zcl_analog_output_basic_status_out_of_service,
6518 { "Out of Service Status", "zbee_zcl_general.analog_output_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL((void*)0),
6519 ZBEE_ZCL_STATUS_OUT_OF_SERVICE0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6520 /* end Status Flags fields */
6521
6522 { &hf_zbee_zcl_analog_output_basic_priority_array_bool,
6523 { "Valid/Invalid", "zbee_zcl_general.analog_output_basic.attr.priority_array.bool", FT_BOOLEAN, BASE_NONE, TFS(&tfs_invalid_valid)((0 ? (const struct true_false_string*)0 : ((&tfs_invalid_valid
))))
,
6524 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6525
6526 { &hf_zbee_zcl_analog_output_basic_priority_array_sing_prec,
6527 { "Priority Value", "zbee_zcl_general.analog_output_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL((void*)0),
6528 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6529
6530 { &hf_zbee_zcl_analog_output_basic_priority_array,
6531 { "Priority Array", "zbee_zcl_general.analog_output_basic.priority_array", FT_NONE, BASE_NONE, NULL((void*)0),
6532 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6533
6534 { &hf_zbee_zcl_analog_output_basic_structure,
6535 { "Structure", "zbee_zcl_general.analog_output_basic.structure", FT_NONE, BASE_NONE, NULL((void*)0),
6536 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
6537 };
6538
6539 /* ZCL Analog Output Basic subtrees */
6540 static int *ett[] = {
6541 &ett_zbee_zcl_analog_output_basic,
6542 &ett_zbee_zcl_analog_output_basic_status_flags,
6543 &ett_zbee_zcl_analog_output_basic_priority_array,
6544 &ett_zbee_zcl_analog_output_basic_priority_array_structure
6545 };
6546
6547
6548
6549 /* Register the ZigBee ZCL Analog Output Basic cluster protocol name and description */
6550 proto_zbee_zcl_analog_output_basic = proto_register_protocol("ZigBee ZCL Analog Output Basic", "ZCL Analog Output Basic", ZBEE_PROTOABBREV_ZCL_ANALOG_OUTPUT_BASIC"zbee_zcl_general.analog.output.basic");
6551 proto_register_field_array(proto_zbee_zcl_analog_output_basic, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
6552 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
6553
6554 /* Register the ZigBee ZCL Analog Output Basic dissector. */
6555 register_dissector(ZBEE_PROTOABBREV_ZCL_ANALOG_OUTPUT_BASIC"zbee_zcl_general.analog.output.basic", dissect_zbee_zcl_analog_output_basic, proto_zbee_zcl_analog_output_basic);
6556} /*proto_register_zbee_zcl_analog_output_basic*/
6557
6558/*FUNCTION:------------------------------------------------------
6559 * NAME
6560 * proto_reg_handoff_zbee_zcl_analog_output_basic
6561 * DESCRIPTION
6562 * Hands off the ZCL Analog Output Basic dissector.
6563 * PARAMETERS
6564 * none
6565 * RETURNS
6566 * none
6567 *---------------------------------------------------------------
6568 */
6569void
6570proto_reg_handoff_zbee_zcl_analog_output_basic(void)
6571{
6572 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ANALOG_OUTPUT_BASIC"zbee_zcl_general.analog.output.basic",
6573 proto_zbee_zcl_analog_output_basic,
6574 ett_zbee_zcl_analog_output_basic,
6575 ZBEE_ZCL_CID_ANALOG_OUTPUT_BASIC0x000d,
6576 ZBEE_MFG_CODE_NONE0x0000,
6577 hf_zbee_zcl_analog_output_basic_attr_id,
6578 hf_zbee_zcl_analog_output_basic_attr_id,
6579 -1, -1,
6580 (zbee_zcl_fn_attr_data)dissect_zcl_analog_output_basic_attr_data
6581 );
6582} /*proto_reg_handoff_zbee_zcl_analog_output_basic*/
6583
6584
6585/* ########################################################################## */
6586/* #### (0x000E) ANALOG VALUE (BASIC) CLUSTER ############################### */
6587/* ########################################################################## */
6588
6589/*************************/
6590/* Defines */
6591/*************************/
6592
6593/*Attributes*/
6594#define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_DESCRIPTION0x001C 0x001C /* Description */
6595#define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_OUT_OF_SERVICE0x0051 0x0051 /* Out of Service */
6596#define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRESENT_VALUE0x0055 0x0055 /* Present Value */
6597#define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRIORITY_ARRAY0x0057 0x0057 /* Priority Array */
6598#define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELIABILITY0x0067 0x0067 /* Reliability */
6599#define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELINQUISH_DEFAULT0x0068 0x0068 /* Relinquish Default */
6600#define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_STATUS_FLAGS0x006F 0x006F /* Status Flags */
6601#define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_ENGINEERING_UNITS0x0075 0x0075 /* Engineering Units */
6602#define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_APPLICATION_TYPE0x0100 0x0100 /* Application Type */
6603
6604/*Server commands received - none*/
6605
6606/*Server commands generated - none*/
6607
6608/*************************/
6609/* Function Declarations */
6610/*************************/
6611
6612void proto_register_zbee_zcl_analog_value_basic(void);
6613void proto_reg_handoff_zbee_zcl_analog_value_basic(void);
6614
6615/* Command Dissector Helpers */
6616static void dissect_zcl_analog_value_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
6617
6618/* Private functions prototype */
6619
6620/*************************/
6621/* Global Variables */
6622/*************************/
6623/* Initialize the protocol and registered fields */
6624static int proto_zbee_zcl_analog_value_basic;
6625
6626static int hf_zbee_zcl_analog_value_basic_attr_id;
6627static int hf_zbee_zcl_analog_value_basic_reliability;
6628static int hf_zbee_zcl_analog_value_basic_status_flags;
6629static int hf_zbee_zcl_analog_value_basic_status_in_alarm;
6630static int hf_zbee_zcl_analog_value_basic_status_fault;
6631static int hf_zbee_zcl_analog_value_basic_status_overridden;
6632static int hf_zbee_zcl_analog_value_basic_status_out_of_service;
6633static int hf_zbee_zcl_analog_value_basic_priority_array_bool;
6634static int hf_zbee_zcl_analog_value_basic_priority_array_sing_prec;
6635static int hf_zbee_zcl_analog_value_basic_priority_array;
6636static int hf_zbee_zcl_analog_value_basic_structure;
6637
6638/* Initialize the subtree pointers */
6639static int ett_zbee_zcl_analog_value_basic;
6640static int ett_zbee_zcl_analog_value_basic_status_flags;
6641static int ett_zbee_zcl_analog_value_basic_priority_array;
6642static int ett_zbee_zcl_analog_value_basic_priority_array_structure;
6643
6644/* Attributes */
6645static const value_string zbee_zcl_analog_value_basic_attr_names[] = {
6646 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_DESCRIPTION0x001C, "Description" },
6647 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_OUT_OF_SERVICE0x0051, "Out of Service" },
6648 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRESENT_VALUE0x0055, "Present Value" },
6649 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRIORITY_ARRAY0x0057, "Priority Array" },
6650 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELIABILITY0x0067, "Reliability" },
6651 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELINQUISH_DEFAULT0x0068, "Relinquish Default" },
6652 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_STATUS_FLAGS0x006F, "Status Flags" },
6653 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_ENGINEERING_UNITS0x0075, "Engineering Units" },
6654 { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_APPLICATION_TYPE0x0100, "Application Type" },
6655 { 0, NULL((void*)0) }
6656};
6657
6658/*************************/
6659/* Function Bodies */
6660/*************************/
6661
6662/*FUNCTION:------------------------------------------------------
6663 * NAME
6664 * dissect_zbee_zcl_analog_value_basic
6665 * DESCRIPTION
6666 * ZigBee ZCL Analog Value Basic cluster dissector for wireshark.
6667 * PARAMETERS
6668 * tvbuff_t *tvb - pointer to buffer containing raw packet.
6669 * packet_info *pinfo - pointer to packet information fields
6670 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
6671 * RETURNS
6672 * int - length of parsed data.
6673 *---------------------------------------------------------------
6674 */
6675
6676static int
6677dissect_zbee_zcl_analog_value_basic(tvbuff_t *tvb _U___attribute__((unused)), packet_info *pinfo _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), void* data _U___attribute__((unused)))
6678{
6679 return tvb_captured_length(tvb);
6680} /*dissect_zbee_zcl_analog_value_basic*/
6681
6682
6683/*FUNCTION:------------------------------------------------------
6684 * NAME
6685 * dissect_zcl_analog_value_basic_attr_data
6686 * DESCRIPTION
6687 * this function is called by ZCL foundation dissector in order to decode
6688 * specific cluster attributes data.
6689 * PARAMETERS
6690 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
6691 * tvbuff_t *tvb - pointer to buffer containing raw packet.
6692 * unsigned *offset - pointer to buffer offset
6693 * uint16_t attr_id - attribute identifier
6694 * unsigned data_type - attribute data type
6695 * bool client_attr- ZCL client
6696 * RETURNS
6697 * none
6698 *---------------------------------------------------------------
6699 */
6700void
6701dissect_zcl_analog_value_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
6702{
6703 proto_item *ti = NULL((void*)0), *tj = NULL((void*)0);
6704 proto_tree *sub_tree = NULL((void*)0), *sub = NULL((void*)0);
6705 int i;
6706
6707 static int * const status_flags[] = {
6708 &hf_zbee_zcl_analog_value_basic_status_in_alarm,
6709 &hf_zbee_zcl_analog_value_basic_status_fault,
6710 &hf_zbee_zcl_analog_value_basic_status_overridden,
6711 &hf_zbee_zcl_analog_value_basic_status_out_of_service,
6712 NULL((void*)0)
6713 };
6714
6715 /* Dissect attribute data type and data */
6716 switch (attr_id) {
6717
6718 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRIORITY_ARRAY0x0057:
6719 ti = proto_tree_add_item(tree,hf_zbee_zcl_analog_value_basic_priority_array, tvb, *offset, 80, ENC_NA0x00000000);
6720 sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_analog_value_basic_priority_array);
6721
6722 for( i = 1; i <= 16; i++)
6723 {
6724 tj = proto_tree_add_item(sub_tree, hf_zbee_zcl_analog_value_basic_structure, tvb, *offset, 5, ENC_NA0x00000000);
6725 proto_item_append_text(tj," %d",i);
6726 sub = proto_item_add_subtree(tj, ett_zbee_zcl_analog_value_basic_priority_array_structure);
6727 proto_tree_add_item(sub, hf_zbee_zcl_analog_value_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
6728 *offset += 1;
6729 proto_tree_add_item(sub, hf_zbee_zcl_analog_value_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
6730 *offset += 4;
6731 }
6732 break;
6733
6734 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELIABILITY0x0067:
6735 proto_tree_add_item(tree, hf_zbee_zcl_analog_value_basic_reliability, tvb, *offset, 1, ENC_NA0x00000000);
6736 *offset += 1;
6737 break;
6738
6739 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_STATUS_FLAGS0x006F:
6740 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_ENDIAN0x80000000);
6741 *offset += 1;
6742 break;
6743
6744 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_DESCRIPTION0x001C:
6745 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_OUT_OF_SERVICE0x0051:
6746 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRESENT_VALUE0x0055:
6747 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELINQUISH_DEFAULT0x0068:
6748 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_ENGINEERING_UNITS0x0075:
6749 case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_APPLICATION_TYPE0x0100:
6750 default:
6751 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
6752 break;
6753 }
6754
6755} /*dissect_zcl_analog_value_basic_attr_data*/
6756
6757
6758/*FUNCTION:------------------------------------------------------
6759 * NAME
6760 * proto_register_zbee_zcl_analog_value_basic
6761 * DESCRIPTION
6762 * ZigBee ZCL Analog Value Basic cluster protocol registration routine.
6763 * PARAMETERS
6764 * none
6765 * RETURNS
6766 * none
6767 *---------------------------------------------------------------
6768 */
6769void
6770proto_register_zbee_zcl_analog_value_basic(void)
6771{
6772 /* Setup list of header fields */
6773 static hf_register_info hf[] = {
6774
6775 { &hf_zbee_zcl_analog_value_basic_attr_id,
6776 { "Attribute", "zbee_zcl_general.analog_value_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_analog_value_basic_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_analog_value_basic_attr_names
))))
,
6777 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6778
6779 { &hf_zbee_zcl_analog_value_basic_reliability,
6780 { "Reliability", "zbee_zcl_general.analog_value_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_reliability_names
))))
,
6781 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6782
6783 /* start Status Flags fields */
6784 { &hf_zbee_zcl_analog_value_basic_status_flags,
6785 { "Status Flags", "zbee_zcl_general.analog_value_basic.attr.status", FT_UINT8, BASE_HEX, NULL((void*)0),
6786 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6787
6788 { &hf_zbee_zcl_analog_value_basic_status_in_alarm,
6789 { "In Alarm Status", "zbee_zcl_general.analog_value_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL((void*)0),
6790 ZBEE_ZCL_STATUS_IN_ALARM0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6791
6792 { &hf_zbee_zcl_analog_value_basic_status_fault,
6793 { "Fault Status", "zbee_zcl_general.analog_value_basic.attr.status.fault", FT_BOOLEAN, 8, NULL((void*)0),
6794 ZBEE_ZCL_STATUS_FAULT0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6795
6796 { &hf_zbee_zcl_analog_value_basic_status_overridden,
6797 { "Overridden Status", "zbee_zcl_general.analog_value_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL((void*)0),
6798 ZBEE_ZCL_STATUS_OVERRIDDEN0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6799
6800 { &hf_zbee_zcl_analog_value_basic_status_out_of_service,
6801 { "Out of Service Status", "zbee_zcl_general.analog_value_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL((void*)0),
6802 ZBEE_ZCL_STATUS_OUT_OF_SERVICE0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6803 /* end Status Flags fields */
6804
6805 { &hf_zbee_zcl_analog_value_basic_priority_array_bool,
6806 { "Valid/Invalid", "zbee_zcl_general.analog_value_basic.attr.priority_array.bool", FT_BOOLEAN, BASE_NONE, TFS(&tfs_invalid_valid)((0 ? (const struct true_false_string*)0 : ((&tfs_invalid_valid
))))
,
6807 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6808
6809 { &hf_zbee_zcl_analog_value_basic_priority_array_sing_prec,
6810 { "Priority Value", "zbee_zcl_general.analog_value_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL((void*)0),
6811 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6812
6813 { &hf_zbee_zcl_analog_value_basic_priority_array,
6814 { "Priority Array", "zbee_zcl_general.analog_value_basic.priority_array", FT_NONE, BASE_NONE, NULL((void*)0),
6815 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
6816
6817 { &hf_zbee_zcl_analog_value_basic_structure,
6818 { "Structure", "zbee_zcl_general.analog_value_basic.structure", FT_NONE, BASE_NONE, NULL((void*)0),
6819 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
6820 };
6821
6822 /* ZCL Analog Value Basic subtrees */
6823 static int *ett[] = {
6824 &ett_zbee_zcl_analog_value_basic,
6825 &ett_zbee_zcl_analog_value_basic_status_flags,
6826 &ett_zbee_zcl_analog_value_basic_priority_array,
6827 &ett_zbee_zcl_analog_value_basic_priority_array_structure
6828 };
6829
6830 /* Register the ZigBee ZCL Analog Value Basic cluster protocol name and description */
6831 proto_zbee_zcl_analog_value_basic = proto_register_protocol("ZigBee ZCL Analog Value Basic", "ZCL Analog Value Basic", ZBEE_PROTOABBREV_ZCL_ANALOG_VALUE_BASIC"zbee_zcl_general.analog.value.basic");
6832 proto_register_field_array(proto_zbee_zcl_analog_value_basic, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
6833 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
6834
6835 /* Register the ZigBee ZCL Analog Value Basic dissector. */
6836 register_dissector(ZBEE_PROTOABBREV_ZCL_ANALOG_VALUE_BASIC"zbee_zcl_general.analog.value.basic", dissect_zbee_zcl_analog_value_basic, proto_zbee_zcl_analog_value_basic);
6837} /*proto_register_zbee_zcl_analog_value_basic*/
6838
6839/*FUNCTION:------------------------------------------------------
6840 * NAME
6841 * proto_reg_handoff_zbee_zcl_analog_value_basic
6842 * DESCRIPTION
6843 * Hands off the ZCL Analog Value Basic dissector.
6844 * PARAMETERS
6845 * none
6846 * RETURNS
6847 * none
6848 *---------------------------------------------------------------
6849 */
6850void
6851proto_reg_handoff_zbee_zcl_analog_value_basic(void)
6852{
6853 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ANALOG_VALUE_BASIC"zbee_zcl_general.analog.value.basic",
6854 proto_zbee_zcl_analog_value_basic,
6855 ett_zbee_zcl_analog_value_basic,
6856 ZBEE_ZCL_CID_ANALOG_VALUE_BASIC0x000e,
6857 ZBEE_MFG_CODE_NONE0x0000,
6858 hf_zbee_zcl_analog_value_basic_attr_id,
6859 hf_zbee_zcl_analog_value_basic_attr_id,
6860 -1, -1,
6861 (zbee_zcl_fn_attr_data)dissect_zcl_analog_value_basic_attr_data
6862 );
6863} /*proto_reg_handoff_zbee_zcl_analog_value_basic*/
6864
6865
6866/* ########################################################################## */
6867/* #### (0x000F) BINARY INPUT (BASIC) CLUSTER ############################### */
6868/* ########################################################################## */
6869
6870/*************************/
6871/* Defines */
6872/*************************/
6873
6874/*Attributes*/
6875#define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_ACTIVE_TEXT0x0004 0x0004 /* Active Text */
6876#define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_DESCRIPTION0x001C 0x001C /* Description */
6877#define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_INACTIVE_TEXT0x002E 0x002E /* Inactive Text */
6878#define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_OUT_OF_SERVICE0x0051 0x0051 /* Out of Service */
6879#define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_POLARITY0x0054 0x0054 /* Polarity */
6880#define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_PRESENT_VALUE0x0055 0x0055 /* Present Value */
6881#define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_RELIABILITY0x0067 0x0067 /* Reliability */
6882#define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_STATUS_FLAGS0x006F 0x006F /* Status Flags */
6883#define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_APPLICATION_TYPE0x0100 0x0100 /* Application Type */
6884
6885/*Server commands received - none*/
6886
6887/*Server commands generated - none*/
6888
6889static const value_string zbee_zcl_binary_input_polarity_values[] = {
6890 {0, "Normal"},
6891 {1, "Reversed"},
6892 {0, NULL((void*)0)}
6893};
6894
6895/*************************/
6896/* Function Declarations */
6897/*************************/
6898
6899void proto_register_zbee_zcl_binary_input_basic(void);
6900void proto_reg_handoff_zbee_zcl_binary_input_basic(void);
6901
6902/* Command Dissector Helpers */
6903static void dissect_zcl_binary_input_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
6904
6905/* Private functions prototype */
6906
6907/*************************/
6908/* Global Variables */
6909/*************************/
6910/* Initialize the protocol and registered fields */
6911static int proto_zbee_zcl_binary_input_basic;
6912
6913static int hf_zbee_zcl_binary_input_basic_attr_id;
6914static int hf_zbee_zcl_binary_input_basic_status_flags;
6915static int hf_zbee_zcl_binary_input_basic_status_in_alarm;
6916static int hf_zbee_zcl_binary_input_basic_status_fault;
6917static int hf_zbee_zcl_binary_input_basic_status_overridden;
6918static int hf_zbee_zcl_binary_input_basic_status_out_of_service;
6919static int hf_zbee_zcl_binary_input_basic_polarity;
6920static int hf_zbee_zcl_binary_input_basic_reliability;
6921
6922/* Initialize the subtree pointers */
6923static int ett_zbee_zcl_binary_input_basic;
6924static int ett_zbee_zcl_binary_input_basic_status_flags;
6925
6926/* Attributes */
6927static const value_string zbee_zcl_binary_input_basic_attr_names[] = {
6928 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_ACTIVE_TEXT0x0004, "Active Text" },
6929 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_DESCRIPTION0x001C, "Description" },
6930 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_INACTIVE_TEXT0x002E, "Inactive Text" },
6931 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_OUT_OF_SERVICE0x0051, "Out of Service" },
6932 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_POLARITY0x0054, "Polarity" },
6933 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_PRESENT_VALUE0x0055, "Present Value" },
6934 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_RELIABILITY0x0067, "Reliability" },
6935 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_STATUS_FLAGS0x006F, "Status Flags" },
6936 { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_APPLICATION_TYPE0x0100, "Application Type" },
6937 { 0, NULL((void*)0) }
6938};
6939
6940/*************************/
6941/* Function Bodies */
6942/*************************/
6943
6944/*FUNCTION:------------------------------------------------------
6945 * NAME
6946 * dissect_zbee_zcl_binary_input_basic
6947 * DESCRIPTION
6948 * ZigBee ZCL Binary Input Basic cluster dissector for wireshark.
6949 * PARAMETERS
6950 * tvbuff_t *tvb - pointer to buffer containing raw packet.
6951 * packet_info *pinfo - pointer to packet information fields
6952 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
6953 * RETURNS
6954 * int - length of parsed data.
6955 *---------------------------------------------------------------
6956 */
6957
6958static int
6959dissect_zbee_zcl_binary_input_basic(tvbuff_t *tvb _U___attribute__((unused)), packet_info *pinfo _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), void* data _U___attribute__((unused)))
6960{
6961 return tvb_captured_length(tvb);
6962} /*dissect_zbee_zcl_binary_input_basic*/
6963
6964
6965/*FUNCTION:------------------------------------------------------
6966 * NAME
6967 * dissect_zcl_binary_input_basic_attr_data
6968 * DESCRIPTION
6969 * this function is called by ZCL foundation dissector in order to decode
6970 * specific cluster attributes data.
6971 * PARAMETERS
6972 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
6973 * tvbuff_t *tvb - pointer to buffer containing raw packet.
6974 * unsigned *offset - pointer to buffer offset
6975 * uint16_t attr_id - attribute identifier
6976 * unsigned data_type - attribute data type
6977 * bool client_attr- ZCL client
6978 * RETURNS
6979 * none
6980 *---------------------------------------------------------------
6981 */
6982void
6983dissect_zcl_binary_input_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
6984{
6985 static int * const status_flags[] = {
6986 &hf_zbee_zcl_binary_input_basic_status_in_alarm,
6987 &hf_zbee_zcl_binary_input_basic_status_fault,
6988 &hf_zbee_zcl_binary_input_basic_status_overridden,
6989 &hf_zbee_zcl_binary_input_basic_status_out_of_service,
6990 NULL((void*)0)
6991 };
6992
6993 /* Dissect attribute data type and data */
6994 switch (attr_id) {
6995
6996 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_POLARITY0x0054:
6997 proto_tree_add_item(tree, hf_zbee_zcl_binary_input_basic_polarity, tvb, *offset, 1, ENC_NA0x00000000);
6998 *offset += 1;
6999 break;
7000
7001 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_RELIABILITY0x0067:
7002 proto_tree_add_item(tree, hf_zbee_zcl_binary_input_basic_reliability, tvb, *offset, 1, ENC_NA0x00000000);
7003 *offset += 1;
7004 break;
7005
7006 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_STATUS_FLAGS0x006F:
7007 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_ENDIAN0x80000000);
7008 *offset += 1;
7009 break;
7010
7011 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_ACTIVE_TEXT0x0004:
7012 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_INACTIVE_TEXT0x002E:
7013 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_DESCRIPTION0x001C:
7014 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_OUT_OF_SERVICE0x0051:
7015 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_PRESENT_VALUE0x0055:
7016 case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_APPLICATION_TYPE0x0100:
7017 default:
7018 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
7019 break;
7020 }
7021
7022} /*dissect_zcl_binary_input_basic_attr_data*/
7023
7024
7025/*FUNCTION:------------------------------------------------------
7026 * NAME
7027 * proto_register_zbee_zcl_binary_input_basic
7028 * DESCRIPTION
7029 * ZigBee ZCL Binary Input Basic cluster protocol registration routine.
7030 * PARAMETERS
7031 * none
7032 * RETURNS
7033 * none
7034 *---------------------------------------------------------------
7035 */
7036void
7037proto_register_zbee_zcl_binary_input_basic(void)
7038{
7039 /* Setup list of header fields */
7040 static hf_register_info hf[] = {
7041
7042 { &hf_zbee_zcl_binary_input_basic_attr_id,
7043 { "Attribute", "zbee_zcl_general.binary_input_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_binary_input_basic_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_binary_input_basic_attr_names
))))
,
7044 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7045
7046 { &hf_zbee_zcl_binary_input_basic_reliability,
7047 { "Reliability", "zbee_zcl_general.binary_input_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_reliability_names
))))
,
7048 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7049
7050 /* start Status Flags fields */
7051 { &hf_zbee_zcl_binary_input_basic_status_flags,
7052 { "Status Flags", "zbee_zcl_general.binary_input_basic.attr.status", FT_UINT8, BASE_HEX, NULL((void*)0),
7053 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7054
7055 { &hf_zbee_zcl_binary_input_basic_status_in_alarm,
7056 { "In Alarm Status", "zbee_zcl_general.binary_input_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL((void*)0),
7057 ZBEE_ZCL_STATUS_IN_ALARM0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7058
7059 { &hf_zbee_zcl_binary_input_basic_status_fault,
7060 { "Fault Status", "zbee_zcl_general.binary_input_basic.attr.status.fault", FT_BOOLEAN, 8, NULL((void*)0),
7061 ZBEE_ZCL_STATUS_FAULT0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7062
7063 { &hf_zbee_zcl_binary_input_basic_status_overridden,
7064 { "Overridden Status", "zbee_zcl_general.binary_input_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL((void*)0),
7065 ZBEE_ZCL_STATUS_OVERRIDDEN0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7066
7067 { &hf_zbee_zcl_binary_input_basic_status_out_of_service,
7068 { "Out of Service Status", "zbee_zcl_general.binary_input_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL((void*)0),
7069 ZBEE_ZCL_STATUS_OUT_OF_SERVICE0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7070 /* end Status Flags fields */
7071
7072 { &hf_zbee_zcl_binary_input_basic_polarity,
7073 { "Polarity", "zbee_zcl_general.binary_input_basic.attr.polarity", FT_UINT8, BASE_HEX, VALS(zbee_zcl_binary_input_polarity_values)((0 ? (const struct _value_string*)0 : ((zbee_zcl_binary_input_polarity_values
))))
,
7074 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
7075
7076 };
7077
7078 /* ZCL Binary Input Basic subtrees */
7079 static int *ett[] = {
7080 &ett_zbee_zcl_binary_input_basic,
7081 &ett_zbee_zcl_binary_input_basic_status_flags
7082 };
7083
7084 /* Register the ZigBee ZCL Binary Input Basic cluster protocol name and description */
7085 proto_zbee_zcl_binary_input_basic = proto_register_protocol("ZigBee ZCL Binary Input Basic", "ZCL Binary Input Basic", ZBEE_PROTOABBREV_ZCL_BINARY_INPUT_BASIC"zbee_zcl_general.binary_input_basic");
7086 proto_register_field_array(proto_zbee_zcl_binary_input_basic, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
7087 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
7088
7089 /* Register the ZigBee ZCL Binary Input Basic dissector. */
7090 register_dissector(ZBEE_PROTOABBREV_ZCL_BINARY_INPUT_BASIC"zbee_zcl_general.binary_input_basic", dissect_zbee_zcl_binary_input_basic, proto_zbee_zcl_binary_input_basic);
7091} /*proto_register_zbee_zcl_binary_input_basic*/
7092
7093/*FUNCTION:------------------------------------------------------
7094 * NAME
7095 * proto_reg_handoff_zbee_zcl_binary_input_basic
7096 * DESCRIPTION
7097 * Hands off the ZCL Binary Input Basic dissector.
7098 * PARAMETERS
7099 * none
7100 * RETURNS
7101 * none
7102 *---------------------------------------------------------------
7103 */
7104void
7105proto_reg_handoff_zbee_zcl_binary_input_basic(void)
7106{
7107 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_BINARY_INPUT_BASIC"zbee_zcl_general.binary_input_basic",
7108 proto_zbee_zcl_binary_input_basic,
7109 ett_zbee_zcl_binary_input_basic,
7110 ZBEE_ZCL_CID_BINARY_INPUT_BASIC0x000f,
7111 ZBEE_MFG_CODE_NONE0x0000,
7112 hf_zbee_zcl_binary_input_basic_attr_id,
7113 hf_zbee_zcl_binary_input_basic_attr_id,
7114 -1, -1,
7115 (zbee_zcl_fn_attr_data)dissect_zcl_binary_input_basic_attr_data
7116 );
7117} /*proto_reg_handoff_zbee_zcl_binary_input_basic*/
7118
7119/* ########################################################################## */
7120/* #### (0x0010) BINARY OUTPUT (BASIC) CLUSTER ############################## */
7121/* ########################################################################## */
7122
7123/*************************/
7124/* Defines */
7125/*************************/
7126
7127/*Attributes*/
7128#define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_ACTIVE_TEXT0x0004 0x0004 /* Active Text */
7129#define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_DESCRIPTION0x001C 0x001C /* Description */
7130#define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_INACTIVE_TEXT0x002E 0x002E /* Inactive Text */
7131#define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_OFF_TIME0x0042 0x0042 /* Maximum Off Time */
7132#define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_ON_TIME0x0043 0x0043 /* Minimum On Time */
7133#define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_OUT_OF_SERVICE0x0051 0x0051 /* Out of Service */
7134#define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_POLARITY0x0054 0x0054 /* Polarity */
7135#define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRESENT_VALUE0x0055 0x0055 /* Present Value */
7136#define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRIORITY_ARRAY0x0057 0x0057 /* Priority Array */
7137#define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELIABILITY0x0067 0x0067 /* Reliability */
7138#define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELINQUISH_DEFAULT0x0068 0x0068 /* Relinquish Default */
7139#define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_STATUS_FLAGS0x006F 0x006F /* Status Flags */
7140#define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_APPLICATION_TYPE0x0100 0x0100 /* Application Type */
7141
7142/*Server commands received - none*/
7143
7144/*Server commands generated - none*/
7145
7146static const value_string zbee_zcl_binary_output_polarity_values[] = {
7147 {0, "Normal"},
7148 {1, "Reversed"},
7149 {0, NULL((void*)0)}
7150};
7151
7152/*************************/
7153/* Function Declarations */
7154/*************************/
7155
7156void proto_register_zbee_zcl_binary_output_basic(void);
7157void proto_reg_handoff_zbee_zcl_binary_output_basic(void);
7158
7159/* Command Dissector Helpers */
7160static void dissect_zcl_binary_output_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
7161
7162/* Private functions prototype */
7163
7164/*************************/
7165/* Global Variables */
7166/*************************/
7167/* Initialize the protocol and registered fields */
7168static int proto_zbee_zcl_binary_output_basic;
7169
7170static int hf_zbee_zcl_binary_output_basic_attr_id;
7171static int hf_zbee_zcl_binary_output_basic_status_flags;
7172static int hf_zbee_zcl_binary_output_basic_status_in_alarm;
7173static int hf_zbee_zcl_binary_output_basic_status_fault;
7174static int hf_zbee_zcl_binary_output_basic_status_overridden;
7175static int hf_zbee_zcl_binary_output_basic_status_out_of_service;
7176static int hf_zbee_zcl_binary_output_basic_priority_array_bool;
7177static int hf_zbee_zcl_binary_output_basic_priority_array_sing_prec;
7178static int hf_zbee_zcl_binary_output_basic_polarity;
7179static int hf_zbee_zcl_binary_output_basic_reliability;
7180static int hf_zbee_zcl_binary_output_basic_priority_array;
7181static int hf_zbee_zcl_binary_output_basic_structure;
7182
7183/* Initialize the subtree pointers */
7184static int ett_zbee_zcl_binary_output_basic;
7185static int ett_zbee_zcl_binary_output_basic_status_flags;
7186static int ett_zbee_zcl_binary_output_basic_priority_array;
7187static int ett_zbee_zcl_binary_output_basic_priority_array_structure;
7188
7189/* Attributes */
7190static const value_string zbee_zcl_binary_output_basic_attr_names[] = {
7191 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_ACTIVE_TEXT0x0004, "Active Text" },
7192 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_DESCRIPTION0x001C, "Description" },
7193 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_INACTIVE_TEXT0x002E, "Inactive Text" },
7194 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_OFF_TIME0x0042, "Minimum Off Time" },
7195 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_ON_TIME0x0043, "Minimum On Time" },
7196 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_OUT_OF_SERVICE0x0051, "Out of Service" },
7197 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_POLARITY0x0054, "Polarity" },
7198 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRESENT_VALUE0x0055, "Present Value" },
7199 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRIORITY_ARRAY0x0057, "Priority Array" },
7200 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELIABILITY0x0067, "Reliability" },
7201 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELINQUISH_DEFAULT0x0068, "Relinquish Default" },
7202 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_STATUS_FLAGS0x006F, "Status Flags" },
7203 { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_APPLICATION_TYPE0x0100, "Application Type" },
7204 { 0, NULL((void*)0) }
7205};
7206
7207/*************************/
7208/* Function Bodies */
7209/*************************/
7210
7211/*FUNCTION:------------------------------------------------------
7212 * NAME
7213 * dissect_zbee_zcl_binary_output_basic
7214 * DESCRIPTION
7215 * ZigBee ZCL Binary Output Basic cluster dissector for wireshark.
7216 * PARAMETERS
7217 * tvbuff_t *tvb - pointer to buffer containing raw packet.
7218 * packet_info *pinfo - pointer to packet information fields
7219 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
7220 * RETURNS
7221 * int - length of parsed data.
7222 *---------------------------------------------------------------
7223 */
7224
7225static int
7226dissect_zbee_zcl_binary_output_basic(tvbuff_t *tvb _U___attribute__((unused)), packet_info *pinfo _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), void* data _U___attribute__((unused)))
7227{
7228 return tvb_captured_length(tvb);
7229} /*dissect_zbee_zcl_binary_output_basic*/
7230
7231
7232/*FUNCTION:------------------------------------------------------
7233 * NAME
7234 * dissect_zcl_binary_output_basic_attr_data
7235 * DESCRIPTION
7236 * this function is called by ZCL foundation dissector in order to decode
7237 * specific cluster attributes data.
7238 * PARAMETERS
7239 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
7240 * tvbuff_t *tvb - pointer to buffer containing raw packet.
7241 * unsigned *offset - pointer to buffer offset
7242 * uint16_t attr_id - attribute identifier
7243 * unsigned data_type - attribute data type
7244 * bool client_attr- ZCL client
7245 * RETURNS
7246 * none
7247 *---------------------------------------------------------------
7248 */
7249void
7250dissect_zcl_binary_output_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
7251{
7252 proto_item *ti = NULL((void*)0), *tj = NULL((void*)0);
7253 proto_tree *sub_tree = NULL((void*)0), *sub = NULL((void*)0);
7254 int i;
7255
7256 static int * const status_flags[] = {
7257 &hf_zbee_zcl_binary_output_basic_status_in_alarm,
7258 &hf_zbee_zcl_binary_output_basic_status_fault,
7259 &hf_zbee_zcl_binary_output_basic_status_overridden,
7260 &hf_zbee_zcl_binary_output_basic_status_out_of_service,
7261 NULL((void*)0)
7262 };
7263
7264 /* Dissect attribute data type and data */
7265 switch (attr_id) {
7266
7267 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRIORITY_ARRAY0x0057:
7268 ti = proto_tree_add_item(tree,hf_zbee_zcl_binary_output_basic_priority_array, tvb, *offset, 80, ENC_NA0x00000000);
7269 sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_binary_output_basic_priority_array);
7270
7271 for(i = 1; i <= 16; i++)
7272 {
7273 tj = proto_tree_add_item(sub_tree, hf_zbee_zcl_binary_output_basic_structure, tvb, *offset, 5, ENC_NA0x00000000);
7274 proto_item_append_text(tj," %d",i);
7275 sub = proto_item_add_subtree(tj, ett_zbee_zcl_binary_output_basic_priority_array_structure);
7276 proto_tree_add_item(sub, hf_zbee_zcl_binary_output_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
7277 *offset += 1;
7278 proto_tree_add_item(sub, hf_zbee_zcl_binary_output_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
7279 *offset += 4;
7280 }
7281 break;
7282
7283 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_POLARITY0x0054:
7284 proto_tree_add_item(tree, hf_zbee_zcl_binary_output_basic_polarity, tvb, *offset, 1, ENC_NA0x00000000);
7285 *offset += 1;
7286 break;
7287
7288 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELIABILITY0x0067:
7289 proto_tree_add_item(tree, hf_zbee_zcl_binary_output_basic_reliability, tvb, *offset, 1, ENC_NA0x00000000);
7290 *offset += 1;
7291 break;
7292
7293 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_STATUS_FLAGS0x006F:
7294 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_ENDIAN0x80000000);
7295 *offset += 1;
7296 break;
7297
7298 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_ACTIVE_TEXT0x0004:
7299 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_DESCRIPTION0x001C:
7300 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_INACTIVE_TEXT0x002E:
7301 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_OFF_TIME0x0042:
7302 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_ON_TIME0x0043:
7303 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_OUT_OF_SERVICE0x0051:
7304 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRESENT_VALUE0x0055:
7305 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELINQUISH_DEFAULT0x0068:
7306 case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_APPLICATION_TYPE0x0100:
7307 default:
7308 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
7309 break;
7310 }
7311
7312} /*dissect_zcl_binary_output_basic_attr_data*/
7313
7314
7315/*FUNCTION:------------------------------------------------------
7316 * NAME
7317 * proto_register_zbee_zcl_binary_output_basic
7318 * DESCRIPTION
7319 * ZigBee ZCL Binary Output Basic cluster protocol registration routine.
7320 * PARAMETERS
7321 * none
7322 * RETURNS
7323 * none
7324 *---------------------------------------------------------------
7325 */
7326void
7327proto_register_zbee_zcl_binary_output_basic(void)
7328{
7329 /* Setup list of header fields */
7330 static hf_register_info hf[] = {
7331
7332 { &hf_zbee_zcl_binary_output_basic_attr_id,
7333 { "Attribute", "zbee_zcl_general.binary_output_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_binary_output_basic_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_binary_output_basic_attr_names
))))
,
7334 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7335
7336 { &hf_zbee_zcl_binary_output_basic_reliability,
7337 { "Reliability", "zbee_zcl_general.binary_output_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_reliability_names
))))
,
7338 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7339
7340 /* start Status Flags fields */
7341 { &hf_zbee_zcl_binary_output_basic_status_flags,
7342 { "Status Flags", "zbee_zcl_general.binary_output_basic.attr.status", FT_UINT8, BASE_HEX, NULL((void*)0),
7343 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7344
7345 { &hf_zbee_zcl_binary_output_basic_status_in_alarm,
7346 { "In Alarm Status", "zbee_zcl_general.binary_output_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL((void*)0),
7347 ZBEE_ZCL_STATUS_IN_ALARM0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7348
7349 { &hf_zbee_zcl_binary_output_basic_status_fault,
7350 { "Fault Status", "zbee_zcl_general.binary_output_basic.attr.status.fault", FT_BOOLEAN, 8, NULL((void*)0),
7351 ZBEE_ZCL_STATUS_FAULT0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7352
7353 { &hf_zbee_zcl_binary_output_basic_status_overridden,
7354 { "Overridden Status", "zbee_zcl_general.binary_output_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL((void*)0),
7355 ZBEE_ZCL_STATUS_OVERRIDDEN0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7356
7357 { &hf_zbee_zcl_binary_output_basic_status_out_of_service,
7358 { "Out of Service Status", "zbee_zcl_general.binary_output_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL((void*)0),
7359 ZBEE_ZCL_STATUS_OUT_OF_SERVICE0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7360 /* end Status Flags fields */
7361
7362 { &hf_zbee_zcl_binary_output_basic_polarity,
7363 { "Polarity", "zbee_zcl_general.binary_output_basic.attr.polarity", FT_UINT8, BASE_HEX, VALS(zbee_zcl_binary_output_polarity_values)((0 ? (const struct _value_string*)0 : ((zbee_zcl_binary_output_polarity_values
))))
,
7364 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7365
7366 { &hf_zbee_zcl_binary_output_basic_priority_array_bool,
7367 { "Valid/Invalid", "zbee_zcl_general.binary_output_basic.attr.priority_array.bool", FT_BOOLEAN, BASE_NONE, TFS(&tfs_invalid_valid)((0 ? (const struct true_false_string*)0 : ((&tfs_invalid_valid
))))
,
7368 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7369
7370 { &hf_zbee_zcl_binary_output_basic_priority_array_sing_prec,
7371 { "Priority Value", "zbee_zcl_general.binary_output_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL((void*)0),
7372 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7373
7374 { &hf_zbee_zcl_binary_output_basic_priority_array,
7375 { "Priority Array", "zbee_zcl_general.binary_output_basic.priority_array", FT_NONE, BASE_NONE, NULL((void*)0),
7376 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7377
7378 { &hf_zbee_zcl_binary_output_basic_structure,
7379 { "Structure", "zbee_zcl_general.binary_output_basic.structure", FT_NONE, BASE_NONE, NULL((void*)0),
7380 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
7381 };
7382
7383 /* ZCL Binary Output Basic subtrees */
7384 static int *ett[] = {
7385 &ett_zbee_zcl_binary_output_basic,
7386 &ett_zbee_zcl_binary_output_basic_status_flags,
7387 &ett_zbee_zcl_binary_output_basic_priority_array,
7388 &ett_zbee_zcl_binary_output_basic_priority_array_structure
7389 };
7390
7391 /* Register the ZigBee ZCL Binary Output Basic cluster protocol name and description */
7392 proto_zbee_zcl_binary_output_basic = proto_register_protocol("ZigBee ZCL Binary Output Basic", "ZCL Binary Output Basic", ZBEE_PROTOABBREV_ZCL_BINARY_OUTPUT_BASIC"zbee_zcl_general.binary_output_basic");
7393 proto_register_field_array(proto_zbee_zcl_binary_output_basic, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
7394 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
7395
7396 /* Register the ZigBee ZCL Binary Output Basic dissector. */
7397 register_dissector(ZBEE_PROTOABBREV_ZCL_BINARY_OUTPUT_BASIC"zbee_zcl_general.binary_output_basic", dissect_zbee_zcl_binary_output_basic, proto_zbee_zcl_binary_output_basic);
7398} /*proto_register_zbee_zcl_binary_output_basic*/
7399
7400/*FUNCTION:------------------------------------------------------
7401 * NAME
7402 * proto_reg_handoff_zbee_zcl_binary_output_basic
7403 * DESCRIPTION
7404 * Hands off the ZCL Binary Output Basic dissector.
7405 * PARAMETERS
7406 * none
7407 * RETURNS
7408 * none
7409 *---------------------------------------------------------------
7410 */
7411void
7412proto_reg_handoff_zbee_zcl_binary_output_basic(void)
7413{
7414 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_BINARY_OUTPUT_BASIC"zbee_zcl_general.binary_output_basic",
7415 proto_zbee_zcl_binary_output_basic,
7416 ett_zbee_zcl_binary_output_basic,
7417 ZBEE_ZCL_CID_BINARY_OUTPUT_BASIC0x0010,
7418 ZBEE_MFG_CODE_NONE0x0000,
7419 hf_zbee_zcl_binary_output_basic_attr_id,
7420 hf_zbee_zcl_binary_output_basic_attr_id,
7421 -1, -1,
7422 (zbee_zcl_fn_attr_data)dissect_zcl_binary_output_basic_attr_data
7423 );
7424} /*proto_reg_handoff_zbee_zcl_binary_output_basic*/
7425
7426/* ########################################################################## */
7427/* #### (0x0011) BINARY VALUE (BASIC) CLUSTER ############################### */
7428/* ########################################################################## */
7429
7430/*************************/
7431/* Defines */
7432/*************************/
7433
7434/*Attributes*/
7435#define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_ACTIVE_TEXT0x0004 0x0004 /* Active Text */
7436#define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_DESCRIPTION0x001C 0x001C /* Description */
7437#define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_INACTIVE_TEXT0x002E 0x002E /* Inactive Text */
7438#define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_OFF_TIME0x0042 0x0042 /* Maximum Off Time */
7439#define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_ON_TIME0x0043 0x0043 /* Minimum On Time */
7440#define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_OUT_OF_SERVICE0x0051 0x0051 /* Out of Service */
7441#define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRESENT_VALUE0x0055 0x0055 /* Present Value */
7442#define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRIORITY_ARRAY0x0057 0x0057 /* Priority Array */
7443#define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELIABILITY0x0067 0x0067 /* Reliability */
7444#define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELINQUISH_DEFAULT0x0068 0x0068 /* Relinquish Default */
7445#define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_STATUS_FLAGS0x006F 0x006F /* Status Flags */
7446#define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_APPLICATION_TYPE0x0100 0x0100 /* Application Type */
7447
7448/*Server commands received - none*/
7449
7450/*Server commands generated - none*/
7451
7452/*************************/
7453/* Function Declarations */
7454/*************************/
7455
7456void proto_register_zbee_zcl_binary_value_basic(void);
7457void proto_reg_handoff_zbee_zcl_binary_value_basic(void);
7458
7459/* Command Dissector Helpers */
7460static void dissect_zcl_binary_value_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
7461
7462/* Private functions prototype */
7463
7464/*************************/
7465/* Global Variables */
7466/*************************/
7467/* Initialize the protocol and registered fields */
7468static int proto_zbee_zcl_binary_value_basic;
7469
7470static int hf_zbee_zcl_binary_value_basic_attr_id;
7471static int hf_zbee_zcl_binary_value_basic_status_flags;
7472static int hf_zbee_zcl_binary_value_basic_status_in_alarm;
7473static int hf_zbee_zcl_binary_value_basic_status_fault;
7474static int hf_zbee_zcl_binary_value_basic_status_overridden;
7475static int hf_zbee_zcl_binary_value_basic_status_out_of_service;
7476static int hf_zbee_zcl_binary_value_basic_priority_array_bool;
7477static int hf_zbee_zcl_binary_value_basic_priority_array_sing_prec;
7478static int hf_zbee_zcl_binary_value_basic_reliability;
7479static int hf_zbee_zcl_binary_value_basic_priority_array;
7480static int hf_zbee_zcl_binary_value_basic_structure;
7481
7482/* Initialize the subtree pointers */
7483static int ett_zbee_zcl_binary_value_basic;
7484static int ett_zbee_zcl_binary_value_basic_status_flags;
7485static int ett_zbee_zcl_binary_value_basic_priority_array;
7486static int ett_zbee_zcl_binary_value_basic_priority_array_structure;
7487
7488/* Attributes */
7489static const value_string zbee_zcl_binary_value_basic_attr_names[] = {
7490 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_ACTIVE_TEXT0x0004, "Active Text" },
7491 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_DESCRIPTION0x001C, "Description" },
7492 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_INACTIVE_TEXT0x002E, "Inactive Text" },
7493 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_OFF_TIME0x0042, "Minimum Off Time" },
7494 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_ON_TIME0x0043, "Minimum On Time" },
7495 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_OUT_OF_SERVICE0x0051, "Out of Service" },
7496 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRESENT_VALUE0x0055, "Present Value" },
7497 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRIORITY_ARRAY0x0057, "Priority Array" },
7498 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELIABILITY0x0067, "Reliability" },
7499 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELINQUISH_DEFAULT0x0068, "Relinquish Default" },
7500 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_STATUS_FLAGS0x006F, "Status Flags" },
7501 { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_APPLICATION_TYPE0x0100, "Application Type" },
7502 { 0, NULL((void*)0) }
7503};
7504
7505/*************************/
7506/* Function Bodies */
7507/*************************/
7508
7509/*FUNCTION:------------------------------------------------------
7510 * NAME
7511 * dissect_zbee_zcl_binary_value_basic
7512 * DESCRIPTION
7513 * ZigBee ZCL Binary Value Basic cluster dissector for wireshark.
7514 * PARAMETERS
7515 * tvbuff_t *tvb - pointer to buffer containing raw packet.
7516 * packet_info *pinfo - pointer to packet information fields
7517 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
7518 * RETURNS
7519 * int - length of parsed data.
7520 *---------------------------------------------------------------
7521 */
7522
7523static int
7524dissect_zbee_zcl_binary_value_basic(tvbuff_t *tvb _U___attribute__((unused)), packet_info *pinfo _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), void* data _U___attribute__((unused)))
7525{
7526 return tvb_captured_length(tvb);
7527} /*dissect_zbee_zcl_binary_value_basic*/
7528
7529
7530/*FUNCTION:------------------------------------------------------
7531 * NAME
7532 * dissect_zcl_binary_value_basic_attr_data
7533 * DESCRIPTION
7534 * this function is called by ZCL foundation dissector in order to decode
7535 * specific cluster attributes data.
7536 * PARAMETERS
7537 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
7538 * tvbuff_t *tvb - pointer to buffer containing raw packet.
7539 * unsigned *offset - pointer to buffer offset
7540 * uint16_t attr_id - attribute identifier
7541 * unsigned data_type - attribute data type
7542 * bool client_attr- ZCL client
7543 * RETURNS
7544 * none
7545 *---------------------------------------------------------------
7546 */
7547void
7548dissect_zcl_binary_value_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
7549{
7550 proto_item *ti = NULL((void*)0), *tj = NULL((void*)0);
7551 proto_tree *sub_tree = NULL((void*)0), *sub = NULL((void*)0);
7552 int i;
7553
7554 static int * const status_flags[] = {
7555 &hf_zbee_zcl_binary_value_basic_status_in_alarm,
7556 &hf_zbee_zcl_binary_value_basic_status_fault,
7557 &hf_zbee_zcl_binary_value_basic_status_overridden,
7558 &hf_zbee_zcl_binary_value_basic_status_out_of_service,
7559 NULL((void*)0)
7560 };
7561
7562 /* Dissect attribute data type and data */
7563 switch (attr_id) {
7564
7565 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRIORITY_ARRAY0x0057:
7566 ti = proto_tree_add_item(tree,hf_zbee_zcl_binary_value_basic_priority_array, tvb, *offset, 80, ENC_NA0x00000000);
7567 sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_binary_value_basic_priority_array);
7568
7569 for( i = 1; i <= 16; i++)
7570 {
7571 tj = proto_tree_add_item(sub_tree, hf_zbee_zcl_binary_value_basic_structure, tvb, *offset, 5, ENC_NA0x00000000);
7572 proto_item_append_text(tj," %d",i);
7573 sub = proto_item_add_subtree(tj, ett_zbee_zcl_binary_value_basic_priority_array_structure);
7574 proto_tree_add_item(sub, hf_zbee_zcl_binary_value_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
7575 *offset += 1;
7576 proto_tree_add_item(sub, hf_zbee_zcl_binary_value_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
7577 *offset += 4;
7578 }
7579 break;
7580
7581 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELIABILITY0x0067:
7582 proto_tree_add_item(tree, hf_zbee_zcl_binary_value_basic_reliability, tvb, *offset, 1, ENC_NA0x00000000);
7583 *offset += 1;
7584 break;
7585
7586 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_STATUS_FLAGS0x006F:
7587 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_ENDIAN0x80000000);
7588 *offset += 1;
7589 break;
7590
7591 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_ACTIVE_TEXT0x0004:
7592 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_DESCRIPTION0x001C:
7593 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_INACTIVE_TEXT0x002E:
7594 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_OFF_TIME0x0042:
7595 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_ON_TIME0x0043:
7596 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_OUT_OF_SERVICE0x0051:
7597 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRESENT_VALUE0x0055:
7598 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELINQUISH_DEFAULT0x0068:
7599 case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_APPLICATION_TYPE0x0100:
7600 default:
7601 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
7602 break;
7603 }
7604
7605} /*dissect_zcl_binary_value_basic_attr_data*/
7606
7607
7608/*FUNCTION:------------------------------------------------------
7609 * NAME
7610 * proto_register_zbee_zcl_binary_value_basic
7611 * DESCRIPTION
7612 * ZigBee ZCL Binary Value Basic cluster protocol registration routine.
7613 * PARAMETERS
7614 * none
7615 * RETURNS
7616 * none
7617 *---------------------------------------------------------------
7618 */
7619void
7620proto_register_zbee_zcl_binary_value_basic(void)
7621{
7622 /* Setup list of header fields */
7623 static hf_register_info hf[] = {
7624
7625 { &hf_zbee_zcl_binary_value_basic_attr_id,
7626 { "Attribute", "zbee_zcl_general.binary_value_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_binary_value_basic_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_binary_value_basic_attr_names
))))
,
7627 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7628
7629 { &hf_zbee_zcl_binary_value_basic_reliability,
7630 { "Reliability", "zbee_zcl_general.binary_value_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_reliability_names
))))
,
7631 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7632
7633 /* start Status Flags fields */
7634 { &hf_zbee_zcl_binary_value_basic_status_flags,
7635 { "Status Flags", "zbee_zcl_general.binary_value_basic.attr.status", FT_UINT8, BASE_HEX, NULL((void*)0),
7636 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7637
7638 { &hf_zbee_zcl_binary_value_basic_status_in_alarm,
7639 { "In Alarm Status", "zbee_zcl_general.binary_value_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL((void*)0),
7640 ZBEE_ZCL_STATUS_IN_ALARM0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7641
7642 { &hf_zbee_zcl_binary_value_basic_status_fault,
7643 { "Fault Status", "zbee_zcl_general.binary_value_basic.attr.status.fault", FT_BOOLEAN, 8, NULL((void*)0),
7644 ZBEE_ZCL_STATUS_FAULT0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7645
7646 { &hf_zbee_zcl_binary_value_basic_status_overridden,
7647 { "Overridden Status", "zbee_zcl_general.binary_value_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL((void*)0),
7648 ZBEE_ZCL_STATUS_OVERRIDDEN0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7649
7650 { &hf_zbee_zcl_binary_value_basic_status_out_of_service,
7651 { "Out of Service Status", "zbee_zcl_general.binary_value_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL((void*)0),
7652 ZBEE_ZCL_STATUS_OUT_OF_SERVICE0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7653 /* end Status Flags fields */
7654
7655 { &hf_zbee_zcl_binary_value_basic_priority_array_bool,
7656 { "Valid/Invalid", "zbee_zcl_general.binary_value_basic.attr.priority_array.bool", FT_BOOLEAN, BASE_NONE, TFS(&tfs_invalid_valid)((0 ? (const struct true_false_string*)0 : ((&tfs_invalid_valid
))))
,
7657 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7658
7659 { &hf_zbee_zcl_binary_value_basic_priority_array_sing_prec,
7660 { "Priority Value", "zbee_zcl_general.binary_value_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL((void*)0),
7661 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7662
7663 { &hf_zbee_zcl_binary_value_basic_priority_array,
7664 { "Priority Array", "zbee_zcl_general.binary_value_basic.priority_array", FT_NONE, BASE_NONE, NULL((void*)0),
7665 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7666
7667 { &hf_zbee_zcl_binary_value_basic_structure,
7668 { "Structure", "zbee_zcl_general.binary_value_basic.structure", FT_NONE, BASE_NONE, NULL((void*)0),
7669 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
7670 };
7671
7672 /* ZCL Binary Value Basic subtrees */
7673 static int *ett[] = {
7674 &ett_zbee_zcl_binary_value_basic,
7675 &ett_zbee_zcl_binary_value_basic_status_flags,
7676 &ett_zbee_zcl_binary_value_basic_priority_array,
7677 &ett_zbee_zcl_binary_value_basic_priority_array_structure
7678 };
7679
7680 /* Register the ZigBee ZCL Binary Value Basic cluster protocol name and description */
7681 proto_zbee_zcl_binary_value_basic = proto_register_protocol("ZigBee ZCL Binary Value Basic", "ZCL Binary Value Basic", ZBEE_PROTOABBREV_ZCL_BINARY_VALUE_BASIC"zbee_zcl_general.binary_value_basic");
7682 proto_register_field_array(proto_zbee_zcl_binary_value_basic, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
7683 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
7684
7685 /* Register the ZigBee ZCL Binary Value Basic dissector. */
7686 register_dissector(ZBEE_PROTOABBREV_ZCL_BINARY_VALUE_BASIC"zbee_zcl_general.binary_value_basic", dissect_zbee_zcl_binary_value_basic, proto_zbee_zcl_binary_value_basic);
7687} /*proto_register_zbee_zcl_binary_value_basic*/
7688
7689/*FUNCTION:------------------------------------------------------
7690 * NAME
7691 * proto_reg_handoff_zbee_zcl_binary_value_basic
7692 * DESCRIPTION
7693 * Hands off the ZCL Binary Value Basic dissector.
7694 * PARAMETERS
7695 * none
7696 * RETURNS
7697 * none
7698 *---------------------------------------------------------------
7699 */
7700void
7701proto_reg_handoff_zbee_zcl_binary_value_basic(void)
7702{
7703 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_BINARY_VALUE_BASIC"zbee_zcl_general.binary_value_basic",
7704 proto_zbee_zcl_binary_value_basic,
7705 ett_zbee_zcl_binary_value_basic,
7706 ZBEE_ZCL_CID_BINARY_VALUE_BASIC0x0011,
7707 ZBEE_MFG_CODE_NONE0x0000,
7708 hf_zbee_zcl_binary_value_basic_attr_id,
7709 hf_zbee_zcl_binary_value_basic_attr_id,
7710 -1, -1,
7711 (zbee_zcl_fn_attr_data)dissect_zcl_binary_value_basic_attr_data
7712 );
7713} /*proto_reg_handoff_zbee_zcl_binary_value_basic*/
7714
7715
7716/* ########################################################################## */
7717/* #### (0x0012) MULTISTATE INPUT (BASIC) CLUSTER ########################### */
7718/* ########################################################################## */
7719
7720/*************************/
7721/* Defines */
7722/*************************/
7723
7724/*Attributes*/
7725#define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_STATE_TEXT0x000E 0x000E /* State Text */
7726#define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_DESCRIPTION0x001C 0x001C /* Description */
7727#define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_NUMBER_OF_STATES0x004A 0x004A /* Number of States */
7728#define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_OUT_OF_SERVICE0x0051 0x0051 /* Out of Service */
7729#define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_PRESENT_VALUE0x0055 0x0055 /* Present Value */
7730#define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_RELIABILITY0x0067 0x0067 /* Reliability */
7731#define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_STATUS_FLAGS0x006F 0x006F /* Status Flags */
7732#define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_APPLICATION_TYPE0x0100 0x0100 /* Application Type */
7733
7734/*Server commands received - none*/
7735
7736/*Server commands generated - none*/
7737
7738/*************************/
7739/* Function Declarations */
7740/*************************/
7741
7742void proto_register_zbee_zcl_multistate_input_basic(void);
7743void proto_reg_handoff_zbee_zcl_multistate_input_basic(void);
7744
7745/* Command Dissector Helpers */
7746static void dissect_zcl_multistate_input_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
7747
7748/* Private functions prototype */
7749
7750/*************************/
7751/* Global Variables */
7752/*************************/
7753/* Initialize the protocol and registered fields */
7754static int proto_zbee_zcl_multistate_input_basic;
7755
7756static int hf_zbee_zcl_multistate_input_basic_attr_id;
7757static int hf_zbee_zcl_multistate_input_basic_status_flags;
7758static int hf_zbee_zcl_multistate_input_basic_status_in_alarm;
7759static int hf_zbee_zcl_multistate_input_basic_status_fault;
7760static int hf_zbee_zcl_multistate_input_basic_status_overridden;
7761static int hf_zbee_zcl_multistate_input_basic_status_out_of_service;
7762static int hf_zbee_zcl_multistate_input_basic_reliability;
7763
7764/* Initialize the subtree pointers */
7765static int ett_zbee_zcl_multistate_input_basic;
7766static int ett_zbee_zcl_multistate_input_basic_status_flags;
7767
7768/* Attributes */
7769static const value_string zbee_zcl_multistate_input_basic_attr_names[] = {
7770 { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_STATE_TEXT0x000E, "State Text" },
7771 { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_DESCRIPTION0x001C, "Description" },
7772 { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_NUMBER_OF_STATES0x004A, "Number of States" },
7773 { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_OUT_OF_SERVICE0x0051, "Out of Service" },
7774 { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_PRESENT_VALUE0x0055, "Present Value" },
7775 { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_RELIABILITY0x0067, "Reliability" },
7776 { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_STATUS_FLAGS0x006F, "Status Flags" },
7777 { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_APPLICATION_TYPE0x0100, "Application Type" },
7778 { 0, NULL((void*)0) }
7779};
7780
7781/*************************/
7782/* Function Bodies */
7783/*************************/
7784
7785/*FUNCTION:------------------------------------------------------
7786 * NAME
7787 * dissect_zbee_zcl_multistate_input_basic
7788 * DESCRIPTION
7789 * ZigBee ZCL Multistate Input Basic cluster dissector for wireshark.
7790 * PARAMETERS
7791 * tvbuff_t *tvb - pointer to buffer containing raw packet.
7792 * packet_info *pinfo - pointer to packet information fields
7793 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
7794 * RETURNS
7795 * none
7796 *---------------------------------------------------------------
7797 */
7798
7799static int
7800dissect_zbee_zcl_multistate_input_basic(tvbuff_t *tvb _U___attribute__((unused)), packet_info *pinfo _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), void* data _U___attribute__((unused)))
7801{
7802 return tvb_captured_length(tvb);
7803} /*dissect_zbee_zcl_multistate_input_basic*/
7804
7805
7806/*FUNCTION:------------------------------------------------------
7807 * NAME
7808 * dissect_zcl_multistate_input_basic_attr_data
7809 * DESCRIPTION
7810 * this function is called by ZCL foundation dissector in order to decode
7811 * specific cluster attributes data.
7812 * PARAMETERS
7813 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
7814 * tvbuff_t *tvb - pointer to buffer containing raw packet.
7815 * unsigned *offset - pointer to buffer offset
7816 * uint16_t attr_id - attribute identifier
7817 * unsigned data_type - attribute data type
7818 * bool client_attr- ZCL client
7819 * RETURNS
7820 * none
7821 *---------------------------------------------------------------
7822 */
7823void
7824dissect_zcl_multistate_input_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
7825{
7826 static int * const status_flags[] = {
7827 &hf_zbee_zcl_multistate_input_basic_status_in_alarm,
7828 &hf_zbee_zcl_multistate_input_basic_status_fault,
7829 &hf_zbee_zcl_multistate_input_basic_status_overridden,
7830 &hf_zbee_zcl_multistate_input_basic_status_out_of_service,
7831 NULL((void*)0)
7832 };
7833
7834 /* Dissect attribute data type and data */
7835 switch (attr_id) {
7836
7837 case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_RELIABILITY0x0067:
7838 proto_tree_add_item(tree, hf_zbee_zcl_multistate_input_basic_reliability, tvb, *offset, 1, ENC_NA0x00000000);
7839 *offset += 1;
7840 break;
7841
7842 case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_STATUS_FLAGS0x006F:
7843 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_ENDIAN0x80000000);
7844 *offset += 1;
7845 break;
7846
7847 case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_DESCRIPTION0x001C:
7848 case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_NUMBER_OF_STATES0x004A:
7849 case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_OUT_OF_SERVICE0x0051:
7850 case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_PRESENT_VALUE0x0055:
7851 case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_APPLICATION_TYPE0x0100:
7852 default:
7853 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
7854 break;
7855 }
7856
7857} /*dissect_zcl_multistate_input_basic_attr_data*/
7858
7859
7860/*FUNCTION:------------------------------------------------------
7861 * NAME
7862 * proto_register_zbee_zcl_multistate_input_basic
7863 * DESCRIPTION
7864 * ZigBee ZCL Multistate Input Basic cluster protocol registration routine.
7865 * PARAMETERS
7866 * none
7867 * RETURNS
7868 * void
7869 *---------------------------------------------------------------
7870 */
7871void
7872proto_register_zbee_zcl_multistate_input_basic(void)
7873{
7874 /* Setup list of header fields */
7875 static hf_register_info hf[] = {
7876
7877 { &hf_zbee_zcl_multistate_input_basic_attr_id,
7878 { "Attribute", "zbee_zcl_general.multistate_input_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_multistate_input_basic_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_multistate_input_basic_attr_names
))))
,
7879 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7880
7881 { &hf_zbee_zcl_multistate_input_basic_reliability,
7882 { "Reliability", "zbee_zcl_general.multistate_input_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_reliability_names
))))
,
7883 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7884
7885 /* start Status Flags fields */
7886 { &hf_zbee_zcl_multistate_input_basic_status_flags,
7887 { "Status Flags", "zbee_zcl_general.multistate_input_basic.attr.status", FT_UINT8, BASE_HEX, NULL((void*)0),
7888 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7889
7890 { &hf_zbee_zcl_multistate_input_basic_status_in_alarm,
7891 { "In Alarm Status", "zbee_zcl_general.multistate_input_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL((void*)0),
7892 ZBEE_ZCL_STATUS_IN_ALARM0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7893
7894 { &hf_zbee_zcl_multistate_input_basic_status_fault,
7895 { "Fault Status", "zbee_zcl_general.multistate_input_basic.attr.status.fault", FT_BOOLEAN, 8, NULL((void*)0),
7896 ZBEE_ZCL_STATUS_FAULT0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7897
7898 { &hf_zbee_zcl_multistate_input_basic_status_overridden,
7899 { "Overridden Status", "zbee_zcl_general.multistate_input_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL((void*)0),
7900 ZBEE_ZCL_STATUS_OVERRIDDEN0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
7901
7902 { &hf_zbee_zcl_multistate_input_basic_status_out_of_service,
7903 { "Out of Service Status", "zbee_zcl_general.multistate_input_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL((void*)0),
7904 ZBEE_ZCL_STATUS_OUT_OF_SERVICE0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
7905 /* end Status Flags fields */
7906 };
7907
7908 /* ZCL Multistate Input Basic subtrees */
7909 static int *ett[] = {
7910 &ett_zbee_zcl_multistate_input_basic,
7911 &ett_zbee_zcl_multistate_input_basic_status_flags
7912 };
7913
7914 /* Register the ZigBee ZCL Multistate Input Basic cluster protocol name and description */
7915 proto_zbee_zcl_multistate_input_basic = proto_register_protocol("ZigBee ZCL Multistate Input Basic", "ZCL Multistate Input Basic", ZBEE_PROTOABBREV_ZCL_MULTISTATE_INPUT_BASIC"zbee_zcl_general.multistate.input.basic");
7916 proto_register_field_array(proto_zbee_zcl_multistate_input_basic, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
7917 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
7918
7919 /* Register the ZigBee ZCL Multistate Input Basic dissector. */
7920 register_dissector(ZBEE_PROTOABBREV_ZCL_MULTISTATE_INPUT_BASIC"zbee_zcl_general.multistate.input.basic", dissect_zbee_zcl_multistate_input_basic, proto_zbee_zcl_multistate_input_basic);
7921} /*proto_register_zbee_zcl_multistate_input_basic*/
7922
7923/*FUNCTION:------------------------------------------------------
7924 * NAME
7925 * proto_reg_handoff_zbee_zcl_multistate_input_basic
7926 * DESCRIPTION
7927 * Hands off the ZCL Multistate Input Basic dissector.
7928 * PARAMETERS
7929 * none
7930 * RETURNS
7931 * none
7932 *---------------------------------------------------------------
7933 */
7934void
7935proto_reg_handoff_zbee_zcl_multistate_input_basic(void)
7936{
7937 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_MULTISTATE_INPUT_BASIC"zbee_zcl_general.multistate.input.basic",
7938 proto_zbee_zcl_multistate_input_basic,
7939 ett_zbee_zcl_multistate_input_basic,
7940 ZBEE_ZCL_CID_MULTISTATE_INPUT_BASIC0x0012,
7941 ZBEE_MFG_CODE_NONE0x0000,
7942 hf_zbee_zcl_multistate_input_basic_attr_id,
7943 hf_zbee_zcl_multistate_input_basic_attr_id,
7944 -1, -1,
7945 (zbee_zcl_fn_attr_data)dissect_zcl_multistate_input_basic_attr_data
7946 );
7947} /*proto_reg_handoff_zbee_zcl_multistate_input_basic*/
7948
7949
7950/* ########################################################################## */
7951/* #### (0x0013) MULTISTATE OUTPUT (BASIC) CLUSTER ########################## */
7952/* ########################################################################## */
7953
7954/*************************/
7955/* Defines */
7956/*************************/
7957
7958/*Attributes*/
7959#define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_STATE_TEXT0x000E 0x000E /* State Text */
7960#define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_DESCRIPTION0x001C 0x001C /* Description */
7961#define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_NUMBER_OF_STATES0x004A 0x004A /* Number of States */
7962#define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_OUT_OF_SERVICE0x0051 0x0051 /* Out of Service */
7963#define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRESENT_VALUE0x0055 0x0055 /* Present Value */
7964#define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRIORITY_ARRAY0x0057 0x0057 /* Priority Array */
7965#define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELIABILITY0x0067 0x0067 /* Reliability */
7966#define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELINQUISH_DEFAULT0x0068 0x0068 /* Relinquish Default */
7967#define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_STATUS_FLAGS0x006F 0x006F /* Status Flags */
7968#define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_APPLICATION_TYPE0x0100 0x0100 /* Application Type */
7969
7970/*Server commands received - none*/
7971
7972/*Server commands generated - none*/
7973
7974/*************************/
7975/* Function Declarations */
7976/*************************/
7977
7978void proto_register_zbee_zcl_multistate_output_basic(void);
7979void proto_reg_handoff_zbee_zcl_multistate_output_basic(void);
7980
7981/* Command Dissector Helpers */
7982static void dissect_zcl_multistate_output_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
7983
7984/* Private functions prototype */
7985
7986/*************************/
7987/* Global Variables */
7988/*************************/
7989/* Initialize the protocol and registered fields */
7990static int proto_zbee_zcl_multistate_output_basic;
7991
7992static int hf_zbee_zcl_multistate_output_basic_attr_id;
7993static int hf_zbee_zcl_multistate_output_basic_status_flags;
7994static int hf_zbee_zcl_multistate_output_basic_status_in_alarm;
7995static int hf_zbee_zcl_multistate_output_basic_status_fault;
7996static int hf_zbee_zcl_multistate_output_basic_status_overridden;
7997static int hf_zbee_zcl_multistate_output_basic_status_out_of_service;
7998static int hf_zbee_zcl_multistate_output_basic_reliability;
7999static int hf_zbee_zcl_multistate_output_basic_priority_array_bool;
8000static int hf_zbee_zcl_multistate_output_basic_priority_array_sing_prec;
8001static int hf_zbee_zcl_multistate_output_basic_priority_array;
8002static int hf_zbee_zcl_multistate_output_basic_structure;
8003
8004/* Initialize the subtree pointers */
8005static int ett_zbee_zcl_multistate_output_basic;
8006static int ett_zbee_zcl_multistate_output_basic_status_flags;
8007static int ett_zbee_zcl_multistate_output_basic_priority_array;
8008static int ett_zbee_zcl_multistate_output_basic_priority_array_structure;
8009
8010/* Attributes */
8011static const value_string zbee_zcl_multistate_output_basic_attr_names[] = {
8012 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_STATE_TEXT0x000E, "State Text" },
8013 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_DESCRIPTION0x001C, "Description" },
8014 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_NUMBER_OF_STATES0x004A, "Number of States" },
8015 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_OUT_OF_SERVICE0x0051, "Out of Service" },
8016 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRESENT_VALUE0x0055, "Present Value" },
8017 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRIORITY_ARRAY0x0057, "Priority Array" },
8018 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELIABILITY0x0067, "Reliability" },
8019 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELINQUISH_DEFAULT0x0068, "Relinquish Default" },
8020 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_STATUS_FLAGS0x006F, "Status Flags" },
8021 { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_APPLICATION_TYPE0x0100, "Application Type" },
8022 { 0, NULL((void*)0) }
8023};
8024
8025static const value_string zbee_zcl_multistate_output_basic_priority_array_bool_values[] = {
8026 { 0x01, "Valid" },
8027 { 0x00, "Invalid" },
8028 { 0, NULL((void*)0) }
8029};
8030
8031/*************************/
8032/* Function Bodies */
8033/*************************/
8034
8035/*FUNCTION:------------------------------------------------------
8036 * NAME
8037 * dissect_zbee_zcl_multistate_output_basic
8038 * DESCRIPTION
8039 * ZigBee ZCL Multistate Output Basic cluster dissector for wireshark.
8040 * PARAMETERS
8041 * tvbuff_t *tvb - pointer to buffer containing raw packet.
8042 * packet_info *pinfo - pointer to packet information fields
8043 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
8044 * RETURNS
8045 * none
8046 *---------------------------------------------------------------
8047 */
8048
8049static int
8050dissect_zbee_zcl_multistate_output_basic(tvbuff_t *tvb _U___attribute__((unused)), packet_info *pinfo _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), void* data _U___attribute__((unused)))
8051{
8052 return tvb_captured_length(tvb);
8053} /*dissect_zbee_zcl_multistate_output_basic*/
8054
8055
8056/*FUNCTION:------------------------------------------------------
8057 * NAME
8058 * dissect_zcl_multistate_output_basic_attr_data
8059 * DESCRIPTION
8060 * this function is called by ZCL foundation dissector in order to decode
8061 * specific cluster attributes data.
8062 * PARAMETERS
8063 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
8064 * tvbuff_t *tvb - pointer to buffer containing raw packet.
8065 * unsigned *offset - pointer to buffer offset
8066 * uint16_t attr_id - attribute identifier
8067 * unsigned data_type - attribute data type
8068 * bool client_attr- ZCL client
8069 * RETURNS
8070 * none
8071 *---------------------------------------------------------------
8072 */
8073void
8074dissect_zcl_multistate_output_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
8075{
8076 proto_item *ti = NULL((void*)0), *tj = NULL((void*)0);
8077 proto_tree *sub_tree = NULL((void*)0), *sub = NULL((void*)0);
8078 int i;
8079
8080 static int * const status_flags[] = {
8081 &hf_zbee_zcl_multistate_output_basic_status_in_alarm,
8082 &hf_zbee_zcl_multistate_output_basic_status_fault,
8083 &hf_zbee_zcl_multistate_output_basic_status_overridden,
8084 &hf_zbee_zcl_multistate_output_basic_status_out_of_service,
8085 NULL((void*)0)
8086 };
8087
8088 /* Dissect attribute data type and data */
8089 switch (attr_id) {
8090
8091 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRIORITY_ARRAY0x0057:
8092 ti = proto_tree_add_item(tree,hf_zbee_zcl_multistate_output_basic_priority_array, tvb, *offset, 80, ENC_NA0x00000000);
8093 sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_multistate_output_basic_priority_array);
8094
8095 for( i = 1; i <= 16; i++)
8096 {
8097 tj = proto_tree_add_item(sub_tree, hf_zbee_zcl_multistate_output_basic_structure, tvb, *offset, 5, ENC_NA0x00000000);
8098 proto_item_append_text(tj," %d",i);
8099 sub = proto_item_add_subtree(tj, ett_zbee_zcl_multistate_output_basic_priority_array_structure);
8100 proto_tree_add_item(sub, hf_zbee_zcl_multistate_output_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
8101 *offset += 1;
8102 proto_tree_add_item(sub, hf_zbee_zcl_multistate_output_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
8103 *offset += 4;
8104 }
8105 break;
8106
8107 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELIABILITY0x0067:
8108 proto_tree_add_item(tree, hf_zbee_zcl_multistate_output_basic_reliability, tvb, *offset, 1, ENC_NA0x00000000);
8109 *offset += 1;
8110 break;
8111
8112 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_STATUS_FLAGS0x006F:
8113 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_ENDIAN0x80000000);
8114 *offset += 1;
8115 break;
8116
8117 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_DESCRIPTION0x001C:
8118 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_NUMBER_OF_STATES0x004A:
8119 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_OUT_OF_SERVICE0x0051:
8120 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELINQUISH_DEFAULT0x0068:
8121 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRESENT_VALUE0x0055:
8122 case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_APPLICATION_TYPE0x0100:
8123 default:
8124 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
8125 break;
8126 }
8127
8128} /*dissect_zcl_multistate_output_basic_attr_data*/
8129
8130
8131/*FUNCTION:------------------------------------------------------
8132 * NAME
8133 * proto_register_zbee_zcl_multistate_output_basic
8134 * DESCRIPTION
8135 * ZigBee ZCL Multistate Output Basic cluster protocol registration routine.
8136 * PARAMETERS
8137 * none
8138 * RETURNS
8139 * void
8140 *---------------------------------------------------------------
8141 */
8142void
8143proto_register_zbee_zcl_multistate_output_basic(void)
8144{
8145 /* Setup list of header fields */
8146 static hf_register_info hf[] = {
8147
8148 { &hf_zbee_zcl_multistate_output_basic_attr_id,
8149 { "Attribute", "zbee_zcl_general.multistate_output_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_multistate_output_basic_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_multistate_output_basic_attr_names
))))
,
8150 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8151
8152 { &hf_zbee_zcl_multistate_output_basic_reliability,
8153 { "Reliability", "zbee_zcl_general.multistate_output_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_reliability_names
))))
,
8154 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8155
8156 /* start Status Flags fields */
8157 { &hf_zbee_zcl_multistate_output_basic_status_flags,
8158 { "Status Flags", "zbee_zcl_general.multistate_output_basic.attr.status", FT_UINT8, BASE_HEX, NULL((void*)0),
8159 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8160
8161 { &hf_zbee_zcl_multistate_output_basic_status_in_alarm,
8162 { "In Alarm Status", "zbee_zcl_general.multistate_output_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL((void*)0),
8163 ZBEE_ZCL_STATUS_IN_ALARM0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8164
8165 { &hf_zbee_zcl_multistate_output_basic_status_fault,
8166 { "Fault Status", "zbee_zcl_general.multistate_output_basic.attr.status.fault", FT_BOOLEAN, 8, NULL((void*)0),
8167 ZBEE_ZCL_STATUS_FAULT0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8168
8169 { &hf_zbee_zcl_multistate_output_basic_status_overridden,
8170 { "Overridden Status", "zbee_zcl_general.multistate_output_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL((void*)0),
8171 ZBEE_ZCL_STATUS_OVERRIDDEN0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8172
8173 { &hf_zbee_zcl_multistate_output_basic_status_out_of_service,
8174 { "Out of Service Status", "zbee_zcl_general.multistate_output_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL((void*)0),
8175 ZBEE_ZCL_STATUS_OUT_OF_SERVICE0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8176 /* end Status Flags fields */
8177
8178 { &hf_zbee_zcl_multistate_output_basic_priority_array_bool,
8179 { "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)((0 ? (const struct _value_string*)0 : ((zbee_zcl_multistate_output_basic_priority_array_bool_values
))))
,
8180 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8181
8182 { &hf_zbee_zcl_multistate_output_basic_priority_array_sing_prec,
8183 { "Priority Value", "zbee_zcl_general.multistate_output_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL((void*)0),
8184 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } } ,
8185
8186 { &hf_zbee_zcl_multistate_output_basic_priority_array,
8187 { "Priority Array", "zbee_zcl_general.multistate_output_basic.priority_array", FT_NONE, BASE_NONE, NULL((void*)0),
8188 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8189
8190 { &hf_zbee_zcl_multistate_output_basic_structure,
8191 { "Structure", "zbee_zcl_general.multistate_output_basic.structure", FT_NONE, BASE_NONE, NULL((void*)0),
8192 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
8193};
8194
8195 /* ZCL Multistate Output Basic subtrees */
8196 static int *ett[] = {
8197 &ett_zbee_zcl_multistate_output_basic,
8198 &ett_zbee_zcl_multistate_output_basic_status_flags,
8199 &ett_zbee_zcl_multistate_output_basic_priority_array,
8200 &ett_zbee_zcl_multistate_output_basic_priority_array_structure
8201 };
8202
8203 /* Register the ZigBee ZCL Multistate Output Basic cluster protocol name and description */
8204 proto_zbee_zcl_multistate_output_basic = proto_register_protocol("ZigBee ZCL Multistate Output Basic", "ZCL Multistate Output Basic", ZBEE_PROTOABBREV_ZCL_MULTISTATE_OUTPUT_BASIC"zbee_zcl_general.multistate.output.basic");
8205 proto_register_field_array(proto_zbee_zcl_multistate_output_basic, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
8206 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
8207
8208 /* Register the ZigBee ZCL Multistate Output Basic dissector. */
8209 register_dissector(ZBEE_PROTOABBREV_ZCL_MULTISTATE_OUTPUT_BASIC"zbee_zcl_general.multistate.output.basic", dissect_zbee_zcl_multistate_output_basic, proto_zbee_zcl_multistate_output_basic);
8210} /*proto_register_zbee_zcl_multistate_output_basic*/
8211
8212/*FUNCTION:------------------------------------------------------
8213 * NAME
8214 * proto_reg_handoff_zbee_zcl_multistate_output_basic
8215 * DESCRIPTION
8216 * Hands off the ZCL Multistate Output Basic dissector.
8217 * PARAMETERS
8218 * none
8219 * RETURNS
8220 * none
8221 *---------------------------------------------------------------
8222 */
8223void
8224proto_reg_handoff_zbee_zcl_multistate_output_basic(void)
8225{
8226 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_MULTISTATE_OUTPUT_BASIC"zbee_zcl_general.multistate.output.basic",
8227 proto_zbee_zcl_multistate_output_basic,
8228 ett_zbee_zcl_multistate_output_basic,
8229 ZBEE_ZCL_CID_MULTISTATE_OUTPUT_BASIC0x0013,
8230 ZBEE_MFG_CODE_NONE0x0000,
8231 hf_zbee_zcl_multistate_output_basic_attr_id,
8232 hf_zbee_zcl_multistate_output_basic_attr_id,
8233 -1,-1,
8234 (zbee_zcl_fn_attr_data)dissect_zcl_multistate_output_basic_attr_data
8235 );
8236} /*proto_reg_handoff_zbee_zcl_multistate_output_basic*/
8237
8238
8239/* ########################################################################## */
8240/* #### (0x0014) MULTISTATE VALUE (BASIC) CLUSTER ########################### */
8241/* ########################################################################## */
8242
8243/*************************/
8244/* Defines */
8245/*************************/
8246
8247/*Attributes*/
8248#define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_STATE_TEXT0x000E 0x000E /* State Text */
8249#define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_DESCRIPTION0x001C 0x001C /* Description */
8250#define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_NUMBER_OF_STATES0x004A 0x004A /* Number of States */
8251#define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_OUT_OF_SERVICE0x0051 0x0051 /* Out of Service */
8252#define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_PRESENT_VALUE0x0055 0x0055 /* Present Value */
8253#define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_PRIORITY_ARRAY0x0057 0x0057 /* Priority Array */
8254#define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_RELIABILITY0x0067 0x0067 /* Reliability */
8255#define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_RELINQUISH_DEFAULT0x0068 0x0068 /* Relinquish Default */
8256#define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_STATUS_FLAGS0x006F 0x006F /* Status Flags */
8257#define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_APPLICATION_TYPE0x0100 0x0100 /* Application Type */
8258
8259/*Server commands received - none*/
8260
8261/*Server commands generated - none*/
8262
8263/*************************/
8264/* Function Declarations */
8265/*************************/
8266
8267void proto_register_zbee_zcl_multistate_value_basic(void);
8268void proto_reg_handoff_zbee_zcl_multistate_value_basic(void);
8269
8270/* Command Dissector Helpers */
8271static void dissect_zcl_multistate_value_basic_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
8272
8273/* Private functions prototype */
8274
8275/*************************/
8276/* Global Variables */
8277/*************************/
8278/* Initialize the protocol and registered fields */
8279static int proto_zbee_zcl_multistate_value_basic;
8280
8281static int hf_zbee_zcl_multistate_value_basic_attr_id;
8282static int hf_zbee_zcl_multistate_value_basic_status_flags;
8283static int hf_zbee_zcl_multistate_value_basic_status_in_alarm;
8284static int hf_zbee_zcl_multistate_value_basic_status_fault;
8285static int hf_zbee_zcl_multistate_value_basic_status_overridden;
8286static int hf_zbee_zcl_multistate_value_basic_status_out_of_service;
8287static int hf_zbee_zcl_multistate_value_basic_reliability;
8288static int hf_zbee_zcl_multistate_value_basic_priority_array_bool;
8289static int hf_zbee_zcl_multistate_value_basic_priority_array_sing_prec;
8290static int hf_zbee_zcl_multistate_value_basic_priority_array;
8291static int hf_zbee_zcl_multistate_value_basic_structure;
8292
8293
8294/* Initialize the subtree pointers */
8295static int ett_zbee_zcl_multistate_value_basic;
8296static int ett_zbee_zcl_multistate_value_basic_status_flags;
8297static int ett_zbee_zcl_multistate_value_basic_priority_array;
8298static int ett_zbee_zcl_multistate_value_basic_priority_array_structure;
8299
8300/* Attributes */
8301static const value_string zbee_zcl_multistate_value_basic_attr_names[] = {
8302 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_STATE_TEXT0x000E, "State Text" },
8303 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_DESCRIPTION0x001C, "Description" },
8304 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_NUMBER_OF_STATES0x004A, "Number of States" },
8305 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_OUT_OF_SERVICE0x0051, "Out of Service" },
8306 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_PRESENT_VALUE0x0055, "Present Value" },
8307 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_PRIORITY_ARRAY0x0057, "Priority Array" },
8308 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_RELIABILITY0x0067, "Reliability" },
8309 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_RELINQUISH_DEFAULT0x0068, "Relinquish Default" },
8310 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_STATUS_FLAGS0x006F, "Status Flags" },
8311 { ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_APPLICATION_TYPE0x0100, "Application Type" },
8312 { 0, NULL((void*)0) }
8313};
8314
8315static const value_string zbee_zcl_multistate_value_basic_priority_array_bool_values[] = {
8316 { 0x01, "Valid" },
8317 { 0x00, "Invalid" },
8318 { 0, NULL((void*)0) }
8319};
8320
8321/*************************/
8322/* Function Bodies */
8323/*************************/
8324
8325/*FUNCTION:------------------------------------------------------
8326 * NAME
8327 * dissect_zbee_zcl_multistate_value_basic
8328 * DESCRIPTION
8329 * ZigBee ZCL Multistate Value Basic cluster dissector for wireshark.
8330 * PARAMETERS
8331 * tvbuff_t *tvb - pointer to buffer containing raw packet.
8332 * packet_info *pinfo - pointer to packet information fields
8333 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
8334 * RETURNS
8335 * none
8336 *---------------------------------------------------------------
8337 */
8338
8339static int
8340dissect_zbee_zcl_multistate_value_basic(tvbuff_t *tvb _U___attribute__((unused)), packet_info *pinfo _U___attribute__((unused)), proto_tree *tree _U___attribute__((unused)), void* data _U___attribute__((unused)))
8341{
8342 return tvb_captured_length(tvb);
8343} /*dissect_zbee_zcl_multistate_value_basic*/
8344
8345
8346/*FUNCTION:------------------------------------------------------
8347 * NAME
8348 * dissect_zcl_multistate_value_basic_attr_data
8349 * DESCRIPTION
8350 * this function is called by ZCL foundation dissector in order to decode
8351 * specific cluster attributes data.
8352 * PARAMETERS
8353 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
8354 * tvbuff_t *tvb - pointer to buffer containing raw packet.
8355 * unsigned *offset - pointer to buffer offset
8356 * uint16_t attr_id - attribute identifier
8357 * unsigned data_type - attribute data type
8358 * bool client_attr- ZCL client
8359 * RETURNS
8360 * none
8361 *---------------------------------------------------------------
8362 */
8363void
8364dissect_zcl_multistate_value_basic_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
8365{
8366 proto_item *ti = NULL((void*)0), *tj = NULL((void*)0);
8367 proto_tree *sub_tree = NULL((void*)0), *sub = NULL((void*)0);
8368 int i;
8369
8370 static int * const status_flags[] = {
8371 &hf_zbee_zcl_multistate_value_basic_status_in_alarm,
8372 &hf_zbee_zcl_multistate_value_basic_status_fault,
8373 &hf_zbee_zcl_multistate_value_basic_status_overridden,
8374 &hf_zbee_zcl_multistate_value_basic_status_out_of_service,
8375 NULL((void*)0)
8376 };
8377
8378 /* Dissect attribute data type and data */
8379 switch (attr_id) {
8380
8381 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_PRIORITY_ARRAY0x0057:
8382 ti = proto_tree_add_item(tree,hf_zbee_zcl_multistate_value_basic_priority_array, tvb, *offset, 80, ENC_NA0x00000000);
8383 sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_multistate_value_basic_priority_array);
8384
8385 for( i = 1; i <= 16; i++)
8386 {
8387 tj = proto_tree_add_item(sub_tree,hf_zbee_zcl_multistate_value_basic_structure, tvb, *offset, 5,ENC_NA0x00000000);
8388 proto_item_append_text(tj," %d",i);
8389 sub = proto_item_add_subtree(tj, ett_zbee_zcl_multistate_value_basic_priority_array_structure);
8390 proto_tree_add_item(sub, hf_zbee_zcl_multistate_value_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
8391 *offset += 1;
8392 proto_tree_add_item(sub, hf_zbee_zcl_multistate_value_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
8393 *offset += 4;
8394 }
8395 break;
8396
8397 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_RELIABILITY0x0067:
8398 proto_tree_add_item(tree, hf_zbee_zcl_multistate_value_basic_reliability, tvb, *offset, 1, ENC_NA0x00000000);
8399 *offset += 1;
8400 break;
8401
8402 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_STATUS_FLAGS0x006F:
8403 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_ENDIAN0x80000000);
8404 *offset += 1;
8405 break;
8406
8407 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_DESCRIPTION0x001C:
8408 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_NUMBER_OF_STATES0x004A:
8409 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_OUT_OF_SERVICE0x0051:
8410 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_RELINQUISH_DEFAULT0x0068:
8411 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_PRESENT_VALUE0x0055:
8412 case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_APPLICATION_TYPE0x0100:
8413 default:
8414 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
8415 break;
8416 }
8417
8418} /*dissect_zcl_multistate_value_basic_attr_data*/
8419
8420
8421/*FUNCTION:------------------------------------------------------
8422 * NAME
8423 * proto_register_zbee_zcl_multistate_value_basic
8424 * DESCRIPTION
8425 * ZigBee ZCL Multistate Value Basic cluster protocol registration routine.
8426 * PARAMETERS
8427 * none
8428 * RETURNS
8429 * void
8430 *---------------------------------------------------------------
8431 */
8432void
8433proto_register_zbee_zcl_multistate_value_basic(void)
8434{
8435 /* Setup list of header fields */
8436 static hf_register_info hf[] = {
8437
8438 { &hf_zbee_zcl_multistate_value_basic_attr_id,
8439 { "Attribute", "zbee_zcl_general.multistate_value_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_multistate_value_basic_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_multistate_value_basic_attr_names
))))
,
8440 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8441
8442 { &hf_zbee_zcl_multistate_value_basic_reliability,
8443 { "Reliability", "zbee_zcl_general.multistate_value_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_reliability_names
))))
,
8444 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8445
8446 /* start Status Flags fields */
8447 { &hf_zbee_zcl_multistate_value_basic_status_flags,
8448 { "Status Flags", "zbee_zcl_general.multistate_value_basic.attr.status", FT_UINT8, BASE_HEX, NULL((void*)0),
8449 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8450
8451 { &hf_zbee_zcl_multistate_value_basic_status_in_alarm,
8452 { "In Alarm Status", "zbee_zcl_general.multistate_value_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL((void*)0),
8453 ZBEE_ZCL_STATUS_IN_ALARM0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8454
8455 { &hf_zbee_zcl_multistate_value_basic_status_fault,
8456 { "Fault Status", "zbee_zcl_general.multistate_value_basic.attr.status.fault", FT_BOOLEAN, 8, NULL((void*)0),
8457 ZBEE_ZCL_STATUS_FAULT0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8458
8459 { &hf_zbee_zcl_multistate_value_basic_status_overridden,
8460 { "Overridden Status", "zbee_zcl_general.multistate_value_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL((void*)0),
8461 ZBEE_ZCL_STATUS_OVERRIDDEN0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8462
8463 { &hf_zbee_zcl_multistate_value_basic_status_out_of_service,
8464 { "Out of Service Status", "zbee_zcl_general.multistate_value_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL((void*)0),
8465 ZBEE_ZCL_STATUS_OUT_OF_SERVICE0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8466 /* end Status Flags fields */
8467
8468 { &hf_zbee_zcl_multistate_value_basic_priority_array_bool,
8469 { "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)((0 ? (const struct _value_string*)0 : ((zbee_zcl_multistate_value_basic_priority_array_bool_values
))))
,
8470 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8471
8472 { &hf_zbee_zcl_multistate_value_basic_priority_array_sing_prec,
8473 { "Priority Value", "zbee_zcl_general.multistate_value_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL((void*)0),
8474 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8475
8476 { &hf_zbee_zcl_multistate_value_basic_priority_array,
8477 { "Priority Array", "zbee_zcl_general.multistate_value_basic.priority_array", FT_NONE, BASE_NONE, NULL((void*)0),
8478 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
8479
8480 { &hf_zbee_zcl_multistate_value_basic_structure,
8481 { "Structure", "zbee_zcl_general.multistate_value_basic.structure", FT_NONE, BASE_NONE, NULL((void*)0),
8482 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
8483 };
8484
8485 /* ZCL Multistate Value Basic subtrees */
8486 static int *ett[] = {
8487 &ett_zbee_zcl_multistate_value_basic,
8488 &ett_zbee_zcl_multistate_value_basic_status_flags,
8489 &ett_zbee_zcl_multistate_value_basic_priority_array,
8490 &ett_zbee_zcl_multistate_value_basic_priority_array_structure
8491 };
8492
8493 /* Register the ZigBee ZCL Multistate Value Basic cluster protocol name and description */
8494 proto_zbee_zcl_multistate_value_basic = proto_register_protocol("ZigBee ZCL Multistate Value Basic", "ZCL Multistate Value Basic", ZBEE_PROTOABBREV_ZCL_MULTISTATE_VALUE_BASIC"zbee_zcl_general.multistate.value.basic");
8495 proto_register_field_array(proto_zbee_zcl_multistate_value_basic, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
8496 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
8497
8498 /* Register the ZigBee ZCL Multistate Value Basic dissector. */
8499 register_dissector(ZBEE_PROTOABBREV_ZCL_MULTISTATE_VALUE_BASIC"zbee_zcl_general.multistate.value.basic", dissect_zbee_zcl_multistate_value_basic, proto_zbee_zcl_multistate_value_basic);
8500} /*proto_register_zbee_zcl_multistate_value_basic*/
8501
8502/*FUNCTION:------------------------------------------------------
8503 * NAME
8504 * proto_reg_handoff_zbee_zcl_multistate_value_basic
8505 * DESCRIPTION
8506 * Hands off the ZCL Multistate Value Basic dissector.
8507 * PARAMETERS
8508 * none
8509 * RETURNS
8510 * none
8511 *---------------------------------------------------------------
8512 */
8513void
8514proto_reg_handoff_zbee_zcl_multistate_value_basic(void)
8515{
8516 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_MULTISTATE_VALUE_BASIC"zbee_zcl_general.multistate.value.basic",
8517 proto_zbee_zcl_multistate_value_basic,
8518 ett_zbee_zcl_multistate_value_basic,
8519 ZBEE_ZCL_CID_MULTISTATE_VALUE_BASIC0x0014,
8520 ZBEE_MFG_CODE_NONE0x0000,
8521 hf_zbee_zcl_multistate_value_basic_attr_id,
8522 hf_zbee_zcl_multistate_value_basic_attr_id,
8523 -1, -1,
8524 (zbee_zcl_fn_attr_data)dissect_zcl_multistate_value_basic_attr_data
8525 );
8526} /*proto_reg_handoff_zbee_zcl_multistate_value_basic*/
8527
8528/* ########################################################################## */
8529/* #### (0x0015) COMMISSIONING CLUSTER ###################################### */
8530/* ########################################################################## */
8531
8532/*************************/
8533/* Defines */
8534/*************************/
8535
8536/* Attributes */
8537#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_SHORT_ADDRESS0x0000 0x0000 /* Short Address */
8538#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_EXTENDED_PAN_ID0x0001 0x0001 /* Extended PAN Id */
8539#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_PAN_ID0x0002 0x0002 /* PAN Id */
8540#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_CHANNEL_MASK0x0003 0x0003 /* Channel Mask */
8541#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_PROTOCOL_VERSION0x0004 0x0004 /* Protocol Version */
8542#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_STACK_PROFILE0x0005 0x0005 /* Stack Profile */
8543#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_STARTUP_CONTROL0x0006 0x0006 /* Startup Control */
8544#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_ADDRESS0x0010 0x0010 /* Trust Center Address */
8545#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_MASTER_KEY0x0011 0x0011 /* Trust Center Master Key */
8546#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY0x0012 0x0012 /* Network Key */
8547#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_USE_INSECURE_JOIN0x0013 0x0013 /* Use Insecure Join */
8548#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_PRECONFIGURED_LINK_KEY0x0014 0x0014 /* Preconfigured Link Key */
8549#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_SEQ_NUM0x0015 0x0015 /* Network Key Sequence Number */
8550#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_TYPE0x0016 0x0016 /* Network Key Type */
8551#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_MANAGER_ADDRESS0x0017 0x0017 /* Network Manager Address */
8552#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_SCAN_ATTEMPTS0x0020 0x0020 /* Scan Attempts */
8553#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_TIME_BETWEEN_SCANS0x0021 0x0021 /* Time Between Scans */
8554#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_REJOIN_INTERVAL0x0022 0x0022 /* Rejoin Interval */
8555#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_MAX_REJOIN_INTERVAL0x0023 0x0023 /* Max Rejoin Interval */
8556#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_INDIRECT_POLL_RATE0x0030 0x0030 /* Indirect Poll Rate */
8557#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_PARENT_RETRY_THRESHOLD0x0031 0x0031 /* Parent Retry Threshold */
8558#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_FLAG0x0040 0x0040 /* Concentrator Flag */
8559#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_RADIUS0x0041 0x0041 /* Concentrator Radius */
8560#define ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_DISCOVERY_TIME0x0042 0x0042 /* Concentrator Discovery Time */
8561
8562/* Server Commands Received */
8563#define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE0x00 0x00 /* Restart Device */
8564#define ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS0x01 0x01 /* Save Startup Parameters */
8565#define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS0x02 0x02 /* Restore Startup Parameters */
8566#define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS0x03 0x03 /* Reset Startup Parameters */
8567
8568/* Server Commands Generated */
8569#define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE_RESPONSE0x00 0x00 /* Restart Device Response */
8570#define ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS_RESPONSE0x01 0x01 /* Save Startup Parameters Response */
8571#define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS_RESPONSE0x02 0x02 /* Restore Startup Parameters Response */
8572#define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS_RESPONSE0x03 0x03 /* Reset Startup Parameters Response */
8573
8574/* Restart Device Options Field Mask Values */
8575#define ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_STARTUP_MODE0x07 0x07
8576#define ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_IMMEDIATE0x08 0x08
8577#define ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_RESERVED0xF0 0xF0
8578
8579/* Reset Startup Parameters Options Field Mask Values */
8580#define ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESET_CURRENT0x01 0x01
8581#define ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESET_ALL0x02 0x02
8582#define ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_ERASE_INDEX0x04 0x04
8583#define ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESERVED0xFC 0xFC
8584
8585
8586/*************************/
8587/* Function Declarations */
8588/*************************/
8589
8590void proto_register_zbee_zcl_commissioning(void);
8591void proto_reg_handoff_zbee_zcl_commissioning(void);
8592
8593/* Command Dissector Helpers */
8594static void dissect_zcl_commissioning_restart_device (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
8595static void dissect_zcl_commissioning_save_restore_startup_parameters (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
8596static void dissect_zcl_commissioning_reset_startup_parameters (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
8597static void dissect_zcl_commissioning_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
8598
8599static void dissect_zcl_commissioning_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
8600
8601/* Private functions prototype */
8602
8603/*************************/
8604/* Global Variables */
8605/*************************/
8606/* Initialize the protocol and registered fields */
8607static int proto_zbee_zcl_commissioning;
8608
8609static int hf_zbee_zcl_commissioning_attr_id;
8610static int hf_zbee_zcl_commissioning_attr_stack_profile;
8611static int hf_zbee_zcl_commissioning_attr_startup_control;
8612static int hf_zbee_zcl_commissioning_restart_device_options;
8613static int hf_zbee_zcl_commissioning_restart_device_options_startup_mode;
8614static int hf_zbee_zcl_commissioning_restart_device_options_immediate;
8615static int hf_zbee_zcl_commissioning_restart_device_options_reserved;
8616static int hf_zbee_zcl_commissioning_delay;
8617static int hf_zbee_zcl_commissioning_jitter;
8618static int hf_zbee_zcl_commissioning_options;
8619static int hf_zbee_zcl_commissioning_index;
8620static int hf_zbee_zcl_commissioning_reset_startup_options;
8621static int hf_zbee_zcl_commissioning_reset_startup_options_reset_current;
8622static int hf_zbee_zcl_commissioning_reset_startup_options_reset_all;
8623static int hf_zbee_zcl_commissioning_reset_startup_options_erase_index;
8624static int hf_zbee_zcl_commissioning_reset_startup_options_reserved;
8625static int hf_zbee_zcl_commissioning_status;
8626static int hf_zbee_zcl_commissioning_srv_rx_cmd_id;
8627static int hf_zbee_zcl_commissioning_srv_tx_cmd_id;
8628
8629/* Initialize the subtree pointers */
8630static int ett_zbee_zcl_commissioning;
8631static int ett_zbee_zcl_commissioning_restart_device_options;
8632static int ett_zbee_zcl_commissioning_reset_startup_options;
8633
8634/* Attributes */
8635static const value_string zbee_zcl_commissioning_attr_names[] = {
8636 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_SHORT_ADDRESS0x0000, "Short Address" },
8637 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_EXTENDED_PAN_ID0x0001, "Extended PAN Id" },
8638 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_PAN_ID0x0002, "PAN Id" },
8639 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_CHANNEL_MASK0x0003, "Channel Mask" },
8640 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_PROTOCOL_VERSION0x0004, "Protocol Version" },
8641 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_STACK_PROFILE0x0005, "Stack Profile" },
8642 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_STARTUP_CONTROL0x0006, "Startup Control" },
8643 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_ADDRESS0x0010, "Trust Center Address" },
8644 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_MASTER_KEY0x0011, "Trust Center Master Key" },
8645 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY0x0012, "Network Key" },
8646 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_USE_INSECURE_JOIN0x0013, "Use Insecure Join" },
8647 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_PRECONFIGURED_LINK_KEY0x0014, "Preconfigured Link Key" },
8648 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_SEQ_NUM0x0015, "Network Key Sequence Number" },
8649 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_TYPE0x0016, "Network Key Type" },
8650 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_MANAGER_ADDRESS0x0017, "Network Manager Address" },
8651 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_SCAN_ATTEMPTS0x0020, "Scan Attempts" },
8652 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_TIME_BETWEEN_SCANS0x0021, "Time Between Scans" },
8653 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_REJOIN_INTERVAL0x0022, "Rejoin Interval" },
8654 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_MAX_REJOIN_INTERVAL0x0023, "Max Rejoin Interval" },
8655 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_INDIRECT_POLL_RATE0x0030, "Indirect Poll Rate" },
8656 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_PARENT_RETRY_THRESHOLD0x0031, "Parent Retry Threshold" },
8657 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_FLAG0x0040, "Concentrator Flag" },
8658 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_RADIUS0x0041, "Concentrator Radius" },
8659 { ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_DISCOVERY_TIME0x0042, "Concentrator Discovery Time" },
8660 { 0, NULL((void*)0) }
8661};
8662
8663/* Server Commands Received */
8664static const value_string zbee_zcl_commissioning_srv_rx_cmd_names[] = {
8665 { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE0x00, "Commissioning - Restart Device" },
8666 { ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS0x01, "Commissioning - Save Startup Parameters" },
8667 { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS0x02, "Commissioning - Restore Startup Parameters" },
8668 { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS0x03, "Commissioning - Reset Startup Parameters" },
8669 { 0, NULL((void*)0) }
8670};
8671
8672/* Server Commands Generated */
8673static const value_string zbee_zcl_commissioning_srv_tx_cmd_names[] = {
8674 { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE_RESPONSE0x00, "Commissioning - Restart Device Response" },
8675 { ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS_RESPONSE0x01, "Commissioning - Save Startup Parameters Response" },
8676 { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS_RESPONSE0x02, "Commissioning - Startup Parameters Response" },
8677 { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS_RESPONSE0x03, "Commissioning - Reset Startup Parameters Response" },
8678 { 0, NULL((void*)0) }
8679};
8680
8681static const value_string zbee_zcl_commissioning_stack_profile_values[] = {
8682 {0x01, "ZigBee Stack Profile"},
8683 {0x02, "ZigBee PRO Stack Profile"},
8684 {0, NULL((void*)0)}
8685};
8686
8687static const value_string zbee_zcl_commissioning_startup_control_values[] = {
8688 {0x00, "Device is part of the network indicated by the Extended PAN Id"},
8689 {0x01, "Device should form a network with the Extended PAN Id"},
8690 {0x02, "Device should rejoin the network with Extended PAN Id"},
8691 {0x03, "Device should join the network using MAC Association"},
8692 {0, NULL((void*)0)}
8693};
8694
8695static const value_string zbee_zcl_commissioning_startup_mode_values[] ={
8696 {0, "Restart Device using current set of startup parameters"},
8697 {1, "Restart Device using current set of stack attributes"},
8698 {0, NULL((void*)0)}
8699};
8700
8701/*************************/
8702/* Function Bodies */
8703/*************************/
8704
8705/*FUNCTION:------------------------------------------------------
8706 * NAME
8707 * dissect_zbee_zcl_commissioning
8708 * DESCRIPTION
8709 * ZigBee ZCL Commissioning cluster dissector for wireshark.
8710 * PARAMETERS
8711 * tvbuff_t *tvb - pointer to buffer containing raw packet.
8712 * packet_info *pinfo - pointer to packet information fields
8713 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
8714 * RETURNS
8715 * none
8716 *---------------------------------------------------------------
8717 */
8718static int
8719dissect_zbee_zcl_commissioning(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
8720{
8721 proto_tree *payload_tree;
8722 zbee_zcl_packet *zcl;
8723 unsigned offset = 0;
8724 uint8_t cmd_id;
8725 int rem_len;
8726
8727 /* Reject the packet if data is NULL */
8728 if (data == NULL((void*)0))
8729 return 0;
8730 zcl = (zbee_zcl_packet *)data;
8731 cmd_id = zcl->cmd_id;
8732
8733 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
8734 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER0x00) {
8735 /* Append the command name to the info column. */
8736 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
8737 val_to_str_const(cmd_id, zbee_zcl_commissioning_srv_rx_cmd_names, "Unknown Command"),
8738 zcl->tran_seqno);
8739
8740 /* Add the command ID. */
8741 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
8742
8743 /* Check if this command has a payload, then add the payload tree */
8744 rem_len = tvb_reported_length_remaining(tvb, ++offset);
8745 if (rem_len > 0) {
8746 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_commissioning, NULL((void*)0), "Payload");
8747
8748 /* Call the appropriate command dissector */
8749 switch (cmd_id) {
8750 case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE0x00:
8751 dissect_zcl_commissioning_restart_device(tvb, payload_tree, &offset);
8752 break;
8753
8754 case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS0x03:
8755 dissect_zcl_commissioning_reset_startup_parameters(tvb, payload_tree, &offset);
8756 break;
8757
8758 case ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS0x01:
8759 case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS0x02:
8760 dissect_zcl_commissioning_save_restore_startup_parameters(tvb, payload_tree, &offset);
8761 break;
8762
8763 default:
8764 break;
8765 }
8766 }
8767 }
8768 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
8769 /* Append the command name to the info column. */
8770 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
8771 val_to_str_const(cmd_id, zbee_zcl_commissioning_srv_tx_cmd_names, "Unknown Command"),
8772 zcl->tran_seqno);
8773
8774 /* Add the command ID. */
8775 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
8776
8777 /* Check if this command has a payload, then add the payload tree */
8778 rem_len = tvb_reported_length_remaining(tvb, ++offset);
8779 if (rem_len > 0) {
8780 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_commissioning, NULL((void*)0), "Payload");
8781
8782 /* Call the appropriate command dissector */
8783 switch (cmd_id) {
8784 case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE_RESPONSE0x00:
8785 case ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS_RESPONSE0x01:
8786 case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS_RESPONSE0x02:
8787 case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS_RESPONSE0x03:
8788 dissect_zcl_commissioning_response(tvb, payload_tree, &offset);
8789 break;
8790
8791 default:
8792 break;
8793 }
8794 }
8795 }
8796
8797 return tvb_captured_length(tvb);
8798} /*dissect_zbee_zcl_commissioning*/
8799
8800
8801 /*FUNCTION:------------------------------------------------------
8802 * NAME
8803 * dissect_zcl_commissioning_restart_device
8804 * DESCRIPTION
8805 * this function decodes the Restart Device payload.
8806 * PARAMETERS
8807 * tvb - the tv buffer of the current data_type
8808 * tree - the tree to append this item to
8809 * offset - offset of data in tvb
8810 * RETURNS
8811 * none
8812 *---------------------------------------------------------------
8813 */
8814static void
8815dissect_zcl_commissioning_restart_device(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
8816{
8817 static int * const restart_device_mask[] = {
8818 &hf_zbee_zcl_commissioning_restart_device_options_startup_mode,
8819 &hf_zbee_zcl_commissioning_restart_device_options_immediate,
8820 &hf_zbee_zcl_commissioning_restart_device_options_reserved,
8821 NULL((void*)0)
8822 };
8823
8824 /* Retrieve "Options" field */
8825 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_ENDIAN0x80000000);
8826 *offset += 1;
8827
8828 /* Retrieve "Delay" field */
8829 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_delay, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
8830 *offset += 1;
8831
8832 /* Retrieve "Jitter" field */
8833 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_jitter, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
8834 *offset += 1;
8835
8836} /*dissect_zcl_commissioning_restart_device*/
8837
8838
8839 /*FUNCTION:------------------------------------------------------
8840 * NAME
8841 * dissect_zcl_commissioning_save_restore_startup_parameters
8842 * DESCRIPTION
8843 * this function decodes the Save and Restore payload.
8844 * PARAMETERS
8845 * tvb - the tv buffer of the current data_type
8846 * tree - the tree to append this item to
8847 * offset - offset of data in tvb
8848 * RETURNS
8849 * none
8850 *---------------------------------------------------------------
8851 */
8852static void
8853dissect_zcl_commissioning_save_restore_startup_parameters(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
8854{
8855 /* Retrieve "Options" field */
8856 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_options, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
8857 *offset += 1;
8858
8859 /* Retrieve "Index" field */
8860 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
8861 *offset += 1;
8862
8863} /*dissect_zcl_commissioning_save_restore_startup_parameters*/
8864
8865/*FUNCTION:------------------------------------------------------
8866* NAME
8867* dissect_zcl_commissioning_reset_startup_parameters
8868* DESCRIPTION
8869* this function decodes the Reset Startup Parameters payload.
8870* PARAMETERS
8871* tvb - the tv buffer of the current data_type
8872* tree - the tree to append this item to
8873* offset - offset of data in tvb
8874* RETURNS
8875* none
8876*---------------------------------------------------------------
8877*/
8878static void
8879dissect_zcl_commissioning_reset_startup_parameters(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
8880{
8881 static int * const reset_startup_mask[] = {
8882 &hf_zbee_zcl_commissioning_reset_startup_options_reset_current,
8883 &hf_zbee_zcl_commissioning_reset_startup_options_reset_all,
8884 &hf_zbee_zcl_commissioning_reset_startup_options_erase_index,
8885 &hf_zbee_zcl_commissioning_reset_startup_options_reserved,
8886 NULL((void*)0)
8887 };
8888
8889 /* Retrieve "Options" field */
8890 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_ENDIAN0x80000000);
8891 *offset += 1;
8892
8893 /* Retrieve "Index" field */
8894 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
8895 *offset += 1;
8896
8897} /*dissect_zcl_commissioning_reset_startup_parameters*/
8898
8899/*FUNCTION:------------------------------------------------------
8900* NAME
8901* dissect_zcl_commissioning_response
8902* DESCRIPTION
8903* this function decodes the Response payload.
8904* PARAMETERS
8905* tvb - the tv buffer of the current data_type
8906* tree - the tree to append this item to
8907* offset - offset of data in tvb
8908* RETURNS
8909* none
8910*---------------------------------------------------------------
8911*/
8912static void
8913dissect_zcl_commissioning_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
8914{
8915 /* Retrieve "Status" field */
8916 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
8917 *offset += 1;
8918
8919} /*dissect_zcl_commissioning_response*/
8920
8921
8922/*FUNCTION:------------------------------------------------------
8923 * NAME
8924 * dissect_zcl_commissioning_attr_data
8925 * DESCRIPTION
8926 * this function is called by ZCL foundation dissector in order to decode
8927 * specific cluster attributes data.
8928 * PARAMETERS
8929 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
8930 * tvbuff_t *tvb - pointer to buffer containing raw packet.
8931 * unsigned *offset - pointer to buffer offset
8932 * uint16_t attr_id - attribute identifier
8933 * unsigned data_type - attribute data type
8934 * bool client_attr- ZCL client
8935 * RETURNS
8936 * none
8937 *---------------------------------------------------------------
8938 */
8939void
8940dissect_zcl_commissioning_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
8941{
8942 /* Dissect attribute data type and data */
8943 switch ( attr_id ) {
8944
8945 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_STACK_PROFILE0x0005:
8946 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_attr_stack_profile, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
8947 *offset += 1;
8948 break;
8949
8950 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_STARTUP_CONTROL0x0006:
8951 proto_tree_add_item(tree, hf_zbee_zcl_commissioning_attr_startup_control, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
8952 *offset += 1;
8953 break;
8954
8955 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_SHORT_ADDRESS0x0000:
8956 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_EXTENDED_PAN_ID0x0001:
8957 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_PAN_ID0x0002:
8958 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_CHANNEL_MASK0x0003:
8959 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_PROTOCOL_VERSION0x0004:
8960 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_ADDRESS0x0010:
8961 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_MASTER_KEY0x0011:
8962 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY0x0012:
8963 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_USE_INSECURE_JOIN0x0013:
8964 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_PRECONFIGURED_LINK_KEY0x0014:
8965 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_SEQ_NUM0x0015:
8966 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_TYPE0x0016:
8967 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_MANAGER_ADDRESS0x0017:
8968 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_SCAN_ATTEMPTS0x0020:
8969 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_TIME_BETWEEN_SCANS0x0021:
8970 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_REJOIN_INTERVAL0x0022:
8971 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_MAX_REJOIN_INTERVAL0x0023:
8972 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_INDIRECT_POLL_RATE0x0030:
8973 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_PARENT_RETRY_THRESHOLD0x0031:
8974 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_FLAG0x0040:
8975 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_RADIUS0x0041:
8976 case ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_DISCOVERY_TIME0x0042:
8977 default:
8978 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
8979 break;
8980 }
8981
8982} /*dissect_zcl_commissioning_attr_data*/
8983
8984
8985/*FUNCTION:------------------------------------------------------
8986 * NAME
8987 * proto_register_zbee_zcl_commissioning
8988 * DESCRIPTION
8989 * ZigBee ZCL Commissioning cluster protocol registration routine.
8990 * PARAMETERS
8991 * none
8992 * RETURNS
8993 * void
8994 *---------------------------------------------------------------
8995 */
8996void
8997proto_register_zbee_zcl_commissioning(void)
8998{
8999 /* Setup list of header fields */
9000 static hf_register_info hf[] = {
9001
9002 { &hf_zbee_zcl_commissioning_attr_id,
9003 { "Attribute", "zbee_zcl_general.commissioning.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_commissioning_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_commissioning_attr_names
))))
,
9004 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9005
9006 { &hf_zbee_zcl_commissioning_attr_stack_profile,
9007 { "Stack Profile", "zbee_zcl_general.commissioning.attr.stack_profile", FT_UINT8, BASE_HEX, VALS(zbee_zcl_commissioning_stack_profile_values)((0 ? (const struct _value_string*)0 : ((zbee_zcl_commissioning_stack_profile_values
))))
,
9008 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9009
9010 { &hf_zbee_zcl_commissioning_attr_startup_control,
9011 { "Startup Control", "zbee_zcl_general.commissioning.attr.startup_control", FT_UINT8, BASE_HEX, VALS(zbee_zcl_commissioning_startup_control_values)((0 ? (const struct _value_string*)0 : ((zbee_zcl_commissioning_startup_control_values
))))
,
9012 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9013
9014 /* start Restart Device Options fields */
9015 { &hf_zbee_zcl_commissioning_restart_device_options,
9016 { "Restart Device Options", "zbee_zcl_general.commissioning.restart_device_options", FT_UINT8, BASE_HEX, NULL((void*)0),
9017 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9018
9019 { &hf_zbee_zcl_commissioning_restart_device_options_startup_mode,
9020 { "Startup Mode", "zbee_zcl_general.commissioning.restart_device_options.startup_mode", FT_UINT8, BASE_HEX, VALS(zbee_zcl_commissioning_startup_mode_values)((0 ? (const struct _value_string*)0 : ((zbee_zcl_commissioning_startup_mode_values
))))
,
9021 ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_STARTUP_MODE0x07, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9022
9023 { &hf_zbee_zcl_commissioning_restart_device_options_immediate,
9024 { "Immediate", "zbee_zcl_general.commissioning.restart_device_options.immediate", FT_BOOLEAN, 8, NULL((void*)0),
9025 ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_IMMEDIATE0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9026
9027 { &hf_zbee_zcl_commissioning_restart_device_options_reserved,
9028 { "Reserved", "zbee_zcl_general.commissioning.restart_device_options.reserved", FT_BOOLEAN, 8, NULL((void*)0),
9029 ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_RESERVED0xF0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9030 /* end Restart Device Options fields */
9031
9032 { &hf_zbee_zcl_commissioning_delay,
9033 { "Delay", "zbee_zcl_general.commissioning.delay", FT_UINT8, BASE_DEC, NULL((void*)0),
9034 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9035
9036 { &hf_zbee_zcl_commissioning_jitter,
9037 { "Jitter", "zbee_zcl_general.commissioning.jitter", FT_UINT8, BASE_DEC, NULL((void*)0),
9038 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9039
9040 { &hf_zbee_zcl_commissioning_options,
9041 { "Options (Reserved)", "zbee_zcl_general.commissioning.options", FT_UINT8, BASE_HEX, NULL((void*)0),
9042 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9043
9044 { &hf_zbee_zcl_commissioning_index,
9045 { "Index", "zbee_zcl_general.commissioning.index", FT_UINT8, BASE_DEC, NULL((void*)0),
9046 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9047
9048 /* start Reset Startup Options fields */
9049 { &hf_zbee_zcl_commissioning_reset_startup_options,
9050 { "Reset Startup Options", "zbee_zcl_general.commissioning.reset_startup_options", FT_UINT8, BASE_HEX, NULL((void*)0),
9051 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9052
9053 { &hf_zbee_zcl_commissioning_reset_startup_options_reset_current,
9054 { "Reset Current", "zbee_zcl_general.commissioning.reset_startup_options.current", FT_BOOLEAN, 8, NULL((void*)0),
9055 ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESET_CURRENT0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9056
9057 { &hf_zbee_zcl_commissioning_reset_startup_options_reset_all,
9058 { "Reset All", "zbee_zcl_general.commissioning.reset_startup_options.reset_all", FT_BOOLEAN, 8, NULL((void*)0),
9059 ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESET_ALL0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9060
9061 { &hf_zbee_zcl_commissioning_reset_startup_options_erase_index,
9062 { "Erase Index", "zbee_zcl_general.commissioning.reset_startup_options.erase_index", FT_BOOLEAN, 8, NULL((void*)0),
9063 ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_ERASE_INDEX0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9064
9065 { &hf_zbee_zcl_commissioning_reset_startup_options_reserved,
9066 { "Reserved", "zbee_zcl_general.commissioning.reset_startup_options.reserved", FT_BOOLEAN, 8, NULL((void*)0),
9067 ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESERVED0xFC, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9068 /* end Reset Startup Options fields */
9069
9070 { &hf_zbee_zcl_commissioning_status,
9071 { "Status", "zbee_zcl_general.commissioning.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_status_names
))))
,
9072 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9073
9074 { &hf_zbee_zcl_commissioning_srv_rx_cmd_id,
9075 { "Command", "zbee_zcl_general.commissioning.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_commissioning_srv_rx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_commissioning_srv_rx_cmd_names
))))
,
9076 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9077
9078 { &hf_zbee_zcl_commissioning_srv_tx_cmd_id,
9079 { "Command", "zbee_zcl_general.commissioning.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_commissioning_srv_tx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_commissioning_srv_tx_cmd_names
))))
,
9080 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
9081
9082 };
9083
9084 /* ZCL Commissioning subtrees */
9085 static int *ett[] = {
9086 &ett_zbee_zcl_commissioning,
9087 &ett_zbee_zcl_commissioning_restart_device_options,
9088 &ett_zbee_zcl_commissioning_reset_startup_options
9089 };
9090
9091 /* Register the ZigBee ZCL Commissioning cluster protocol name and description */
9092 proto_zbee_zcl_commissioning = proto_register_protocol("ZigBee ZCL Commissioning", "ZCL Commissioning", ZBEE_PROTOABBREV_ZCL_COMMISSIONING"zbee_zcl_general.commissioning");
9093 proto_register_field_array(proto_zbee_zcl_commissioning, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
9094 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
9095
9096 /* Register the ZigBee ZCL Commissioning dissector. */
9097 register_dissector(ZBEE_PROTOABBREV_ZCL_COMMISSIONING"zbee_zcl_general.commissioning", dissect_zbee_zcl_commissioning, proto_zbee_zcl_commissioning);
9098
9099} /*proto_register_zbee_zcl_commissioning*/
9100
9101
9102/*FUNCTION:------------------------------------------------------
9103 * NAME
9104 * proto_reg_handoff_zbee_zcl_commissioning
9105 * DESCRIPTION
9106 * Hands off the ZCL Commissioning dissector.
9107 * PARAMETERS
9108 * none
9109 * RETURNS
9110 * none
9111 *---------------------------------------------------------------
9112 */
9113void
9114proto_reg_handoff_zbee_zcl_commissioning(void)
9115{
9116 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_COMMISSIONING"zbee_zcl_general.commissioning",
9117 proto_zbee_zcl_commissioning,
9118 ett_zbee_zcl_commissioning,
9119 ZBEE_ZCL_CID_COMMISSIONING0x0015,
9120 ZBEE_MFG_CODE_NONE0x0000,
9121 hf_zbee_zcl_commissioning_attr_id,
9122 hf_zbee_zcl_commissioning_attr_id,
9123 hf_zbee_zcl_commissioning_srv_rx_cmd_id,
9124 hf_zbee_zcl_commissioning_srv_tx_cmd_id,
9125 (zbee_zcl_fn_attr_data)dissect_zcl_commissioning_attr_data
9126 );
9127} /*proto_reg_handoff_zbee_zcl_commissioning*/
9128
9129
9130/* ########################################################################## */
9131/* #### (0x0016) PARTITION ################################################## */
9132/* ########################################################################## */
9133
9134/*************************/
9135/* Defines */
9136/*************************/
9137
9138#define ZBEE_ZCL_PART_NUM_GENERIC_ETT3 3
9139#define ZBEE_ZCL_PART_NUM_NACK_ID_ETT16 16
9140#define ZBEE_ZCL_PART_NUM_ATTRS_ID_ETT16 16
9141#define ZBEE_ZCL_PART_NUM_ETT(3 + 16 + 16) (ZBEE_ZCL_PART_NUM_GENERIC_ETT3 + \
9142 ZBEE_ZCL_PART_NUM_NACK_ID_ETT16 + \
9143 ZBEE_ZCL_PART_NUM_ATTRS_ID_ETT16)
9144
9145#define ZBEE_ZCL_PART_OPT_1_BLOCK0x01 0x01
9146#define ZBEE_ZCL_PART_OPT_INDIC_LEN0x02 0x02
9147#define ZBEE_ZCL_PART_OPT_RESERVED0xc0 0xc0
9148
9149#define ZBEE_ZCL_PART_ACK_OPT_NACK_LEN0x01 0x01
9150#define ZBEE_ZCL_PART_ACK_OPT_RESERVED0xFE 0xFE
9151
9152/* Attributes */
9153#define ZBEE_ZCL_ATTR_ID_PART_MAX_IN_TRANSF_SIZE0x0000 0x0000 /* Maximum Incoming Transfer Size */
9154#define ZBEE_ZCL_ATTR_ID_PART_MAX_OUT_TRANSF_SIZE0x0001 0x0001 /* Maximum Outgoing Transfer Size */
9155#define ZBEE_ZCL_ATTR_ID_PART_PARTITIONED_FRAME_SIZE0x0002 0x0002 /* Partitioned Frame Size */
9156#define ZBEE_ZCL_ATTR_ID_PART_LARGE_FRAME_SIZE0x0003 0x0003 /* Large Frame Size */
9157#define ZBEE_ZCL_ATTR_ID_PART_ACK_FRAME_NUM0x0004 0x0004 /* Number of Ack Frame*/
9158#define ZBEE_ZCL_ATTR_ID_PART_NACK_TIMEOUT0x0005 0x0005 /* Nack Timeout */
9159#define ZBEE_ZCL_ATTR_ID_PART_INTERFRAME_DELEAY0x0006 0x0006 /* Interframe Delay */
9160#define ZBEE_ZCL_ATTR_ID_PART_SEND_RETRIES_NUM0x0007 0x0007 /* Number of Send Retries */
9161#define ZBEE_ZCL_ATTR_ID_PART_SENDER_TIMEOUT0x0008 0x0008 /* Sender Timeout */
9162#define ZBEE_ZCL_ATTR_ID_PART_RECEIVER_TIMEOUT0x0009 0x0009 /* Receiver Timeout */
9163
9164/* Server Commands Received */
9165#define ZBEE_ZCL_CMD_ID_PART_TRANSF_PART_FRAME0x00 0x00 /* Transfer Partitioned Frame */
9166#define ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM0x01 0x01 /* Read Handshake Param */
9167#define ZBEE_ZCL_CMD_ID_PART_WR_HANDSHAKE_PARAM0x02 0x02 /* Write Handshake Param */
9168
9169/* Server Commands Generated */
9170#define ZBEE_ZCL_CMD_ID_PART_MULTI_ACK0x00 0x00 /* Multiple Ack */
9171#define ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM_RSP0x01 0x01 /* Read Handshake Param Response */
9172
9173
9174/*************************/
9175/* Function Declarations */
9176/*************************/
9177
9178void proto_register_zbee_zcl_part(void);
9179void proto_reg_handoff_zbee_zcl_part(void);
9180
9181/* Command Dissector Helpers */
9182static void dissect_zcl_part_trasfpartframe (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
9183static void dissect_zcl_part_rdhandshakeparam (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool_Bool direction);
9184static void dissect_zcl_part_wrhandshakeparam (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool_Bool direction);
9185static void dissect_zcl_part_multiack (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
9186static void dissect_zcl_part_rdhandshakeparamrsp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool_Bool direction);
9187
9188/* Private functions prototype */
9189
9190/*************************/
9191/* Global Variables */
9192/*************************/
9193
9194/* Initialize the protocol and registered fields */
9195static int proto_zbee_zcl_part;
9196
9197static int hf_zbee_zcl_part_attr_id;
9198static int hf_zbee_zcl_part_srv_tx_cmd_id;
9199static int hf_zbee_zcl_part_srv_rx_cmd_id;
9200static int hf_zbee_zcl_part_opt;
9201static int hf_zbee_zcl_part_opt_first_block;
9202static int hf_zbee_zcl_part_opt_indic_len;
9203static int hf_zbee_zcl_part_opt_res;
9204static int hf_zbee_zcl_part_first_frame_id;
9205static int hf_zbee_zcl_part_part_indicator;
9206static int hf_zbee_zcl_part_part_frame;
9207static int hf_zbee_zcl_part_partitioned_cluster_id;
9208static int hf_zbee_zcl_part_ack_opt;
9209static int hf_zbee_zcl_part_ack_opt_nack_id_len;
9210static int hf_zbee_zcl_part_ack_opt_res;
9211static int hf_zbee_zcl_part_nack_id;
9212
9213/* Initialize the subtree pointers */
9214static int ett_zbee_zcl_part;
9215static int ett_zbee_zcl_part_fragm_options;
9216static int ett_zbee_zcl_part_ack_opts;
9217static int ett_zbee_zcl_part_nack_id_list[ZBEE_ZCL_PART_NUM_NACK_ID_ETT16];
9218static int ett_zbee_zcl_part_attrs_id_list[ZBEE_ZCL_PART_NUM_ATTRS_ID_ETT16];
9219
9220/* Attributes */
9221static const value_string zbee_zcl_part_attr_names[] = {
9222 { ZBEE_ZCL_ATTR_ID_PART_MAX_IN_TRANSF_SIZE0x0000, "Maximum Incoming Transfer Size" },
9223 { ZBEE_ZCL_ATTR_ID_PART_MAX_OUT_TRANSF_SIZE0x0001, "Maximum Outgoing Transfer Size" },
9224 { ZBEE_ZCL_ATTR_ID_PART_PARTITIONED_FRAME_SIZE0x0002, "Partitioned Frame Size" },
9225 { ZBEE_ZCL_ATTR_ID_PART_LARGE_FRAME_SIZE0x0003, "Large Frame Size" },
9226 { ZBEE_ZCL_ATTR_ID_PART_ACK_FRAME_NUM0x0004, "Number of Ack Frame" },
9227 { ZBEE_ZCL_ATTR_ID_PART_NACK_TIMEOUT0x0005, "Nack Timeout" },
9228 { ZBEE_ZCL_ATTR_ID_PART_INTERFRAME_DELEAY0x0006, "Interframe Delay" },
9229 { ZBEE_ZCL_ATTR_ID_PART_SEND_RETRIES_NUM0x0007, "Number of Send Retries" },
9230 { ZBEE_ZCL_ATTR_ID_PART_SENDER_TIMEOUT0x0008, "Sender Timeout" },
9231 { ZBEE_ZCL_ATTR_ID_PART_RECEIVER_TIMEOUT0x0009, "Receiver Timeout" },
9232 { 0, NULL((void*)0) }
9233};
9234
9235/* Server Commands Received */
9236static const value_string zbee_zcl_part_srv_rx_cmd_names[] = {
9237 { ZBEE_ZCL_CMD_ID_PART_TRANSF_PART_FRAME0x00, "Transfer Partitioned Frame" },
9238 { ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM0x01, "Read Handshake Param" },
9239 { ZBEE_ZCL_CMD_ID_PART_WR_HANDSHAKE_PARAM0x02, "Write Handshake Param" },
9240 { 0, NULL((void*)0) }
9241};
9242
9243/* Server Commands Generated */
9244static const value_string zbee_zcl_part_srv_tx_cmd_names[] = {
9245 { ZBEE_ZCL_CMD_ID_PART_MULTI_ACK0x00, "Multiple Ack" },
9246 { ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM_RSP0x01, "Read Handshake Param Response" },
9247 { 0, NULL((void*)0) }
9248};
9249
9250/* ID Length */
9251static const value_string zbee_zcl_part_id_length_names[] = {
9252 { 0, "1-Byte length" },
9253 { 1, "2-Bytes length" },
9254 { 0, NULL((void*)0) }
9255};
9256
9257/*************************/
9258/* Function Bodies */
9259/*************************/
9260
9261/*FUNCTION:------------------------------------------------------
9262 * NAME
9263 * dissect_zbee_zcl_part
9264 * DESCRIPTION
9265 * ZigBee ZCL Partition cluster dissector for wireshark.
9266 * PARAMETERS
9267 * tvbuff_t *tvb - pointer to buffer containing raw packet.
9268 * packet_info *pinfo - pointer to packet information fields
9269 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
9270 * void *data - pointer to ZCL packet structure.
9271 * RETURNS
9272 * int - length of parsed data.
9273 *---------------------------------------------------------------
9274 */
9275static int
9276dissect_zbee_zcl_part(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
9277{
9278 proto_tree *payload_tree;
9279 zbee_zcl_packet *zcl;
9280 unsigned offset = 0;
9281 uint8_t cmd_id;
9282 int rem_len;
9283
9284 /* Reject the packet if data is NULL */
9285 if (data == NULL((void*)0))
9286 return 0;
9287 zcl = (zbee_zcl_packet *)data;
9288 cmd_id = zcl->cmd_id;
9289
9290 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
9291 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER0x00) {
9292 /* Append the command name to the info column. */
9293 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
9294 val_to_str_const(cmd_id, zbee_zcl_part_srv_rx_cmd_names, "Unknown Command"),
9295 zcl->tran_seqno);
9296
9297 /* Add the command ID. */
9298 proto_tree_add_item(tree, hf_zbee_zcl_part_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
9299
9300 /* Check is this command has a payload, than add the payload tree */
9301 rem_len = tvb_reported_length_remaining(tvb, ++offset);
9302 if (rem_len > 0) {
9303 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_part, NULL((void*)0), "Payload");
9304
9305 /* Call the appropriate command dissector */
9306 switch (cmd_id) {
9307 case ZBEE_ZCL_CMD_ID_PART_TRANSF_PART_FRAME0x00:
9308 dissect_zcl_part_trasfpartframe(tvb, payload_tree, &offset);
9309 break;
9310
9311 case ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM0x01:
9312 dissect_zcl_part_rdhandshakeparam(tvb, pinfo, payload_tree, &offset, zcl->direction);
9313 break;
9314
9315 case ZBEE_ZCL_CMD_ID_PART_WR_HANDSHAKE_PARAM0x02:
9316 dissect_zcl_part_wrhandshakeparam(tvb, pinfo, payload_tree, &offset, zcl->direction);
9317 break;
9318
9319 default:
9320 break;
9321 }
9322 }
9323 }
9324 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
9325 /* Append the command name to the info column. */
9326 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
9327 val_to_str_const(cmd_id, zbee_zcl_part_srv_tx_cmd_names, "Unknown Command"),
9328 zcl->tran_seqno);
9329
9330 /* Add the command ID. */
9331 proto_tree_add_item(tree, hf_zbee_zcl_part_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
9332
9333 /* Check is this command has a payload, than add the payload tree */
9334 rem_len = tvb_reported_length_remaining(tvb, ++offset);
9335 if (rem_len > 0) {
9336 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_part, NULL((void*)0), "Payload");
9337
9338 /* Call the appropriate command dissector */
9339 switch (cmd_id) {
9340 case ZBEE_ZCL_CMD_ID_PART_MULTI_ACK0x00:
9341 dissect_zcl_part_multiack(tvb, payload_tree, &offset);
9342 break;
9343
9344 case ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM_RSP0x01:
9345 dissect_zcl_part_rdhandshakeparamrsp(tvb, pinfo, payload_tree, &offset, zcl->direction);
9346 break;
9347
9348 default:
9349 break;
9350 }
9351 }
9352 }
9353
9354 return tvb_captured_length(tvb);
9355} /*dissect_zbee_zcl_part*/
9356
9357 /*FUNCTION:------------------------------------------------------
9358 * NAME
9359 * dissect_zcl_part_trasfpartframe
9360 * DESCRIPTION
9361 * This function manages the Transfer Partition Frame payload
9362 * PARAMETERS
9363 * tvbuff_t *tvb - pointer to buffer containing raw packet.
9364 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
9365 * offset - pointer of buffer offset
9366 * RETURNS
9367 * none
9368 *---------------------------------------------------------------
9369 */
9370static void dissect_zcl_part_trasfpartframe(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
9371{
9372
9373 uint8_t options;
9374 int frame_len;
9375
9376 static int * const part_opt[] = {
9377 &hf_zbee_zcl_part_opt_first_block,
9378 &hf_zbee_zcl_part_opt_indic_len,
9379 &hf_zbee_zcl_part_opt_res,
9380 NULL((void*)0)
9381 };
9382
9383 /* Retrieve "Fragmentation Options" field */
9384 options = tvb_get_uint8(tvb, *offset);
9385 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_part_opt, ett_zbee_zcl_part_fragm_options, part_opt, ENC_NA0x00000000);
9386 *offset += 1;
9387
9388 /* Retrieve "PartitionIndicator" field */
9389 if ((options & ZBEE_ZCL_PART_OPT_INDIC_LEN0x02) == 0)
9390 {
9391 /* 1-byte length */
9392 proto_tree_add_item(tree, hf_zbee_zcl_part_part_indicator, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
9393 *offset += 1;
9394 }
9395 else {
9396 /* 2-bytes length */
9397 proto_tree_add_item(tree, hf_zbee_zcl_part_part_indicator, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
9398 *offset += 2;
9399 }
9400
9401 /* Retrieve "PartitionedFrame" field */
9402 proto_tree_add_item_ret_length(tree, hf_zbee_zcl_part_part_frame, tvb, *offset, 1, ENC_NA0x00000000|ENC_ZIGBEE0x40000000, &frame_len);
9403 *offset += frame_len;
9404
9405} /*dissect_zcl_part_trasfpartframe*/
9406
9407 /*FUNCTION:------------------------------------------------------
9408 * NAME
9409 * dissect_zcl_part_rdhandshakeparam
9410 * DESCRIPTION
9411 * This function manages the ReadHandshakeParam payload
9412 * PARAMETERS
9413 * tvbuff_t *tvb - pointer to buffer containing raw packet.
9414 * packet_info *pinfo - pointer to packet information fields
9415 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
9416 * offset - offset
9417 * direction - ZCL direction
9418 * RETURNS
9419 * none
9420 *---------------------------------------------------------------
9421 */
9422static void
9423dissect_zcl_part_rdhandshakeparam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool_Bool direction)
9424{
9425 /* Retrieve "Partitioned Cluster ID" field */
9426 proto_tree_add_item(tree, hf_zbee_zcl_part_partitioned_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
9427 *offset += 2;
9428
9429 /* Dissect the attribute id list */
9430 dissect_zcl_read_attr(tvb, pinfo, tree, offset, ZBEE_ZCL_CID_PARTITION0x0016, ZBEE_MFG_CODE_NONE0x0000, direction);
9431} /*dissect_zcl_part_rdhandshakeparam*/
9432
9433 /*FUNCTION:------------------------------------------------------
9434 * NAME
9435 * dissect_zcl_part_wrhandshakeparam
9436 * DESCRIPTION
9437 * This function manages the WriteAndShakeParam payload
9438 * PARAMETERS
9439 * tvbuff_t *tvb - pointer to buffer containing raw packet.
9440 * packet_info *pinfo - pointer to packet information fields
9441 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
9442 * offset - offset
9443 * direction - ZCL direction
9444 * RETURNS
9445 * none
9446 *---------------------------------------------------------------
9447 */
9448static void
9449dissect_zcl_part_wrhandshakeparam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool_Bool direction)
9450{
9451 /* Retrieve "Partitioned Cluster ID" field */
9452 proto_tree_add_item(tree, hf_zbee_zcl_part_partitioned_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
9453 *offset += 2;
9454
9455 /* Dissect the attributes list */
9456 dissect_zcl_write_attr(tvb, pinfo, tree, offset, ZBEE_ZCL_CID_PARTITION0x0016, ZBEE_MFG_CODE_NONE0x0000, direction);
9457
9458} /*dissect_zcl_part_wrhandshakeparam*/
9459
9460
9461/* Management of Cluster specific commands sent by the server */
9462
9463 /*FUNCTION:------------------------------------------------------
9464 * NAME
9465 * dissect_zcl_part_multiack
9466 * DESCRIPTION
9467 * This function manages the MultipleACK payload
9468 * PARAMETERS
9469 * tvbuff_t *tvb - pointer to buffer containing raw packet.
9470 * packet_info *pinfo, -
9471 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
9472 * offset - offset
9473 * RETURNS
9474 * none
9475 *---------------------------------------------------------------
9476 */
9477static void
9478dissect_zcl_part_multiack(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
9479{
9480 unsigned tvb_len = tvb_reported_length(tvb);
9481 unsigned i = 0;
9482 uint8_t options;
9483
9484 static int * const ack_opts[] = {
9485 &hf_zbee_zcl_part_ack_opt_nack_id_len,
9486 &hf_zbee_zcl_part_ack_opt_res,
9487 NULL((void*)0)
9488 };
9489
9490 /* Retrieve "Ack Options" field */
9491 options = tvb_get_uint8(tvb, *offset);
9492 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_part_ack_opt, ett_zbee_zcl_part_ack_opts, ack_opts, ENC_NA0x00000000);
9493 *offset += 1;
9494
9495 /* Retrieve "First Frame ID" field */
9496 if ((options & ZBEE_ZCL_PART_ACK_OPT_NACK_LEN0x01) == 0)
9497 {
9498 /* 1-byte length */
9499 proto_tree_add_item(tree, hf_zbee_zcl_part_first_frame_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
9500 *offset += 1;
9501 }
9502 else {
9503 /* 2-bytes length */
9504 proto_tree_add_item(tree, hf_zbee_zcl_part_first_frame_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
9505 *offset += 2;
9506 }
9507
9508 /* Dissect the nack id list */
9509 while ( *offset < tvb_len && i < ZBEE_ZCL_PART_NUM_NACK_ID_ETT16 )
9510 {
9511 if ((options & ZBEE_ZCL_PART_ACK_OPT_NACK_LEN0x01) == 0)
9512 {
9513 /* 1-byte length */
9514 proto_tree_add_item(tree, hf_zbee_zcl_part_nack_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
9515 *offset += 1;
9516 }
9517 else {
9518 /* 2-bytes length */
9519 proto_tree_add_item(tree, hf_zbee_zcl_part_nack_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
9520 *offset += 2;
9521 }
9522
9523 i++;
9524 }
9525} /*dissect_zcl_part_multiack*/
9526
9527 /*FUNCTION:------------------------------------------------------
9528 * NAME
9529 * dissect_zcl_part_rdhandshakeparamrsp
9530 * DESCRIPTION
9531 * This function manages the ReadHandshakeParamResponse payload
9532 * PARAMETERS
9533 * tvbuff_t *tvb - pointer to buffer containing raw packet.
9534 * packet_info *pinfo - pointer to packet information fields
9535 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
9536 * offset - offset
9537 * direction - ZCL direction
9538 * RETURNS
9539 * none
9540 *---------------------------------------------------------------
9541 */
9542static void
9543dissect_zcl_part_rdhandshakeparamrsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool_Bool direction)
9544{
9545 /* Retrieve "Partitioned Cluster ID" field */
9546 proto_tree_add_item(tree, hf_zbee_zcl_part_partitioned_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
9547 *offset += 2;
9548
9549 /* Dissect the attributes list */
9550 dissect_zcl_read_attr_resp(tvb, pinfo, tree, offset, ZBEE_ZCL_CID_PARTITION0x0016, ZBEE_MFG_CODE_NONE0x0000, direction);
9551} /*dissect_zcl_part_rdhandshakeparamrsp*/
9552
9553
9554/*FUNCTION:------------------------------------------------------
9555 * NAME
9556 * proto_register_zbee_zcl_part
9557 * DESCRIPTION
9558 * this function is called by ZCL foundation dissector in order to decode
9559 * specific cluster attributes data.
9560 * PARAMETERS
9561 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
9562 * tvbuff_t *tvb - pointer to buffer containing raw packet.
9563 * unsigned *offset - pointer to buffer offset
9564 * uint16_t attr_id - attribute identifier
9565 * unsigned data_type - attribute data type
9566 * RETURNS
9567 * none
9568 *---------------------------------------------------------------
9569 */
9570void proto_register_zbee_zcl_part(void)
9571{
9572 uint8_t i, j;
9573
9574 static hf_register_info hf[] = {
9575
9576 { &hf_zbee_zcl_part_attr_id,
9577 { "Attribute", "zbee_zcl_general.part.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_part_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_part_attr_names
))))
,
9578 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9579
9580 { &hf_zbee_zcl_part_srv_tx_cmd_id,
9581 { "Command", "zbee_zcl_general.part.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_part_srv_tx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_part_srv_tx_cmd_names
))))
,
9582 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9583
9584 { &hf_zbee_zcl_part_srv_rx_cmd_id,
9585 { "Command", "zbee_zcl_general.part.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_part_srv_rx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_part_srv_rx_cmd_names
))))
,
9586 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9587
9588 { &hf_zbee_zcl_part_opt,
9589 { "Fragmentation Options", "zbee_zcl_general.part.opt", FT_UINT8, BASE_HEX,
9590 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
9591
9592 { &hf_zbee_zcl_part_opt_first_block,
9593 { "First Block", "zbee_zcl_general.part.opt.first_block", FT_UINT8, BASE_HEX, NULL((void*)0),
9594 ZBEE_ZCL_PART_OPT_1_BLOCK0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9595
9596 { &hf_zbee_zcl_part_opt_indic_len,
9597 { "Indicator length", "zbee_zcl_general.part.opt.indic_len", FT_UINT8, BASE_DEC, VALS(zbee_zcl_part_id_length_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_part_id_length_names
))))
,
9598 ZBEE_ZCL_PART_OPT_INDIC_LEN0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9599
9600 { &hf_zbee_zcl_part_opt_res,
9601 { "Reserved", "zbee_zcl_general.part.opt.res", FT_UINT8, BASE_HEX, NULL((void*)0),
9602 ZBEE_ZCL_PART_OPT_RESERVED0xc0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9603
9604 { &hf_zbee_zcl_part_first_frame_id,
9605 { "First Frame ID", "zbee_zcl_general.part.first_frame_id", FT_UINT16, BASE_DEC, NULL((void*)0),
9606 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9607
9608 { &hf_zbee_zcl_part_part_indicator,
9609 { "Partition Indicator", "zbee_zcl_general.part.part_indicator", FT_UINT16, BASE_DEC, NULL((void*)0),
9610 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9611
9612 { &hf_zbee_zcl_part_part_frame,
9613 { "Partition Frame", "zbee_zcl_general.part.part_frame", FT_UINT_BYTES, SEP_COLON, NULL((void*)0),
9614 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9615
9616 { &hf_zbee_zcl_part_partitioned_cluster_id,
9617 { "Partitioned Cluster ID", "zbee_zcl_general.part.part_cluster_id", FT_UINT16, BASE_HEX | BASE_RANGE_STRING0x00000100, RVALS(zbee_aps_cid_names)((0 ? (const struct _range_string*)0 : ((zbee_aps_cid_names))
))
,
9618 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9619
9620 { &hf_zbee_zcl_part_ack_opt,
9621 { "Ack Options", "zbee_zcl_general.ack_opt.part", FT_UINT8, BASE_HEX,
9622 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
9623
9624 { &hf_zbee_zcl_part_ack_opt_nack_id_len,
9625 { "Nack Id Length", "zbee_zcl_general.ack_opt.part.nack_id.len", FT_UINT8, BASE_HEX, VALS(zbee_zcl_part_id_length_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_part_id_length_names
))))
,
9626 ZBEE_ZCL_PART_ACK_OPT_NACK_LEN0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9627
9628 { &hf_zbee_zcl_part_ack_opt_res,
9629 { "Reserved", "zbee_zcl_general.part.ack_opt.reserved", FT_UINT8, BASE_HEX, NULL((void*)0),
9630 ZBEE_ZCL_PART_ACK_OPT_RESERVED0xFE, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
9631
9632 { &hf_zbee_zcl_part_nack_id,
9633 { "Nack Id", "zbee_zcl_general.part.nack_id", FT_UINT16, BASE_DEC, NULL((void*)0),
9634 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
9635
9636 };
9637
9638 /* ZCL Partition subtrees */
9639 int *ett[ZBEE_ZCL_PART_NUM_ETT(3 + 16 + 16)] = {
9640 &ett_zbee_zcl_part,
9641 &ett_zbee_zcl_part_fragm_options,
9642 &ett_zbee_zcl_part_ack_opts
9643 };
9644
9645 /* initialize attribute subtree types */
9646 for ( i = 0, j = ZBEE_ZCL_PART_NUM_GENERIC_ETT3; i < ZBEE_ZCL_PART_NUM_NACK_ID_ETT16; i++, j++) {
9647 ett[j] = &ett_zbee_zcl_part_nack_id_list[i];
9648 }
9649
9650 for ( i = 0; i < ZBEE_ZCL_PART_NUM_ATTRS_ID_ETT16; i++, j++) {
9651 ett[j] = &ett_zbee_zcl_part_attrs_id_list[i];
9652 }
9653
9654 /* Register ZigBee ZCL Partition protocol with Wireshark. */
9655 proto_zbee_zcl_part = proto_register_protocol("ZigBee ZCL Partition", "ZCL Partition", ZBEE_PROTOABBREV_ZCL_PART"zbee_zcl_general.part");
9656 proto_register_field_array(proto_zbee_zcl_part, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
9657 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
9658
9659 /* Register the ZigBee ZCL Partition dissector. */
9660 register_dissector(ZBEE_PROTOABBREV_ZCL_PART"zbee_zcl_general.part", dissect_zbee_zcl_part, proto_zbee_zcl_part);
9661} /* proto_register_zbee_zcl_part */
9662
9663
9664/*FUNCTION:------------------------------------------------------
9665 * NAME
9666 * proto_reg_handoff_zbee_zcl_part
9667 * DESCRIPTION
9668 * Registers the zigbee ZCL Partition cluster dissector with Wireshark.
9669 * PARAMETERS
9670 * none
9671 * RETURNS
9672 * void
9673 *---------------------------------------------------------------
9674 */
9675void proto_reg_handoff_zbee_zcl_part(void)
9676{
9677 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_PART"zbee_zcl_general.part",
9678 proto_zbee_zcl_part,
9679 ett_zbee_zcl_part,
9680 ZBEE_ZCL_CID_PARTITION0x0016,
9681 ZBEE_MFG_CODE_NONE0x0000,
9682 hf_zbee_zcl_part_attr_id,
9683 hf_zbee_zcl_part_attr_id,
9684 hf_zbee_zcl_part_srv_rx_cmd_id,
9685 hf_zbee_zcl_part_srv_tx_cmd_id,
9686 NULL((void*)0)
9687 );
9688
9689} /*proto_reg_handoff_zbee_zcl_part*/
9690
9691/* ########################################################################## */
9692/* #### (0x0019) OTA UPGRADE CLUSTER ######################################## */
9693/* ########################################################################## */
9694
9695/*************************/
9696/* Defines */
9697/*************************/
9698
9699/* Attributes */
9700#define ZBEE_ZCL_ATTR_ID_OTA_UPGRADE_SERVER_ID0x0000 0x0000 /* Upgrade Server ID */
9701#define ZBEE_ZCL_ATTR_ID_OTA_FILE_OFFSET0x0001 0x0001 /* File Offset */
9702#define ZBEE_ZCL_ATTR_ID_OTA_CURRENT_FILE_VERSION0x0002 0x0002 /* Current File Version */
9703#define ZBEE_ZCL_ATTR_ID_OTA_CURRENT_ZB_STACK_VERSION0x0003 0x0003 /* Current ZigBee Stack Version */
9704#define ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_FILE_VERSION0x0004 0x0004 /* Downloaded File Version */
9705#define ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_ZB_STACK_VERSION0x0005 0x0005 /* Downloaded ZigBee Stack Version */
9706#define ZBEE_ZCL_ATTR_ID_OTA_IMAGE_UPGRADE_STATUS0x0006 0x0006 /* Image Upgrade Status */
9707#define ZBEE_ZCL_ATTR_ID_OTA_MANUFACTURER_ID0x0007 0x0007 /* Manufacturer ID */
9708#define ZBEE_ZCL_ATTR_ID_OTA_IMAGE_TYPE_ID0x0008 0x0008 /* Image Type ID */
9709#define ZBEE_ZCL_ATTR_ID_OTA_MIN_BLOCK_REQ_DELAY0x0009 0x0009 /* Minimum Block Request Delay */
9710
9711/* Server Commands Generated */
9712#define ZBEE_ZCL_CMD_ID_OTA_IMAGE_NOTIFY0x00 0x00 /* Image Notify */
9713#define ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_RSP0x02 0x02 /* Query Next Image Response */
9714#define ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_RSP0x05 0x05 /* Image Block Response */
9715#define ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_RSP0x07 0x07 /* Upgrade End Response */
9716#define ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_RSP0x09 0x09 /* Query Specific File Response */
9717
9718/* Server Commands Received */
9719#define ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_REQ0x01 0x01 /* Query Next Image Request */
9720#define ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_REQ0x03 0x03 /* Image Block Request */
9721#define ZBEE_ZCL_CMD_ID_OTA_IMAGE_PAGE_REQ0x04 0x04 /* Image Page Request */
9722#define ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_REQ0x06 0x06 /* Upgrade End Request */
9723#define ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_REQ0x08 0x08 /* Query Specific File Request */
9724
9725/* Payload Type */
9726#define ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ0x00 0x00 /* Query Jitter */
9727#define ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC0x01 0x01 /* Query Jitter and Manufacturer Code */
9728#define ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT0x02 0x02 /* Query Jitter, Manufacturer Code and Image Type */
9729#define ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT_FV0x03 0x03 /* Query Jitter, Manufacturer Code, Image Type and File Version */
9730
9731/* Image Type */
9732#define ZBEE_ZCL_OTA_IMG_TYPE_MFR_LOW0x0000 0x0000 /* Manufacturer Specific (Low value) */
9733#define ZBEE_ZCL_OTA_IMG_TYPE_MFR_HIGH0xffbf 0xffbf /* Manufacturer Specific (High value) */
9734#define ZBEE_ZCL_OTA_IMG_TYPE_SECURITY0xffc0 0xffc0 /* Security Credential */
9735#define ZBEE_ZCL_OTA_IMG_TYPE_CONFIG0xffc1 0xffc1 /* Configuration */
9736#define ZBEE_ZCL_OTA_IMG_TYPE_LOG0xffc2 0xffc2 /* Log */
9737#define ZBEE_ZCL_OTA_IMG_TYPE_UNASSIGNED_LOW0xffc3 0xffc3 /* Reserved: Unassigned (Low value) */
9738#define ZBEE_ZCL_OTA_IMG_TYPE_UNASSIGNED_HIGH0xfffe 0xfffe /* Reserved: Unassigned (High value) */
9739#define ZBEE_ZCL_OTA_IMG_TYPE_WILD_CARD0xffff 0xffff /* Reserved: Wild Card */
9740
9741/* ZigBee Stack Version */
9742#define ZBEE_ZCL_OTA_ZB_STACK_VER_20060x0000 0x0000 /* ZigBee 2006 */
9743#define ZBEE_ZCL_OTA_ZB_STACK_VER_20070x0001 0x0001 /* ZigBee 2007 */
9744#define ZBEE_ZCL_OTA_ZB_STACK_VER_PRO0x0002 0x0002 /* ZigBee Pro */
9745#define ZBEE_ZCL_OTA_ZB_STACK_VER_IP0x0003 0x0003 /* ZigBee IP */
9746#define ZBEE_ZCL_OTA_ZB_STACK_VER_RESERVED_LO0x0004 0x0004 /* Reserved Low */
9747#define ZBEE_ZCL_OTA_ZB_STACK_VER_RESERVED_HI0xffff 0xffff /* Reserved High */
9748
9749/* Image Upgrade Status */
9750#define ZBEE_ZCL_OTA_STATUS_NORMAL0x00 0x00 /* Normal */
9751#define ZBEE_ZCL_OTA_STATUS_DOWNLOAD_IN_PROGRESS0x01 0x01 /* Download in progress */
9752#define ZBEE_ZCL_OTA_STATUS_DOWNLOAD_COMPLETE0x02 0x02 /* Download complete */
9753#define ZBEE_ZCL_OTA_STATUS_WAITING_TO_UPGRADE0x03 0x03 /* Waiting to upgrade */
9754#define ZBEE_ZCL_OTA_STATUS_COUNT_DOWN0x04 0x04 /* Count down */
9755#define ZBEE_ZCL_OTA_STATUS_WAIT_FOR_MORE0x05 0x05 /* Wait for more */
9756 /* 0x06-0xff - Reserved */
9757/* File Version mask */
9758#define ZBEE_ZCL_OTA_FILE_VERS_APPL_RELEASE0xFF000000 0xFF000000 /* Application Release */
9759#define ZBEE_ZCL_OTA_FILE_VERS_APPL_BUILD0x00FF0000 0x00FF0000 /* Application Build */
9760#define ZBEE_ZCL_OTA_FILE_VERS_STACK_RELEASE0x0000FF00 0x0000FF00 /* Stack Release */
9761#define ZBEE_ZCL_OTA_FILE_VERS_STACK_BUILD0x000000FF 0x000000FF /* Stack Build */
9762
9763/* Field Control bitmask field list for Query Next Image Request */
9764#define ZBEE_ZCL_OTA_QUERY_NEXT_IMAGE_REQ_FIELD_CTRL_HW_VER_PRESENT0x01 0x01 /* bit 0 */
9765#define ZBEE_ZCL_OTA_QUERY_NEXT_IMAGE_REQ_FIELD_CTRL_RESERVED0xfe 0xfe /* bit 1-7 */
9766
9767/* Field Control bitmask field list for Image Block Request */
9768#define ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT0x01 0x01 /* bit 0 - Request node IEEE address Present */
9769#define ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_MIN_BLOCK_PERIOD_PRESENT0x02 0x02 /* bit 1 - Minimum block period Present */
9770#define ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_RESERVED0xfc 0xfc /* bit 2-7 */
9771
9772/* Field Control bitmask field list for Image Page Request */
9773#define ZBEE_ZCL_OTA_IMAGE_PAGE_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT0x01 0x01 /* bit 0 - Request node IEEE address Present */
9774#define ZBEE_ZCL_OTA_IMAGE_PAGE_REQ_FIELD_CTRL_RESERVED0xfe 0xfe /* bit 1-7 */
9775
9776/* OTA Time */
9777#define ZBEE_ZCL_OTA_TIME_NOW0x00000000 0x00000000 /* Now */
9778#define ZBEE_ZCL_OTA_TIME_UTC_LO0x00000001 0x00000001 /* UTC Low Boundary */
9779#define ZBEE_ZCL_OTA_TIME_UTC_HI0xfffffffe 0xfffffffe /* UTC High Boundary */
9780#define ZBEE_ZCL_OTA_TIME_WAIT0xffffffff 0xffffffff /* Wait for a Upgrade command (not used for RequestTime) */
9781
9782/*************************/
9783/* Function Declarations */
9784/*************************/
9785
9786void proto_register_zbee_zcl_ota(void);
9787void proto_reg_handoff_zbee_zcl_ota(void);
9788
9789/*************************/
9790/* Global Variables */
9791/*************************/
9792/* Initialize the protocol and registered fields */
9793static int proto_zbee_zcl_ota;
9794
9795static int hf_zbee_zcl_ota_attr_id;
9796static int hf_zbee_zcl_ota_srv_tx_cmd_id;
9797static int hf_zbee_zcl_ota_srv_rx_cmd_id;
9798static int hf_zbee_zcl_ota_image_upgrade_status;
9799static int hf_zbee_zcl_ota_zb_stack_ver;
9800static int hf_zbee_zcl_ota_file_offset;
9801static int hf_zbee_zcl_ota_payload_type;
9802static int hf_zbee_zcl_ota_query_jitter;
9803static int hf_zbee_zcl_ota_manufacturer_code;
9804static int hf_zbee_zcl_ota_image_type;
9805static int hf_zbee_zcl_ota_file_version;
9806static int hf_zbee_zcl_ota_file_version_appl_release;
9807static int hf_zbee_zcl_ota_file_version_appl_build;
9808static int hf_zbee_zcl_ota_file_version_stack_release;
9809static int hf_zbee_zcl_ota_file_version_stack_build;
9810static int hf_zbee_zcl_ota_query_next_image_req_field_ctrl;
9811static int hf_zbee_zcl_ota_query_next_image_req_field_ctrl_hw_ver_present;
9812static int hf_zbee_zcl_ota_query_next_image_req_field_ctrl_reserved;
9813static int hf_zbee_zcl_ota_image_block_req_field_ctrl;
9814static int hf_zbee_zcl_ota_image_block_req_field_ctrl_ieee_addr_present;
9815static int hf_zbee_zcl_ota_image_block_req_field_ctrl_min_block_period_present;
9816static int hf_zbee_zcl_ota_image_block_req_field_ctrl_reserved;
9817static int hf_zbee_zcl_ota_image_page_req_field_ctrl;
9818static int hf_zbee_zcl_ota_image_page_req_field_ctrl_ieee_addr_present;
9819static int hf_zbee_zcl_ota_image_page_req_field_ctrl_reserved;
9820static int hf_zbee_zcl_ota_hw_version;
9821static int hf_zbee_zcl_ota_status;
9822static int hf_zbee_zcl_ota_image_size;
9823static int hf_zbee_zcl_ota_max_data_size;
9824static int hf_zbee_zcl_ota_min_block_period;
9825static int hf_zbee_zcl_ota_req_node_addr;
9826static int hf_zbee_zcl_ota_current_time;
9827static int hf_zbee_zcl_ota_request_time_offset;
9828static int hf_zbee_zcl_ota_request_time_utc;
9829static int hf_zbee_zcl_ota_upgrade_time;
9830static int hf_zbee_zcl_ota_upgrade_time_utc;
9831static int hf_zbee_zcl_ota_data_size;
9832static int hf_zbee_zcl_ota_image_data;
9833static int hf_zbee_zcl_ota_page_size;
9834static int hf_zbee_zcl_ota_rsp_spacing;
9835
9836/* Initialize the subtree pointers */
9837static int ett_zbee_zcl_ota;
9838static int ett_zbee_zcl_ota_query_next_image_req_field_ctrl;
9839static int ett_zbee_zcl_ota_image_block_req_field_ctrl;
9840static int ett_zbee_zcl_ota_image_page_req_field_ctrl;
9841static int ett_zbee_zcl_ota_file_version;
9842
9843/* Attributes */
9844static const value_string zbee_zcl_ota_attr_names[] = {
9845 { ZBEE_ZCL_ATTR_ID_OTA_UPGRADE_SERVER_ID0x0000, "Upgrade Server ID" },
9846 { ZBEE_ZCL_ATTR_ID_OTA_FILE_OFFSET0x0001, "File Offset" },
9847 { ZBEE_ZCL_ATTR_ID_OTA_CURRENT_FILE_VERSION0x0002, "Current File Version" },
9848 { ZBEE_ZCL_ATTR_ID_OTA_CURRENT_ZB_STACK_VERSION0x0003, "Current ZigBee Stack Version" },
9849 { ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_FILE_VERSION0x0004, "Downloaded File Version" },
9850 { ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_ZB_STACK_VERSION0x0005, "Downloaded ZigBee Stack Version" },
9851 { ZBEE_ZCL_ATTR_ID_OTA_IMAGE_UPGRADE_STATUS0x0006, "Image Upgrade Status" },
9852 { ZBEE_ZCL_ATTR_ID_OTA_MANUFACTURER_ID0x0007, "Manufacturer ID" },
9853 { ZBEE_ZCL_ATTR_ID_OTA_IMAGE_TYPE_ID0x0008, "Image Type ID" },
9854 { ZBEE_ZCL_ATTR_ID_OTA_MIN_BLOCK_REQ_DELAY0x0009, "Minimum Block Request Delay" },
9855 { 0, NULL((void*)0) }
9856};
9857
9858/* Server Commands Received */
9859static const value_string zbee_zcl_ota_srv_rx_cmd_names[] = {
9860 { ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_REQ0x01, "Query Next Image Request" },
9861 { ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_REQ0x03, "Image Block Request" },
9862 { ZBEE_ZCL_CMD_ID_OTA_IMAGE_PAGE_REQ0x04, "Image Page Request" },
9863 { ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_REQ0x06, "Upgrade End Request" },
9864 { ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_REQ0x08, "Query Specific File Request" },
9865 { 0, NULL((void*)0) }
9866};
9867
9868/* Server Commands Generated */
9869static const value_string zbee_zcl_ota_srv_tx_cmd_names[] = {
9870 { ZBEE_ZCL_CMD_ID_OTA_IMAGE_NOTIFY0x00, "Image Notify" },
9871 { ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_RSP0x02, "Query Next Image Response" },
9872 { ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_RSP0x05, "Image Block Response" },
9873 { ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_RSP0x07, "Upgrade End Response" },
9874 { ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_RSP0x09, "Query Specific File Response" },
9875 { 0, NULL((void*)0) }
9876};
9877
9878/* Payload Type */
9879static const value_string zbee_zcl_ota_paylaod_type_names[] = {
9880 { ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ0x00, "Query Jitter" },
9881 { ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC0x01, "Query Jitter and Manufacturer Code" },
9882 { ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT0x02, "Query Jitter, Manufacturer Code and Image Type" },
9883 { ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT_FV0x03, "Query Jitter, Manufacturer Code, Image Type and File Version" },
9884 { 0, NULL((void*)0) }
9885};
9886
9887/* Image Upgrade Status */
9888static const value_string zbee_zcl_ota_image_upgrade_attr_status_names[] = {
9889 { ZBEE_ZCL_OTA_STATUS_NORMAL0x00, "Normal" },
9890 { ZBEE_ZCL_OTA_STATUS_DOWNLOAD_IN_PROGRESS0x01, "Download in progress" },
9891 { ZBEE_ZCL_OTA_STATUS_DOWNLOAD_COMPLETE0x02, "Download complete" },
9892 { ZBEE_ZCL_OTA_STATUS_WAITING_TO_UPGRADE0x03, "Waiting to upgrade" },
9893 { ZBEE_ZCL_OTA_STATUS_COUNT_DOWN0x04, "Count down" },
9894 { ZBEE_ZCL_OTA_STATUS_WAIT_FOR_MORE0x05, "Wait for more" },
9895 { 0, NULL((void*)0) }
9896};
9897
9898/* ZigBee Stack Version */
9899static const range_string zbee_zcl_ota_zb_stack_ver_names[] = {
9900 { ZBEE_ZCL_OTA_ZB_STACK_VER_20060x0000, ZBEE_ZCL_OTA_ZB_STACK_VER_20060x0000, "ZigBee 2006" },
9901 { ZBEE_ZCL_OTA_ZB_STACK_VER_20070x0001, ZBEE_ZCL_OTA_ZB_STACK_VER_20070x0001, "ZigBee 2007" },
9902 { ZBEE_ZCL_OTA_ZB_STACK_VER_PRO0x0002, ZBEE_ZCL_OTA_ZB_STACK_VER_PRO0x0002, "ZigBee Pro" },
9903 { ZBEE_ZCL_OTA_ZB_STACK_VER_IP0x0003, ZBEE_ZCL_OTA_ZB_STACK_VER_IP0x0003, "ZigBee IP" },
9904 { ZBEE_ZCL_OTA_ZB_STACK_VER_RESERVED_LO0x0004, ZBEE_ZCL_OTA_ZB_STACK_VER_RESERVED_HI0xffff, "Reserved" },
9905 { 0, 0, NULL((void*)0) },
9906};
9907
9908/* Image Type */
9909static const range_string zbee_zcl_ota_image_type_names[] = {
9910 {ZBEE_ZCL_OTA_IMG_TYPE_MFR_LOW0x0000, ZBEE_ZCL_OTA_IMG_TYPE_MFR_HIGH0xffbf, "Manufacturer Specific" },
9911 {ZBEE_ZCL_OTA_IMG_TYPE_SECURITY0xffc0, ZBEE_ZCL_OTA_IMG_TYPE_SECURITY0xffc0, "Security Credential" },
9912 {ZBEE_ZCL_OTA_IMG_TYPE_CONFIG0xffc1, ZBEE_ZCL_OTA_IMG_TYPE_CONFIG0xffc1, "Configuration" },
9913 {ZBEE_ZCL_OTA_IMG_TYPE_LOG0xffc2, ZBEE_ZCL_OTA_IMG_TYPE_LOG0xffc2, "Log" },
9914 {ZBEE_ZCL_OTA_IMG_TYPE_UNASSIGNED_LOW0xffc3, ZBEE_ZCL_OTA_IMG_TYPE_UNASSIGNED_HIGH0xfffe, "Reserved: Unassigned" },
9915 {ZBEE_ZCL_OTA_IMG_TYPE_WILD_CARD0xffff, ZBEE_ZCL_OTA_IMG_TYPE_WILD_CARD0xffff, "Reserved: Wild Card" },
9916 { 0, 0, NULL((void*)0) }
9917};
9918
9919/**
9920 * This table matches a Zigbee time value of 0x00000000, which means
9921 * "now" in some contexts.
9922 */
9923const time_value_string now_strings[] = {
9924 { NSTIME_INIT_ZBEE(0x00000000){((uint32_t)(0x00000000)) + ((3*365 + 366)*7 + 2*365)*24*3600UL
, 0}
, "Now" },
9925 { NSTIME_INIT_ZERO{0, 0}, NULL((void*)0) }
9926};
9927
9928static const time_value_string upgrade_time_utc_strings[] = {
9929 { NSTIME_INIT_ZBEE(ZBEE_ZCL_OTA_TIME_WAIT){((uint32_t)(0xffffffff)) + ((3*365 + 366)*7 + 2*365)*24*3600UL
, 0}
, "Wait for upgrade command" },
9930 { NSTIME_INIT_ZERO{0, 0}, NULL((void*)0) }
9931};
9932
9933/*************************/
9934/* Function Bodies */
9935/*************************/
9936
9937/*FUNCTION:------------------------------------------------------
9938 * NAME
9939 * decode_zcl_ota_req_time
9940 * DESCRIPTION
9941 * this function decode the request time field
9942 * PARAMETERS
9943 * RETURNS
9944 * none
9945 *---------------------------------------------------------------
9946 */
9947static void
9948decode_zcl_ota_req_time(char *s, uint32_t value)
9949{
9950 if (value == ZBEE_ZCL_OTA_TIME_WAIT0xffffffff) {
9951 snprintf(s, ITEM_LABEL_LENGTH240, "Wrong Value");
9952 }
9953 else {
9954 /* offset from now */
9955 char *tmp = signed_time_secs_to_str(NULL((void*)0), value);
9956 snprintf(s, ITEM_LABEL_LENGTH240, "%s from now", tmp);
9957 wmem_free(NULL((void*)0), tmp);
9958 }
9959
9960 return;
9961} /*decode_zcl_ota_req_time*/
9962
9963/*FUNCTION:------------------------------------------------------
9964 * NAME
9965 * decode_zcl_ota_upgr_time
9966 * DESCRIPTION
9967 * this function decode the upgrade time field
9968 * PARAMETERS
9969 * RETURNS
9970 * none
9971 *---------------------------------------------------------------
9972 */
9973static void
9974decode_zcl_ota_upgr_time(char *s, uint32_t value)
9975{
9976 if (value == ZBEE_ZCL_OTA_TIME_WAIT0xffffffff) {
9977 snprintf(s, ITEM_LABEL_LENGTH240, "Wait for upgrade command");
9978 }
9979 else {
9980 /* offset from now */
9981 char *tmp = signed_time_secs_to_str(NULL((void*)0), value);
9982 snprintf(s, ITEM_LABEL_LENGTH240, "%s from now", tmp);
9983 wmem_free(NULL((void*)0), tmp);
9984 }
9985
9986 return;
9987} /*decode_zcl_ota_upgr_time*/
9988
9989/*FUNCTION:------------------------------------------------------
9990 * NAME
9991 * decode_zcl_ota_size_in_bytes
9992 * DESCRIPTION
9993 * this function decodes size in bytes
9994 * PARAMETERS
9995 * RETURNS
9996 * none
9997 *---------------------------------------------------------------
9998 */
9999static void
10000decode_zcl_ota_size_in_bytes(char *s, uint32_t value)
10001{
10002 snprintf(s, ITEM_LABEL_LENGTH240, "%d [Bytes]", value);
10003} /*decode_zcl_ota_size_in_bytes*/
10004
10005/*FUNCTION:------------------------------------------------------
10006 * NAME
10007 * dissect_zcl_ota_file_version_field
10008 * DESCRIPTION
10009 * this function is called in order to decode "FileVersion" field,
10010 * PARAMETERS
10011 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10012 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10013 * unsigned *offset - pointer to buffer offset
10014 * RETURNS
10015 * none
10016 *---------------------------------------------------------------
10017 */
10018static void
10019dissect_zcl_ota_file_version_field(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10020{
10021 static int * const file_version[] = {
10022 &hf_zbee_zcl_ota_file_version_appl_release,
10023 &hf_zbee_zcl_ota_file_version_appl_build,
10024 &hf_zbee_zcl_ota_file_version_stack_release,
10025 &hf_zbee_zcl_ota_file_version_stack_build,
10026 NULL((void*)0)
10027 };
10028
10029 /* 'File Version' field present, retrieves it */
10030 /* File version is Little endian. as well as all ZigBee data structures:
10031 "The endianness used in each data field shall be little endian in order
10032 to be compliant with general ZigBee messages."
10033 File version A: 0x10053519 represents application release 1.0 build 05 with stack release 3.5 b19
10034 */
10035 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_ota_file_version, ett_zbee_zcl_ota_file_version, file_version, ENC_LITTLE_ENDIAN0x80000000);
10036 *offset += 4;
10037} /*dissect_zcl_ota_file_version_field*/
10038
10039/*FUNCTION:------------------------------------------------------
10040 * NAME
10041 * dissect_zcl_ota_field_ctrl_field
10042 * DESCRIPTION
10043 * this function is called in order to decode "FileVersion" field,
10044 * PARAMETERS
10045 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10046 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10047 * unsigned *offset - pointer to buffer offset
10048 * int hf_hdr - hf_hdr
10049 * int ett - ett subtree index
10050 * int* const *fields - fields an array of pointers to int that lists all the fields of the bitmask
10051 * RETURNS
10052 * uint8_t - field ctrl value
10053 *---------------------------------------------------------------
10054 */
10055static uint8_t
10056dissect_zcl_ota_field_ctrl_field(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, int hf_hdr, int ett, int * const *fields)
10057{
10058 uint8_t field;
10059
10060 /* Retrieve 'Field Control' field */
10061 field = tvb_get_uint8(tvb, *offset);
10062 proto_tree_add_bitmask(tree, tvb, *offset, hf_hdr, ett, fields, ENC_NA0x00000000);
10063 *offset += 1;
10064
10065 return field;
10066} /*dissect_zcl_ota_field_ctrl_field*/
10067
10068/*FUNCTION:------------------------------------------------------
10069 * NAME
10070 * dissect_zcl_ota_imagenotify
10071 * DESCRIPTION
10072 * this function is called in order to decode "ImageNotify",
10073 * PARAMETERS
10074 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10075 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10076 * unsigned *offset - pointer to buffer offset
10077 * RETURNS
10078 * none
10079 *---------------------------------------------------------------
10080 */
10081static void
10082dissect_zcl_ota_imagenotify(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10083{
10084 uint8_t payload_type;
10085
10086 /* Retrieve 'Payload type' field */
10087 payload_type = tvb_get_uint8(tvb, *offset);
10088 proto_tree_add_item(tree, hf_zbee_zcl_ota_payload_type, tvb, *offset, 1, ENC_NA0x00000000);
10089 *offset += 1;
10090
10091 /* Retrieve 'Query Jitter' field */
10092 proto_tree_add_item(tree, hf_zbee_zcl_ota_query_jitter, tvb, *offset, 1, ENC_NA0x00000000);
10093 *offset += 1;
10094
10095 /* Check if there are optional fields */
10096
10097 if (payload_type >= ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC0x01) {
10098 /* 'Manufacturer Code' field present, retrieves it */
10099 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10100 *offset += 2;
10101 }
10102
10103 if (payload_type >= ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT0x02) {
10104 /* 'Image Type' field present, retrieves it */
10105 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10106 *offset += 2;
10107 }
10108
10109 if (payload_type >= ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT_FV0x03) {
10110 /* 'File Version' field present, retrieves it */
10111 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10112 }
10113
10114} /*dissect_zcl_ota_imagenotify*/
10115
10116/*FUNCTION:------------------------------------------------------
10117 * NAME
10118 * dissect_zcl_ota_querynextimagereq
10119 * DESCRIPTION
10120 * this function is called in order to decode "QueryNextImageRequest",
10121 * PARAMETERS
10122 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10123 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10124 * unsigned *offset - pointer to buffer offset
10125 * RETURNS
10126 * none
10127 *---------------------------------------------------------------
10128 */
10129static void
10130dissect_zcl_ota_querynextimagereq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10131{
10132 static int * const fields[] = {
10133 &hf_zbee_zcl_ota_query_next_image_req_field_ctrl_hw_ver_present,
10134 &hf_zbee_zcl_ota_query_next_image_req_field_ctrl_reserved,
10135 NULL((void*)0)
10136 };
10137
10138 uint8_t field_ctrl;
10139
10140 /* Retrieve 'Field Control' field */
10141 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);
10142
10143 /* Retrieve 'Manufacturer Code' field */
10144 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10145 *offset += 2;
10146
10147 /* Retrieve 'Image Type' field */
10148 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10149 *offset += 2;
10150
10151 /* Retrieve 'File Version' field */
10152 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10153
10154 /* Check if there are optional fields */
10155 if (field_ctrl & ZBEE_ZCL_OTA_QUERY_NEXT_IMAGE_REQ_FIELD_CTRL_HW_VER_PRESENT0x01) {
10156 /* 'Hardware Version' field present, retrieves it */
10157 proto_tree_add_item(tree, hf_zbee_zcl_ota_hw_version, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10158 *offset += 2;
10159 }
10160} /*dissect_zcl_ota_querynextimagereq*/
10161
10162/*FUNCTION:------------------------------------------------------
10163 * NAME
10164 * dissect_zcl_ota_querynextimagersp
10165 * DESCRIPTION
10166 * this function is called in order to decode "QueryNextImageResponse",
10167 * PARAMETERS
10168 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10169 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10170 * unsigned *offset - pointer to buffer offset
10171 * RETURNS
10172 * none
10173 *---------------------------------------------------------------
10174 */
10175static void
10176dissect_zcl_ota_querynextimagersp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10177{
10178 uint8_t status;
10179
10180 /* Retrieve 'Status' field */
10181 status = tvb_get_uint8(tvb, *offset);
10182 proto_tree_add_item(tree, hf_zbee_zcl_ota_status, tvb, *offset, 1, ENC_NA0x00000000);
10183 *offset += 1;
10184
10185 /* Check if there are optional fields */
10186 if (status == ZBEE_ZCL_STAT_SUCCESS0x00) {
10187 /* Retrieve 'Manufacturer Code' field */
10188 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10189 *offset += 2;
10190
10191 /* Retrieve 'Image Type' field */
10192 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10193 *offset += 2;
10194
10195 /* Retrieve 'File Version' field */
10196 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10197
10198 /* Retrieve 'Image Size' field */
10199 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_size, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
10200 *offset += 4;
10201 }
10202
10203} /*dissect_zcl_ota_querynextimagersp*/
10204
10205/*FUNCTION:------------------------------------------------------
10206 * NAME
10207 * dissect_zcl_ota_imageblockreq
10208 * DESCRIPTION
10209 * this function is called in order to decode "ImageBlockRequest",
10210 * PARAMETERS
10211 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10212 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10213 * unsigned *offset - pointer to buffer offset
10214 * RETURNS
10215 * none
10216 *---------------------------------------------------------------
10217 */
10218static void
10219dissect_zcl_ota_imageblockreq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10220{
10221 static int * const fields[] = {
10222 &hf_zbee_zcl_ota_image_block_req_field_ctrl_ieee_addr_present,
10223 &hf_zbee_zcl_ota_image_block_req_field_ctrl_min_block_period_present,
10224 &hf_zbee_zcl_ota_image_block_req_field_ctrl_reserved,
10225 NULL((void*)0)
10226 };
10227
10228 uint8_t field_ctrl;
10229
10230 /* Retrieve 'Field Control' field */
10231 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);
10232
10233 /* Retrieve 'Manufacturer Code' field */
10234 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10235 *offset += 2;
10236
10237 /* Retrieve 'Image Type' field */
10238 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10239 *offset += 2;
10240
10241 /* Retrieve 'File Version' field */
10242 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10243
10244 /* Retrieve 'File Offset' field */
10245 proto_tree_add_item(tree, hf_zbee_zcl_ota_file_offset, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
10246 *offset += 4;
10247
10248 /* Retrieve 'Maximum Data Size' field */
10249 proto_tree_add_item(tree, hf_zbee_zcl_ota_max_data_size, tvb, *offset, 1, ENC_NA0x00000000);
10250 *offset += 1;
10251
10252 /* Check if there are optional fields */
10253 if (field_ctrl & ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT0x01) {
10254 /* 'Request Node Address' field present, retrieve it */
10255 proto_tree_add_item(tree, hf_zbee_zcl_ota_req_node_addr, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
10256 *offset += 8;
10257 }
10258 if (field_ctrl & ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_MIN_BLOCK_PERIOD_PRESENT0x02) {
10259 /* 'Minimum Block Period' field present, retrieve it */
10260 proto_tree_add_item(tree, hf_zbee_zcl_ota_min_block_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10261 *offset += 2;
10262 }
10263} /*dissect_zcl_ota_imageblockreq*/
10264
10265/*FUNCTION:------------------------------------------------------
10266 * NAME
10267 * dissect_zcl_ota_imagepagereq
10268 * DESCRIPTION
10269 * this function is called in order to decode "ImagePageRequest",
10270 * PARAMETERS
10271 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10272 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10273 * unsigned *offset - pointer to buffer offset
10274 * RETURNS
10275 * none
10276 *---------------------------------------------------------------
10277 */
10278static void
10279dissect_zcl_ota_imagepagereq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10280{
10281 static int * const fields[] = {
10282 &hf_zbee_zcl_ota_image_page_req_field_ctrl_ieee_addr_present,
10283 &hf_zbee_zcl_ota_image_page_req_field_ctrl_reserved,
10284 NULL((void*)0)
10285 };
10286
10287 uint8_t field_ctrl;
10288
10289 /* Retrieve 'Field Control' field */
10290 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);
10291
10292 /* Retrieve 'Manufacturer Code' field */
10293 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10294 *offset += 2;
10295
10296 /* Retrieve 'Image Type' field */
10297 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10298 *offset += 2;
10299
10300 /* Retrieve 'File Version' field */
10301 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10302
10303 /* Retrieve 'File Offset' field */
10304 proto_tree_add_item(tree, hf_zbee_zcl_ota_file_offset, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
10305 *offset += 4;
10306
10307 /* Retrieve 'Maximum Data Size' field */
10308 proto_tree_add_item(tree, hf_zbee_zcl_ota_max_data_size, tvb, *offset, 1, ENC_NA0x00000000);
10309 *offset += 1;
10310
10311 /* Retrieve 'Page Size' field */
10312 proto_tree_add_item(tree, hf_zbee_zcl_ota_page_size, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10313 *offset += 2;
10314
10315 /* Retrieve 'Response Spacing' field */
10316 proto_tree_add_item(tree, hf_zbee_zcl_ota_rsp_spacing, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10317 *offset += 2;
10318
10319 /* Check if there are optional fields */
10320 if (field_ctrl & ZBEE_ZCL_OTA_IMAGE_PAGE_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT0x01) {
10321 /* 'Request Node Address' field present, retrieves it */
10322 proto_tree_add_item(tree, hf_zbee_zcl_ota_req_node_addr, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
10323 *offset += 8;
10324 }
10325} /*dissect_zcl_ota_imagepagereq*/
10326
10327/*FUNCTION:------------------------------------------------------
10328 * NAME
10329 * dissect_zcl_ota_imageblockrsp
10330 * DESCRIPTION
10331 * this function is called in order to decode "ImageBlockResponse",
10332 * PARAMETERS
10333 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10334 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10335 * unsigned *offset - pointer to buffer offset
10336 * RETURNS
10337 * none
10338 *---------------------------------------------------------------
10339 */
10340static void
10341dissect_zcl_ota_imageblockrsp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10342{
10343 uint8_t status;
10344 uint8_t data_size;
10345
10346 /* Retrieve 'Status' field */
10347 status = tvb_get_uint8(tvb, *offset);
10348 proto_tree_add_item(tree, hf_zbee_zcl_ota_status, tvb, *offset, 1, ENC_NA0x00000000);
10349 *offset += 1;
10350
10351 if (status == ZBEE_ZCL_STAT_SUCCESS0x00) {
10352 /* Retrieve 'Manufacturer Code' field */
10353 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10354 *offset += 2;
10355
10356 /* Retrieve 'Image Type' field */
10357 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10358 *offset += 2;
10359
10360 /* Retrieve 'File Version' field */
10361 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10362
10363 /* Retrieve 'File Offset' field */
10364 proto_tree_add_item(tree, hf_zbee_zcl_ota_file_offset, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
10365 *offset += 4;
10366
10367 /* Retrieve 'Data Size' field */
10368 data_size = tvb_get_uint8(tvb, *offset);
10369 proto_tree_add_item(tree, hf_zbee_zcl_ota_data_size, tvb, *offset, 1, ENC_NA0x00000000);
10370 *offset += 1;
10371
10372 /* Retrieve 'Image Data' field */
10373 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_data, tvb, *offset, data_size, ENC_NA0x00000000);
10374 *offset += data_size;
10375 }
10376 else if (status == ZBEE_ZCL_STAT_OTA_WAIT_FOR_DATA0x97) {
10377 /* If 'Current Time' is zero, 'Request Time' is an offset from now;
10378 * if it's non-zero, 'Request Time' is UTC.
10379 */
10380 uint32_t current_time;
10381
10382 /* Retrieve 'Current Time' field */
10383 proto_tree_add_item(tree, hf_zbee_zcl_ota_current_time, tvb, *offset, 4, ENC_TIME_ZBEE_ZCL0x00000032|ENC_LITTLE_ENDIAN0x80000000);
10384 current_time = tvb_get_letohl(tvb, *offset);
10385 *offset += 4;
10386
10387 /* Retrieve 'Request Time' field */
10388 if (current_time == 0) {
10389 /* Request Time is offset time from now */
10390 proto_tree_add_item(tree, hf_zbee_zcl_ota_request_time_offset, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
10391 } else {
10392 /* Request Time is UTC time */
10393 proto_tree_add_item(tree, hf_zbee_zcl_ota_request_time_utc, tvb, *offset, 4, ENC_TIME_ZBEE_ZCL0x00000032|ENC_LITTLE_ENDIAN0x80000000);
10394 /* XXX - compute delta between Request Time and Current Time
10395 * and display as offset time from now?
10396 */
10397 }
10398 *offset += 4;
10399 }
10400 else {
10401 /* */
10402 }
10403
10404} /*dissect_zcl_ota_imageblockrsp*/
10405
10406/*FUNCTION:------------------------------------------------------
10407 * NAME
10408 * dissect_zcl_ota_upgradeendreq
10409 * DESCRIPTION
10410 * this function is called in order to decode "UpgradeEndRequest",
10411 * PARAMETERS
10412 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10413 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10414 * unsigned *offset - pointer to buffer offset
10415 * RETURNS
10416 * none
10417 *---------------------------------------------------------------
10418 */
10419static void
10420dissect_zcl_ota_upgradeendreq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10421{
10422 /* Retrieve 'Status' field */
10423 proto_tree_add_item(tree, hf_zbee_zcl_ota_status, tvb, *offset, 1, ENC_NA0x00000000);
10424 *offset += 1;
10425
10426 /* Retrieve 'Manufacturer Code' field */
10427 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10428 *offset += 2;
10429
10430 /* Retrieve 'Image Type' field */
10431 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10432 *offset += 2;
10433
10434 /* Retrieve 'File Version' field */
10435 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10436
10437} /*dissect_zcl_ota_upgradeendreq*/
10438
10439/*FUNCTION:------------------------------------------------------
10440 * NAME
10441 * dissect_zcl_ota_upgradeendrsp
10442 * DESCRIPTION
10443 * this function is called in order to decode "UpgradeEndResponse",
10444 * PARAMETERS
10445 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10446 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10447 * unsigned *offset - pointer to buffer offset
10448 * RETURNS
10449 * none
10450 *---------------------------------------------------------------
10451 */
10452static void
10453dissect_zcl_ota_upgradeendrsp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10454{
10455 uint32_t current_time = 0;
10456
10457 /* Retrieve 'Manufacturer Code' field */
10458 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10459 *offset += 2;
10460
10461 /* Retrieve 'Image Type' field */
10462 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10463 *offset += 2;
10464
10465 /* Retrieve 'File Version' field */
10466 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10467
10468 /* Retrieve 'Current Time' field */
10469 proto_tree_add_item(tree, hf_zbee_zcl_ota_current_time, tvb, *offset, 4, ENC_TIME_ZBEE_ZCL0x00000032|ENC_LITTLE_ENDIAN0x80000000);
10470 current_time = tvb_get_letohl(tvb, *offset);
10471 *offset += 4;
10472
10473 /* Retrieve 'Upgrade Time' field */
10474 if (current_time == 0)
10475 {
10476 /* Upgrade Time is offset time from now */
10477 proto_tree_add_item(tree, hf_zbee_zcl_ota_upgrade_time, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
10478 }
10479 else
10480 {
10481 /* Upgrade Time is UTC time */
10482 proto_tree_add_item(tree, hf_zbee_zcl_ota_upgrade_time_utc, tvb, *offset, 4, ENC_TIME_ZBEE_ZCL0x00000032|ENC_LITTLE_ENDIAN0x80000000);
10483 }
10484 *offset += 4;
10485
10486} /*dissect_zcl_ota_upgradeendrsp*/
10487
10488/*FUNCTION:------------------------------------------------------
10489 * NAME
10490 * dissect_zcl_ota_queryspecfilereq
10491 * DESCRIPTION
10492 * this function is called in order to decode "QuerySpecificFileRequest",
10493 * PARAMETERS
10494 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10495 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10496 * unsigned *offset - pointer to buffer offset
10497 * RETURNS
10498 * none
10499 *---------------------------------------------------------------
10500 */
10501static void
10502dissect_zcl_ota_queryspecfilereq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10503{
10504 /* 'Request Node Address' field present, retrieves it */
10505 proto_tree_add_item(tree, hf_zbee_zcl_ota_req_node_addr, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
10506 *offset += 8;
10507
10508 /* Retrieve 'Manufacturer Code' field */
10509 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10510 *offset += 2;
10511
10512 /* Retrieve 'Image Type' field */
10513 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10514 *offset += 2;
10515
10516 /* Retrieve 'File Version' field */
10517 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10518
10519 /* Retrieve 'ZigBee Stack Version' field */
10520 proto_tree_add_item(tree, hf_zbee_zcl_ota_zb_stack_ver, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10521 *offset += 2;
10522
10523} /*dissect_zcl_ota_queryspecfilereq*/
10524
10525/*FUNCTION:------------------------------------------------------
10526 * NAME
10527 * dissect_zcl_ota_queryspecfilersp
10528 * DESCRIPTION
10529 * this function is called in order to decode "QuerySpecificFileResponse",
10530 * PARAMETERS
10531 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10532 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10533 * unsigned *offset - pointer to buffer offset
10534 * RETURNS
10535 * none
10536 *---------------------------------------------------------------
10537 */
10538static void
10539dissect_zcl_ota_queryspecfilersp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
10540{
10541 uint8_t status;
10542
10543 /* Retrieve 'Status' field */
10544 status = tvb_get_uint8(tvb, *offset);
10545 proto_tree_add_item(tree, hf_zbee_zcl_ota_status, tvb, *offset, 1, ENC_NA0x00000000);
10546 *offset += 1;
10547
10548 if (status == ZBEE_ZCL_STAT_SUCCESS0x00) {
10549 /* Retrieve 'Manufacturer Code' field */
10550 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10551 *offset += 2;
10552
10553 /* Retrieve 'Image Type' field */
10554 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10555 *offset += 2;
10556
10557 /* Retrieve 'File Version' field */
10558 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10559
10560 /* Retrieve 'Image Size' field */
10561 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_size, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
10562 *offset += 4;
10563 }
10564
10565} /*dissect_zcl_ota_queryspecfilersp*/
10566
10567
10568/*FUNCTION:------------------------------------------------------
10569 * NAME
10570 * dissect_zcl_ota_attr_data
10571 * DESCRIPTION
10572 * this function is called by ZCL foundation dissector in order to decode
10573 * specific cluster attributes data.
10574 * PARAMETERS
10575 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10576 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10577 * unsigned *offset - pointer to buffer offset
10578 * uint16_t attr_id - attribute identifier
10579 * unsigned data_type - attribute data type
10580 * bool client_attr- ZCL client
10581 * RETURNS
10582 * none
10583 *---------------------------------------------------------------
10584 */
10585static void
10586dissect_zcl_ota_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
10587{
10588 /* Dissect attribute data type and data */
10589 switch ( attr_id )
10590 {
10591 case ZBEE_ZCL_ATTR_ID_OTA_CURRENT_FILE_VERSION0x0002:
10592 case ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_FILE_VERSION0x0004:
10593 dissect_zcl_ota_file_version_field(tvb, tree, offset);
10594 break;
10595
10596 case ZBEE_ZCL_ATTR_ID_OTA_CURRENT_ZB_STACK_VERSION0x0003:
10597 case ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_ZB_STACK_VERSION0x0005:
10598 proto_tree_add_item(tree, hf_zbee_zcl_ota_zb_stack_ver, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10599 *offset += 2;
10600 break;
10601
10602 case ZBEE_ZCL_ATTR_ID_OTA_IMAGE_UPGRADE_STATUS0x0006:
10603 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_upgrade_status, tvb, *offset, 1, ENC_NA0x00000000);
10604 *offset += 1;
10605 break;
10606
10607 case ZBEE_ZCL_ATTR_ID_OTA_MANUFACTURER_ID0x0007:
10608 proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10609 *offset += 2;
10610 break;
10611
10612 case ZBEE_ZCL_ATTR_ID_OTA_IMAGE_TYPE_ID0x0008:
10613 proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
10614 *offset += 2;
10615 break;
10616
10617 case ZBEE_ZCL_ATTR_ID_OTA_MIN_BLOCK_REQ_DELAY0x0009:
10618 default:
10619 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
10620 break;
10621 }
10622} /*dissect_zcl_ota_attr_data*/
10623
10624
10625/*FUNCTION:------------------------------------------------------
10626 * NAME
10627 * dissect_zbee_zcl_ota
10628 * DESCRIPTION
10629 * ZigBee ZCL OTA cluster dissector for wireshark.
10630 * PARAMETERS
10631 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10632 * packet_info *pinfo - pointer to packet information fields
10633 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10634 * void *data - pointer to ZCL packet structure.
10635 * RETURNS
10636 * int - length of parsed data.
10637 *---------------------------------------------------------------
10638 */
10639static int
10640dissect_zbee_zcl_ota(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
10641{
10642 proto_tree *payload_tree;
10643 zbee_zcl_packet *zcl;
10644 unsigned offset = 0;
10645 uint8_t cmd_id;
10646 int rem_len;
10647
10648 /* Reject the packet if data is NULL */
10649 if (data == NULL((void*)0))
10650 return 0;
10651 zcl = (zbee_zcl_packet *)data;
10652 cmd_id = zcl->cmd_id;
10653
10654 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
10655 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER0x00) {
10656 /* Append the command name to the info column. */
10657 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
10658 val_to_str_const(cmd_id, zbee_zcl_ota_srv_rx_cmd_names, "Unknown Command"),
10659 zcl->tran_seqno);
10660
10661 /* Add the command ID. */
10662 proto_tree_add_item(tree, hf_zbee_zcl_ota_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
10663
10664 /* Check is this command has a payload, than add the payload tree */
10665 rem_len = tvb_reported_length_remaining(tvb, ++offset);
10666 if (rem_len > 0) {
10667 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_ota, NULL((void*)0), "Payload");
10668
10669 /* Call the appropriate command dissector */
10670 switch (cmd_id) {
10671 case ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_REQ0x01:
10672 dissect_zcl_ota_querynextimagereq(tvb, payload_tree, &offset);
10673 break;
10674
10675 case ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_REQ0x03:
10676 dissect_zcl_ota_imageblockreq(tvb, payload_tree, &offset);
10677 break;
10678
10679 case ZBEE_ZCL_CMD_ID_OTA_IMAGE_PAGE_REQ0x04:
10680 dissect_zcl_ota_imagepagereq(tvb, payload_tree, &offset);
10681 break;
10682
10683 case ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_REQ0x06:
10684 dissect_zcl_ota_upgradeendreq(tvb, payload_tree, &offset);
10685 break;
10686
10687 case ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_REQ0x08:
10688 dissect_zcl_ota_queryspecfilereq(tvb, payload_tree, &offset);
10689 break;
10690
10691 default:
10692 break;
10693 }
10694 }
10695 }
10696 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
10697 /* Append the command name to the info column. */
10698 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
10699 val_to_str_const(cmd_id, zbee_zcl_ota_srv_tx_cmd_names, "Unknown Command"),
10700 zcl->tran_seqno);
10701
10702 /* Add the command ID. */
10703 proto_tree_add_item(tree, hf_zbee_zcl_ota_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
10704
10705 /* Check is this command has a payload, than add the payload tree */
10706 rem_len = tvb_reported_length_remaining(tvb, ++offset);
10707 if (rem_len > 0) {
10708 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_ota, NULL((void*)0), "Payload");
10709
10710 /* Call the appropriate command dissector */
10711 switch (cmd_id) {
10712 case ZBEE_ZCL_CMD_ID_OTA_IMAGE_NOTIFY0x00:
10713 dissect_zcl_ota_imagenotify(tvb, payload_tree, &offset);
10714 break;
10715
10716 case ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_RSP0x02:
10717 dissect_zcl_ota_querynextimagersp(tvb, payload_tree, &offset);
10718 break;
10719
10720 case ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_RSP0x05:
10721 dissect_zcl_ota_imageblockrsp(tvb, payload_tree, &offset);
10722 break;
10723
10724 case ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_RSP0x07:
10725 dissect_zcl_ota_upgradeendrsp(tvb, payload_tree, &offset);
10726 break;
10727
10728 case ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_RSP0x09:
10729 dissect_zcl_ota_queryspecfilersp(tvb, payload_tree, &offset);
10730 break;
10731
10732 default:
10733 break;
10734 }
10735 }
10736 }
10737
10738 return tvb_captured_length(tvb);
10739} /*dissect_zbee_zcl_ota*/
10740
10741/*FUNCTION:------------------------------------------------------
10742 * NAME
10743 * proto_register_zbee_zcl_ota
10744 * DESCRIPTION
10745 * this function is called by ZCL foundation dissector in order to decode
10746 * specific cluster attributes data.
10747 * PARAMETERS
10748 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
10749 * tvbuff_t *tvb - pointer to buffer containing raw packet.
10750 * unsigned *offset - pointer to buffer offset
10751 * uint16_t attr_id - attribute identifier
10752 * unsigned data_type - attribute data type
10753 * RETURNS
10754 * none
10755 *---------------------------------------------------------------
10756 */
10757void proto_register_zbee_zcl_ota(void)
10758{
10759 static hf_register_info hf[] = {
10760
10761 { &hf_zbee_zcl_ota_attr_id,
10762 { "Attribute", "zbee_zcl_general.ota.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_ota_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_ota_attr_names
))))
,
10763 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10764
10765 { &hf_zbee_zcl_ota_srv_tx_cmd_id,
10766 { "Command", "zbee_zcl_general.ota.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ota_srv_tx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_ota_srv_tx_cmd_names
))))
,
10767 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10768
10769 { &hf_zbee_zcl_ota_srv_rx_cmd_id,
10770 { "Command", "zbee_zcl_general.ota.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ota_srv_rx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_ota_srv_rx_cmd_names
))))
,
10771 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10772
10773 { &hf_zbee_zcl_ota_image_upgrade_status,
10774 { "Image Upgrade Status", "zbee_zcl_general.ota.status_attr", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ota_image_upgrade_attr_status_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_ota_image_upgrade_attr_status_names
))))
,
10775 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10776
10777 { &hf_zbee_zcl_ota_zb_stack_ver,
10778 { "ZigBee Stack Version", "zbee_zcl_general.ota.zb_stack.ver", FT_UINT16, BASE_HEX | BASE_RANGE_STRING0x00000100,
10779 RVALS(zbee_zcl_ota_zb_stack_ver_names)((0 ? (const struct _range_string*)0 : ((zbee_zcl_ota_zb_stack_ver_names
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10780
10781 { &hf_zbee_zcl_ota_payload_type,
10782 { "Payload Type", "zbee_zcl_general.ota.payload.type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ota_paylaod_type_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_ota_paylaod_type_names
))))
,
10783 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10784
10785 { &hf_zbee_zcl_ota_query_jitter,
10786 { "Query Jitter", "zbee_zcl_general.ota.query_jitter", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_seconds)((const void *) (size_t) (decode_zcl_time_in_seconds)),
10787 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10788
10789 { &hf_zbee_zcl_ota_manufacturer_code,
10790 { "Manufacturer Code", "zbee_zcl_general.ota.manufacturer_code", FT_UINT16, BASE_HEX, VALS(zbee_mfr_code_names)((0 ? (const struct _value_string*)0 : ((zbee_mfr_code_names)
)))
,
10791 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10792
10793 { &hf_zbee_zcl_ota_image_type,
10794 { "Image Type", "zbee_zcl_general.ota.image.type", FT_UINT16, BASE_HEX | BASE_RANGE_STRING0x00000100,
10795 RVALS(zbee_zcl_ota_image_type_names)((0 ? (const struct _range_string*)0 : ((zbee_zcl_ota_image_type_names
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10796
10797/* Begin FileVersion fields */
10798 { &hf_zbee_zcl_ota_file_version,
10799 { "File Version", "zbee_zcl_general.ota.file.version", FT_UINT32, BASE_HEX, NULL((void*)0),
10800 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10801
10802 { &hf_zbee_zcl_ota_file_version_appl_release,
10803 { "Application Release", "zbee_zcl_general.ota.file.version.appl.release", FT_UINT32, BASE_DEC, NULL((void*)0),
10804 ZBEE_ZCL_OTA_FILE_VERS_APPL_RELEASE0xFF000000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10805
10806 { &hf_zbee_zcl_ota_file_version_appl_build,
10807 { "Application Build", "zbee_zcl_general.ota.file.version.appl.build", FT_UINT32, BASE_DEC, NULL((void*)0),
10808 ZBEE_ZCL_OTA_FILE_VERS_APPL_BUILD0x00FF0000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10809
10810 { &hf_zbee_zcl_ota_file_version_stack_release,
10811 { "Stack Release", "zbee_zcl_general.ota.file.version.stack.release", FT_UINT32, BASE_DEC, NULL((void*)0),
10812 ZBEE_ZCL_OTA_FILE_VERS_STACK_RELEASE0x0000FF00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10813
10814 { &hf_zbee_zcl_ota_file_version_stack_build,
10815 { "Stack Build", "zbee_zcl_general.ota.file.version.stack.build", FT_UINT32, BASE_DEC, NULL((void*)0),
10816 ZBEE_ZCL_OTA_FILE_VERS_STACK_BUILD0x000000FF, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10817/* End FileVersion fields */
10818
10819/* Begin FieldControl fields Query Next Image Request */
10820 { &hf_zbee_zcl_ota_query_next_image_req_field_ctrl,
10821 { "Field Control", "zbee_zcl_general.ota.query_next_image_req.field_ctrl",
10822 FT_UINT8, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10823
10824 { &hf_zbee_zcl_ota_query_next_image_req_field_ctrl_hw_ver_present,
10825 { "Hardware Version", "zbee_zcl_general.ota.query_next_image_req.field_ctrl.hw_ver_present",
10826 FT_BOOLEAN, 8, TFS(&tfs_present_not_present)((0 ? (const struct true_false_string*)0 : ((&tfs_present_not_present
))))
, ZBEE_ZCL_OTA_QUERY_NEXT_IMAGE_REQ_FIELD_CTRL_HW_VER_PRESENT0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10827
10828 { &hf_zbee_zcl_ota_query_next_image_req_field_ctrl_reserved,
10829 { "Reserved", "zbee_zcl_general.ota.query_next_image_req.field_ctrl.reserved", FT_UINT8, BASE_HEX, NULL((void*)0),
10830 ZBEE_ZCL_OTA_QUERY_NEXT_IMAGE_REQ_FIELD_CTRL_RESERVED0xfe, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10831/* End FieldControl fields Query Next Image Request */
10832
10833/* Begin FieldControl fields Image Block Request */
10834 { &hf_zbee_zcl_ota_image_block_req_field_ctrl,
10835 { "Field Control", "zbee_zcl_general.ota.image_block_req.field_ctrl",
10836 FT_UINT8, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10837
10838 { &hf_zbee_zcl_ota_image_block_req_field_ctrl_ieee_addr_present,
10839 { "Request Node Address", "zbee_zcl_general.ota.image_block_req.field_ctrl.request_node_addr_present",
10840 FT_BOOLEAN, 8, TFS(&tfs_present_not_present)((0 ? (const struct true_false_string*)0 : ((&tfs_present_not_present
))))
, ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10841
10842 { &hf_zbee_zcl_ota_image_block_req_field_ctrl_min_block_period_present,
10843 { "Minimum Block Period", "zbee_zcl_general.ota.image_block_req.field_ctrl.min_block_period",
10844 FT_BOOLEAN, 8, TFS(&tfs_present_not_present)((0 ? (const struct true_false_string*)0 : ((&tfs_present_not_present
))))
, ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_MIN_BLOCK_PERIOD_PRESENT0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10845
10846 { &hf_zbee_zcl_ota_image_block_req_field_ctrl_reserved,
10847 { "Reserved", "zbee_zcl_general.ota.query_next_image_req.field_ctrl.reserved", FT_UINT8, BASE_HEX, NULL((void*)0),
10848 ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_RESERVED0xfc, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10849/* End FieldControl fields Image Block Request */
10850
10851/* Begin FieldControl fields Image Page Request */
10852 { &hf_zbee_zcl_ota_image_page_req_field_ctrl,
10853 { "Field Control", "zbee_zcl_general.ota.image_page_req.field_ctrl",
10854 FT_UINT8, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10855
10856 { &hf_zbee_zcl_ota_image_page_req_field_ctrl_ieee_addr_present,
10857 { "Request Node Address", "zbee_zcl_general.ota.query_next_image_req.field_ctrl.request_node_addr_present",
10858 FT_BOOLEAN, 8, TFS(&tfs_present_not_present)((0 ? (const struct true_false_string*)0 : ((&tfs_present_not_present
))))
, ZBEE_ZCL_OTA_IMAGE_PAGE_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10859
10860 { &hf_zbee_zcl_ota_image_page_req_field_ctrl_reserved,
10861 { "Reserved", "zbee_zcl_general.ota.image_page_req.field_ctrl.reserved", FT_UINT8, BASE_HEX, NULL((void*)0),
10862 ZBEE_ZCL_OTA_IMAGE_PAGE_REQ_FIELD_CTRL_RESERVED0xfe, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10863/* End FieldControl fields Image Page Request */
10864
10865 { &hf_zbee_zcl_ota_hw_version,
10866 { "Hardware Version", "zbee_zcl_general.ota.hw_ver", FT_UINT16, BASE_HEX, NULL((void*)0),
10867 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10868
10869 { &hf_zbee_zcl_ota_status,
10870 { "Status", "zbee_zcl_general.ota.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_status_names
))))
,
10871 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10872
10873 { &hf_zbee_zcl_ota_image_size,
10874 { "Image Size", "zbee_zcl_general.ota.image.size", FT_UINT32, BASE_CUSTOM, CF_FUNC(decode_zcl_ota_size_in_bytes)((const void *) (size_t) (decode_zcl_ota_size_in_bytes)),
10875 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10876
10877 { &hf_zbee_zcl_ota_file_offset,
10878 { "File Offset", "zbee_zcl_general.ota.file.offset", FT_UINT32, BASE_DEC, NULL((void*)0),
10879 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10880
10881 { &hf_zbee_zcl_ota_max_data_size,
10882 { "Max Data Size", "zbee_zcl_general.ota.max_data_size", FT_UINT8, BASE_DEC, NULL((void*)0),
10883 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10884
10885 { &hf_zbee_zcl_ota_min_block_period,
10886 { "Minimum Block Period", "zbee_zcl_general.ota.min_block_period", FT_UINT16, BASE_DEC, NULL((void*)0),
10887 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10888
10889 { &hf_zbee_zcl_ota_req_node_addr,
10890 { "Ieee Address", "zbee_zcl_general.ota.ieee_addr", FT_UINT64, BASE_HEX, NULL((void*)0),
10891 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10892
10893 { &hf_zbee_zcl_ota_page_size,
10894 { "Page Size", "zbee_zcl_general.ota.page.size", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_ota_size_in_bytes)((const void *) (size_t) (decode_zcl_ota_size_in_bytes)),
10895 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10896
10897 { &hf_zbee_zcl_ota_rsp_spacing,
10898 { "Response Spacing", "zbee_zcl_general.ota.rsp_spacing", FT_UINT16, BASE_HEX, NULL((void*)0),
10899 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10900
10901 { &hf_zbee_zcl_ota_current_time,
10902 { "Current Time", "zbee_zcl_general.ota.current_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, TIME_VALS(now_strings)((0 ? (const struct _time_value_string*)0 : ((now_strings)))),
10903 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
10904
10905 { &hf_zbee_zcl_ota_request_time_offset,
10906 { "Request Time (offset)", "zbee_zcl_general.ota.request_time_offset", FT_UINT32, BASE_CUSTOM, CF_FUNC(decode_zcl_ota_req_time)((const void *) (size_t) (decode_zcl_ota_req_time)),
10907 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
10908
10909 { &hf_zbee_zcl_ota_request_time_utc,
10910 { "Request Time (UTC)", "zbee_zcl_general.ota.request_time_utc", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, TIME_VALS(now_strings)((0 ? (const struct _time_value_string*)0 : ((now_strings)))),
10911 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
10912
10913 { &hf_zbee_zcl_ota_upgrade_time,
10914 { "Upgrade Time", "zbee_zcl_general.ota.upgrade_time", FT_UINT32, BASE_CUSTOM, CF_FUNC(decode_zcl_ota_upgr_time)((const void *) (size_t) (decode_zcl_ota_upgr_time)),
10915 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
10916
10917 { &hf_zbee_zcl_ota_upgrade_time_utc,
10918 { "Upgrade Time", "zbee_zcl_general.ota.upgrade_time_utc", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, TIME_VALS(upgrade_time_utc_strings)((0 ? (const struct _time_value_string*)0 : ((upgrade_time_utc_strings
))))
,
10919 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
10920
10921 { &hf_zbee_zcl_ota_data_size,
10922 { "Data Size", "zbee_zcl_general.ota.data_size", FT_UINT8, BASE_DEC, NULL((void*)0),
10923 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
10924
10925 { &hf_zbee_zcl_ota_image_data,
10926 { "Image Data", "zbee_zcl_general.ota.image.data", FT_BYTES, SEP_COLON, NULL((void*)0),
10927 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
10928 };
10929
10930 /* ZCL OTA subtrees */
10931 int *ett[] = {
10932 &ett_zbee_zcl_ota,
10933 &ett_zbee_zcl_ota_query_next_image_req_field_ctrl,
10934 &ett_zbee_zcl_ota_image_block_req_field_ctrl,
10935 &ett_zbee_zcl_ota_image_page_req_field_ctrl,
10936 &ett_zbee_zcl_ota_file_version
10937 };
10938
10939 /* Register ZigBee ZCL Ota protocol with Wireshark. */
10940 proto_zbee_zcl_ota = proto_register_protocol("ZigBee ZCL OTA", "ZCL OTA", ZBEE_PROTOABBREV_ZCL_OTA"zbee_zcl_general.ota");
10941 proto_register_field_array(proto_zbee_zcl_ota, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
10942 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
10943
10944 /* Register the ZigBee ZCL OTA dissector. */
10945 register_dissector(ZBEE_PROTOABBREV_ZCL_OTA"zbee_zcl_general.ota", dissect_zbee_zcl_ota, proto_zbee_zcl_ota);
10946
10947} /* proto_register_zbee_zcl_ota */
10948
10949
10950/*FUNCTION:------------------------------------------------------
10951 * NAME
10952 * proto_reg_handoff_zbee_zcl_ota
10953 * DESCRIPTION
10954 * Registers the zigbee ZCL OTA cluster dissector with Wireshark.
10955 * PARAMETERS
10956 * none
10957 * RETURNS
10958 * void
10959 *---------------------------------------------------------------
10960 */
10961void proto_reg_handoff_zbee_zcl_ota(void)
10962{
10963 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_OTA"zbee_zcl_general.ota",
10964 proto_zbee_zcl_ota,
10965 ett_zbee_zcl_ota,
10966 ZBEE_ZCL_CID_OTA_UPGRADE0x0019,
10967 ZBEE_MFG_CODE_NONE0x0000,
10968 hf_zbee_zcl_ota_attr_id,
10969 hf_zbee_zcl_ota_attr_id,
10970 hf_zbee_zcl_ota_srv_rx_cmd_id,
10971 hf_zbee_zcl_ota_srv_tx_cmd_id,
10972 (zbee_zcl_fn_attr_data)dissect_zcl_ota_attr_data
10973 );
10974
10975} /*proto_reg_handoff_zbee_zcl_ota*/
10976
10977/* ########################################################################## */
10978/* #### (0x001A) POWER PROFILE CLUSTER ###################################### */
10979/* ########################################################################## */
10980
10981/*************************/
10982/* Defines */
10983/*************************/
10984
10985#define ZBEE_ZCL_PWR_PROF_NUM_GENERIC_ETT4 4
10986#define ZBEE_ZCL_PWR_PROF_NUM_PWR_PROF_ETT5 5
10987#define ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT16 16
10988#define ZBEE_ZCL_PWR_PROF_NUM_ETT(4 + 5 + 16) (ZBEE_ZCL_PWR_PROF_NUM_GENERIC_ETT4 + \
10989 ZBEE_ZCL_PWR_PROF_NUM_PWR_PROF_ETT5 + \
10990 ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT16)
10991
10992/* Attributes */
10993#define ZBEE_ZCL_ATTR_ID_PWR_PROF_TOT_PROF_NUM0x0000 0x0000 /* Total Profile Number */
10994#define ZBEE_ZCL_ATTR_ID_PWR_PROF_MULTIPLE_SCHED0x0001 0x0001 /* Multiple Schedule */
10995#define ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_FORMAT0x0002 0x0002 /* Energy Formatting */
10996#define ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_REMOTE0x0003 0x0003 /* Energy Remote */
10997#define ZBEE_ZCL_ATTR_ID_PWR_PROF_SCHED_MODE0x0004 0x0004 /* Schedule Mode */
10998
10999/* Server Commands Received */
11000#define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_REQ0x00 0x00 /* Power Profile Request */
11001#define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_REQ0x01 0x01 /* Power Profile State Request */
11002#define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_RSP0x02 0x02 /* Get Power Profile Price Response */
11003#define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE_RSP0x03 0x03 /* Get Overall Schedule Price Response */
11004#define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_NOTIF0x04 0x04 /* Energy Phases Schedule Notification */
11005#define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_RSP0x05 0x05 /* Energy Phases Schedule Response */
11006#define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_REQ0x06 0x06 /* Power Profile Schedule Constraints Request */
11007#define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_REQ0x07 0x07 /* Energy Phases Schedule State Request */
11008#define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT_RSP0x08 0x08 /* Get Power Profile Price Extended Response */
11009
11010/* Server Commands Generated */
11011#define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_NOTIF0x00 0x00 /* Power Profile Notification */
11012#define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_RSP0x01 0x01 /* Power Profile Response */
11013#define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_RSP0x02 0x02 /* Power Profile State Response */
11014#define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE0x03 0x03 /* Get Power Profile Price */
11015#define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_NOTIF0x04 0x04 /* Power Profile State Notification */
11016#define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE0x05 0x05 /* Get Overall Schedule Price */
11017#define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_REQ0x06 0x06 /* Energy Phases Schedule Request */
11018#define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_RSP0x07 0x07 /* Energy Phases Schedule State Response */
11019#define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_NOITIF0x08 0x08 /* Energy Phases Schedule State Notification */
11020#define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_NOTIF0x09 0x09 /* Power Profile Schedule Constraints Notification */
11021#define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_RSP0x0A 0x0A /* Power Profile Schedule Constraints Response */
11022#define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT0x0B 0x0B /* Get Power Profile Price Extended */
11023
11024/* Power Profile StateId */
11025#define ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_IDLE0x00 0x00 /* Power Profile Idle */
11026#define ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_PROGRAMMED0x01 0x01 /* Power Profile Programmed */
11027#define ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_RUNNING0x03 0x03 /* Energy Phase Running */
11028#define ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_PAUSE0x04 0x04 /* Energy Phase Pause */
11029#define ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_WAITING_TO_START0x05 0x05 /* Energy Phase Waiting to Start */
11030#define ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_WAITING_PAUSED0x06 0x06 /* Energy Phase Waiting Pause */
11031#define ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_ENDED0x07 0x07 /* Power Profile Ended */
11032
11033/* Energy Formatting bitmask field list */
11034#define ZBEE_ZCL_OPT_PWRPROF_NUM_R_DIGIT0x07 0x07 /* bits 0..2 */
11035#define ZBEE_ZCL_OPT_PWRPROF_NUM_L_DIGIT0x78 0x78 /* bits 3..6 */
11036#define ZBEE_ZCL_OPT_PWRPROF_NO_LEADING_ZERO0x80 0x80 /* bit 7 */
11037
11038/* Schedule Mode bitmask field list */
11039#define ZBEE_ZCL_OPT_PWRPROF_SCHED_CHEAPEST0x01 0x01 /* bit 0 */
11040#define ZBEE_ZCL_OPT_PWRPROF_SCHED_GREENEST0x02 0x02 /* bit 1 */
11041#define ZBEE_ZCL_OPT_PWRPROF_SCHED_RESERVED0xfc 0xfc /* bits 2..7 */
11042
11043/* Options bitmask field list */
11044#define ZBEE_ZCL_OPT_PWRPROF_STIME_PRESENT0x01 0x01 /* bit 0 */
11045#define ZBEE_ZCL_OPT_PWRPROF_RESERVED0xfe 0xfe /* bits 1..7 */
11046
11047/*************************/
11048/* Function Declarations */
11049/*************************/
11050
11051void proto_register_zbee_zcl_pwr_prof(void);
11052void proto_reg_handoff_zbee_zcl_pwr_prof(void);
11053
11054/* Command Dissector Helpers */
11055static void dissect_zcl_pwr_prof_pwrprofreq (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11056static void dissect_zcl_pwr_prof_getpwrprofpricersp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11057static void dissect_zcl_pwr_prof_getoverallschedpricersp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11058static void dissect_zcl_pwr_prof_enphsschednotif (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11059
11060static void dissect_zcl_energy_phase (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11061static void dissect_zcl_pwr_prof_pwrprofnotif (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11062static void dissect_zcl_power_profile (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11063static void dissect_zcl_pwr_prof_pwrprofstatersp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11064static void dissect_zcl_pwr_prof_pwrprofschedcontrsnotif (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11065static void dissect_zcl_pwr_prof_pwrprofpriceext (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
11066
11067static void dissect_zcl_pwr_prof_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
11068
11069/* Private functions prototype */
11070static void decode_power_profile_id (char *s, uint8_t id);
11071static void decode_price_in_cents (char *s, uint32_t value);
11072static void decode_power_in_watt (char *s, uint16_t value);
11073static void decode_energy (char *s, uint16_t value);
11074
11075/*************************/
11076/* Global Variables */
11077/*************************/
11078/* Initialize the protocol and registered fields */
11079static int proto_zbee_zcl_pwr_prof;
11080
11081static int hf_zbee_zcl_pwr_prof_attr_id;
11082static int hf_zbee_zcl_pwr_prof_tot_prof_num;
11083static int hf_zbee_zcl_pwr_prof_multiple_sched;
11084static int hf_zbee_zcl_pwr_prof_energy_format;
11085static int hf_zbee_zcl_pwr_prof_energy_format_rdigit;
11086static int hf_zbee_zcl_pwr_prof_energy_format_ldigit;
11087static int hf_zbee_zcl_pwr_prof_energy_format_noleadingzero;
11088static int hf_zbee_zcl_pwr_prof_energy_remote;
11089static int hf_zbee_zcl_pwr_prof_sched_mode;
11090static int hf_zbee_zcl_pwr_prof_sched_mode_cheapest;
11091static int hf_zbee_zcl_pwr_prof_sched_mode_greenest;
11092static int hf_zbee_zcl_pwr_prof_sched_mode_reserved;
11093static int hf_zbee_zcl_pwr_prof_srv_tx_cmd_id;
11094static int hf_zbee_zcl_pwr_prof_srv_rx_cmd_id;
11095static int hf_zbee_zcl_pwr_prof_pwr_prof_id;
11096static int hf_zbee_zcl_pwr_prof_currency;
11097static int hf_zbee_zcl_pwr_prof_price;
11098static int hf_zbee_zcl_pwr_prof_price_trailing_digit;
11099static int hf_zbee_zcl_pwr_prof_num_of_sched_phases;
11100static int hf_zbee_zcl_pwr_prof_scheduled_time;
11101static int hf_zbee_zcl_pwr_prof_pwr_prof_count;
11102static int hf_zbee_zcl_pwr_prof_num_of_trans_phases;
11103static int hf_zbee_zcl_pwr_prof_energy_phase_id;
11104static int hf_zbee_zcl_pwr_prof_macro_phase_id;
11105static int hf_zbee_zcl_pwr_prof_expect_duration;
11106static int hf_zbee_zcl_pwr_prof_peak_power;
11107static int hf_zbee_zcl_pwr_prof_energy;
11108static int hf_zbee_zcl_pwr_prof_max_active_delay;
11109static int hf_zbee_zcl_pwr_prof_pwr_prof_rem_ctrl;
11110static int hf_zbee_zcl_pwr_prof_pwr_prof_state;
11111static int hf_zbee_zcl_pwr_prof_start_after;
11112static int hf_zbee_zcl_pwr_prof_stop_before;
11113static int hf_zbee_zcl_pwr_prof_options;
11114static int hf_zbee_zcl_pwr_prof_options_01;
11115static int hf_zbee_zcl_pwr_prof_options_res;
11116static int hf_zbee_zcl_pwr_prof_pwr_prof_stime;
11117
11118/* Initialize the subtree pointers */
11119static int ett_zbee_zcl_pwr_prof;
11120static int ett_zbee_zcl_pwr_prof_options;
11121static int ett_zbee_zcl_pwr_prof_en_format;
11122static int ett_zbee_zcl_pwr_prof_sched_mode;
11123static int ett_zbee_zcl_pwr_prof_pwrprofiles[ZBEE_ZCL_PWR_PROF_NUM_PWR_PROF_ETT5];
11124static int ett_zbee_zcl_pwr_prof_enphases[ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT16];
11125
11126/* Attributes */
11127static const value_string zbee_zcl_pwr_prof_attr_names[] = {
11128 { ZBEE_ZCL_ATTR_ID_PWR_PROF_TOT_PROF_NUM0x0000, "Total Profile Number" },
11129 { ZBEE_ZCL_ATTR_ID_PWR_PROF_MULTIPLE_SCHED0x0001, "Multiple Scheduling" },
11130 { ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_FORMAT0x0002, "Energy Formatting" },
11131 { ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_REMOTE0x0003, "Energy Remote" },
11132 { ZBEE_ZCL_ATTR_ID_PWR_PROF_SCHED_MODE0x0004, "Schedule Mode" },
11133 { 0, NULL((void*)0) }
11134};
11135
11136/* Server Commands Received */
11137static const value_string zbee_zcl_pwr_prof_srv_rx_cmd_names[] = {
11138 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_REQ0x00, "Power Profile Request" },
11139 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_REQ0x01, "Power Profile State Request" },
11140 { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_RSP0x02, "Get Power Profile Price Response" },
11141 { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE_RSP0x03, "Get Overall Schedule Price Response" },
11142 { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_NOTIF0x04, "Energy Phases Schedule Notification" },
11143 { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_RSP0x05, "Energy Phases Schedule Response" },
11144 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_REQ0x06, "Power Profile Schedule Constraints Request" },
11145 { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_REQ0x07, "Energy Phases Schedule State Request" },
11146 { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT_RSP0x08, "Get Power Profile Price Extended Response" },
11147 { 0, NULL((void*)0) }
11148};
11149
11150/* Server Commands Generated */
11151static const value_string zbee_zcl_pwr_prof_srv_tx_cmd_names[] = {
11152 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_NOTIF0x00, "Power Profile Notification" },
11153 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_RSP0x01, "Power Profile Response" },
11154 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_RSP0x02, "Power Profile State Response" },
11155 { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE0x03, "Get Power Profile Price" },
11156 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_NOTIF0x04, "Power Profile State Notification" },
11157 { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE0x05, "Get Overall Schedule Price" },
11158 { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_REQ0x06, "Energy Phases Schedule Request" },
11159 { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_RSP0x07, "Energy Phases Schedule State Response" },
11160 { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_NOITIF0x08, "Energy Phases Schedule State Notification" },
11161 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_NOTIF0x09, "Power Profile Schedule Constraints Notification" },
11162 { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_RSP0x0A, "Power Profile Schedule Constraints Response" },
11163 { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT0x0B, "Get Power Profile Price Extended" },
11164 { 0, NULL((void*)0) }
11165};
11166
11167/* Currencies (values defined by ISO 4217) */
11168static const value_string zbee_zcl_currecy_names[] = {
11169 { 0x03D2, "EUR" },
11170 { 0x033A, "GBP" },
11171 { 0x0348, "USD" },
11172 { 0, NULL((void*)0) }
11173};
11174
11175/* Power Profile State */
11176static const value_string zbee_zcl_pwr_prof_state_names[] = {
11177 { ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_IDLE0x00, "Power Profile Idle" },
11178 { ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_PROGRAMMED0x01, "Power Profile Programmed" },
11179 { ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_RUNNING0x03, "Energy Phase Running" },
11180 { ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_PAUSE0x04, "Energy Phase Pause" },
11181 { ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_WAITING_TO_START0x05, "Energy Phase Waiting to Start" },
11182 { ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_WAITING_PAUSED0x06, "Energy Phase Waiting Paused" },
11183 { ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_ENDED0x07, "Power Profile Ended" },
11184 { 0, NULL((void*)0) }
11185};
11186
11187/*************************/
11188/* Function Bodies */
11189/*************************/
11190
11191/*FUNCTION:------------------------------------------------------
11192 * NAME
11193 * dissect_zbee_zcl_pwr_prof
11194 * DESCRIPTION
11195 * ZigBee ZCL Power Profile cluster dissector for wireshark.
11196 * PARAMETERS
11197 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11198 * packet_info *pinfo - pointer to packet information fields
11199 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11200 * void *data - pointer to ZCL packet structure.
11201 * RETURNS
11202 * int - length of parsed data.
11203 *---------------------------------------------------------------
11204 */
11205static int
11206dissect_zbee_zcl_pwr_prof (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
11207{
11208 proto_tree *payload_tree;
11209 zbee_zcl_packet *zcl;
11210 unsigned offset = 0;
11211 uint8_t cmd_id;
11212 int rem_len;
11213
11214 /* Reject the packet if data is NULL */
11215 if (data == NULL((void*)0))
11216 return 0;
11217 zcl = (zbee_zcl_packet *)data;
11218 cmd_id = zcl->cmd_id;
11219
11220 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
11221 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER0x00) {
11222 /* Append the command name to the info column. */
11223 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
11224 val_to_str_const(cmd_id, zbee_zcl_pwr_prof_srv_rx_cmd_names, "Unknown Command"),
11225 zcl->tran_seqno);
11226
11227 /* Add the command ID. */
11228 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
11229
11230 /* Check is this command has a payload, than add the payload tree */
11231 rem_len = tvb_reported_length_remaining(tvb, ++offset);
11232 if (rem_len > 0) {
11233 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_pwr_prof, NULL((void*)0), "Payload");
11234
11235 /* Call the appropriate command dissector */
11236 switch (cmd_id) {
11237 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_REQ0x00:
11238 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_REQ0x06:
11239 case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_REQ0x07:
11240 dissect_zcl_pwr_prof_pwrprofreq(tvb, payload_tree, &offset);
11241 break;
11242
11243 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_REQ0x01:
11244 /* No payload */
11245 break;
11246
11247 case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_RSP0x02:
11248 case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT_RSP0x08:
11249 dissect_zcl_pwr_prof_getpwrprofpricersp(tvb, payload_tree, &offset);
11250 break;
11251
11252 case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE_RSP0x03:
11253 dissect_zcl_pwr_prof_getoverallschedpricersp(tvb, payload_tree, &offset);
11254 break;
11255
11256 case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_NOTIF0x04:
11257 case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_RSP0x05:
11258 dissect_zcl_pwr_prof_enphsschednotif(tvb, payload_tree, &offset);
11259 break;
11260
11261 default:
11262 break;
11263 }
11264 }
11265 }
11266 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
11267 /* Append the command name to the info column. */
11268 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
11269 val_to_str_const(cmd_id, zbee_zcl_pwr_prof_srv_tx_cmd_names, "Unknown Command"),
11270 zcl->tran_seqno);
11271
11272 /* Add the command ID. */
11273 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
11274
11275 /* Check is this command has a payload, than add the payload tree */
11276 rem_len = tvb_reported_length_remaining(tvb, ++offset);
11277 if (rem_len > 0) {
11278 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_pwr_prof, NULL((void*)0), "Payload");
11279
11280 /* Call the appropriate command dissector */
11281 switch (cmd_id) {
11282 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_NOTIF0x00:
11283 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_RSP0x01:
11284 dissect_zcl_pwr_prof_pwrprofnotif(tvb, payload_tree, &offset);
11285 break;
11286
11287 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_RSP0x02:
11288 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_NOTIF0x04:
11289 dissect_zcl_pwr_prof_pwrprofstatersp(tvb, payload_tree, &offset);
11290 break;
11291
11292 case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE0x05:
11293 /* no payload */
11294 break;
11295
11296 case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_RSP0x07:
11297 case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_NOITIF0x08:
11298 dissect_zcl_pwr_prof_enphsschednotif(tvb, payload_tree, &offset);
11299 break;
11300
11301 case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE0x03:
11302 case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_REQ0x06:
11303 dissect_zcl_pwr_prof_pwrprofreq(tvb, payload_tree, &offset);
11304 break;
11305
11306 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_NOTIF0x09:
11307 case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_RSP0x0A:
11308 dissect_zcl_pwr_prof_pwrprofschedcontrsnotif(tvb, payload_tree, &offset);
11309 break;
11310
11311 case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT0x0B:
11312 dissect_zcl_pwr_prof_pwrprofpriceext(tvb, payload_tree, &offset);
11313 break;
11314
11315 default:
11316 break;
11317 }
11318 }
11319 }
11320
11321 return tvb_captured_length(tvb);
11322} /*dissect_zbee_zcl_pwr_prof*/
11323
11324/*FUNCTION:------------------------------------------------------
11325 * NAME
11326 * dissect_zcl_pwr_prof_pwrprofreq
11327 * DESCRIPTION
11328 * this function is called in order to decode "PowerProfileRequest",
11329 * "PowerProfileScheduleConstraintsRequest", "EnergyPhasesScheduleStateRequest",
11330 * "GetPowerProfilePrice" and "EnergyPhasesScheduleRequest" payload.
11331 * PARAMETERS
11332 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11333 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11334 * unsigned *offset - pointer to buffer offset
11335 * RETURNS
11336 * none
11337 *---------------------------------------------------------------
11338 */
11339static void
11340dissect_zcl_pwr_prof_pwrprofreq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11341{
11342 /* Retrieve "Power Profile Id" field */
11343 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA0x00000000);
11344 *offset += 1;
11345
11346} /*dissect_zcl_pwr_prof_pwrprofreq*/
11347
11348
11349/*FUNCTION:------------------------------------------------------
11350 * NAME
11351 * dissect_zcl_pwr_prof_getpwrprofpricersp
11352 * DESCRIPTION
11353 * this function is called in order to decode "GetPowerProfilePriceResponse"
11354 * and "PowerProfilePriceExtendedResponse" payload.
11355 * PARAMETERS
11356 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11357 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11358 * unsigned *offset - pointer to buffer offset
11359 * RETURNS
11360 * none
11361 *---------------------------------------------------------------
11362 */
11363static void
11364dissect_zcl_pwr_prof_getpwrprofpricersp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11365{
11366 /* Retrieve "Power Profile Id" field */
11367 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA0x00000000);
11368 *offset += 1;
11369
11370 /* Retrieve "Currency" field */
11371 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_currency, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
11372 *offset += 2;
11373
11374 /* Retrieve "Price" field */
11375 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_price, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
11376 *offset += 4;
11377
11378 /* Retrieve "Price Trailing Digit" field */
11379 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_price_trailing_digit, tvb, *offset, 1, ENC_NA0x00000000);
11380 *offset += 1;
11381
11382} /*dissect_zcl_pwr_prof_getpwrprofpricersp*/
11383
11384
11385/*FUNCTION:------------------------------------------------------
11386 * NAME
11387 * dissect_zcl_pwr_prof_getoverallschedpricersp
11388 * DESCRIPTION
11389 * this function is called in order to decode "GetOverallSchedulePriceResponse"
11390 * payload.
11391 * PARAMETERS
11392 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11393 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11394 * unsigned *offset - pointer to buffer offset
11395 * RETURNS
11396 * none
11397 *---------------------------------------------------------------
11398 */
11399static void
11400dissect_zcl_pwr_prof_getoverallschedpricersp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11401{
11402 /* Retrieve "Currency" field */
11403 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_currency, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
11404 *offset += 2;
11405
11406 /* Retrieve "Price" field */
11407 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_price, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
11408 *offset += 4;
11409
11410 /* Retrieve "Price Trailing Digit" field */
11411 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_price_trailing_digit, tvb, *offset, 1, ENC_NA0x00000000);
11412 *offset += 1;
11413
11414} /*dissect_zcl_pwr_prof_getoverallschedpricersp*/
11415
11416
11417/*FUNCTION:------------------------------------------------------
11418 * NAME
11419 * dissect_zcl_sched_energy_phase
11420 * DESCRIPTION
11421 * this function is called in order to decode "ScheduledEnergyPhases"
11422 * element.
11423 * PARAMETERS
11424 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11425 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11426 * unsigned *offset - pointer to buffer offset
11427 * RETURNS
11428 * none
11429 *---------------------------------------------------------------
11430 */
11431static void
11432dissect_zcl_sched_energy_phase(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11433{
11434 /* Energy Phase ID */
11435 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_energy_phase_id, tvb, *offset, 1, ENC_NA0x00000000);
11436 *offset += 1;
11437
11438 /* Scheduled Time */
11439 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_scheduled_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
11440 *offset += 2;
11441
11442} /*dissect_zcl_sched_energy_phase*/
11443
11444
11445/*FUNCTION:------------------------------------------------------
11446 * NAME
11447 * dissect_zcl_pwr_prof_enphsschednotif
11448 * DESCRIPTION
11449 * this function is called in order to decode "EnergyPhasesScheduleNotification"
11450 * and "EnergyPhasesScheduleResoponse" payload.
11451 * PARAMETERS
11452 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11453 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11454 * unsigned *offset - pointer to buffer offset
11455 * RETURNS
11456 * none
11457 *---------------------------------------------------------------
11458 */
11459static void
11460dissect_zcl_pwr_prof_enphsschednotif(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11461{
11462 proto_tree *sub_tree = NULL((void*)0);
11463
11464 unsigned i;
11465 uint8_t num_of_sched_phases;
11466
11467 /* Retrieve "Power Profile Id" field */
11468 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA0x00000000);
11469 *offset += 1;
11470
11471 /* Retrieve "Number of Scheduled Phases" field */
11472 num_of_sched_phases = tvb_get_uint8(tvb, *offset);
11473 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_num_of_sched_phases, tvb, *offset, 1, ENC_NA0x00000000);
11474 *offset += 1;
11475
11476 /* Scheduled Energy Phases decoding */
11477 for (i=0 ; (i<num_of_sched_phases && i < ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT16); i++) {
11478 /* Create subtree */
11479 sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 1,
11480 ett_zbee_zcl_pwr_prof_enphases[i], NULL((void*)0), "Energy Phase #%u", i);
11481
11482 dissect_zcl_sched_energy_phase(tvb, sub_tree, offset);
11483 }
11484} /*dissect_zcl_pwr_prof_enphsschednotif*/
11485
11486
11487/*FUNCTION:------------------------------------------------------
11488 * NAME
11489 * dissect_zcl_energy_phase
11490 * DESCRIPTION
11491 * this function is called in order to decode "EnergyPhases"
11492 * element.
11493 * PARAMETERS
11494 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11495 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11496 * unsigned *offset - pointer to buffer offset
11497 * RETURNS
11498 * none
11499 *---------------------------------------------------------------
11500 */
11501static void
11502dissect_zcl_energy_phase(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11503{
11504 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_energy_phase_id, tvb, *offset, 1, ENC_NA0x00000000);
11505 *offset += 1;
11506
11507 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_macro_phase_id, tvb, *offset, 1, ENC_NA0x00000000);
11508 *offset += 1;
11509
11510 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_expect_duration, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
11511 *offset += 2;
11512
11513 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_peak_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
11514 *offset += 2;
11515
11516 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_energy, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
11517 *offset += 2;
11518
11519 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_max_active_delay, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
11520 *offset += 2;
11521
11522} /*dissect_zcl_energy_phase*/
11523
11524
11525/*FUNCTION:------------------------------------------------------
11526 * NAME
11527 * dissect_zcl_pwr_prof_pwrprofnotif
11528 * DESCRIPTION
11529 * this function is called in order to decode "PowerProfileNotification"
11530 * and "PowerProfileResponse" payload.
11531 * PARAMETERS
11532 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11533 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11534 * unsigned *offset - pointer to buffer offset
11535 * RETURNS
11536 * none
11537 *---------------------------------------------------------------
11538 */
11539static void
11540dissect_zcl_pwr_prof_pwrprofnotif(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11541{
11542 proto_tree *sub_tree = NULL((void*)0);
11543
11544 unsigned i;
11545 uint8_t total_profile_number;
11546 uint8_t num_of_transferred_phases;
11547
11548 /* Retrieve "Total Profile Number" field */
11549 total_profile_number = tvb_get_uint8(tvb, *offset);
11550 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_tot_prof_num, tvb, *offset, 1, ENC_NA0x00000000);
11551 *offset += 1;
11552
11553 if ( total_profile_number != 0 ) {
11554 /* Retrieve "Power Profile Id" field */
11555 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA0x00000000);
11556 *offset += 1;
11557
11558 /* Retrieve "Number of Transferred Phases" field */
11559 num_of_transferred_phases = tvb_get_uint8(tvb, *offset);
11560 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_num_of_trans_phases, tvb, *offset, 1, ENC_NA0x00000000);
11561 *offset += 1;
11562
11563 /* Energy Phases decoding */
11564 for ( i=0 ; (i<num_of_transferred_phases && i < ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT16); i++) {
11565 /* Create subtree */
11566 sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 1,
11567 ett_zbee_zcl_pwr_prof_enphases[i], NULL((void*)0), "Energy Phase #%u", i);
11568
11569 dissect_zcl_energy_phase(tvb, sub_tree, offset);
11570 }
11571 }
11572}
11573
11574
11575/*FUNCTION:------------------------------------------------------
11576 * NAME
11577 * dissect_zcl_power_profile
11578 * DESCRIPTION
11579 * this function is called in order to decode "PowerProfile"
11580 * element.
11581 * PARAMETERS
11582 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11583 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11584 * unsigned *offset - pointer to buffer offset
11585 * RETURNS
11586 * none
11587 *---------------------------------------------------------------
11588 */
11589static void
11590dissect_zcl_power_profile(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11591{
11592 /* Power Profile Id */
11593 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA0x00000000);
11594 *offset += 1;
11595
11596 /* Energy Phase Id */
11597 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_energy_phase_id, tvb, *offset, 1, ENC_NA0x00000000);
11598 *offset += 1;
11599
11600 /* Power Profile Remote Control */
11601 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_rem_ctrl, tvb, *offset, 1, ENC_NA0x00000000);
11602 *offset += 1;
11603
11604 /* Power Profile State */
11605 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_state, tvb, *offset, 1, ENC_NA0x00000000);
11606 *offset += 1;
11607
11608} /*dissect_zcl_power_profile*/
11609
11610
11611/*FUNCTION:------------------------------------------------------
11612 * NAME
11613 * dissect_zcl_pwr_prof_pwrprofstatersp
11614 * DESCRIPTION
11615 * this function is called in order to decode "PowerProfileStateResponse"
11616 * and "PowerProfileStateNotification" payload.
11617 * PARAMETERS
11618 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11619 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11620 * unsigned *offset - pointer to buffer offset
11621 * RETURNS
11622 * none
11623 *---------------------------------------------------------------
11624 */
11625static void
11626dissect_zcl_pwr_prof_pwrprofstatersp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11627{
11628 proto_tree *sub_tree = NULL((void*)0);
11629
11630 unsigned i;
11631 uint8_t power_profile_count;
11632
11633 /* Retrieve "Total Profile Number" field */
11634 power_profile_count = MIN(tvb_get_uint8(tvb, *offset), ZBEE_ZCL_PWR_PROF_NUM_PWR_PROF_ETT)(((tvb_get_uint8(tvb, *offset)) < (5)) ? (tvb_get_uint8(tvb
, *offset)) : (5))
;
11635 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_count, tvb, *offset, 1, ENC_NA0x00000000);
11636 *offset += 1;
11637
11638 /* Energy Phases decoding */
11639 for (i=0 ; i<power_profile_count ; i++) {
11640 /* Create subtree */
11641 sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 1,
11642 ett_zbee_zcl_pwr_prof_pwrprofiles[i], NULL((void*)0), "Power Profile #%u", i);
11643
11644 dissect_zcl_power_profile(tvb, sub_tree, offset);
11645 }
11646} /*dissect_zcl_pwr_prof_pwrprofstatersp*/
11647
11648
11649/*FUNCTION:------------------------------------------------------
11650 * NAME
11651 * dissect_zcl_pwr_prof_pwrprofschedcontrsnotif
11652 * DESCRIPTION
11653 * this function is called in order to decode "PowerProfileScheduleConstraintsNotification"
11654 * and "PowerProfileScheduleConstraintsResponse" payload.
11655 * PARAMETERS
11656 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11657 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11658 * unsigned *offset - pointer to buffer offset
11659 * RETURNS
11660 * none
11661 *---------------------------------------------------------------
11662 */
11663static void
11664dissect_zcl_pwr_prof_pwrprofschedcontrsnotif(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11665{
11666 /* Retrieve "Power Profile Id" field */
11667 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA0x00000000);
11668 *offset += 1;
11669
11670 /* Retrieve "Start After" field */
11671 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_start_after, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
11672 *offset += 2;
11673
11674 /* Retrieve "Stop Before" field */
11675 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_stop_before, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
11676 *offset += 2;
11677
11678} /*dissect_zcl_pwr_prof_pwrprofschedcontrsnotif*/
11679
11680
11681/*FUNCTION:------------------------------------------------------
11682 * NAME
11683 * dissect_zcl_pwr_prof_pwrprofpriceext
11684 * DESCRIPTION
11685 * this function is called in order to decode "GetPowerProfilePriceExtended"
11686 * and "PowerProfileScheduleConstraintsResponse" payload.
11687 * PARAMETERS
11688 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11689 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11690 * unsigned *offset - pointer to buffer offset
11691 * RETURNS
11692 * none
11693 *---------------------------------------------------------------
11694 */
11695static void
11696dissect_zcl_pwr_prof_pwrprofpriceext(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
11697{
11698 static int * const options[] = {
11699 &hf_zbee_zcl_pwr_prof_options_01,
11700 &hf_zbee_zcl_pwr_prof_options_res,
11701 NULL((void*)0)
11702 };
11703
11704 /* Retrieve "Options" field */
11705 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_pwr_prof_options, ett_zbee_zcl_pwr_prof_options, options, ENC_NA0x00000000);
11706 *offset += 1;
11707
11708 /* Retrieve "Power Profile Id" field */
11709 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA0x00000000);
11710 *offset += 1;
11711
11712 /* Retrieve "Power Profile Start Time" field */
11713 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_stime, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
11714 *offset += 2;
11715
11716} /*dissect_zcl_pwr_prof_pwrprofpriceext*/
11717
11718
11719/*FUNCTION:------------------------------------------------------
11720 * NAME
11721 * dissect_zcl_pwr_prof_attr_data
11722 * DESCRIPTION
11723 * this function is called by ZCL foundation dissector in order to decode
11724 * specific cluster attributes data.
11725 * PARAMETERS
11726 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
11727 * tvbuff_t *tvb - pointer to buffer containing raw packet.
11728 * unsigned *offset - pointer to buffer offset
11729 * uint16_t attr_id - attribute identifier
11730 * unsigned data_type - attribute data type
11731 * bool client_attr- ZCL client
11732 * RETURNS
11733 * none
11734 *---------------------------------------------------------------
11735 */
11736static void
11737dissect_zcl_pwr_prof_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
11738{
11739 static int * const format_fields[] = {
11740 &hf_zbee_zcl_pwr_prof_energy_format_rdigit,
11741 &hf_zbee_zcl_pwr_prof_energy_format_ldigit,
11742 &hf_zbee_zcl_pwr_prof_energy_format_noleadingzero,
11743 NULL((void*)0)
11744 };
11745 static int * const modes[] = {
11746 &hf_zbee_zcl_pwr_prof_sched_mode_cheapest,
11747 &hf_zbee_zcl_pwr_prof_sched_mode_greenest,
11748 &hf_zbee_zcl_pwr_prof_sched_mode_reserved,
11749 NULL((void*)0)
11750 };
11751
11752 /* Dissect attribute data type and data */
11753 switch ( attr_id )
11754 {
11755 case ZBEE_ZCL_ATTR_ID_PWR_PROF_TOT_PROF_NUM0x0000:
11756 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_tot_prof_num, tvb, *offset, 1, ENC_NA0x00000000);
11757 *offset += 1;
11758 break;
11759
11760 case ZBEE_ZCL_ATTR_ID_PWR_PROF_MULTIPLE_SCHED0x0001:
11761 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_multiple_sched, tvb, *offset, 1, ENC_NA0x00000000);
11762 *offset += 1;
11763 break;
11764
11765 case ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_FORMAT0x0002:
11766 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_pwr_prof_energy_format, ett_zbee_zcl_pwr_prof_en_format, format_fields, ENC_NA0x00000000);
11767 *offset += 1;
11768 break;
11769
11770 case ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_REMOTE0x0003:
11771 proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_energy_remote, tvb, *offset, 1, ENC_NA0x00000000);
11772 *offset += 1;
11773 break;
11774
11775 case ZBEE_ZCL_ATTR_ID_PWR_PROF_SCHED_MODE0x0004:
11776 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_pwr_prof_sched_mode, ett_zbee_zcl_pwr_prof_sched_mode, modes, ENC_NA0x00000000);
11777 *offset += 1;
11778 break;
11779
11780 default:
11781 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
11782 break;
11783 }
11784} /*dissect_zcl_pwr_prof_attr_data*/
11785
11786
11787/*FUNCTION:------------------------------------------------------
11788 * NAME
11789 * decode_power_profile_id
11790 * DESCRIPTION
11791 * this function decodes the power profile custom type
11792 * PARAMETERS
11793 * unsigned *s - string to display
11794 * uint16_t value - value to decode
11795 * RETURNS
11796 * none
11797 *---------------------------------------------------------------
11798 */
11799static void
11800decode_power_profile_id(char *s, uint8_t id)
11801{
11802 if (id == 0) {
11803 snprintf(s, ITEM_LABEL_LENGTH240, "%d (All)", id);
11804 }
11805 else {
11806 snprintf(s, ITEM_LABEL_LENGTH240, "%d", id);
11807 }
11808} /*decode_power_profile_id*/
11809
11810
11811/*FUNCTION:------------------------------------------------------
11812 * NAME
11813 * decode_price_in_cents
11814 * DESCRIPTION
11815 * this function decodes price type variable
11816 * PARAMETERS
11817 * unsigned *s - string to display
11818 * uint16_t value - value to decode
11819 * RETURNS
11820 * none
11821 *---------------------------------------------------------------
11822 */
11823static void
11824decode_price_in_cents(char *s, uint32_t value)
11825{
11826 snprintf(s, ITEM_LABEL_LENGTH240, "%d cents", value);
11827} /* decode_price_in_cents */
11828
11829
11830/*FUNCTION:------------------------------------------------------
11831 * NAME
11832 * decode_power_in_watt
11833 * DESCRIPTION
11834 * this function decodes watt power type variable
11835 * PARAMETERS
11836 * unsigned *s - string to display
11837 * uint16_t value - value to decode
11838 * RETURNS
11839 * none
11840 *---------------------------------------------------------------
11841 */
11842static void
11843decode_power_in_watt(char *s, uint16_t value)
11844{
11845 snprintf(s, ITEM_LABEL_LENGTH240, "%d Watt", value);
11846} /* decode_power_in_watt */
11847
11848/*FUNCTION:------------------------------------------------------
11849 * NAME
11850 * decode_energy
11851 * DESCRIPTION
11852 * this function decodes energy type variable
11853 * PARAMETERS
11854 * unsigned *s - string to display
11855 * uint16_t value - value to decode
11856 * RETURNS
11857 * none
11858 *---------------------------------------------------------------
11859 */
11860static void
11861decode_energy(char *s, uint16_t value)
11862{
11863 snprintf(s, ITEM_LABEL_LENGTH240, "%d Watt per hours", value);
11864} /* decode_energy */
11865
11866/*FUNCTION:------------------------------------------------------
11867 * NAME
11868 * func_decode_delayinminute
11869 * DESCRIPTION
11870 * this function decodes minute delay type variable
11871 * PARAMETERS
11872 * unsigned *s - string to display
11873 * uint16_t value - value to decode
11874 * RETURNS
11875 * none
11876 *---------------------------------------------------------------
11877 */
11878static void
11879func_decode_delayinminute(char *s, uint16_t value)
11880{
11881 if (value == 0) {
11882 snprintf(s, ITEM_LABEL_LENGTH240, "%d minutes (Not permitted)", value);
11883 }
11884 else {
11885 snprintf(s, ITEM_LABEL_LENGTH240, "%d minutes", value);
11886 }
11887
11888} /* func_decode_delayinminute*/
11889
11890
11891/*FUNCTION:------------------------------------------------------
11892 * NAME
11893 * proto_register_zbee_zcl_pwr_prof
11894 * DESCRIPTION
11895 * ZigBee ZCL PowerProfile cluster protocol registration routine.
11896 * PARAMETERS
11897 * none
11898 * RETURNS
11899 * void
11900 *---------------------------------------------------------------
11901 */
11902void
11903proto_register_zbee_zcl_pwr_prof(void)
11904{
11905 unsigned i, j;
11906
11907 static hf_register_info hf[] = {
11908
11909 { &hf_zbee_zcl_pwr_prof_tot_prof_num,
11910 { "Total Profile Number", "zbee_zcl_general.pwrprof.attr.totprofnum", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
11911 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11912
11913 { &hf_zbee_zcl_pwr_prof_multiple_sched,
11914 { "Multiple Scheduling", "zbee_zcl_general.pwrprof.attr.multiplesched", FT_BOOLEAN, BASE_NONE,
11915 TFS(&tfs_supported_not_supported)((0 ? (const struct true_false_string*)0 : ((&tfs_supported_not_supported
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11916
11917/* Begin EnergyFormatting fields */
11918 { &hf_zbee_zcl_pwr_prof_energy_format,
11919 { "Data", "zbee_zcl_general.pwrprof.attr.energyformat",
11920 FT_UINT8, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11921
11922 { &hf_zbee_zcl_pwr_prof_energy_format_rdigit,
11923 { "Number of Digits to the right of the Decimal Point", "zbee_zcl_general.pwrprof.attr.energyformat.rdigit",
11924 FT_UINT8, BASE_DEC, NULL((void*)0), ZBEE_ZCL_OPT_PWRPROF_NUM_R_DIGIT0x07, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11925
11926 { &hf_zbee_zcl_pwr_prof_energy_format_ldigit,
11927 { "Number of Digits to the left of the Decimal Point", "zbee_zcl_general.pwrprof.attr.energyformat.ldigit",
11928 FT_UINT8, BASE_DEC, NULL((void*)0), ZBEE_ZCL_OPT_PWRPROF_NUM_L_DIGIT0x78, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11929
11930 { &hf_zbee_zcl_pwr_prof_energy_format_noleadingzero,
11931 { "Suppress leading zeros.", "zbee_zcl_general.pwrprof.attr.energyformat.noleadingzero",
11932 FT_BOOLEAN, 8, NULL((void*)0), ZBEE_ZCL_OPT_PWRPROF_NO_LEADING_ZERO0x80, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11933/* End EnergyFormatting fields */
11934
11935 { &hf_zbee_zcl_pwr_prof_energy_remote,
11936 { "Energy Remote", "zbee_zcl_general.pwrprof.attr.energyremote", FT_BOOLEAN, BASE_NONE,
11937 TFS(&tfs_enabled_disabled)((0 ? (const struct true_false_string*)0 : ((&tfs_enabled_disabled
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11938
11939/* Begin ScheduleMode fields */
11940 { &hf_zbee_zcl_pwr_prof_sched_mode,
11941 { "Schedule Mode", "zbee_zcl_general.pwrprof.attr.schedmode",
11942 FT_UINT8, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11943
11944 { &hf_zbee_zcl_pwr_prof_sched_mode_cheapest,
11945 { "Schedule Mode Cheapest", "zbee_zcl_general.pwrprof.attr.schedmode.cheapest",
11946 FT_BOOLEAN, 8, TFS(&tfs_active_inactive)((0 ? (const struct true_false_string*)0 : ((&tfs_active_inactive
))))
, ZBEE_ZCL_OPT_PWRPROF_SCHED_CHEAPEST0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11947
11948 { &hf_zbee_zcl_pwr_prof_sched_mode_greenest,
11949 { "Schedule Mode Greenest", "zbee_zcl_general.pwrprof.attr.schedmode.greenest",
11950 FT_BOOLEAN, 8, TFS(&tfs_active_inactive)((0 ? (const struct true_false_string*)0 : ((&tfs_active_inactive
))))
, ZBEE_ZCL_OPT_PWRPROF_SCHED_GREENEST0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11951
11952 { &hf_zbee_zcl_pwr_prof_sched_mode_reserved,
11953 { "Schedule Mode Reserved", "zbee_zcl_general.pwrprof.attr.schedmode.reserved",
11954 FT_UINT8, BASE_HEX, NULL((void*)0), ZBEE_ZCL_OPT_PWRPROF_SCHED_RESERVED0xfc, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11955/* End ScheduleMode fields */
11956
11957 { &hf_zbee_zcl_pwr_prof_attr_id,
11958 { "Attribute", "zbee_zcl_general.pwrprof.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_pwr_prof_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_pwr_prof_attr_names
))))
,
11959 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11960
11961 { &hf_zbee_zcl_pwr_prof_srv_tx_cmd_id,
11962 { "Command", "zbee_zcl_general.pwrprof.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_pwr_prof_srv_tx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_pwr_prof_srv_tx_cmd_names
))))
,
11963 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11964
11965 { &hf_zbee_zcl_pwr_prof_srv_rx_cmd_id,
11966 { "Command", "zbee_zcl_general.pwrprof.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_pwr_prof_srv_rx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_pwr_prof_srv_rx_cmd_names
))))
,
11967 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11968
11969 { &hf_zbee_zcl_pwr_prof_pwr_prof_id,
11970 { "Power Profile ID", "zbee_zcl_general.pwrprof.pwrprofid", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_profile_id)((const void *) (size_t) (decode_power_profile_id)), 0x00,
11971 "Identifier of the specific profile", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11972
11973 { &hf_zbee_zcl_pwr_prof_currency,
11974 { "Currency", "zbee_zcl_general.pwrprof.currency", FT_UINT16, BASE_HEX, VALS(zbee_zcl_currecy_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_currecy_names
))))
, 0x0,
11975 "Local unit of currency (ISO 4217) used in the price field.", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11976
11977 { &hf_zbee_zcl_pwr_prof_price,
11978 { "Price", "zbee_zcl_general.pwrprof.price", FT_UINT32, BASE_CUSTOM, CF_FUNC(decode_price_in_cents)((const void *) (size_t) (decode_price_in_cents)), 0x0,
11979 "Price of the energy of a specific Power Profile.", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11980
11981 { &hf_zbee_zcl_pwr_prof_price_trailing_digit,
11982 { "Price Trailing Digit", "zbee_zcl_general.pwrprof.pricetrailingdigit", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
11983 "Number of digits to the right of the decimal point.", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11984
11985 { &hf_zbee_zcl_pwr_prof_num_of_sched_phases,
11986 { "Number of Scheduled Phases", "zbee_zcl_general.pwrprof.numofschedphases", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
11987 "Total number of the energy phases of the Power Profile that need to be scheduled.", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11988
11989 { &hf_zbee_zcl_pwr_prof_energy_phase_id,
11990 { "Energy Phase ID", "zbee_zcl_general.pwrprof.energyphaseid", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
11991 "Identifier of the specific phase.", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11992
11993 { &hf_zbee_zcl_pwr_prof_scheduled_time,
11994 { "Scheduled Time", "zbee_zcl_general.pwrprof.scheduledtime", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_minutes)((const void *) (size_t) (decode_zcl_time_in_minutes)), 0x0,
11995 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
11996
11997 { &hf_zbee_zcl_pwr_prof_macro_phase_id,
11998 { "Macro Phase ID", "zbee_zcl_general.pwrprof.macrophaseid", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
11999 "Identifier of the specific energy phase.", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12000
12001 { &hf_zbee_zcl_pwr_prof_expect_duration,
12002 { "Expected Duration", "zbee_zcl_general.pwrprof.expectduration", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_minutes)((const void *) (size_t) (decode_zcl_time_in_minutes)), 0x0,
12003 "The estimated duration of the specific phase.", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12004
12005 { &hf_zbee_zcl_pwr_prof_num_of_trans_phases,
12006 { "Number of Transferred Phases", "zbee_zcl_general.pwrprof.numoftransphases", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
12007 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12008
12009 { &hf_zbee_zcl_pwr_prof_peak_power,
12010 { "Peak Power", "zbee_zcl_general.pwrprof.peakpower", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_power_in_watt)((const void *) (size_t) (decode_power_in_watt)), 0x0,
12011 "The estimated power for the specific phase.", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12012
12013 { &hf_zbee_zcl_pwr_prof_energy,
12014 { "Energy", "zbee_zcl_general.pwrprof.energy", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_energy)((const void *) (size_t) (decode_energy)), 0x0,
12015 "The estimated energy consumption for the accounted phase.", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12016
12017 { &hf_zbee_zcl_pwr_prof_max_active_delay,
12018 { "Max Activation Delay", "zbee_zcl_general.pwrprof.maxactivdelay", FT_UINT16, BASE_CUSTOM, CF_FUNC(func_decode_delayinminute)((const void *) (size_t) (func_decode_delayinminute)), 0x0,
12019 "The maximum interruption time between the end of the previous phase and the beginning of the specific phase.", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12020
12021 { &hf_zbee_zcl_pwr_prof_pwr_prof_count,
12022 { "Power Profile Count", "zbee_zcl_general.pwrprof.pwrprofcount", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
12023 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12024
12025 { &hf_zbee_zcl_pwr_prof_pwr_prof_rem_ctrl,
12026 { "Power Profile Remote Control", "zbee_zcl_general.pwrprof.pwrprofremctrl", FT_BOOLEAN, BASE_NONE, TFS(&tfs_enabled_disabled)((0 ? (const struct true_false_string*)0 : ((&tfs_enabled_disabled
))))
, 0x00,
12027 "It indicates if the PowerProfile is currently remotely controllable or not.", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12028
12029 { &hf_zbee_zcl_pwr_prof_pwr_prof_state,
12030 { "Power Profile State", "zbee_zcl_general.pwrprof.pwrprofstate", FT_UINT8, BASE_HEX, VALS(zbee_zcl_pwr_prof_state_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_pwr_prof_state_names
))))
,
12031 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12032
12033 { &hf_zbee_zcl_pwr_prof_start_after,
12034 { "Start After", "zbee_zcl_general.pwrprof.startafter", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_minutes)((const void *) (size_t) (decode_zcl_time_in_minutes)), 0x0,
12035 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12036
12037 { &hf_zbee_zcl_pwr_prof_stop_before,
12038 { "Stop Before", "zbee_zcl_general.pwrprof.stopbefore", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_minutes)((const void *) (size_t) (decode_zcl_time_in_minutes)), 0x0,
12039 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12040
12041/* Begin Options fields */
12042 { &hf_zbee_zcl_pwr_prof_options,
12043 { "Options", "zbee_zcl_general.pwrprof.options", FT_UINT8, BASE_HEX, NULL((void*)0),
12044 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12045
12046 { &hf_zbee_zcl_pwr_prof_options_01,
12047 { "PowerProfileStartTime Field Present", "zbee_zcl_general.pwrprof.options.01", FT_BOOLEAN, 8, NULL((void*)0),
12048 ZBEE_ZCL_OPT_PWRPROF_STIME_PRESENT0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12049
12050 { &hf_zbee_zcl_pwr_prof_options_res,
12051 { "Reserved", "zbee_zcl_general.pwrprof.options.reserved", FT_UINT8, BASE_HEX, NULL((void*)0),
12052 ZBEE_ZCL_OPT_PWRPROF_RESERVED0xfe, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12053/* End Options fields */
12054
12055 { &hf_zbee_zcl_pwr_prof_pwr_prof_stime,
12056 { "Power Profile Start Time", "zbee_zcl_general.pwrprof.pwrprofstime", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_minutes)((const void *) (size_t) (decode_zcl_time_in_minutes)), 0x0,
12057 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
12058
12059 };
12060
12061 /* ZCL PowerProfile subtrees */
12062 static int *ett[ZBEE_ZCL_PWR_PROF_NUM_ETT(4 + 5 + 16)] = {
12063 &ett_zbee_zcl_pwr_prof,
12064 &ett_zbee_zcl_pwr_prof_options,
12065 &ett_zbee_zcl_pwr_prof_en_format,
12066 &ett_zbee_zcl_pwr_prof_sched_mode
12067 };
12068
12069 /* initialize attribute subtree types */
12070 for ( i = 0, j = ZBEE_ZCL_PWR_PROF_NUM_GENERIC_ETT4; i < ZBEE_ZCL_PWR_PROF_NUM_PWR_PROF_ETT5; i++, j++ ) {
12071 ett[j] = &ett_zbee_zcl_pwr_prof_pwrprofiles[i];
12072 }
12073
12074 for ( i = 0; i < ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT16; i++, j++ ) {
12075 ett[j] = &ett_zbee_zcl_pwr_prof_enphases[i];
12076 }
12077
12078 /* Register the ZigBee ZCL PowerProfile cluster protocol name and description */
12079 proto_zbee_zcl_pwr_prof = proto_register_protocol("ZigBee ZCL Power Profile", "ZCL Power Profile", ZBEE_PROTOABBREV_ZCL_PWRPROF"zbee_zcl_general.pwrprof");
12080 proto_register_field_array(proto_zbee_zcl_pwr_prof, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
12081 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
12082
12083 /* Register the ZigBee ZCL Power Profile dissector. */
12084 register_dissector(ZBEE_PROTOABBREV_ZCL_PWRPROF"zbee_zcl_general.pwrprof", dissect_zbee_zcl_pwr_prof, proto_zbee_zcl_pwr_prof);
12085} /* proto_register_zbee_zcl_pwr_prof */
12086
12087
12088/*FUNCTION:------------------------------------------------------
12089 * NAME
12090 * proto_reg_handoff_zbee_zcl_pwr_prof
12091 * DESCRIPTION
12092 * Hands off the Zcl Power Profile cluster dissector.
12093 * PARAMETERS
12094 * none
12095 * RETURNS
12096 * void
12097 *---------------------------------------------------------------
12098 */
12099void
12100proto_reg_handoff_zbee_zcl_pwr_prof(void)
12101{
12102 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_PWRPROF"zbee_zcl_general.pwrprof",
12103 proto_zbee_zcl_pwr_prof,
12104 ett_zbee_zcl_pwr_prof,
12105 ZBEE_ZCL_CID_POWER_PROFILE0x001a,
12106 ZBEE_MFG_CODE_NONE0x0000,
12107 hf_zbee_zcl_pwr_prof_attr_id,
12108 hf_zbee_zcl_pwr_prof_attr_id,
12109 hf_zbee_zcl_pwr_prof_srv_rx_cmd_id,
12110 hf_zbee_zcl_pwr_prof_srv_tx_cmd_id,
12111 (zbee_zcl_fn_attr_data)dissect_zcl_pwr_prof_attr_data
12112 );
12113} /*proto_reg_handoff_zbee_zcl_pwr_prof*/
12114
12115/* ########################################################################## */
12116/* #### (0x001B) APPLIANCE CONTROL CLUSTER ################################## */
12117/* ########################################################################## */
12118
12119/*************************/
12120/* Defines */
12121/*************************/
12122
12123#define ZBEE_ZCL_APPL_CTRL_NUM_GENERIC_ETT3 3
12124#define ZBEE_ZCL_APPL_CTRL_NUM_FUNC_ETT32 32
12125#define ZBEE_ZCL_APPL_CTRL_NUM_ETT(3 + 32) (ZBEE_ZCL_APPL_CTRL_NUM_GENERIC_ETT3 + \
12126 ZBEE_ZCL_APPL_CTRL_NUM_FUNC_ETT32)
12127
12128/* Attributes */
12129#define ZBEE_ZCL_ATTR_ID_APPL_CTRL_START_TIME0x0000 0x0000 /* Start Time */
12130#define ZBEE_ZCL_ATTR_ID_APPL_CTRL_FINISH_TIME0x0001 0x0001 /* Finish Time */
12131#define ZBEE_ZCL_ATTR_ID_APPL_CTRL_REMAINING_TIME0x0002 0x0002 /* Remaining Time */
12132
12133/* Server Commands Received */
12134#define ZBEE_ZCL_CMD_ID_APPL_CTRL_EXECUTION_CMD0x00 0x00 /* Execution of a Command */
12135#define ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE0x01 0x01 /* Signal State */
12136#define ZBEE_ZCL_CMD_ID_APPL_CTRL_WRITE_FUNCS0x02 0x02 /* Write Functions */
12137#define ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE_RESUME0x03 0x03 /* Overload Pause Resume */
12138#define ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE0x04 0x04 /* Overload Pause */
12139#define ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_WARNING0x05 0x05 /* Overload Warning */
12140
12141/* Server Commands Generated */
12142#define ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_RSP0x00 0x00 /* Signal State Response */
12143#define ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_NOTIF0x01 0x01 /* Signal State Notification */
12144
12145/* Execution Of a Command - Command Ids list */
12146#define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_RESERVED0x00 0x00 /* Reserved */
12147#define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START0x01 0x01 /* Start appliance cycle */
12148#define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP0x02 0x02 /* Stop appliance cycle */
12149#define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_PAUSE0x03 0x03 /* Pause appliance cycle */
12150#define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START_SUPERFREEZING0x04 0x04 /* Start superfreezing cycle */
12151#define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP_SUPERFREEZING0x05 0x05 /* Stop superfreezing cycle */
12152#define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START_SUPERCOOLING0x06 0x06 /* Start supercooling cycle */
12153#define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP_SUPERCOOLING0x07 0x07 /* Stop supercooling cycle */
12154#define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_DISABLE_GAS0x08 0x08 /* Disable gas */
12155#define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_ENABLE_GAS0x09 0x09 /* Enable gas */
12156
12157/* CECED Time mask */
12158#define ZBEE_ZCL_APPL_CTRL_TIME_MM0x003f 0x003f /* Minutes */
12159#define ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_TYPE0x00c0 0x00c0 /* Encoding Type */
12160#define ZBEE_ZCL_APPL_CTRL_TIME_HH0xff00 0xff00 /* Hours */
12161
12162/* Time encoding values */
12163#define ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_REL0x00 0x00
12164#define ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_ABS0x01 0x01
12165
12166/* Overload Warnings */
12167#define ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_10x00 0x00
12168#define ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_20x01 0x01
12169#define ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_30x02 0x02
12170#define ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_40x03 0x03
12171#define ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_50x04 0x04
12172
12173/* Appliance Status Ids list */
12174#define ZBEE_ZCL_APPL_CTRL_ID_STATUS_RESERVED0x00 0x00 /* Reserved */
12175#define ZBEE_ZCL_APPL_CTRL_ID_STATUS_OFF0x01 0x01 /* Appliance in off state */
12176#define ZBEE_ZCL_APPL_CTRL_ID_STATUS_STANDBY0x02 0x02 /* Appliance in stand-by */
12177#define ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG0x03 0x03 /* Appliance already programmed */
12178#define ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG_WAITING_TO_START0x04 0x04 /* Appliance already programmed and ready to start */
12179#define ZBEE_ZCL_APPL_CTRL_ID_STATUS_RUNNING0x05 0x05 /* Appliance is running */
12180#define ZBEE_ZCL_APPL_CTRL_ID_STATUS_PAUSE0x06 0x06 /* Appliance is in pause */
12181#define ZBEE_ZCL_APPL_CTRL_ID_STATUS_END_PRG0x07 0x07 /* Appliance end programmed tasks */
12182#define ZBEE_ZCL_APPL_CTRL_ID_STATUS_FAILURE0x08 0x08 /* Appliance is in a failure state */
12183#define ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG_INTERRUPTED0x09 0x09 /* The appliance programmed tasks have been interrupted */
12184#define ZBEE_ZCL_APPL_CTRL_ID_STATUS_IDLE0x1a 0x1a /* Appliance in idle state */
12185#define ZBEE_ZCL_APPL_CTRL_ID_STATUS_RINSE_HOLD0x1b 0x1b /* Appliance rinse hold */
12186#define ZBEE_ZCL_APPL_CTRL_ID_STATUS_SERVICE0x1c 0x1c /* Appliance in service state */
12187#define ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERFREEZING0x1d 0x1d /* Appliance in superfreezing state */
12188#define ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERCOOLING0x1e 0x1e /* Appliance in supercooling state */
12189#define ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERHEATING0x1f 0x1f /* Appliance in superheating state */
12190
12191/* Remote Enable Flags mask */
12192#define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_FLAGS0x0f 0x0f
12193#define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_STATUS20xf0 0xf0
12194
12195/* Remote Enable Flags values */
12196#define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_DIS0x00 0x00 /* Disabled */
12197#define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_EN_REM_EN_CTRL0x01 0x01 /* Enable Remote and Energy Control */
12198#define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_TEMP_LOCK_DIS0x07 0x07 /* Temporarily locked/disabled */
12199#define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_EN_REM_CTRL0x0f 0x0f /* Enable Remote Control */
12200
12201/* Device Status 2 values */
12202#define ZBEE_ZCL_APPL_CTRL_STATUS2_PROPRIETARY_00x00 0x00 /* Proprietary */
12203#define ZBEE_ZCL_APPL_CTRL_STATUS2_PROPRIETARY_10x01 0x01 /* Proprietary */
12204#define ZBEE_ZCL_APPL_CTRL_STATUS2_IRIS_SYMPTOM_CODE0x02 0x02 /* Iris symptom code */
12205
12206/*************************/
12207/* Function Declarations */
12208/*************************/
12209
12210void proto_register_zbee_zcl_appl_ctrl(void);
12211void proto_reg_handoff_zbee_zcl_appl_ctrl(void);
12212
12213/* Command Dissector Helpers */
12214static void dissect_zcl_appl_ctrl_exec_cmd (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
12215static void dissect_zcl_appl_ctrl_attr_func (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
12216static void dissect_zcl_appl_ctrl_wr_funcs (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
12217static void dissect_zcl_appl_ctrl_ovrl_warning (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
12218static void dissect_zcl_appl_ctrl_signal_state_rsp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
12219
12220static void dissect_zcl_appl_ctrl_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr);
12221
12222/* Private functions prototype */
12223
12224/*************************/
12225/* Global Variables */
12226/*************************/
12227/* Initialize the protocol and registered fields */
12228static int proto_zbee_zcl_appl_ctrl;
12229
12230static int hf_zbee_zcl_appl_ctrl_attr_id;
12231static int hf_zbee_zcl_appl_ctrl_time;
12232static int hf_zbee_zcl_appl_ctrl_time_mm;
12233static int hf_zbee_zcl_appl_ctrl_time_encoding_type;
12234static int hf_zbee_zcl_appl_ctrl_time_hh;
12235static int hf_zbee_zcl_appl_ctrl_srv_tx_cmd_id;
12236static int hf_zbee_zcl_appl_ctrl_srv_rx_cmd_id;
12237static int hf_zbee_zcl_appl_ctrl_exec_cmd_id;
12238static int hf_zbee_zcl_appl_ctrl_attr_func_id;
12239static int hf_zbee_zcl_appl_ctrl_attr_func_data_type;
12240static int hf_zbee_zcl_appl_ctrl_warning_id;
12241static int hf_zbee_zcl_appl_ctrl_appl_status;
12242static int hf_zbee_zcl_appl_ctrl_rem_en_flags_raw;
12243static int hf_zbee_zcl_appl_ctrl_rem_en_flags;
12244static int hf_zbee_zcl_appl_ctrl_status2;
12245static int hf_zbee_zcl_appl_ctrl_status2_array;
12246
12247/* Initialize the subtree pointers */
12248static int ett_zbee_zcl_appl_ctrl;
12249static int ett_zbee_zcl_appl_ctrl_flags;
12250static int ett_zbee_zcl_appl_ctrl_time;
12251static int ett_zbee_zcl_appl_ctrl_func[ZBEE_ZCL_APPL_CTRL_NUM_FUNC_ETT32];
12252
12253/* Attributes */
12254static const value_string zbee_zcl_appl_ctrl_attr_names[] = {
12255 { ZBEE_ZCL_ATTR_ID_APPL_CTRL_START_TIME0x0000, "Start Time" },
12256 { ZBEE_ZCL_ATTR_ID_APPL_CTRL_FINISH_TIME0x0001, "Finish Time" },
12257 { ZBEE_ZCL_ATTR_ID_APPL_CTRL_REMAINING_TIME0x0002, "Remaining Time" },
12258 { 0, NULL((void*)0) }
12259};
12260static value_string_ext zbee_zcl_appl_ctrl_attr_names_ext = VALUE_STRING_EXT_INIT(zbee_zcl_appl_ctrl_attr_names){ _try_val_to_str_ext_init, 0, (sizeof (zbee_zcl_appl_ctrl_attr_names
) / sizeof ((zbee_zcl_appl_ctrl_attr_names)[0]))-1, zbee_zcl_appl_ctrl_attr_names
, "zbee_zcl_appl_ctrl_attr_names" }
;
12261
12262/* Server Commands Received */
12263static const value_string zbee_zcl_appl_ctrl_srv_rx_cmd_names[] = {
12264 { ZBEE_ZCL_CMD_ID_APPL_CTRL_EXECUTION_CMD0x00, "Execution of a Command" },
12265 { ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE0x01, "Signal State" },
12266 { ZBEE_ZCL_CMD_ID_APPL_CTRL_WRITE_FUNCS0x02, "Write Functions" },
12267 { ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE_RESUME0x03, "Overload Pause Resume" },
12268 { ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE0x04, "Overload Pause" },
12269 { ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_WARNING0x05, "Overload Warning" },
12270 { 0, NULL((void*)0) }
12271};
12272
12273/* Server Commands Generated */
12274static const value_string zbee_zcl_appl_ctrl_srv_tx_cmd_names[] = {
12275 { ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_RSP0x00, "Signal State Response" },
12276 { ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_NOTIF0x01, "Signal State Notification" },
12277 { 0, NULL((void*)0) }
12278};
12279
12280/* Execution Of a Command - Command Name */
12281static const value_string zbee_zcl_appl_ctrl_exec_cmd_names[] = {
12282 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_RESERVED0x00, "Reserved" },
12283 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START0x01, "Start" },
12284 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP0x02, "Stop" },
12285 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_PAUSE0x03, "Pause" },
12286 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START_SUPERFREEZING0x04, "Start Superfreezing" },
12287 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP_SUPERFREEZING0x05, "Stop Superfreezing" },
12288 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START_SUPERCOOLING0x06, "Start Supercooling" },
12289 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP_SUPERCOOLING0x07, "Stop Supercooling" },
12290 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_DISABLE_GAS0x08, "Disable Gas" },
12291 { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_ENABLE_GAS0x09, "Enable Gas" },
12292 { 0, NULL((void*)0) }
12293};
12294
12295/* Appliance Status Names list */
12296static const value_string zbee_zcl_appl_ctrl_appl_status_names[] = {
12297 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_RESERVED0x00, "Reserved" },
12298 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_OFF0x01, "Off" },
12299 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_STANDBY0x02, "Stand-by" },
12300 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG0x03, "Programmed" },
12301 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG_WAITING_TO_START0x04, "Waiting to Start" },
12302 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_RUNNING0x05, "Running" },
12303 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_PAUSE0x06, "Pause" },
12304 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_END_PRG0x07, "End Programmed" },
12305 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_FAILURE0x08, "Failure" },
12306 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG_INTERRUPTED0x09, "Programming Interrupted" },
12307 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_IDLE0x1a, "Idle" },
12308 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_RINSE_HOLD0x1b, "Raise Hold" },
12309 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_SERVICE0x1c, "Service" },
12310 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERFREEZING0x1d, "Superfreezing" },
12311 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERCOOLING0x1e, "Supercooling" },
12312 { ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERHEATING0x1f, "Superheating" },
12313 { 0, NULL((void*)0) }
12314};
12315
12316/* Remote Enable Flags Names list */
12317static const value_string zbee_zcl_appl_ctrl_rem_flags_names[] = {
12318 { ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_DIS0x00, "Disable" },
12319 { ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_EN_REM_EN_CTRL0x01, "Enable Remote and Energy Control" },
12320 { ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_TEMP_LOCK_DIS0x07, "Temporarily locked/disabled" },
12321 { ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_EN_REM_CTRL0x0f, "Enable Remote Control" },
12322 { 0, NULL((void*)0) }
12323};
12324
12325/* Appliance Status 2 Names list */
12326static const value_string zbee_zcl_appl_ctrl_status2_names[] = {
12327 { ZBEE_ZCL_APPL_CTRL_STATUS2_PROPRIETARY_00x00, "Proprietary" },
12328 { ZBEE_ZCL_APPL_CTRL_STATUS2_PROPRIETARY_10x01, "Proprietary" },
12329 { ZBEE_ZCL_APPL_CTRL_STATUS2_IRIS_SYMPTOM_CODE0x02, "Iris symptom code" },
12330 { 0, NULL((void*)0) }
12331};
12332
12333/* Overload Warning Names list */
12334static const value_string zbee_zcl_appl_ctrl_ovrl_warning_names[] = {
12335 { ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_10x00, "Overall power above 'available power' level" },
12336 { ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_20x01, "Overall power above 'power threshold' level" },
12337 { ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_30x02, "Overall power back below the 'available power' level" },
12338 { ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_40x03, "Overall power back below the 'power threshold' level" },
12339 { ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_50x04, "Overall power will be potentially above 'available power' level if the appliance starts" },
12340 { 0, NULL((void*)0) }
12341};
12342
12343/* CEDEC Time Encoding Names list */
12344static const value_string zbee_zcl_appl_ctrl_time_encoding_type_names[] = {
12345 { ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_REL0x00, "Relative" },
12346 { ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_ABS0x01, "Absolute" },
12347 { 0, NULL((void*)0) }
12348};
12349
12350/*************************/
12351/* Function Bodies */
12352/*************************/
12353
12354/*FUNCTION:------------------------------------------------------
12355 * NAME
12356 * dissect_zbee_zcl_appl_ctrl
12357 * DESCRIPTION
12358 * ZigBee ZCL Appliance Control cluster dissector for wireshark.
12359 * PARAMETERS
12360 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12361 * packet_info *pinfo - pointer to packet information fields
12362 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12363 * void *data - pointer to ZCL packet structure.
12364 * RETURNS
12365 * int - length of parsed data.
12366 *---------------------------------------------------------------
12367 */
12368static int
12369dissect_zbee_zcl_appl_ctrl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
12370{
12371 proto_tree *payload_tree;
12372 zbee_zcl_packet *zcl;
12373 unsigned offset = 0;
12374 uint8_t cmd_id;
12375 int rem_len;
12376
12377 /* Reject the packet if data is NULL */
12378 if (data == NULL((void*)0))
12379 return 0;
12380 zcl = (zbee_zcl_packet *)data;
12381 cmd_id = zcl->cmd_id;
12382
12383 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
12384 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER0x00) {
12385 /* Append the command name to the info column. */
12386 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
12387 val_to_str_const(cmd_id, zbee_zcl_appl_ctrl_srv_rx_cmd_names, "Unknown Command"),
12388 zcl->tran_seqno);
12389
12390 /* Add the command ID. */
12391 proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
12392
12393 /* Check is this command has a payload, than add the payload tree */
12394 rem_len = tvb_reported_length_remaining(tvb, ++offset);
12395 if (rem_len > 0) {
12396 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_appl_ctrl, NULL((void*)0), "Payload");
12397
12398 /* Call the appropriate command dissector */
12399 switch (cmd_id) {
12400 case ZBEE_ZCL_CMD_ID_APPL_CTRL_EXECUTION_CMD0x00:
12401 dissect_zcl_appl_ctrl_exec_cmd(tvb, payload_tree, &offset);
12402 break;
12403
12404 case ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE0x01:
12405 case ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE_RESUME0x03:
12406 case ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE0x04:
12407 /* No payload */
12408 break;
12409
12410 case ZBEE_ZCL_CMD_ID_APPL_CTRL_WRITE_FUNCS0x02:
12411 dissect_zcl_appl_ctrl_wr_funcs(tvb, payload_tree, &offset);
12412 break;
12413
12414 case ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_WARNING0x05:
12415 dissect_zcl_appl_ctrl_ovrl_warning(tvb, payload_tree, &offset);
12416 break;
12417
12418 default:
12419 break;
12420 }
12421 }
12422 }
12423 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
12424 /* Append the command name to the info column. */
12425 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
12426 val_to_str_const(cmd_id, zbee_zcl_appl_ctrl_srv_tx_cmd_names, "Unknown Command"),
12427 zcl->tran_seqno);
12428
12429 /* Add the command ID. */
12430 proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
12431
12432 /* Check is this command has a payload, than add the payload tree */
12433 rem_len = tvb_reported_length_remaining(tvb, ++offset);
12434 if (rem_len > 0) {
12435 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_appl_ctrl, NULL((void*)0), "Payload");
12436
12437 /* Call the appropriate command dissector */
12438 switch (cmd_id) {
12439 case ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_RSP0x00:
12440 case ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_NOTIF0x01:
12441 dissect_zcl_appl_ctrl_signal_state_rsp(tvb, payload_tree, &offset);
12442 break;
12443
12444 default:
12445 break;
12446 }
12447 }
12448 }
12449
12450 return tvb_captured_length(tvb);
12451}
12452
12453
12454/*FUNCTION:------------------------------------------------------
12455 * NAME
12456 * dissect_zcl_appl_ctrl_exec_cmd
12457 * DESCRIPTION
12458 * this function is called in order to decode "ExecutionOfACommand"
12459 * payload.
12460 * PARAMETERS
12461 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12462 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12463 * unsigned *offset - pointer to buffer offset
12464 * RETURNS
12465 * none
12466 *---------------------------------------------------------------
12467 */
12468static void
12469dissect_zcl_appl_ctrl_exec_cmd(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
12470{
12471 /* Retrieve "Command Id" field */
12472 proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_exec_cmd_id, tvb, *offset, 1, ENC_NA0x00000000);
12473 *offset += 1;
12474} /*dissect_zcl_appl_ctrl_exec_cmd*/
12475
12476
12477/*FUNCTION:------------------------------------------------------
12478 * NAME
12479 * dissect_zcl_appl_ctrl_attr_func
12480 * DESCRIPTION
12481 * this function is called in order to decode "Function" element.
12482 * PARAMETERS
12483 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12484 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12485 * unsigned *offset - pointer to buffer offset
12486 * RETURNS
12487 * none
12488 *---------------------------------------------------------------
12489 */
12490static void
12491dissect_zcl_appl_ctrl_attr_func(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
12492{
12493 uint8_t func_data_type;
12494 uint16_t func_id;
12495
12496 /* ID */
12497 func_id = tvb_get_letohs(tvb, *offset);
12498 proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_attr_func_id, tvb, *offset, 2,ENC_LITTLE_ENDIAN0x80000000);
12499 *offset += 2;
12500
12501 proto_item_append_text(tree, ", %s",
12502 val_to_str_ext_const(func_id, &zbee_zcl_appl_ctrl_attr_names_ext, "Reserved"));
12503
12504 /* Data Type */
12505 func_data_type = tvb_get_uint8(tvb, *offset);
12506 proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_attr_func_data_type, tvb, *offset, 1, ENC_NA0x00000000);
12507 *offset += 1;
12508
12509 /* Function Data Dissector */
12510 dissect_zcl_appl_ctrl_attr_data(tree, tvb, offset, func_id, func_data_type, false0);
12511
12512} /*dissect_zcl_appl_ctrl_attr_func*/
12513
12514
12515/*FUNCTION:------------------------------------------------------
12516 * NAME
12517 * dissect_zcl_appl_ctrl_wr_funcs
12518 * DESCRIPTION
12519 * this function is called in order to decode "WriteFunctions"
12520 * payload.
12521 * PARAMETERS
12522 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12523 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12524 * unsigned *offset - pointer to buffer offset
12525 * RETURNS
12526 * none
12527 *---------------------------------------------------------------
12528 */
12529static void
12530dissect_zcl_appl_ctrl_wr_funcs(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
12531{
12532 proto_tree *sub_tree = NULL((void*)0);
12533 unsigned tvb_len;
12534 unsigned i = 0;
12535
12536 tvb_len = tvb_reported_length(tvb);
12537 while ( *offset < tvb_len && i < ZBEE_ZCL_APPL_CTRL_NUM_FUNC_ETT32 ) {
12538 /* Create subtree for attribute status field */
12539 sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 0,
12540 ett_zbee_zcl_appl_ctrl_func[i], NULL((void*)0), "Function #%d", i);
12541 i++;
12542
12543 /* Dissect the attribute identifier */
12544 dissect_zcl_appl_ctrl_attr_func(tvb, sub_tree, offset);
12545 }
12546
12547} /*dissect_zcl_appl_ctrl_wr_funcs*/
12548
12549
12550/*FUNCTION:------------------------------------------------------
12551 * NAME
12552 * dissect_zcl_appl_ctrl_ovrl_warning
12553 * DESCRIPTION
12554 * this function is called in order to decode "OverloadWarning"
12555 * payload.
12556 * PARAMETERS
12557 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12558 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12559 * unsigned *offset - pointer to buffer offset
12560 * RETURNS
12561 * none
12562 *---------------------------------------------------------------
12563 */
12564static void
12565dissect_zcl_appl_ctrl_ovrl_warning(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
12566{
12567 /* Retrieve "Warning Id" field */
12568 proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_warning_id, tvb, *offset, 1, ENC_NA0x00000000);
12569 *offset += 1;
12570
12571} /*dissect_zcl_appl_ctrl_ovrl_warning*/
12572
12573
12574/*FUNCTION:------------------------------------------------------
12575 * NAME
12576 * dissect_zcl_appl_ctrl_signal_state_rsp
12577 * DESCRIPTION
12578 * this function is called in order to decode "SignalStateResponse"
12579 * "SignalStateNotification" payload.
12580 * PARAMETERS
12581 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12582 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12583 * unsigned *offset - pointer to buffer offset
12584 * RETURNS
12585 * none
12586 *---------------------------------------------------------------
12587 */
12588static void
12589dissect_zcl_appl_ctrl_signal_state_rsp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
12590{
12591 static int * const flags[] = {
12592 &hf_zbee_zcl_appl_ctrl_rem_en_flags,
12593 &hf_zbee_zcl_appl_ctrl_status2,
12594 NULL((void*)0)
12595 };
12596
12597 /* Retrieve "Appliance Status" field */
12598 proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_appl_status, tvb, *offset, 1, ENC_NA0x00000000);
12599 *offset += 1;
12600
12601 /* Retrieve "Remote Enable" field */
12602 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_appl_ctrl_rem_en_flags_raw, ett_zbee_zcl_appl_ctrl_flags, flags, ENC_NA0x00000000);
12603 *offset += 1;
12604
12605 /* Retrieve "Appliance Status 2" field */
12606 proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_status2_array, tvb, *offset, 3, ENC_BIG_ENDIAN0x00000000);
12607} /*dissect_zcl_appl_ctrl_signal_state_rsp*/
12608
12609/*FUNCTION:------------------------------------------------------
12610 * NAME
12611 * dissect_zcl_appl_ctrl_attr_data
12612 * DESCRIPTION
12613 * this function is called by ZCL foundation dissector in order to decode
12614 * specific cluster attributes data.
12615 * PARAMETERS
12616 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12617 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12618 * unsigned *offset - pointer to buffer offset
12619 * uint16_t attr_id - attribute identifier
12620 * unsigned data_type - attribute data type
12621 * bool client_attr- ZCL client
12622 * RETURNS
12623 * none
12624 *---------------------------------------------------------------
12625 */
12626static void
12627dissect_zcl_appl_ctrl_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool_Bool client_attr)
12628{
12629 static int * const flags[] = {
12630 &hf_zbee_zcl_appl_ctrl_time_mm,
12631 &hf_zbee_zcl_appl_ctrl_time_encoding_type,
12632 &hf_zbee_zcl_appl_ctrl_time_hh,
12633 NULL((void*)0)
12634 };
12635
12636 /* Dissect attribute data type and data */
12637 switch (attr_id) {
12638
12639 case ZBEE_ZCL_ATTR_ID_APPL_CTRL_START_TIME0x0000:
12640 case ZBEE_ZCL_ATTR_ID_APPL_CTRL_FINISH_TIME0x0001:
12641 case ZBEE_ZCL_ATTR_ID_APPL_CTRL_REMAINING_TIME0x0002:
12642 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_appl_ctrl_time, ett_zbee_zcl_appl_ctrl_time, flags, ENC_LITTLE_ENDIAN0x80000000);
12643 *offset += 2;
12644 break;
12645
12646 default:
12647 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
12648 break;
12649 }
12650} /*dissect_zcl_appl_ctrl_attr_data*/
12651
12652
12653/*FUNCTION:------------------------------------------------------
12654 * NAME
12655 * proto_register_zbee_zcl_appl_ctrl
12656 * DESCRIPTION
12657 * this function registers the ZCL Appliance Control dissector
12658 * and all its information.
12659 * PARAMETERS
12660 * none
12661 * RETURNS
12662 * none
12663 *---------------------------------------------------------------
12664 */
12665void
12666proto_register_zbee_zcl_appl_ctrl(void)
12667{
12668 unsigned i, j;
12669
12670 static hf_register_info hf[] = {
12671
12672 { &hf_zbee_zcl_appl_ctrl_attr_id,
12673 { "Attribute", "zbee_zcl_general.applctrl.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_appl_ctrl_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_appl_ctrl_attr_names
))))
,
12674 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12675
12676 { &hf_zbee_zcl_appl_ctrl_time,
12677 { "Data", "zbee_zcl_general.applctrl.time", FT_UINT16, BASE_HEX, NULL((void*)0), 0x0,
12678 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12679
12680 { &hf_zbee_zcl_appl_ctrl_time_mm,
12681 { "Minutes", "zbee_zcl_general.applctrl.time.mm", FT_UINT16, BASE_DEC, NULL((void*)0), ZBEE_ZCL_APPL_CTRL_TIME_MM0x003f,
12682 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12683
12684 { &hf_zbee_zcl_appl_ctrl_time_encoding_type,
12685 { "Encoding Type", "zbee_zcl_general.applctrl.time.encoding_type", FT_UINT16, BASE_HEX, VALS(zbee_zcl_appl_ctrl_time_encoding_type_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_appl_ctrl_time_encoding_type_names
))))
,
12686 ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_TYPE0x00c0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12687
12688 { &hf_zbee_zcl_appl_ctrl_time_hh,
12689 { "Hours", "zbee_zcl_general.applctrl.time.hh", FT_UINT16, BASE_DEC, NULL((void*)0), ZBEE_ZCL_APPL_CTRL_TIME_HH0xff00,
12690 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12691
12692 { &hf_zbee_zcl_appl_ctrl_srv_tx_cmd_id,
12693 { "Command", "zbee_zcl_general.applctrl.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_srv_tx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_appl_ctrl_srv_tx_cmd_names
))))
,
12694 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12695
12696 { &hf_zbee_zcl_appl_ctrl_srv_rx_cmd_id,
12697 { "Command", "zbee_zcl_general.applctrl.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_srv_rx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_appl_ctrl_srv_rx_cmd_names
))))
,
12698 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12699
12700 { &hf_zbee_zcl_appl_ctrl_appl_status,
12701 { "Appliance Status", "zbee_zcl_general.applctrl.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_appl_status_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_appl_ctrl_appl_status_names
))))
,
12702 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12703
12704 { &hf_zbee_zcl_appl_ctrl_rem_en_flags_raw,
12705 { "Remote Enable Flags", "zbee_zcl_general.applctrl.remote_enable_flags", FT_UINT8, BASE_HEX, NULL((void*)0),
12706 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12707
12708 { &hf_zbee_zcl_appl_ctrl_rem_en_flags,
12709 { "Remote Enable Flags", "zbee_zcl_general.applctrl.remenflags", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_rem_flags_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_appl_ctrl_rem_flags_names
))))
,
12710 ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_FLAGS0x0f, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12711
12712 { &hf_zbee_zcl_appl_ctrl_status2,
12713 { "Appliance Status 2", "zbee_zcl_general.applctrl.status2", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_status2_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_appl_ctrl_status2_names
))))
,
12714 ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_STATUS20xf0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12715
12716 { &hf_zbee_zcl_appl_ctrl_status2_array,
12717 { "Appliance Status 2", "zbee_zcl_general.applctrl.status2.array", FT_UINT24, BASE_HEX, NULL((void*)0),
12718 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12719
12720 { &hf_zbee_zcl_appl_ctrl_exec_cmd_id,
12721 { "Command", "zbee_zcl_general.applctrl.execcmd.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_exec_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_appl_ctrl_exec_cmd_names
))))
,
12722 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12723
12724 { &hf_zbee_zcl_appl_ctrl_attr_func_id,
12725 { "ID", "zbee_zcl_general.applctrl.attr_func.id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_appl_ctrl_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_appl_ctrl_attr_names
))))
,
12726 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12727
12728 { &hf_zbee_zcl_appl_ctrl_attr_func_data_type,
12729 { "Data Type", "zbee_zcl_general.applctrl.attr_func.datatype", FT_UINT8, BASE_HEX, VALS(zbee_zcl_short_data_type_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_short_data_type_names
))))
,
12730 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12731
12732 { &hf_zbee_zcl_appl_ctrl_warning_id,
12733 { "Warning", "zbee_zcl_general.applctrl.ovrlwarning.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_ovrl_warning_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_appl_ctrl_ovrl_warning_names
))))
,
12734 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }
12735
12736 };
12737
12738 /* ZCL ApplianceControl subtrees */
12739 int *ett[ZBEE_ZCL_APPL_CTRL_NUM_ETT(3 + 32)] = {
12740 &ett_zbee_zcl_appl_ctrl,
12741 &ett_zbee_zcl_appl_ctrl_flags,
12742 &ett_zbee_zcl_appl_ctrl_time
12743 };
12744
12745 /* initialize attribute subtree types */
12746 for ( i = 0, j = ZBEE_ZCL_APPL_CTRL_NUM_GENERIC_ETT3; i < ZBEE_ZCL_APPL_CTRL_NUM_FUNC_ETT32; i++, j++) {
12747 ett[j] = &ett_zbee_zcl_appl_ctrl_func[i];
12748 }
12749
12750 /* Register the ZigBee ZCL ApplianceControl cluster protocol name and description */
12751 proto_zbee_zcl_appl_ctrl = proto_register_protocol("ZigBee ZCL Appliance Control", "ZCL Appliance Control", ZBEE_PROTOABBREV_ZCL_APPLCTRL"zbee_zcl_general.applctrl");
12752 proto_register_field_array(proto_zbee_zcl_appl_ctrl, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
12753 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
12754
12755 /* Register the ZigBee ZCL Appliance Control dissector. */
12756 register_dissector(ZBEE_PROTOABBREV_ZCL_APPLCTRL"zbee_zcl_general.applctrl", dissect_zbee_zcl_appl_ctrl, proto_zbee_zcl_appl_ctrl);
12757} /*proto_register_zbee_zcl_appl_ctrl*/
12758
12759
12760/*FUNCTION:------------------------------------------------------
12761 * NAME
12762 * proto_reg_handoff_zbee_zcl_appl_ctrl
12763 * DESCRIPTION
12764 * Hands off the Zcl Appliance Control dissector.
12765 * PARAMETERS
12766 * none
12767 * RETURNS
12768 * void
12769 *---------------------------------------------------------------
12770 */
12771void
12772proto_reg_handoff_zbee_zcl_appl_ctrl(void)
12773{
12774 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_APPLCTRL"zbee_zcl_general.applctrl",
12775 proto_zbee_zcl_appl_ctrl,
12776 ett_zbee_zcl_appl_ctrl,
12777 ZBEE_ZCL_CID_APPLIANCE_CONTROL0x001b,
12778 ZBEE_MFG_CODE_NONE0x0000,
12779 hf_zbee_zcl_appl_ctrl_attr_id,
12780 hf_zbee_zcl_appl_ctrl_attr_id,
12781 hf_zbee_zcl_appl_ctrl_srv_rx_cmd_id,
12782 hf_zbee_zcl_appl_ctrl_srv_tx_cmd_id,
12783 (zbee_zcl_fn_attr_data)dissect_zcl_appl_ctrl_attr_data
12784 );
12785} /*proto_reg_handoff_zbee_zcl_appl_ctrl*/
12786
12787/* ########################################################################## */
12788/* #### (0x0020) POLL CONTROL CLUSTER ####################################### */
12789/* ########################################################################## */
12790
12791/*************************/
12792/* Defines */
12793/*************************/
12794
12795/* Poll Control Attributes */
12796#define ZBEE_ZCL_ATTR_ID_POLL_CTRL_CHECK_IN0x0000 0x0000
12797#define ZBEE_ZCL_ATTR_ID_POLL_CTRL_LONG_POLL0x0001 0x0001
12798#define ZBEE_ZCL_ATTR_ID_POLL_CTRL_SHORT_POLL0x0002 0x0002
12799#define ZBEE_ZCL_ATTR_ID_POLL_CTRL_FAST_POLL0x0003 0x0003
12800#define ZBEE_ZCL_ATTR_ID_POLL_CTRL_CHECK_IN_MIN0x0004 0x0004
12801#define ZBEE_ZCL_ATTR_ID_POLL_CTRL_LONG_POLL_MIN0x0005 0x0005
12802#define ZBEE_ZCL_ATTR_ID_POLL_CTRL_FAST_POLL_TIMEOUT0x0006 0x0006
12803
12804static const value_string zbee_zcl_poll_ctrl_attr_names[] = {
12805 { ZBEE_ZCL_ATTR_ID_POLL_CTRL_CHECK_IN0x0000, "Check-inInterval" },
12806 { ZBEE_ZCL_ATTR_ID_POLL_CTRL_LONG_POLL0x0001, "LongPollInterval" },
12807 { ZBEE_ZCL_ATTR_ID_POLL_CTRL_SHORT_POLL0x0002, "ShortPollInterval" },
12808 { ZBEE_ZCL_ATTR_ID_POLL_CTRL_FAST_POLL0x0003, "FastPollTimeout" },
12809 { ZBEE_ZCL_ATTR_ID_POLL_CTRL_CHECK_IN_MIN0x0004, "Check-inIntervalMin" },
12810 { ZBEE_ZCL_ATTR_ID_POLL_CTRL_LONG_POLL_MIN0x0005, "LongPollIntervalMin" },
12811 { ZBEE_ZCL_ATTR_ID_POLL_CTRL_FAST_POLL_TIMEOUT0x0006, "FastPollTimeoutMax" },
12812 { 0, NULL((void*)0) }
12813};
12814
12815/* Server-to-client command IDs. */
12816#define ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN0x00 0x00
12817static const value_string zbee_zcl_poll_ctrl_srv_tx_cmd_names[] = {
12818 { ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN0x00, "Check-in" },
12819 { 0, NULL((void*)0) }
12820};
12821
12822/* Client-to-server command IDs. */
12823#define ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN_RESPONSE0x00 0x00
12824#define ZBEE_ZCL_CMD_ID_POLL_CTRL_FAST_POLL_STOP0x01 0x01
12825#define ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_LONG_POLL0x02 0x02
12826#define ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_SHORT_POLL0x03 0x03
12827static const value_string zbee_zcl_poll_ctrl_srv_rx_cmd_names[] = {
12828 { ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN_RESPONSE0x00, "Check-in Response" },
12829 { ZBEE_ZCL_CMD_ID_POLL_CTRL_FAST_POLL_STOP0x01, "Fast Poll Stop" },
12830 { ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_LONG_POLL0x02, "Set Long Poll Interval" },
12831 { ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_SHORT_POLL0x03, "Set Short Poll Interval" },
12832 { 0, NULL((void*)0) }
12833};
12834
12835/*************************/
12836/* Global Variables */
12837/*************************/
12838/* Initialize the protocol and registered fields */
12839static int proto_zbee_zcl_poll_ctrl;
12840
12841static int hf_zbee_zcl_poll_ctrl_attr_id;
12842static int hf_zbee_zcl_poll_ctrl_srv_rx_cmd_id;
12843static int hf_zbee_zcl_poll_ctrl_srv_tx_cmd_id;
12844static int hf_zbee_zcl_poll_ctrl_start_fast_polling;
12845static int hf_zbee_zcl_poll_ctrl_fast_poll_timeout;
12846static int hf_zbee_zcl_poll_ctrl_new_long_poll_interval;
12847static int hf_zbee_zcl_poll_ctrl_new_short_poll_interval;
12848
12849static int ett_zbee_zcl_poll_ctrl;
12850
12851/*************************/
12852/* Function Declarations */
12853/*************************/
12854void proto_register_zbee_zcl_poll_ctrl(void);
12855void proto_reg_handoff_zbee_zcl_poll_ctrl(void);
12856
12857/*FUNCTION:------------------------------------------------------
12858 * NAME
12859 * dissect_zbee_zcl_poll_ctrl
12860 * DESCRIPTION
12861 * ZigBee ZCL Poll Control cluster dissector for wireshark.
12862 * PARAMETERS
12863 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12864 * packet_info *pinfo - pointer to packet information fields
12865 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12866 * void *data - pointer to ZCL packet structure.
12867 * RETURNS
12868 * int - length of parsed data.
12869 *---------------------------------------------------------------
12870 */
12871static int
12872dissect_zbee_zcl_poll_ctrl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
12873{
12874 zbee_zcl_packet *zcl;
12875 unsigned offset = 0;
12876 uint8_t cmd_id;
12877
12878 /* Reject the packet if data is NULL */
12879 if (data == NULL((void*)0))
12880 return 0;
12881 zcl = (zbee_zcl_packet *)data;
12882 cmd_id = zcl->cmd_id;
12883
12884 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER0x00) {
12885 /* Append the command name to the info column. */
12886 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
12887 val_to_str_const(cmd_id, zbee_zcl_poll_ctrl_srv_rx_cmd_names, "Unknown Command"),
12888 zcl->tran_seqno);
12889
12890 /* Add the command ID. */
12891 proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
12892 offset++;
12893
12894 /* Handle the command dissection. */
12895 switch (cmd_id) {
12896 case ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN_RESPONSE0x00:
12897 proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_start_fast_polling, tvb, offset, 1, ENC_NA0x00000000);
12898 offset++;
12899 proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_fast_poll_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
12900 break;
12901
12902 case ZBEE_ZCL_CMD_ID_POLL_CTRL_FAST_POLL_STOP0x01:
12903 /* no payload. */
12904 break;
12905
12906 case ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_LONG_POLL0x02:
12907 proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_new_long_poll_interval, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000);
12908 break;
12909
12910 case ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_SHORT_POLL0x03:
12911 proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_new_short_poll_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
12912 break;
12913
12914 default:
12915 break;
12916 } /* switch */
12917 } else {
12918 /* Append the command name to the info column. */
12919 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
12920 val_to_str_const(cmd_id, zbee_zcl_poll_ctrl_srv_tx_cmd_names, "Unknown Command"),
12921 zcl->tran_seqno);
12922
12923 /* Add the command ID. */
12924 proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_srv_tx_cmd_id, tvb, offset, 1, ENC_NA0x00000000);
12925 offset++;
12926
12927 /* Handle the command dissection. */
12928 switch (cmd_id) {
12929 case ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN0x00:
12930 /* No payload - fall through. */
12931 default:
12932 break;
12933 } /* switch */
12934 }
12935
12936 return tvb_captured_length(tvb);
12937} /* dissect_zbee_zcl_poll_ctrl */
12938
12939
12940/*FUNCTION:------------------------------------------------------
12941 * NAME
12942 * dissect_zcl_poll_ctrl_attr_data
12943 * DESCRIPTION
12944 * this function is called by ZCL foundation dissector in order to decode
12945 * specific cluster attributes data.
12946 * PARAMETERS
12947 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
12948 * tvbuff_t *tvb - pointer to buffer containing raw packet.
12949 * unsigned *offset - pointer to buffer offset
12950 * uint16_t attr_id - attribute identifier
12951 * unsigned data_type - attribute data type
12952 * bool client_attr- ZCL client
12953 * RETURNS
12954 * none
12955 *---------------------------------------------------------------
12956 */
12957static void
12958dissect_zcl_poll_ctrl_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id _U___attribute__((unused)), unsigned data_type, bool_Bool client_attr)
12959{
12960 /* Dissect attribute data type and data */
12961 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
12962
12963} /*dissect_zcl_poll_ctrl_attr_data*/
12964
12965/*FUNCTION:------------------------------------------------------
12966 * NAME
12967 * proto_register_zbee_zcl_poll_ctrl
12968 * DESCRIPTION
12969 * ZigBee ZCL Poll Control cluster protocol registration.
12970 * PARAMETERS
12971 * none
12972 * RETURNS
12973 * void
12974 *---------------------------------------------------------------
12975 */
12976void
12977proto_register_zbee_zcl_poll_ctrl(void)
12978{
12979 /* Setup list of header fields */
12980 static hf_register_info hf[] = {
12981
12982 { &hf_zbee_zcl_poll_ctrl_attr_id,
12983 { "Attribute", "zbee_zcl_general.poll.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_poll_ctrl_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_poll_ctrl_attr_names
))))
,
12984 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
12985
12986 { &hf_zbee_zcl_poll_ctrl_srv_rx_cmd_id,
12987 { "Command", "zbee_zcl_general.poll.cmd.srv_rx.id", FT_UINT8, BASE_HEX,
12988 VALS(zbee_zcl_poll_ctrl_srv_rx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_poll_ctrl_srv_rx_cmd_names
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
12989
12990 { &hf_zbee_zcl_poll_ctrl_srv_tx_cmd_id,
12991 { "Command", "zbee_zcl_general.poll.cmd.srv_tx.id", FT_UINT8, BASE_HEX,
12992 VALS(zbee_zcl_poll_ctrl_srv_tx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_poll_ctrl_srv_tx_cmd_names
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
12993
12994 { &hf_zbee_zcl_poll_ctrl_start_fast_polling,
12995 { "Start Fast Polling", "zbee_zcl_general.poll.start", FT_BOOLEAN, BASE_NONE, NULL((void*)0), 0x0,
12996 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
12997
12998 { &hf_zbee_zcl_poll_ctrl_fast_poll_timeout,
12999 { "Fast Poll Timeout (quarterseconds)", "zbee_zcl_general.poll.fast_timeout", FT_UINT16, BASE_DEC, NULL((void*)0),
13000 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
13001
13002 { &hf_zbee_zcl_poll_ctrl_new_long_poll_interval,
13003 { "New Long Poll Interval", "zbee_zcl_general.poll.new_long_interval", FT_UINT32, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0),
13004 HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
13005
13006 { &hf_zbee_zcl_poll_ctrl_new_short_poll_interval,
13007 { "New Short Poll Interval", "zbee_zcl_general.poll.new_short_interval", FT_UINT16, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0),
13008 HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}
13009 };
13010
13011 /* ZCL Poll Control subtrees */
13012 static int *ett[] = {
13013 &ett_zbee_zcl_poll_ctrl
13014 };
13015
13016 /* Register the ZigBee ZCL Poll Control cluster protocol name and description */
13017 proto_zbee_zcl_poll_ctrl = proto_register_protocol("ZigBee ZCL Poll Control", "ZCL Poll Control", ZBEE_PROTOABBREV_ZCL_POLL"zbee_zcl_general.poll");
13018 proto_register_field_array(proto_zbee_zcl_poll_ctrl, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
13019 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
13020
13021 /* Register the ZigBee ZCL Poll Control dissector. */
13022 register_dissector(ZBEE_PROTOABBREV_ZCL_POLL"zbee_zcl_general.poll", dissect_zbee_zcl_poll_ctrl, proto_zbee_zcl_poll_ctrl);
13023} /*proto_register_zbee_zcl_poll_ctrl*/
13024
13025/*FUNCTION:------------------------------------------------------
13026 * NAME
13027 * proto_reg_handoff_zbee_zcl_poll_ctrl
13028 * DESCRIPTION
13029 * Hands off the ZCL Poll Control dissector.
13030 * PARAMETERS
13031 * none
13032 * RETURNS
13033 * none
13034 *---------------------------------------------------------------
13035 */
13036void
13037proto_reg_handoff_zbee_zcl_poll_ctrl(void)
13038{
13039 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_POLL"zbee_zcl_general.poll",
13040 proto_zbee_zcl_poll_ctrl,
13041 ett_zbee_zcl_poll_ctrl,
13042 ZBEE_ZCL_CID_POLL_CONTROL0x0020,
13043 ZBEE_MFG_CODE_NONE0x0000,
13044 hf_zbee_zcl_poll_ctrl_attr_id,
13045 hf_zbee_zcl_poll_ctrl_attr_id,
13046 hf_zbee_zcl_poll_ctrl_srv_rx_cmd_id,
13047 hf_zbee_zcl_poll_ctrl_srv_tx_cmd_id,
13048 (zbee_zcl_fn_attr_data)dissect_zcl_poll_ctrl_attr_data
13049 );
13050} /*proto_reg_handoff_zbee_zcl_poll_ctrl*/
13051
13052
13053
13054/* ########################################################################## */
13055/* #### (0x0021) GREEN POWER CLUSTER ######################################## */
13056/* ########################################################################## */
13057
13058/*************************/
13059/* Defines */
13060/*************************/
13061
13062/* Green Power Attributes */
13063
13064#define ZBEE_ZCL_ATTR_GPS_MAX_SINK_TABLE_ENTRIES0x0000 0x0000
13065#define ZBEE_ZCL_ATTR_GPS_SINK_TABLE0x0001 0x0001
13066#define ZBEE_ZCL_ATTR_GPS_COMMUNICATION_MODE0x0002 0x0002
13067#define ZBEE_ZCL_ATTR_GPS_COMMISSIONING_EXIT_MODE0x0003 0x0003
13068#define ZBEE_ZCL_ATTR_GPS_COMMISSIONING_WINDOW0x0004 0x0004
13069#define ZBEE_ZCL_ATTR_GPS_SECURITY_LEVEL0x0005 0x0005
13070#define ZBEE_ZCL_ATTR_GPS_FUNCTIONALITY0x0006 0x0006
13071#define ZBEE_ZCL_ATTR_GPS_ACTIVE_FUNCTIONALITY0x0007 0x0007
13072#define ZBEE_ZCL_ATTR_GPP_MAX_PROXY_TABLE_ENTRIES0x0010 0x0010
13073#define ZBEE_ZCL_ATTR_GPP_PROXY_TABLE0x0011 0x0011
13074#define ZBEE_ZCL_ATTR_GPP_NOTIFICATION_RETRY_NUMBER0x0012 0x0012
13075#define ZBEE_ZCL_ATTR_GPP_NOTIFICATION_RETRY_TIMER0x0013 0x0013
13076#define ZBEE_ZCL_ATTR_GPP_MAX_SEARCH_COUNTER0x0014 0x0014
13077#define ZBEE_ZCL_ATTR_GPP_BLOCKED_GPDID0x0015 0x0015
13078#define ZBEE_ZCL_ATTR_GPP_FUNCTIONALITY0x0016 0x0016
13079#define ZBEE_ZCL_ATTR_GPP_ACTIVE_FUNCTIONALITY0x0017 0x0017
13080#define ZBEE_ZCL_ATTR_GP_SHARED_SECURITY_KEY_TYPE0x0020 0x0020
13081#define ZBEE_ZCL_ATTR_GP_SHARED_SECURITY_KEY0x0021 0x0021
13082#define ZBEE_ZCL_ATTR_GP_LINK_KEY0x0022 0x0022
13083
13084static const value_string zbee_zcl_gp_attr_names[] = {
13085 { ZBEE_ZCL_ATTR_GPS_MAX_SINK_TABLE_ENTRIES0x0000, "gpsMaxSinkTableEntries" },
13086 { ZBEE_ZCL_ATTR_GPS_SINK_TABLE0x0001, "SinkTable" },
13087 { ZBEE_ZCL_ATTR_GPS_COMMUNICATION_MODE0x0002, "gpsCommunicationMode" },
13088 { ZBEE_ZCL_ATTR_GPS_COMMISSIONING_EXIT_MODE0x0003, "gpsCommissioningExitMode" },
13089 { ZBEE_ZCL_ATTR_GPS_COMMISSIONING_WINDOW0x0004, "gpsCommissioningWindow" },
13090 { ZBEE_ZCL_ATTR_GPS_SECURITY_LEVEL0x0005, "gpsSecurityLevel" },
13091 { ZBEE_ZCL_ATTR_GPS_FUNCTIONALITY0x0006, "gpsFunctionality" },
13092 { ZBEE_ZCL_ATTR_GPS_ACTIVE_FUNCTIONALITY0x0007, "gpsActiveFunctionality" },
13093 { ZBEE_ZCL_ATTR_GPP_MAX_PROXY_TABLE_ENTRIES0x0010, "gppMaxProxyTableEntries" },
13094 { ZBEE_ZCL_ATTR_GPP_PROXY_TABLE0x0011, "ProxyTable" },
13095 { ZBEE_ZCL_ATTR_GPP_NOTIFICATION_RETRY_NUMBER0x0012, "gppNotificationRetryNumber" },
13096 { ZBEE_ZCL_ATTR_GPP_NOTIFICATION_RETRY_TIMER0x0013, "gppNotificationRetryTimer" },
13097 { ZBEE_ZCL_ATTR_GPP_MAX_SEARCH_COUNTER0x0014, "gppMaxSearchCounter" },
13098 { ZBEE_ZCL_ATTR_GPP_BLOCKED_GPDID0x0015, "gppBlockedGPDID" },
13099 { ZBEE_ZCL_ATTR_GPP_FUNCTIONALITY0x0016, "gppFunctionality" },
13100 { ZBEE_ZCL_ATTR_GPP_ACTIVE_FUNCTIONALITY0x0017, "gppActiveFunctionality" },
13101 { ZBEE_ZCL_ATTR_GP_SHARED_SECURITY_KEY_TYPE0x0020, "gpSharedSecurityKeyType" },
13102 { ZBEE_ZCL_ATTR_GP_SHARED_SECURITY_KEY0x0021, "gpSharedSecurityKey" },
13103 { ZBEE_ZCL_ATTR_GP_LINK_KEY0x0022, "gpLinkKey" },
13104 { 0, NULL((void*)0) }
13105};
13106
13107/* Server-to-client command IDs. */
13108#define ZBEE_ZCL_CMD_ID_GP_NOTIFICATION_RESPONSE0x00 0x00
13109#define ZBEE_ZCL_CMD_ID_GP_PAIRING0x01 0x01
13110#define ZBEE_ZCL_CMD_ID_GP_PROXY_COMMISSIONING_MODE0x02 0x02
13111#define ZBEE_ZCL_CMD_ID_GP_RESPONSE0x06 0x06
13112#define ZBEE_ZCL_CMD_ID_GP_TRANS_TBL_RESPONSE0x08 0x08
13113#define ZBEE_ZCL_CMD_ID_GP_SINK_TABLE_RESPONSE0x0a 0x0a
13114#define ZBEE_ZCL_CMD_ID_GP_PROXY_TABLE_REQUEST0x0b 0x0b
13115
13116static const value_string zbee_zcl_gp_srv_tx_cmd_names[] = {
13117 { ZBEE_ZCL_CMD_ID_GP_NOTIFICATION_RESPONSE0x00, "GP Notification Response" },
13118 { ZBEE_ZCL_CMD_ID_GP_PAIRING0x01, "GP Pairing" },
13119 { ZBEE_ZCL_CMD_ID_GP_PROXY_COMMISSIONING_MODE0x02, "GP Proxy Commissioning Mode" },
13120 { ZBEE_ZCL_CMD_ID_GP_RESPONSE0x06, "GP Response" },
13121 { ZBEE_ZCL_CMD_ID_GP_TRANS_TBL_RESPONSE0x08, "GP Translation Table Response" },
13122 { ZBEE_ZCL_CMD_ID_GP_SINK_TABLE_RESPONSE0x0a, "GP Sink Table Response" },
13123 { ZBEE_ZCL_CMD_ID_GP_PROXY_TABLE_REQUEST0x0b, "GP Proxy Table Request" },
13124 { 0, NULL((void*)0) }
13125};
13126
13127/* Client-to-server command IDs. */
13128#define ZBEE_CMD_ID_GP_NOTIFICATION0x00 0x00
13129#define ZBEE_CMD_ID_GP_PAIRING_SEARCH0x01 0x01
13130#define ZBEE_CMD_ID_GP_TUNNELING_STOP0x03 0x03
13131#define ZBEE_CMD_ID_GP_COMMISSIONING_NOTIFICATION0x04 0x04
13132#define ZBEE_CMD_ID_GP_SINK_COMMISSIONING_MODE0x05 0x05
13133#define ZBEE_CMD_ID_GP_TRANSLATION_TABLE_UPDATE_COMMAND0x07 0x07
13134#define ZBEE_CMD_ID_GP_TRANSLATION_TABLE_REQUEST0x08 0x08
13135#define ZBEE_CMD_ID_GP_PAIRING_CONFIGURATION0x09 0x09
13136#define ZBEE_CMD_ID_GP_SINK_TABLE_REQUEST0x0a 0x0a
13137#define ZBEE_CMD_ID_GP_PROXY_TABLE_RESPONSE0x0b 0x0b
13138
13139static const value_string zbee_zcl_gp_srv_rx_cmd_names[] = {
13140 { ZBEE_CMD_ID_GP_NOTIFICATION0x00, "GP Notification" },
13141 { ZBEE_CMD_ID_GP_PAIRING_SEARCH0x01, "GP Pairing Search" },
13142 { ZBEE_CMD_ID_GP_TUNNELING_STOP0x03, "GP Tunneling Stop" },
13143 { ZBEE_CMD_ID_GP_COMMISSIONING_NOTIFICATION0x04, "GP Commissioning Notification" },
13144 { ZBEE_CMD_ID_GP_SINK_COMMISSIONING_MODE0x05, "GP Sink Commissioning Mode" },
13145 { ZBEE_CMD_ID_GP_TRANSLATION_TABLE_UPDATE_COMMAND0x07, "GP Translation Table Update" },
13146 { ZBEE_CMD_ID_GP_TRANSLATION_TABLE_REQUEST0x08, "GP Translation Table Request" },
13147 { ZBEE_CMD_ID_GP_PAIRING_CONFIGURATION0x09, "GP Pairing Configuration" },
13148 { ZBEE_CMD_ID_GP_SINK_TABLE_REQUEST0x0a, "GP Sink Table Request" },
13149 { ZBEE_CMD_ID_GP_PROXY_TABLE_RESPONSE0x0b, "GP Proxy Table Response" },
13150 { 0, NULL((void*)0) }
13151};
13152
13153static const value_string zbee_zcl_gp_comm_mode_actions[] = {
13154 { 0, "Exit commissioning mode" },
13155 { 1, "Enter commissioning mode" },
13156 { 0, NULL((void*)0) }
13157};
13158
13159static const value_string zbee_zcl_gp_app_ids[] = {
13160 { 0, "0b000 4b SrcID; no Endpoint" },
13161 { 2, "0b010 8b IEEE; Endpoint presents" },
13162 { 0, NULL((void*)0) }
13163};
13164
13165static const value_string zbee_zcl_gp_secur_levels[] = {
13166 { 0, "No security" },
13167 { 1, "Reserved" },
13168 { 2, "4B frame counter and 4B MIC only" },
13169 { 3, "Encryption & 4B frame counter and 4B MIC" },
13170 { 0, NULL((void*)0) }
13171};
13172
13173static const value_string zbee_zcl_gp_secur_key_types[] = {
13174 { 0, "No key" },
13175 { 1, "ZigBee NWK key" },
13176 { 2, "GPD group key" },
13177 { 3, "NWK-key derived GPD group key" },
13178 { 4, "(individual) out-of-the-box GPD key" },
13179 { 7, "Derived individual GPD key" },
13180 { 0, NULL((void*)0) }
13181};
13182
13183static const value_string zbee_zcl_gp_communication_modes[] = {
13184 { 0, "Full unicast" },
13185 { 1, "Groupcast to DGroupID" },
13186 { 2, "Groupcast to pre-commissioned GroupID" },
13187 { 3, "Lightweight unicast" },
13188 { 0, NULL((void*)0) }
13189};
13190
13191static const value_string zbee_zcl_gp_lqi_vals[] = {
13192 { 0, "Poor" },
13193 { 1, "Moderate" },
13194 { 2, "High" },
13195 { 3, "Excellent" },
13196 { 0, NULL((void*)0) }
13197};
13198
13199static const value_string zbee_zcl_gp_channels[] = {
13200 { 0, "Channel 11" },
13201 { 1, "Channel 12" },
13202 { 2, "Channel 13" },
13203 { 3, "Channel 14" },
13204 { 4, "Channel 15" },
13205 { 5, "Channel 16" },
13206 { 6, "Channel 17" },
13207 { 7, "Channel 18" },
13208 { 8, "Channel 19" },
13209 { 9, "Channel 20" },
13210 { 10, "Channel 21" },
13211 { 11, "Channel 22" },
13212 { 12, "Channel 23" },
13213 { 13, "Channel 24" },
13214 { 14, "Channel 25" },
13215 { 15, "Channel 26" },
13216 { 0, NULL((void*)0) }
13217};
13218
13219static const value_string zbee_gp_pc_actions[] = {
13220 { 0, "No action" },
13221 { 1, "Extend Sink Table entry" },
13222 { 2, "Replace Sink Table entry" },
13223 { 3, "Remove a pairing" },
13224 { 4, "Remove GPD" },
13225 { 0, NULL((void*)0) }
13226};
13227
13228static const value_string zbee_zcl_gp_proxy_sink_tbl_req_type[] = {
13229 { 0, "Request table entries by GPD ID" },
13230 { 1, "Request table entries by Index" },
13231 { 0, NULL((void*)0) }
13232};
13233
13234#define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ACTION1 1
13235#define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_EXIT_MODE(7<<1) (7<<1)
13236#define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_COMMISSIONING_WINDOW_EXPIRATION((1<<0)<<1) ((1<<0)<<1)
13237#define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_PAIRING_SUCCESS((1<<1)<<1) ((1<<1)<<1)
13238#define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_GP_PROXY_COMM_MODE((1<<2)<<1) ((1<<2)<<1)
13239#define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_CHANNEL_PRESENT(1<<4) (1<<4)
13240#define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_UNICAST(1<<5) (1<<5)
13241
13242
13243#define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_APP_ID(7<<0) (7<<0)
13244#define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_RX_AFTER_TX(1<<3) (1<<3)
13245#define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_LEVEL(3<<4) (3<<4)
13246#define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_KEY_TYPE(7<<6) (7<<6)
13247#define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_FAILED(1<<9) (1<<9)
13248#define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_BIDIR_CAP(1<<10) (1<<10)
13249#define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_PROXY_INFO_PRESENT(1<<11) (1<<11)
13250
13251#define ZBEE_ZCL_GP_GPP_GPD_LINK_RSSI0x3f 0x3f
13252#define ZBEE_ZCL_GP_GPP_GPD_LINK_LQI(3<<6) (3<<6)
13253
13254#define ZBEE_ZCL_GP_NOTIFICATION_OPTION_APP_ID(7<<0) (7<<0)
13255#define ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_UNICAST(1<<3) (1<<3)
13256#define ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_DERIVED_GROUP(1<<4) (1<<4)
13257#define ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_COMMISSIONED_GROUP(1<<5) (1<<5)
13258#define ZBEE_ZCL_GP_NOTIFICATION_OPTION_SECUR_LEVEL(3<<6) (3<<6)
13259#define ZBEE_ZCL_GP_NOTIFICATION_OPTION_SECUR_KEY_TYPE(7<<8) (7<<8)
13260#define ZBEE_ZCL_GP_NOTIFICATION_OPTION_RX_AFTER_TX(1<<11) (1<<11)
13261#define ZBEE_ZCL_GP_NOTIFICATION_OPTION_TX_Q_FULL(1<<12) (1<<12)
13262#define ZBEE_ZCL_GP_NOTIFICATION_OPTION_BIDIR_CAP(1<<13) (1<<13)
13263#define ZBEE_ZCL_GP_NOTIFICATION_OPTION_PROXY_INFO_PRESENT(1<<14) (1<<14)
13264
13265#define ZBEE_ZCL_GP_PAIRING_OPTION_APP_ID(7<<0) (7<<0)
13266#define ZBEE_ZCL_GP_PAIRING_OPTION_ADD_SINK(1<<3) (1<<3)
13267#define ZBEE_ZCL_GP_PAIRING_OPTION_REMOVE_GPD(1<<4) (1<<4)
13268#define ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE(3<<5) (3<<5)
13269#define ZBEE_ZCL_GP_PAIRING_OPTION_GPD_FIXED(1<<7) (1<<7)
13270#define ZBEE_ZCL_GP_PAIRING_OPTION_GPD_MAC_SEQ_NUM_CAP(1<<8) (1<<8)
13271#define ZBEE_ZCL_GP_PAIRING_OPTION_SECUR_LEVEL(3<<9) (3<<9)
13272#define ZBEE_ZCL_GP_PAIRING_OPTION_SECUR_KEY_TYPE(7<<11) (7<<11)
13273#define ZBEE_ZCL_GP_PAIRING_OPTION_GPD_FRAME_CNT_PRESENT(1<<14) (1<<14)
13274#define ZBEE_ZCL_GP_PAIRING_OPTION_GPD_SECUR_KEY_PRESENT(1<<15) (1<<15)
13275#define ZBEE_ZCL_GP_PAIRING_OPTION_ASSIGNED_ALIAS_PRESENT(1<<16) (1<<16)
13276#define ZBEE_ZCL_GP_PAIRING_OPTION_FWD_RADIUS_PRESENT(1<<17) (1<<17)
13277
13278#define ZBEE_ZCL_GP_RESPONSE_OPTION_APP_ID(7<<0) (7<<0)
13279#define ZBEE_ZCL_GP_RESPONSE_OPTION_TX_ON_ENDPOINT_MATCH(1<<3) (1<<3)
13280
13281#define ZBEE_ZCL_GP_RESPONSE_TX_CHANNEL(0xf<<0) (0xf<<0)
13282
13283#define ZBEE_ZCL_GP_CMD_PC_ACTIONS_ACTION(7<<0) (7<<0)
13284#define ZBEE_ZCL_GP_CMD_PC_ACTIONS_SEND_GP_PAIRING(1<<3) (1<<3)
13285
13286#define ZBEE_ZCL_GP_CMD_PC_OPT_APP_ID(7<<0) (7<<0)
13287#define ZBEE_ZCL_GP_CMD_PC_OPT_COMMUNICATION_MODE(3<<3) (3<<3)
13288#define ZBEE_ZCL_GP_CMD_PC_OPT_SEQ_NUMBER_CAP(1<<5) (1<<5)
13289#define ZBEE_ZCL_GP_CMD_PC_OPT_RX_ON_CAP(1<<6) (1<<6)
13290#define ZBEE_ZCL_GP_CMD_PC_OPT_FIXED_LOCATION(1<<7) (1<<7)
13291#define ZBEE_ZCL_GP_CMD_PC_OPT_ASSIGNED_ALIAS(1<<8) (1<<8)
13292#define ZBEE_ZCL_GP_CMD_PC_OPT_SECURITY_USE(1<<9) (1<<9)
13293#define ZBEE_ZCL_GP_CMD_PC_OPT_APP_INFO_PRESENT(1<<10) (1<<10)
13294#define ZBEE_ZCL_GP_COMMUNICATION_MODE_GROUPCAST_PRECOMMISSIONED2 2
13295#define ZBEE_ZCL_GP_PAIRING_CONFIGURATION_OPTION_COMMUNICATION_MODE_SHIFT3 3
13296#define ZBEE_ZCL_GP_CMD_PC_SECUR_LEVEL(3<<0) (3<<0)
13297#define ZBEE_ZCL_GP_CMD_PC_SECUR_KEY_TYPE(7<<2) (7<<2)
13298#define ZBEE_ZCL_GP_CMD_PC_APP_INFO_MANUF_ID_PRESENT(1<<0) (1<<0)
13299#define ZBEE_ZCL_GP_CMD_PC_APP_INFO_MODEL_ID_PRESENT(1<<1) (1<<1)
13300#define ZBEE_ZCL_GP_CMD_PC_APP_INFO_GPD_COMMANDS_PRESENT(1<<2) (1<<2)
13301#define ZBEE_ZCL_GP_CMD_PC_APP_INFO_CLUSTER_LIST_PRESENT(1<<3) (1<<3)
13302#define ZBEE_ZCL_GP_CLUSTER_LIST_LEN_SRV(0xf<<0) (0xf<<0)
13303#define ZBEE_ZCL_GP_CLUSTER_LIST_LEN_CLI(0xf<<4) (0xf<<4)
13304#define ZBEE_ZCL_GP_CLUSTER_LIST_LEN_CLI_SHIFT4 4
13305
13306#define ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_APP_ID(0x07<<0) (0x07<<0)
13307#define ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_REQ_TYPE(0x03<<3) (0x03<<3)
13308#define ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_REQ_TYPE_SHIFT3 3
13309
13310#define ZBEE_ZCL_GP_SINK_TBL_OPT_APP_ID(7<<0) (7<<0)
13311#define ZBEE_ZCL_GP_SINK_TBL_OPT_COMMUNICATION_MODE(3<<3) (3<<3)
13312#define ZBEE_ZCL_GP_SINK_TBL_OPT_SEQ_NUMBER_CAP(1<<5) (1<<5)
13313#define ZBEE_ZCL_GP_SINK_TBL_OPT_RX_ON_CAP(1<<6) (1<<6)
13314#define ZBEE_ZCL_GP_SINK_TBL_OPT_FIXED_LOCATION(1<<7) (1<<7)
13315#define ZBEE_ZCL_GP_SINK_TBL_OPT_ASSIGNED_ALIAS(1<<8) (1<<8)
13316#define ZBEE_ZCL_GP_SINK_TBL_OPT_SECURITY_USE(1<<9) (1<<9)
13317
13318#define ZBEE_ZCL_GP_PROXY_TBL_OPT_APP_ID(7<<0) (7<<0)
13319#define ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_ACTIVE(1<<3) (1<<3)
13320#define ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_VALID(1<<4) (1<<4)
13321#define ZBEE_ZCL_GP_PROXY_TBL_OPT_SEQ_NUMBER_CAP(1<<5) (1<<5)
13322#define ZBEE_ZCL_GP_PROXY_TBL_OPT_LW_UCAST_GPS(1<<6) (1<<6)
13323#define ZBEE_ZCL_GP_PROXY_TBL_OPT_DERIVED_GROUP_GPS(1<<7) (1<<7)
13324#define ZBEE_ZCL_GP_PROXY_TBL_OPT_COMM_GROUP_GPS(1<<8) (1<<8)
13325#define ZBEE_ZCL_GP_PROXY_TBL_OPT_FIRST_TO_FORWARD(1<<9) (1<<9)
13326#define ZBEE_ZCL_GP_PROXY_TBL_OPT_IN_RANGE(1<<10) (1<<10)
13327#define ZBEE_ZCL_GP_PROXY_TBL_OPT_GPD_FIXED(1<<11) (1<<11)
13328#define ZBEE_ZCL_GP_PROXY_TBL_OPT_HAS_ALL_UCAST_ROUTES(1<<12) (1<<12)
13329#define ZBEE_ZCL_GP_PROXY_TBL_OPT_ASSIGNED_ALIAS(1<<13) (1<<13)
13330#define ZBEE_ZCL_GP_PROXY_TBL_OPT_SECURITY_USE(1<<14) (1<<14)
13331#define ZBEE_ZCL_GP_PROXY_TBL_OPT_OPTIONS_EXTENTIONS(1<<15) (1<<15)
13332
13333#define ZBEE_ZCL_GP_PROXY_TBL_EXT_OPT_FULL_UCAST_GPS(1<<0) (1<<0)
13334
13335#define ZBEE_ZCL_GP_SECUR_OPT_SECUR_LEVEL(3<<0) (3<<0)
13336#define ZBEE_ZCL_GP_SECUR_OPT_SECUR_KEY_TYPE(7<<2) (7<<2)
13337
13338/* Sink Commissioning Mode command */
13339#define ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_ACTION(1<<0) (1<<0)
13340#define ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_GPM_IN_SECUR(1<<1) (1<<1)
13341#define ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_GPM_IN_PAIRING(1<<2) (1<<2)
13342#define ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_PROXIES(1<<3) (1<<3)
13343
13344/* gppFunctionality attribute */
13345#define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GP_FEATURE(1<<0) (1<<0)
13346#define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_DIRECT_COMM(1<<1) (1<<1)
13347#define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_DERIVED_GCAST_COMM(1<<2) (1<<2)
13348#define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_PRE_COMMISSIONED_GCAST_COMM(1<<3) (1<<3)
13349#define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_FULL_UCAST_COMM(1<<4) (1<<4)
13350#define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_LW_UCAST_COMM(1<<5) (1<<5)
13351#define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_BIDIR_OP(1<<7) (1<<7)
13352#define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_PROXY_TBL_MAINTENANCE(1<<8) (1<<8)
13353#define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GP_COMMISSIONING(1<<10) (1<<10)
13354#define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_CT_BASED_COMMISSIONING(1<<11) (1<<11)
13355#define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_MAINTENANCE_OF_GPD(1<<12) (1<<12)
13356#define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_00(1<<13) (1<<13)
13357#define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_01(1<<14) (1<<14)
13358#define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_10(1<<15) (1<<15)
13359#define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_11(1<<16) (1<<16)
13360#define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_IEEE_ADDRESS(1<<19) (1<<19)
13361/* gppActiveFunctionality attribute */
13362#define ZBEE_ZCL_GP_ATTR_GPP_ACTIVE_FUNC_FLD_GP_FUNCTIONALITY(1<<0) (1<<0)
13363
13364/* gpsFunctionality attribute */
13365#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GP_FEATURE(1<<0) (1<<0)
13366#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_DIRECT_COMM(1<<1) (1<<1)
13367#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_DERIVED_GCAST_COMM(1<<2) (1<<2)
13368#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PRE_COMMISSIONED_GCAST_COMM(1<<3) (1<<3)
13369#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_FULL_UCAST_COMM(1<<4) (1<<4)
13370#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_LW_UCAST_COMM(1<<5) (1<<5)
13371#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXIMITY_BIDIR_OP(1<<6) (1<<6)
13372#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MULTI_HOP_BIDIR_OP(1<<7) (1<<7)
13373#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXY_TBL_MAINTENANCE(1<<8) (1<<8)
13374#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXIMITY_COMMISSIONING(1<<9) (1<<9)
13375#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MULTI_HOP_COMMISSIONING(1<<10) (1<<10)
13376#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_CT_BASED_COMMISSIONING(1<<11) (1<<11)
13377#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MAINTENANCE_OF_GPD(1<<12) (1<<12)
13378#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_00(1<<13) (1<<13)
13379#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_01(1<<14) (1<<14)
13380#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_10(1<<15) (1<<15)
13381#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_11(1<<16) (1<<16)
13382#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_SINK_TBL_BASED_GCAST_FORWARDING(1<<17) (1<<17)
13383#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_TRANSLATION_TABLE(1<<18) (1<<18)
13384#define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_IEEE_ADDRESS(1<<19) (1<<19)
13385/* gpsActiveFunctionality attribute */
13386#define ZBEE_ZCL_GP_ATTR_GPS_ACTIVE_FUNC_FLD_GP_FUNCTIONALITY(1<<0) (1<<0)
13387
13388/* gpsCommissioningExitMode attribute */
13389#define ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_COMM_WINDOW_EXPIRE(1<<0) (1<<0)
13390#define ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_PAIRING_SUCCESS(1<<1) (1<<1)
13391#define ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_GP_PROXY_COMM_MODE(1<<2) (1<<2)
13392
13393/* gpsCommunicationMode attribute */
13394#define ZBEE_ZCL_GP_ATTR_GPS_COMMUNICATION_MODE_FLD_MODE(3<<0) (3<<0)
13395
13396/* gpsSecurityLevel attribute */
13397#define ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_MIN_GPD_SECUR_LVL(3<<0) (3<<0)
13398#define ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_PROTECTION_WITH_GP_LINK_KEY(1<<2) (1<<2)
13399#define ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_INVOLVE_TC(1<<3) (1<<3)
13400
13401/* Definitions for application IDs. */
13402#define ZBEE_ZCL_GP_APP_ID_DEFAULT0x00 0x00
13403#define ZBEE_ZCL_GP_APP_ID_ZGP0x02 0x02
13404
13405/** Definitions for Request type sub-field of the Options field of the
13406 * GP Sink Table Request and GP Proxy Table request commands
13407 */
13408#define ZBEE_ZCL_GP_PROXY_SINK_TABLE_REQ_CMD_REQUSET_BY_GPD_ID0 0
13409#define ZBEE_ZCL_GP_PROXY_SINK_TABLE_REQ_CMD_REQUSET_BY_INDEX1 1
13410
13411/*************************/
13412/* Global Variables */
13413/*************************/
13414/* Initialize the protocol and registered fields */
13415static int proto_zbee_zcl_gp;
13416
13417static int hf_zbee_zcl_gp_attr_id;
13418static int hf_zbee_zcl_gp_srv_rx_cmd_id;
13419static int hf_zbee_zcl_gp_srv_tx_cmd_id;
13420
13421static int ett_zbee_zcl_gp;
13422
13423/* GP_PROXY_COMMISSIONING_MODE */
13424static int ett_zbee_gp_cmd_proxy_commissioning_mode_options;
13425static int ett_zbee_gp_cmd_proxy_commissioning_mode_exit_mode;
13426static int hf_zbee_gp_cmd_proxy_commissioning_mode_options;
13427static int hf_zbee_gp_cmd_pcm_opt_action;
13428static int hf_zbee_gp_cmd_pcm_opt_exit_mode;
13429static int hf_zbee_gp_cmd_pcm_opt_channel_present;
13430static int hf_zbee_gp_cmd_pcm_opt_unicast_comm;
13431static int hf_zbee_gp_cmd_proxy_commissioning_mode_exit_mode;
13432static int hf_zbee_gp_cmd_pcm_exit_mode_on_comm_window_expire;
13433static int hf_zbee_gp_cmd_pcm_exit_mode_on_pairing_success;
13434static int hf_zbee_gp_cmd_pcm_exit_mode_on_gp_proxy_comm_mode;
13435static int hf_zbee_zcl_gp_commissioning_window;
13436static int hf_zbee_zcl_gp_channel;
13437
13438/* GP_COMMISSIONING_NOTIFICATION */
13439static int hf_zbee_gp_cmd_comm_notif_opt_app_id;
13440static int hf_zbee_gp_cmd_comm_notif_opt_rx_after_tx;
13441static int hf_zbee_gp_cmd_comm_notif_opt_secur_level;
13442static int hf_zbee_gp_cmd_comm_notif_opt_secur_key_type;
13443static int hf_zbee_gp_cmd_comm_notif_opt_secur_fail;
13444static int hf_zbee_gp_cmd_comm_notif_opt_bidir_cap;
13445static int hf_zbee_gp_cmd_comm_notif_opt_proxy_info_present;
13446static int hf_zbee_gp_cmd_commissioning_notification_options;
13447static int ett_zbee_gp_cmd_commissioning_notification_options;
13448static int hf_zbee_gp_src_id;
13449static int hf_zbee_gp_ieee;
13450static int hf_zbee_gp_endpoint;
13451static int hf_zbee_gp_secur_frame_counter;
13452static int hf_zbee_gp_gpd_command_id;
13453static int hf_zbee_gp_short_addr;
13454static int hf_zbee_gp_gpp_gpd_link;
13455static int hf_zbee_gp_mic;
13456static int ett_zbee_gp_gpp_gpd_link;
13457static int hf_zbee_gpp_gpd_link_rssi;
13458static int hf_zbee_gpp_gpd_link_lqi;
13459static int hf_zbee_gp_gpd_payload_size;
13460
13461
13462/* GP_NOTIFICATION */
13463static int hf_zbee_gp_cmd_notification_options;
13464static int ett_zbee_gp_cmd_notification_options;
13465static int hf_zbee_gp_cmd_notif_opt_app_id;
13466static int hf_zbee_gp_cmd_notif_opt_also_unicast;
13467static int hf_zbee_gp_cmd_notif_opt_also_derived_group;
13468static int hf_zbee_gp_cmd_notif_opt_also_comm_group;
13469static int hf_zbee_gp_cmd_notif_opt_secur_level;
13470static int hf_zbee_gp_cmd_notif_opt_secur_key_type;
13471static int hf_zbee_gp_cmd_notif_opt_rx_after_tx;
13472static int hf_zbee_gp_cmd_notif_opt_tx_q_full;
13473static int hf_zbee_gp_cmd_notif_opt_bidir_cap;
13474static int hf_zbee_gp_cmd_notif_opt_proxy_info_present;
13475
13476/* GP_PAIRING */
13477static int hf_zbee_gp_cmd_pairing_opt_app_id;
13478static int hf_zbee_gp_cmd_pairing_opt_add_sink;
13479static int hf_zbee_gp_cmd_pairing_opt_remove_gpd;
13480static int hf_zbee_gp_cmd_pairing_opt_communication_mode;
13481static int hf_zbee_gp_cmd_pairing_opt_gpd_fixed;
13482static int hf_zbee_gp_cmd_pairing_opt_gpd_mac_seq_num_cap;
13483static int hf_zbee_gp_cmd_pairing_opt_secur_level;
13484static int hf_zbee_gp_cmd_pairing_opt_secur_key_type;
13485static int hf_zbee_gp_cmd_pairing_opt_gpd_frame_cnt_present;
13486static int hf_zbee_gp_cmd_pairing_opt_gpd_secur_key_present;
13487static int hf_zbee_gp_cmd_pairing_opt_assigned_alias_present;
13488static int hf_zbee_gp_cmd_pairing_opt_fwd_radius_present;
13489static int hf_zbee_gp_cmd_pairing_options;
13490static int ett_zbee_gp_cmd_pairing_options;
13491static int hf_zbee_gp_sink_ieee;
13492static int hf_zbee_gp_sink_nwk;
13493static int hf_zbee_gp_sink_group_id;
13494static int hf_zbee_gp_device_id;
13495static int hf_zbee_gp_assigned_alias;
13496static int hf_zbee_gp_forwarding_radius;
13497static int hf_zbee_gp_gpd_key;
13498static int hf_zbee_gp_groupcast_radius;
13499
13500/* GP Response */
13501static int hf_zbee_gp_cmd_response_options;
13502static int ett_zbee_gp_cmd_response_options;
13503static int hf_zbee_gp_cmd_response_tx_channel;
13504static int ett_zbee_gp_cmd_response_tx_channel;
13505static int hf_zbee_gp_cmd_resp_opt_app_id;
13506static int hf_zbee_gp_cmd_resp_opt_tx_on_ep_match;
13507static int hf_zbee_gp_tmp_master_short_addr;
13508static int hf_zbee_gp_cmd_resp_tx_channel;
13509
13510/* GP_PAIRING_CONFIGURATION */
13511static int hf_zbee_gp_cmd_pc_actions_action;
13512static int hf_zbee_gp_cmd_pc_actions_send_gp_pairing;
13513static int hf_zbee_gp_cmd_pc_opt_app_id;
13514static int hf_zbee_gp_cmd_pc_opt_communication_mode;
13515static int hf_zbee_gp_cmd_pc_opt_seq_number_cap;
13516static int hf_zbee_gp_cmd_px_opt_rx_on_cap;
13517static int hf_zbee_gp_cmd_pc_opt_fixed_location;
13518static int hf_zbee_gp_cmd_pc_opt_assigned_alias;
13519static int hf_zbee_gp_cmd_pc_opt_security_use;
13520static int hf_zbee_gp_cmd_pc_opt_app_info_present;
13521static int hf_zbee_gp_cmd_pc_secur_level;
13522static int hf_zbee_gp_cmd_pc_secur_key_type;
13523static int hf_zbee_gp_cmd_pc_app_info_manuf_id_present;
13524static int hf_zbee_gp_cmd_pc_app_info_model_id_present;
13525static int hf_zbee_gp_cmd_pc_app_info_gpd_commands_present;
13526static int hf_zbee_gp_cmd_pc_app_info_cluster_list_present;
13527static int hf_zbee_gp_cmd_pc_actions;
13528static int ett_zbee_gp_cmd_pc_actions;
13529static int hf_zbee_gp_cmd_pc_options;
13530static int ett_zbee_gp_cmd_pc_options;
13531static int ett_zbee_zcl_gp_group_list;
13532static int hf_zbee_gp_group_list_len;
13533static int hf_zbee_gp_group_list_group_id;
13534static int hf_zbee_gp_group_list_alias;
13535static int hf_zbee_gp_cmd_pc_secur_options;
13536static int ett_zbee_gp_cmd_pc_secur_options;
13537static int hf_zbee_gp_n_paired_endpoints;
13538static int hf_zbee_gp_paired_endpoint;
13539static int hf_zbee_gp_cmd_pc_app_info;
13540static int ett_zbee_gp_cmd_pc_app_info;
13541static int hf_zbee_zcl_gp_manufacturer_id;
13542static int hf_zbee_zcl_gp_model_id;
13543static int hf_zbee_gp_n_gpd_commands;
13544static int hf_zbee_gp_gpd_command;
13545static int hf_zbee_gp_n_srv_clusters;
13546static int hf_zbee_gp_n_cli_clusters;
13547static int hf_zbee_gp_gpd_cluster_id;
13548static int ett_zbee_zcl_gp_ep;
13549static int ett_zbee_zcl_gp_cmds;
13550static int ett_zbee_zcl_gp_clusters;
13551static int ett_zbee_zcl_gp_srv_clusters;
13552static int ett_zbee_zcl_gp_cli_clusters;
13553
13554/* GP_SINK_TABLE_REQUEST and GP_PROXY_TABLE_REQUEST */
13555static int ett_zbee_zcl_proxy_sink_tbl_req_options;
13556static int hf_zbee_zcl_proxy_sink_tbl_req_options;
13557static int hf_zbee_zcl_proxy_sink_tbl_req_fld_app_id;
13558static int hf_zbee_zcl_proxy_sink_tbl_req_fld_req_type;
13559static int hf_zbee_zcl_proxy_sink_tbl_req_index;
13560
13561/* GP_SINK_TABLE_RESPONSE and GP_PROXY_TABLE_RESPONSE */
13562static int hf_zbee_zcl_proxy_sink_tbl_resp_status;
13563static int hf_zbee_zcl_proxy_sink_tbl_resp_entries_total;
13564static int hf_zbee_zcl_proxy_sink_tbl_resp_start_index;
13565static int hf_zbee_zcl_proxy_sink_tbl_resp_entries_count;
13566
13567/* GP SINK_COMMISSIONING_MODE */
13568static int ett_zbee_zcl_gp_cmd_sink_comm_mode_options;
13569static int hf_zbee_zcl_gp_cmd_sink_comm_mode_options;
13570
13571static int hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_action;
13572static int hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_secur;
13573static int hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_pairing;
13574static int hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_proxies;
13575
13576static int hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_secur;
13577static int hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_pairing;
13578static int hf_zbee_gp_zcl_cmd_sink_comm_mode_sink_ep;
13579
13580/* GP Sink Table Attribute */
13581static int ett_zbee_gp_sink_tbl;
13582static int ett_zbee_gp_sink_tbl_entry;
13583static int ett_zbee_gp_sink_tbl_entry_options;
13584
13585static int hf_zbee_gp_sink_tbl_length;
13586static int hf_zbee_gp_sink_tbl_entry_options;
13587
13588static int hf_zbee_gp_sink_tbl_entry_options_app_id;
13589static int hf_zbee_gp_sink_tbl_entry_options_comm_mode;
13590static int hf_zbee_gp_sink_tbl_entry_options_seq_num_cap;
13591static int hf_zbee_gp_sink_tbl_entry_options_rx_on_cap;
13592static int hf_zbee_gp_sink_tbl_entry_options_fixed_loc;
13593static int hf_zbee_gp_sink_tbl_entry_options_assigned_alias;
13594static int hf_zbee_gp_sink_tbl_entry_options_sec_use;
13595
13596static int ett_zbee_gp_sec_options;
13597static int hf_zbee_gp_sec_options;
13598static int hf_zbee_gp_sec_options_sec_level;
13599static int hf_zbee_gp_sec_options_sec_key_type;
13600
13601/* GP Proxy Table Attribute */
13602static int ett_zbee_gp_proxy_tbl;
13603static int ett_zbee_gp_proxy_tbl_entry;
13604static int ett_zbee_gp_proxy_tbl_entry_options;
13605static int ett_zbee_gp_proxy_tbl_entry_ext_options;
13606
13607static int hf_zbee_gp_proxy_tbl_length;
13608static int hf_zbee_gp_proxy_tbl_entry_options;
13609static int hf_zbee_gp_proxy_tbl_entry_ext_options;
13610
13611static int hf_zbee_gp_proxy_tbl_entry_options_app_id;
13612static int hf_zbee_gp_proxy_tbl_entry_options_entry_active;
13613static int hf_zbee_gp_proxy_tbl_entry_options_entry_valid;
13614static int hf_zbee_gp_proxy_tbl_entry_options_seq_num_cap;
13615static int hf_zbee_gp_proxy_tbl_entry_options_lw_ucast_gps;
13616static int hf_zbee_gp_proxy_tbl_entry_options_derived_group_gps;
13617static int hf_zbee_gp_proxy_tbl_entry_options_comm_group_gps;
13618static int hf_zbee_gp_proxy_tbl_entry_options_first_to_forward;
13619static int hf_zbee_gp_proxy_tbl_entry_options_in_range;
13620static int hf_zbee_gp_proxy_tbl_entry_options_gpd_fixed;
13621static int hf_zbee_gp_proxy_tbl_entry_options_has_all_ucast_routes;
13622static int hf_zbee_gp_proxy_tbl_entry_options_assigned_alias;
13623static int hf_zbee_gp_proxy_tbl_entry_options_sec_use;
13624static int hf_zbee_gp_proxy_tbl_entry_options_opt_ext;
13625
13626static int hf_zbee_gp_proxy_tbl_entry_search_counter;
13627
13628static int hf_zbee_gp_proxy_tbl_entry_ext_options_full_ucast_gps;
13629
13630static int ett_zbee_gp_sink_address_list;
13631static int hf_zbee_gp_sink_address_list_length;
13632
13633/* GP gppFunctionality Attribute */
13634static int ett_zbee_zcl_gp_attr_gpp_func;
13635static int hf_zbee_zcl_gp_attr_gpp_func;
13636
13637static int hf_zbee_zcl_gp_attr_gpp_func_fld_gp_feature;
13638static int hf_zbee_zcl_gp_attr_gpp_func_fld_direct_comm;
13639static int hf_zbee_zcl_gp_attr_gpp_func_fld_derived_gcast_comm;
13640static int hf_zbee_zcl_gp_attr_gpp_func_fld_pre_commissioned_gcast_comm;
13641static int hf_zbee_zcl_gp_attr_gpp_func_fld_full_ucast_comm;
13642static int hf_zbee_zcl_gp_attr_gpp_func_fld_lw_ucast_comm;
13643static int hf_zbee_zcl_gp_attr_gpp_func_fld_bidir_op;
13644static int hf_zbee_zcl_gp_attr_gpp_func_fld_proxy_tbl_maintenance;
13645static int hf_zbee_zcl_gp_attr_gpp_func_fld_gp_commissioning;
13646static int hf_zbee_zcl_gp_attr_gpp_func_fld_ct_based_commissioning;
13647static int hf_zbee_zcl_gp_attr_gpp_func_fld_maintenance_of_gpd;
13648static int hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_00;
13649static int hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_01;
13650static int hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_10;
13651static int hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_11;
13652static int hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_ieee_address;
13653
13654/* GP gppActiveFunctionality Attribute */
13655static int ett_zbee_zcl_gp_attr_gpp_active_func;
13656static int hf_zbee_zcl_gp_attr_gpp_active_func;
13657static int hf_zbee_zcl_gp_attr_gpp_active_func_fld_gp_functionality;
13658
13659/* GP gpsFunctionality Attribute */
13660static int ett_zbee_zcl_gp_attr_gps_func;
13661static int hf_zbee_zcl_gp_attr_gps_func;
13662
13663static int hf_zbee_zcl_gp_attr_gps_func_fld_gp_feature;
13664static int hf_zbee_zcl_gp_attr_gps_func_fld_direct_comm;
13665static int hf_zbee_zcl_gp_attr_gps_func_fld_derived_gcast_comm;
13666static int hf_zbee_zcl_gp_attr_gps_func_fld_pre_commissioned_gcast_comm;
13667static int hf_zbee_zcl_gp_attr_gps_func_fld_full_ucast_comm;
13668static int hf_zbee_zcl_gp_attr_gps_func_fld_lw_ucast_comm;
13669static int hf_zbee_zcl_gp_attr_gps_func_fld_proximity_bidir_op;
13670static int hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_bidir_op;
13671static int hf_zbee_zcl_gp_attr_gps_func_fld_proxy_tbl_maintenance;
13672static int hf_zbee_zcl_gp_attr_gps_func_fld_proximity_commissioning;
13673static int hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_commissioning;
13674static int hf_zbee_zcl_gp_attr_gps_func_fld_ct_based_commissioning;
13675static int hf_zbee_zcl_gp_attr_gps_func_fld_maintenance_of_gpd;
13676static int hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_00;
13677static int hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_01;
13678static int hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_10;
13679static int hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_11;
13680static int hf_zbee_zcl_gp_attr_gps_func_fld_sink_tbl_based_gcast_forwarding;
13681static int hf_zbee_zcl_gp_attr_gps_func_fld_translation_table;
13682static int hf_zbee_zcl_gp_attr_gps_func_fld_gpd_ieee_address;
13683
13684/* GP gppActiveFunctionality Attribute */
13685static int ett_zbee_zcl_gp_attr_gps_active_func;
13686static int hf_zbee_zcl_gp_attr_gps_active_func;
13687static int hf_zbee_zcl_gp_attr_gps_active_func_fld_gp_functionality;
13688
13689/* GP gpsCommissioningExitMode Attribute */
13690static int ett_zbee_zcl_gp_attr_gps_comm_exit_mode;
13691static int hf_zbee_zcl_gp_attr_gps_comm_exit_mode;
13692static int hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_comm_window_expire;
13693static int hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_pairing_success;
13694static int hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_gp_proxy_comm_mode;
13695
13696/* GP gpsCommunicationMode Attribute */
13697static int ett_zbee_zcl_gp_attr_gps_communication_mode;
13698static int hf_zbee_zcl_gp_attr_gps_communication_mode;
13699static int hf_zbee_zcl_gp_attr_gps_communication_mode_fld_mode;
13700
13701/* GP gpsSecurityLevel Attribute */
13702static int ett_zbee_zcl_gp_attr_gps_secur_lvl;
13703static int hf_zbee_zcl_gp_attr_gps_secur_lvl;
13704static int hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_min_gpd_secur_lvl;
13705static int hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_protection_with_gp_link_key;
13706static int hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_involve_tc;
13707
13708/* reuse ZGPD command names */
13709extern value_string_ext zbee_nwk_gp_cmd_names_ext;
13710/* reuse devices table from ZGPD parser */
13711extern const value_string zbee_nwk_gp_device_ids_names[];
13712
13713/*************************/
13714/* Function Declarations */
13715/*************************/
13716void proto_register_zbee_zcl_gp(void);
13717void proto_reg_handoff_zbee_zcl_gp(void);
13718
13719static dissector_handle_t zgp_handle;
13720
13721
13722/**
13723 * dissect_zbee_zcl_gp_payload
13724 *
13725 * ZigBee ZCL Green Power data payload cluster dissector for wireshark.
13726 *
13727 * @param tvb - pointer to buffer containing raw packet.
13728 * @param pinfo - pointer to packet information fields
13729 * @param tree - pointer to data tree Wireshark uses to display packet.
13730 * @param offset - offset in a buffer
13731 *
13732 * @return new offset.
13733 */
13734static int
13735dissect_zbee_zcl_gp_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
13736{
13737 unsigned payload_size;
13738
13739 proto_tree_add_item(tree, hf_zbee_gp_gpd_command_id, tvb, offset, 1, ENC_NA0x00000000);
13740 offset += 1;
13741
13742 payload_size = tvb_get_uint8(tvb, offset);
13743 proto_tree_add_item(tree, hf_zbee_gp_gpd_payload_size, tvb, offset, 1, ENC_NA0x00000000);
13744 offset += 1;
13745
13746 if (payload_size != 0 && payload_size != 0xff) {
13747 tvbuff_t *gtvb = tvb_new_composite();
13748 bool_Bool writable = col_get_writable(pinfo->cinfo, COL_INFO);
13749
13750 /* remove payload length and put command id instead */
13751 tvb_composite_append(gtvb, tvb_new_subset_length(tvb, offset-2, 1));
13752 tvb_composite_append(gtvb, tvb_new_subset_length(tvb, offset, payload_size));
13753 tvb_composite_finalize(gtvb);
13754 /* prevent overwriting COL_INFO */
13755 col_set_writable(pinfo->cinfo, COL_INFO, false0);
13756 call_dissector_only(zgp_handle, gtvb, pinfo, tree, NULL((void*)0));
13757 col_set_writable(pinfo->cinfo, COL_INFO, writable);
13758 offset += payload_size;
13759 }
13760 return offset;
13761}
13762
13763/**
13764 * dissect_zbee_zcl_gp_group_list
13765 *
13766 * ZigBee ZCL Green Power Group List dissector for wireshark.
13767 *
13768 * @param tvb - pointer to buffer containing raw packet.
13769 * @param tree - pointer to data tree Wireshark uses to display packet.
13770 * @param offset - offset in a buffer
13771 * @param text - string attached to Group list subtree
13772 * @return new offset.
13773 */
13774static int
13775dissect_zbee_zcl_gp_group_list(tvbuff_t *tvb, proto_tree *tree, unsigned offset, const char* text)
13776{
13777 uint8_t len = tvb_get_uint8(tvb, offset);
13778 proto_tree *gl_tree = proto_tree_add_subtree_format(tree, tvb, offset, len*4+1,
13779 ett_zbee_zcl_gp_group_list, NULL((void*)0), "%s #%d", text, len);
13780
13781 proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_len, tvb, offset, 1, ENC_NA0x00000000);
13782 offset += 1;
13783 while (len) {
13784 proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_group_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
13785 offset += 2;
13786 proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_alias, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
13787 offset += 2;
13788 len--;
13789 }
13790
13791 return offset;
13792} /*dissect_zbee_zcl_gp_group_list*/
13793
13794/**
13795 * dissect_zbee_zcl_gp_sink_address_list
13796 *
13797 * ZigBee ZCL Green Power Sink Address List dissector for wireshark.
13798 *
13799 * @param tvb - pointer to buffer containing raw packet.
13800 * @param tree - pointer to data tree Wireshark uses to display packet.
13801 * @param offset - offset in a buffer
13802 * @param text - string attached to Sink Address list subtree
13803 * @return new offset.
13804 */
13805static int
13806dissect_zbee_zcl_gp_sink_address_list(tvbuff_t *tvb, proto_tree *tree, unsigned offset, const char* text)
13807{
13808 uint8_t len = tvb_get_uint8(tvb, offset);
13809 proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, offset, len*10+1,
13810 ett_zbee_gp_sink_address_list, NULL((void*)0), "%s #%d", text, len);
13811
13812 proto_tree_add_item(subtree, hf_zbee_gp_sink_address_list_length, tvb, offset, 1, ENC_NA0x00000000);
13813 offset += 1;
13814 while (len) {
13815 proto_tree_add_item(subtree, hf_zbee_gp_sink_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN0x80000000);
13816 offset += 8;
13817 proto_tree_add_item(subtree, hf_zbee_gp_sink_nwk, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
13818 offset += 2;
13819 len--;
13820 }
13821
13822 return offset;
13823} /*dissect_zbee_zcl_gp_sink_address_list*/
13824
13825/**
13826 * dissect_zbee_zcl_gp_sink_table_entry
13827 *
13828 * ZigBee ZCL Green Power Sink Table entry dissector for wireshark.
13829 *
13830 * @param tvb - pointer to buffer containing raw packet.
13831 * @param tree - pointer to data tree Wireshark uses to display packet.
13832 * @param offset - offset in a buffer
13833 * @param idx - entry index
13834 *
13835 * @return 1 if entry parsed, 0 - otherwise.
13836 */
13837static int
13838dissect_zbee_zcl_gp_sink_table_entry(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, unsigned idx)
13839{
13840 uint16_t options = 0;
13841 uint16_t app_id, comm_mode;
13842 proto_tree *subtree;
13843 static int * const n_options[] = {
13844 &hf_zbee_gp_sink_tbl_entry_options_app_id,
13845 &hf_zbee_gp_sink_tbl_entry_options_comm_mode,
13846 &hf_zbee_gp_sink_tbl_entry_options_seq_num_cap,
13847 &hf_zbee_gp_sink_tbl_entry_options_rx_on_cap,
13848 &hf_zbee_gp_sink_tbl_entry_options_fixed_loc,
13849 &hf_zbee_gp_sink_tbl_entry_options_assigned_alias,
13850 &hf_zbee_gp_sink_tbl_entry_options_sec_use,
13851 NULL((void*)0)
13852 };
13853 static int * const n_secur_options[] = {
13854 &hf_zbee_gp_sec_options_sec_level,
13855 &hf_zbee_gp_sec_options_sec_key_type,
13856 NULL((void*)0)
13857 };
13858
13859 subtree = proto_tree_add_subtree_format(tree, tvb, *offset, -1, ett_zbee_gp_sink_tbl_entry,
13860 NULL((void*)0), "Sink Table Entry #%d", idx);
13861
13862 /* Options - 2 bytes */
13863 options = tvb_get_uint16(tvb, *offset, ENC_LITTLE_ENDIAN0x80000000);
13864 proto_tree_add_bitmask(subtree, tvb, *offset, hf_zbee_gp_sink_tbl_entry_options,
13865 ett_zbee_gp_sink_tbl_entry_options, n_options, ENC_LITTLE_ENDIAN0x80000000);
13866 *offset += 2;
13867
13868 app_id = (options & ZBEE_ZCL_GP_SINK_TBL_OPT_APP_ID(7<<0)) >> ws_ctz(ZBEE_ZCL_GP_SINK_TBL_OPT_APP_ID(7<<0));
13869 switch (app_id) {
13870 case ZBEE_ZCL_GP_APP_ID_DEFAULT0x00:
13871 /* Add 4 byte SRC ID */
13872 proto_tree_add_item(subtree, hf_zbee_gp_src_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
13873 *offset += 4;
13874 break;
13875 case ZBEE_ZCL_GP_APP_ID_ZGP0x02:
13876 /* Add IEEE address and endpoint (9 bytes) */
13877 proto_tree_add_item(subtree, hf_zbee_gp_ieee, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
13878 *offset += 8;
13879 proto_tree_add_item(subtree, hf_zbee_gp_endpoint, tvb, *offset, 1, ENC_NA0x00000000);
13880 *offset += 1;
13881 break;
13882 default:
13883 /* Bad entry - stop Sink Table Entry parsing */
13884 return 0;
13885 }
13886
13887 /* Device ID - 1 byte */
13888 proto_tree_add_item(subtree, hf_zbee_gp_device_id, tvb, *offset, 1, ENC_NA0x00000000);
13889 *offset += 1;
13890
13891 /* Group list */
13892 comm_mode = (options & ZBEE_ZCL_GP_SINK_TBL_OPT_COMMUNICATION_MODE(3<<3)) >>
13893 ws_ctz(ZBEE_ZCL_GP_SINK_TBL_OPT_COMMUNICATION_MODE(3<<3));
13894 if (comm_mode == ZBEE_ZCL_GP_COMMUNICATION_MODE_GROUPCAST_PRECOMMISSIONED2) {
13895 *offset = dissect_zbee_zcl_gp_group_list(tvb, subtree, *offset, "GroupList");
13896 }
13897
13898 /* GPD Assigned Alias: 2 bytes */
13899 if (options & ZBEE_ZCL_GP_SINK_TBL_OPT_ASSIGNED_ALIAS(1<<8)) {
13900 proto_tree_add_item(subtree, hf_zbee_gp_assigned_alias, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
13901 *offset += 2;
13902 }
13903
13904 /* Groupcast radius: 1 byte */
13905 proto_tree_add_item(subtree, hf_zbee_gp_groupcast_radius, tvb, *offset, 1, ENC_NA0x00000000);
13906 *offset += 1;
13907
13908 /* Security options: 1 byte */
13909 if (options & ZBEE_ZCL_GP_SINK_TBL_OPT_SECURITY_USE(1<<9)) {
13910 proto_tree_add_bitmask(subtree, tvb, *offset, hf_zbee_gp_sec_options,
13911 ett_zbee_gp_sec_options, n_secur_options, ENC_NA0x00000000);
13912 *offset += 1;
13913 }
13914
13915 /* GPD Frame Counter: 4 bytes */
13916 if ((options & ZBEE_ZCL_GP_SINK_TBL_OPT_SECURITY_USE(1<<9)) || (options & ZBEE_ZCL_GP_SINK_TBL_OPT_SEQ_NUMBER_CAP(1<<5))) {
13917 proto_tree_add_item(subtree, hf_zbee_gp_secur_frame_counter, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
13918 *offset += 4;
13919 }
13920
13921 /* GPD key: 16 bytes */
13922 if (options & ZBEE_ZCL_GP_SINK_TBL_OPT_SECURITY_USE(1<<9)) {
13923 proto_tree_add_item(subtree, hf_zbee_gp_gpd_key, tvb, *offset, 16, ENC_NA0x00000000);
13924 *offset += 16;
13925 }
13926
13927 return 1;
13928}
13929
13930/**
13931 * dissect_zbee_zcl_gp_sink_table
13932 *
13933 * ZigBee ZCL Green Power Sink Table dissector for wireshark.
13934 *
13935 * @param tvb - pointer to buffer containing raw packet.
13936 * @param tree - pointer to data tree Wireshark uses to display packet.
13937 * @param offset - offset in a buffer
13938 *
13939 * @return new offset.
13940 */
13941static int
13942dissect_zbee_zcl_gp_sink_table(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
13943{
13944 uint16_t sink_tbl_len, n_parsed_octets;
13945 uint8_t n_tbl_entries;
13946 proto_tree *sink_tbl_tree;
13947
13948 n_parsed_octets = 0;
13949 n_tbl_entries = 0;
13950 sink_tbl_len = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN0x80000000);
13951
13952 sink_tbl_tree = proto_tree_add_subtree_format(tree, tvb, offset, sink_tbl_len,
13953 ett_zbee_gp_sink_tbl, NULL((void*)0), "Sink Table: length = %d", sink_tbl_len);
13954 proto_tree_add_item(sink_tbl_tree, hf_zbee_gp_sink_tbl_length, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
13955 offset += 2;
13956 if (sink_tbl_len == 0) {
13957 return offset;
13958 }
13959
13960 while (n_parsed_octets < sink_tbl_len) {
13961 unsigned old_offset = offset;
13962 if (dissect_zbee_zcl_gp_sink_table_entry(tvb, sink_tbl_tree, &offset, n_tbl_entries + 1)) {
13963 n_parsed_octets += offset - old_offset;
13964 }
13965 else {
13966 /* Bad Sink Table Entry - stop Sink Table attribute dissection */
13967 break;
13968 }
13969
13970 ++n_tbl_entries;
13971 }
13972
13973 return offset;
13974} /*dissect_zbee_zcl_gp_sink_table*/
13975
13976/**
13977 * dissect_zbee_zcl_gp_proxy_table_entry
13978 *
13979 * ZigBee ZCL Green Power Proxy Table entry dissector for wireshark.
13980 *
13981 * @param tvb - pointer to buffer containing raw packet.
13982 * @param tree - pointer to data tree Wireshark uses to display packet.
13983 * @param offset - offset in a buffer
13984 * @param idx - entry index
13985 *
13986 * @return 1 if entry parsed, 0 - otherwise.
13987 */
13988static int
13989dissect_zbee_zcl_gp_proxy_table_entry(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, unsigned idx)
13990{
13991 uint16_t options = 0;
13992 uint16_t ext_options = 0;
13993 uint16_t app_id;
13994 proto_tree *subtree;
13995 static int * const n_options[] = {
13996 &hf_zbee_gp_proxy_tbl_entry_options_app_id,
13997 &hf_zbee_gp_proxy_tbl_entry_options_entry_active,
13998 &hf_zbee_gp_proxy_tbl_entry_options_entry_valid,
13999 &hf_zbee_gp_proxy_tbl_entry_options_seq_num_cap,
14000 &hf_zbee_gp_proxy_tbl_entry_options_lw_ucast_gps,
14001 &hf_zbee_gp_proxy_tbl_entry_options_derived_group_gps,
14002 &hf_zbee_gp_proxy_tbl_entry_options_comm_group_gps,
14003 &hf_zbee_gp_proxy_tbl_entry_options_first_to_forward,
14004 &hf_zbee_gp_proxy_tbl_entry_options_in_range,
14005 &hf_zbee_gp_proxy_tbl_entry_options_gpd_fixed,
14006 &hf_zbee_gp_proxy_tbl_entry_options_has_all_ucast_routes,
14007 &hf_zbee_gp_proxy_tbl_entry_options_assigned_alias,
14008 &hf_zbee_gp_proxy_tbl_entry_options_sec_use,
14009 &hf_zbee_gp_proxy_tbl_entry_options_opt_ext,
14010 NULL((void*)0)
14011 };
14012 static int * const n_ext_options[] = {
14013 &hf_zbee_gp_proxy_tbl_entry_ext_options_full_ucast_gps,
14014 NULL((void*)0)
14015 };
14016 static int * const n_secur_options[] = {
14017 &hf_zbee_gp_sec_options_sec_level,
14018 &hf_zbee_gp_sec_options_sec_key_type,
14019 NULL((void*)0)
14020 };
14021
14022 subtree = proto_tree_add_subtree_format(tree, tvb, *offset, -1,
14023 ett_zbee_gp_proxy_tbl_entry, NULL((void*)0), "Proxy Table Entry #%d", idx);
14024
14025 /* Options - 2 bytes */
14026 options = tvb_get_uint16(tvb, *offset, ENC_LITTLE_ENDIAN0x80000000);
14027 proto_tree_add_bitmask(subtree, tvb, *offset, hf_zbee_gp_proxy_tbl_entry_options,
14028 ett_zbee_gp_proxy_tbl_entry_options, n_options, ENC_LITTLE_ENDIAN0x80000000);
14029 *offset += 2;
14030
14031 app_id = (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_APP_ID(7<<0)) >> ws_ctz(ZBEE_ZCL_GP_PROXY_TBL_OPT_APP_ID(7<<0));
14032 switch (app_id) {
14033 case ZBEE_ZCL_GP_APP_ID_DEFAULT0x00:
14034 /* Add 4 byte SRC ID */
14035 proto_tree_add_item(subtree, hf_zbee_gp_src_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
14036 *offset += 4;
14037 break;
14038 case ZBEE_ZCL_GP_APP_ID_ZGP0x02:
14039 /* Add IEEE address and endpoint (9 bytes) */
14040 proto_tree_add_item(subtree, hf_zbee_gp_ieee, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
14041 *offset += 8;
14042 proto_tree_add_item(subtree, hf_zbee_gp_endpoint, tvb, *offset, 1, ENC_NA0x00000000);
14043 *offset += 1;
14044 break;
14045 default:
14046 /* Bad entry - stop Proxy Table entry parsing */
14047 return 0;
14048 }
14049
14050
14051 /* Assigned Alias - 2 bytes */
14052 if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_ASSIGNED_ALIAS(1<<13)) {
14053 proto_tree_add_item(subtree, hf_zbee_gp_assigned_alias, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14054 *offset += 2;
14055 }
14056
14057 /* Security Options - 1 byte */
14058 if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_SECURITY_USE(1<<14)) {
14059 proto_tree_add_bitmask(subtree, tvb, *offset, hf_zbee_gp_sec_options,
14060 ett_zbee_gp_sec_options, n_secur_options, ENC_NA0x00000000);
14061 *offset += 1;
14062 }
14063
14064 /* GPD Frame Counter: 4 bytes */
14065 if ((options & ZBEE_ZCL_GP_PROXY_TBL_OPT_SECURITY_USE(1<<14)) || (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_SEQ_NUMBER_CAP(1<<5))) {
14066 proto_tree_add_item(subtree, hf_zbee_gp_secur_frame_counter, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
14067 *offset += 4;
14068 }
14069
14070 /* GPD key: 16 bytes */
14071 if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_SECURITY_USE(1<<14)) {
14072 proto_tree_add_item(subtree, hf_zbee_gp_gpd_key, tvb, *offset, 16, ENC_NA0x00000000);
14073 *offset += 16;
14074 }
14075
14076 if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_LW_UCAST_GPS(1<<6)) {
14077 *offset = dissect_zbee_zcl_gp_sink_address_list(tvb, subtree, *offset, "Lightweight Sink Address list");
14078 }
14079
14080 /* Sink Group list */
14081 if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_COMM_GROUP_GPS(1<<8)) {
14082 *offset = dissect_zbee_zcl_gp_group_list(tvb, subtree, *offset, "Sink GroupList");
14083 }
14084
14085 /* Groupcast radius: 1 byte */
14086 proto_tree_add_item(subtree, hf_zbee_gp_groupcast_radius, tvb, *offset, 1, ENC_NA0x00000000);
14087 *offset += 1;
14088
14089 /* Search Counter: 1 byte */
14090 if (!(options & ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_ACTIVE(1<<3)) || !(options & ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_VALID(1<<4))) {
14091 proto_tree_add_item(subtree, hf_zbee_gp_proxy_tbl_entry_search_counter, tvb, *offset, 1, ENC_NA0x00000000);
14092 *offset += 1;
14093 }
14094
14095 /* Extended Options: 2 bytes */
14096 if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_OPTIONS_EXTENTIONS(1<<15)) {
14097 ext_options = tvb_get_uint16(tvb, *offset, ENC_LITTLE_ENDIAN0x80000000);
14098 proto_tree_add_bitmask(subtree, tvb, *offset, hf_zbee_gp_proxy_tbl_entry_ext_options,
14099 ett_zbee_gp_proxy_tbl_entry_ext_options, n_ext_options, ENC_LITTLE_ENDIAN0x80000000);
14100 *offset += 1;
14101 }
14102
14103 /* Full unicast sink address list */
14104 if (ext_options & ZBEE_ZCL_GP_PROXY_TBL_EXT_OPT_FULL_UCAST_GPS(1<<0)) {
14105 *offset = dissect_zbee_zcl_gp_sink_address_list(tvb, subtree, *offset, "Full unicast Sink Address list");
14106 }
14107
14108 return 1;
14109}
14110
14111/**
14112 * dissect_zbee_zcl_gp_proxy_table
14113 *
14114 * ZigBee ZCL Green Power Proxy Table dissector for wireshark.
14115 *
14116 * @param tvb - pointer to buffer containing raw packet.
14117 * @param tree - pointer to data tree Wireshark uses to display packet.
14118 * @param offset - offset in a buffer
14119 *
14120 * @return new offset.
14121 */
14122static int
14123dissect_zbee_zcl_gp_proxy_table(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
14124{
14125 uint16_t proxy_tbl_len, n_parsed_octets;
14126 uint8_t n_tbl_entries;
14127 proto_tree *proxy_tbl_tree;
14128
14129 n_parsed_octets = 0;
14130 n_tbl_entries = 0;
14131 proxy_tbl_len = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN0x80000000);
14132
14133 proxy_tbl_tree = proto_tree_add_subtree_format(tree, tvb, offset, proxy_tbl_len,
14134 ett_zbee_gp_proxy_tbl, NULL((void*)0), "Proxy Table: length = %d", proxy_tbl_len);
14135 proto_tree_add_item(proxy_tbl_tree, hf_zbee_gp_proxy_tbl_length, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14136 offset += 2;
14137 if (proxy_tbl_len == 0) {
14138 return offset;
14139 }
14140
14141 while (n_parsed_octets < proxy_tbl_len) {
14142 unsigned old_offset = offset;
14143 if (dissect_zbee_zcl_gp_proxy_table_entry(tvb, proxy_tbl_tree, &offset, n_tbl_entries + 1)) {
14144 n_parsed_octets += offset - old_offset;
14145 }
14146 else {
14147 /* Bad Proxy Table entry - stop Proxy Table attribute dissection */
14148 break;
14149 }
14150
14151 ++n_tbl_entries;
14152 }
14153
14154 return offset;
14155} /*dissect_zbee_zcl_gp_proxy_table*/
14156
14157/**
14158 * dissect_zbee_zcl_gp_attr_gpp_functionality
14159 *
14160 * ZigBee ZCL Green Power gppFunctionality dissector for wireshark.
14161 *
14162 * @param tvb - pointer to buffer containing raw packet.
14163 * @param tree - pointer to data tree Wireshark uses to display packet.
14164 * @param offset - offset in a buffer
14165 *
14166 * @return new offset.
14167 */
14168static int
14169dissect_zbee_zcl_gp_attr_gpp_functionality(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
14170{
14171 static int * const n_fields[] = {
14172 &hf_zbee_zcl_gp_attr_gpp_func_fld_gp_feature,
14173 &hf_zbee_zcl_gp_attr_gpp_func_fld_direct_comm,
14174 &hf_zbee_zcl_gp_attr_gpp_func_fld_derived_gcast_comm,
14175 &hf_zbee_zcl_gp_attr_gpp_func_fld_pre_commissioned_gcast_comm,
14176 &hf_zbee_zcl_gp_attr_gpp_func_fld_full_ucast_comm,
14177 &hf_zbee_zcl_gp_attr_gpp_func_fld_lw_ucast_comm,
14178 &hf_zbee_zcl_gp_attr_gpp_func_fld_bidir_op,
14179 &hf_zbee_zcl_gp_attr_gpp_func_fld_proxy_tbl_maintenance,
14180 &hf_zbee_zcl_gp_attr_gpp_func_fld_gp_commissioning,
14181 &hf_zbee_zcl_gp_attr_gpp_func_fld_ct_based_commissioning,
14182 &hf_zbee_zcl_gp_attr_gpp_func_fld_maintenance_of_gpd,
14183 &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_00,
14184 &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_01,
14185 &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_10,
14186 &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_11,
14187 &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_ieee_address,
14188 NULL((void*)0)
14189 };
14190
14191 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gpp_func,
14192 ett_zbee_zcl_gp_attr_gpp_func, n_fields, ENC_LITTLE_ENDIAN0x80000000);
14193 offset += 3;
14194
14195 return offset;
14196} /*dissect_zbee_zcl_gp_attr_gpp_functionality*/
14197
14198/**
14199 * dissect_zbee_zcl_gp_attr_gpp_active_functionality
14200 *
14201 * ZigBee ZCL Green Power gppActiveFunctionality dissector for wireshark.
14202 *
14203 * @param tvb - pointer to buffer containing raw packet.
14204 * @param tree - pointer to data tree Wireshark uses to display packet.
14205 * @param offset - offset in a buffer
14206 *
14207 * @return new offset.
14208 */
14209static int
14210dissect_zbee_zcl_gp_attr_gpp_active_functionality(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
14211{
14212 static int * const n_fields[] = {
14213 &hf_zbee_zcl_gp_attr_gpp_active_func_fld_gp_functionality,
14214 NULL((void*)0)
14215 };
14216
14217 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gpp_active_func,
14218 ett_zbee_zcl_gp_attr_gpp_active_func, n_fields, ENC_LITTLE_ENDIAN0x80000000);
14219 offset += 3;
14220
14221 return offset;
14222} /*dissect_zbee_zcl_gp_attr_gpp_active_functionality*/
14223
14224/**
14225 * dissect_zbee_zcl_gp_attr_gps_functionality
14226 *
14227 * ZigBee ZCL Green Power gpsFunctionality dissector for wireshark.
14228 *
14229 * @param tvb - pointer to buffer containing raw packet.
14230 * @param tree - pointer to data tree Wireshark uses to display packet.
14231 * @param offset - offset in a buffer
14232 *
14233 * @return new offset.
14234 */
14235static int
14236dissect_zbee_zcl_gp_attr_gps_functionality(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
14237{
14238 static int * const n_fields[] = {
14239 &hf_zbee_zcl_gp_attr_gps_func_fld_gp_feature,
14240 &hf_zbee_zcl_gp_attr_gps_func_fld_direct_comm,
14241 &hf_zbee_zcl_gp_attr_gps_func_fld_derived_gcast_comm,
14242 &hf_zbee_zcl_gp_attr_gps_func_fld_pre_commissioned_gcast_comm,
14243 &hf_zbee_zcl_gp_attr_gps_func_fld_full_ucast_comm,
14244 &hf_zbee_zcl_gp_attr_gps_func_fld_lw_ucast_comm,
14245 &hf_zbee_zcl_gp_attr_gps_func_fld_proximity_bidir_op,
14246 &hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_bidir_op,
14247 &hf_zbee_zcl_gp_attr_gps_func_fld_proxy_tbl_maintenance,
14248 &hf_zbee_zcl_gp_attr_gps_func_fld_proximity_commissioning,
14249 &hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_commissioning,
14250 &hf_zbee_zcl_gp_attr_gps_func_fld_ct_based_commissioning,
14251 &hf_zbee_zcl_gp_attr_gps_func_fld_maintenance_of_gpd,
14252 &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_00,
14253 &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_01,
14254 &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_10,
14255 &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_11,
14256 &hf_zbee_zcl_gp_attr_gps_func_fld_sink_tbl_based_gcast_forwarding,
14257 &hf_zbee_zcl_gp_attr_gps_func_fld_translation_table,
14258 &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_ieee_address,
14259 NULL((void*)0)
14260 };
14261
14262 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gps_func,
14263 ett_zbee_zcl_gp_attr_gps_func, n_fields, ENC_LITTLE_ENDIAN0x80000000);
14264 offset += 3;
14265
14266 return offset;
14267} /*dissect_zbee_zcl_gp_attr_gps_functionality*/
14268
14269/**
14270 * dissect_zbee_zcl_gp_attr_gps_active_functionality
14271 *
14272 * ZigBee ZCL Green Power gpsActiveFunctionality dissector for wireshark.
14273 *
14274 * @param tvb - pointer to buffer containing raw packet.
14275 * @param tree - pointer to data tree Wireshark uses to display packet.
14276 * @param offset - offset in a buffer
14277 *
14278 * @return new offset.
14279 */
14280static int
14281dissect_zbee_zcl_gp_attr_gps_active_functionality(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
14282{
14283 static int * const n_fields[] = {
14284 &hf_zbee_zcl_gp_attr_gps_active_func_fld_gp_functionality,
14285 NULL((void*)0)
14286 };
14287
14288 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gps_active_func,
14289 ett_zbee_zcl_gp_attr_gps_active_func, n_fields, ENC_LITTLE_ENDIAN0x80000000);
14290 offset += 3;
14291
14292 return offset;
14293} /*dissect_zbee_zcl_gp_attr_gps_active_functionality*/
14294
14295/**
14296 * dissect_zbee_zcl_gp_attr_gps_communication_mode
14297 *
14298 * ZigBee ZCL Green Power gpsCommunicationMode dissector for wireshark.
14299 *
14300 * @param tvb - pointer to buffer containing raw packet.
14301 * @param tree - pointer to data tree Wireshark uses to display packet.
14302 * @param offset - offset in a buffer
14303 *
14304 * @return new offset.
14305 */
14306static int
14307dissect_zbee_zcl_gp_attr_gps_communication_mode(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
14308{
14309 static int * const n_fields[] = {
14310 &hf_zbee_zcl_gp_attr_gps_communication_mode_fld_mode,
14311 NULL((void*)0)
14312 };
14313
14314 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gps_communication_mode,
14315 ett_zbee_zcl_gp_attr_gps_communication_mode, n_fields, ENC_NA0x00000000);
14316 offset += 1;
14317
14318 return offset;
14319} /*dissect_zbee_zcl_gp_attr_gps_communication_mode*/
14320
14321/**
14322 * dissect_zbee_zcl_gp_attr_gps_comm_exit_mode
14323 *
14324 * ZigBee ZCL Green Power gpsCommissioningExitMode dissector for wireshark.
14325 *
14326 * @param tvb - pointer to buffer containing raw packet.
14327 * @param tree - pointer to data tree Wireshark uses to display packet.
14328 * @param offset - offset in a buffer
14329 *
14330 * @return new offset.
14331 */
14332static int
14333dissect_zbee_zcl_gp_attr_gps_comm_exit_mode(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
14334{
14335 static int * const n_fields[] = {
14336 &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_comm_window_expire,
14337 &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_pairing_success,
14338 &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_gp_proxy_comm_mode,
14339 NULL((void*)0)
14340 };
14341
14342 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gps_comm_exit_mode,
14343 ett_zbee_zcl_gp_attr_gps_comm_exit_mode, n_fields, ENC_NA0x00000000);
14344 offset += 1;
14345
14346 return offset;
14347} /*dissect_zbee_zcl_gp_attr_gps_comm_exit_mode*/
14348
14349/**
14350 * dissect_zbee_zcl_gp_attr_gps_secur_lvl
14351 *
14352 * ZigBee ZCL Green Power gpsSecurityLevel dissector for wireshark.
14353 *
14354 * @param tvb - pointer to buffer containing raw packet.
14355 * @param tree - pointer to data tree Wireshark uses to display packet.
14356 * @param offset - offset in a buffer
14357 *
14358 * @return new offset.
14359 */
14360static int
14361dissect_zbee_zcl_gp_attr_gps_secur_lvl(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
14362{
14363 static int * const n_fields[] = {
14364 &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_min_gpd_secur_lvl,
14365 &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_protection_with_gp_link_key,
14366 &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_involve_tc,
14367 NULL((void*)0)
14368 };
14369
14370 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gps_secur_lvl,
14371 ett_zbee_zcl_gp_attr_gps_secur_lvl, n_fields, ENC_NA0x00000000);
14372 offset += 1;
14373
14374 return offset;
14375} /*dissect_zbee_zcl_gp_attr_gps_secur_lvl*/
14376
14377/**
14378 * dissect_zcl_gp_proxy_sink_table_request
14379 *
14380 * ZigBee ZCL Green Power cluster dissector for Proxy Table Request
14381 * and Sink Table Request commands
14382 *
14383 * @param tree - pointer to data tree Wireshark uses to display packet.
14384 * @param tvb - pointer to buffer containing raw packet.
14385 * @param offset - pointer to buffer offset
14386 */
14387static void
14388dissect_zcl_gp_proxy_sink_table_request(proto_tree *tree, tvbuff_t *tvb, unsigned *offset)
14389{
14390 /* get Options field */
14391 uint8_t options = tvb_get_uint8(tvb, *offset);
14392 uint8_t app_id, req_type;
14393 static int * const n_options[] = {
14394 &hf_zbee_zcl_proxy_sink_tbl_req_fld_app_id,
14395 &hf_zbee_zcl_proxy_sink_tbl_req_fld_req_type,
14396 NULL((void*)0)
14397 };
14398
14399 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_proxy_sink_tbl_req_options,
14400 ett_zbee_zcl_proxy_sink_tbl_req_options, n_options, ENC_NA0x00000000);
14401 *offset += 1;
14402 app_id = options & ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_APP_ID(0x07<<0);
14403 req_type = (options & ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_REQ_TYPE(0x03<<3)) >>
14404 ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_REQ_TYPE_SHIFT3;
14405 if (req_type == ZBEE_ZCL_GP_PROXY_SINK_TABLE_REQ_CMD_REQUSET_BY_GPD_ID0) {
14406 /* Include GPD ID and/or Endpoint */
14407 if (app_id == ZBEE_ZCL_GP_APP_ID_DEFAULT0x00) {
14408 /* App_id = 000: GPD SRC ID only */
14409 proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000);
14410 *offset += 4;
14411 }
14412 else if (app_id == ZBEE_ZCL_GP_APP_ID_ZGP0x02) {
14413 /* App_id = 010: MAC address + Endpoint */
14414 proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
14415 *offset += 8;
14416 proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, *offset, 1, ENC_NA0x00000000);
14417 *offset += 1;
14418 }
14419 }
14420 else if (req_type == ZBEE_ZCL_GP_PROXY_SINK_TABLE_REQ_CMD_REQUSET_BY_INDEX1) {
14421 /* Include index only */
14422 proto_tree_add_item(tree, hf_zbee_zcl_proxy_sink_tbl_req_index, tvb, *offset, 1, ENC_NA0x00000000);
14423 *offset += 1;
14424 }
14425} /*dissect_zcl_gp_proxy_sink_table_request*/
14426
14427/**
14428 * dissect_zcl_gp_proxy_sink_table_response
14429 *
14430 * ZigBee ZCL Green Power cluster dissector for Proxy Table response
14431 * and Sink Table Request commands
14432 *
14433 * @param tree - pointer to data tree Wireshark uses to display packet.
14434 * @param tvb - pointer to buffer containing raw packet.
14435 * @param offset - pointer to buffer offset
14436 * @param attr_id - attribute (should be ZBEE_ZCL_ATTR_GPS_SINK_TABLE or
14437 * ZBEE_ZCL_ATTR_GPP_PROXY_TABLE) that will be reported
14438 */
14439static void
14440dissect_zcl_gp_proxy_sink_table_response(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id)
14441{
14442 uint8_t entries_count, start_index;
14443 unsigned i, stop;
14444
14445 if ( !((attr_id == ZBEE_ZCL_ATTR_GPS_SINK_TABLE0x0001) || (attr_id == ZBEE_ZCL_ATTR_GPP_PROXY_TABLE0x0011)) ) {
14446 return;
14447 }
14448
14449 proto_tree_add_item(tree, hf_zbee_zcl_proxy_sink_tbl_resp_status, tvb, *offset, 1, ENC_NA0x00000000);
14450 *offset += 1;
14451 proto_tree_add_item(tree, hf_zbee_zcl_proxy_sink_tbl_resp_entries_total, tvb, *offset, 1, ENC_NA0x00000000);
14452 *offset += 1;
14453 start_index = tvb_get_uint8(tvb, *offset);
14454 proto_tree_add_item(tree, hf_zbee_zcl_proxy_sink_tbl_resp_start_index, tvb, *offset, 1, ENC_NA0x00000000);
14455 *offset += 1;
14456 entries_count = tvb_get_uint8(tvb, *offset);
14457 proto_tree_add_item(tree, hf_zbee_zcl_proxy_sink_tbl_resp_entries_count, tvb, *offset, 1, ENC_NA0x00000000);
14458 *offset += 1;
14459
14460 for (i = 0, stop = 0; i < entries_count && !stop; i++) {
14461 switch (attr_id) {
14462 case ZBEE_ZCL_ATTR_GPS_SINK_TABLE0x0001:
14463 stop = !dissect_zbee_zcl_gp_sink_table_entry(tvb, tree, (unsigned*) offset, start_index + i);
14464 break;
14465 case ZBEE_ZCL_ATTR_GPP_PROXY_TABLE0x0011:
14466 stop = !dissect_zbee_zcl_gp_proxy_table_entry(tvb, tree, (unsigned*) offset, start_index + i);
14467 break;
14468 }
14469 }
14470} /*dissect_zcl_gp_proxy_sink_table_response*/
14471
14472/**
14473 * dissect_zcl_gp_sink_comm_mode
14474 *
14475 * ZigBee ZCL Green Power cluster dissector for Sink Commissioning Mode
14476 * and Sink Table Request commands
14477 *
14478 * @param tree - pointer to data tree Wireshark uses to display packet.
14479 * @param tvb - pointer to buffer containing raw packet.
14480 * @param offset - pointer to buffer offset
14481 */
14482static void
14483dissect_zcl_gp_sink_comm_mode(proto_tree *tree, tvbuff_t *tvb, unsigned *offset)
14484{
14485 static int * const n_options[] = {
14486 &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_action,
14487 &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_secur,
14488 &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_pairing,
14489 &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_proxies,
14490 NULL((void*)0)
14491 };
14492
14493 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_gp_cmd_sink_comm_mode_options,
14494 ett_zbee_zcl_gp_cmd_sink_comm_mode_options, n_options, ENC_NA0x00000000);
14495 *offset += 1;
14496 proto_tree_add_item(tree, hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_secur, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14497 *offset += 2;
14498 proto_tree_add_item(tree, hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_pairing, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14499 *offset += 2;
14500 proto_tree_add_item(tree, hf_zbee_gp_zcl_cmd_sink_comm_mode_sink_ep, tvb, *offset, 1, ENC_NA0x00000000);
14501 *offset += 1;
14502} /*dissect_zcl_gp_sink_comm_mode*/
14503
14504/**
14505 * dissect_zbee_zcl_gp
14506 *
14507 * ZigBee ZCL Green Power cluster dissector for wireshark.
14508 *
14509 * @param tvb - pointer to buffer containing raw packet.
14510 * @param pinfo - pointer to packet information fields
14511 * @param tree - pointer to data tree Wireshark uses to display packet.
14512 * @param data - pointer to ZCL packet structure.
14513 *
14514 * @return length of parsed data.
14515 */
14516static int
14517dissect_zbee_zcl_gp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
14518{
14519 static int * const gpp_gpd_link[] = {
14520 &hf_zbee_gpp_gpd_link_rssi,
14521 &hf_zbee_gpp_gpd_link_lqi,
14522 NULL((void*)0)
14523 };
14524
14525 zbee_zcl_packet *zcl;
14526 unsigned offset = 0;
14527 uint8_t cmd_id;
14528
14529 /* Reject the packet if data is NULL */
14530 if (data == NULL((void*)0))
14531 return 0;
14532 zcl = (zbee_zcl_packet *)data;
14533 cmd_id = zcl->cmd_id;
14534
14535 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER0x00) {
14536 /* Append the command name to the info column. */
14537 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
14538 val_to_str_const(cmd_id, zbee_zcl_gp_srv_rx_cmd_names, "Unknown Command"),
14539 zcl->tran_seqno);
14540
14541 /* Add the command ID. */
14542 proto_tree_add_item(tree, hf_zbee_zcl_gp_srv_rx_cmd_id, tvb, offset, 1, ENC_NA0x00000000);
14543 offset++;
14544
14545 /* Handle the command dissection. */
14546 switch (cmd_id) {
14547 case ZBEE_CMD_ID_GP_NOTIFICATION0x00:
14548 {
14549 static int * const n_options[] = {
14550 &hf_zbee_gp_cmd_notif_opt_app_id,
14551 &hf_zbee_gp_cmd_notif_opt_also_unicast,
14552 &hf_zbee_gp_cmd_notif_opt_also_derived_group,
14553 &hf_zbee_gp_cmd_notif_opt_also_comm_group,
14554 &hf_zbee_gp_cmd_notif_opt_secur_level,
14555 &hf_zbee_gp_cmd_notif_opt_secur_key_type,
14556 &hf_zbee_gp_cmd_notif_opt_rx_after_tx,
14557 &hf_zbee_gp_cmd_notif_opt_tx_q_full,
14558 &hf_zbee_gp_cmd_notif_opt_bidir_cap,
14559 &hf_zbee_gp_cmd_notif_opt_proxy_info_present,
14560 NULL((void*)0)
14561 };
14562 uint16_t options = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN0x80000000);
14563
14564 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_notification_options,
14565 ett_zbee_gp_cmd_notification_options, n_options, ENC_LITTLE_ENDIAN0x80000000);
14566 offset += 2;
14567 if ((options & ZBEE_ZCL_GP_NOTIFICATION_OPTION_APP_ID(7<<0)) == 0) {
14568 proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000);
14569 offset += 4;
14570 }
14571 else {
14572 proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN0x80000000);
14573 offset += 8;
14574 proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, offset, 1, ENC_NA0x00000000);
14575 offset += 1;
14576 }
14577 proto_tree_add_item(tree, hf_zbee_gp_secur_frame_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000);
14578 offset += 4;
14579
14580 offset = dissect_zbee_zcl_gp_payload(tvb, pinfo, tree, offset);
14581
14582 if (options & ZBEE_ZCL_GP_NOTIFICATION_OPTION_PROXY_INFO_PRESENT(1<<14)) {
14583 proto_tree_add_item(tree, hf_zbee_gp_short_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14584 offset += 2;
14585 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_gpp_gpd_link,
14586 ett_zbee_gp_gpp_gpd_link,
14587 gpp_gpd_link, ENC_LITTLE_ENDIAN0x80000000);
14588 offset += 1;
14589 }
14590 break;
14591 }
14592
14593 case ZBEE_CMD_ID_GP_PAIRING_SEARCH0x01:
14594 case ZBEE_CMD_ID_GP_TUNNELING_STOP0x03:
14595 /* TODO: add commands parse */
14596 break;
14597
14598 case ZBEE_CMD_ID_GP_COMMISSIONING_NOTIFICATION0x04:
14599 {
14600 static int * const commn_options[] = {
14601 &hf_zbee_gp_cmd_comm_notif_opt_app_id,
14602 &hf_zbee_gp_cmd_comm_notif_opt_rx_after_tx,
14603 &hf_zbee_gp_cmd_comm_notif_opt_secur_level,
14604 &hf_zbee_gp_cmd_comm_notif_opt_secur_key_type,
14605 &hf_zbee_gp_cmd_comm_notif_opt_secur_fail,
14606 &hf_zbee_gp_cmd_comm_notif_opt_bidir_cap,
14607 &hf_zbee_gp_cmd_comm_notif_opt_proxy_info_present,
14608 NULL((void*)0)
14609 };
14610 uint16_t options = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN0x80000000);
14611
14612 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_commissioning_notification_options,
14613 ett_zbee_gp_cmd_commissioning_notification_options, commn_options, ENC_LITTLE_ENDIAN0x80000000);
14614 offset += 2;
14615 if ((options & ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_APP_ID(7<<0)) == 0) {
14616 proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000);
14617 offset += 4;
14618 }
14619 else {
14620 proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN0x80000000);
14621 offset += 8;
14622 proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, offset, 1, ENC_NA0x00000000);
14623 offset += 1;
14624 }
14625 proto_tree_add_item(tree, hf_zbee_gp_secur_frame_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000);
14626 offset += 4;
14627
14628 offset = dissect_zbee_zcl_gp_payload(tvb, pinfo, tree, offset);
14629
14630 if (options & ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_PROXY_INFO_PRESENT(1<<11)) {
14631 proto_tree_add_item(tree, hf_zbee_gp_short_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14632 offset += 2;
14633 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_gpp_gpd_link,
14634 ett_zbee_gp_gpp_gpd_link,
14635 gpp_gpd_link, ENC_LITTLE_ENDIAN0x80000000);
14636 offset += 1;
14637 }
14638 if (options & ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_FAILED(1<<9)) {
14639 proto_tree_add_item(tree, hf_zbee_gp_mic, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000);
14640 offset += 4;
14641 }
14642 break;
14643 }
14644
14645 case ZBEE_CMD_ID_GP_PAIRING_CONFIGURATION0x09:
14646 {
14647 static int * const pc_actions[] = {
14648 &hf_zbee_gp_cmd_pc_actions_action,
14649 &hf_zbee_gp_cmd_pc_actions_send_gp_pairing,
14650 NULL((void*)0)
14651 };
14652 static int * const pc_options[] = {
14653 &hf_zbee_gp_cmd_pc_opt_app_id,
14654 &hf_zbee_gp_cmd_pc_opt_communication_mode,
14655 &hf_zbee_gp_cmd_pc_opt_seq_number_cap,
14656 &hf_zbee_gp_cmd_px_opt_rx_on_cap,
14657 &hf_zbee_gp_cmd_pc_opt_fixed_location,
14658 &hf_zbee_gp_cmd_pc_opt_assigned_alias,
14659 &hf_zbee_gp_cmd_pc_opt_security_use,
14660 &hf_zbee_gp_cmd_pc_opt_app_info_present,
14661 NULL((void*)0)
14662 };
14663 uint16_t options;
14664
14665 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_pc_actions,
14666 ett_zbee_gp_cmd_pc_actions, pc_actions, ENC_NA0x00000000);
14667 offset += 1;
14668
14669 options = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN0x80000000);
14670
14671 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_pc_options,
14672 ett_zbee_gp_cmd_pc_options, pc_options, ENC_LITTLE_ENDIAN0x80000000);
14673 offset += 2;
14674
14675 if ((options & ZBEE_ZCL_GP_CMD_PC_OPT_APP_ID(7<<0)) == 0) {
14676 proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000);
14677 offset += 4;
14678 }
14679 else {
14680 proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN0x80000000);
14681 offset += 8;
14682 proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, offset, 1, ENC_NA0x00000000);
14683 offset += 1;
14684 }
14685
14686 proto_tree_add_item(tree, hf_zbee_gp_device_id, tvb, offset, 1, ENC_NA0x00000000);
14687 offset += 1;
14688
14689 if (((options & ZBEE_ZCL_GP_CMD_PC_OPT_COMMUNICATION_MODE(3<<3)) >> ZBEE_ZCL_GP_PAIRING_CONFIGURATION_OPTION_COMMUNICATION_MODE_SHIFT3)
14690 == ZBEE_ZCL_GP_COMMUNICATION_MODE_GROUPCAST_PRECOMMISSIONED2) {
14691 uint8_t len = tvb_get_uint8(tvb, offset);
14692 proto_tree *gl_tree = proto_tree_add_subtree_format(tree, tvb, offset, len*4+1, ett_zbee_zcl_gp_group_list, NULL((void*)0), "GroupList #%d", len);
14693
14694 proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_len, tvb, offset, 1, ENC_NA0x00000000);
14695 offset += 1;
14696 while (len)
14697 {
14698 proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_group_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14699 offset += 2;
14700 proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_alias, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14701 offset += 2;
14702 len--;
14703 }
14704 }
14705
14706 if (options & ZBEE_ZCL_GP_CMD_PC_OPT_ASSIGNED_ALIAS(1<<8)) {
14707 proto_tree_add_item(tree, hf_zbee_gp_assigned_alias, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14708 offset += 2;
14709 }
14710
14711 proto_tree_add_item(tree, hf_zbee_gp_forwarding_radius, tvb, offset, 1, ENC_NA0x00000000);
14712 offset += 1;
14713
14714 if (options & ZBEE_ZCL_GP_CMD_PC_OPT_SECURITY_USE(1<<9)) {
14715 static int * const secur_options[] = {
14716 &hf_zbee_gp_cmd_pc_secur_level,
14717 &hf_zbee_gp_cmd_pc_secur_key_type,
14718 NULL((void*)0)
14719 };
14720 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_pc_secur_options,
14721 ett_zbee_gp_cmd_pc_secur_options, secur_options, ENC_NA0x00000000);
14722 offset += 1;
14723 proto_tree_add_item(tree, hf_zbee_gp_secur_frame_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000);
14724 offset += 4;
14725 proto_tree_add_item(tree, hf_zbee_gp_gpd_key, tvb, offset, 16, ENC_NA0x00000000);
14726 offset += 16;
14727 }
14728 {
14729 uint8_t n_paired_endpoints = tvb_get_uint8(tvb, offset);
14730 proto_tree *ep_tree = proto_tree_add_subtree_format(tree, tvb, offset, n_paired_endpoints+1, ett_zbee_zcl_gp_ep, NULL((void*)0), "Paired Endpoints #%d", n_paired_endpoints);
14731 proto_tree_add_item(ep_tree, hf_zbee_gp_n_paired_endpoints, tvb, offset, 1, ENC_NA0x00000000);
14732 offset += 1;
14733 if (n_paired_endpoints != 0 && n_paired_endpoints != 0xfd
14734 && n_paired_endpoints != 0xfe && n_paired_endpoints != 0xff)
14735 {
14736 while (n_paired_endpoints)
14737 {
14738 proto_tree_add_item(ep_tree, hf_zbee_gp_paired_endpoint, tvb, offset, 1, ENC_NA0x00000000);
14739 offset += 1;
14740 n_paired_endpoints--;
14741 }
14742 }
14743 }
14744 if (options & ZBEE_ZCL_GP_CMD_PC_OPT_APP_INFO_PRESENT(1<<10)) {
14745 static int * const app_info[] = {
14746 &hf_zbee_gp_cmd_pc_app_info_manuf_id_present,
14747 &hf_zbee_gp_cmd_pc_app_info_model_id_present,
14748 &hf_zbee_gp_cmd_pc_app_info_gpd_commands_present,
14749 &hf_zbee_gp_cmd_pc_app_info_cluster_list_present,
14750 NULL((void*)0)
14751 };
14752 uint8_t appi = tvb_get_uint8(tvb, offset);
14753
14754 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_pc_app_info,
14755 ett_zbee_gp_cmd_pc_app_info, app_info, ENC_NA0x00000000);
14756 offset += 1;
14757 if (appi & ZBEE_ZCL_GP_CMD_PC_APP_INFO_MANUF_ID_PRESENT(1<<0)) {
14758 proto_tree_add_item(tree, hf_zbee_zcl_gp_manufacturer_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14759 offset += 2;
14760 }
14761 if (appi & ZBEE_ZCL_GP_CMD_PC_APP_INFO_MODEL_ID_PRESENT(1<<1)) {
14762 proto_tree_add_item(tree, hf_zbee_zcl_gp_model_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14763 offset += 2;
14764 }
14765 if (appi & ZBEE_ZCL_GP_CMD_PC_APP_INFO_GPD_COMMANDS_PRESENT(1<<2)) {
14766 uint8_t n_commands = tvb_get_uint8(tvb, offset);
14767 proto_tree *c_tree = proto_tree_add_subtree_format(tree, tvb, offset, n_commands+1, ett_zbee_zcl_gp_cmds, NULL((void*)0), "GPD CommandID list #%d", n_commands);
14768 proto_tree_add_item(c_tree, hf_zbee_gp_n_gpd_commands, tvb, offset, 1, ENC_NA0x00000000);
14769 offset += 1;
14770 while (n_commands)
14771 {
14772 proto_tree_add_item(c_tree, hf_zbee_gp_gpd_command, tvb, offset, 1, ENC_NA0x00000000);
14773 offset += 1;
14774 n_commands--;
14775 }
14776 }
14777 if (appi & ZBEE_ZCL_GP_CMD_PC_APP_INFO_CLUSTER_LIST_PRESENT(1<<3)) {
14778 uint8_t n = tvb_get_uint8(tvb, offset);
14779 uint8_t n_srv_clusters = n & ZBEE_ZCL_GP_CLUSTER_LIST_LEN_SRV(0xf<<0);
14780 uint8_t n_cli_clusters = (n & ZBEE_ZCL_GP_CLUSTER_LIST_LEN_CLI(0xf<<4)) >> ZBEE_ZCL_GP_CLUSTER_LIST_LEN_CLI_SHIFT4;
14781 proto_tree *cl_tree = proto_tree_add_subtree_format(tree, tvb, offset, n*2+1, ett_zbee_zcl_gp_clusters, NULL((void*)0), "Cluster List #%d/%d", n_srv_clusters, n_cli_clusters);
14782 proto_tree_add_item(cl_tree, hf_zbee_gp_n_srv_clusters, tvb, offset, 1, ENC_NA0x00000000);
14783 proto_tree_add_item(cl_tree, hf_zbee_gp_n_cli_clusters, tvb, offset, 1, ENC_NA0x00000000);
14784 offset += 1;
14785 if (n_srv_clusters)
14786 {
14787 proto_tree *s_tree = proto_tree_add_subtree_format(cl_tree, tvb, offset, n_srv_clusters*2, ett_zbee_zcl_gp_srv_clusters, NULL((void*)0), "Server clusters #%d", n_srv_clusters);
14788 while (n_srv_clusters)
14789 {
14790 proto_tree_add_item(s_tree, hf_zbee_gp_gpd_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14791 offset += 2;
14792 n_srv_clusters--;
14793 }
14794 }
14795 if (n_cli_clusters)
14796 {
14797 proto_tree *c_tree = proto_tree_add_subtree_format(cl_tree, tvb, offset, n_cli_clusters*2, ett_zbee_zcl_gp_cli_clusters, NULL((void*)0), "Client clusters #%d", n_cli_clusters);
14798 while (n_cli_clusters)
14799 {
14800 proto_tree_add_item(c_tree, hf_zbee_gp_gpd_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14801 offset += 2;
14802 n_cli_clusters--;
14803 }
14804 }
14805 }
14806 }
14807 break;
14808 }
14809
14810 case ZBEE_CMD_ID_GP_SINK_COMMISSIONING_MODE0x05:
14811 dissect_zcl_gp_sink_comm_mode(tree, tvb, &offset);
14812 break;
14813 case ZBEE_CMD_ID_GP_TRANSLATION_TABLE_UPDATE_COMMAND0x07:
14814 case ZBEE_CMD_ID_GP_TRANSLATION_TABLE_REQUEST0x08:
14815 /* TODO: add commands parse */
14816 break;
14817 case ZBEE_CMD_ID_GP_SINK_TABLE_REQUEST0x0a:
14818 dissect_zcl_gp_proxy_sink_table_request(tree, tvb, &offset);
14819 break;
14820 case ZBEE_CMD_ID_GP_PROXY_TABLE_RESPONSE0x0b:
14821 dissect_zcl_gp_proxy_sink_table_response(tree, tvb, &offset, ZBEE_ZCL_ATTR_GPP_PROXY_TABLE0x0011);
14822 break;
14823
14824 default:
14825 break;
14826 } /* switch */
14827 } else {
14828 /* Append the command name to the info column. */
14829 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
14830 val_to_str_const(cmd_id, zbee_zcl_gp_srv_tx_cmd_names, "Unknown Command"),
14831 zcl->tran_seqno);
14832
14833 /* Add the command ID. */
14834 proto_tree_add_item(tree, hf_zbee_zcl_gp_srv_tx_cmd_id, tvb, offset, 1, ENC_NA0x00000000);
14835 offset++;
14836
14837 /* Handle the command dissection. */
14838 switch (cmd_id) {
14839 case ZBEE_ZCL_CMD_ID_GP_NOTIFICATION_RESPONSE0x00:
14840 /* TODO: add commands parse */
14841 break;
14842
14843 case ZBEE_ZCL_CMD_ID_GP_PAIRING0x01:
14844 {
14845 static int * const p_options[] = {
14846 &hf_zbee_gp_cmd_pairing_opt_app_id,
14847 &hf_zbee_gp_cmd_pairing_opt_add_sink,
14848 &hf_zbee_gp_cmd_pairing_opt_remove_gpd,
14849 &hf_zbee_gp_cmd_pairing_opt_communication_mode,
14850 &hf_zbee_gp_cmd_pairing_opt_gpd_fixed,
14851 &hf_zbee_gp_cmd_pairing_opt_gpd_mac_seq_num_cap,
14852 &hf_zbee_gp_cmd_pairing_opt_secur_level,
14853 &hf_zbee_gp_cmd_pairing_opt_secur_key_type,
14854 &hf_zbee_gp_cmd_pairing_opt_gpd_frame_cnt_present,
14855 &hf_zbee_gp_cmd_pairing_opt_gpd_secur_key_present,
14856 &hf_zbee_gp_cmd_pairing_opt_assigned_alias_present,
14857 &hf_zbee_gp_cmd_pairing_opt_fwd_radius_present,
14858 NULL((void*)0)
14859 };
14860 uint32_t options = tvb_get_uint24(tvb, offset, ENC_LITTLE_ENDIAN0x80000000);
14861
14862 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_pairing_options,
14863 ett_zbee_gp_cmd_pairing_options, p_options, ENC_LITTLE_ENDIAN0x80000000);
14864 offset += 3;
14865 if ((options & ZBEE_ZCL_GP_PAIRING_OPTION_APP_ID(7<<0)) == 0) {
14866 proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000);
14867 offset += 4;
14868 }
14869 else {
14870 proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN0x80000000);
14871 offset += 8;
14872 proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, offset, 1, ENC_NA0x00000000);
14873 offset += 1;
14874 }
14875 if ((options & ZBEE_ZCL_GP_PAIRING_OPTION_REMOVE_GPD(1<<4)) == 0 &&
14876 /* see Table 37 */
14877 (options & ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE(3<<5)) == ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE(3<<5)) {
14878 proto_tree_add_item(tree, hf_zbee_gp_sink_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN0x80000000);
14879 offset += 8;
14880 proto_tree_add_item(tree, hf_zbee_gp_sink_nwk, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14881 offset += 2;
14882 }
14883 if ((options & ZBEE_ZCL_GP_PAIRING_OPTION_REMOVE_GPD(1<<4)) == 0 &&
14884 (options & ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE(3<<5)) != ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE(3<<5) &&
14885 (options & ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE(3<<5)) != 0) {
14886 proto_tree_add_item(tree, hf_zbee_gp_sink_group_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14887 offset += 2;
14888 }
14889 if (options & ZBEE_ZCL_GP_PAIRING_OPTION_ADD_SINK(1<<3)) {
14890 proto_tree_add_item(tree, hf_zbee_gp_device_id, tvb, offset, 1, ENC_NA0x00000000);
14891 offset += 1;
14892 }
14893 if (options & ZBEE_ZCL_GP_PAIRING_OPTION_GPD_FRAME_CNT_PRESENT(1<<14)) {
14894 proto_tree_add_item(tree, hf_zbee_gp_secur_frame_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000);
14895 offset += 4;
14896 }
14897 if (options & ZBEE_ZCL_GP_PAIRING_OPTION_GPD_SECUR_KEY_PRESENT(1<<15)) {
14898 proto_tree_add_item(tree, hf_zbee_gp_gpd_key, tvb, offset, 16, ENC_NA0x00000000);
14899 offset += 16;
14900 }
14901 if (options & ZBEE_ZCL_GP_PAIRING_OPTION_ASSIGNED_ALIAS_PRESENT(1<<16)) {
14902 proto_tree_add_item(tree, hf_zbee_gp_assigned_alias, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14903 offset += 2;
14904 }
14905 if (options & ZBEE_ZCL_GP_PAIRING_OPTION_FWD_RADIUS_PRESENT(1<<17)) {
14906 proto_tree_add_item(tree, hf_zbee_gp_forwarding_radius, tvb, offset, 1, ENC_NA0x00000000);
14907 offset += 1;
14908 }
14909 break;
14910 }
14911
14912 case ZBEE_ZCL_CMD_ID_GP_PROXY_COMMISSIONING_MODE0x02:
14913 {
14914 static int * const pcm_options[] = {
14915 &hf_zbee_gp_cmd_pcm_opt_action,
14916 &hf_zbee_gp_cmd_pcm_opt_exit_mode,
14917 &hf_zbee_gp_cmd_pcm_opt_channel_present,
14918 &hf_zbee_gp_cmd_pcm_opt_unicast_comm,
14919 NULL((void*)0)
14920 };
14921 uint8_t options = tvb_get_uint8(tvb, offset);
14922 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_proxy_commissioning_mode_options,
14923 ett_zbee_gp_cmd_proxy_commissioning_mode_options, pcm_options, ENC_NA0x00000000);
14924 if (options & ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ACTION1) {
14925 static int * const exit_mode[] = {
14926 &hf_zbee_gp_cmd_pcm_exit_mode_on_comm_window_expire,
14927 &hf_zbee_gp_cmd_pcm_exit_mode_on_pairing_success,
14928 &hf_zbee_gp_cmd_pcm_exit_mode_on_gp_proxy_comm_mode,
14929 NULL((void*)0)
14930 };
14931 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_proxy_commissioning_mode_exit_mode,
14932 ett_zbee_gp_cmd_proxy_commissioning_mode_exit_mode, exit_mode, ENC_NA0x00000000);
14933 }
14934 offset += 1;
14935 if (options & ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_COMMISSIONING_WINDOW_EXPIRATION((1<<0)<<1)) {
14936 proto_tree_add_item(tree, hf_zbee_zcl_gp_commissioning_window, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14937 offset += 2;
14938 }
14939 if (options & ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_CHANNEL_PRESENT(1<<4)) {
14940 proto_tree_add_item(tree, hf_zbee_zcl_gp_channel, tvb, offset, 1, ENC_NA0x00000000);
14941 offset += 1;
14942 }
14943 break;
14944 }
14945
14946 case ZBEE_ZCL_CMD_ID_GP_RESPONSE0x06:
14947 {
14948 static int * const rsp_options[] = {
14949 &hf_zbee_gp_cmd_resp_opt_app_id,
14950 &hf_zbee_gp_cmd_resp_opt_tx_on_ep_match,
14951 NULL((void*)0)
14952 };
14953 static int * const tx_ch[] = {
14954 &hf_zbee_gp_cmd_resp_tx_channel,
14955 NULL((void*)0)
14956 };
14957 uint8_t options = tvb_get_uint8(tvb, offset);
14958
14959 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_response_options,
14960 ett_zbee_gp_cmd_response_options, rsp_options, ENC_LITTLE_ENDIAN0x80000000);
14961 offset += 1;
14962 proto_tree_add_item(tree, hf_zbee_gp_tmp_master_short_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
14963 offset += 2;
14964 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_response_tx_channel,
14965 ett_zbee_gp_cmd_response_tx_channel, tx_ch, ENC_LITTLE_ENDIAN0x80000000);
14966 offset += 1;
14967
14968 if ((options & ZBEE_ZCL_GP_RESPONSE_OPTION_APP_ID(7<<0)) == 0) {
14969 proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000);
14970 offset += 4;
14971 }
14972 else {
14973 proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN0x80000000);
14974 offset += 8;
14975 proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, offset, 1, ENC_NA0x00000000);
14976 offset += 1;
14977 }
14978
14979 offset = dissect_zbee_zcl_gp_payload(tvb, pinfo, tree, offset);
14980 break;
14981 }
14982 case ZBEE_ZCL_CMD_ID_GP_TRANS_TBL_RESPONSE0x08:
14983 /* TODO: add commands parse */
14984 break;
14985 case ZBEE_ZCL_CMD_ID_GP_SINK_TABLE_RESPONSE0x0a:
14986 dissect_zcl_gp_proxy_sink_table_response(tree, tvb, &offset, ZBEE_ZCL_ATTR_GPS_SINK_TABLE0x0001);
14987 break;
14988 case ZBEE_ZCL_CMD_ID_GP_PROXY_TABLE_REQUEST0x0b:
14989 dissect_zcl_gp_proxy_sink_table_request(tree, tvb, &offset);
14990 break;
14991 default:
14992 break;
14993 } /* switch */
14994 }
14995
14996 /* Call the data dissector for any leftover bytes. */
14997 if (tvb_captured_length(tvb) > offset) {
14998 call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree);
14999 }
15000
15001 return tvb_captured_length(tvb);
15002} /* dissect_zbee_zcl_gp */
15003
15004
15005/**
15006 * dissect_zcl_gp_attr_data
15007 *
15008 * this function is called by ZCL foundation dissector in order to decode
15009 * specific cluster attributes data.
15010 *
15011 * @param tree - pointer to data tree Wireshark uses to display packet.
15012 * @param tvb - pointer to buffer containing raw packet.
15013 * @param offset - pointer to buffer offset
15014 * @param attr_id - attribute identifier
15015 * @param data_type - attribute data type
15016 * @param client_attr - ZCL client
15017 */
15018static void
15019dissect_zcl_gp_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id _U___attribute__((unused)), unsigned data_type, bool_Bool client_attr)
15020{
15021 /* Dissect attribute data type and data */
15022 switch (attr_id) {
15023 case ZBEE_ZCL_ATTR_GPS_SINK_TABLE0x0001:
15024 *offset = dissect_zbee_zcl_gp_sink_table(tvb, tree, *offset);
15025 break;
15026 case ZBEE_ZCL_ATTR_GPS_COMMUNICATION_MODE0x0002:
15027 *offset = dissect_zbee_zcl_gp_attr_gps_communication_mode(tvb, tree, *offset);
15028 break;
15029 case ZBEE_ZCL_ATTR_GPS_COMMISSIONING_EXIT_MODE0x0003:
15030 *offset = dissect_zbee_zcl_gp_attr_gps_comm_exit_mode(tvb, tree, *offset);
15031 break;
15032 case ZBEE_ZCL_ATTR_GPS_SECURITY_LEVEL0x0005:
15033 *offset = dissect_zbee_zcl_gp_attr_gps_secur_lvl(tvb, tree, *offset);
15034 break;
15035 case ZBEE_ZCL_ATTR_GPS_FUNCTIONALITY0x0006:
15036 *offset = dissect_zbee_zcl_gp_attr_gps_functionality(tvb, tree, *offset);
15037 break;
15038 case ZBEE_ZCL_ATTR_GPS_ACTIVE_FUNCTIONALITY0x0007:
15039 *offset = dissect_zbee_zcl_gp_attr_gps_active_functionality(tvb, tree, *offset);
15040 break;
15041 case ZBEE_ZCL_ATTR_GPP_PROXY_TABLE0x0011:
15042 *offset = dissect_zbee_zcl_gp_proxy_table(tvb, tree, *offset);
15043 break;
15044 case ZBEE_ZCL_ATTR_GPP_FUNCTIONALITY0x0016:
15045 *offset = dissect_zbee_zcl_gp_attr_gpp_functionality(tvb, tree, *offset);
15046 break;
15047 case ZBEE_ZCL_ATTR_GPP_ACTIVE_FUNCTIONALITY0x0017:
15048 *offset = dissect_zbee_zcl_gp_attr_gpp_active_functionality(tvb, tree, *offset);
15049 break;
15050 default:
15051 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
15052 }
15053
15054
15055} /*dissect_zcl_gp_attr_data*/
15056
15057/**
15058 * proto_register_zbee_zcl_gp
15059 *
15060 * ZigBee ZCL Green Power cluster protocol registration.
15061 */
15062void
15063proto_register_zbee_zcl_gp(void)
15064{
15065 /* Setup list of header fields */
15066 static hf_register_info hf[] = {
15067
15068 { &hf_zbee_zcl_gp_attr_id,
15069 { "Attribute", "zbee_zcl_general.gp.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_gp_attr_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_attr_names
))))
,
15070 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
15071
15072 { &hf_zbee_zcl_gp_srv_rx_cmd_id,
15073 { "Command", "zbee_zcl_general.gp.cmd.srv_rx.id", FT_UINT8, BASE_HEX,
15074 VALS(zbee_zcl_gp_srv_rx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_srv_rx_cmd_names
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15075
15076 { &hf_zbee_zcl_gp_srv_tx_cmd_id,
15077 { "Command", "zbee_zcl_general.gp.cmd.srv_tx.id", FT_UINT8, BASE_HEX,
15078 VALS(zbee_zcl_gp_srv_tx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_srv_tx_cmd_names
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15079
15080 /* GP Proxy Commissioning Mode command */
15081 { &hf_zbee_gp_cmd_proxy_commissioning_mode_options,
15082 { "Options", "zbee_zcl_general.gp.proxy_comm_mode.options", FT_UINT8, BASE_HEX,
15083 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15084 { &hf_zbee_zcl_gp_commissioning_window,
15085 { "Commissioning window", "zbee_zcl_general.gp.proxy_comm_mode.comm_window", FT_UINT16, BASE_DEC,
15086 NULL((void*)0), 0x0, "Commissioning window in seconds", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15087 { &hf_zbee_zcl_gp_channel,
15088 { "Channel", "zbee_zcl_general.gp.proxy_comm_mode.channel", FT_UINT8, BASE_DEC,
15089 NULL((void*)0), 0x0, "Identifier of the channel the devices SHOULD switch to on reception", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15090 { &hf_zbee_gp_cmd_pcm_opt_action,
15091 { "Action", "zbee_zcl_general.gp.proxy_comm_mode.opt.action", FT_UINT8, BASE_DEC,
15092 VALS(zbee_zcl_gp_comm_mode_actions)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_comm_mode_actions
))))
, ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ACTION1, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15093 { &hf_zbee_gp_cmd_pcm_opt_exit_mode,
15094 { "Exit mode", "zbee_zcl_general.gp.proxy_comm_mode.opt.exit_mode", FT_UINT8, BASE_HEX,
15095 NULL((void*)0), ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_EXIT_MODE(7<<1), "Commissioning mode exit requirements", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15096 { &hf_zbee_gp_cmd_pcm_opt_channel_present,
15097 { "Channel present", "zbee_zcl_general.gp.proxy_comm_mode.opt.ch_present", FT_BOOLEAN, 8,
15098 NULL((void*)0), ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_CHANNEL_PRESENT(1<<4), "If set to 0b1, it indicates that the Channel field is present", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15099 { &hf_zbee_gp_cmd_pcm_opt_unicast_comm,
15100 { "Unicast", "zbee_zcl_general.gp.proxy_comm_mode.opt.unicast", FT_BOOLEAN, 8,
15101 NULL((void*)0), ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_UNICAST(1<<5), "Send the GP Commissioning Notification commands in broadcast (0) vs unicast (1)", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15102 { &hf_zbee_gp_cmd_proxy_commissioning_mode_exit_mode,
15103 { "Exit mode", "zbee_zcl_general.gp.proxy_comm_mode.opt.exit_mode", FT_UINT8, BASE_HEX,
15104 NULL((void*)0), ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_EXIT_MODE(7<<1), "Commissioning mode exit requirements", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15105 { &hf_zbee_gp_cmd_pcm_exit_mode_on_comm_window_expire,
15106 { "On Window expire", "zbee_zcl_general.gp.proxy_comm_mode.opt.exit_mode.win_expire", FT_BOOLEAN, 8,
15107 NULL((void*)0), ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_COMMISSIONING_WINDOW_EXPIRATION((1<<0)<<1), "On CommissioningWindow expiration", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15108 { &hf_zbee_gp_cmd_pcm_exit_mode_on_pairing_success,
15109 { "On first Pairing success", "zbee_zcl_general.gp.proxy_comm_mode.opt.exit_mode.pair_succs", FT_BOOLEAN, 8,
15110 NULL((void*)0), ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_PAIRING_SUCCESS((1<<1)<<1), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15111 { &hf_zbee_gp_cmd_pcm_exit_mode_on_gp_proxy_comm_mode,
15112 { "On GP Proxy Commissioning Mode", "zbee_zcl_general.gp.proxy_comm_mode.opt.exit_mode.proxy_comm_mode", FT_BOOLEAN, 8,
15113 NULL((void*)0), ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_GP_PROXY_COMM_MODE((1<<2)<<1), "On GP Proxy Commissioning Mode (exit)", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15114
15115 /* GP Commissioning Notification command */
15116 { &hf_zbee_gp_cmd_commissioning_notification_options,
15117 { "Options", "zbee_zcl_general.gp.comm_notif.options", FT_UINT16, BASE_HEX,
15118 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15119 { &hf_zbee_gp_cmd_comm_notif_opt_app_id,
15120 { "ApplicationID", "zbee_zcl_general.gp.comm_notif.opt.app_id", FT_UINT16, BASE_HEX,
15121 VALS(zbee_zcl_gp_app_ids)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_app_ids)
)))
, ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_APP_ID(7<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15122 { &hf_zbee_gp_cmd_comm_notif_opt_rx_after_tx,
15123 { "RxAfterTx", "zbee_zcl_general.gp.comm_notif.opt.rx_after_tx", FT_BOOLEAN, 16,
15124 NULL((void*)0), ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_RX_AFTER_TX(1<<3), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15125 { &hf_zbee_gp_cmd_comm_notif_opt_secur_level,
15126 { "SecurityLevel", "zbee_zcl_general.gp.comm_notif.opt.secur_lev", FT_UINT16, BASE_HEX,
15127 VALS(zbee_zcl_gp_secur_levels)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_secur_levels
))))
, ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_LEVEL(3<<4), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15128 { &hf_zbee_gp_cmd_comm_notif_opt_secur_key_type,
15129 { "SecurityKeyType", "zbee_zcl_general.gp.comm_notif.opt.secur_key_type", FT_UINT16, BASE_HEX,
15130 VALS(zbee_zcl_gp_secur_key_types)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_secur_key_types
))))
, ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_KEY_TYPE(7<<6), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15131 { &hf_zbee_gp_cmd_comm_notif_opt_secur_fail,
15132 { "Security processing failed", "zbee_zcl_general.gp.comm_notif.opt.secur_failed", FT_BOOLEAN, 16,
15133 NULL((void*)0), ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_FAILED(1<<9), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15134 { &hf_zbee_gp_cmd_comm_notif_opt_bidir_cap,
15135 { "Bidirectional Capability", "zbee_zcl_general.gp.comm_notif.opt.bidir_cap", FT_BOOLEAN, 16,
15136 NULL((void*)0), ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_BIDIR_CAP(1<<10), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15137 { &hf_zbee_gp_cmd_comm_notif_opt_proxy_info_present,
15138 { "Proxy info present", "zbee_zcl_general.gp.comm_notif.opt.proxy_info", FT_BOOLEAN, 16,
15139 NULL((void*)0), ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_PROXY_INFO_PRESENT(1<<11), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15140 { &hf_zbee_gp_src_id,
15141 { "SrcID", "zbee_zcl_general.gp.src_id", FT_UINT32, BASE_HEX,
15142 NULL((void*)0), 0, "GPD Source identifier", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15143 { &hf_zbee_gp_ieee,
15144 { "GPD IEEE", "zbee_zcl_general.gp.gpd_ieee", FT_EUI64, BASE_NONE,
15145 NULL((void*)0), 0, "GPD IEEE address", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15146 { &hf_zbee_gp_endpoint,
15147 { "Endpoint", "zbee_zcl_general.gp.endpoint", FT_UINT8, BASE_HEX,
15148 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15149 { &hf_zbee_gp_secur_frame_counter,
15150 { "Frame counter", "zbee_zcl_general.gp.frame_cnt", FT_UINT32, BASE_DEC,
15151 NULL((void*)0), 0, "GPD security frame counter", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15152 { &hf_zbee_gp_gpd_command_id,
15153 { "ZGPD CommandID", "zbee_zcl_general.gp.command_id", FT_UINT8, BASE_HEX | BASE_EXT_STRING0x00000200,
15154 &zbee_nwk_gp_cmd_names_ext, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15155 { &hf_zbee_gp_short_addr,
15156 { "GPP short address", "zbee_zcl_general.gp.gpp_short", FT_UINT16, BASE_HEX,
15157 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15158 { &hf_zbee_gp_gpp_gpd_link,
15159 { "GPP-GPD link", "zbee_zcl_general.gp.gpd_gpp_link", FT_UINT8, BASE_HEX,
15160 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15161 { &hf_zbee_gp_mic,
15162 { "MIC", "zbee_zcl_general.gp.mic", FT_UINT32, BASE_HEX,
15163 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15164 { &hf_zbee_gpp_gpd_link_rssi,
15165 { "RSSI", "zbee_zcl_general.gp.gpp_gpd_link.rssi", FT_UINT8, BASE_HEX,
15166 NULL((void*)0), ZBEE_ZCL_GP_GPP_GPD_LINK_RSSI0x3f, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15167 { &hf_zbee_gpp_gpd_link_lqi,
15168 { "LQI", "zbee_zcl_general.gp.gpp_gpd_link.lqi", FT_UINT8, BASE_HEX,
15169 VALS(zbee_zcl_gp_lqi_vals)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_lqi_vals
))))
, ZBEE_ZCL_GP_GPP_GPD_LINK_LQI(3<<6), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15170 { &hf_zbee_gp_gpd_payload_size,
15171 { "Payload size", "zbee_zcl_general.gp.payload_size", FT_UINT8, BASE_DEC,
15172 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15173
15174 /* GP Notification */
15175 { &hf_zbee_gp_cmd_notification_options,
15176 { "Options", "zbee_zcl_general.gp.notif.opt", FT_UINT16, BASE_HEX,
15177 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15178 { &hf_zbee_gp_cmd_notif_opt_app_id,
15179 { "ApplicationID", "zbee_zcl_general.gp.notif.opt.app_id", FT_UINT16, BASE_HEX,
15180 VALS(zbee_zcl_gp_app_ids)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_app_ids)
)))
, ZBEE_ZCL_GP_NOTIFICATION_OPTION_APP_ID(7<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15181 { &hf_zbee_gp_cmd_notif_opt_also_unicast,
15182 { "Also Unicast", "zbee_zcl_general.gp.notif.opt.also_unicast", FT_BOOLEAN, 16,
15183 NULL((void*)0), ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_UNICAST(1<<3), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15184 { &hf_zbee_gp_cmd_notif_opt_also_derived_group,
15185 { "Also Derived Group", "zbee_zcl_general.gp.notif.opt.also_derived_grp", FT_BOOLEAN, 16,
15186 NULL((void*)0), ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_DERIVED_GROUP(1<<4), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15187 { &hf_zbee_gp_cmd_notif_opt_also_comm_group,
15188 { "Also Commissioned Group", "zbee_zcl_general.gp.notif.opt.also_comm_grp", FT_BOOLEAN, 16,
15189 NULL((void*)0), ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_COMMISSIONED_GROUP(1<<5), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15190 { &hf_zbee_gp_cmd_notif_opt_secur_level,
15191 { "SecurityLevel", "zbee_zcl_general.gp.notif.opt.secur_lev", FT_UINT16, BASE_HEX,
15192 VALS(zbee_zcl_gp_secur_levels)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_secur_levels
))))
, ZBEE_ZCL_GP_NOTIFICATION_OPTION_SECUR_LEVEL(3<<6), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15193 { &hf_zbee_gp_cmd_notif_opt_secur_key_type,
15194 { "SecurityKeyType", "zbee_zcl_general.gp.notif.opt.secur_key_type", FT_UINT16, BASE_HEX,
15195 VALS(zbee_zcl_gp_secur_key_types)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_secur_key_types
))))
, ZBEE_ZCL_GP_NOTIFICATION_OPTION_SECUR_KEY_TYPE(7<<8), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15196 { &hf_zbee_gp_cmd_notif_opt_rx_after_tx,
15197 { "RxAfterTx", "zbee_zcl_general.gp.comm_notif.opt.rx_after_tx", FT_BOOLEAN, 16,
15198 NULL((void*)0), ZBEE_ZCL_GP_NOTIFICATION_OPTION_RX_AFTER_TX(1<<11), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15199 { &hf_zbee_gp_cmd_notif_opt_tx_q_full,
15200 { "gpTxQueueFull", "zbee_zcl_general.gp.comm_notif.opt.tx_q_full", FT_BOOLEAN, 16,
15201 NULL((void*)0), ZBEE_ZCL_GP_NOTIFICATION_OPTION_TX_Q_FULL(1<<12), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15202 { &hf_zbee_gp_cmd_notif_opt_bidir_cap,
15203 { "Bidirectional Capability", "zbee_zcl_general.gp.notif.opt.bidir_cap", FT_BOOLEAN, 16,
15204 NULL((void*)0), ZBEE_ZCL_GP_NOTIFICATION_OPTION_BIDIR_CAP(1<<13), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15205 { &hf_zbee_gp_cmd_notif_opt_proxy_info_present,
15206 { "Proxy info present", "zbee_zcl_general.gp.notif.opt.proxy_info", FT_BOOLEAN, 16,
15207 NULL((void*)0), ZBEE_ZCL_GP_NOTIFICATION_OPTION_PROXY_INFO_PRESENT(1<<14), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15208
15209
15210 /* GP Pairing */
15211 { &hf_zbee_gp_cmd_pairing_opt_app_id,
15212 { "ApplicationID", "zbee_zcl_general.gp.pairing.opt.app_id", FT_UINT24, BASE_HEX,
15213 VALS(zbee_zcl_gp_app_ids)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_app_ids)
)))
, ZBEE_ZCL_GP_PAIRING_OPTION_APP_ID(7<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15214 { &hf_zbee_gp_cmd_pairing_opt_add_sink,
15215 { "Add Sink", "zbee_zcl_general.gp.pairing.opt.add_sink", FT_BOOLEAN, 24,
15216 NULL((void*)0), ZBEE_ZCL_GP_PAIRING_OPTION_ADD_SINK(1<<3), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15217 { &hf_zbee_gp_cmd_pairing_opt_remove_gpd,
15218 { "Remove GPD", "zbee_zcl_general.gp.pairing.opt.remove_gpd", FT_BOOLEAN, 24,
15219 NULL((void*)0), ZBEE_ZCL_GP_PAIRING_OPTION_REMOVE_GPD(1<<4), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15220 { &hf_zbee_gp_cmd_pairing_opt_communication_mode,
15221 { "Communication mode", "zbee_zcl_general.gp.pairing.opt.comm_mode", FT_UINT24, BASE_HEX,
15222 VALS(zbee_zcl_gp_communication_modes)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_communication_modes
))))
, ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE(3<<5), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15223 { &hf_zbee_gp_cmd_pairing_opt_gpd_fixed,
15224 { "GPD Fixed", "zbee_zcl_general.gp.pairing.opt.gpd_fixed", FT_BOOLEAN, 24,
15225 NULL((void*)0), ZBEE_ZCL_GP_PAIRING_OPTION_GPD_FIXED(1<<7), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15226 { &hf_zbee_gp_cmd_pairing_opt_gpd_mac_seq_num_cap,
15227 { "MAC Seq number cap", "zbee_zcl_general.gp.pairing.opt.seq_num_cap", FT_BOOLEAN, 24,
15228 NULL((void*)0), ZBEE_ZCL_GP_PAIRING_OPTION_GPD_MAC_SEQ_NUM_CAP(1<<8), "GPD MAC sequence number capabilities", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15229 { &hf_zbee_gp_cmd_pairing_opt_secur_level,
15230 { "SecurityLevel", "zbee_zcl_general.gp.pairing.opt.secur_lev", FT_UINT24, BASE_HEX,
15231 VALS(zbee_zcl_gp_secur_levels)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_secur_levels
))))
, ZBEE_ZCL_GP_PAIRING_OPTION_SECUR_LEVEL(3<<9), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15232 { &hf_zbee_gp_cmd_pairing_opt_secur_key_type,
15233 { "SecurityKeyType", "zbee_zcl_general.gp.pairing.opt.secur_key_type", FT_UINT24, BASE_HEX,
15234 VALS(zbee_zcl_gp_secur_key_types)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_secur_key_types
))))
, ZBEE_ZCL_GP_PAIRING_OPTION_SECUR_KEY_TYPE(7<<11), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15235 { &hf_zbee_gp_cmd_pairing_opt_gpd_frame_cnt_present,
15236 { "Frame Counter present", "zbee_zcl_general.gp.pairing.opt.frame_counter_present", FT_BOOLEAN, 24,
15237 NULL((void*)0), ZBEE_ZCL_GP_PAIRING_OPTION_GPD_FRAME_CNT_PRESENT(1<<14), "GPD security Frame Counter present", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15238 { &hf_zbee_gp_cmd_pairing_opt_gpd_secur_key_present,
15239 { "Key present", "zbee_zcl_general.gp.pairing.opt.key_present", FT_BOOLEAN, 24,
15240 NULL((void*)0), ZBEE_ZCL_GP_PAIRING_OPTION_GPD_SECUR_KEY_PRESENT(1<<15), "GPD security key present", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15241 { &hf_zbee_gp_cmd_pairing_opt_assigned_alias_present,
15242 { "Assigned Alias present", "zbee_zcl_general.gp.pairing.opt.asn_alias_present", FT_BOOLEAN, 24,
15243 NULL((void*)0), ZBEE_ZCL_GP_PAIRING_OPTION_ASSIGNED_ALIAS_PRESENT(1<<16), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15244 { &hf_zbee_gp_cmd_pairing_opt_fwd_radius_present,
15245 { "Forwarding Radius present", "zbee_zcl_general.gp.pairing.opt.fwd_radius_present", FT_BOOLEAN, 24,
15246 NULL((void*)0), ZBEE_ZCL_GP_PAIRING_OPTION_FWD_RADIUS_PRESENT(1<<17), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15247 { &hf_zbee_gp_cmd_pairing_options,
15248 { "Options", "zbee_zcl_general.gp.pairing.opt", FT_UINT24, BASE_HEX,
15249 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15250 { &hf_zbee_gp_sink_ieee,
15251 { "Sink IEEE", "zbee_zcl_general.gp.sink_ieee", FT_EUI64, BASE_NONE,
15252 NULL((void*)0), 0, "Sink IEEE address", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15253 { &hf_zbee_gp_sink_nwk,
15254 { "Sink NWK", "zbee_zcl_general.gp.sink_nwk", FT_UINT16, BASE_HEX,
15255 NULL((void*)0), 0, "Sink NWK address", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15256 { &hf_zbee_gp_sink_group_id,
15257 { "Sink GroupID", "zbee_zcl_general.gp.sink_grp", FT_UINT16, BASE_HEX,
15258 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15259 { &hf_zbee_gp_device_id,
15260 { "DeviceID", "zbee_zcl_general.gp.dev_id", FT_UINT8, BASE_HEX,
15261 VALS(zbee_nwk_gp_device_ids_names)((0 ? (const struct _value_string*)0 : ((zbee_nwk_gp_device_ids_names
))))
, 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15262 { &hf_zbee_gp_assigned_alias,
15263 { "Assigned alias", "zbee_zcl_general.gp.asn_alias", FT_UINT16, BASE_HEX,
15264 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15265 { &hf_zbee_gp_forwarding_radius,
15266 { "Forwarding Radius", "zbee_zcl_general.gp.fw_radius", FT_UINT8, BASE_HEX,
15267 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15268 { &hf_zbee_gp_gpd_key,
15269 { "GPD key", "zbee_zcl_general.gp.gpd_key", FT_BYTES, BASE_NONE,
15270 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15271 { &hf_zbee_gp_groupcast_radius,
15272 { "Groupcast radius", "zbee_zcl_general.gp.groupcast_radius", FT_UINT8, BASE_DEC,
15273 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15274
15275 /* GP Response */
15276 { &hf_zbee_gp_cmd_response_options,
15277 { "Options", "zbee_zcl_general.gp.response.opt", FT_UINT8, BASE_HEX,
15278 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15279 { &hf_zbee_gp_cmd_resp_opt_app_id,
15280 { "ApplicationID", "zbee_zcl_general.gp.response.opt.app_id", FT_UINT8, BASE_HEX,
15281 NULL((void*)0), ZBEE_ZCL_GP_RESPONSE_OPTION_APP_ID(7<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15282 { &hf_zbee_gp_cmd_resp_opt_tx_on_ep_match,
15283 { "Transmit on endpoint match", "zbee_zcl_general.gp.response.opt.tx_on_ep_match", FT_UINT8, BASE_HEX,
15284 NULL((void*)0), ZBEE_ZCL_GP_RESPONSE_OPTION_TX_ON_ENDPOINT_MATCH(1<<3), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15285 { &hf_zbee_gp_cmd_response_tx_channel,
15286 { "TempMaster Tx channel", "zbee_zcl_general.gp.response.tmpmaster_tx_chan", FT_UINT8, BASE_HEX,
15287 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15288 { &hf_zbee_gp_cmd_resp_tx_channel,
15289 { "Transmit channel", "zbee_zcl_general.gp.response.opt.tx_chan", FT_UINT8, BASE_HEX,
15290 VALS(zbee_zcl_gp_channels)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_channels
))))
, ZBEE_ZCL_GP_RESPONSE_TX_CHANNEL(0xf<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15291 { &hf_zbee_gp_tmp_master_short_addr,
15292 { "TempMaster short address", "zbee_zcl_general.gp.response.tmpmaster_addr", FT_UINT16, BASE_HEX,
15293 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15294
15295 /* GP Pairing Configuration */
15296 { &hf_zbee_gp_cmd_pc_actions_action,
15297 { "Action", "zbee_zcl_general.gp.pc.action.action", FT_UINT8, BASE_HEX,
15298 VALS(zbee_gp_pc_actions)((0 ? (const struct _value_string*)0 : ((zbee_gp_pc_actions))
))
, ZBEE_ZCL_GP_CMD_PC_ACTIONS_ACTION(7<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15299 { &hf_zbee_gp_cmd_pc_actions_send_gp_pairing,
15300 { "Send GP Pairing", "zbee_zcl_general.gp.pc.action.send_gp_pairing", FT_BOOLEAN, 8,
15301 NULL((void*)0), ZBEE_ZCL_GP_CMD_PC_ACTIONS_SEND_GP_PAIRING(1<<3), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15302 { &hf_zbee_gp_cmd_pc_opt_app_id,
15303 { "ApplicationID", "zbee_zcl_general.gp.pp.opt.app_id", FT_UINT16, BASE_HEX,
15304 NULL((void*)0), ZBEE_ZCL_GP_CMD_PC_OPT_APP_ID(7<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15305 { &hf_zbee_gp_cmd_pc_opt_communication_mode,
15306 { "Communication mode", "zbee_zcl_general.gp.pc.opt.comm_mode", FT_UINT16, BASE_HEX,
15307 VALS(zbee_zcl_gp_communication_modes)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_communication_modes
))))
, ZBEE_ZCL_GP_CMD_PC_OPT_COMMUNICATION_MODE(3<<3), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15308 { &hf_zbee_gp_cmd_pc_opt_seq_number_cap,
15309 { "Sequence number capabilities", "zbee_zcl_general.gp.pc.opt.seq_num_cap", FT_BOOLEAN, 16,
15310 NULL((void*)0), ZBEE_ZCL_GP_CMD_PC_OPT_SEQ_NUMBER_CAP(1<<5), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15311 { &hf_zbee_gp_cmd_px_opt_rx_on_cap,
15312 { "RxOnCapability", "zbee_zcl_general.gp.pc.opt.rx_on_cap", FT_BOOLEAN, 16,
15313 NULL((void*)0), ZBEE_ZCL_GP_CMD_PC_OPT_RX_ON_CAP(1<<6), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15314 { &hf_zbee_gp_cmd_pc_opt_fixed_location,
15315 { "FixedLocation", "zbee_zcl_general.gp.pc.opt.fixed_loc", FT_BOOLEAN, 16,
15316 NULL((void*)0), ZBEE_ZCL_GP_CMD_PC_OPT_FIXED_LOCATION(1<<7), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15317 { &hf_zbee_gp_cmd_pc_opt_assigned_alias,
15318 { "AssignedAlias", "zbee_zcl_general.gp.pc.opt.asn_alias", FT_BOOLEAN, 16,
15319 NULL((void*)0), ZBEE_ZCL_GP_CMD_PC_OPT_ASSIGNED_ALIAS(1<<8), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15320 { &hf_zbee_gp_cmd_pc_opt_security_use,
15321 { "Security use", "zbee_zcl_general.gp.pc.opt.secur_use", FT_BOOLEAN, 16,
15322 NULL((void*)0), ZBEE_ZCL_GP_CMD_PC_OPT_SECURITY_USE(1<<9), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15323 { &hf_zbee_gp_cmd_pc_opt_app_info_present,
15324 { "Application in-formation present", "zbee_zcl_general.gp.pc.opt.app_info_present", FT_BOOLEAN, 16,
15325 NULL((void*)0), ZBEE_ZCL_GP_CMD_PC_OPT_APP_INFO_PRESENT(1<<10), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15326 { &hf_zbee_gp_cmd_pc_secur_level,
15327 { "SecurityLevel", "zbee_zcl_general.gp.pc.secur.secur_lev", FT_UINT8, BASE_HEX,
15328 VALS(zbee_zcl_gp_secur_levels)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_secur_levels
))))
, ZBEE_ZCL_GP_CMD_PC_SECUR_LEVEL(3<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15329 { &hf_zbee_gp_cmd_pc_secur_key_type,
15330 { "SecurityKeyType", "zbee_zcl_general.gp.pc.secur.secur_key_type", FT_UINT8, BASE_HEX,
15331 VALS(zbee_zcl_gp_secur_key_types)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_secur_key_types
))))
, ZBEE_ZCL_GP_CMD_PC_SECUR_KEY_TYPE(7<<2), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15332 { &hf_zbee_gp_cmd_pc_app_info_manuf_id_present,
15333 { "ManufacturerID present", "zbee_zcl_general.gp.pc.app.manuf_id_present", FT_BOOLEAN, 8,
15334 NULL((void*)0), ZBEE_ZCL_GP_CMD_PC_APP_INFO_MANUF_ID_PRESENT(1<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15335 { &hf_zbee_gp_cmd_pc_app_info_model_id_present,
15336 { "ModelID present", "zbee_zcl_general.gp.pc.app.model_id_present", FT_BOOLEAN, 8,
15337 NULL((void*)0), ZBEE_ZCL_GP_CMD_PC_APP_INFO_MODEL_ID_PRESENT(1<<1), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15338 { &hf_zbee_gp_cmd_pc_app_info_gpd_commands_present,
15339 { "GPD commands present", "zbee_zcl_general.gp.pc.app.gpd_cmds_present", FT_BOOLEAN, 8,
15340 NULL((void*)0), ZBEE_ZCL_GP_CMD_PC_APP_INFO_GPD_COMMANDS_PRESENT(1<<2), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15341 { &hf_zbee_gp_cmd_pc_app_info_cluster_list_present,
15342 { "Cluster list present", "zbee_zcl_general.gp.pc.app.cluster_list_present", FT_BOOLEAN, 8,
15343 NULL((void*)0), ZBEE_ZCL_GP_CMD_PC_APP_INFO_CLUSTER_LIST_PRESENT(1<<3), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15344 { &hf_zbee_gp_cmd_pc_actions,
15345 { "Actions", "zbee_zcl_general.gp.pc.actions", FT_UINT8, BASE_HEX,
15346 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15347 { &hf_zbee_gp_cmd_pc_options,
15348 { "Options", "zbee_zcl_general.gp.pc.options", FT_UINT16, BASE_HEX,
15349 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15350 { &hf_zbee_gp_group_list_len,
15351 { "Group list length", "zbee_zcl_general.gp.group_list.len", FT_UINT8, BASE_DEC,
15352 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15353 { &hf_zbee_gp_group_list_group_id,
15354 { "Group id", "zbee_zcl_general.gp.group_list.group", FT_UINT16, BASE_HEX,
15355 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15356 { &hf_zbee_gp_group_list_alias,
15357 { "Alias", "zbee_zcl_general.gp.group_list.alias", FT_UINT16, BASE_HEX,
15358 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15359 { &hf_zbee_gp_cmd_pc_secur_options,
15360 { "Security Options", "zbee_zcl_general.gp.pc.secur_options", FT_UINT8, BASE_HEX,
15361 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15362 { &hf_zbee_gp_n_paired_endpoints,
15363 { "Number of paired endpoints", "zbee_zcl_general.gp.pc.n_ep", FT_UINT8, BASE_DEC,
15364 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15365 { &hf_zbee_gp_paired_endpoint,
15366 { "Paired endpoint", "zbee_zcl_general.gp.pc.endpoint", FT_UINT8, BASE_HEX,
15367 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15368 { &hf_zbee_gp_cmd_pc_app_info,
15369 { "Application information", "zbee_zcl_general.gp.pc.app_info", FT_UINT8, BASE_HEX,
15370 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15371 { &hf_zbee_zcl_gp_manufacturer_id,
15372 { "Manufacturer ID", "zbee_zcl_general.gp.pc.manufacturer_id", FT_UINT16, BASE_HEX,
15373 VALS(zbee_mfr_code_names)((0 ? (const struct _value_string*)0 : ((zbee_mfr_code_names)
)))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15374 { &hf_zbee_zcl_gp_model_id,
15375 { "Model ID", "zbee_zcl_general.gp.pc.model_id", FT_UINT16, BASE_HEX,
15376 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15377 { &hf_zbee_gp_n_gpd_commands,
15378 { "Number of GPD commands", "zbee_zcl_general.gp.pc.n_gpd_commands", FT_UINT8, BASE_DEC,
15379 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15380 { &hf_zbee_gp_gpd_command,
15381 { "ZGPD Command ID", "zbee_zcl_general.gp.pc.gpd_command", FT_UINT8, BASE_HEX | BASE_EXT_STRING0x00000200,
15382 &zbee_nwk_gp_cmd_names_ext, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15383 { &hf_zbee_gp_n_srv_clusters,
15384 { "Number of Server clusters", "zbee_zcl_general.gp.pc.n_srv_clusters", FT_UINT8, BASE_DEC,
15385 NULL((void*)0), ZBEE_ZCL_GP_CLUSTER_LIST_LEN_SRV(0xf<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15386 { &hf_zbee_gp_n_cli_clusters,
15387 { "Number of Client clusters", "zbee_zcl_general.gp.pc.n_clnt_clusters", FT_UINT8, BASE_DEC,
15388 NULL((void*)0), ZBEE_ZCL_GP_CLUSTER_LIST_LEN_CLI(0xf<<4), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15389 { &hf_zbee_gp_gpd_cluster_id,
15390 { "Cluster ID", "zbee_zcl_general.gp.pc.cluster", FT_UINT16, BASE_HEX | BASE_RANGE_STRING0x00000100, RVALS(zbee_aps_cid_names)((0 ? (const struct _range_string*)0 : ((zbee_aps_cid_names))
))
,
15391 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15392
15393 /* GP Sink Table Request and GP Proxy Table Request commands */
15394 { &hf_zbee_zcl_proxy_sink_tbl_req_options,
15395 { "Options", "zbee_zcl_general.gp.proxy_sink_tbl_req.options", FT_UINT8, BASE_HEX,
15396 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15397 { &hf_zbee_zcl_proxy_sink_tbl_req_fld_app_id,
15398 { "Application ID", "zbee_zcl_general.gp.proxy_sink_tbl_req.options.app_id", FT_UINT8, BASE_HEX,
15399 NULL((void*)0), ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_APP_ID(0x07<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15400 { &hf_zbee_zcl_proxy_sink_tbl_req_fld_req_type,
15401 { "Request type", "zbee_zcl_general.gp.proxy_sink_tbl_req.options.req_type", FT_UINT8, BASE_HEX,
15402 VALS(zbee_zcl_gp_proxy_sink_tbl_req_type)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_proxy_sink_tbl_req_type
))))
, ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_REQ_TYPE(0x03<<3), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15403 { &hf_zbee_zcl_proxy_sink_tbl_req_index,
15404 { "Index", "zbee_zcl_general.gp.proxy_sink_tbl_req.index", FT_UINT8, BASE_DEC,
15405 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15406
15407 /* GP Sink Table Response and GP Proxy Table Response commands */
15408 { &hf_zbee_zcl_proxy_sink_tbl_resp_status,
15409 { "Status", "zbee_zcl_general.gp.proxy_sink_tbl_resp.status", FT_UINT8, BASE_HEX,
15410 VALS(zbee_zcl_status_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_status_names
))))
, 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15411 { &hf_zbee_zcl_proxy_sink_tbl_resp_entries_total,
15412 { "Total number of non-empty entries", "zbee_zcl_general.gp.proxy_sink_tbl_resp.entries_total", FT_UINT8, BASE_DEC,
15413 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15414 { &hf_zbee_zcl_proxy_sink_tbl_resp_start_index,
15415 { "Start index", "zbee_zcl_general.gp.proxy_sink_tbl_resp.start_index", FT_UINT8, BASE_DEC,
15416 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15417 { &hf_zbee_zcl_proxy_sink_tbl_resp_entries_count,
15418 { "Entries count", "zbee_zcl_general.gp.proxy_sink_tbl_resp.entries_count", FT_UINT8, BASE_DEC,
15419 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15420
15421 /* GP Sink Commissioning Mode command */
15422 { &hf_zbee_zcl_gp_cmd_sink_comm_mode_options,
15423 { "Options", "zbee_zcl_general.gp.sink_comm_mode.options", FT_UINT8, BASE_HEX,
15424 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15425
15426 { &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_action,
15427 { "Action", "zbee_zcl_general.gp.sink_comm_mode.options.action", FT_BOOLEAN, 8,
15428 NULL((void*)0), ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_ACTION(1<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15429 { &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_secur,
15430 { "Involve GPM in security", "zbee_zcl_general.gp.sink_comm_mode.options.inv_gpm_in_secur", FT_BOOLEAN, 8,
15431 NULL((void*)0), ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_GPM_IN_SECUR(1<<1), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15432 { &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_pairing,
15433 { "Involve GPM in pairing", "zbee_zcl_general.gp.sink_comm_mode.options.inv_gpm_in_pairing", FT_BOOLEAN, 8,
15434 NULL((void*)0), ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_GPM_IN_PAIRING(1<<2), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15435 { &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_proxies,
15436 { "Involve proxies", "zbee_zcl_general.gp.sink_comm_mode.options.inv_proxies", FT_BOOLEAN, 8,
15437 NULL((void*)0), ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_PROXIES(1<<3), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15438
15439 { &hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_secur,
15440 { "GPM address for security", "zbee_zcl_general.gp.sink_comm_mode.gpm_addr_for_secur", FT_UINT16, BASE_HEX,
15441 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15442 { &hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_pairing,
15443 { "GPM address for pairing", "zbee_zcl_general.gp.sink_comm_mode.gpm_addr_for_pairing", FT_UINT16, BASE_HEX,
15444 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15445 { &hf_zbee_gp_zcl_cmd_sink_comm_mode_sink_ep,
15446 { "Sink Endpoint", "zbee_zcl_general.gp.sink_comm_mode.sink_ep", FT_UINT8, BASE_DEC,
15447 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15448
15449 /* GP Sink Table attribute */
15450 { &hf_zbee_gp_sink_tbl_length,
15451 { "Sink Table length", "zbee_zcl_general.gp.sink_tbl_len", FT_UINT16, BASE_DEC,
15452 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15453 { &hf_zbee_gp_sink_tbl_entry_options,
15454 { "Options", "zbee_zcl_general.gp.sink_tbl.entry.opt", FT_UINT16, BASE_HEX,
15455 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15456 { &hf_zbee_gp_sec_options,
15457 { "Security Options", "zbee_zcl_general.gp.secur", FT_UINT8, BASE_HEX,
15458 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15459
15460 { &hf_zbee_gp_sink_tbl_entry_options_app_id,
15461 { "ApplicationID", "zbee_zcl_general.gp.sink_tbl.entry.opt.app_id", FT_UINT16, BASE_HEX,
15462 NULL((void*)0), ZBEE_ZCL_GP_SINK_TBL_OPT_APP_ID(7<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15463 { &hf_zbee_gp_sink_tbl_entry_options_comm_mode,
15464 { "Communication Mode", "zbee_zcl_general.gp.sink_tbl.entry.opt.comm_mode", FT_UINT16, BASE_HEX,
15465 VALS(zbee_zcl_gp_communication_modes)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_communication_modes
))))
, ZBEE_ZCL_GP_SINK_TBL_OPT_COMMUNICATION_MODE(3<<3), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15466 { &hf_zbee_gp_sink_tbl_entry_options_seq_num_cap,
15467 { "Sequence number capabilities", "zbee_zcl_general.gp.sink_tbl.entry.opt.seq_num_cap", FT_BOOLEAN, 16,
15468 NULL((void*)0), ZBEE_ZCL_GP_SINK_TBL_OPT_SEQ_NUMBER_CAP(1<<5), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15469 { &hf_zbee_gp_sink_tbl_entry_options_rx_on_cap,
15470 { "Rx On Capability", "zbee_zcl_general.gp.sink_tbl.entry.opt.rx_on_cap", FT_BOOLEAN, 16,
15471 NULL((void*)0), ZBEE_ZCL_GP_SINK_TBL_OPT_RX_ON_CAP(1<<6), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15472 { &hf_zbee_gp_sink_tbl_entry_options_fixed_loc,
15473 { "Fixed Location", "zbee_zcl_general.gp.sink_tbl.entry.opt.fixed_loc", FT_BOOLEAN, 16,
15474 NULL((void*)0), ZBEE_ZCL_GP_SINK_TBL_OPT_FIXED_LOCATION(1<<7), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15475 { &hf_zbee_gp_sink_tbl_entry_options_assigned_alias,
15476 { "Assigned Alias", "zbee_zcl_general.gp.sink_tbl.entry.opt.asn_alias", FT_BOOLEAN, 16,
15477 NULL((void*)0), ZBEE_ZCL_GP_SINK_TBL_OPT_ASSIGNED_ALIAS(1<<8), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15478 { &hf_zbee_gp_sink_tbl_entry_options_sec_use,
15479 { "Security use", "zbee_zcl_general.gp.sink_tbl.entry.opt.secur_use", FT_BOOLEAN, 16,
15480 NULL((void*)0), ZBEE_ZCL_GP_SINK_TBL_OPT_SECURITY_USE(1<<9), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15481
15482 { &hf_zbee_gp_sec_options_sec_level,
15483 { "Security Level", "zbee_zcl_general.gp.secur.secur_lev", FT_UINT8, BASE_HEX,
15484 VALS(zbee_zcl_gp_secur_levels)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_secur_levels
))))
, ZBEE_ZCL_GP_SECUR_OPT_SECUR_LEVEL(3<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15485 { &hf_zbee_gp_sec_options_sec_key_type,
15486 { "Security Key Type", "zbee_zcl_general.gp.secur.secur_key_type", FT_UINT8, BASE_HEX,
15487 VALS(zbee_zcl_gp_secur_key_types)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_secur_key_types
))))
, ZBEE_ZCL_GP_SECUR_OPT_SECUR_KEY_TYPE(7<<2), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15488
15489 /* GP Proxy Table attribute */
15490 { &hf_zbee_gp_proxy_tbl_length,
15491 { "Proxy Table length", "zbee_zcl_general.gp.proxy_tbl_len", FT_UINT16, BASE_DEC,
15492 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15493 { &hf_zbee_gp_proxy_tbl_entry_options,
15494 { "Options", "zbee_zcl_general.gp.proxy_tbl.entry.opt", FT_UINT16, BASE_HEX,
15495 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15496 { &hf_zbee_gp_proxy_tbl_entry_ext_options,
15497 { "Extended Options", "zbee_zcl_general.gp.proxy_tbl.entry.ext_opt", FT_UINT8, BASE_HEX,
15498 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15499
15500 { &hf_zbee_gp_proxy_tbl_entry_options_app_id,
15501 { "ApplicationID", "zbee_zcl_general.gp.proxy_tbl.entry.opt.app_id", FT_UINT16, BASE_HEX,
15502 NULL((void*)0), ZBEE_ZCL_GP_PROXY_TBL_OPT_APP_ID(7<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15503 { &hf_zbee_gp_proxy_tbl_entry_options_entry_active,
15504 { "EntryActive", "zbee_zcl_general.gp.proxy_tbl.entry.opt.entry_active", FT_BOOLEAN, 16,
15505 NULL((void*)0), ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_ACTIVE(1<<3), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15506 { &hf_zbee_gp_proxy_tbl_entry_options_entry_valid,
15507 { "EntryValid", "zbee_zcl_general.gp.proxy_tbl.entry.opt.entry_valid", FT_BOOLEAN, 16,
15508 NULL((void*)0), ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_VALID(1<<4), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15509 { &hf_zbee_gp_proxy_tbl_entry_options_seq_num_cap,
15510 { "Sequence number capabilities", "zbee_zcl_general.gp.proxy_tbl.entry.opt.seq_num_cap", FT_BOOLEAN, 16,
15511 NULL((void*)0), ZBEE_ZCL_GP_PROXY_TBL_OPT_SEQ_NUMBER_CAP(1<<5), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15512 { &hf_zbee_gp_proxy_tbl_entry_options_lw_ucast_gps,
15513 { "Lightweight Unicast GPS", "zbee_zcl_general.gp.proxy_tbl.entry.opt.lw_ucast_gps", FT_BOOLEAN, 16,
15514 NULL((void*)0), ZBEE_ZCL_GP_PROXY_TBL_OPT_LW_UCAST_GPS(1<<6), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15515 { &hf_zbee_gp_proxy_tbl_entry_options_derived_group_gps,
15516 { "Derived Group GPS", "zbee_zcl_general.gp.proxy_tbl.entry.opt.derived_group_gps", FT_BOOLEAN, 16,
15517 NULL((void*)0), ZBEE_ZCL_GP_PROXY_TBL_OPT_DERIVED_GROUP_GPS(1<<7), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15518 { &hf_zbee_gp_proxy_tbl_entry_options_comm_group_gps,
15519 { "Commissioned Group GPS", "zbee_zcl_general.gp.proxy_tbl.entry.opt.comm_group_gps", FT_BOOLEAN, 16,
15520 NULL((void*)0), ZBEE_ZCL_GP_PROXY_TBL_OPT_COMM_GROUP_GPS(1<<8), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15521 { &hf_zbee_gp_proxy_tbl_entry_options_first_to_forward,
15522 { "FirstToForward", "zbee_zcl_general.gp.proxy_tbl.entry.opt.first_to_forward", FT_BOOLEAN, 16,
15523 NULL((void*)0), ZBEE_ZCL_GP_PROXY_TBL_OPT_FIRST_TO_FORWARD(1<<9), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15524 { &hf_zbee_gp_proxy_tbl_entry_options_in_range,
15525 { "InRange", "zbee_zcl_general.gp.proxy_tbl.entry.opt.in_range", FT_BOOLEAN, 16,
15526 NULL((void*)0), ZBEE_ZCL_GP_PROXY_TBL_OPT_IN_RANGE(1<<10), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15527 { &hf_zbee_gp_proxy_tbl_entry_options_gpd_fixed,
15528 { "GPD Fixed", "zbee_zcl_general.gp.proxy_tbl.entry.opt.gpd_fixed", FT_BOOLEAN, 16,
15529 NULL((void*)0), ZBEE_ZCL_GP_PROXY_TBL_OPT_GPD_FIXED(1<<11), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15530 { &hf_zbee_gp_proxy_tbl_entry_options_has_all_ucast_routes,
15531 { "HasAllUnicastRoutes", "zbee_zcl_general.gp.proxy_tbl.entry.opt.has_all_ucast_routes", FT_BOOLEAN, 16,
15532 NULL((void*)0), ZBEE_ZCL_GP_PROXY_TBL_OPT_HAS_ALL_UCAST_ROUTES(1<<12), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15533 { &hf_zbee_gp_proxy_tbl_entry_options_assigned_alias,
15534 { "AssignedAlias", "zbee_zcl_general.gp.proxy_tbl.entry.opt.asn_alias", FT_BOOLEAN, 16,
15535 NULL((void*)0), ZBEE_ZCL_GP_PROXY_TBL_OPT_ASSIGNED_ALIAS(1<<13), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15536 { &hf_zbee_gp_proxy_tbl_entry_options_sec_use,
15537 { "SecurityUse", "zbee_zcl_general.gp.proxy_tbl.entry.opt.secur_use", FT_BOOLEAN, 16,
15538 NULL((void*)0), ZBEE_ZCL_GP_PROXY_TBL_OPT_SECURITY_USE(1<<14), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15539 { &hf_zbee_gp_proxy_tbl_entry_options_opt_ext,
15540 { "Options Extension", "zbee_zcl_general.gp.proxy_tbl.entry.opt.ext_opt", FT_BOOLEAN, 16,
15541 NULL((void*)0), ZBEE_ZCL_GP_PROXY_TBL_OPT_OPTIONS_EXTENTIONS(1<<15), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15542
15543 { &hf_zbee_gp_proxy_tbl_entry_search_counter,
15544 { "Search Counter", "zbee_zcl_general.gp.proxy_tbl.entry.search_counter", FT_UINT8, BASE_DEC,
15545 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15546
15547 { &hf_zbee_gp_proxy_tbl_entry_ext_options_full_ucast_gps,
15548 { "Full unicast GPS", "zbee_zcl_general.gp.proxy_tbl.entry.ext_opt.full_ucast_gps", FT_BOOLEAN, 16,
15549 NULL((void*)0), ZBEE_ZCL_GP_PROXY_TBL_EXT_OPT_FULL_UCAST_GPS(1<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15550
15551 { &hf_zbee_gp_sink_address_list_length,
15552 { "Sink Address list length", "zbee_zcl_general.gp.sink_addr_list_len", FT_UINT8, BASE_DEC,
15553 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15554
15555 /* gppFunctionality attribute */
15556 { &hf_zbee_zcl_gp_attr_gpp_func,
15557 { "gppFunctionality", "zbee_zcl_general.gp.attr.gpp_func", FT_UINT24, BASE_HEX,
15558 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15559
15560 { &hf_zbee_zcl_gp_attr_gpp_func_fld_gp_feature,
15561 { "GP feature", "zbee_zcl_general.gp.attr.gpp_func.gp_feature", FT_BOOLEAN, 24,
15562 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GP_FEATURE(1<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15563 { &hf_zbee_zcl_gp_attr_gpp_func_fld_direct_comm,
15564 { "Direct communication", "zbee_zcl_general.gp.attr.gpp_func.direct_comm", FT_BOOLEAN, 24,
15565 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_DIRECT_COMM(1<<1), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15566 { &hf_zbee_zcl_gp_attr_gpp_func_fld_derived_gcast_comm,
15567 { "Derived groupcast communication", "zbee_zcl_general.gp.attr.gpp_func.derived_gcast_comm", FT_BOOLEAN, 24,
15568 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_DERIVED_GCAST_COMM(1<<2), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15569 { &hf_zbee_zcl_gp_attr_gpp_func_fld_pre_commissioned_gcast_comm,
15570 { "Pre-commissioned groupcast communication", "zbee_zcl_general.gp.attr.gpp_func.pre_commissioned_gcast_comm", FT_BOOLEAN, 24,
15571 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_PRE_COMMISSIONED_GCAST_COMM(1<<3), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15572 { &hf_zbee_zcl_gp_attr_gpp_func_fld_full_ucast_comm,
15573 { "Full unicast communication", "zbee_zcl_general.gp.attr.gpp_func.full_ucast_comm", FT_BOOLEAN, 24,
15574 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_FULL_UCAST_COMM(1<<4), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15575 { &hf_zbee_zcl_gp_attr_gpp_func_fld_lw_ucast_comm,
15576 { "Lightweight unicast communication", "zbee_zcl_general.gp.attr.gpp_func.lw_ucast_comm", FT_BOOLEAN, 24,
15577 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_LW_UCAST_COMM(1<<5), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15578 { &hf_zbee_zcl_gp_attr_gpp_func_fld_bidir_op,
15579 { "Bidirectional operation", "zbee_zcl_general.gp.attr.gpp_func.bidir_op", FT_BOOLEAN, 24,
15580 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_BIDIR_OP(1<<7), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15581 { &hf_zbee_zcl_gp_attr_gpp_func_fld_proxy_tbl_maintenance,
15582 { "Proxy Table maintenance", "zbee_zcl_general.gp.attr.gpp_func.proxy_tbl_maintenance", FT_BOOLEAN, 24,
15583 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_PROXY_TBL_MAINTENANCE(1<<8), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15584 { &hf_zbee_zcl_gp_attr_gpp_func_fld_gp_commissioning,
15585 { "GP commissioning", "zbee_zcl_general.gp.attr.gpp_func.gp_commissioning", FT_BOOLEAN, 24,
15586 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GP_COMMISSIONING(1<<10), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15587 { &hf_zbee_zcl_gp_attr_gpp_func_fld_ct_based_commissioning,
15588 { "CT-based commissioning", "zbee_zcl_general.gp.attr.gpp_func.ct_based_commissioning", FT_BOOLEAN, 24,
15589 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_CT_BASED_COMMISSIONING(1<<11), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15590 { &hf_zbee_zcl_gp_attr_gpp_func_fld_maintenance_of_gpd,
15591 { "Maintenance of GPD", "zbee_zcl_general.gp.attr.gpp_func.maintenance_of_gpd", FT_BOOLEAN, 24,
15592 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_MAINTENANCE_OF_GPD(1<<12), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15593 { &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_00,
15594 { "gpdSecurityLevel = 0b00", "zbee_zcl_general.gp.attr.gpp_func.gpd_secur_lvl_00", FT_BOOLEAN, 24,
15595 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_00(1<<13), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15596 { &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_01,
15597 { "Deprecated: gpdSecurityLevel = 0b01", "zbee_zcl_general.gp.attr.gpp_func.gpd_secur_lvl_01", FT_BOOLEAN, 24,
15598 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_01(1<<14), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15599 { &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_10,
15600 { "gpdSecurityLevel = 0b10", "zbee_zcl_general.gp.attr.gpp_func.gpd_secur_lvl_10", FT_BOOLEAN, 24,
15601 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_10(1<<15), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15602 { &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_11,
15603 { "gpdSecurityLevel = 0b11", "zbee_zcl_general.gp.attr.gpp_func.gpd_secur_lvl_11", FT_BOOLEAN, 24,
15604 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_11(1<<16), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15605 { &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_ieee_address,
15606 { "GPD IEEE address", "zbee_zcl_general.gp.attr.gpp_func.gpd_ieee_address", FT_BOOLEAN, 24,
15607 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_IEEE_ADDRESS(1<<19), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15608
15609 /* gppActiveFunctionality attribute */
15610 { &hf_zbee_zcl_gp_attr_gpp_active_func,
15611 { "gppActiveFunctionality", "zbee_zcl_general.gp.attr.gpp_active_func", FT_UINT24, BASE_HEX,
15612 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15613
15614 { &hf_zbee_zcl_gp_attr_gpp_active_func_fld_gp_functionality,
15615 { "GP functionality", "zbee_zcl_general.gp.attr.gpp_active_func.gp_functionality", FT_BOOLEAN, 24,
15616 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPP_ACTIVE_FUNC_FLD_GP_FUNCTIONALITY(1<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15617
15618 /* gpsFunctionality attribute */
15619 { &hf_zbee_zcl_gp_attr_gps_func,
15620 { "gpsFunctionality", "zbee_zcl_general.gp.attr.gps_func", FT_UINT24, BASE_HEX,
15621 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15622
15623 { &hf_zbee_zcl_gp_attr_gps_func_fld_gp_feature,
15624 { "GP feature", "zbee_zcl_general.gp.attr.gps_func.gp_feature", FT_BOOLEAN, 24,
15625 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GP_FEATURE(1<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15626 { &hf_zbee_zcl_gp_attr_gps_func_fld_direct_comm,
15627 { "Direct communication", "zbee_zcl_general.gp.attr.gps_func.direct_comm", FT_BOOLEAN, 24,
15628 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_DIRECT_COMM(1<<1), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15629 { &hf_zbee_zcl_gp_attr_gps_func_fld_derived_gcast_comm,
15630 { "Derived groupcast communication", "zbee_zcl_general.gp.attr.gps_func.derived_gcast_comm", FT_BOOLEAN, 24,
15631 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_DERIVED_GCAST_COMM(1<<2), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15632 { &hf_zbee_zcl_gp_attr_gps_func_fld_pre_commissioned_gcast_comm,
15633 { "Pre-commissioned groupcast communication", "zbee_zcl_general.gp.attr.gps_func.pre_commissioned_gcast_comm", FT_BOOLEAN, 24,
15634 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PRE_COMMISSIONED_GCAST_COMM(1<<3), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15635 { &hf_zbee_zcl_gp_attr_gps_func_fld_full_ucast_comm,
15636 { "Full unicast communication", "zbee_zcl_general.gp.attr.gps_func.full_ucast_comm", FT_BOOLEAN, 24,
15637 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_FULL_UCAST_COMM(1<<4), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15638 { &hf_zbee_zcl_gp_attr_gps_func_fld_lw_ucast_comm,
15639 { "Lightweight unicast communication", "zbee_zcl_general.gp.attr.gps_func.lw_ucast_comm", FT_BOOLEAN, 24,
15640 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_LW_UCAST_COMM(1<<5), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15641 { &hf_zbee_zcl_gp_attr_gps_func_fld_proximity_bidir_op,
15642 { "Proximity bidirectional operation", "zbee_zcl_general.gp.attr.gps_func.proximity_bidir_op", FT_BOOLEAN, 24,
15643 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXIMITY_BIDIR_OP(1<<6), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15644 { &hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_bidir_op,
15645 { "Multi-hop bidirectional operation", "zbee_zcl_general.gp.attr.gps_func.multi_hop_bidir_op", FT_BOOLEAN, 24,
15646 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MULTI_HOP_BIDIR_OP(1<<7), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15647 { &hf_zbee_zcl_gp_attr_gps_func_fld_proxy_tbl_maintenance,
15648 { "Proxy Table maintenance", "zbee_zcl_general.gp.attr.gps_func.proxy_tbl_maintenance", FT_BOOLEAN, 24,
15649 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXY_TBL_MAINTENANCE(1<<8), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15650 { &hf_zbee_zcl_gp_attr_gps_func_fld_proximity_commissioning,
15651 { "Proximity commissioning", "zbee_zcl_general.gp.attr.gps_func.proximity_commissioning", FT_BOOLEAN, 24,
15652 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXIMITY_COMMISSIONING(1<<9), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15653 { &hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_commissioning,
15654 { "Multi-hop commissioning","zbee_zcl_general.gp.attr.gps_func.multi_hop_commissioning", FT_BOOLEAN, 24,
15655 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MULTI_HOP_COMMISSIONING(1<<10), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15656 { &hf_zbee_zcl_gp_attr_gps_func_fld_ct_based_commissioning,
15657 { "CT-based commissioning", "zbee_zcl_general.gp.attr.gps_func.ct_based_commissioning", FT_BOOLEAN, 24,
15658 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_CT_BASED_COMMISSIONING(1<<11), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15659 { &hf_zbee_zcl_gp_attr_gps_func_fld_maintenance_of_gpd,
15660 { "Maintenance of GPD", "zbee_zcl_general.gp.attr.gps_func.maintenance_of_gpd", FT_BOOLEAN, 24,
15661 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MAINTENANCE_OF_GPD(1<<12), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15662 { &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_00,
15663 { "gpdSecurityLevel = 0b00", "zbee_zcl_general.gp.attr.gps_func.gpd_secur_lvl_00", FT_BOOLEAN, 24,
15664 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_00(1<<13), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15665 { &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_01,
15666 { "Deprecated: gpdSecurityLevel = 0b01", "zbee_zcl_general.gp.attr.gps_func.gpd_secur_lvl_01", FT_BOOLEAN, 24,
15667 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_01(1<<14), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15668 { &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_10,
15669 { "gpdSecurityLevel = 0b10", "zbee_zcl_general.gp.attr.gps_func.gpd_secur_lvl_10", FT_BOOLEAN, 24,
15670 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_10(1<<15), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15671 { &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_11,
15672 { "gpdSecurityLevel = 0b11", "zbee_zcl_general.gp.attr.gps_func.gpd_secur_lvl_11", FT_BOOLEAN, 24,
15673 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_11(1<<16), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15674 { &hf_zbee_zcl_gp_attr_gps_func_fld_sink_tbl_based_gcast_forwarding,
15675 { "Sink Table-based groupcast forwarding", "zbee_zcl_general.gp.attr.gps_func.sink_tbl_based_gcast_forwarding", FT_BOOLEAN, 24,
15676 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_SINK_TBL_BASED_GCAST_FORWARDING(1<<17), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15677 { &hf_zbee_zcl_gp_attr_gps_func_fld_translation_table,
15678 { "Translation Table", "zbee_zcl_general.gp.attr.gps_func.translation_table", FT_BOOLEAN, 24,
15679 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_TRANSLATION_TABLE(1<<18), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15680 { &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_ieee_address,
15681 { "GPD IEEE address", "zbee_zcl_general.gp.attr.gps_func.gpd_ieee_address", FT_BOOLEAN, 24,
15682 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_IEEE_ADDRESS(1<<19), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15683
15684 /* gpsActiveFunctionality attribute */
15685 { &hf_zbee_zcl_gp_attr_gps_active_func,
15686 { "gpsActiveFunctionality", "zbee_zcl_general.gp.attr.gps_active_func", FT_UINT24, BASE_HEX,
15687 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15688
15689 { &hf_zbee_zcl_gp_attr_gps_active_func_fld_gp_functionality,
15690 { "GP functionality", "zbee_zcl_general.gp.attr.gps_active_func.gp_functionality", FT_BOOLEAN, 24,
15691 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_ACTIVE_FUNC_FLD_GP_FUNCTIONALITY(1<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15692
15693 /* gpsCommunicationMode attribute */
15694 { &hf_zbee_zcl_gp_attr_gps_communication_mode,
15695 { "gpsCommunicationMode", "zbee_zcl_general.gp.attr.gps_communication_mode", FT_UINT8, BASE_HEX,
15696 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15697
15698 { &hf_zbee_zcl_gp_attr_gps_communication_mode_fld_mode,
15699 { "Mode", "zbee_zcl_general.gp.attr.gps_communication_mode.mode", FT_UINT8, BASE_HEX,
15700 VALS(zbee_zcl_gp_communication_modes)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_communication_modes
))))
, ZBEE_ZCL_GP_ATTR_GPS_COMMUNICATION_MODE_FLD_MODE(3<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15701
15702 /* gpsCommissioningExitMode attribute */
15703 { &hf_zbee_zcl_gp_attr_gps_comm_exit_mode,
15704 { "gpsCommissioningExitMode", "zbee_zcl_general.gp.attr.gps_comm_exit_mode", FT_UINT8, BASE_HEX,
15705 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15706
15707 { &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_comm_window_expire,
15708 { "On CommissioningWindow expiration", "zbee_zcl_general.gp.attr.gps_comm_exit_mode.on_comm_window_expire",
15709 FT_BOOLEAN, 8, NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_COMM_WINDOW_EXPIRE(1<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15710 { &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_pairing_success,
15711 { "On first Pairing success", "zbee_zcl_general.gp.attr.gps_comm_exit_mode.on_pairing_success",
15712 FT_BOOLEAN, 8, NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_PAIRING_SUCCESS(1<<1), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15713 { &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_gp_proxy_comm_mode,
15714 { "On GP Proxy Commissioning Mode (exit)", "zbee_zcl_general.gp.attr.gps_comm_exit_mode.on_gp_proxy_comm_mode",
15715 FT_BOOLEAN, 8, NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_GP_PROXY_COMM_MODE(1<<2), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15716
15717 /* gpsSecurityLevel attribute */
15718 { &hf_zbee_zcl_gp_attr_gps_secur_lvl,
15719 { "gpsSecurityLevel", "zbee_zcl_general.gp.attr.gps_secur_lvl", FT_UINT8, BASE_HEX,
15720 NULL((void*)0), 0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15721
15722 { &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_min_gpd_secur_lvl,
15723 { "Minimal GPD Security Level", "zbee_zcl_general.gp.attr.gps_secur_lvl.min_gpd_secur_lvl", FT_UINT8, BASE_HEX,
15724 VALS(zbee_zcl_gp_secur_levels)((0 ? (const struct _value_string*)0 : ((zbee_zcl_gp_secur_levels
))))
, ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_MIN_GPD_SECUR_LVL(3<<0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15725 { &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_protection_with_gp_link_key,
15726 { "Protection with gpLinkKey", "zbee_zcl_general.gp.attr.gps_secur_lvl.protection_with_gp_link_key", FT_BOOLEAN, 8,
15727 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_PROTECTION_WITH_GP_LINK_KEY(1<<2), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
15728 { &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_involve_tc,
15729 { "Involve TC", "zbee_zcl_general.gp.attr.gps_secur_lvl.involve_tc", FT_BOOLEAN, 8,
15730 NULL((void*)0), ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_INVOLVE_TC(1<<3), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}
15731 };
15732
15733 /* ZCL Green Power subtrees */
15734 static int *ett[] = {
15735 &ett_zbee_zcl_gp,
15736 &ett_zbee_gp_cmd_proxy_commissioning_mode_options,
15737 &ett_zbee_gp_cmd_proxy_commissioning_mode_exit_mode,
15738 &ett_zbee_gp_cmd_commissioning_notification_options,
15739 &ett_zbee_gp_gpp_gpd_link,
15740 &ett_zbee_gp_cmd_notification_options,
15741 &ett_zbee_gp_cmd_pairing_options,
15742 &ett_zbee_gp_cmd_response_options,
15743 &ett_zbee_gp_cmd_response_tx_channel,
15744 &ett_zbee_gp_cmd_pc_actions,
15745 &ett_zbee_gp_cmd_pc_options,
15746 &ett_zbee_zcl_gp_group_list,
15747 &ett_zbee_gp_cmd_pc_secur_options,
15748 &ett_zbee_gp_cmd_pc_app_info,
15749 &ett_zbee_zcl_gp_ep,
15750 &ett_zbee_zcl_gp_cmds,
15751 &ett_zbee_zcl_gp_clusters,
15752 &ett_zbee_zcl_gp_srv_clusters,
15753 &ett_zbee_zcl_gp_cli_clusters,
15754 &ett_zbee_zcl_proxy_sink_tbl_req_options,
15755 &ett_zbee_zcl_gp_cmd_sink_comm_mode_options,
15756 &ett_zbee_gp_sink_tbl,
15757 &ett_zbee_gp_sink_tbl_entry,
15758 &ett_zbee_gp_sink_tbl_entry_options,
15759 &ett_zbee_gp_sec_options,
15760 &ett_zbee_gp_proxy_tbl,
15761 &ett_zbee_gp_proxy_tbl_entry,
15762 &ett_zbee_gp_proxy_tbl_entry_options,
15763 &ett_zbee_gp_proxy_tbl_entry_ext_options,
15764 &ett_zbee_gp_sink_address_list,
15765 &ett_zbee_zcl_gp_attr_gpp_func,
15766 &ett_zbee_zcl_gp_attr_gpp_active_func,
15767 &ett_zbee_zcl_gp_attr_gps_func,
15768 &ett_zbee_zcl_gp_attr_gps_active_func,
15769 &ett_zbee_zcl_gp_attr_gps_communication_mode,
15770 &ett_zbee_zcl_gp_attr_gps_comm_exit_mode,
15771 &ett_zbee_zcl_gp_attr_gps_secur_lvl
15772 };
15773
15774
15775 /* Register the ZigBee ZCL Green Power cluster protocol name and description */
15776 proto_zbee_zcl_gp = proto_register_protocol("ZigBee ZCL Green Power", "ZCL Green Power", ZBEE_PROTOABBREV_ZCL_GP"zbee_zcl_general.gp");
15777 proto_register_field_array(proto_zbee_zcl_gp, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
15778 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
15779
15780 /* Register the ZigBee ZCL Green Power dissector. */
15781 register_dissector(ZBEE_PROTOABBREV_ZCL_GP"zbee_zcl_general.gp", dissect_zbee_zcl_gp, proto_zbee_zcl_gp);
15782} /*proto_register_zbee_zcl_gp*/
15783
15784/**
15785 * proto_reg_handoff_zbee_zcl_gp
15786 *
15787 * Hands off the ZCL Green Power dissector.
15788 */
15789void
15790proto_reg_handoff_zbee_zcl_gp(void)
15791{
15792 zgp_handle = find_dissector(ZBEE_PROTOABBREV_NWK_GP_CMD"zbee_nwk_gp_cmd");
15793
15794 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_GP"zbee_zcl_general.gp",
15795 proto_zbee_zcl_gp,
15796 ett_zbee_zcl_gp,
15797 ZBEE_ZCL_CID_GP0x0021,
15798 ZBEE_MFG_CODE_NONE0x0000,
15799 hf_zbee_zcl_gp_attr_id,
15800 hf_zbee_zcl_gp_attr_id,
15801 hf_zbee_zcl_gp_srv_rx_cmd_id,
15802 hf_zbee_zcl_gp_srv_tx_cmd_id,
15803 (zbee_zcl_fn_attr_data)dissect_zcl_gp_attr_data
15804 );
15805} /*proto_reg_handoff_zbee_zcl_gp*/
15806
15807/* ########################################################################## */
15808/* #### (0x1000) TOUCHLINK COMMISSIONING CLUSTER ############################ */
15809/* ########################################################################## */
15810
15811/*************************/
15812/* Defines */
15813/*************************/
15814/*Server commands received*/
15815#define ZBEE_ZCL_CMD_ID_SCAN_REQUEST0x00 0x00
15816#define ZBEE_ZCL_CMD_ID_DEVICE_INFO_REQUEST0x02 0x02
15817#define ZBEE_ZCL_CMD_ID_IDENTIFY_REQUEST0x06 0x06
15818#define ZBEE_ZCL_CMD_ID_FACTORT_RESET_REQUEST0x07 0x07
15819#define ZBEE_ZCL_CMD_ID_NETWORK_START_REQUEST0x10 0x10
15820#define ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_REQUEST0x12 0x12
15821#define ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_REQUEST0x14 0x14
15822#define ZBEE_ZCL_CMD_ID_NETWORK_UPDATE_REQUEST0x16 0x16
15823#define ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_REQUEST0x41 0x41
15824#define ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_REQUEST0x42 0x42
15825
15826/*Server commands generated*/
15827#define ZBEE_ZCL_CMD_ID_SCAN_RESPONSE0x01 0x01
15828#define ZBEE_ZCL_CMD_ID_DEVICE_INFO_RESPONSE0x03 0x03
15829#define ZBEE_ZCL_CMD_ID_NETWORK_START_RESPONSE0x11 0x11
15830#define ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_RESPONSE0x13 0x13
15831#define ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_RESPONSE0x15 0x15
15832#define ZBEE_ZCL_CMD_ID_ENDPOINT_INFORMATION0x40 0x40
15833#define ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_RESPONSE0x41 0x41
15834#define ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_RESPONSE0x42 0x42
15835
15836/*ZigBee Information Mask Value*/
15837#define ZBEE_ZCL_TOUCHLINK_ZBEE_INFO_TYPE0x03 0x03
15838#define ZBEE_ZCL_TOUCHLINK_ZBEE_INFO_RXIDLE0x04 0x04
15839
15840/*Touchlink Information Mask Values*/
15841#define ZBEE_ZCL_TOUCHLINK_INFO_FACTORY0x01 0x01
15842#define ZBEE_ZCL_TOUCHLINK_INFO_ASSIGNMENT0x02 0x02
15843#define ZBEE_ZCL_TOUCHLINK_INFO_INITIATOR0x10 0x10
15844#define ZBEE_ZCL_TOUCHLINK_INFO_UNDEFINED0x20 0x20
15845#define ZBEE_ZCL_TOUCHLINK_INFO_PROFILE_INTEROP0x80 0x80
15846
15847/*Touchlink Key Indices*/
15848#define ZBEE_ZCL_TOUCHLINK_KEYID_DEVELOPMENT0 0
15849#define ZBEE_ZCL_TOUCHLINK_KEYID_MASTER4 4
15850#define ZBEE_ZCL_TOUCHLINK_KEYID_CERTIFICATION15 15
15851
15852/*************************/
15853/* Function Declarations */
15854/*************************/
15855void proto_register_zbee_zcl_touchlink(void);
15856void proto_reg_handoff_zbee_zcl_touchlink(void);
15857
15858/*************************/
15859/* Global Variables */
15860/*************************/
15861/* Initialize the protocol and registered fields */
15862static int proto_zbee_zcl_touchlink;
15863
15864static int hf_zbee_zcl_touchlink_rx_cmd_id;
15865static int hf_zbee_zcl_touchlink_tx_cmd_id;
15866static int hf_zbee_zcl_touchlink_transaction_id;
15867static int hf_zbee_zcl_touchlink_zbee;
15868static int hf_zbee_zcl_touchlink_zbee_type;
15869static int hf_zbee_zcl_touchlink_zbee_rxidle;
15870static int hf_zbee_zcl_touchlink_info;
15871static int hf_zbee_zcl_touchlink_info_factory;
15872static int hf_zbee_zcl_touchlink_info_assignment;
15873static int hf_zbee_zcl_touchlink_info_initiator;
15874static int hf_zbee_zcl_touchlink_info_undefined;
15875static int hf_zbee_zcl_touchlink_info_profile_introp;
15876static int hf_zbee_zcl_touchlink_start_index;
15877static int hf_zbee_zcl_touchlink_ident_duration;
15878
15879static int hf_zbee_zcl_touchlink_rssi_correction;
15880static int hf_zbee_zcl_touchlink_response_id;
15881static int hf_zbee_zcl_touchlink_ext_panid;
15882static int hf_zbee_zcl_touchlink_nwk_update_id;
15883static int hf_zbee_zcl_touchlink_channel;
15884static int hf_zbee_zcl_touchlink_nwk_addr;
15885static int hf_zbee_zcl_touchlink_ext_addr;
15886static int hf_zbee_zcl_touchlink_panid;
15887static int hf_zbee_zcl_touchlink_sub_devices;
15888static int hf_zbee_zcl_touchlink_total_groups;
15889static int hf_zbee_zcl_touchlink_endpoint;
15890static int hf_zbee_zcl_touchlink_profile_id;
15891static int hf_zbee_zcl_touchlink_device_id;
15892static int hf_zbee_zcl_touchlink_version;
15893static int hf_zbee_zcl_touchlink_group_count;
15894static int hf_zbee_zcl_touchlink_group_begin;
15895static int hf_zbee_zcl_touchlink_group_end;
15896static int hf_zbee_zcl_touchlink_group_type;
15897static int hf_zbee_zcl_touchlink_group_id;
15898static int hf_zbee_zcl_touchlink_addr_range_begin;
15899static int hf_zbee_zcl_touchlink_addr_range_end;
15900static int hf_zbee_zcl_touchlink_group_range_begin;
15901static int hf_zbee_zcl_touchlink_group_range_end;
15902static int hf_zbee_zcl_touchlink_key_bitmask;
15903static int hf_zbee_zcl_touchlink_key_bit_dev;
15904static int hf_zbee_zcl_touchlink_key_bit_master;
15905static int hf_zbee_zcl_touchlink_key_bit_cert;
15906static int hf_zbee_zcl_touchlink_key_index;
15907static int hf_zbee_zcl_touchlink_key;
15908static int hf_zbee_zcl_touchlink_network_key;
15909static int hf_zbee_zcl_touchlink_init_addr;
15910static int hf_zbee_zcl_touchlink_init_eui64;
15911static int hf_zbee_zcl_touchlink_status;
15912
15913/* Initialize the subtree pointers */
15914static int ett_zbee_zcl_touchlink;
15915static int ett_zbee_zcl_touchlink_zbee;
15916static int ett_zbee_zcl_touchlink_info;
15917static int ett_zbee_zcl_touchlink_keybits;
15918static int ett_zbee_zcl_touchlink_groups;
15919
15920static expert_field ei_zbee_zcl_touchlink_no_key = EI_INIT{0, 0};
15921
15922static GHashTable * zcl_touchlink_commissioning_map = NULL((void*)0);
15923
15924struct zcl_touchlink_commissioning_data {
15925 unsigned transaction_id;
15926 unsigned response_id;
15927};
15928
15929/* Command names */
15930static const value_string zbee_zcl_touchlink_rx_cmd_names[] = {
15931 { ZBEE_ZCL_CMD_ID_SCAN_REQUEST0x00, "Scan Request" },
15932 { ZBEE_ZCL_CMD_ID_DEVICE_INFO_REQUEST0x02, "Device Information Request" },
15933 { ZBEE_ZCL_CMD_ID_IDENTIFY_REQUEST0x06, "Identify Request" },
15934 { ZBEE_ZCL_CMD_ID_FACTORT_RESET_REQUEST0x07, "Reset to Factory New Request" },
15935 { ZBEE_ZCL_CMD_ID_NETWORK_START_REQUEST0x10, "Network Start Request" },
15936 { ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_REQUEST0x12, "Network Join Router Request" },
15937 { ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_REQUEST0x14, "Network Join End Device Request" },
15938 { ZBEE_ZCL_CMD_ID_NETWORK_UPDATE_REQUEST0x16, "Network Update Request" },
15939 { ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_REQUEST0x41, "Get Group Identifiers Request" },
15940 { ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_REQUEST0x42, "Get Endpoint List Request" },
15941 { 0, NULL((void*)0) }
15942};
15943static const value_string zbee_zcl_touchlink_tx_cmd_names[] = {
15944 { ZBEE_ZCL_CMD_ID_SCAN_RESPONSE0x01, "Scan Response" },
15945 { ZBEE_ZCL_CMD_ID_DEVICE_INFO_RESPONSE0x03, "Device Information Response" },
15946 { ZBEE_ZCL_CMD_ID_NETWORK_START_RESPONSE0x11, "Network Start Response" },
15947 { ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_RESPONSE0x13, "Network Join Router Response" },
15948 { ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_RESPONSE0x15, "Network Join End Device Response" },
15949 { ZBEE_ZCL_CMD_ID_ENDPOINT_INFORMATION0x40, "Endpoint Information" },
15950 { ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_RESPONSE0x41, "Get Group Identifiers Response" },
15951 { ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_RESPONSE0x42, "Get Endpoint List Response" },
15952 { 0, NULL((void*)0) }
15953};
15954
15955/* ZigBee logical types */
15956static const value_string zbee_zcl_touchlink_zbee_type_names[] = {
15957 { 0, "coordinator" },
15958 { 1, "router" },
15959 { 2, "end device" },
15960 { 0, NULL((void*)0) }
15961};
15962
15963static const value_string zbee_zcl_touchlink_status_names[] = {
15964 { 0x00, "Success" },
15965 { 0x01, "Failure" },
15966 { 0, NULL((void*)0) }
15967};
15968
15969static const value_string zbee_zcl_touchlink_profile_interop_names[] = {
15970 { 0, "ZLL" },
15971 { 1, "Zigbee 3.0" },
15972 { 0, NULL((void*)0) }
15973};
15974
15975static const value_string zbee_zcl_touchlink_keyid_names[] = {
15976 { ZBEE_ZCL_TOUCHLINK_KEYID_DEVELOPMENT0, "Development Key" },
15977 { ZBEE_ZCL_TOUCHLINK_KEYID_MASTER4, "Master Key" },
15978 { ZBEE_ZCL_TOUCHLINK_KEYID_CERTIFICATION15, "Certification Key" },
15979 { 0, NULL((void*)0) }
15980};
15981
15982#define ZBEE_ZCL_TOUCHLINK_NUM_KEYID16 16
15983#define ZBEE_ZCL_TOUCHLINK_KEY_SIZE16 16
15984
15985/*************************/
15986/* Function Bodies */
15987/*************************/
15988
15989/* Functions for Touchlink Comissionning hashtables. {{{ */
15990static int
15991zcl_touchlink_comissioning_equal (gconstpointer v, gconstpointer v2)
15992{
15993 if (v == NULL((void*)0) || v2 == NULL((void*)0)) {
15994 return 0;
15995 }
15996
15997 const unsigned *val1;
15998 const unsigned *val2;
15999 val1 = (const unsigned *)v;
16000 val2 = (const unsigned *)v2;
16001
16002 if (*val1 == *val2) {
16003 return 1;
16004 }
16005 return 0;
16006}
16007
16008static unsigned
16009zcl_touchlink_comissioning_hash (gconstpointer v)
16010{
16011 unsigned hash;
16012 const unsigned * id;
16013
16014 if (v == NULL((void*)0)) {
16015 return 0;
16016 }
16017
16018 hash = 0;
Value stored to 'hash' is never read
16019 id = (const unsigned*) v;
16020 hash = *id;
16021
16022 return hash;
16023}
16024/* Functions for Touchlink Comissionning hashtables. }}} */
16025
16026/**
16027 *This function decodes the Scan Request payload.
16028 *
16029 *@param tvb the tv buffer of the current data_type
16030 *@param tree the tree to append this item to
16031 *@param offset offset of data in tvb
16032*/
16033static void
16034dissect_zcl_touchlink_scan_request(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
16035{
16036 static int * const zbee_info_flags[] = {
16037 &hf_zbee_zcl_touchlink_zbee_type,
16038 &hf_zbee_zcl_touchlink_zbee_rxidle,
16039 NULL((void*)0)
16040 };
16041 static int * const zll_info_flags[] = {
16042 &hf_zbee_zcl_touchlink_info_factory,
16043 &hf_zbee_zcl_touchlink_info_assignment,
16044 &hf_zbee_zcl_touchlink_info_initiator,
16045 &hf_zbee_zcl_touchlink_info_undefined,
16046 &hf_zbee_zcl_touchlink_info_profile_introp,
16047 NULL((void*)0)
16048 };
16049 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_touchlink_zbee, ett_zbee_zcl_touchlink_zbee, zbee_info_flags, ENC_LITTLE_ENDIAN0x80000000);
16050 *offset += 1;
16051 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_touchlink_info, ett_zbee_zcl_touchlink_info, zll_info_flags, ENC_LITTLE_ENDIAN0x80000000);
16052 *offset += 1;
16053} /*dissect_zcl_touchlink_scan_request*/
16054
16055/**
16056 *This function decodes the Identify Request payload.
16057 *
16058 *@param tvb the tv buffer of the current data_type
16059 *@param tree the tree to append this item to
16060 *@param offset offset of data in tvb
16061*/
16062static void
16063dissect_zcl_touchlink_identify_request(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
16064{
16065 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ident_duration, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16066 *offset += 2;
16067} /*dissect_zcl_touchlink_identify_request*/
16068
16069/**
16070 *This function decodes the Network Start Request payload.
16071 *
16072 *@param tvb the tv buffer of the current data_type
16073 *@param tree the tree to append this item to
16074 *@param offset offset of data in tvb
16075*/
16076static void
16077dissect_zcl_touchlink_network_start_request(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
16078{
16079 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_panid, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
16080 *offset += 8;
16081 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_key_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16082 *offset += 1;
16083 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_key, tvb, *offset, 16, ENC_NA0x00000000);
16084 *offset += 16;
16085 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_channel, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16086 *offset += 1;
16087 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_panid, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16088 *offset += 2;
16089 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16090 *offset += 2;
16091 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16092 *offset += 2;
16093 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16094 *offset += 2;
16095 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_addr_range_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16096 *offset += 2;
16097 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_addr_range_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16098 *offset += 2;
16099 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_range_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16100 *offset += 2;
16101 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_range_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16102 *offset += 2;
16103 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_init_eui64, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
16104 *offset += 8;
16105 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_init_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16106 *offset += 2;
16107} /*dissect_zcl_touchlink_network_start_request*/
16108
16109/**
16110 *This function decodes the Network Join Router/EndDevice Request payloads.
16111 *
16112 *@param tvb the tv buffer of the current data_type
16113 *@param tree the tree to append this item to
16114 *@param offset offset of data in tvb
16115*/
16116static void
16117dissect_zcl_touchlink_network_join_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, struct zcl_touchlink_commissioning_data * commissioning_data)
16118{
16119 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_panid, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
16120 *offset += 8;
16121 uint32_t key_index;
16122 proto_tree_add_item_ret_uint(tree, hf_zbee_zcl_touchlink_key_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000, &key_index);
16123 *offset += 1;
16124 proto_item* it_key = proto_tree_add_item(tree, hf_zbee_zcl_touchlink_key, tvb, *offset, 16, ENC_NA0x00000000);
16125 const char *encrypted_network_key = (const char *)tvb_get_ptr(tvb, *offset, 16);
16126 *offset += 16;
16127
16128 static const uint8_t Touchlink_Certification_Key[16] = {0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf};
16129 uint8_t Touchlink_Master_Key[16];
16130 char network_key[16] = {0};
16131 const uint8_t * key = NULL((void*)0);
16132 uint8_t * decrypted_network_key = NULL((void*)0);
16133 if(key_index == ZBEE_ZCL_TOUCHLINK_KEYID_MASTER4 || key_index == ZBEE_ZCL_TOUCHLINK_KEYID_CERTIFICATION15){
16134 if(key_index == ZBEE_ZCL_TOUCHLINK_KEYID_MASTER4){
16135 if(!zbee_sec_get_key_from_keyring("Touchlink Master Key", Touchlink_Master_Key)){
16136 expert_add_info_format(pinfo, it_key, &ei_zbee_zcl_touchlink_no_key, "No key named 'Touchlink Master Key' found, cannot decrypt transport key");
16137 }else{
16138 key = Touchlink_Master_Key;
16139 }
16140 }else if(key_index == ZBEE_ZCL_TOUCHLINK_KEYID_CERTIFICATION15){
16141 key = Touchlink_Certification_Key;
16142 }
16143 if(key){
16144 uint8_t expanded_input[16];
16145 expanded_input[0x0] = (commissioning_data->transaction_id >> 24) & 0xFF;
16146 expanded_input[0x1] = (commissioning_data->transaction_id >> 16) & 0xFF;
16147 expanded_input[0x2] = (commissioning_data->transaction_id >> 8) & 0xFF;
16148 expanded_input[0x3] = (commissioning_data->transaction_id >> 0) & 0xFF;
16149 expanded_input[0x4] = (commissioning_data->transaction_id >> 24) & 0xFF;
16150 expanded_input[0x5] = (commissioning_data->transaction_id >> 16) & 0xFF;
16151 expanded_input[0x6] = (commissioning_data->transaction_id >> 8) & 0xFF;
16152 expanded_input[0x7] = (commissioning_data->transaction_id >> 0) & 0xFF;
16153 expanded_input[0x8] = (commissioning_data->response_id >> 24) & 0xFF;
16154 expanded_input[0x9] = (commissioning_data->response_id >> 16) & 0xFF;
16155 expanded_input[0xA] = (commissioning_data->response_id >> 8) & 0xFF;
16156 expanded_input[0xB] = (commissioning_data->response_id >> 0) & 0xFF;
16157 expanded_input[0xC] = (commissioning_data->response_id >> 24) & 0xFF;
16158 expanded_input[0xD] = (commissioning_data->response_id >> 16) & 0xFF;
16159 expanded_input[0xE] = (commissioning_data->response_id >> 8) & 0xFF;
16160 expanded_input[0xF] = (commissioning_data->response_id >> 0) & 0xFF;
16161 ws_debug("expanded_input: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", expanded_input[0x0], expanded_input[0x1], expanded_input[0x2], expanded_input[0x3], expanded_input[0x4], expanded_input[0x5], expanded_input[0x6], expanded_input[0x7], expanded_input[0x8], expanded_input[0x9], expanded_input[0xA], expanded_input[0xB], expanded_input[0xC], expanded_input[0xD], expanded_input[0xE], expanded_input[0xF])do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16161, __func__, "expanded_input: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n"
, expanded_input[0x0], expanded_input[0x1], expanded_input[0x2
], expanded_input[0x3], expanded_input[0x4], expanded_input[0x5
], expanded_input[0x6], expanded_input[0x7], expanded_input[0x8
], expanded_input[0x9], expanded_input[0xA], expanded_input[0xB
], expanded_input[0xC], expanded_input[0xD], expanded_input[0xE
], expanded_input[0xF]); } } while (0)
;
16162 ws_debug("key: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", key[0x0], key[0x1], key[0x2], key[0x3], key[0x4], key[0x5], key[0x6], key[0x7], key[0x8], key[0x9], key[0xA], key[0xB], key[0xC], key[0xD], key[0xE], key[0xF])do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16162, __func__, "key: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n"
, key[0x0], key[0x1], key[0x2], key[0x3], key[0x4], key[0x5],
key[0x6], key[0x7], key[0x8], key[0x9], key[0xA], key[0xB], key
[0xC], key[0xD], key[0xE], key[0xF]); } } while (0)
;
16163
16164 gcry_cipher_hd_t hd1;
16165 gcry_error_t err;
16166 if (gcry_cipher_open(&hd1, GCRY_CIPHER_AES128GCRY_CIPHER_AES, GCRY_CIPHER_MODE_ECB, 0)) {
16167 gcry_cipher_close(hd1);
16168 ws_debug("touchlink: can't open aes128 cipher handle")do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16168, __func__, "touchlink: can't open aes128 cipher handle"
); } } while (0)
;
16169 return;
16170 }
16171 if ((err = gcry_cipher_setkey(hd1, key, 16))) {
16172 gcry_cipher_close(hd1);
16173 ws_debug("touchlink: can't set aes128 cipher key")do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16173, __func__, "touchlink: can't set aes128 cipher key");
} } while (0)
;
16174 ws_debug("libgcrypt: %d %s %s", gcry_err_code(err), gcry_strsource(err), gcry_strerror(err))do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16174, __func__, "libgcrypt: %d %s %s", gcry_err_code(err),
gcry_strsource(err), gcry_strerror(err)); } } while (0)
;
16175 return;
16176 }
16177
16178 char transport_key[16] = {0};
16179 if (gcry_cipher_encrypt(hd1, transport_key, 16, expanded_input, 16)) {
16180 ws_debug("can\'t decrypt aes128")do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16180, __func__, "can\'t decrypt aes128"); } } while (0)
;
16181 return;
16182 }
16183
16184 ws_debug("transport_key: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", (uint8_t)transport_key[0x0], (uint8_t)transport_key[0x1], (uint8_t)transport_key[0x2], (uint8_t)transport_key[0x3], (uint8_t)transport_key[0x4], (uint8_t)transport_key[0x5], (uint8_t)transport_key[0x6], (uint8_t)transport_key[0x7], (uint8_t)transport_key[0x8], (uint8_t)transport_key[0x9], (uint8_t)transport_key[0xA], (uint8_t)transport_key[0xB], (uint8_t)transport_key[0xC], (uint8_t)transport_key[0xD], (uint8_t)transport_key[0xE], (uint8_t)transport_key[0xF])do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16184, __func__, "transport_key: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n"
, (uint8_t)transport_key[0x0], (uint8_t)transport_key[0x1], (
uint8_t)transport_key[0x2], (uint8_t)transport_key[0x3], (uint8_t
)transport_key[0x4], (uint8_t)transport_key[0x5], (uint8_t)transport_key
[0x6], (uint8_t)transport_key[0x7], (uint8_t)transport_key[0x8
], (uint8_t)transport_key[0x9], (uint8_t)transport_key[0xA], (
uint8_t)transport_key[0xB], (uint8_t)transport_key[0xC], (uint8_t
)transport_key[0xD], (uint8_t)transport_key[0xE], (uint8_t)transport_key
[0xF]); } } while (0)
;
16185
16186 gcry_cipher_close(hd1);
16187
16188 gcry_cipher_hd_t hd2;
16189 if (gcry_cipher_open(&hd2, GCRY_CIPHER_AES128GCRY_CIPHER_AES, GCRY_CIPHER_MODE_ECB, 0)) {
16190 gcry_cipher_close(hd2);
16191 ws_debug("touchlink: can't open aes128 cipher handle")do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16191, __func__, "touchlink: can't open aes128 cipher handle"
); } } while (0)
;
16192 return;
16193 }
16194 if ((err = gcry_cipher_setkey(hd2, transport_key, 16))) {
16195 gcry_cipher_close(hd2);
16196 ws_debug("touchlink: can't set aes128 cipher key")do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16196, __func__, "touchlink: can't set aes128 cipher key");
} } while (0)
;
16197 ws_debug("libgcrypt: %d %s %s", gcry_err_code(err), gcry_strsource(err), gcry_strerror(err))do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16197, __func__, "libgcrypt: %d %s %s", gcry_err_code(err),
gcry_strsource(err), gcry_strerror(err)); } } while (0)
;
16198 return;
16199 }
16200
16201 ws_debug("encrypted_network_key: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", (uint8_t)encrypted_network_key[0x0], (uint8_t)encrypted_network_key[0x1], (uint8_t)encrypted_network_key[0x2], (uint8_t)encrypted_network_key[0x3], (uint8_t)encrypted_network_key[0x4], (uint8_t)encrypted_network_key[0x5], (uint8_t)encrypted_network_key[0x6], (uint8_t)encrypted_network_key[0x7], (uint8_t)encrypted_network_key[0x8], (uint8_t)encrypted_network_key[0x9], (uint8_t)encrypted_network_key[0xA], (uint8_t)encrypted_network_key[0xB], (uint8_t)encrypted_network_key[0xC], (uint8_t)encrypted_network_key[0xD], (uint8_t)encrypted_network_key[0xE], (uint8_t)encrypted_network_key[0xF])do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16201, __func__, "encrypted_network_key: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n"
, (uint8_t)encrypted_network_key[0x0], (uint8_t)encrypted_network_key
[0x1], (uint8_t)encrypted_network_key[0x2], (uint8_t)encrypted_network_key
[0x3], (uint8_t)encrypted_network_key[0x4], (uint8_t)encrypted_network_key
[0x5], (uint8_t)encrypted_network_key[0x6], (uint8_t)encrypted_network_key
[0x7], (uint8_t)encrypted_network_key[0x8], (uint8_t)encrypted_network_key
[0x9], (uint8_t)encrypted_network_key[0xA], (uint8_t)encrypted_network_key
[0xB], (uint8_t)encrypted_network_key[0xC], (uint8_t)encrypted_network_key
[0xD], (uint8_t)encrypted_network_key[0xE], (uint8_t)encrypted_network_key
[0xF]); } } while (0)
;
16202
16203 if (gcry_cipher_decrypt(hd2, network_key, 16, encrypted_network_key, 16)) {
16204 ws_debug("can\'t decrypt aes128")do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16204, __func__, "can\'t decrypt aes128"); } } while (0)
;
16205 return;
16206 }
16207
16208 ws_debug("network_key: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", (uint8_t)network_key[0x0], (uint8_t)network_key[0x1], (uint8_t)network_key[0x2], (uint8_t)network_key[0x3], (uint8_t)network_key[0x4], (uint8_t)network_key[0x5], (uint8_t)network_key[0x6], (uint8_t)network_key[0x7], (uint8_t)network_key[0x8], (uint8_t)network_key[0x9], (uint8_t)network_key[0xA], (uint8_t)network_key[0xB], (uint8_t)network_key[0xC], (uint8_t)network_key[0xD], (uint8_t)network_key[0xE], (uint8_t)network_key[0xF])do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16208, __func__, "network_key: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n"
, (uint8_t)network_key[0x0], (uint8_t)network_key[0x1], (uint8_t
)network_key[0x2], (uint8_t)network_key[0x3], (uint8_t)network_key
[0x4], (uint8_t)network_key[0x5], (uint8_t)network_key[0x6], (
uint8_t)network_key[0x7], (uint8_t)network_key[0x8], (uint8_t
)network_key[0x9], (uint8_t)network_key[0xA], (uint8_t)network_key
[0xB], (uint8_t)network_key[0xC], (uint8_t)network_key[0xD], (
uint8_t)network_key[0xE], (uint8_t)network_key[0xF]); } } while
(0)
;
16209
16210 gcry_cipher_close(hd2);
16211
16212 proto_tree_add_bytes(tree, hf_zbee_zcl_touchlink_network_key, tvb, *offset-16, 16, network_key);
16213 decrypted_network_key = network_key;
16214 }
16215 }else if(key_index == ZBEE_ZCL_TOUCHLINK_KEYID_DEVELOPMENT0){
16216 uint8_t expanded_input[16];
16217 expanded_input[0x0] = 'P';
16218 expanded_input[0x1] = 'h';
16219 expanded_input[0x2] = 'L';
16220 expanded_input[0x3] = 'i';
16221 expanded_input[0x4] = (commissioning_data->transaction_id >> 24) & 0xFF;
16222 expanded_input[0x5] = (commissioning_data->transaction_id >> 16) & 0xFF;
16223 expanded_input[0x6] = (commissioning_data->transaction_id >> 8) & 0xFF;
16224 expanded_input[0x7] = (commissioning_data->transaction_id >> 0) & 0xFF;
16225 expanded_input[0x8] = 'C';
16226 expanded_input[0x9] = 'L';
16227 expanded_input[0xA] = 'S';
16228 expanded_input[0xB] = 'N';
16229 expanded_input[0xC] = (commissioning_data->response_id >> 24) & 0xFF;
16230 expanded_input[0xD] = (commissioning_data->response_id >> 16) & 0xFF;
16231 expanded_input[0xE] = (commissioning_data->response_id >> 8) & 0xFF;
16232 expanded_input[0xF] = (commissioning_data->response_id >> 0) & 0xFF;
16233 ws_debug("expanded_input: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", expanded_input[0x0], expanded_input[0x1], expanded_input[0x2], expanded_input[0x3], expanded_input[0x4], expanded_input[0x5], expanded_input[0x6], expanded_input[0x7], expanded_input[0x8], expanded_input[0x9], expanded_input[0xA], expanded_input[0xB], expanded_input[0xC], expanded_input[0xD], expanded_input[0xE], expanded_input[0xF])do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16233, __func__, "expanded_input: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n"
, expanded_input[0x0], expanded_input[0x1], expanded_input[0x2
], expanded_input[0x3], expanded_input[0x4], expanded_input[0x5
], expanded_input[0x6], expanded_input[0x7], expanded_input[0x8
], expanded_input[0x9], expanded_input[0xA], expanded_input[0xB
], expanded_input[0xC], expanded_input[0xD], expanded_input[0xE
], expanded_input[0xF]); } } while (0)
;
16234
16235 gcry_cipher_hd_t hd;
16236 gcry_error_t err;
16237 if (gcry_cipher_open(&hd, GCRY_CIPHER_AES128GCRY_CIPHER_AES, GCRY_CIPHER_MODE_ECB, 0)) {
16238 gcry_cipher_close(hd);
16239 ws_debug("touchlink: can't open aes128 cipher handle")do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16239, __func__, "touchlink: can't open aes128 cipher handle"
); } } while (0)
;
16240 return;
16241 }
16242 if ((err = gcry_cipher_setkey(hd, expanded_input, 16))) {
16243 gcry_cipher_close(hd);
16244 ws_debug("touchlink: can't set aes128 cipher key")do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16244, __func__, "touchlink: can't set aes128 cipher key");
} } while (0)
;
16245 ws_debug("libgcrypt: %d %s %s", gcry_err_code(err), gcry_strsource(err), gcry_strerror(err))do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16245, __func__, "libgcrypt: %d %s %s", gcry_err_code(err),
gcry_strsource(err), gcry_strerror(err)); } } while (0)
;
16246 return;
16247 }
16248
16249 ws_debug("encrypted_network_key: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", (uint8_t)encrypted_network_key[0x0], (uint8_t)encrypted_network_key[0x1], (uint8_t)encrypted_network_key[0x2], (uint8_t)encrypted_network_key[0x3], (uint8_t)encrypted_network_key[0x4], (uint8_t)encrypted_network_key[0x5], (uint8_t)encrypted_network_key[0x6], (uint8_t)encrypted_network_key[0x7], (uint8_t)encrypted_network_key[0x8], (uint8_t)encrypted_network_key[0x9], (uint8_t)encrypted_network_key[0xA], (uint8_t)encrypted_network_key[0xB], (uint8_t)encrypted_network_key[0xC], (uint8_t)encrypted_network_key[0xD], (uint8_t)encrypted_network_key[0xE], (uint8_t)encrypted_network_key[0xF])do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16249, __func__, "encrypted_network_key: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n"
, (uint8_t)encrypted_network_key[0x0], (uint8_t)encrypted_network_key
[0x1], (uint8_t)encrypted_network_key[0x2], (uint8_t)encrypted_network_key
[0x3], (uint8_t)encrypted_network_key[0x4], (uint8_t)encrypted_network_key
[0x5], (uint8_t)encrypted_network_key[0x6], (uint8_t)encrypted_network_key
[0x7], (uint8_t)encrypted_network_key[0x8], (uint8_t)encrypted_network_key
[0x9], (uint8_t)encrypted_network_key[0xA], (uint8_t)encrypted_network_key
[0xB], (uint8_t)encrypted_network_key[0xC], (uint8_t)encrypted_network_key
[0xD], (uint8_t)encrypted_network_key[0xE], (uint8_t)encrypted_network_key
[0xF]); } } while (0)
;
16250
16251 if (gcry_cipher_decrypt(hd, network_key, 16, encrypted_network_key, 16)) {
16252 ws_debug("can\'t decrypt aes128")do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16252, __func__, "can\'t decrypt aes128"); } } while (0)
;
16253 return;
16254 }
16255
16256 ws_debug("network_key: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", (uint8_t)network_key[0x0], (uint8_t)network_key[0x1], (uint8_t)network_key[0x2], (uint8_t)network_key[0x3], (uint8_t)network_key[0x4], (uint8_t)network_key[0x5], (uint8_t)network_key[0x6], (uint8_t)network_key[0x7], (uint8_t)network_key[0x8], (uint8_t)network_key[0x9], (uint8_t)network_key[0xA], (uint8_t)network_key[0xB], (uint8_t)network_key[0xC], (uint8_t)network_key[0xD], (uint8_t)network_key[0xE], (uint8_t)network_key[0xF])do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16256, __func__, "network_key: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n"
, (uint8_t)network_key[0x0], (uint8_t)network_key[0x1], (uint8_t
)network_key[0x2], (uint8_t)network_key[0x3], (uint8_t)network_key
[0x4], (uint8_t)network_key[0x5], (uint8_t)network_key[0x6], (
uint8_t)network_key[0x7], (uint8_t)network_key[0x8], (uint8_t
)network_key[0x9], (uint8_t)network_key[0xA], (uint8_t)network_key
[0xB], (uint8_t)network_key[0xC], (uint8_t)network_key[0xD], (
uint8_t)network_key[0xE], (uint8_t)network_key[0xF]); } } while
(0)
;
16257
16258 gcry_cipher_close(hd);
16259
16260 proto_tree_add_bytes(tree, hf_zbee_zcl_touchlink_network_key, tvb, *offset-16, 16, network_key);
16261 decrypted_network_key = network_key;
16262 }else{
16263 expert_add_info_format(pinfo, it_key, &ei_zbee_zcl_touchlink_no_key, "Unsupported key %d, cannot decrypt transport key", key_index);
16264 }
16265 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_update_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16266 *offset += 1;
16267 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_channel, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16268 *offset += 1;
16269 uint32_t panid;
16270 proto_tree_add_item_ret_uint(tree, hf_zbee_zcl_touchlink_panid, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000, &panid);
16271 *offset += 2;
16272 if(decrypted_network_key){
16273 zbee_sec_add_key_to_keyring_panid(pinfo, decrypted_network_key, panid);
16274 }
16275
16276 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16277 *offset += 2;
16278 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16279 *offset += 2;
16280 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16281 *offset += 2;
16282 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_addr_range_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16283 *offset += 2;
16284 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_addr_range_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16285 *offset += 2;
16286 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_range_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16287 *offset += 2;
16288 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_range_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16289 *offset += 2;
16290} /*dissect_zcl_touchlink_network_join_request*/
16291
16292/**
16293 *This function decodes the Scan Response payload.
16294 *
16295 *@param tvb the tv buffer of the current data_type
16296 *@param tree the tree to append this item to
16297 *@param offset offset of data in tvb
16298*/
16299static void
16300dissect_zcl_touchlink_network_update_request(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
16301{
16302 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_panid, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
16303 *offset += 8;
16304 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_update_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16305 *offset += 1;
16306 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_channel, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16307 *offset += 1;
16308 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_panid, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16309 *offset += 2;
16310 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16311 *offset += 2;
16312} /*dissect_zcl_touchlink_network_update_request*/
16313
16314/**
16315 *This function decodes the Scan Response payload.
16316 *
16317 *@param tvb the tv buffer of the current data_type
16318 *@param tree the tree to append this item to
16319 *@param offset offset of data in tvb
16320*/
16321static void
16322dissect_zcl_touchlink_scan_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, struct zcl_touchlink_commissioning_data * commissioning_data)
16323{
16324 static int * const zbee_info_flags[] = {
16325 &hf_zbee_zcl_touchlink_zbee_type,
16326 &hf_zbee_zcl_touchlink_zbee_rxidle,
16327 NULL((void*)0)
16328 };
16329 static int * const zll_info_flags[] = {
16330 &hf_zbee_zcl_touchlink_info_factory,
16331 &hf_zbee_zcl_touchlink_info_assignment,
16332 &hf_zbee_zcl_touchlink_info_initiator,
16333 &hf_zbee_zcl_touchlink_info_undefined,
16334 &hf_zbee_zcl_touchlink_info_profile_introp,
16335 NULL((void*)0)
16336 };
16337 static int * const zll_keybit_flags[] = {
16338 &hf_zbee_zcl_touchlink_key_bit_dev,
16339 &hf_zbee_zcl_touchlink_key_bit_master,
16340 &hf_zbee_zcl_touchlink_key_bit_cert,
16341 NULL((void*)0)
16342 };
16343 uint8_t subdev;
16344
16345 /* Parse out the fixed-format stuff */
16346 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_rssi_correction, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16347 *offset += 1;
16348 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_touchlink_zbee, ett_zbee_zcl_touchlink_zbee, zbee_info_flags, ENC_LITTLE_ENDIAN0x80000000);
16349 *offset += 1;
16350 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_touchlink_info, ett_zbee_zcl_touchlink_info, zll_info_flags, ENC_LITTLE_ENDIAN0x80000000);
16351 *offset += 1;
16352 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_touchlink_key_bitmask, ett_zbee_zcl_touchlink_keybits, zll_keybit_flags, ENC_LITTLE_ENDIAN0x80000000);
16353 *offset += 2;
16354 proto_tree_add_item_ret_uint(tree, hf_zbee_zcl_touchlink_response_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN0x80000000, &commissioning_data->response_id);
16355 *offset += 4;
16356 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_panid, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
16357 *offset += 8;
16358 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_update_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16359 *offset += 1;
16360 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_channel, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16361 *offset += 1;
16362 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_panid, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16363 *offset += 2;
16364 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16365 *offset += 2;
16366 subdev = tvb_get_uint8(tvb, *offset);
16367 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_sub_devices, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16368 *offset += 1;
16369 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_total_groups, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16370 *offset += 1;
16371
16372 /* The remaining fields are only present when sub-devices is one. */
16373 if (subdev == 1) {
16374 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_endpoint, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16375 *offset += 1;
16376 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_profile_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16377 *offset += 2;
16378 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_device_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16379 *offset += 2;
16380 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_version, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16381 *offset += 1;
16382 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_count, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16383 *offset += 1;
16384 }
16385} /*dissect_zcl_touchlink_scan_response*/
16386
16387/**
16388 *This function decodes the Network Start Response payload.
16389 *
16390 *@param tvb the tv buffer of the current data_type
16391 *@param tree the tree to append this item to
16392 *@param offset offset of data in tvb
16393*/
16394static void
16395dissect_zcl_touchlink_network_start_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
16396{
16397 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16398 *offset += 1;
16399 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_panid, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
16400 *offset += 8;
16401 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_update_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16402 *offset += 1;
16403 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_channel, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16404 *offset += 1;
16405 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_panid, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16406 *offset += 2;
16407} /* dissect_zcl_touchlink_network_start_response */
16408
16409/**
16410 *This function decodes the Endpoint Information payload.
16411 *
16412 *@param tvb the tv buffer of the current data_type
16413 *@param tree the tree to append this item to
16414 *@param offset offset of data in tvb
16415*/
16416static void
16417dissect_zcl_touchlink_endpoint_info(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
16418{
16419 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_addr, tvb, *offset, 8, ENC_LITTLE_ENDIAN0x80000000);
16420 *offset += 8;
16421 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16422 *offset += 2;
16423 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_endpoint, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16424 *offset += 1;
16425 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_profile_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16426 *offset += 2;
16427 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_device_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16428 *offset += 2;
16429 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_version, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16430 *offset += 1;
16431} /* dissect_zcl_touchlink_endpoint_info */
16432
16433/**
16434 *This function decodes the Get Group Identifiers Response payload.
16435 *
16436 *@param tvb the tv buffer of the current data_type
16437 *@param tree the tree to append this item to
16438 *@param offset offset of data in tvb
16439*/
16440static void
16441dissect_zcl_touchlink_group_id_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
16442{
16443 proto_tree *list_tree;
16444 uint8_t count;
16445 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_total_groups, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16446 *offset += 1;
16447 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_start_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16448 *offset += 1;
16449 count = tvb_get_uint8(tvb, *offset);
16450 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_count, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16451 *offset += 1;
16452
16453 list_tree = proto_tree_add_subtree(tree, tvb, *offset, count * 3, ett_zbee_zcl_touchlink_groups, NULL((void*)0), "Group Information Records");
16454 while (count--) {
16455 proto_tree_add_item(list_tree, hf_zbee_zcl_touchlink_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN0x80000000);
16456 *offset += 2;
16457 proto_tree_add_item(list_tree, hf_zbee_zcl_touchlink_group_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16458 *offset += 1;
16459 }
16460} /* dissect_zcl_touchlink_group_id_response */
16461
16462/**
16463 *ZigBee ZCL Touchlink Commissioining cluster dissector for wireshark.
16464 *
16465 *@param tvb pointer to buffer containing raw packet.
16466 *@param pinfo pointer to packet information fields
16467 *@param tree pointer to data tree Wireshark uses to display packet.
16468*/
16469static int
16470dissect_zbee_zcl_touchlink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
16471{
16472 zbee_zcl_packet *zcl;
16473 unsigned offset = 0;
16474 uint8_t cmd_id;
16475 int hf_cmd_id;
16476 const value_string *vals_cmd_id;
16477 struct zcl_touchlink_commissioning_data *commissioning_data = NULL((void*)0);
16478
16479 /* Reject the packet if data is NULL */
16480 if (data == NULL((void*)0))
16481 return 0;
16482 zcl = (zbee_zcl_packet *)data;
16483 cmd_id = zcl->cmd_id;
16484
16485 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER0x00) {
16486 hf_cmd_id = hf_zbee_zcl_touchlink_rx_cmd_id;
16487 vals_cmd_id = zbee_zcl_touchlink_rx_cmd_names;
16488 } else {
16489 hf_cmd_id = hf_zbee_zcl_touchlink_tx_cmd_id;
16490 vals_cmd_id = zbee_zcl_touchlink_tx_cmd_names;
16491 }
16492
16493 /* Append the command name to the info column. */
16494 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
16495 val_to_str_const(cmd_id, vals_cmd_id, "Unknown Command"),
16496 zcl->tran_seqno);
16497 /* Add the command ID. */
16498 if (tree) {
16499 proto_tree_add_item(tree, hf_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16500 }
16501 offset++;
16502
16503 /* All commands in the touchlink commissioning command set (0x00-0x3f)
16504 * are cluster inter-PAN command frames and begin with a transaction
16505 * identifier. */
16506 unsigned transaction_id = 0;
16507 if (cmd_id < 0x40) {
16508 proto_tree_add_item_ret_uint(tree, hf_zbee_zcl_touchlink_transaction_id, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000, &transaction_id);
16509 offset += 4;
16510 }
16511
16512 ws_noisy("transaction_id=%08X\n", transaction_id)do { if (1) { ws_log_full("zcl", LOG_LEVEL_NOISY, "epan/dissectors/packet-zbee-zcl-general.c"
, 16512, __func__, "transaction_id=%08X\n", transaction_id); }
} while (0)
;
16513 commissioning_data = (struct zcl_touchlink_commissioning_data *)g_hash_table_lookup(zcl_touchlink_commissioning_map, &transaction_id);
16514 if(!commissioning_data){
16515 ws_debug("creating commissioning_data for transaction_id=%08X\n", transaction_id)do { if (1) { ws_log_full("zcl", LOG_LEVEL_DEBUG, "epan/dissectors/packet-zbee-zcl-general.c"
, 16515, __func__, "creating commissioning_data for transaction_id=%08X\n"
, transaction_id); } } while (0)
;
16516 commissioning_data = wmem_new0(wmem_file_scope(), struct zcl_touchlink_commissioning_data)((struct zcl_touchlink_commissioning_data*)wmem_alloc0((wmem_file_scope
()), sizeof(struct zcl_touchlink_commissioning_data)))
;
16517 commissioning_data->transaction_id = transaction_id;
16518 g_hash_table_insert(zcl_touchlink_commissioning_map, &commissioning_data->transaction_id, commissioning_data);
16519 }
16520
16521 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
16522 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER0x00) {
16523 /* Call the appropriate command dissector */
16524 switch (cmd_id) {
16525 case ZBEE_ZCL_CMD_ID_SCAN_REQUEST0x00:
16526 dissect_zcl_touchlink_scan_request(tvb, tree, &offset);
16527 break;
16528
16529 case ZBEE_ZCL_CMD_ID_IDENTIFY_REQUEST0x06:
16530 dissect_zcl_touchlink_identify_request(tvb, tree, &offset);
16531 break;
16532
16533 case ZBEE_ZCL_CMD_ID_FACTORT_RESET_REQUEST0x07:
16534 /* No payload */
16535 break;
16536
16537 case ZBEE_ZCL_CMD_ID_NETWORK_START_REQUEST0x10:
16538 dissect_zcl_touchlink_network_start_request(tvb, tree, &offset);
16539 break;
16540
16541 case ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_REQUEST0x12:
16542 case ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_REQUEST0x14:
16543 dissect_zcl_touchlink_network_join_request(tvb, pinfo, tree, &offset, commissioning_data);
16544 break;
16545
16546 case ZBEE_ZCL_CMD_ID_NETWORK_UPDATE_REQUEST0x16:
16547 dissect_zcl_touchlink_network_update_request(tvb, tree, &offset);
16548 break;
16549
16550 case ZBEE_ZCL_CMD_ID_DEVICE_INFO_REQUEST0x02:
16551 case ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_REQUEST0x41:
16552 case ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_REQUEST0x42:
16553 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_start_index, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16554 offset++;
16555 break;
16556
16557 default:
16558 break;
16559 }
16560 }
16561 else {
16562 /* Call the appropriate command dissector */
16563 switch (cmd_id) {
16564 case ZBEE_ZCL_CMD_ID_SCAN_RESPONSE0x01:
16565 dissect_zcl_touchlink_scan_response(tvb, tree, &offset, commissioning_data);
16566 break;
16567
16568 case ZBEE_ZCL_CMD_ID_NETWORK_START_RESPONSE0x11:
16569 dissect_zcl_touchlink_network_start_response(tvb, tree, &offset);
16570 break;
16571
16572 case ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_RESPONSE0x13:
16573 case ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_RESPONSE0x15:
16574 proto_tree_add_item(tree, hf_zbee_zcl_touchlink_status, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
16575 offset++;
16576 break;
16577
16578 case ZBEE_ZCL_CMD_ID_DEVICE_INFO_RESPONSE0x03:
16579 break;
16580
16581 case ZBEE_ZCL_CMD_ID_ENDPOINT_INFORMATION0x40:
16582 dissect_zcl_touchlink_endpoint_info(tvb, tree, &offset);
16583 break;
16584
16585 case ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_RESPONSE0x41:
16586 dissect_zcl_touchlink_group_id_response(tvb, tree, &offset);
16587 break;
16588
16589 case ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_RESPONSE0x42:
16590 /* No payload */
16591 break;
16592
16593 default:
16594 break;
16595 }
16596 }
16597
16598 /* Dump leftover data. */
16599 if (tvb_captured_length_remaining(tvb, offset) > 0) {
16600 tvbuff_t *excess = tvb_new_subset_remaining(tvb, offset);
16601 call_data_dissector(excess, pinfo, proto_tree_get_root(tree));
16602 }
16603 return offset;
16604} /*dissect_zbee_zcl_touchlink*/
16605
16606/**
16607 *ZigBee ZCL Touchlink Commissioning cluster protocol registration routine.
16608 *
16609*/
16610void
16611proto_register_zbee_zcl_touchlink(void)
16612{
16613 /* Setup list of header fields */
16614 static hf_register_info hf[] = {
16615 { &hf_zbee_zcl_touchlink_rx_cmd_id,
16616 { "Command", "zbee_zcl_general.touchlink.rx_cmd_id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_touchlink_rx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_touchlink_rx_cmd_names
))))
,
16617 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16618 { &hf_zbee_zcl_touchlink_tx_cmd_id,
16619 { "Command", "zbee_zcl_general.touchlink.tx_cmd_id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_touchlink_tx_cmd_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_touchlink_tx_cmd_names
))))
,
16620 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16621 { &hf_zbee_zcl_touchlink_transaction_id,
16622 { "Transaction ID", "zbee_zcl_general.touchlink.transaction_id", FT_UINT32, BASE_HEX, NULL((void*)0),
16623 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16624
16625 /* ZigBee Information Bitmask */
16626 { &hf_zbee_zcl_touchlink_zbee,
16627 { "ZigBee Information", "zbee_zcl_general.touchlink.zbee", FT_UINT8, BASE_HEX, NULL((void*)0),
16628 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
16629
16630 { &hf_zbee_zcl_touchlink_zbee_type,
16631 { "Logical type", "zbee_zcl_general.touchlink.zbee.type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_touchlink_zbee_type_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_touchlink_zbee_type_names
))))
,
16632 ZBEE_ZCL_TOUCHLINK_ZBEE_INFO_TYPE0x03, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16633
16634 { &hf_zbee_zcl_touchlink_zbee_rxidle,
16635 { "Rx on when idle", "zbee_zcl_general.touchlink.zbee.rxidle", FT_BOOLEAN, 8, TFS(&tfs_yes_no)((0 ? (const struct true_false_string*)0 : ((&tfs_yes_no)
)))
,
16636 ZBEE_ZCL_TOUCHLINK_ZBEE_INFO_RXIDLE0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16637
16638 /* Touchlink Information Bitmask */
16639 { &hf_zbee_zcl_touchlink_info,
16640 { "Touchlink Information", "zbee_zcl_general.touchlink.info", FT_UINT8, BASE_HEX, NULL((void*)0),
16641 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
16642
16643 { &hf_zbee_zcl_touchlink_info_factory,
16644 { "Factory new", "zbee_zcl_general.touchlink.info.factory", FT_BOOLEAN, 8, TFS(&tfs_yes_no)((0 ? (const struct true_false_string*)0 : ((&tfs_yes_no)
)))
,
16645 ZBEE_ZCL_TOUCHLINK_INFO_FACTORY0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16646
16647 { &hf_zbee_zcl_touchlink_info_assignment,
16648 { "Address assignment", "zbee_zcl_general.touchlink.info.assignment", FT_BOOLEAN, 8, TFS(&tfs_yes_no)((0 ? (const struct true_false_string*)0 : ((&tfs_yes_no)
)))
,
16649 ZBEE_ZCL_TOUCHLINK_INFO_ASSIGNMENT0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16650
16651 { &hf_zbee_zcl_touchlink_info_initiator,
16652 { "Link initiator", "zbee_zcl_general.touchlink.info.initiator", FT_BOOLEAN, 8, TFS(&tfs_yes_no)((0 ? (const struct true_false_string*)0 : ((&tfs_yes_no)
)))
,
16653 ZBEE_ZCL_TOUCHLINK_INFO_INITIATOR0x10, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16654
16655 { &hf_zbee_zcl_touchlink_info_undefined,
16656 { "Undefined", "zbee_zcl_general.touchlink.info.undefined", FT_BOOLEAN, 8, NULL((void*)0),
16657 ZBEE_ZCL_TOUCHLINK_INFO_UNDEFINED0x20, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16658
16659 { &hf_zbee_zcl_touchlink_info_profile_introp,
16660 { "Profile Interop", "zbee_zcl_general.touchlink.info.profile.interop", FT_UINT8, BASE_HEX, VALS(zbee_zcl_touchlink_profile_interop_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_touchlink_profile_interop_names
))))
,
16661 ZBEE_ZCL_TOUCHLINK_INFO_PROFILE_INTEROP0x80, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16662
16663 /* Touchlink Key Information Bitmask */
16664 { &hf_zbee_zcl_touchlink_key_bitmask,
16665 { "Key Bitmask", "zbee_zcl_general.touchlink.key_bitmask", FT_UINT16, BASE_HEX, NULL((void*)0),
16666 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16667
16668 { &hf_zbee_zcl_touchlink_key_bit_dev,
16669 { "Development Key", "zbee_zcl_general.touchlink.key_bitmask.dev", FT_BOOLEAN, 16, TFS(&tfs_yes_no)((0 ? (const struct true_false_string*)0 : ((&tfs_yes_no)
)))
,
16670 (1<<ZBEE_ZCL_TOUCHLINK_KEYID_DEVELOPMENT0), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16671
16672 { &hf_zbee_zcl_touchlink_key_bit_master,
16673 { "Master Key", "zbee_zcl_general.touchlink.key_bitmask.master", FT_BOOLEAN, 16, TFS(&tfs_yes_no)((0 ? (const struct true_false_string*)0 : ((&tfs_yes_no)
)))
,
16674 (1<<ZBEE_ZCL_TOUCHLINK_KEYID_MASTER4), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16675
16676 { &hf_zbee_zcl_touchlink_key_bit_cert,
16677 { "Certification Key", "zbee_zcl_general.touchlink.key_bitmask.cert", FT_BOOLEAN, 16, TFS(&tfs_yes_no)((0 ? (const struct true_false_string*)0 : ((&tfs_yes_no)
)))
,
16678 (1<<ZBEE_ZCL_TOUCHLINK_KEYID_CERTIFICATION15), NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16679
16680 { &hf_zbee_zcl_touchlink_start_index,
16681 { "Start index", "zbee_zcl_general.touchlink.index", FT_UINT8, BASE_DEC, NULL((void*)0),
16682 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16683
16684 { &hf_zbee_zcl_touchlink_ident_duration,
16685 { "Identify duration", "zbee_zcl_general.touchlink.duration", FT_UINT16, BASE_DEC, NULL((void*)0),
16686 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16687
16688 { &hf_zbee_zcl_touchlink_rssi_correction,
16689 { "RSSI Correction", "zbee_zcl_general.touchlink.rssi_correction", FT_UINT8, BASE_DEC, NULL((void*)0),
16690 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16691
16692 { &hf_zbee_zcl_touchlink_response_id,
16693 { "Response ID", "zbee_zcl_general.touchlink.response_id", FT_UINT32, BASE_HEX, NULL((void*)0),
16694 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16695
16696 { &hf_zbee_zcl_touchlink_ext_panid,
16697 { "Extended PAN ID", "zbee_zcl_general.touchlink.ext_panid", FT_EUI64, BASE_NONE, NULL((void*)0),
16698 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16699
16700 { &hf_zbee_zcl_touchlink_nwk_update_id,
16701 { "Network Update ID", "zbee_zcl_general.touchlink.nwk_update_id", FT_UINT8, BASE_DEC, NULL((void*)0),
16702 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16703
16704 { &hf_zbee_zcl_touchlink_channel,
16705 { "Logical Channel", "zbee_zcl_general.touchlink.channel", FT_UINT8, BASE_DEC, NULL((void*)0),
16706 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16707
16708 { &hf_zbee_zcl_touchlink_nwk_addr,
16709 { "Network Address", "zbee_zcl_general.touchlink.nwk_addr", FT_UINT16, BASE_DEC, NULL((void*)0),
16710 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16711
16712 { &hf_zbee_zcl_touchlink_ext_addr,
16713 { "Extended Address", "zbee_zcl_general.touchlink.ext_addr", FT_EUI64, BASE_NONE, NULL((void*)0),
16714 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16715
16716 { &hf_zbee_zcl_touchlink_panid,
16717 { "PAN ID", "zbee_zcl_general.touchlink.panid", FT_UINT16, BASE_HEX, NULL((void*)0),
16718 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16719
16720 { &hf_zbee_zcl_touchlink_sub_devices,
16721 { "Sub-devices", "zbee_zcl_general.touchlink.sub_devices", FT_UINT8, BASE_DEC, NULL((void*)0),
16722 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16723
16724 { &hf_zbee_zcl_touchlink_total_groups,
16725 { "Total Group Identifiers", "zbee_zcl_general.touchlink.total_groups", FT_UINT8, BASE_DEC, NULL((void*)0),
16726 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16727
16728 { &hf_zbee_zcl_touchlink_endpoint,
16729 { "Endpoint", "zbee_zcl_general.touchlink.endpoint", FT_UINT8, BASE_DEC, NULL((void*)0),
16730 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16731
16732 { &hf_zbee_zcl_touchlink_profile_id,
16733 { "Profile ID", "zbee_zcl_general.touchlink.profile_id", FT_UINT16, BASE_HEX | BASE_RANGE_STRING0x00000100, RVALS(zbee_aps_apid_names)((0 ? (const struct _range_string*)0 : ((zbee_aps_apid_names)
)))
,
16734 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16735
16736 { &hf_zbee_zcl_touchlink_device_id,
16737 { "Device ID", "zbee_zcl_general.touchlink.device_id", FT_UINT16, BASE_HEX, NULL((void*)0),
16738 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16739
16740 { &hf_zbee_zcl_touchlink_version,
16741 { "Version", "zbee_zcl_general.touchlink.version", FT_UINT8, BASE_HEX, NULL((void*)0),
16742 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16743
16744 { &hf_zbee_zcl_touchlink_group_count,
16745 { "Group ID Count", "zbee_zcl_general.touchlink.group_count", FT_UINT8, BASE_DEC, NULL((void*)0),
16746 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16747
16748 { &hf_zbee_zcl_touchlink_group_begin,
16749 { "Group ID Begin", "zbee_zcl_general.touchlink.group_begin", FT_UINT16, BASE_HEX, NULL((void*)0),
16750 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16751
16752 { &hf_zbee_zcl_touchlink_group_end,
16753 { "Group ID End", "zbee_zcl_general.touchlink.group_end", FT_UINT16, BASE_HEX, NULL((void*)0),
16754 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16755
16756 { &hf_zbee_zcl_touchlink_group_type,
16757 { "Group Type", "zbee_zcl_general.touchlink.group_type", FT_UINT8, BASE_HEX, NULL((void*)0),
16758 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16759
16760 { &hf_zbee_zcl_touchlink_group_id,
16761 { "Group ID", "zbee_zcl_general.touchlink.group_id", FT_UINT16, BASE_HEX, NULL((void*)0),
16762 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16763
16764 { &hf_zbee_zcl_touchlink_addr_range_begin,
16765 { "Free Address Range Begin", "zbee_zcl_general.touchlink.addr_range_begin", FT_UINT16, BASE_HEX, NULL((void*)0),
16766 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16767
16768 { &hf_zbee_zcl_touchlink_addr_range_end,
16769 { "Free Address Range End", "zbee_zcl_general.touchlink.addr_range_end", FT_UINT16, BASE_HEX, NULL((void*)0),
16770 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16771
16772 { &hf_zbee_zcl_touchlink_group_range_begin,
16773 { "Free Group ID Range Begin", "zbee_zcl_general.touchlink.group_range_begin", FT_UINT16, BASE_HEX, NULL((void*)0),
16774 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16775
16776 { &hf_zbee_zcl_touchlink_group_range_end,
16777 { "Free Group ID Range End", "zbee_zcl_general.touchlink.group_range_end", FT_UINT16, BASE_HEX, NULL((void*)0),
16778 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16779
16780 { &hf_zbee_zcl_touchlink_key_index,
16781 { "Key Index", "zbee_zcl_general.touchlink.key_index", FT_UINT8, BASE_DEC, VALS(zbee_zcl_touchlink_keyid_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_touchlink_keyid_names
))))
,
16782 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16783
16784 { &hf_zbee_zcl_touchlink_key,
16785 { "Encrypted Network Key", "zbee_zcl_general.touchlink.key", FT_BYTES, BASE_NONE, NULL((void*)0),
16786 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16787
16788 { &hf_zbee_zcl_touchlink_network_key,
16789 { "Decrypted Network Key", "zbee_zcl_general.touchlink.network_key", FT_BYTES, BASE_NONE, NULL((void*)0),
16790 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16791
16792 { &hf_zbee_zcl_touchlink_init_eui64,
16793 { "Initiator Extended Address", "zbee_zcl_general.touchlink.init_eui", FT_EUI64, BASE_NONE, NULL((void*)0),
16794 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16795
16796 { &hf_zbee_zcl_touchlink_init_addr,
16797 { "Initiator Network Address", "zbee_zcl_general.touchlink.init_addr", FT_UINT16, BASE_HEX, NULL((void*)0),
16798 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16799
16800 { &hf_zbee_zcl_touchlink_status,
16801 { "Status", "zbee_zcl_general.touchlink.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_touchlink_status_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_touchlink_status_names
))))
,
16802 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
16803 };
16804
16805 /* ZCL Touchlink subtrees */
16806 static int *ett[] = {
16807 &ett_zbee_zcl_touchlink,
16808 &ett_zbee_zcl_touchlink_zbee,
16809 &ett_zbee_zcl_touchlink_info,
16810 &ett_zbee_zcl_touchlink_keybits,
16811 &ett_zbee_zcl_touchlink_groups,
16812 };
16813
16814 static ei_register_info ei[] = {
16815 { &ei_zbee_zcl_touchlink_no_key, { "zbee_zcl_general.touchlink.no_key.expert", PI_DECRYPTION0x0c000000, PI_WARN0x00600000, "Cannot decrypt transport key", EXPFILL0, ((void*)0), 0, {0, {((void*)0), ((void*)0), FT_NONE, BASE_NONE
, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE, -1, ((void
*)0)}}
}},
16816 };
16817
16818 expert_module_t *expert_zbee_zcl;
16819
16820 /* Register the ZigBee ZCL Touchlink cluster protocol name and description */
16821 proto_zbee_zcl_touchlink = proto_register_protocol("ZigBee ZCL Touchlink", "ZCL Touchlink", ZBEE_PROTOABBREV_ZCL_TOUCHLINK"zbee_zcl_general.touchlink");
16822 proto_register_field_array(proto_zbee_zcl_touchlink, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
16823 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
16824 expert_zbee_zcl = expert_register_protocol(proto_zbee_zcl_touchlink);
16825 expert_register_field_array(expert_zbee_zcl, ei, array_length(ei)(sizeof (ei) / sizeof (ei)[0]));
16826
16827 zcl_touchlink_commissioning_map = g_hash_table_new(zcl_touchlink_comissioning_hash, zcl_touchlink_comissioning_equal);
16828
16829 /* Register the ZigBee ZCL Touchlink Commissioning dissector. */
16830 register_dissector(ZBEE_PROTOABBREV_ZCL_TOUCHLINK"zbee_zcl_general.touchlink", dissect_zbee_zcl_touchlink, proto_zbee_zcl_touchlink);
16831} /*proto_register_zbee_zcl_touchlink*/
16832
16833/**
16834 *Hands off the ZCL Touchlink Commissioning dissector.
16835 *
16836*/
16837void
16838proto_reg_handoff_zbee_zcl_touchlink(void)
16839{
16840 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_TOUCHLINK"zbee_zcl_general.touchlink",
16841 proto_zbee_zcl_touchlink,
16842 ett_zbee_zcl_touchlink,
16843 ZBEE_ZCL_CID_ZLL0x1000,
16844 ZBEE_MFG_CODE_NONE0x0000,
16845 -1, -1,
16846 hf_zbee_zcl_touchlink_rx_cmd_id, hf_zbee_zcl_touchlink_tx_cmd_id,
16847 NULL((void*)0)
16848 );
16849} /*proto_reg_handoff_zbee_zcl_touchlink*/
16850
16851/*
16852 * Editor modelines - https://www.wireshark.org/tools/modelines.html
16853 *
16854 * Local variables:
16855 * c-basic-offset: 4
16856 * tab-width: 8
16857 * indent-tabs-mode: nil
16858 * End:
16859 *
16860 * vi: set shiftwidth=4 tabstop=8 expandtab:
16861 * :indentSize=4:tabSize=8:noTabs=true:
16862 */