/src/wireshark/epan/dissectors/packet-zbee-zcl-general.c
Line | Count | Source |
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 | 0 | #define WS_LOG_DOMAIN "zcl" |
17 | | |
18 | | #include <wireshark.h> |
19 | | #include <epan/packet.h> |
20 | | #include <epan/expert.h> |
21 | | #include <epan/to_str.h> |
22 | | #include <epan/tfs.h> |
23 | | #include <wsutil/array.h> |
24 | | #include <wsutil/bits_ctz.h> |
25 | | #include <wsutil/utf8_entities.h> |
26 | | #include <wsutil/wsgcrypt.h> |
27 | | |
28 | | #include "packet-zbee.h" |
29 | | #include "packet-zbee-aps.h" |
30 | | #include "packet-zbee-nwk.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 | 702 | #define ZBEE_ZCL_ATTR_ID_BASIC_ZCL_VERSION 0x0000 /* ZCL Version */ |
44 | 717 | #define ZBEE_ZCL_ATTR_ID_BASIC_APPL_VERSION 0x0001 /* Application Version */ |
45 | 726 | #define ZBEE_ZCL_ATTR_ID_BASIC_STACK_VERSION 0x0002 /* Stack Version */ |
46 | 731 | #define ZBEE_ZCL_ATTR_ID_BASIC_HW_VERSION 0x0003 /* HW Version */ |
47 | 735 | #define ZBEE_ZCL_ATTR_ID_BASIC_MANUFACTURER_NAME 0x0004 /* Manufacturer Name */ |
48 | 738 | #define ZBEE_ZCL_ATTR_ID_BASIC_MODEL_ID 0x0005 /* Model Identifier */ |
49 | 751 | #define ZBEE_ZCL_ATTR_ID_BASIC_DATE_CODE 0x0006 /* Date Code */ |
50 | 13 | #define ZBEE_ZCL_ATTR_ID_BASIC_POWER_SOURCE 0x0007 /* Power Source */ |
51 | 754 | #define ZBEE_ZCL_ATTR_ID_BASIC_LOCATION_DESCR 0x0010 /* Location Description */ |
52 | 753 | #define ZBEE_ZCL_ATTR_ID_BASIC_PHY_ENVIRONMENT 0x0011 /* Physical Environment */ |
53 | 13 | #define ZBEE_ZCL_ATTR_ID_BASIC_DEVICE_ENABLED 0x0012 /* Device Enabled */ |
54 | 7 | #define ZBEE_ZCL_ATTR_ID_BASIC_ALARM_MASK 0x0013 /* Alarm Mask */ |
55 | 5 | #define ZBEE_ZCL_ATTR_ID_BASIC_DISABLE_LOCAL_CFG 0x0014 /* Disable Local Config */ |
56 | 754 | #define ZBEE_ZCL_ATTR_ID_BASIC_SW_BUILD_ID 0x4000 /* SW Build Id */ |
57 | | |
58 | | /* Server Commands Received */ |
59 | 9 | #define ZBEE_ZCL_CMD_ID_BASIC_RESET_FACTORY_DEFAULTS 0x00 /* Reset to Factory Defaults */ |
60 | | |
61 | | /* Server Commands Generated - None */ |
62 | | |
63 | | /* Power Source Id */ |
64 | | #define ZBEE_ZCL_BASIC_PWR_SRC_UNKNOWN 0x00 /* Unknown */ |
65 | | #define ZBEE_ZCL_BASIC_PWR_SRC_MAINS_1PH 0x01 /* Mains (single phase) */ |
66 | | #define ZBEE_ZCL_BASIC_PWR_SRC_MAINS_3PH 0x02 /* Mains (3 phase) */ |
67 | | #define ZBEE_ZCL_BASIC_PWR_SRC_BATTERY 0x03 /* Battery */ |
68 | | #define ZBEE_ZCL_BASIC_PWR_SRC_DC_SRC 0x04 /* DC source */ |
69 | | #define ZBEE_ZCL_BASIC_PWR_SRC_EMERGENCY_1 0x05 /* Emergency mains constantly powered */ |
70 | | #define ZBEE_ZCL_BASIC_PWR_SRC_EMERGENCY_2 0x06 /* Emergency mains and transfer switch */ |
71 | | |
72 | | /* Device Enable Values */ |
73 | | #define ZBEE_ZCL_BASIC_DISABLED 0x00 /* Disabled */ |
74 | | #define ZBEE_ZCL_BASIC_ENABLED 0x01 /* Enabled */ |
75 | | |
76 | | /* Alarm Mask bit-mask */ |
77 | 16 | #define ZBEE_ZCL_BASIC_ALARM_GEN_HW_FAULT 0x01 /* General hardware fault */ |
78 | 16 | #define ZBEE_ZCL_BASIC_ALARM_GEN_SW_FAULT 0x02 /* General software fault */ |
79 | 16 | #define ZBEE_ZCL_BASIC_ALARM_RESERVED 0xfc /* Reserved */ |
80 | | |
81 | | /* Disable Local Config bit-mask */ |
82 | 16 | #define ZBEE_ZCL_BASIC_DIS_LOC_CFG_RESET 0x01 /* Reset (to factory defaults) */ |
83 | 16 | #define ZBEE_ZCL_BASIC_DIS_LOC_CFG_DEV_CFG 0x02 /* Device configuration */ |
84 | 16 | #define ZBEE_ZCL_BASIC_DIS_LOC_CFG_RESERVED 0xfc /* Reserved */ |
85 | | |
86 | | /*************************/ |
87 | | /* Function Declarations */ |
88 | | /*************************/ |
89 | | |
90 | | void proto_register_zbee_zcl_basic(void); |
91 | | void proto_reg_handoff_zbee_zcl_basic(void); |
92 | | |
93 | | /* Private functions prototype */ |
94 | | |
95 | | /*************************/ |
96 | | /* Global Variables */ |
97 | | /*************************/ |
98 | | /* Initialize the protocol and registered fields */ |
99 | | static int proto_zbee_zcl_basic; |
100 | | |
101 | | static int hf_zbee_zcl_basic_attr_id; |
102 | | static int hf_zbee_zcl_basic_pwr_src; |
103 | | static int hf_zbee_zcl_basic_dev_en; |
104 | | static int hf_zbee_zcl_basic_alarm_mask; |
105 | | static int hf_zbee_zcl_basic_alarm_mask_gen_hw_fault; |
106 | | static int hf_zbee_zcl_basic_alarm_mask_gen_sw_fault; |
107 | | static int hf_zbee_zcl_basic_alarm_mask_reserved; |
108 | | static int hf_zbee_zcl_basic_disable_local_cfg; |
109 | | static int hf_zbee_zcl_basic_disable_local_cfg_reset; |
110 | | static int hf_zbee_zcl_basic_disable_local_cfg_device_cfg; |
111 | | static int hf_zbee_zcl_basic_disable_local_cfg_reserved; |
112 | | static int hf_zbee_zcl_basic_srv_rx_cmd_id; |
113 | | |
114 | | /* Initialize the subtree pointers */ |
115 | | static int ett_zbee_zcl_basic; |
116 | | static int ett_zbee_zcl_basic_alarm_mask; |
117 | | static int ett_zbee_zcl_basic_dis_local_cfg; |
118 | | |
119 | | /* Attributes */ |
120 | | static const value_string zbee_zcl_basic_attr_names[] = { |
121 | | { ZBEE_ZCL_ATTR_ID_BASIC_ZCL_VERSION, "ZCL Version" }, |
122 | | { ZBEE_ZCL_ATTR_ID_BASIC_APPL_VERSION, "Application Version" }, |
123 | | { ZBEE_ZCL_ATTR_ID_BASIC_STACK_VERSION, "Stack Version" }, |
124 | | { ZBEE_ZCL_ATTR_ID_BASIC_HW_VERSION, "HW Version" }, |
125 | | { ZBEE_ZCL_ATTR_ID_BASIC_MANUFACTURER_NAME, "Manufacturer Name" }, |
126 | | { ZBEE_ZCL_ATTR_ID_BASIC_MODEL_ID, "Model Identifier" }, |
127 | | { ZBEE_ZCL_ATTR_ID_BASIC_DATE_CODE, "Date Code" }, |
128 | | { ZBEE_ZCL_ATTR_ID_BASIC_POWER_SOURCE, "Power Source" }, |
129 | | { ZBEE_ZCL_ATTR_ID_BASIC_LOCATION_DESCR, "Location Description" }, |
130 | | { ZBEE_ZCL_ATTR_ID_BASIC_PHY_ENVIRONMENT, "Physical Environment" }, |
131 | | { ZBEE_ZCL_ATTR_ID_BASIC_DEVICE_ENABLED, "Device Enabled" }, |
132 | | { ZBEE_ZCL_ATTR_ID_BASIC_ALARM_MASK, "Alarm Mask" }, |
133 | | { ZBEE_ZCL_ATTR_ID_BASIC_DISABLE_LOCAL_CFG, "Disable Local Config" }, |
134 | | { ZBEE_ZCL_ATTR_ID_BASIC_SW_BUILD_ID, "Software Build Id" }, |
135 | | { 0, NULL } |
136 | | }; |
137 | | |
138 | | /* Server Commands Received */ |
139 | | static const value_string zbee_zcl_basic_srv_rx_cmd_names[] = { |
140 | | { ZBEE_ZCL_CMD_ID_BASIC_RESET_FACTORY_DEFAULTS, "Reset to Factory Defaults" }, |
141 | | { 0, NULL } |
142 | | }; |
143 | | |
144 | | /* Power Source Names */ |
145 | | static const value_string zbee_zcl_basic_pwr_src_names[] = { |
146 | | { ZBEE_ZCL_BASIC_PWR_SRC_UNKNOWN, "Unknown" }, |
147 | | { ZBEE_ZCL_BASIC_PWR_SRC_MAINS_1PH, "Mains (single phase)" }, |
148 | | { ZBEE_ZCL_BASIC_PWR_SRC_MAINS_3PH, "Mains (3 phase)" }, |
149 | | { ZBEE_ZCL_BASIC_PWR_SRC_BATTERY, "Battery" }, |
150 | | { ZBEE_ZCL_BASIC_PWR_SRC_DC_SRC, "DC source" }, |
151 | | { ZBEE_ZCL_BASIC_PWR_SRC_EMERGENCY_1, "Emergency mains constantly powered" }, |
152 | | { ZBEE_ZCL_BASIC_PWR_SRC_EMERGENCY_2, "Emergency mains and transfer switch" }, |
153 | | { 0, NULL } |
154 | | }; |
155 | | |
156 | | /* Device Enable Names */ |
157 | | static const value_string zbee_zcl_basic_dev_en_names[] = { |
158 | | { ZBEE_ZCL_BASIC_DISABLED, "Disabled" }, |
159 | | { ZBEE_ZCL_BASIC_ENABLED, "Enabled" }, |
160 | | { 0, NULL } |
161 | | }; |
162 | | |
163 | | /*************************/ |
164 | | /* Function Bodies */ |
165 | | /*************************/ |
166 | | |
167 | | /*FUNCTION:------------------------------------------------------ |
168 | | * NAME |
169 | | * dissect_zbee_zcl_basic |
170 | | * DESCRIPTION |
171 | | * ZigBee ZCL Basic cluster dissector for wireshark. |
172 | | * PARAMETERS |
173 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
174 | | * packet_info *pinfo - pointer to packet information fields |
175 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
176 | | * void *data - pointer to ZCL packet structure. |
177 | | * RETURNS |
178 | | * int - length of parsed data. |
179 | | *--------------------------------------------------------------- |
180 | | */ |
181 | | static int |
182 | | dissect_zbee_zcl_basic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) |
183 | 71 | { |
184 | 71 | zbee_zcl_packet *zcl; |
185 | 71 | unsigned offset = 0; |
186 | 71 | uint8_t cmd_id; |
187 | | |
188 | | /* Reject the packet if data is NULL */ |
189 | 71 | if (data == NULL) |
190 | 0 | return 0; |
191 | 71 | zcl = (zbee_zcl_packet *)data; |
192 | 71 | cmd_id = zcl->cmd_id; |
193 | | |
194 | | /* Create a subtree for the ZCL Command frame, and add the command ID to it. */ |
195 | 71 | if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { |
196 | | /* Append the command name to the info column. */ |
197 | 50 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
198 | 50 | val_to_str_const(cmd_id, zbee_zcl_basic_srv_rx_cmd_names, "Unknown Command"), |
199 | 50 | zcl->tran_seqno); |
200 | | |
201 | 50 | if (tree) { |
202 | | /* Add the command ID. */ |
203 | 50 | proto_tree_add_item(tree, hf_zbee_zcl_basic_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
204 | 50 | } |
205 | | /*offset++;*/ |
206 | | |
207 | | /* Call the appropriate command dissector */ |
208 | 50 | switch (cmd_id) { |
209 | | |
210 | 9 | case ZBEE_ZCL_CMD_ID_BASIC_RESET_FACTORY_DEFAULTS: |
211 | | /* No payload */ |
212 | 9 | break; |
213 | | |
214 | 41 | default: |
215 | 41 | break; |
216 | 50 | } |
217 | 50 | } |
218 | | |
219 | 71 | return tvb_captured_length(tvb); |
220 | 71 | } /*dissect_zbee_zcl_basic*/ |
221 | | |
222 | | |
223 | | /*FUNCTION:------------------------------------------------------ |
224 | | * NAME |
225 | | * dissect_zcl_basic_attr_data |
226 | | * DESCRIPTION |
227 | | * this function is called by ZCL foundation dissector in order to decode |
228 | | * specific cluster attributes data. |
229 | | * PARAMETERS |
230 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
231 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
232 | | * unsigned *offset - pointer to buffer offset |
233 | | * uint16_t attr_id - attribute identifier |
234 | | * unsigned data_type - attribute data type |
235 | | * bool client_attr- ZCL client |
236 | | * RETURNS |
237 | | * none |
238 | | *--------------------------------------------------------------- |
239 | | */ |
240 | | static void |
241 | | dissect_zcl_basic_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
242 | 2.07k | { |
243 | | |
244 | 2.07k | static int * const alarm_mask[] = { |
245 | 2.07k | &hf_zbee_zcl_basic_alarm_mask_gen_hw_fault, |
246 | 2.07k | &hf_zbee_zcl_basic_alarm_mask_gen_sw_fault, |
247 | 2.07k | &hf_zbee_zcl_basic_alarm_mask_reserved, |
248 | 2.07k | NULL |
249 | 2.07k | }; |
250 | | |
251 | 2.07k | static int * const local_cfg[] = { |
252 | 2.07k | &hf_zbee_zcl_basic_disable_local_cfg_reset, |
253 | 2.07k | &hf_zbee_zcl_basic_disable_local_cfg_device_cfg, |
254 | 2.07k | &hf_zbee_zcl_basic_disable_local_cfg_reserved, |
255 | 2.07k | NULL |
256 | 2.07k | }; |
257 | | |
258 | | /* Dissect attribute data type and data */ |
259 | 2.07k | switch (attr_id) { |
260 | | |
261 | 13 | case ZBEE_ZCL_ATTR_ID_BASIC_POWER_SOURCE: |
262 | 13 | proto_tree_add_item(tree, hf_zbee_zcl_basic_pwr_src, tvb, *offset, 1, ENC_NA); |
263 | 13 | *offset += 1; |
264 | 13 | break; |
265 | | |
266 | 13 | case ZBEE_ZCL_ATTR_ID_BASIC_DEVICE_ENABLED: |
267 | 13 | proto_tree_add_item(tree, hf_zbee_zcl_basic_dev_en, tvb, *offset, 1, ENC_NA); |
268 | 13 | *offset += 1; |
269 | 13 | break; |
270 | | |
271 | 7 | case ZBEE_ZCL_ATTR_ID_BASIC_ALARM_MASK: |
272 | 7 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_basic_alarm_mask , ett_zbee_zcl_basic_alarm_mask, alarm_mask, ENC_NA); |
273 | 7 | *offset += 1; |
274 | 7 | break; |
275 | | |
276 | 5 | case ZBEE_ZCL_ATTR_ID_BASIC_DISABLE_LOCAL_CFG: |
277 | 5 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_basic_disable_local_cfg , ett_zbee_zcl_basic_dis_local_cfg, local_cfg, ENC_NA); |
278 | 5 | *offset += 1; |
279 | 5 | break; |
280 | | |
281 | 702 | case ZBEE_ZCL_ATTR_ID_BASIC_ZCL_VERSION: |
282 | 717 | case ZBEE_ZCL_ATTR_ID_BASIC_APPL_VERSION: |
283 | 726 | case ZBEE_ZCL_ATTR_ID_BASIC_STACK_VERSION: |
284 | 731 | case ZBEE_ZCL_ATTR_ID_BASIC_HW_VERSION: |
285 | 735 | case ZBEE_ZCL_ATTR_ID_BASIC_MANUFACTURER_NAME: |
286 | 738 | case ZBEE_ZCL_ATTR_ID_BASIC_MODEL_ID: |
287 | 751 | case ZBEE_ZCL_ATTR_ID_BASIC_DATE_CODE: |
288 | 753 | case ZBEE_ZCL_ATTR_ID_BASIC_PHY_ENVIRONMENT: |
289 | 754 | case ZBEE_ZCL_ATTR_ID_BASIC_LOCATION_DESCR: |
290 | 754 | case ZBEE_ZCL_ATTR_ID_BASIC_SW_BUILD_ID: |
291 | 2.04k | default: |
292 | 2.04k | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
293 | 2.04k | break; |
294 | 2.07k | } |
295 | | |
296 | 2.07k | } /*dissect_zcl_basic_attr_data*/ |
297 | | |
298 | | |
299 | | /*FUNCTION:------------------------------------------------------ |
300 | | * NAME |
301 | | * proto_register_zbee_zcl_basic |
302 | | * DESCRIPTION |
303 | | * ZigBee ZCL Basic cluster protocol registration routine. |
304 | | * PARAMETERS |
305 | | * none |
306 | | * RETURNS |
307 | | * void |
308 | | *--------------------------------------------------------------- |
309 | | */ |
310 | | void |
311 | | proto_register_zbee_zcl_basic(void) |
312 | 16 | { |
313 | | /* Setup list of header fields */ |
314 | 16 | static hf_register_info hf[] = { |
315 | | |
316 | 16 | { &hf_zbee_zcl_basic_attr_id, |
317 | 16 | { "Attribute", "zbee_zcl_general.basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_basic_attr_names), |
318 | 16 | 0x00, NULL, HFILL } }, |
319 | | |
320 | 16 | { &hf_zbee_zcl_basic_pwr_src, |
321 | 16 | { "Power Source", "zbee_zcl_general.basic.attr.pwr_src", FT_UINT8, BASE_HEX, VALS(zbee_zcl_basic_pwr_src_names), |
322 | 16 | 0x00, NULL, HFILL } }, |
323 | | |
324 | 16 | { &hf_zbee_zcl_basic_dev_en, |
325 | 16 | { "Device Enabled", "zbee_zcl_general.basic.attr.dev_en", FT_UINT8, BASE_HEX, VALS(zbee_zcl_basic_dev_en_names), |
326 | 16 | 0x00, NULL, HFILL } }, |
327 | | |
328 | | /* start Alarm Mask fields */ |
329 | 16 | { &hf_zbee_zcl_basic_alarm_mask, |
330 | 16 | { "Alarm Mask", "zbee_zcl_general.basic.attr.alarm_mask", FT_UINT8, BASE_HEX, NULL, |
331 | 16 | 0x0, NULL, HFILL } }, |
332 | | |
333 | 16 | { &hf_zbee_zcl_basic_alarm_mask_gen_hw_fault, |
334 | 16 | { "General hardware fault", "zbee_zcl_general.basic.attr.alarm_mask.gen_hw_fault", FT_UINT8, BASE_DEC, NULL, |
335 | 16 | ZBEE_ZCL_BASIC_ALARM_GEN_HW_FAULT, NULL, HFILL } }, |
336 | | |
337 | 16 | { &hf_zbee_zcl_basic_alarm_mask_gen_sw_fault, |
338 | 16 | { "General software fault", "zbee_zcl_general.basic.attr.alarm_mask.gen_sw_fault", FT_UINT8, BASE_DEC, NULL, |
339 | 16 | ZBEE_ZCL_BASIC_ALARM_GEN_SW_FAULT, NULL, HFILL } }, |
340 | | |
341 | 16 | { &hf_zbee_zcl_basic_alarm_mask_reserved, |
342 | 16 | { "Reserved", "zbee_zcl_general.basic.attr.alarm_mask.reserved", FT_UINT8, BASE_DEC, NULL, |
343 | 16 | ZBEE_ZCL_BASIC_ALARM_RESERVED, NULL, HFILL } }, |
344 | | /* end Alarm Mask fields */ |
345 | | |
346 | | /* start Disable Local Config fields */ |
347 | 16 | { &hf_zbee_zcl_basic_disable_local_cfg, |
348 | 16 | { "Disable Local Config", "zbee_zcl_general.basic.attr.dis_loc_cfg", FT_UINT8, BASE_HEX, NULL, |
349 | 16 | 0x0, NULL, HFILL } }, |
350 | | |
351 | 16 | { &hf_zbee_zcl_basic_disable_local_cfg_reset, |
352 | 16 | { "Reset (to factory defaults)", "zbee_zcl_general.basic.attr.dis_loc_cfg.reset", FT_UINT8, BASE_DEC, NULL, |
353 | 16 | ZBEE_ZCL_BASIC_DIS_LOC_CFG_RESET , NULL, HFILL } }, |
354 | | |
355 | 16 | { &hf_zbee_zcl_basic_disable_local_cfg_device_cfg, |
356 | 16 | { "Device configuration", "zbee_zcl_general.basic.attr.dis_loc_cfg.dev_cfg", FT_UINT8, BASE_DEC, NULL, |
357 | 16 | ZBEE_ZCL_BASIC_DIS_LOC_CFG_DEV_CFG , NULL, HFILL } }, |
358 | | |
359 | 16 | { &hf_zbee_zcl_basic_disable_local_cfg_reserved, |
360 | 16 | { "Reserved", "zbee_zcl_general.basic.attr.dis_loc_cfg.reserved", FT_UINT8, BASE_DEC, NULL, |
361 | 16 | ZBEE_ZCL_BASIC_DIS_LOC_CFG_RESERVED , NULL, HFILL } }, |
362 | | /* end Disable Local Config fields */ |
363 | | |
364 | 16 | { &hf_zbee_zcl_basic_srv_rx_cmd_id, |
365 | 16 | { "Command", "zbee_zcl_general.basic.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_basic_srv_rx_cmd_names), |
366 | 16 | 0x00, NULL, HFILL } } |
367 | | |
368 | 16 | }; |
369 | | |
370 | | /* ZCL Basic subtrees */ |
371 | 16 | static int *ett[] = { |
372 | 16 | &ett_zbee_zcl_basic, |
373 | 16 | &ett_zbee_zcl_basic_alarm_mask, |
374 | 16 | &ett_zbee_zcl_basic_dis_local_cfg |
375 | 16 | }; |
376 | | |
377 | | /* Register the ZigBee ZCL Basic cluster protocol name and description */ |
378 | 16 | proto_zbee_zcl_basic = proto_register_protocol("ZigBee ZCL Basic", "ZCL Basic", ZBEE_PROTOABBREV_ZCL_BASIC); |
379 | 16 | proto_register_field_array(proto_zbee_zcl_basic, hf, array_length(hf)); |
380 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
381 | | |
382 | | /* Register the ZigBee ZCL Basic dissector. */ |
383 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_BASIC, dissect_zbee_zcl_basic, proto_zbee_zcl_basic); |
384 | 16 | } /*proto_register_zbee_zcl_basic*/ |
385 | | |
386 | | /*FUNCTION:------------------------------------------------------ |
387 | | * NAME |
388 | | * proto_reg_handoff_zbee_zcl_basic |
389 | | * DESCRIPTION |
390 | | * Hands off the ZCL Basic dissector. |
391 | | * PARAMETERS |
392 | | * none |
393 | | * RETURNS |
394 | | * none |
395 | | *--------------------------------------------------------------- |
396 | | */ |
397 | | void |
398 | | proto_reg_handoff_zbee_zcl_basic(void) |
399 | 16 | { |
400 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_BASIC, |
401 | 16 | proto_zbee_zcl_basic, |
402 | 16 | ett_zbee_zcl_basic, |
403 | 16 | ZBEE_ZCL_CID_BASIC, |
404 | 16 | ZBEE_MFG_CODE_NONE, |
405 | 16 | hf_zbee_zcl_basic_attr_id, |
406 | 16 | hf_zbee_zcl_basic_attr_id, |
407 | 16 | hf_zbee_zcl_basic_srv_rx_cmd_id, |
408 | 16 | -1, |
409 | 16 | dissect_zcl_basic_attr_data |
410 | 16 | ); |
411 | 16 | } /*proto_reg_handoff_zbee_zcl_basic*/ |
412 | | |
413 | | |
414 | | |
415 | | /* ########################################################################## */ |
416 | | /* #### (0x0001) POWER CONFIGURATION CLUSTER ################################ */ |
417 | | /* ########################################################################## */ |
418 | | |
419 | | /*************************/ |
420 | | /* Defines */ |
421 | | /*************************/ |
422 | | |
423 | | /* Attributes */ |
424 | 366 | #define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE 0x0000 /* Mains voltage */ |
425 | 109 | #define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_FREQUENCY 0x0001 /* Mains frequency */ |
426 | 6 | #define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_ALARM_MASK 0x0010 /* Mains Alarm Mask */ |
427 | 17 | #define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MIN_THR 0x0011 /* Mains Voltage Min Threshold */ |
428 | 4 | #define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MAX_THR 0x0012 /* Mains Voltage Max Threshold */ |
429 | 2 | #define ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_DWELL_TP 0x0013 /* Mains Voltage Dwell Trip Point */ |
430 | 8 | #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE 0x0020 /* Battery Voltage */ |
431 | 10 | #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_PERCENTAGE 0x0021 /* Battery Percentage Remaining */ |
432 | 1 | #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_MANUFACTURER 0x0030 /* Battery Manufacturer */ |
433 | 4 | #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_SIZE 0x0031 /* Battery Size */ |
434 | 3 | #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_AH_RATING 0x0032 /* Battery AHr Rating */ |
435 | 1 | #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_QUANTITY 0x0033 /* Battery Quantity */ |
436 | 6 | #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_RATED_VOLTAGE 0x0034 /* Battery Rated Voltage */ |
437 | 3 | #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_ALARM_MASK 0x0035 /* Battery Alarm Mask */ |
438 | 6 | #define ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE_MIN_THR 0x0036 /* Battery Voltage Min Threshold */ |
439 | | |
440 | | /* Server Commands Received - None */ |
441 | | |
442 | | /* Server Commands Generated - None */ |
443 | | |
444 | | /* Mains Alarm Mask bit-mask */ |
445 | 16 | #define ZBEE_ZCL_POWER_CONF_MAINS_ALARM_LOW 0x01 /* Mains voltage too low */ |
446 | 16 | #define ZBEE_ZCL_POWER_CONF_MAINS_ALARM_HIGH 0x02 /* Mains voltage too high */ |
447 | 16 | #define ZBEE_ZCL_POWER_CONF_MAINS_ALARM_RESERVED 0xfc /* Reserved */ |
448 | | |
449 | | /* Battery Size values */ |
450 | | #define ZBEE_ZCL_POWER_CONF_BAT_TYPE_NO_BAT 0x00 /* No battery */ |
451 | | #define ZBEE_ZCL_POWER_CONF_BAT_TYPE_BUILT_IN 0x01 /* Built in */ |
452 | | #define ZBEE_ZCL_POWER_CONF_BAT_TYPE_OTHER 0x02 /* Other */ |
453 | | #define ZBEE_ZCL_POWER_CONF_BAT_TYPE_AA 0x03 /* AA */ |
454 | | #define ZBEE_ZCL_POWER_CONF_BAT_TYPE_AAA 0x04 /* AAA */ |
455 | | #define ZBEE_ZCL_POWER_CONF_BAT_TYPE_C 0x05 /* C */ |
456 | | #define ZBEE_ZCL_POWER_CONF_BAT_TYPE_D 0x06 /* D */ |
457 | | #define ZBEE_ZCL_POWER_CONF_BAT_TYPE_UNKNOWN 0xFF /* Unknown */ |
458 | | |
459 | | /* Battery alarm mask bit-mask */ |
460 | 16 | #define ZBEE_ZCL_POWER_CONF_BATTERY_ALARM_LOW 0x01 /* Battery voltage too low */ |
461 | 16 | #define ZBEE_ZCL_POWER_CONF_BATTERY_ALARM_RESERVED 0xfe /* Reserved */ |
462 | | |
463 | | /*************************/ |
464 | | /* Function Declarations */ |
465 | | /*************************/ |
466 | | |
467 | | void proto_register_zbee_zcl_power_config(void); |
468 | | void proto_reg_handoff_zbee_zcl_power_config(void); |
469 | | |
470 | | /* Private functions prototype */ |
471 | | |
472 | | /*************************/ |
473 | | /* Global Variables */ |
474 | | /*************************/ |
475 | | /* Initialize the protocol and registered fields */ |
476 | | static int proto_zbee_zcl_power_config; |
477 | | static int hf_zbee_zcl_power_config_attr_id; |
478 | | static int hf_zbee_zcl_power_config_batt_type; |
479 | | static int hf_zbee_zcl_power_config_mains_alarm_mask; |
480 | | static int hf_zbee_zcl_power_config_mains_alarm_mask_low; |
481 | | static int hf_zbee_zcl_power_config_mains_alarm_mask_high; |
482 | | static int hf_zbee_zcl_power_config_mains_alarm_mask_reserved; |
483 | | static int hf_zbee_zcl_power_config_batt_alarm_mask; |
484 | | static int hf_zbee_zcl_power_config_batt_alarm_mask_low; |
485 | | static int hf_zbee_zcl_power_config_batt_alarm_mask_reserved; |
486 | | static int hf_zbee_zcl_power_config_mains_voltage; |
487 | | static int hf_zbee_zcl_power_config_mains_frequency; |
488 | | static int hf_zbee_zcl_power_config_mains_voltage_min_thr; |
489 | | static int hf_zbee_zcl_power_config_mains_voltage_max_thr; |
490 | | static int hf_zbee_zcl_power_config_mains_voltage_dwell_tp; |
491 | | static int hf_zbee_zcl_power_config_batt_voltage; |
492 | | static int hf_zbee_zcl_power_config_batt_percentage; |
493 | | static int hf_zbee_zcl_power_config_batt_ah_rating; |
494 | | static int hf_zbee_zcl_power_config_batt_rated_voltage; |
495 | | static int hf_zbee_zcl_power_config_batt_voltage_min_thr; |
496 | | /* Initialize the subtree pointers */ |
497 | | static int ett_zbee_zcl_power_config; |
498 | | static int ett_zbee_zcl_power_config_mains_alarm_mask; |
499 | | static int ett_zbee_zcl_power_config_batt_alarm_mask; |
500 | | |
501 | | /* Attributes */ |
502 | | static const value_string zbee_zcl_power_config_attr_names[] = { |
503 | | { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE, "Mains Voltage" }, |
504 | | { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_FREQUENCY, "Mains Frequency" }, |
505 | | { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_ALARM_MASK, "Mains Alarm Mask" }, |
506 | | { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MIN_THR, "Mains Voltage Min Threshold" }, |
507 | | { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MAX_THR, "Mains Voltage Max Threshold" }, |
508 | | { ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_DWELL_TP, "Mains Voltage Dwell Trip Point" }, |
509 | | { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE, "Battery Voltage" }, |
510 | | { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_PERCENTAGE, "Battery Percentage Remaining" }, |
511 | | { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_MANUFACTURER, "Battery Manufacturer" }, |
512 | | { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_SIZE, "Battery Size" }, |
513 | | { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_AH_RATING, "Battery AHr Rating" }, |
514 | | { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_QUANTITY, "Battery Quantity" }, |
515 | | { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_RATED_VOLTAGE, "Battery Rated Voltage" }, |
516 | | { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_ALARM_MASK, "Battery Alarm Mask" }, |
517 | | { ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE_MIN_THR, "Battery Voltage Minimum Threshold" }, |
518 | | { 0, NULL } |
519 | | }; |
520 | | |
521 | | |
522 | | /* Battery size Names */ |
523 | | static const value_string zbee_zcl_power_config_batt_type_names[] = { |
524 | | { ZBEE_ZCL_POWER_CONF_BAT_TYPE_NO_BAT, "No battery" }, |
525 | | { ZBEE_ZCL_POWER_CONF_BAT_TYPE_BUILT_IN, "Built in" }, |
526 | | { ZBEE_ZCL_POWER_CONF_BAT_TYPE_OTHER, "Other" }, |
527 | | { ZBEE_ZCL_POWER_CONF_BAT_TYPE_AA, "AA" }, |
528 | | { ZBEE_ZCL_POWER_CONF_BAT_TYPE_AAA, "AAA" }, |
529 | | { ZBEE_ZCL_POWER_CONF_BAT_TYPE_C, "C" }, |
530 | | { ZBEE_ZCL_POWER_CONF_BAT_TYPE_D, "D" }, |
531 | | { ZBEE_ZCL_POWER_CONF_BAT_TYPE_UNKNOWN, "Unknown" }, |
532 | | { 0, NULL } |
533 | | }; |
534 | | |
535 | | |
536 | | /*************************/ |
537 | | /* Function Bodies */ |
538 | | /*************************/ |
539 | | |
540 | | /*FUNCTION:------------------------------------------------------ |
541 | | * NAME |
542 | | * dissect_zbee_zcl_power_config |
543 | | * DESCRIPTION |
544 | | * ZigBee ZCL power configuration cluster dissector for wireshark. |
545 | | * PARAMETERS |
546 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
547 | | * packet_info *pinfo - pointer to packet information fields |
548 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
549 | | * RETURNS |
550 | | * none |
551 | | *--------------------------------------------------------------- |
552 | | */ |
553 | | static int |
554 | | dissect_zbee_zcl_power_config(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) |
555 | 16 | { |
556 | 16 | return tvb_captured_length(tvb); |
557 | 16 | } /*dissect_zbee_zcl_power_config*/ |
558 | | |
559 | | /*FUNCTION:------------------------------------------------------ |
560 | | * NAME |
561 | | * decode_power_conf_voltage |
562 | | * DESCRIPTION |
563 | | * this function decodes voltage values |
564 | | * PARAMETERS |
565 | | * unsigned *s - string to display |
566 | | * uint32_t value - value to decode |
567 | | * RETURNS |
568 | | * none |
569 | | *--------------------------------------------------------------- |
570 | | */ |
571 | | static void |
572 | | decode_power_conf_voltage(char *s, uint32_t value) |
573 | 0 | { |
574 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "%u.%u [V]", value/10, value%10); |
575 | 0 | return; |
576 | 0 | } /*decode_power_conf_voltage*/ |
577 | | |
578 | | /*FUNCTION:------------------------------------------------------ |
579 | | * NAME |
580 | | * decode_power_conf_percentage |
581 | | * DESCRIPTION |
582 | | * this function decodes percentage values |
583 | | * PARAMETERS |
584 | | * unsigned *s - string to display |
585 | | * uint32_t value - value to decode |
586 | | * RETURNS |
587 | | * none |
588 | | *--------------------------------------------------------------- |
589 | | */ |
590 | | static void |
591 | | decode_power_conf_percentage(char *s, uint32_t value) |
592 | 0 | { |
593 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "%.1f [%%]", value/2.0); |
594 | 0 | return; |
595 | 0 | } /*decode_power_conf_percentage*/ |
596 | | |
597 | | /*FUNCTION:------------------------------------------------------ |
598 | | * NAME |
599 | | * decode_power_conf_frequency |
600 | | * DESCRIPTION |
601 | | * this function decodes mains frequency values |
602 | | * PARAMETERS |
603 | | * unsigned *s - string to display |
604 | | * uint32_t value - value to decode |
605 | | * RETURNS |
606 | | * none |
607 | | *--------------------------------------------------------------- |
608 | | */ |
609 | | static void |
610 | | decode_power_conf_frequency(char *s, uint32_t value) |
611 | 0 | { |
612 | 0 | if(value == 0x00) |
613 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "Frequency too low to be measured (or DC supply)"); |
614 | 0 | else if(value == 0xfe) |
615 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "Frequency too high to be measured"); |
616 | 0 | else if (value == 0xff) |
617 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "Frequency could not be measured"); |
618 | 0 | else |
619 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "%u [Hz]", value*2); |
620 | 0 | return; |
621 | 0 | } /*decode_power_conf_frequency*/ |
622 | | |
623 | | /*FUNCTION:------------------------------------------------------ |
624 | | * NAME |
625 | | * decode_power_conf_batt_AHr |
626 | | * DESCRIPTION |
627 | | * this function decodes battery capacity values |
628 | | * PARAMETERS |
629 | | * unsigned *s - string to display |
630 | | * uint32_t value - value to decode |
631 | | * RETURNS |
632 | | * none |
633 | | *--------------------------------------------------------------- |
634 | | */ |
635 | | static void |
636 | | decode_power_conf_batt_AHr(char *s, uint32_t value) |
637 | 0 | { |
638 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "%u [mAHr]", value*10); |
639 | 0 | return; |
640 | 0 | } /*decode_power_conf_batt_AHr*/ |
641 | | |
642 | | /*FUNCTION:------------------------------------------------------ |
643 | | * NAME |
644 | | * dissect_zcl_power_config_attr_data |
645 | | * DESCRIPTION |
646 | | * this function is called by ZCL foundation dissector in order to decode |
647 | | * specific cluster attributes data. |
648 | | * PARAMETERS |
649 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
650 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
651 | | * unsigned *offset - pointer to buffer offset |
652 | | * uint16_t attr_id - attribute identifier |
653 | | * unsigned data_type - attribute data type |
654 | | * bool client_attr- ZCL client |
655 | | * RETURNS |
656 | | * none |
657 | | *--------------------------------------------------------------- |
658 | | */ |
659 | | static void |
660 | | dissect_zcl_power_config_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
661 | 1.90k | { |
662 | 1.90k | proto_item *it; |
663 | 1.90k | static int * const mains_alarm_mask[] = { |
664 | 1.90k | &hf_zbee_zcl_power_config_mains_alarm_mask_low, |
665 | 1.90k | &hf_zbee_zcl_power_config_mains_alarm_mask_high, |
666 | 1.90k | &hf_zbee_zcl_power_config_mains_alarm_mask_reserved, |
667 | 1.90k | NULL |
668 | 1.90k | }; |
669 | | |
670 | 1.90k | static int * const batt_alarm_mask[] = { |
671 | 1.90k | &hf_zbee_zcl_power_config_batt_alarm_mask_low, |
672 | 1.90k | &hf_zbee_zcl_power_config_batt_alarm_mask_reserved, |
673 | 1.90k | NULL |
674 | 1.90k | }; |
675 | | |
676 | | /* Dissect attribute data type and data */ |
677 | 1.90k | switch (attr_id) { |
678 | 366 | case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE: |
679 | 366 | proto_tree_add_item(tree, hf_zbee_zcl_power_config_mains_voltage, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
680 | 366 | *offset += 2; |
681 | 366 | break; |
682 | 109 | case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_FREQUENCY: |
683 | 109 | proto_tree_add_item(tree, hf_zbee_zcl_power_config_mains_frequency, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
684 | 109 | *offset += 1; |
685 | 109 | break; |
686 | 6 | case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_ALARM_MASK: |
687 | 6 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_power_config_mains_alarm_mask, ett_zbee_zcl_power_config_mains_alarm_mask, mains_alarm_mask, ENC_LITTLE_ENDIAN); |
688 | 6 | *offset += 1; |
689 | 6 | break; |
690 | 17 | case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MIN_THR: |
691 | 17 | proto_tree_add_item(tree, hf_zbee_zcl_power_config_mains_voltage_min_thr, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
692 | 17 | *offset += 2; |
693 | 17 | break; |
694 | 4 | case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MAX_THR: |
695 | 4 | proto_tree_add_item(tree, hf_zbee_zcl_power_config_mains_voltage_max_thr, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
696 | 4 | *offset += 2; |
697 | 4 | break; |
698 | 2 | case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_DWELL_TP: |
699 | 2 | it = proto_tree_add_item(tree, hf_zbee_zcl_power_config_mains_voltage_dwell_tp, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
700 | 2 | proto_item_append_text(it, " [s]"); |
701 | 2 | *offset += 2; |
702 | 2 | break; |
703 | 4 | case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_SIZE: |
704 | 4 | proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
705 | 4 | *offset += 1; |
706 | 4 | break; |
707 | 8 | case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE: |
708 | 8 | proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_voltage, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
709 | 8 | *offset += 1; |
710 | 8 | break; |
711 | 10 | case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_PERCENTAGE: |
712 | 10 | proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_percentage, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
713 | 10 | *offset += 1; |
714 | 10 | break; |
715 | 3 | case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_AH_RATING: |
716 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_ah_rating, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
717 | 3 | *offset += 2; |
718 | 3 | break; |
719 | 6 | case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_RATED_VOLTAGE: |
720 | 6 | proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_rated_voltage, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
721 | 6 | *offset += 1; |
722 | 6 | break; |
723 | 3 | case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_ALARM_MASK: |
724 | 3 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_power_config_batt_alarm_mask, ett_zbee_zcl_power_config_batt_alarm_mask, batt_alarm_mask, ENC_LITTLE_ENDIAN); |
725 | 3 | *offset += 1; |
726 | 3 | break; |
727 | 6 | case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE_MIN_THR: |
728 | 6 | proto_tree_add_item(tree, hf_zbee_zcl_power_config_batt_voltage_min_thr, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
729 | 6 | *offset += 1; |
730 | 6 | break; |
731 | | |
732 | 1 | case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_MANUFACTURER: |
733 | 1 | case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_QUANTITY: |
734 | 1.35k | default: |
735 | 1.35k | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
736 | 1.35k | break; |
737 | 1.90k | } |
738 | | |
739 | 1.90k | } /*dissect_zcl_power_config_attr_data*/ |
740 | | |
741 | | |
742 | | /*FUNCTION:------------------------------------------------------ |
743 | | * NAME |
744 | | * proto_register_zbee_zcl_power_config |
745 | | * DESCRIPTION |
746 | | * ZigBee ZCL power configuration cluster protocol registration routine. |
747 | | * PARAMETERS |
748 | | * none |
749 | | * RETURNS |
750 | | * void |
751 | | *--------------------------------------------------------------- |
752 | | */ |
753 | | void |
754 | | proto_register_zbee_zcl_power_config(void) |
755 | 16 | { |
756 | | /* Setup list of header fields */ |
757 | 16 | static hf_register_info hf[] = { |
758 | | |
759 | 16 | { &hf_zbee_zcl_power_config_attr_id, |
760 | 16 | { "Attribute", "zbee_zcl_general.power_config.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_power_config_attr_names), |
761 | 16 | 0x00, NULL, HFILL } }, |
762 | | |
763 | 16 | { &hf_zbee_zcl_power_config_batt_type, |
764 | 16 | { "Battery Type", "zbee_zcl_general.power_config.attr.batt_type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_power_config_batt_type_names), |
765 | 16 | 0x00, NULL, HFILL } }, |
766 | | |
767 | | /* start mains Alarm Mask fields */ |
768 | 16 | { &hf_zbee_zcl_power_config_mains_alarm_mask, |
769 | 16 | { "Mains Alarm Mask", "zbee_zcl_general.power_config.attr.mains_alarm_mask", FT_UINT8, BASE_HEX, NULL, |
770 | 16 | 0x0, NULL, HFILL } }, |
771 | | |
772 | 16 | { &hf_zbee_zcl_power_config_mains_alarm_mask_low, |
773 | 16 | { "Mains Voltage too low", "zbee_zcl_general.power_config.attr.mains_alarm_mask.mains_too_low", FT_UINT8, BASE_DEC, NULL, |
774 | 16 | ZBEE_ZCL_POWER_CONF_MAINS_ALARM_LOW, NULL, HFILL } }, |
775 | | |
776 | 16 | { &hf_zbee_zcl_power_config_mains_alarm_mask_high, |
777 | 16 | { "Mains Voltage too high", "zbee_zcl_general.power_config.attr.mains_alarm_mask.mains_too_high", FT_UINT8, BASE_DEC, NULL, |
778 | 16 | ZBEE_ZCL_POWER_CONF_MAINS_ALARM_HIGH, NULL, HFILL } }, |
779 | | |
780 | 16 | { &hf_zbee_zcl_power_config_mains_alarm_mask_reserved, |
781 | 16 | { "Reserved", "zbee_zcl_general.power_config.attr.mains_alarm_mask.reserved", FT_UINT8, BASE_DEC, NULL, |
782 | 16 | ZBEE_ZCL_POWER_CONF_MAINS_ALARM_RESERVED, NULL, HFILL } }, |
783 | | /* end mains Alarm Mask fields */ |
784 | | |
785 | | /* start battery Alarm Mask fields */ |
786 | 16 | { &hf_zbee_zcl_power_config_batt_alarm_mask, |
787 | 16 | { "Battery Alarm Mask", "zbee_zcl_general.power_config.attr.batt_alarm_mask", FT_UINT8, BASE_HEX, NULL, |
788 | 16 | 0x0, NULL, HFILL } }, |
789 | | |
790 | 16 | { &hf_zbee_zcl_power_config_batt_alarm_mask_low, |
791 | 16 | { "Battery Voltage too low", "zbee_zcl_general.power_config.batt_attr.alarm_mask.batt_too_low", FT_UINT8, BASE_DEC, NULL, |
792 | 16 | ZBEE_ZCL_POWER_CONF_BATTERY_ALARM_LOW, NULL, HFILL } }, |
793 | | |
794 | 16 | { &hf_zbee_zcl_power_config_batt_alarm_mask_reserved, |
795 | 16 | { "Reserved", "zbee_zcl_general.power_config.attr.batt_alarm_mask.reserved", FT_UINT8, BASE_DEC, NULL, |
796 | 16 | ZBEE_ZCL_POWER_CONF_BATTERY_ALARM_RESERVED, NULL, HFILL } }, |
797 | | /* end battery Alarm Mask fields */ |
798 | | |
799 | 16 | { &hf_zbee_zcl_power_config_mains_voltage, |
800 | 16 | { "Measured Mains Voltage", "zbee_zcl_general.power_config.attr.mains_voltage", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage), |
801 | 16 | 0x00, NULL, HFILL } }, |
802 | | |
803 | 16 | { &hf_zbee_zcl_power_config_mains_frequency, |
804 | 16 | { "Measured Mains Frequency", "zbee_zcl_general.power_config.attr.mains_frequency", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_conf_frequency), |
805 | 16 | 0x00, NULL, HFILL } }, |
806 | | |
807 | 16 | { &hf_zbee_zcl_power_config_mains_voltage_min_thr, |
808 | 16 | { "Mains Voltage Minimum Threshold", "zbee_zcl_general.power_config.attr.mains_volt_min", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage), |
809 | 16 | 0x00, NULL, HFILL } }, |
810 | | |
811 | 16 | { &hf_zbee_zcl_power_config_mains_voltage_max_thr, |
812 | 16 | { "Mains Voltage Maximum Threshold", "zbee_zcl_general.power_config.attr.mains_volt_max", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage), |
813 | 16 | 0x00, NULL, HFILL } }, |
814 | | |
815 | 16 | { &hf_zbee_zcl_power_config_batt_voltage, |
816 | 16 | { "Measured Battery Voltage", "zbee_zcl_general.power_config.attr.batt_voltage", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage), |
817 | 16 | 0x00, NULL, HFILL } }, |
818 | | |
819 | 16 | { &hf_zbee_zcl_power_config_batt_percentage, |
820 | 16 | { "Remaining Battery Percentage", "zbee_zcl_general.power_config.attr.batt_percentage", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_conf_percentage), |
821 | 16 | 0x00, NULL, HFILL } }, |
822 | | |
823 | 16 | { &hf_zbee_zcl_power_config_batt_ah_rating, |
824 | 16 | { "Battery Capacity", "zbee_zcl_general.power_config.attr.batt_AHr", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_power_conf_batt_AHr), |
825 | 16 | 0x00, NULL, HFILL } }, |
826 | | |
827 | 16 | { &hf_zbee_zcl_power_config_batt_rated_voltage, |
828 | 16 | { "Battery Rated Voltage", "zbee_zcl_general.power_config.attr.batt_rated_voltage", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage), |
829 | 16 | 0x00, NULL, HFILL } }, |
830 | | |
831 | 16 | { &hf_zbee_zcl_power_config_batt_voltage_min_thr, |
832 | 16 | { "Battery Voltage Minimum Threshold", "zbee_zcl_general.power_config.attr.batt_voltage_min_thr", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_conf_voltage), |
833 | 16 | 0x00, NULL, HFILL } }, |
834 | | |
835 | 16 | { &hf_zbee_zcl_power_config_mains_voltage_dwell_tp, |
836 | 16 | { "Mains Voltage Dwell Trip Point", "zbee_zcl_general.power_config.attr.mains_dwell_tp", FT_UINT16, BASE_DEC, NULL, |
837 | 16 | 0x00, NULL, HFILL } }, |
838 | 16 | }; |
839 | | |
840 | | /* ZCL power configuration subtrees */ |
841 | 16 | static int *ett[] = { |
842 | 16 | &ett_zbee_zcl_power_config, |
843 | 16 | &ett_zbee_zcl_power_config_mains_alarm_mask, |
844 | 16 | &ett_zbee_zcl_power_config_batt_alarm_mask |
845 | 16 | }; |
846 | | |
847 | | /* Register the ZigBee ZCL power configuration cluster protocol name and description */ |
848 | 16 | proto_zbee_zcl_power_config = proto_register_protocol("ZigBee ZCL Power Configuration", "ZCL Power Configuration", ZBEE_PROTOABBREV_ZCL_POWER_CONFIG); |
849 | 16 | proto_register_field_array(proto_zbee_zcl_power_config, hf, array_length(hf)); |
850 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
851 | | |
852 | | /* Register the ZigBee ZCL power configuration dissector. */ |
853 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_POWER_CONFIG, dissect_zbee_zcl_power_config, proto_zbee_zcl_power_config); |
854 | 16 | } /*proto_register_zbee_zcl_power_config*/ |
855 | | |
856 | | /*FUNCTION:------------------------------------------------------ |
857 | | * NAME |
858 | | * proto_reg_handoff_zbee_zcl_power_config |
859 | | * DESCRIPTION |
860 | | * Hands off the ZCL power configuration dissector. |
861 | | * PARAMETERS |
862 | | * none |
863 | | * RETURNS |
864 | | * none |
865 | | *--------------------------------------------------------------- |
866 | | */ |
867 | | void |
868 | | proto_reg_handoff_zbee_zcl_power_config(void) |
869 | 16 | { |
870 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_POWER_CONFIG, |
871 | 16 | proto_zbee_zcl_power_config, |
872 | 16 | ett_zbee_zcl_power_config, |
873 | 16 | ZBEE_ZCL_CID_POWER_CONFIG, |
874 | 16 | ZBEE_MFG_CODE_NONE, |
875 | 16 | hf_zbee_zcl_power_config_attr_id, |
876 | 16 | hf_zbee_zcl_power_config_attr_id, |
877 | 16 | -1, -1, |
878 | 16 | dissect_zcl_power_config_attr_data |
879 | 16 | ); |
880 | 16 | } /*proto_reg_handoff_zbee_zcl_power_config*/ |
881 | | |
882 | | |
883 | | /* ########################################################################## */ |
884 | | /* #### (0x0002) DEVICE TEMPERATURE CONFIGURATION CLUSTER ################### */ |
885 | | /* ########################################################################## */ |
886 | | |
887 | | /*************************/ |
888 | | /* Defines */ |
889 | | /*************************/ |
890 | | |
891 | | /*Attributes*/ |
892 | 97 | #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_CURRENT_TEMP 0x0000 /*Current Temperature*/ |
893 | 102 | #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MIN_TEMP_EXP 0x0001 /*Min Temperature Experienced*/ |
894 | 104 | #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MAX_TEMP_EXP 0x0002 /*Max Temperature Experienced*/ |
895 | 108 | #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_OVER_TEMP_TOTAL_DWELL 0x0003 /*Over Temperature Total Dwell*/ |
896 | | |
897 | 22 | #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK 0x0010 /*Device Temperature Alarm Mask*/ |
898 | 108 | #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_THRESHOLD 0x0011 /*Low Temperature Threshold*/ |
899 | 108 | #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_THRESHOLD 0x0012 /*High Temperature Threshold*/ |
900 | 108 | #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_DWELL_TRIP_POINT 0x0013 /*Low Temperature Dwell Trip Point*/ |
901 | 110 | #define ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_DWELL_TRIP_POINT 0x0014 /*High Temperature Dwell Trip Point*/ |
902 | | |
903 | | /*Server commands received - none*/ |
904 | | |
905 | | /*Server commands generated - none*/ |
906 | | |
907 | | /*Device Temperature Alarm Mask Value*/ |
908 | 16 | #define ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_TOO_LOW 0x01 /*Mains Voltage too low*/ |
909 | 16 | #define ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_TOO_HIGH 0x02 /*Mains Voltage too high*/ |
910 | 16 | #define ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_RESERVED 0xfc /*Mains Voltage reserved*/ |
911 | | |
912 | | /*************************/ |
913 | | /* Function Declarations */ |
914 | | /*************************/ |
915 | | |
916 | | void proto_register_zbee_zcl_device_temperature_configuration(void); |
917 | | void proto_reg_handoff_zbee_zcl_device_temperature_configuration(void); |
918 | | |
919 | | /* Private functions prototype */ |
920 | | |
921 | | /*************************/ |
922 | | /* Global Variables */ |
923 | | /*************************/ |
924 | | /* Initialize the protocol and registered fields */ |
925 | | static int proto_zbee_zcl_device_temperature_configuration; |
926 | | |
927 | | static int hf_zbee_zcl_device_temperature_configuration_attr_id; |
928 | | static int hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask; |
929 | | static int hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_low; |
930 | | static int hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_high; |
931 | | static int hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_reserved; |
932 | | |
933 | | /* Initialize the subtree pointers */ |
934 | | static int ett_zbee_zcl_device_temperature_configuration; |
935 | | static int ett_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask; |
936 | | |
937 | | /* Attributes */ |
938 | | static const value_string zbee_zcl_device_temperature_configuration_attr_names[] = { |
939 | | { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_CURRENT_TEMP, "Current Temperature" }, |
940 | | { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MIN_TEMP_EXP, "Min Temperature Experienced" }, |
941 | | { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MAX_TEMP_EXP, "Max Temperature Experienced" }, |
942 | | { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_OVER_TEMP_TOTAL_DWELL, "Over Temperature Total Dwell" }, |
943 | | { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK, "Device Temperature Alarm Mask" }, |
944 | | { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_THRESHOLD, "Low Temperature Threshold" }, |
945 | | { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_THRESHOLD, "High Temperature Threshold" }, |
946 | | { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_DWELL_TRIP_POINT, "Low Temperature Dwell Trip Point" }, |
947 | | { ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_DWELL_TRIP_POINT, "High Temperature Dwell Trip Point" }, |
948 | | { 0, NULL } |
949 | | }; |
950 | | |
951 | | /*************************/ |
952 | | /* Function Bodies */ |
953 | | /*************************/ |
954 | | |
955 | | /*FUNCTION:------------------------------------------------------ |
956 | | * NAME |
957 | | * dissect_zbee_zcl_device_temperature_configuration |
958 | | * DESCRIPTION |
959 | | * ZigBee ZCL Device Temperature Configuration cluster dissector for wireshark. |
960 | | * PARAMETERS |
961 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
962 | | * packet_info *pinfo - pointer to packet information fields |
963 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
964 | | * RETURNS |
965 | | * int - length of parsed data. |
966 | | *--------------------------------------------------------------- |
967 | | */ |
968 | | |
969 | | static int |
970 | | dissect_zbee_zcl_device_temperature_configuration(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) |
971 | 11 | { |
972 | 11 | return tvb_captured_length(tvb); |
973 | 11 | } /*dissect_zbee_zcl_device_temperature_configuration*/ |
974 | | |
975 | | |
976 | | /*FUNCTION:------------------------------------------------------ |
977 | | * NAME |
978 | | * dissect_zcl_device_temperature_configuration_attr_data |
979 | | * DESCRIPTION |
980 | | * this function is called by ZCL foundation dissector in order to decode |
981 | | * specific cluster attributes data. |
982 | | * PARAMETERS |
983 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
984 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
985 | | * unsigned *offset - pointer to buffer offset |
986 | | * uint16_t attr_id - attribute identifier |
987 | | * unsigned data_type - attribute data type |
988 | | * bool client_attr- ZCL client |
989 | | * RETURNS |
990 | | * none |
991 | | *--------------------------------------------------------------- |
992 | | */ |
993 | | static void |
994 | | dissect_zcl_device_temperature_configuration_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
995 | 388 | { |
996 | 388 | static int * const device_temp_alarm_mask[] = { |
997 | 388 | &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_low, |
998 | 388 | &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_high, |
999 | 388 | &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_reserved, |
1000 | 388 | NULL |
1001 | 388 | }; |
1002 | | |
1003 | | /* Dissect attribute data type and data */ |
1004 | 388 | switch (attr_id) { |
1005 | | |
1006 | 22 | case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK: |
1007 | 22 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask, ett_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask, device_temp_alarm_mask, ENC_LITTLE_ENDIAN); |
1008 | 22 | *offset += 1; |
1009 | 22 | break; |
1010 | | |
1011 | 97 | case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_CURRENT_TEMP: |
1012 | 102 | case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MIN_TEMP_EXP: |
1013 | 104 | case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_MAX_TEMP_EXP: |
1014 | 108 | case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_OVER_TEMP_TOTAL_DWELL: |
1015 | 108 | case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_THRESHOLD: |
1016 | 108 | case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_THRESHOLD: |
1017 | 108 | case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_LOW_TEMP_DWELL_TRIP_POINT: |
1018 | 110 | case ZBEE_ZCL_ATTR_ID_DEVICE_TEMPERATURE_CONFIGURATION_HIGH_TEMP_DWELL_TRIP_POINT: |
1019 | 366 | default: |
1020 | 366 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
1021 | 366 | break; |
1022 | 388 | } |
1023 | | |
1024 | 388 | } /*dissect_zcl_device_temperature_configuration_attr_data*/ |
1025 | | |
1026 | | |
1027 | | /*FUNCTION:------------------------------------------------------ |
1028 | | * NAME |
1029 | | * proto_register_zbee_zcl_device_temperature_configuration |
1030 | | * DESCRIPTION |
1031 | | * ZigBee ZCL Device Temperature Configuration cluster protocol registration routine. |
1032 | | * PARAMETERS |
1033 | | * none |
1034 | | * RETURNS |
1035 | | * none |
1036 | | *--------------------------------------------------------------- |
1037 | | */ |
1038 | | void |
1039 | | proto_register_zbee_zcl_device_temperature_configuration(void) |
1040 | 16 | { |
1041 | | /* Setup list of header fields */ |
1042 | 16 | static hf_register_info hf[] = { |
1043 | | |
1044 | 16 | { &hf_zbee_zcl_device_temperature_configuration_attr_id, |
1045 | 16 | { "Attribute", "zbee_zcl_general.device_temperature_configuration.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_device_temperature_configuration_attr_names), |
1046 | 16 | 0x00, NULL, HFILL } }, |
1047 | | |
1048 | | /* start Device Temperature Alarm Mask fields */ |
1049 | 16 | { &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask, |
1050 | 16 | { "Device Temperature Alarm Mask", "zbee_zcl_general.device_temperature_configuration.attr.device_temp_alarm_mask", FT_UINT8, BASE_HEX, NULL, |
1051 | 16 | 0x00, NULL, HFILL } }, |
1052 | | |
1053 | 16 | { &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_low, |
1054 | 16 | { "Device Temperature too low", "zbee_zcl_general.device_temperature_configuration.attr.device_temp_alarm_mask.too_low", FT_UINT8, BASE_DEC, NULL, |
1055 | 16 | ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_TOO_LOW, NULL, HFILL } }, |
1056 | | |
1057 | 16 | { &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_too_high, |
1058 | 16 | { "Device Temperature too high", "zbee_zcl_general.device_temperature_configuration.attr.device_temp_alarm_mask.too_high", FT_UINT8, BASE_DEC, NULL, |
1059 | 16 | ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_TOO_HIGH, NULL, HFILL } }, |
1060 | | |
1061 | 16 | { &hf_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask_reserved, |
1062 | 16 | { "Reserved", "zbee_zcl_general.device_temperature_configuration.attr.device_temp_alarm_mask.reserved", FT_UINT8, BASE_DEC, NULL, |
1063 | 16 | ZBEE_ZCL_DEVICE_TEMPERATURE_CONFIGURATION_DEVICE_TEMP_ALARM_MASK_RESERVED, NULL, HFILL } } |
1064 | | /* end Device Temperature Alarm Mask fields */ |
1065 | 16 | }; |
1066 | | |
1067 | | /* ZCL Device Temperature Configuration subtrees */ |
1068 | 16 | static int *ett[] = { |
1069 | 16 | &ett_zbee_zcl_device_temperature_configuration, |
1070 | 16 | &ett_zbee_zcl_device_temperature_configuration_device_temp_alarm_mask |
1071 | 16 | }; |
1072 | | |
1073 | | /* Register the ZigBee ZCL Device Temperature Configuration cluster protocol name and description */ |
1074 | 16 | proto_zbee_zcl_device_temperature_configuration = proto_register_protocol("ZigBee ZCL Device Temperature Configuration", "ZCL Device Temperature Configuration", ZBEE_PROTOABBREV_ZCL_DEVICE_TEMP_CONFIG); |
1075 | 16 | proto_register_field_array(proto_zbee_zcl_device_temperature_configuration, hf, array_length(hf)); |
1076 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
1077 | | |
1078 | | /* Register the ZigBee ZCL Device Temperature Configuration dissector. */ |
1079 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_DEVICE_TEMP_CONFIG, dissect_zbee_zcl_device_temperature_configuration, proto_zbee_zcl_device_temperature_configuration); |
1080 | 16 | } /*proto_register_zbee_zcl_device_temperature_configuration*/ |
1081 | | |
1082 | | /*FUNCTION:------------------------------------------------------ |
1083 | | * NAME |
1084 | | * proto_reg_handoff_zbee_zcl_device_temperature_configuration |
1085 | | * DESCRIPTION |
1086 | | * Hands off the ZCL Device Temperature Configuration dissector. |
1087 | | * PARAMETERS |
1088 | | * none |
1089 | | * RETURNS |
1090 | | * none |
1091 | | *--------------------------------------------------------------- |
1092 | | */ |
1093 | | void |
1094 | | proto_reg_handoff_zbee_zcl_device_temperature_configuration(void) |
1095 | 16 | { |
1096 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_DEVICE_TEMP_CONFIG, |
1097 | 16 | proto_zbee_zcl_device_temperature_configuration, |
1098 | 16 | ett_zbee_zcl_device_temperature_configuration, |
1099 | 16 | ZBEE_ZCL_CID_DEVICE_TEMP_CONFIG, |
1100 | 16 | ZBEE_MFG_CODE_NONE, |
1101 | 16 | hf_zbee_zcl_device_temperature_configuration_attr_id, |
1102 | 16 | hf_zbee_zcl_device_temperature_configuration_attr_id, |
1103 | 16 | -1, -1, |
1104 | 16 | dissect_zcl_device_temperature_configuration_attr_data |
1105 | 16 | ); |
1106 | 16 | } /*proto_reg_handoff_zbee_zcl_device_temperature_configuration*/ |
1107 | | |
1108 | | |
1109 | | /* ########################################################################## */ |
1110 | | /* #### (0x0003) IDENTIFY CLUSTER ########################################### */ |
1111 | | /* ########################################################################## */ |
1112 | | |
1113 | | /*************************/ |
1114 | | /* Defines */ |
1115 | | /*************************/ |
1116 | | |
1117 | | /* Attributes */ |
1118 | 164 | #define ZBEE_ZCL_ATTR_ID_IDENTIFY_IDENTIFY_TIME 0x0000 /* Identify Time */ |
1119 | | |
1120 | | /* Server Commands Received */ |
1121 | 22 | #define ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY 0x00 /* Identify */ |
1122 | 3 | #define ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY 0x01 /* Identify Query */ |
1123 | 1 | #define ZBEE_ZCL_CMD_ID_IDENTIFY_TRIGGER_EFFECT 0x40 /* Trigger Effect */ |
1124 | | |
1125 | | /* Server Commands Generated */ |
1126 | 4 | #define ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY_RSP 0x00 /* Identify Query Response */ |
1127 | | |
1128 | | |
1129 | | /*************************/ |
1130 | | /* Function Declarations */ |
1131 | | /*************************/ |
1132 | | |
1133 | | void proto_register_zbee_zcl_identify(void); |
1134 | | void proto_reg_handoff_zbee_zcl_identify(void); |
1135 | | |
1136 | | /* Command Dissector Helpers */ |
1137 | | static void dissect_zcl_identify_identify (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
1138 | | static void dissect_zcl_identify_identifyqueryrsp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
1139 | | static void dissect_zcl_identify_triggereffect (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
1140 | | |
1141 | | /* Private functions prototype */ |
1142 | | |
1143 | | /*************************/ |
1144 | | /* Global Variables */ |
1145 | | /*************************/ |
1146 | | /* Initialize the protocol and registered fields */ |
1147 | | static int proto_zbee_zcl_identify; |
1148 | | |
1149 | | static int hf_zbee_zcl_identify_attr_id; |
1150 | | static int hf_zbee_zcl_identify_identify_time; |
1151 | | static int hf_zbee_zcl_identify_identify_timeout; |
1152 | | static int hf_zbee_zcl_identify_effect_id; |
1153 | | static int hf_zbee_zcl_identify_effect_variant; |
1154 | | static int hf_zbee_zcl_identify_srv_rx_cmd_id; |
1155 | | static int hf_zbee_zcl_identify_srv_tx_cmd_id; |
1156 | | |
1157 | | /* Initialize the subtree pointers */ |
1158 | | static int ett_zbee_zcl_identify; |
1159 | | |
1160 | | /* Attributes */ |
1161 | | static const value_string zbee_zcl_identify_attr_names[] = { |
1162 | | { ZBEE_ZCL_ATTR_ID_IDENTIFY_IDENTIFY_TIME, "Identify Time" }, |
1163 | | { 0, NULL } |
1164 | | }; |
1165 | | |
1166 | | /* Server Commands Received */ |
1167 | | static const value_string zbee_zcl_identify_srv_rx_cmd_names[] = { |
1168 | | { ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY, "Identify" }, |
1169 | | { ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY, "Identify Query" }, |
1170 | | { ZBEE_ZCL_CMD_ID_IDENTIFY_TRIGGER_EFFECT, "Trigger Effect" }, |
1171 | | { 0, NULL } |
1172 | | }; |
1173 | | |
1174 | | /* Server Commands Generated */ |
1175 | | static const value_string zbee_zcl_identify_srv_tx_cmd_names[] = { |
1176 | | { ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY_RSP, "Identify Query Response" }, |
1177 | | { 0, NULL } |
1178 | | }; |
1179 | | |
1180 | | /* Trigger Effects */ |
1181 | | static const value_string zbee_zcl_identify_effect_id_names[] = { |
1182 | | { 0x00, "Blink" }, |
1183 | | { 0x01, "Breathe" }, |
1184 | | { 0x02, "Okay" }, |
1185 | | { 0x0b, "Channel change" }, |
1186 | | { 0xfe, "Finish" }, |
1187 | | { 0xff, "Stop" }, |
1188 | | { 0, NULL } |
1189 | | }; |
1190 | | |
1191 | | /*************************/ |
1192 | | /* Function Bodies */ |
1193 | | /*************************/ |
1194 | | |
1195 | | /*FUNCTION:------------------------------------------------------ |
1196 | | * NAME |
1197 | | * dissect_zbee_zcl_identify |
1198 | | * DESCRIPTION |
1199 | | * ZigBee ZCL Identify cluster dissector for wireshark. |
1200 | | * PARAMETERS |
1201 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
1202 | | * packet_info *pinfo - pointer to packet information fields |
1203 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
1204 | | * void *data - pointer to ZCL packet structure. |
1205 | | * RETURNS |
1206 | | * int - length of parsed data. |
1207 | | *--------------------------------------------------------------- |
1208 | | */ |
1209 | | static int |
1210 | | dissect_zbee_zcl_identify(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) |
1211 | 146 | { |
1212 | 146 | proto_tree *payload_tree; |
1213 | 146 | zbee_zcl_packet *zcl; |
1214 | 146 | unsigned offset = 0; |
1215 | 146 | uint8_t cmd_id; |
1216 | 146 | int rem_len; |
1217 | | |
1218 | | /* Reject the packet if data is NULL */ |
1219 | 146 | if (data == NULL) |
1220 | 0 | return 0; |
1221 | 146 | zcl = (zbee_zcl_packet *)data; |
1222 | 146 | cmd_id = zcl->cmd_id; |
1223 | | |
1224 | | /* Create a subtree for the ZCL Command frame, and add the command ID to it. */ |
1225 | 146 | if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { |
1226 | | /* Append the command name to the info column. */ |
1227 | 107 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
1228 | 107 | val_to_str_const(cmd_id, zbee_zcl_identify_srv_rx_cmd_names, "Unknown Command"), |
1229 | 107 | zcl->tran_seqno); |
1230 | | |
1231 | | /* Add the command ID. */ |
1232 | 107 | proto_tree_add_item(tree, hf_zbee_zcl_identify_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
1233 | | |
1234 | | /* Check is this command has a payload, than add the payload tree */ |
1235 | 107 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
1236 | 107 | if (rem_len > 0) { |
1237 | 77 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_identify, NULL, "Payload"); |
1238 | | |
1239 | | /* Call the appropriate command dissector */ |
1240 | 77 | switch (cmd_id) { |
1241 | 22 | case ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY: |
1242 | 22 | dissect_zcl_identify_identify(tvb, payload_tree, &offset); |
1243 | 22 | break; |
1244 | | |
1245 | 3 | case ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY: |
1246 | | /* without payload*/ |
1247 | 3 | break; |
1248 | | |
1249 | 1 | case ZBEE_ZCL_CMD_ID_IDENTIFY_TRIGGER_EFFECT: |
1250 | 1 | dissect_zcl_identify_triggereffect(tvb, payload_tree, &offset); |
1251 | 1 | break; |
1252 | | |
1253 | 51 | default: |
1254 | 51 | break; |
1255 | 77 | } |
1256 | 77 | } |
1257 | 107 | } |
1258 | 39 | else { /* ZBEE_ZCL_FCF_TO_CLIENT */ |
1259 | | /* Append the command name to the info column. */ |
1260 | 39 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
1261 | 39 | val_to_str_const(cmd_id, zbee_zcl_identify_srv_tx_cmd_names, "Unknown Command"), |
1262 | 39 | zcl->tran_seqno); |
1263 | | |
1264 | | /* Add the command ID. */ |
1265 | 39 | proto_tree_add_item(tree, hf_zbee_zcl_identify_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
1266 | | |
1267 | | /* Check is this command has a payload, than add the payload tree */ |
1268 | 39 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
1269 | 39 | if (rem_len > 0) { |
1270 | 37 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_identify, NULL, "Payload"); |
1271 | | |
1272 | | /* Call the appropriate command dissector */ |
1273 | 37 | switch (cmd_id) { |
1274 | 4 | case ZBEE_ZCL_CMD_ID_IDENTIFY_IDENTITY_QUERY_RSP: |
1275 | 4 | dissect_zcl_identify_identifyqueryrsp(tvb, payload_tree, &offset); |
1276 | 4 | break; |
1277 | | |
1278 | 33 | default: |
1279 | 33 | break; |
1280 | 37 | } |
1281 | 37 | } |
1282 | 39 | } |
1283 | | |
1284 | 146 | return tvb_captured_length(tvb); |
1285 | 146 | } /*dissect_zbee_zcl_identify*/ |
1286 | | |
1287 | | |
1288 | | /*FUNCTION:------------------------------------------------------ |
1289 | | * NAME |
1290 | | * dissect_zcl_identify_identify |
1291 | | * DESCRIPTION |
1292 | | * this function decodes the Identify payload. |
1293 | | * PARAMETERS |
1294 | | * tvb - the tv buffer of the current data_type |
1295 | | * tree - the tree to append this item to |
1296 | | * offset - offset of data in tvb |
1297 | | * RETURNS |
1298 | | * none |
1299 | | *--------------------------------------------------------------- |
1300 | | */ |
1301 | | static void |
1302 | | dissect_zcl_identify_identify(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
1303 | 22 | { |
1304 | | /* Retrieve "Identify Time" field */ |
1305 | 22 | proto_tree_add_item(tree, hf_zbee_zcl_identify_identify_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
1306 | 22 | *offset += 2; |
1307 | | |
1308 | 22 | } /*dissect_zcl_identify_identify*/ |
1309 | | |
1310 | | |
1311 | | /*FUNCTION:------------------------------------------------------ |
1312 | | * NAME |
1313 | | * dissect_zcl_identify_identifyqueryrsp |
1314 | | * DESCRIPTION |
1315 | | * this function decodes the IdentifyQueryResponse payload. |
1316 | | * PARAMETERS |
1317 | | * tvb - the tv buffer of the current data_type |
1318 | | * tree - the tree to append this item to |
1319 | | * offset - offset of data in tvb |
1320 | | * RETURNS |
1321 | | * none |
1322 | | *--------------------------------------------------------------- |
1323 | | */ |
1324 | | static void |
1325 | | dissect_zcl_identify_identifyqueryrsp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
1326 | 4 | { |
1327 | | /* Retrieve "Identify Timeout" field */ |
1328 | 4 | proto_tree_add_item(tree, hf_zbee_zcl_identify_identify_timeout, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
1329 | 4 | *offset += 2; |
1330 | | |
1331 | 4 | } /*dissect_zcl_identify_identifyqueryrsp*/ |
1332 | | |
1333 | | /*FUNCTION:------------------------------------------------------ |
1334 | | * NAME |
1335 | | * dissect_zcl_identify_triggereffect |
1336 | | * DESCRIPTION |
1337 | | * this function decodes the Trigger Effect payload. |
1338 | | * PARAMETERS |
1339 | | * tvb - the tv buffer of the current data_type |
1340 | | * tree - the tree to append this item to |
1341 | | * offset - offset of data in tvb |
1342 | | * RETURNS |
1343 | | * none |
1344 | | *--------------------------------------------------------------- |
1345 | | */ |
1346 | | static void |
1347 | | dissect_zcl_identify_triggereffect(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
1348 | 1 | { |
1349 | | /* Retrieve "Trigger Effect Id" field */ |
1350 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_identify_effect_id, tvb, *offset, 1, ENC_NA); |
1351 | 1 | *offset += 1; |
1352 | | |
1353 | | /* Retrieve "Trigger Effect Variant" field */ |
1354 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_identify_effect_variant, tvb, *offset, 1, ENC_NA); |
1355 | 1 | *offset += 1; |
1356 | | |
1357 | 1 | } /*dissect_zcl_identify_triggereffect*/ |
1358 | | |
1359 | | |
1360 | | /*FUNCTION:------------------------------------------------------ |
1361 | | * NAME |
1362 | | * dissect_zcl_identify_attr_data |
1363 | | * DESCRIPTION |
1364 | | * this function is called by ZCL foundation dissector in order to decode |
1365 | | * specific cluster attributes data. |
1366 | | * PARAMETERS |
1367 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
1368 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
1369 | | * unsigned *offset - pointer to buffer offset |
1370 | | * uint16_t attr_id - attribute identifier |
1371 | | * unsigned data_type - attribute data type |
1372 | | * bool client_attr- ZCL client |
1373 | | * RETURNS |
1374 | | * none |
1375 | | *--------------------------------------------------------------- |
1376 | | */ |
1377 | | static void |
1378 | | dissect_zcl_identify_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
1379 | 561 | { |
1380 | | /* Dissect attribute data type and data */ |
1381 | 561 | switch ( attr_id ) { |
1382 | | |
1383 | 164 | case ZBEE_ZCL_ATTR_ID_IDENTIFY_IDENTIFY_TIME: |
1384 | 164 | proto_tree_add_item(tree, hf_zbee_zcl_identify_identify_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
1385 | 164 | *offset += 2; |
1386 | 164 | break; |
1387 | | |
1388 | 397 | default: |
1389 | 397 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
1390 | 397 | break; |
1391 | 561 | } |
1392 | | |
1393 | 561 | } /*dissect_zcl_identify_attr_data*/ |
1394 | | |
1395 | | |
1396 | | /*FUNCTION:------------------------------------------------------ |
1397 | | * NAME |
1398 | | * proto_register_zbee_zcl_identify |
1399 | | * DESCRIPTION |
1400 | | * ZigBee ZCL Identify cluster protocol registration routine. |
1401 | | * PARAMETERS |
1402 | | * none |
1403 | | * RETURNS |
1404 | | * void |
1405 | | *--------------------------------------------------------------- |
1406 | | */ |
1407 | | void |
1408 | | proto_register_zbee_zcl_identify(void) |
1409 | 16 | { |
1410 | | /* Setup list of header fields */ |
1411 | 16 | static hf_register_info hf[] = { |
1412 | | |
1413 | 16 | { &hf_zbee_zcl_identify_attr_id, |
1414 | 16 | { "Attribute", "zbee_zcl_general.identify.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_identify_attr_names), |
1415 | 16 | 0x00, NULL, HFILL } }, |
1416 | | |
1417 | 16 | { &hf_zbee_zcl_identify_identify_time, |
1418 | 16 | { "Identify Time", "zbee_zcl_general.identify.attr.identify_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_seconds), |
1419 | 16 | 0x00, NULL, HFILL } }, |
1420 | | |
1421 | 16 | { &hf_zbee_zcl_identify_identify_timeout, |
1422 | 16 | { "Identify Timeout", "zbee_zcl_general.identify.identify_timeout", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_seconds), |
1423 | 16 | 0x00, NULL, HFILL } }, |
1424 | | |
1425 | 16 | { &hf_zbee_zcl_identify_effect_id, |
1426 | 16 | { "Effect", "zbee_zcl_general.identify.effect_id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_identify_effect_id_names), |
1427 | 16 | 0x00, NULL, HFILL } }, |
1428 | | |
1429 | 16 | { &hf_zbee_zcl_identify_effect_variant, |
1430 | 16 | { "Variant", "zbee_zcl_general.identify.effect_variant", FT_UINT8, BASE_DEC, NULL, |
1431 | 16 | 0x00, NULL, HFILL } }, |
1432 | | |
1433 | 16 | { &hf_zbee_zcl_identify_srv_rx_cmd_id, |
1434 | 16 | { "Command", "zbee_zcl_general.identify.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_identify_srv_rx_cmd_names), |
1435 | 16 | 0x00, NULL, HFILL } }, |
1436 | | |
1437 | 16 | { &hf_zbee_zcl_identify_srv_tx_cmd_id, |
1438 | 16 | { "Command", "zbee_zcl_general.identify.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_identify_srv_tx_cmd_names), |
1439 | 16 | 0x00, NULL, HFILL } } |
1440 | | |
1441 | 16 | }; |
1442 | | |
1443 | | /* ZCL Identify subtrees */ |
1444 | 16 | static int *ett[] = { |
1445 | 16 | &ett_zbee_zcl_identify |
1446 | 16 | }; |
1447 | | |
1448 | | /* Register the ZigBee ZCL Identify cluster protocol name and description */ |
1449 | 16 | proto_zbee_zcl_identify = proto_register_protocol("ZigBee ZCL Identify", "ZCL Identify", ZBEE_PROTOABBREV_ZCL_IDENTIFY); |
1450 | 16 | proto_register_field_array(proto_zbee_zcl_identify, hf, array_length(hf)); |
1451 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
1452 | | |
1453 | | /* Register the ZigBee ZCL Identify dissector. */ |
1454 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_IDENTIFY, dissect_zbee_zcl_identify, proto_zbee_zcl_identify); |
1455 | | |
1456 | 16 | } /*proto_register_zbee_zcl_identify*/ |
1457 | | |
1458 | | |
1459 | | /*FUNCTION:------------------------------------------------------ |
1460 | | * NAME |
1461 | | * proto_reg_handoff_zbee_zcl_identify |
1462 | | * DESCRIPTION |
1463 | | * Hands off the ZCL Identify dissector. |
1464 | | * PARAMETERS |
1465 | | * none |
1466 | | * RETURNS |
1467 | | * none |
1468 | | *--------------------------------------------------------------- |
1469 | | */ |
1470 | | void |
1471 | | proto_reg_handoff_zbee_zcl_identify(void) |
1472 | 16 | { |
1473 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_IDENTIFY, |
1474 | 16 | proto_zbee_zcl_identify, |
1475 | 16 | ett_zbee_zcl_identify, |
1476 | 16 | ZBEE_ZCL_CID_IDENTIFY, |
1477 | 16 | ZBEE_MFG_CODE_NONE, |
1478 | 16 | hf_zbee_zcl_identify_attr_id, |
1479 | 16 | hf_zbee_zcl_identify_attr_id, |
1480 | 16 | hf_zbee_zcl_identify_srv_rx_cmd_id, |
1481 | 16 | hf_zbee_zcl_identify_srv_tx_cmd_id, |
1482 | 16 | dissect_zcl_identify_attr_data |
1483 | 16 | ); |
1484 | 16 | } /*proto_reg_handoff_zbee_zcl_identify*/ |
1485 | | |
1486 | | |
1487 | | /* ########################################################################## */ |
1488 | | /* #### (0x0004) GROUPS CLUSTER ############################################# */ |
1489 | | /* ########################################################################## */ |
1490 | | |
1491 | | /*************************/ |
1492 | | /* Defines */ |
1493 | | /*************************/ |
1494 | | |
1495 | 16 | #define ZBEE_ZCL_CMD_ID_GROUPS_NAME_SUPPORT_MASK 0x80 /*Name support Mask*/ |
1496 | | /* Attributes */ |
1497 | 183 | #define ZBEE_ZCL_ATTR_ID_GROUPS_NAME_SUPPORT 0x0000 /* Groups Name Support*/ |
1498 | | |
1499 | | /* Server Commands Received */ |
1500 | 15 | #define ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP 0x00 /* Add Group */ |
1501 | 2 | #define ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP 0x01 /* View Group */ |
1502 | 19 | #define ZBEE_ZCL_CMD_ID_GROUPS_ADD_GET_GROUP_MEMBERSHIP 0x02 /* Get Group Membership */ |
1503 | 1 | #define ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP 0x03 /* Remove a Group */ |
1504 | 0 | #define ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_ALL_GROUPS 0x04 /* Remove all Groups */ |
1505 | 1 | #define ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_IF_IDENTIFYING 0x05 /* Add Group if Identifying */ |
1506 | | |
1507 | | |
1508 | | /* Server Commands Generated */ |
1509 | 13 | #define ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_RESPONSE 0x00 /* Add Group Response */ |
1510 | 3 | #define ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP_RESPONSE 0x01 /* View Group Response */ |
1511 | 5 | #define ZBEE_ZCL_CMD_ID_GROUPS_GET_GROUP_MEMBERSHIP_RESPONSE 0x02 /* Get Group Membership Response */ |
1512 | 1 | #define ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP_RESPONSE 0x03 /* Remove a Group Response */ |
1513 | | |
1514 | | /*************************/ |
1515 | | /* Function Declarations */ |
1516 | | /*************************/ |
1517 | | |
1518 | | void proto_register_zbee_zcl_groups(void); |
1519 | | void proto_reg_handoff_zbee_zcl_groups(void); |
1520 | | |
1521 | | /* Command Dissector Helpers */ |
1522 | | static void dissect_zcl_groups_add_group_or_if_identifying (tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset); |
1523 | | static void dissect_zcl_groups_view_group (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
1524 | | static void dissect_zcl_groups_get_group_membership (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
1525 | | static void dissect_zcl_groups_remove_group (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
1526 | | static void dissect_zcl_groups_add_remove_group_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
1527 | | static void dissect_zcl_groups_view_group_response (tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset); |
1528 | | static void dissect_zcl_groups_get_group_membership_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
1529 | | |
1530 | | /* Private functions prototype */ |
1531 | | |
1532 | | /*************************/ |
1533 | | /* Global Variables */ |
1534 | | /*************************/ |
1535 | | /* Initialize the protocol and registered fields */ |
1536 | | static int proto_zbee_zcl_groups; |
1537 | | |
1538 | | static int hf_zbee_zcl_groups_attr_id; |
1539 | | static int hf_zbee_zcl_groups_group_name_support; |
1540 | | static int hf_zbee_zcl_groups_group_id; |
1541 | | static int hf_zbee_zcl_groups_group_count; |
1542 | | static int hf_zbee_zcl_groups_group_capacity; |
1543 | | static int hf_zbee_zcl_groups_status; |
1544 | | static int hf_zbee_zcl_groups_attr_str_len; |
1545 | | static int hf_zbee_zcl_groups_attr_str; |
1546 | | static int hf_zbee_zcl_groups_srv_rx_cmd_id; |
1547 | | static int hf_zbee_zcl_groups_srv_tx_cmd_id; |
1548 | | static int hf_zbee_zcl_groups_group_list; |
1549 | | |
1550 | | /* Initialize the subtree pointers */ |
1551 | | static int ett_zbee_zcl_groups; |
1552 | | static int ett_zbee_zcl_groups_grp_ctrl; |
1553 | | |
1554 | | /* Attributes */ |
1555 | | static const value_string zbee_zcl_groups_attr_names[] = { |
1556 | | { ZBEE_ZCL_ATTR_ID_GROUPS_NAME_SUPPORT, "Groups Name Support" }, |
1557 | | { 0, NULL } |
1558 | | }; |
1559 | | |
1560 | | /* Server Commands Received */ |
1561 | | static const value_string zbee_zcl_groups_srv_rx_cmd_names[] = { |
1562 | | { ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP, "Add Group" }, |
1563 | | { ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP, "View Group" }, |
1564 | | { ZBEE_ZCL_CMD_ID_GROUPS_ADD_GET_GROUP_MEMBERSHIP, "Get Group Membership" }, |
1565 | | { ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP, "Remove a Group" }, |
1566 | | { ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_ALL_GROUPS, "Remove all Groups" }, |
1567 | | { ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_IF_IDENTIFYING, "Add Group if Identifying" }, |
1568 | | { 0, NULL } |
1569 | | }; |
1570 | | |
1571 | | /* Server Commands Generated */ |
1572 | | static const value_string zbee_zcl_groups_srv_tx_cmd_names[] = { |
1573 | | { ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_RESPONSE, "Add Group Response" }, |
1574 | | { ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP_RESPONSE, "View Group Response" }, |
1575 | | { ZBEE_ZCL_CMD_ID_GROUPS_GET_GROUP_MEMBERSHIP_RESPONSE, "Get Group Membership Response" }, |
1576 | | { ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP_RESPONSE, "Remove a Group Response" }, |
1577 | | { 0, NULL } |
1578 | | }; |
1579 | | |
1580 | | |
1581 | | /*************************/ |
1582 | | /* Function Bodies */ |
1583 | | /*************************/ |
1584 | | |
1585 | | /*FUNCTION:------------------------------------------------------ |
1586 | | * NAME |
1587 | | * dissect_zbee_zcl_groups |
1588 | | * DESCRIPTION |
1589 | | * ZigBee ZCL Groups cluster dissector for wireshark. |
1590 | | * PARAMETERS |
1591 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
1592 | | * packet_info *pinfo - pointer to packet information fields |
1593 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
1594 | | * RETURNS |
1595 | | * none |
1596 | | *--------------------------------------------------------------- |
1597 | | */ |
1598 | | static int |
1599 | | dissect_zbee_zcl_groups(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) |
1600 | 137 | { |
1601 | 137 | proto_tree *payload_tree; |
1602 | 137 | zbee_zcl_packet *zcl; |
1603 | 137 | unsigned offset = 0; |
1604 | 137 | uint8_t cmd_id; |
1605 | 137 | int rem_len; |
1606 | | |
1607 | | /* Reject the packet if data is NULL */ |
1608 | 137 | if (data == NULL) |
1609 | 0 | return 0; |
1610 | 137 | zcl = (zbee_zcl_packet *)data; |
1611 | 137 | cmd_id = zcl->cmd_id; |
1612 | | |
1613 | | /* Create a subtree for the ZCL Command frame, and add the command ID to it. */ |
1614 | 137 | if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { |
1615 | | /* Append the command name to the info column. */ |
1616 | 91 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
1617 | 91 | val_to_str_const(cmd_id, zbee_zcl_groups_srv_rx_cmd_names, "Unknown Command"), |
1618 | 91 | zcl->tran_seqno); |
1619 | | |
1620 | | /* Add the command ID. */ |
1621 | 91 | proto_tree_add_item(tree, hf_zbee_zcl_groups_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
1622 | | |
1623 | | /* Check if this command has a payload, then add the payload tree */ |
1624 | 91 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
1625 | 91 | if (rem_len > 0) { |
1626 | 71 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_groups, NULL, "Payload"); |
1627 | | |
1628 | | /* Call the appropriate command dissector */ |
1629 | 71 | switch (cmd_id) { |
1630 | 15 | case ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP: |
1631 | 15 | dissect_zcl_groups_add_group_or_if_identifying(tvb, pinfo, payload_tree, &offset); |
1632 | 15 | break; |
1633 | | |
1634 | 2 | case ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP: |
1635 | 2 | dissect_zcl_groups_view_group(tvb, payload_tree, &offset); |
1636 | 2 | break; |
1637 | | |
1638 | 19 | case ZBEE_ZCL_CMD_ID_GROUPS_ADD_GET_GROUP_MEMBERSHIP: |
1639 | 19 | dissect_zcl_groups_get_group_membership(tvb, payload_tree, &offset); |
1640 | 19 | break; |
1641 | | |
1642 | 1 | case ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP: |
1643 | 1 | dissect_zcl_groups_remove_group(tvb, payload_tree, &offset); |
1644 | 1 | break; |
1645 | | |
1646 | 0 | case ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_ALL_GROUPS: |
1647 | | /* without payload*/ |
1648 | 0 | break; |
1649 | | |
1650 | 1 | case ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_IF_IDENTIFYING: |
1651 | 1 | dissect_zcl_groups_add_group_or_if_identifying(tvb, pinfo, payload_tree, &offset); |
1652 | 1 | break; |
1653 | | |
1654 | 33 | default: |
1655 | 33 | break; |
1656 | 71 | } |
1657 | 71 | } |
1658 | 91 | } |
1659 | 46 | else { /* ZBEE_ZCL_FCF_TO_CLIENT */ |
1660 | | /* Append the command name to the info column. */ |
1661 | 46 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
1662 | 46 | val_to_str_const(cmd_id, zbee_zcl_groups_srv_tx_cmd_names, "Unknown Command"), |
1663 | 46 | zcl->tran_seqno); |
1664 | | |
1665 | | /* Add the command ID. */ |
1666 | 46 | proto_tree_add_item(tree, hf_zbee_zcl_groups_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
1667 | | |
1668 | | /* Check if this command has a payload, then add the payload tree */ |
1669 | 46 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
1670 | 46 | if (rem_len > 0) { |
1671 | 45 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_groups, NULL, "Payload"); |
1672 | | |
1673 | | /* Call the appropriate command dissector */ |
1674 | 45 | switch (cmd_id) { |
1675 | 13 | case ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_RESPONSE: |
1676 | 13 | dissect_zcl_groups_add_remove_group_response(tvb, payload_tree, &offset); |
1677 | 13 | break; |
1678 | | |
1679 | 3 | case ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP_RESPONSE: |
1680 | 3 | dissect_zcl_groups_view_group_response(tvb, pinfo, payload_tree, &offset); |
1681 | 3 | break; |
1682 | | |
1683 | 5 | case ZBEE_ZCL_CMD_ID_GROUPS_GET_GROUP_MEMBERSHIP_RESPONSE: |
1684 | 5 | dissect_zcl_groups_get_group_membership_response(tvb, payload_tree, &offset); |
1685 | 5 | break; |
1686 | | |
1687 | 1 | case ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP_RESPONSE: |
1688 | 1 | dissect_zcl_groups_add_remove_group_response(tvb, payload_tree, &offset); |
1689 | 1 | break; |
1690 | | |
1691 | 23 | default: |
1692 | 23 | break; |
1693 | 45 | } |
1694 | 45 | } |
1695 | 46 | } |
1696 | | |
1697 | 121 | return tvb_captured_length(tvb); |
1698 | 137 | } /*dissect_zbee_zcl_groups*/ |
1699 | | |
1700 | | |
1701 | | /*FUNCTION:------------------------------------------------------ |
1702 | | * NAME |
1703 | | * dissect_zcl_groups_add_group_or_if_identifying |
1704 | | * DESCRIPTION |
1705 | | * this function decodes the Add Group or Add Group If |
1706 | | * Identifying payload. |
1707 | | * PARAMETERS |
1708 | | * tvb - the tv buffer of the current data_type |
1709 | | * tree - the tree to append this item to |
1710 | | * offset - offset of data in tvb |
1711 | | * RETURNS |
1712 | | * none |
1713 | | *--------------------------------------------------------------- |
1714 | | */ |
1715 | | static void |
1716 | | dissect_zcl_groups_add_group_or_if_identifying(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset) |
1717 | 16 | { |
1718 | 16 | unsigned attr_uint; |
1719 | 16 | const char *attr_string; |
1720 | | |
1721 | | /* Retrieve "Group ID" field */ |
1722 | 16 | proto_tree_add_item(tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
1723 | 16 | *offset += 2; |
1724 | | |
1725 | | /* Retrieve "Group Name" field */ |
1726 | 16 | attr_uint = tvb_get_uint8(tvb, *offset); /* string length */ |
1727 | 16 | if (attr_uint == 0xff) attr_uint = 0; |
1728 | | |
1729 | 16 | proto_tree_add_uint(tree, hf_zbee_zcl_groups_attr_str_len, tvb, *offset, 1, attr_uint); |
1730 | | |
1731 | 16 | *offset += 1; |
1732 | | |
1733 | 16 | proto_tree_add_item_ret_string(tree, hf_zbee_zcl_groups_attr_str, tvb, *offset, attr_uint, ENC_ASCII, pinfo->pool, (const uint8_t**)&attr_string); |
1734 | 16 | proto_item_append_text(tree, ", String: %s", attr_string); |
1735 | | |
1736 | 16 | *offset += attr_uint; |
1737 | | |
1738 | 16 | } /*dissect_zcl_groups_add_group*/ |
1739 | | |
1740 | | |
1741 | | /*FUNCTION:------------------------------------------------------ |
1742 | | * NAME |
1743 | | * dissect_zcl_groups_view_group |
1744 | | * DESCRIPTION |
1745 | | * this function decodes the View Group payload. |
1746 | | * PARAMETERS |
1747 | | * tvb - the tv buffer of the current data_type |
1748 | | * tree - the tree to append this item to |
1749 | | * offset - offset of data in tvb |
1750 | | * RETURNS |
1751 | | * none |
1752 | | *--------------------------------------------------------------- |
1753 | | */ |
1754 | | static void |
1755 | | dissect_zcl_groups_view_group(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
1756 | 2 | { |
1757 | | /* Retrieve "Groups Timeout" field */ |
1758 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
1759 | 2 | *offset += 2; |
1760 | | |
1761 | 2 | } /*dissect_zcl_groups_view_group*/ |
1762 | | |
1763 | | |
1764 | | /*FUNCTION:------------------------------------------------------ |
1765 | | * NAME |
1766 | | * dissect_zcl_groups_get_group_membership |
1767 | | * DESCRIPTION |
1768 | | * this function decodes the Get Group Membership payload. |
1769 | | * PARAMETERS |
1770 | | * tvb - the tv buffer of the current data_type |
1771 | | * tree - the tree to append this item to |
1772 | | * offset - offset of data in tvb |
1773 | | * RETURNS |
1774 | | * none |
1775 | | *--------------------------------------------------------------- |
1776 | | */ |
1777 | | static void |
1778 | | dissect_zcl_groups_get_group_membership(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
1779 | 19 | { |
1780 | 19 | proto_item *grp_list; |
1781 | 19 | proto_tree *grp_list_tree; |
1782 | 19 | uint8_t count, i; |
1783 | | /* Retrieve "Group Count" field */ |
1784 | 19 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_groups_group_count, tvb, *offset, 1, ENC_NA, &count); |
1785 | 19 | *offset += 1; |
1786 | | |
1787 | 19 | if(count > 0) |
1788 | 17 | { |
1789 | 17 | grp_list = proto_tree_add_item(tree, hf_zbee_zcl_groups_group_list, tvb, *offset, 2*count, ENC_NA); |
1790 | 17 | grp_list_tree = proto_item_add_subtree(grp_list, ett_zbee_zcl_groups_grp_ctrl); |
1791 | | /* Retrieve "Group List" members */ |
1792 | 107 | for( i = 0; i < count; i++) |
1793 | 90 | { |
1794 | 90 | proto_tree_add_item(grp_list_tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
1795 | 90 | *offset += 2; |
1796 | 90 | } |
1797 | 17 | } |
1798 | | |
1799 | 19 | } /*dissect_zcl_groups_get_group_membership*/ |
1800 | | |
1801 | | |
1802 | | /*FUNCTION:------------------------------------------------------ |
1803 | | * NAME |
1804 | | * dissect_zcl_groups_remove_group |
1805 | | * DESCRIPTION |
1806 | | * this function decodes the Remove Group payload. |
1807 | | * PARAMETERS |
1808 | | * tvb - the tv buffer of the current data_type |
1809 | | * tree - the tree to append this item to |
1810 | | * offset - offset of data in tvb |
1811 | | * RETURNS |
1812 | | * none |
1813 | | *--------------------------------------------------------------- |
1814 | | */ |
1815 | | static void |
1816 | | dissect_zcl_groups_remove_group(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
1817 | 1 | { |
1818 | | /* Retrieve "Groups ID" field */ |
1819 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
1820 | 1 | *offset += 2; |
1821 | | |
1822 | 1 | } /*dissect_zcl_groups_remove_group*/ |
1823 | | |
1824 | | |
1825 | | /*FUNCTION:------------------------------------------------------ |
1826 | | * NAME |
1827 | | * dissect_zcl_groups_add_group_response |
1828 | | * DESCRIPTION |
1829 | | * this function decodes the Add Group Response payload. |
1830 | | * PARAMETERS |
1831 | | * tvb - the tv buffer of the current data_type |
1832 | | * tree - the tree to append this item to |
1833 | | * offset - offset of data in tvb |
1834 | | * RETURNS |
1835 | | * none |
1836 | | *--------------------------------------------------------------- |
1837 | | */ |
1838 | | static void |
1839 | | dissect_zcl_groups_add_remove_group_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
1840 | 14 | { |
1841 | | /* Retrieve "Status" field */ |
1842 | 14 | proto_tree_add_item(tree, hf_zbee_zcl_groups_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
1843 | 14 | *offset += 1; |
1844 | | |
1845 | | /* Retrieve "Groups ID" field */ |
1846 | 14 | proto_tree_add_item(tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
1847 | 14 | *offset += 2; |
1848 | | |
1849 | 14 | } /*dissect_zcl_groups_remove_group*/ |
1850 | | |
1851 | | |
1852 | | /*FUNCTION:------------------------------------------------------ |
1853 | | * NAME |
1854 | | * dissect_zcl_groups_view_group_response |
1855 | | * DESCRIPTION |
1856 | | * this function decodes the View Group Response payload |
1857 | | * PARAMETERS |
1858 | | * tvb - the tv buffer of the current data_type |
1859 | | * tree - the tree to append this item to |
1860 | | * offset - offset of data in tvb |
1861 | | * RETURNS |
1862 | | * none |
1863 | | *--------------------------------------------------------------- |
1864 | | */ |
1865 | | static void |
1866 | | dissect_zcl_groups_view_group_response(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset) |
1867 | 3 | { |
1868 | 3 | unsigned attr_uint; |
1869 | 3 | const char *attr_string; |
1870 | | /* Retrieve "Status" field */ |
1871 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_groups_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
1872 | 3 | *offset += 1; |
1873 | | |
1874 | | /* Retrieve "Group ID" field */ |
1875 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
1876 | 3 | *offset += 2; |
1877 | | |
1878 | | /* Retrieve "Group Name" field */ |
1879 | 3 | attr_uint = tvb_get_uint8(tvb, *offset); /* string length */ |
1880 | 3 | if (attr_uint == 0xff) attr_uint = 0; |
1881 | | |
1882 | 3 | proto_tree_add_uint(tree, hf_zbee_zcl_groups_attr_str_len, tvb, *offset, 1, attr_uint); |
1883 | | |
1884 | 3 | *offset += 1; |
1885 | | |
1886 | 3 | proto_tree_add_item_ret_string(tree, hf_zbee_zcl_groups_attr_str, tvb, *offset, attr_uint, ENC_ASCII, pinfo->pool, (const uint8_t**)&attr_string); |
1887 | 3 | proto_item_append_text(tree, ", String: %s", attr_string); |
1888 | | |
1889 | 3 | *offset += attr_uint; |
1890 | 3 | } /*dissect_zcl_groups_add_group*/ |
1891 | | |
1892 | | |
1893 | | /*FUNCTION:------------------------------------------------------ |
1894 | | * NAME |
1895 | | * dissect_zcl_groups_get_group_membership_response |
1896 | | * DESCRIPTION |
1897 | | * this function decodes the Get Group Membership Response payload. |
1898 | | * PARAMETERS |
1899 | | * tvb - the tv buffer of the current data_type |
1900 | | * tree - the tree to append this item to |
1901 | | * offset - offset of data in tvb |
1902 | | * RETURNS |
1903 | | * none |
1904 | | *--------------------------------------------------------------- |
1905 | | */ |
1906 | | static void |
1907 | | dissect_zcl_groups_get_group_membership_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
1908 | 5 | { |
1909 | 5 | proto_item *grp_list; |
1910 | 5 | proto_tree *grp_list_tree; |
1911 | 5 | uint8_t count, i; |
1912 | | |
1913 | | /* Retrieve "Capacity" field */ |
1914 | 5 | proto_tree_add_item(tree, hf_zbee_zcl_groups_group_capacity, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
1915 | 5 | *offset += 1; |
1916 | | |
1917 | | /* Retrieve "Group Count" field */ |
1918 | 5 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_groups_group_count, tvb, *offset, 1, ENC_NA, &count); |
1919 | 5 | *offset += 1; |
1920 | 5 | if(count > 0) |
1921 | 5 | { |
1922 | 5 | grp_list = proto_tree_add_item(tree, hf_zbee_zcl_groups_group_list, tvb, *offset, 2*count, ENC_NA); |
1923 | 5 | grp_list_tree = proto_item_add_subtree(grp_list, ett_zbee_zcl_groups_grp_ctrl); |
1924 | | /* Retrieve "Group List" members */ |
1925 | 83 | for( i = 0; i < count; i++) |
1926 | 78 | { |
1927 | 78 | proto_tree_add_item(grp_list_tree, hf_zbee_zcl_groups_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
1928 | 78 | *offset += 2; |
1929 | 78 | } |
1930 | 5 | } |
1931 | | |
1932 | 5 | } /*dissect_zcl_groups_get_group_membership*/ |
1933 | | |
1934 | | |
1935 | | /*FUNCTION:------------------------------------------------------ |
1936 | | * NAME |
1937 | | * dissect_zcl_groups_attr_data |
1938 | | * DESCRIPTION |
1939 | | * this function is called by ZCL foundation dissector in order to decode |
1940 | | * specific cluster attributes data. |
1941 | | * PARAMETERS |
1942 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
1943 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
1944 | | * unsigned *offset - pointer to buffer offset |
1945 | | * uint16_t attr_id - attribute identifier |
1946 | | * unsigned data_type - attribute data type |
1947 | | * bool client_attr- ZCL client |
1948 | | * RETURNS |
1949 | | * none |
1950 | | *--------------------------------------------------------------- |
1951 | | */ |
1952 | | static void |
1953 | | dissect_zcl_groups_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
1954 | 444 | { |
1955 | | /* Dissect attribute data type and data */ |
1956 | 444 | switch ( attr_id ) { |
1957 | | |
1958 | 183 | case ZBEE_ZCL_ATTR_ID_GROUPS_NAME_SUPPORT: |
1959 | 183 | proto_tree_add_item(tree, hf_zbee_zcl_groups_group_name_support, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
1960 | 183 | *offset += 1; |
1961 | 183 | break; |
1962 | | |
1963 | 261 | default: |
1964 | 261 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
1965 | 261 | break; |
1966 | 444 | } |
1967 | | |
1968 | 444 | } /*dissect_zcl_groups_attr_data*/ |
1969 | | |
1970 | | |
1971 | | /*FUNCTION:------------------------------------------------------ |
1972 | | * NAME |
1973 | | * proto_register_zbee_zcl_groups |
1974 | | * DESCRIPTION |
1975 | | * ZigBee ZCL Groups cluster protocol registration routine. |
1976 | | * PARAMETERS |
1977 | | * none |
1978 | | * RETURNS |
1979 | | * void |
1980 | | *--------------------------------------------------------------- |
1981 | | */ |
1982 | | void |
1983 | | proto_register_zbee_zcl_groups(void) |
1984 | 16 | { |
1985 | | /* Setup list of header fields */ |
1986 | 16 | static hf_register_info hf[] = { |
1987 | | |
1988 | 16 | { &hf_zbee_zcl_groups_attr_id, |
1989 | 16 | { "Attribute", "zbee_zcl_general.groups.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_groups_attr_names), |
1990 | 16 | 0x00, NULL, HFILL } }, |
1991 | | |
1992 | 16 | { &hf_zbee_zcl_groups_group_name_support, |
1993 | 16 | { "Group Name Support", "zbee_zcl_general.groups.attr.group_name_support", FT_BOOLEAN, 8, NULL, |
1994 | 16 | ZBEE_ZCL_CMD_ID_GROUPS_NAME_SUPPORT_MASK, NULL, HFILL } }, |
1995 | | |
1996 | 16 | { &hf_zbee_zcl_groups_group_id, |
1997 | 16 | { "Group ID", "zbee_zcl_general.groups.group_id", FT_UINT16, BASE_HEX, NULL, |
1998 | 16 | 0x00, NULL, HFILL } }, |
1999 | | |
2000 | 16 | { &hf_zbee_zcl_groups_group_list, |
2001 | 16 | {"Group List", "zbee_zcl_general.groups.group_list",FT_NONE,BASE_NONE, NULL, |
2002 | 16 | 0x00, NULL, HFILL } }, |
2003 | | |
2004 | 16 | { &hf_zbee_zcl_groups_group_count, |
2005 | 16 | { "Group Count", "zbee_zcl_general.groups.group_count", FT_UINT8, BASE_DEC, NULL, |
2006 | 16 | 0x00, NULL, HFILL } }, |
2007 | | |
2008 | 16 | { &hf_zbee_zcl_groups_group_capacity, |
2009 | 16 | { "Group Capacity", "zbee_zcl_general.groups.group_capacity", FT_UINT8, BASE_DEC, NULL, |
2010 | 16 | 0x00, NULL, HFILL } }, |
2011 | | |
2012 | 16 | { &hf_zbee_zcl_groups_status, |
2013 | 16 | { "Group Status", "zbee_zcl_general.groups.group_status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names), |
2014 | 16 | 0x00, NULL, HFILL } }, |
2015 | | |
2016 | 16 | { &hf_zbee_zcl_groups_attr_str_len, |
2017 | 16 | { "Length", "zbee_zcl_general.groups.attr_str_len", FT_UINT8, BASE_DEC, NULL, |
2018 | 16 | 0x00, NULL, HFILL }}, |
2019 | | |
2020 | 16 | { &hf_zbee_zcl_groups_attr_str, |
2021 | 16 | { "String", "zbee_zcl_general.groups_attr_str", FT_STRING, BASE_NONE, NULL, |
2022 | 16 | 0x00, NULL, HFILL }}, |
2023 | | |
2024 | 16 | { &hf_zbee_zcl_groups_srv_rx_cmd_id, |
2025 | 16 | { "Command", "zbee_zcl_general.groups.cmd_srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_groups_srv_rx_cmd_names), |
2026 | 16 | 0x00, NULL, HFILL } }, |
2027 | | |
2028 | 16 | { &hf_zbee_zcl_groups_srv_tx_cmd_id, |
2029 | 16 | { "Command", "zbee_zcl_general.groups.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_groups_srv_tx_cmd_names), |
2030 | 16 | 0x00, NULL, HFILL } } |
2031 | | |
2032 | 16 | }; |
2033 | | |
2034 | | /* ZCL Groups subtrees */ |
2035 | 16 | static int *ett[] = { |
2036 | 16 | &ett_zbee_zcl_groups, |
2037 | 16 | &ett_zbee_zcl_groups_grp_ctrl |
2038 | 16 | }; |
2039 | | |
2040 | | /* Register the ZigBee ZCL Groups cluster protocol name and description */ |
2041 | 16 | proto_zbee_zcl_groups = proto_register_protocol("ZigBee ZCL Groups", "ZCL Groups", ZBEE_PROTOABBREV_ZCL_GROUPS); |
2042 | 16 | proto_register_field_array(proto_zbee_zcl_groups, hf, array_length(hf)); |
2043 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
2044 | | |
2045 | | /* Register the ZigBee ZCL Groups dissector. */ |
2046 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_GROUPS, dissect_zbee_zcl_groups, proto_zbee_zcl_groups); |
2047 | | |
2048 | 16 | } /*proto_register_zbee_zcl_groups*/ |
2049 | | |
2050 | | |
2051 | | /*FUNCTION:------------------------------------------------------ |
2052 | | * NAME |
2053 | | * proto_reg_handoff_zbee_zcl_groups |
2054 | | * DESCRIPTION |
2055 | | * Hands off the ZCL Groups dissector. |
2056 | | * PARAMETERS |
2057 | | * none |
2058 | | * RETURNS |
2059 | | * none |
2060 | | *--------------------------------------------------------------- |
2061 | | */ |
2062 | | void |
2063 | | proto_reg_handoff_zbee_zcl_groups(void) |
2064 | 16 | { |
2065 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_GROUPS, |
2066 | 16 | proto_zbee_zcl_groups, |
2067 | 16 | ett_zbee_zcl_groups, |
2068 | 16 | ZBEE_ZCL_CID_GROUPS, |
2069 | 16 | ZBEE_MFG_CODE_NONE, |
2070 | 16 | hf_zbee_zcl_groups_attr_id, |
2071 | 16 | hf_zbee_zcl_groups_attr_id, |
2072 | 16 | hf_zbee_zcl_groups_srv_rx_cmd_id, |
2073 | 16 | hf_zbee_zcl_groups_srv_tx_cmd_id, |
2074 | 16 | dissect_zcl_groups_attr_data |
2075 | 16 | ); |
2076 | 16 | } /*proto_reg_handoff_zbee_zcl_groups*/ |
2077 | | |
2078 | | |
2079 | | /* ########################################################################## */ |
2080 | | /* #### (0x0005) SCENES CLUSTER ############################################# */ |
2081 | | /* ########################################################################## */ |
2082 | | |
2083 | | /*************************/ |
2084 | | /* Defines */ |
2085 | | /*************************/ |
2086 | | |
2087 | 16 | #define ZBEE_ZCL_ATTR_SCENES_SCENE_VALID_MASK 0x01 /* bit 0 */ |
2088 | | |
2089 | | /* Attributes */ |
2090 | 59 | #define ZBEE_ZCL_ATTR_ID_SCENES_SCENE_COUNT 0x0000 /* Scene Count */ |
2091 | 63 | #define ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_SCENE 0x0001 /* Current Scene */ |
2092 | 63 | #define ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_GROUP 0x0002 /* Current Group */ |
2093 | 5 | #define ZBEE_ZCL_ATTR_ID_SCENES_SCENE_VALID 0x0003 /* Scene Valid */ |
2094 | 5 | #define ZBEE_ZCL_ATTR_ID_SCENES_NAME_SUPPORT 0x0004 /* Name Support */ |
2095 | 63 | #define ZBEE_ZCL_ATTR_ID_SCENES_LAST_CONFIGURED_BY 0x0005 /* Last Configured By */ |
2096 | | |
2097 | | /* Scene Name Support */ |
2098 | | #define ZBEE_ZCL_SCENES_NAME_NOT_SUPPORTED 0x00 /* Scene Names Not Supported */ |
2099 | | #define ZBEE_ZCL_SCENES_NAME_SUPPORTED 0x01 /* Scene Names Supported */ |
2100 | | |
2101 | | /* Copy Mode */ |
2102 | | #define ZBEE_ZCL_SCENES_COPY_SPECIFIED 0x00 /* Copy Specified Scenes */ |
2103 | | #define ZBEE_ZCL_SCENES_COPY_ALL 0x01 /* Copy All Scenes */ |
2104 | | |
2105 | | /* Server Commands Received */ |
2106 | 53 | #define ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE 0x00 /* Add Scene */ |
2107 | 17 | #define ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE 0x01 /* View Scene */ |
2108 | 38 | #define ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE 0x02 /* Remove a Scene */ |
2109 | 19 | #define ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES 0x03 /* Remove all Scenes */ |
2110 | 41 | #define ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE 0x04 /* Store Scene */ |
2111 | 42 | #define ZBEE_ZCL_CMD_ID_SCENES_RECALL_SCENE 0x05 /* Recall Scene */ |
2112 | 27 | #define ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP 0x06 /* Get Scene Membership */ |
2113 | 4 | #define ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE 0x40 /* Enhanced Add Scene */ |
2114 | 43 | #define ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE 0x41 /* Enhanced View Scene */ |
2115 | 1 | #define ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE 0x42 /* Copy Scene */ |
2116 | 16 | #define ZBEE_ZCL_CMD_ID_SCENES_NAME_SUPPORT_MASK 0x80 |
2117 | | |
2118 | | /* Server Commands Generated */ |
2119 | 11 | #define ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE_RESPONSE 0x00 /* Add Scene Response */ |
2120 | 3 | #define ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE_RESPONSE 0x01 /* View Scene Response */ |
2121 | 16 | #define ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE_RESPONSE 0x02 /* Remove a Scene Response */ |
2122 | 1 | #define ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES_RESPONSE 0x03 /* Remove all Scenes Response */ |
2123 | 17 | #define ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE_RESPONSE 0x04 /* Store Scene Response */ |
2124 | 32 | #define ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP_RESPONSE 0x06 /* Get Scene Membership Response */ |
2125 | 18 | #define ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE_RESPONSE 0x40 /* Enhanced Add Scene Response */ |
2126 | 0 | #define ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE_RESPONSE 0x41 /* Enhanced View Scene Response */ |
2127 | 0 | #define ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE_RESPONSE 0x42 /* Copy Scene Response */ |
2128 | | |
2129 | | /* Enhanced */ |
2130 | 4 | #define IS_ENHANCED true |
2131 | 56 | #define IS_NOT_ENHANCED false |
2132 | | |
2133 | | /*************************/ |
2134 | | /* Function Declarations */ |
2135 | | /*************************/ |
2136 | | |
2137 | | void proto_register_zbee_zcl_scenes(void); |
2138 | | void proto_reg_handoff_zbee_zcl_scenes(void); |
2139 | | |
2140 | | /* Command Dissector Helpers */ |
2141 | | static void dissect_zcl_scenes_add_scene (tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset, bool enhanced); |
2142 | | static void dissect_zcl_scenes_view_remove_store_recall_scene (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
2143 | | static void dissect_zcl_scenes_remove_all_get_scene_membership (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
2144 | | static void dissect_zcl_scenes_copy_scene (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
2145 | | static void dissect_zcl_scenes_add_remove_store_scene_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
2146 | | static void dissect_zcl_scenes_view_scene_response (tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset, bool enhanced); |
2147 | | static void dissect_zcl_scenes_remove_all_scenes_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
2148 | | static void dissect_zcl_scenes_get_scene_membership_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
2149 | | static void dissect_zcl_scenes_copy_scene_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
2150 | | |
2151 | | static void dissect_zcl_scenes_extension_fields (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
2152 | | |
2153 | | /* Private functions prototype */ |
2154 | | |
2155 | | /*************************/ |
2156 | | /* Global Variables */ |
2157 | | /*************************/ |
2158 | | /* Initialize the protocol and registered fields */ |
2159 | | static int proto_zbee_zcl_scenes; |
2160 | | |
2161 | | static int hf_zbee_zcl_scenes_attr_id; |
2162 | | static int hf_zbee_zcl_scenes_attr_id_scene_valid; |
2163 | | static int hf_zbee_zcl_scenes_attr_id_name_support; |
2164 | | static int hf_zbee_zcl_scenes_group_id; |
2165 | | static int hf_zbee_zcl_scenes_group_id_from; |
2166 | | static int hf_zbee_zcl_scenes_group_id_to; |
2167 | | static int hf_zbee_zcl_scenes_scene_id; |
2168 | | static int hf_zbee_zcl_scenes_scene_id_from; |
2169 | | static int hf_zbee_zcl_scenes_scene_id_to; |
2170 | | static int hf_zbee_zcl_scenes_transit_time; |
2171 | | static int hf_zbee_zcl_scenes_enh_transit_time; |
2172 | | static int hf_zbee_zcl_scenes_extension_set_cluster; |
2173 | | static int hf_zbee_zcl_scenes_extension_set_onoff; |
2174 | | static int hf_zbee_zcl_scenes_extension_set_level; |
2175 | | static int hf_zbee_zcl_scenes_extension_set_x; |
2176 | | static int hf_zbee_zcl_scenes_extension_set_y; |
2177 | | static int hf_zbee_zcl_scenes_extension_set_hue; |
2178 | | static int hf_zbee_zcl_scenes_extension_set_saturation; |
2179 | | static int hf_zbee_zcl_scenes_extension_set_color_loop_active; |
2180 | | static int hf_zbee_zcl_scenes_extension_set_color_loop_direction; |
2181 | | static int hf_zbee_zcl_scenes_extension_set_color_loop_time; |
2182 | | static int hf_zbee_zcl_scenes_extension_set_cooling_setpoint; |
2183 | | static int hf_zbee_zcl_scenes_extension_set_heating_setpoint; |
2184 | | static int hf_zbee_zcl_scenes_extension_set_system_mode; |
2185 | | static int hf_zbee_zcl_scenes_extension_set_lock_state; |
2186 | | static int hf_zbee_zcl_scenes_extension_set_lift_percentage; |
2187 | | static int hf_zbee_zcl_scenes_extension_set_tilt_percentage; |
2188 | | |
2189 | | static int hf_zbee_zcl_scenes_status; |
2190 | | static int hf_zbee_zcl_scenes_capacity; |
2191 | | static int hf_zbee_zcl_scenes_scene_count; |
2192 | | static int hf_zbee_zcl_scenes_attr_str_len; |
2193 | | static int hf_zbee_zcl_scenes_attr_str; |
2194 | | static int hf_zbee_zcl_scenes_srv_rx_cmd_id; |
2195 | | static int hf_zbee_zcl_scenes_srv_tx_cmd_id; |
2196 | | static int hf_zbee_zcl_scenes_scene_list; |
2197 | | static int hf_zbee_zcl_scenes_copy_mode; |
2198 | | |
2199 | | /* Initialize the subtree pointers */ |
2200 | | static int ett_zbee_zcl_scenes; |
2201 | | static int ett_zbee_zcl_scenes_scene_ctrl; |
2202 | | static int ett_zbee_zcl_scenes_extension_field_set; |
2203 | | |
2204 | | /* Attributes */ |
2205 | | static const value_string zbee_zcl_scenes_attr_names[] = { |
2206 | | { ZBEE_ZCL_ATTR_ID_SCENES_SCENE_COUNT, "Scene Count" }, |
2207 | | { ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_SCENE, "Current Scene" }, |
2208 | | { ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_GROUP, "Current Group" }, |
2209 | | { ZBEE_ZCL_ATTR_ID_SCENES_SCENE_VALID, "Scene Valid" }, |
2210 | | { ZBEE_ZCL_ATTR_ID_SCENES_NAME_SUPPORT, "Name Support" }, |
2211 | | { ZBEE_ZCL_ATTR_ID_SCENES_LAST_CONFIGURED_BY, "Last Configured By" }, |
2212 | | { 0, NULL } |
2213 | | }; |
2214 | | |
2215 | | /* Server Commands Received */ |
2216 | | static const value_string zbee_zcl_scenes_srv_rx_cmd_names[] = { |
2217 | | { ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE, "Add Scene" }, |
2218 | | { ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE, "View Scene" }, |
2219 | | { ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE, "Remove a Scene" }, |
2220 | | { ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES, "Remove all Scenes" }, |
2221 | | { ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE, "Store Scene" }, |
2222 | | { ZBEE_ZCL_CMD_ID_SCENES_RECALL_SCENE, "Recall Scene" }, |
2223 | | { ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP, "Get Scene Membership" }, |
2224 | | { ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE, "Enhanced Add Scene" }, |
2225 | | { ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE, "Enhanced View Scene" }, |
2226 | | { ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE, "Copy Scene" }, |
2227 | | { 0, NULL } |
2228 | | }; |
2229 | | |
2230 | | /* Server Commands Generated */ |
2231 | | static const value_string zbee_zcl_scenes_srv_tx_cmd_names[] = { |
2232 | | { ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE_RESPONSE, "Add Scene Response" }, |
2233 | | { ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE_RESPONSE, "View Scene Response" }, |
2234 | | { ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE_RESPONSE, "Remove a Scene Response" }, |
2235 | | { ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES_RESPONSE, "Remove all Scene Response" }, |
2236 | | { ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE_RESPONSE, "Store Scene Response" }, |
2237 | | { ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP_RESPONSE, "Get Scene Membership Response" }, |
2238 | | { ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE_RESPONSE, "Enhanced Add Scene Response" }, |
2239 | | { ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE_RESPONSE, "Enhanced View Scene Response" }, |
2240 | | { ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE_RESPONSE, "Copy Scene Response" }, |
2241 | | { 0, NULL } |
2242 | | }; |
2243 | | |
2244 | | /* Scene Names Support Values */ |
2245 | | static const value_string zbee_zcl_scenes_group_names_support_values[] = { |
2246 | | { ZBEE_ZCL_SCENES_NAME_NOT_SUPPORTED, "Scene names not supported" }, |
2247 | | { ZBEE_ZCL_SCENES_NAME_SUPPORTED, "Scene names supported" }, |
2248 | | { 0, NULL } |
2249 | | }; |
2250 | | |
2251 | | /* Scene Copy Mode Values */ |
2252 | | static const value_string zbee_zcl_scenes_copy_mode_values[] = { |
2253 | | { ZBEE_ZCL_SCENES_COPY_SPECIFIED, "Copy Specified Scenes" }, |
2254 | | { ZBEE_ZCL_SCENES_COPY_ALL, "Copy All Scenes" }, |
2255 | | { 0, NULL } |
2256 | | }; |
2257 | | |
2258 | | /* Color Loop Directions */ |
2259 | | static const value_string zbee_zcl_scenes_color_loop_direction_values[] = { |
2260 | | { 0x00, "Hue is Decrementing" }, |
2261 | | { 0x01, "Hue is Incrementing" }, |
2262 | | { 0, NULL } |
2263 | | }; |
2264 | | |
2265 | | |
2266 | | /*************************/ |
2267 | | /* Function Bodies */ |
2268 | | /*************************/ |
2269 | | |
2270 | | /*FUNCTION:------------------------------------------------------ |
2271 | | * NAME |
2272 | | * decode_color_xy |
2273 | | * DESCRIPTION |
2274 | | * this function decodes color xy values |
2275 | | * PARAMETERS |
2276 | | * unsigned *s - string to display |
2277 | | * uint16_t value - value to decode |
2278 | | * RETURNS |
2279 | | * none |
2280 | | *--------------------------------------------------------------- |
2281 | | */ |
2282 | | static void |
2283 | | decode_color_xy(char *s, uint16_t value) |
2284 | 0 | { |
2285 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "%.4lf", value/65535.0); |
2286 | 0 | } |
2287 | | |
2288 | | /*FUNCTION:------------------------------------------------------ |
2289 | | * NAME |
2290 | | * decode_setpoint |
2291 | | * DESCRIPTION |
2292 | | * this function decodes the setpoint |
2293 | | * PARAMETERS |
2294 | | * unsigned *s - string to display |
2295 | | * uint16_t value - value to decode |
2296 | | * RETURNS |
2297 | | * none |
2298 | | *--------------------------------------------------------------- |
2299 | | */ |
2300 | | static void decode_setpoint(char *s, int16_t value) |
2301 | 0 | { |
2302 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "%.2lf [" UTF8_DEGREE_SIGN "C]", value/100.0); |
2303 | 0 | } |
2304 | | |
2305 | | /*FUNCTION:------------------------------------------------------ |
2306 | | * NAME |
2307 | | * dissect_zbee_zcl_scenes |
2308 | | * DESCRIPTION |
2309 | | * ZigBee ZCL Scenes cluster dissector for wireshark. |
2310 | | * PARAMETERS |
2311 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
2312 | | * packet_info *pinfo - pointer to packet information fields |
2313 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
2314 | | * RETURNS |
2315 | | * none |
2316 | | *--------------------------------------------------------------- |
2317 | | */ |
2318 | | static int |
2319 | | dissect_zbee_zcl_scenes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) |
2320 | 335 | { |
2321 | 335 | proto_tree *payload_tree; |
2322 | 335 | zbee_zcl_packet *zcl; |
2323 | 335 | unsigned offset = 0; |
2324 | 335 | uint8_t cmd_id; |
2325 | 335 | int rem_len; |
2326 | | |
2327 | | /* Reject the packet if data is NULL */ |
2328 | 335 | if (data == NULL) |
2329 | 0 | return 0; |
2330 | 335 | zcl = (zbee_zcl_packet *)data; |
2331 | 335 | cmd_id = zcl->cmd_id; |
2332 | | |
2333 | | /* Create a subtree for the ZCL Command frame, and add the command ID to it. */ |
2334 | 335 | if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { |
2335 | | /* Append the command name to the info column. */ |
2336 | 236 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
2337 | 236 | val_to_str_const(cmd_id, zbee_zcl_scenes_srv_rx_cmd_names, "Unknown Command"), |
2338 | 236 | zcl->tran_seqno); |
2339 | | |
2340 | | /* Add the command ID. */ |
2341 | 236 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
2342 | | |
2343 | | /* Check if this command has a payload, then add the payload tree */ |
2344 | 236 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
2345 | 236 | if (rem_len > 0) { |
2346 | 219 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_scenes, NULL, "Payload"); |
2347 | | |
2348 | | /* Call the appropriate command dissector */ |
2349 | 219 | switch (cmd_id) { |
2350 | 53 | case ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE: |
2351 | 53 | dissect_zcl_scenes_add_scene(tvb, pinfo, payload_tree, &offset, IS_NOT_ENHANCED); |
2352 | 53 | break; |
2353 | | |
2354 | 4 | case ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE: |
2355 | 4 | dissect_zcl_scenes_add_scene(tvb, pinfo, payload_tree, &offset, IS_ENHANCED); |
2356 | 4 | break; |
2357 | | |
2358 | 17 | case ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE: |
2359 | 38 | case ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE: |
2360 | 41 | case ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE: |
2361 | 42 | case ZBEE_ZCL_CMD_ID_SCENES_RECALL_SCENE: |
2362 | 43 | case ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE: |
2363 | 43 | dissect_zcl_scenes_view_remove_store_recall_scene(tvb, payload_tree, &offset); |
2364 | 43 | break; |
2365 | | |
2366 | 19 | case ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES: |
2367 | 27 | case ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP: |
2368 | 27 | dissect_zcl_scenes_remove_all_get_scene_membership(tvb, payload_tree, &offset); |
2369 | 27 | break; |
2370 | | |
2371 | 1 | case ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE: |
2372 | 1 | dissect_zcl_scenes_copy_scene(tvb, payload_tree, &offset); |
2373 | 1 | break; |
2374 | | |
2375 | 90 | default: |
2376 | 90 | break; |
2377 | 219 | } |
2378 | 219 | } |
2379 | 236 | } |
2380 | 99 | else { /* ZBEE_ZCL_FCF_TO_CLIENT */ |
2381 | | /* Append the command name to the info column. */ |
2382 | 99 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
2383 | 99 | val_to_str_const(cmd_id, zbee_zcl_scenes_srv_tx_cmd_names, "Unknown Command"), |
2384 | 99 | zcl->tran_seqno); |
2385 | | |
2386 | | /* Add the command ID. */ |
2387 | 99 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
2388 | | |
2389 | | /* Check if this command has a payload, then add the payload tree */ |
2390 | 99 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
2391 | 99 | if (rem_len > 0) { |
2392 | 98 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_scenes, NULL, "Payload"); |
2393 | | |
2394 | | /* Call the appropriate command dissector */ |
2395 | 98 | switch (cmd_id) { |
2396 | 11 | case ZBEE_ZCL_CMD_ID_SCENES_ADD_SCENE_RESPONSE: |
2397 | 16 | case ZBEE_ZCL_CMD_ID_SCENES_REMOVE_SCENE_RESPONSE: |
2398 | 17 | case ZBEE_ZCL_CMD_ID_SCENES_STORE_SCENE_RESPONSE: |
2399 | 18 | case ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_ADD_SCENE_RESPONSE: |
2400 | 18 | dissect_zcl_scenes_add_remove_store_scene_response(tvb, payload_tree, &offset); |
2401 | 18 | break; |
2402 | | |
2403 | 3 | case ZBEE_ZCL_CMD_ID_SCENES_VIEW_SCENE_RESPONSE: |
2404 | 3 | dissect_zcl_scenes_view_scene_response(tvb, pinfo, payload_tree, &offset, IS_NOT_ENHANCED); |
2405 | 3 | break; |
2406 | | |
2407 | 0 | case ZBEE_ZCL_CMD_ID_SCENES_ENHANCED_VIEW_SCENE_RESPONSE: |
2408 | 0 | dissect_zcl_scenes_view_scene_response(tvb, pinfo, payload_tree, &offset, IS_ENHANCED); |
2409 | 0 | break; |
2410 | | |
2411 | 1 | case ZBEE_ZCL_CMD_ID_SCENES_REMOVE_ALL_SCENES_RESPONSE: |
2412 | 1 | dissect_zcl_scenes_remove_all_scenes_response(tvb, payload_tree, &offset); |
2413 | 1 | break; |
2414 | | |
2415 | 32 | case ZBEE_ZCL_CMD_ID_SCENES_GET_SCENE_MEMBERSHIP_RESPONSE: |
2416 | 32 | dissect_zcl_scenes_get_scene_membership_response(tvb, payload_tree, &offset); |
2417 | 32 | break; |
2418 | | |
2419 | 0 | case ZBEE_ZCL_CMD_ID_SCENES_COPY_SCENE_RESPONSE: |
2420 | 0 | dissect_zcl_scenes_copy_scene_response(tvb, payload_tree, &offset); |
2421 | 0 | break; |
2422 | | |
2423 | 44 | default: |
2424 | 44 | break; |
2425 | 98 | } |
2426 | 98 | } |
2427 | 99 | } |
2428 | | |
2429 | 199 | return tvb_captured_length(tvb); |
2430 | 335 | } /*dissect_zbee_zcl_scenes*/ |
2431 | | |
2432 | | |
2433 | | /*FUNCTION:------------------------------------------------------ |
2434 | | * NAME |
2435 | | * dissect_zcl_scenes_add_scene |
2436 | | * DESCRIPTION |
2437 | | * this function decodes the Add Scene payload. |
2438 | | * PARAMETERS |
2439 | | * tvb - the tv buffer of the current data_type |
2440 | | * tree - the tree to append this item to |
2441 | | * offset - offset of data in tvb |
2442 | | * enhanced - use enhanced transition time |
2443 | | * RETURNS |
2444 | | * none |
2445 | | *--------------------------------------------------------------- |
2446 | | */ |
2447 | | static void |
2448 | | dissect_zcl_scenes_add_scene(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset, bool enhanced) |
2449 | 57 | { |
2450 | 57 | unsigned attr_uint; |
2451 | 57 | const char *attr_string; |
2452 | | |
2453 | | /* Retrieve "Group ID" field */ |
2454 | 57 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2455 | 57 | *offset += 2; |
2456 | | |
2457 | | /* Retrieve "Scene ID" field */ |
2458 | 57 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
2459 | 57 | *offset += 1; |
2460 | | |
2461 | | /* Retrieve "Transition Time" field */ |
2462 | 57 | proto_tree_add_item(tree, enhanced ? hf_zbee_zcl_scenes_enh_transit_time : hf_zbee_zcl_scenes_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2463 | 57 | *offset += 2; |
2464 | | |
2465 | | /* Retrieve Scene Name */ |
2466 | 57 | attr_uint = tvb_get_uint8(tvb, *offset); /* string length */ |
2467 | 57 | if (attr_uint == 0xff) attr_uint = 0; |
2468 | | |
2469 | 57 | proto_tree_add_uint(tree, hf_zbee_zcl_scenes_attr_str_len, tvb, *offset, 1, attr_uint); |
2470 | | |
2471 | 57 | *offset += 1; |
2472 | | |
2473 | 57 | proto_tree_add_item_ret_string(tree, hf_zbee_zcl_scenes_attr_str, tvb, *offset, attr_uint, ENC_ASCII, pinfo->pool, (const uint8_t**)&attr_string); |
2474 | 57 | proto_item_append_text(tree, ", String: %s", attr_string); |
2475 | | |
2476 | 57 | *offset += attr_uint; |
2477 | | |
2478 | | /* Retrieve "Extension Set" field */ |
2479 | 57 | dissect_zcl_scenes_extension_fields(tvb, tree, offset); |
2480 | | |
2481 | 57 | } /*dissect_zcl_scenes_add_scene*/ |
2482 | | |
2483 | | |
2484 | | /*FUNCTION:-------------------------------------------------------------------- |
2485 | | * NAME |
2486 | | * dissect_zcl_scenes_view_remove_store_recall_scene |
2487 | | * DESCRIPTION |
2488 | | * this function decodes the View, Remove, Store and Recall Scene payload. |
2489 | | * PARAMETERS |
2490 | | * tvb - the tv buffer of the current data_type |
2491 | | * tree - the tree to append this item to |
2492 | | * offset - offset of data in tvb |
2493 | | * RETURNS |
2494 | | * none |
2495 | | *------------------------------------------------------------------------------ |
2496 | | */ |
2497 | | static void |
2498 | | dissect_zcl_scenes_view_remove_store_recall_scene(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
2499 | 43 | { |
2500 | | /* Retrieve "Group ID" field */ |
2501 | 43 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2502 | 43 | *offset += 2; |
2503 | | |
2504 | | /* Retrieve "Scene ID" field */ |
2505 | 43 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
2506 | 43 | *offset += 1; |
2507 | | |
2508 | 43 | } /*dissect_zcl_scenes_view_remove_store_recall_scene*/ |
2509 | | |
2510 | | |
2511 | | /*FUNCTION:------------------------------------------------------------------- |
2512 | | * NAME |
2513 | | * dissect_zcl_scenes_remove_all_get_scene_membership |
2514 | | * DESCRIPTION |
2515 | | * this function decodes the Remove all and Get Scene Membership payload. |
2516 | | * PARAMETERS |
2517 | | * tvb - the tv buffer of the current data_type |
2518 | | * tree - the tree to append this item to |
2519 | | * offset - offset of data in tvb |
2520 | | * RETURNS |
2521 | | * none |
2522 | | *----------------------------------------------------------------------------- |
2523 | | */ |
2524 | | static void |
2525 | | dissect_zcl_scenes_remove_all_get_scene_membership(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
2526 | 27 | { |
2527 | | /* Retrieve "Group ID" field */ |
2528 | 27 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2529 | 27 | *offset += 2; |
2530 | | |
2531 | 27 | } /*dissect_zcl_scenes_remove_all_get_scene_membership*/ |
2532 | | |
2533 | | |
2534 | | /*FUNCTION:-------------------------------------------------------------------- |
2535 | | * NAME |
2536 | | * dissect_zcl_scenes_copy_scene |
2537 | | * DESCRIPTION |
2538 | | * this function decodes the Copy Scene payload. |
2539 | | * PARAMETERS |
2540 | | * tvb - the tv buffer of the current data_type |
2541 | | * tree - the tree to append this item to |
2542 | | * offset - offset of data in tvb |
2543 | | * RETURNS |
2544 | | * none |
2545 | | *------------------------------------------------------------------------------ |
2546 | | */ |
2547 | | static void |
2548 | | dissect_zcl_scenes_copy_scene(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
2549 | 1 | { |
2550 | | /* Retrieve "Mode" field */ |
2551 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_copy_mode, tvb, *offset, 1, ENC_NA); |
2552 | 1 | *offset += 1; |
2553 | | |
2554 | | /* Retrieve "Group ID From" field */ |
2555 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id_from, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2556 | 1 | *offset += 2; |
2557 | | |
2558 | | /* Retrieve "Scene ID From" field */ |
2559 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id_from, tvb, *offset, 1, ENC_NA); |
2560 | 1 | *offset += 1; |
2561 | | |
2562 | | /* Retrieve "Group ID To" field */ |
2563 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id_to, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2564 | 1 | *offset += 2; |
2565 | | |
2566 | | /* Retrieve "Scene ID To" field */ |
2567 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id_to, tvb, *offset, 1, ENC_NA); |
2568 | 1 | *offset += 1; |
2569 | | |
2570 | 1 | } /*dissect_zcl_scenes_copy_scene*/ |
2571 | | |
2572 | | |
2573 | | /*FUNCTION:------------------------------------------------------ |
2574 | | * NAME |
2575 | | * dissect_zcl_scenes_add_remove_store_scene_response |
2576 | | * DESCRIPTION |
2577 | | * this function decodes the Add, Remove, Store Scene payload. |
2578 | | * PARAMETERS |
2579 | | * tvb - the tv buffer of the current data_type |
2580 | | * tree - the tree to append this item to |
2581 | | * offset - offset of data in tvb |
2582 | | * RETURNS |
2583 | | * none |
2584 | | *--------------------------------------------------------------- |
2585 | | */ |
2586 | | static void |
2587 | | dissect_zcl_scenes_add_remove_store_scene_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
2588 | 18 | { |
2589 | | /* Retrieve "Status" field */ |
2590 | 18 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
2591 | 18 | *offset += 1; |
2592 | | |
2593 | | /* Retrieve "Group ID" field */ |
2594 | 18 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2595 | 18 | *offset += 2; |
2596 | | |
2597 | | /* Retrieve "Scene ID" field */ |
2598 | 18 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
2599 | 18 | *offset += 1; |
2600 | | |
2601 | 18 | } /*dissect_zcl_scenes_add_remove_store_scene_response*/ |
2602 | | |
2603 | | |
2604 | | /*FUNCTION:------------------------------------------------------ |
2605 | | * NAME |
2606 | | * dissect_zcl_scenes_view_scene_response |
2607 | | * DESCRIPTION |
2608 | | * this function decodes the View Scene Response payload. |
2609 | | * PARAMETERS |
2610 | | * tvb - the tv buffer of the current data_type |
2611 | | * tree - the tree to append this item to |
2612 | | * offset - offset of data in tvb |
2613 | | * enhanced - use enhanced transition time |
2614 | | * RETURNS |
2615 | | * none |
2616 | | *--------------------------------------------------------------- |
2617 | | */ |
2618 | | static void |
2619 | | dissect_zcl_scenes_view_scene_response(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset, bool enhanced) |
2620 | 3 | { |
2621 | 3 | uint8_t status; |
2622 | 3 | const char *attr_string; |
2623 | 3 | unsigned attr_uint; |
2624 | | |
2625 | | /* Retrieve "Status" field */ |
2626 | 3 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_scenes_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN, &status); |
2627 | 3 | *offset += 1; |
2628 | | |
2629 | | /* Retrieve "Group ID" field */ |
2630 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2631 | 3 | *offset += 2; |
2632 | | |
2633 | | /* Retrieve "Scene ID" field */ |
2634 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
2635 | 3 | *offset += 1; |
2636 | | |
2637 | 3 | if(status == ZBEE_ZCL_STAT_SUCCESS) |
2638 | 0 | { |
2639 | | /* Retrieve "Transition Time" field */ |
2640 | 0 | proto_tree_add_item(tree, enhanced ? hf_zbee_zcl_scenes_enh_transit_time : hf_zbee_zcl_scenes_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2641 | 0 | *offset += 2; |
2642 | | |
2643 | | /* Retrieve Scene Name */ |
2644 | 0 | attr_uint = tvb_get_uint8(tvb, *offset); /* string length */ |
2645 | 0 | if (attr_uint == 0xff) attr_uint = 0; |
2646 | |
|
2647 | 0 | proto_tree_add_uint(tree, hf_zbee_zcl_scenes_attr_str_len, tvb, *offset, 1, attr_uint); |
2648 | |
|
2649 | 0 | *offset += 1; |
2650 | |
|
2651 | 0 | proto_tree_add_item_ret_string(tree, hf_zbee_zcl_scenes_attr_str, tvb, *offset, attr_uint, ENC_ASCII, pinfo->pool, (const uint8_t**)&attr_string); |
2652 | 0 | proto_item_append_text(tree, ", String: %s", attr_string); |
2653 | |
|
2654 | 0 | *offset += attr_uint; |
2655 | | |
2656 | | /* Retrieve "Extension Set" field */ |
2657 | 0 | dissect_zcl_scenes_extension_fields(tvb, tree, offset); |
2658 | |
|
2659 | 0 | } |
2660 | | |
2661 | 3 | } /*dissect_zcl_scenes_view_scene_response*/ |
2662 | | |
2663 | | |
2664 | | /*FUNCTION:------------------------------------------------------ |
2665 | | * NAME |
2666 | | * dissect_zcl_scenes_remove_all_scenes_response |
2667 | | * DESCRIPTION |
2668 | | * this function decodes the Remove All Scenes Response payload |
2669 | | * PARAMETERS |
2670 | | * tvb - the tv buffer of the current data_type |
2671 | | * tree - the tree to append this item to |
2672 | | * offset - offset of data in tvb |
2673 | | * RETURNS |
2674 | | * none |
2675 | | *--------------------------------------------------------------- |
2676 | | */ |
2677 | | static void |
2678 | | dissect_zcl_scenes_remove_all_scenes_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
2679 | 1 | { |
2680 | | /* Retrieve "Status" field */ |
2681 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
2682 | 1 | *offset += 1; |
2683 | | |
2684 | | /* Retrieve "Group ID" field */ |
2685 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2686 | 1 | *offset += 2; |
2687 | | |
2688 | 1 | } /*dissect_zcl_scenes_remove_all_scenes_response*/ |
2689 | | |
2690 | | |
2691 | | /*FUNCTION:------------------------------------------------------ |
2692 | | * NAME |
2693 | | * dissect_zcl_scenes_get_scene_membership_response |
2694 | | * DESCRIPTION |
2695 | | * this function decodes the Get Scene Membership Response payload. |
2696 | | * PARAMETERS |
2697 | | * tvb - the tv buffer of the current data_type |
2698 | | * tree - the tree to append this item to |
2699 | | * offset - offset of data in tvb |
2700 | | * RETURNS |
2701 | | * none |
2702 | | *--------------------------------------------------------------- |
2703 | | */ |
2704 | | static void |
2705 | | dissect_zcl_scenes_get_scene_membership_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
2706 | 32 | { |
2707 | 32 | proto_item *scene_list; |
2708 | 32 | proto_tree *scene_list_tree; |
2709 | 32 | uint8_t status, count, i; |
2710 | | |
2711 | | /* Retrieve "Status" field */ |
2712 | 32 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_scenes_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN, &status); |
2713 | 32 | *offset += 1; |
2714 | | |
2715 | | /* Retrieve "Capacity" field */ |
2716 | 32 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_capacity, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
2717 | 32 | *offset += 1; |
2718 | | |
2719 | | /* Retrieve "Group ID" field */ |
2720 | 32 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2721 | 32 | *offset += 2; |
2722 | | |
2723 | 32 | if(status == ZBEE_ZCL_STAT_SUCCESS) |
2724 | 0 | { |
2725 | | /* Retrieve "Scene Count" field */ |
2726 | 0 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_scenes_scene_count, tvb, *offset, 1, ENC_NA, &count); |
2727 | 0 | *offset += 1; |
2728 | |
|
2729 | 0 | if(count>0) |
2730 | 0 | { |
2731 | 0 | scene_list=proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_list, tvb, *offset, count, ENC_NA); |
2732 | 0 | scene_list_tree = proto_item_add_subtree(scene_list, ett_zbee_zcl_scenes_scene_ctrl); |
2733 | | /* Retrieve "Scene List" */ |
2734 | 0 | for( i = 0; i < count; i++) |
2735 | 0 | { |
2736 | 0 | proto_tree_add_item(scene_list_tree, hf_zbee_zcl_scenes_scene_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
2737 | 0 | *offset += 1; |
2738 | 0 | } |
2739 | 0 | } |
2740 | 0 | } |
2741 | | |
2742 | 32 | } /*dissect_zcl_scenes_get_scene_membership_response*/ |
2743 | | |
2744 | | |
2745 | | /*FUNCTION:------------------------------------------------------ |
2746 | | * NAME |
2747 | | * dissect_zcl_scenes_copy_scene_response |
2748 | | * DESCRIPTION |
2749 | | * this function decodes the Copy Scene payload. |
2750 | | * PARAMETERS |
2751 | | * tvb - the tv buffer of the current data_type |
2752 | | * tree - the tree to append this item to |
2753 | | * offset - offset of data in tvb |
2754 | | * RETURNS |
2755 | | * none |
2756 | | *--------------------------------------------------------------- |
2757 | | */ |
2758 | | static void |
2759 | | dissect_zcl_scenes_copy_scene_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
2760 | 0 | { |
2761 | | /* Retrieve "Status" field */ |
2762 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_status, tvb, *offset, 1, ENC_NA); |
2763 | 0 | *offset += 1; |
2764 | | |
2765 | | /* Retrieve "Group ID From" field */ |
2766 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_group_id_from, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2767 | 0 | *offset += 2; |
2768 | | |
2769 | | /* Retrieve "Scene ID From" field */ |
2770 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_scene_id_from, tvb, *offset, 1, ENC_NA); |
2771 | 0 | *offset += 1; |
2772 | |
|
2773 | 0 | } /*dissect_zcl_scenes_copy_scene_response*/ |
2774 | | |
2775 | | |
2776 | | /*FUNCTION:------------------------------------------------------ |
2777 | | * NAME |
2778 | | * dissect_zcl_scenes_extension_fields |
2779 | | * DESCRIPTION |
2780 | | * this function decodes the extension set fields |
2781 | | * PARAMETERS |
2782 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
2783 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
2784 | | * unsigned *offset - pointer to buffer offset |
2785 | | * RETURNS |
2786 | | * none |
2787 | | *--------------------------------------------------------------- |
2788 | | */ |
2789 | | static void dissect_zcl_scenes_extension_fields(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
2790 | 33 | { |
2791 | 33 | uint8_t set = 1; |
2792 | 33 | proto_tree *subtree; |
2793 | | |
2794 | | // Is there an extension field? |
2795 | 33 | bool hasExtensionField = tvb_offset_exists(tvb, *offset+2); |
2796 | | |
2797 | 395 | while (hasExtensionField) |
2798 | 364 | { |
2799 | | // Retrieve the cluster and the length |
2800 | 364 | uint32_t cluster = tvb_get_uint16(tvb, *offset, ENC_LITTLE_ENDIAN); |
2801 | 364 | uint8_t length = tvb_get_uint8 (tvb, *offset+2); |
2802 | | |
2803 | | // Create a subtree |
2804 | 364 | subtree = proto_tree_add_subtree_format(tree, tvb, *offset, length, ett_zbee_zcl_scenes_extension_field_set, NULL, "Extension field set %d", set++); |
2805 | 364 | proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_cluster, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2806 | 364 | *offset += 3; |
2807 | | |
2808 | 364 | switch (cluster) |
2809 | 364 | { |
2810 | 0 | case ZBEE_ZCL_CID_ON_OFF: |
2811 | 0 | if (length >= 1) |
2812 | 0 | { |
2813 | 0 | proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_onoff, tvb, *offset, 1, ENC_NA); |
2814 | 0 | length -= 1; |
2815 | 0 | *offset += 1; |
2816 | 0 | } |
2817 | 0 | break; |
2818 | | |
2819 | 2 | case ZBEE_ZCL_CID_LEVEL_CONTROL: |
2820 | 2 | if (length >= 1) |
2821 | 2 | { |
2822 | 2 | proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_level, tvb, *offset, 1, ENC_NA); |
2823 | 2 | length -= 1; |
2824 | 2 | *offset += 1; |
2825 | 2 | } |
2826 | 2 | break; |
2827 | | |
2828 | 8 | case ZBEE_ZCL_CID_COLOR_CONTROL: |
2829 | 8 | if (length >= 2) |
2830 | 6 | { |
2831 | 6 | proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_x, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2832 | 6 | length -= 2; |
2833 | 6 | *offset += 2; |
2834 | 6 | } |
2835 | 8 | if (length >= 2) |
2836 | 3 | { |
2837 | 3 | proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_y, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2838 | 3 | length -= 2; |
2839 | 3 | *offset += 2; |
2840 | 3 | } |
2841 | 8 | if (length >= 2) |
2842 | 3 | { |
2843 | 3 | proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_hue, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2844 | 3 | length -= 2; |
2845 | 3 | *offset += 2; |
2846 | 3 | } |
2847 | 8 | if (length >= 1) |
2848 | 4 | { |
2849 | 4 | proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_saturation, tvb, *offset, 1, ENC_NA); |
2850 | 4 | length -= 1; |
2851 | 4 | *offset += 1; |
2852 | 4 | } |
2853 | 8 | if (length >= 1) |
2854 | 3 | { |
2855 | 3 | proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_color_loop_active, tvb, *offset, 1, ENC_NA); |
2856 | 3 | length -= 1; |
2857 | 3 | *offset += 1; |
2858 | 3 | } |
2859 | 8 | if (length >= 1) |
2860 | 3 | { |
2861 | 3 | proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_color_loop_direction, tvb, *offset, 1, ENC_NA); |
2862 | 3 | length -= 1; |
2863 | 3 | *offset += 1; |
2864 | 3 | } |
2865 | 8 | if (length >= 2) |
2866 | 2 | { |
2867 | 2 | proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_color_loop_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2868 | 2 | length -= 2; |
2869 | 2 | *offset += 2; |
2870 | 2 | } |
2871 | 8 | break; |
2872 | | |
2873 | 18 | case ZBEE_ZCL_CID_DOOR_LOCK: |
2874 | 18 | if (length >= 1) |
2875 | 16 | { |
2876 | 16 | proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_lock_state, tvb, *offset, 1, ENC_NA); |
2877 | 16 | length -= 1; |
2878 | 16 | *offset += 1; |
2879 | 16 | } |
2880 | 18 | break; |
2881 | | |
2882 | 0 | case ZBEE_ZCL_CID_WINDOW_COVERING: |
2883 | 0 | if (length >= 1) |
2884 | 0 | { |
2885 | 0 | proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_lift_percentage, tvb, *offset, 1, ENC_NA); |
2886 | 0 | length -= 1; |
2887 | 0 | *offset += 1; |
2888 | 0 | } |
2889 | 0 | if (length >= 1) |
2890 | 0 | { |
2891 | 0 | proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_tilt_percentage, tvb, *offset, 1, ENC_NA); |
2892 | 0 | length -= 1; |
2893 | 0 | *offset += 1; |
2894 | 0 | } |
2895 | 0 | break; |
2896 | | |
2897 | 0 | case ZBEE_ZCL_CID_THERMOSTAT: |
2898 | 0 | if (length >= 2) |
2899 | 0 | { |
2900 | 0 | proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_cooling_setpoint, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2901 | 0 | length -= 2; |
2902 | 0 | *offset += 2; |
2903 | 0 | } |
2904 | 0 | if (length >= 2) |
2905 | 0 | { |
2906 | 0 | proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_heating_setpoint, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
2907 | 0 | length -= 2; |
2908 | 0 | *offset += 2; |
2909 | 0 | } |
2910 | 0 | if (length >= 1) |
2911 | 0 | { |
2912 | 0 | proto_tree_add_item(subtree, hf_zbee_zcl_scenes_extension_set_system_mode, tvb, *offset, 1, ENC_NA); |
2913 | 0 | length -= 1; |
2914 | 0 | *offset += 1; |
2915 | 0 | } |
2916 | 0 | break; |
2917 | 364 | } |
2918 | | |
2919 | 362 | *offset += length; |
2920 | 362 | hasExtensionField = tvb_offset_exists(tvb, *offset+2); |
2921 | 362 | } |
2922 | 33 | } |
2923 | | |
2924 | | |
2925 | | /*FUNCTION:------------------------------------------------------ |
2926 | | * NAME |
2927 | | * dissect_zcl_scenes_attr_data |
2928 | | * DESCRIPTION |
2929 | | * this function is called by ZCL foundation dissector in order to decode |
2930 | | * specific cluster attributes data. |
2931 | | * PARAMETERS |
2932 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
2933 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
2934 | | * unsigned *offset - pointer to buffer offset |
2935 | | * uint16_t attr_id - attribute identifier |
2936 | | * unsigned data_type - attribute data type |
2937 | | * bool client_attr- ZCL client |
2938 | | * RETURNS |
2939 | | * none |
2940 | | *--------------------------------------------------------------- |
2941 | | */ |
2942 | | static void |
2943 | | dissect_zcl_scenes_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
2944 | 269 | { |
2945 | | /* Dissect attribute data type and data */ |
2946 | 269 | switch ( attr_id ) { |
2947 | | |
2948 | 5 | case ZBEE_ZCL_ATTR_ID_SCENES_SCENE_VALID: |
2949 | 5 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_attr_id_scene_valid, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
2950 | 5 | *offset += 1; |
2951 | 5 | break; |
2952 | | |
2953 | 5 | case ZBEE_ZCL_ATTR_ID_SCENES_NAME_SUPPORT: |
2954 | 5 | proto_tree_add_item(tree, hf_zbee_zcl_scenes_attr_id_name_support, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
2955 | 5 | *offset += 1; |
2956 | 5 | break; |
2957 | | |
2958 | 59 | case ZBEE_ZCL_ATTR_ID_SCENES_SCENE_COUNT: |
2959 | 63 | case ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_SCENE: |
2960 | 63 | case ZBEE_ZCL_ATTR_ID_SCENES_CURRENT_GROUP: |
2961 | 63 | case ZBEE_ZCL_ATTR_ID_SCENES_LAST_CONFIGURED_BY: |
2962 | 259 | default: |
2963 | 259 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
2964 | 259 | break; |
2965 | 269 | } |
2966 | | |
2967 | 269 | } /*dissect_zcl_scenes_attr_data*/ |
2968 | | |
2969 | | |
2970 | | /*FUNCTION:------------------------------------------------------ |
2971 | | * NAME |
2972 | | * proto_register_zbee_zcl_scenes |
2973 | | * DESCRIPTION |
2974 | | * ZigBee ZCL Scenes cluster protocol registration routine. |
2975 | | * PARAMETERS |
2976 | | * none |
2977 | | * RETURNS |
2978 | | * void |
2979 | | *--------------------------------------------------------------- |
2980 | | */ |
2981 | | void |
2982 | | proto_register_zbee_zcl_scenes(void) |
2983 | 16 | { |
2984 | | /* Setup list of header fields */ |
2985 | 16 | static hf_register_info hf[] = { |
2986 | | |
2987 | 16 | { &hf_zbee_zcl_scenes_attr_id, |
2988 | 16 | { "Attribute", "zbee_zcl_general.scenes.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_scenes_attr_names), |
2989 | 16 | 0x00, NULL, HFILL } }, |
2990 | | |
2991 | 16 | { &hf_zbee_zcl_scenes_scene_list, |
2992 | 16 | {"Scene List", "zbee_zcl_general.groups.scene_list",FT_NONE,BASE_NONE, NULL, |
2993 | 16 | 0x00, NULL, HFILL } }, |
2994 | | |
2995 | 16 | { &hf_zbee_zcl_scenes_group_id, |
2996 | 16 | { "Group ID", "zbee_zcl_general.scenes.group_id", FT_UINT16, BASE_HEX, NULL, |
2997 | 16 | 0x00, NULL, HFILL } }, |
2998 | | |
2999 | 16 | { &hf_zbee_zcl_scenes_group_id_from, |
3000 | 16 | { "Group ID From", "zbee_zcl_general.scenes.group_id_from", FT_UINT16, BASE_HEX, NULL, |
3001 | 16 | 0x00, NULL, HFILL } }, |
3002 | | |
3003 | 16 | { &hf_zbee_zcl_scenes_group_id_to, |
3004 | 16 | { "Group ID To", "zbee_zcl_general.scenes.group_id_to", FT_UINT16, BASE_HEX, NULL, |
3005 | 16 | 0x00, NULL, HFILL } }, |
3006 | | |
3007 | 16 | { &hf_zbee_zcl_scenes_scene_id, |
3008 | 16 | { "Scene ID", "zbee_zcl_general.scenes.scene_id", FT_UINT8, BASE_HEX, NULL, |
3009 | 16 | 0x00, NULL, HFILL } }, |
3010 | | |
3011 | 16 | { &hf_zbee_zcl_scenes_scene_id_from, |
3012 | 16 | { "Scene ID From", "zbee_zcl_general.scenes.scene_id_from", FT_UINT8, BASE_HEX, NULL, |
3013 | 16 | 0x00, NULL, HFILL } }, |
3014 | | |
3015 | 16 | { &hf_zbee_zcl_scenes_scene_id_to, |
3016 | 16 | { "Scene ID To", "zbee_zcl_general.scenes.scene_id_to", FT_UINT8, BASE_HEX, NULL, |
3017 | 16 | 0x00, NULL, HFILL } }, |
3018 | | |
3019 | 16 | { &hf_zbee_zcl_scenes_transit_time, |
3020 | 16 | { "Transition Time", "zbee_zcl_general.scenes.transit_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_seconds), |
3021 | 16 | 0x00, NULL, HFILL } }, |
3022 | | |
3023 | 16 | { &hf_zbee_zcl_scenes_enh_transit_time, |
3024 | 16 | { "Transition Time", "zbee_zcl_general.scenes.enh_transit_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms), |
3025 | 16 | 0x00, NULL, HFILL } }, |
3026 | | |
3027 | 16 | { &hf_zbee_zcl_scenes_status, |
3028 | 16 | { "Scenes Status", "zbee_zcl_general.scenes.scenes_status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names), |
3029 | 16 | 0x00, NULL, HFILL } }, |
3030 | | |
3031 | 16 | { &hf_zbee_zcl_scenes_capacity, |
3032 | 16 | { "Scene Capacity", "zbee_zcl_general.scenes.scene_capacity", FT_UINT8, BASE_DEC, NULL, |
3033 | 16 | 0x00, NULL, HFILL } }, |
3034 | | |
3035 | 16 | { &hf_zbee_zcl_scenes_scene_count, |
3036 | 16 | { "Scene Count", "zbee_zcl_general.scenes.scene_count", FT_UINT8, BASE_DEC, NULL, |
3037 | 16 | 0x00, NULL, HFILL } }, |
3038 | | |
3039 | 16 | { &hf_zbee_zcl_scenes_attr_id_name_support, |
3040 | 16 | { "Scene Name Support", "zbee_zcl_general.scenes.attr.name_support", FT_UINT8, BASE_HEX, VALS(zbee_zcl_scenes_group_names_support_values), |
3041 | 16 | ZBEE_ZCL_CMD_ID_SCENES_NAME_SUPPORT_MASK, NULL, HFILL } }, |
3042 | | |
3043 | 16 | { &hf_zbee_zcl_scenes_attr_id_scene_valid, |
3044 | 16 | { "Scene Valid", "zbee_zcl_general.scenes.scene_valid", FT_BOOLEAN, 8, NULL, |
3045 | 16 | ZBEE_ZCL_ATTR_SCENES_SCENE_VALID_MASK, NULL, HFILL } }, |
3046 | | |
3047 | 16 | { &hf_zbee_zcl_scenes_attr_str_len, |
3048 | 16 | { "Length", "zbee_zcl_general.scenes.attr_str_len", FT_UINT8, BASE_DEC, NULL, |
3049 | 16 | 0x00, NULL, HFILL }}, |
3050 | | |
3051 | 16 | { &hf_zbee_zcl_scenes_attr_str, |
3052 | 16 | { "String", "zbee_zcl_general.scenes.attr_str", FT_STRING, BASE_NONE, NULL, |
3053 | 16 | 0x00, NULL, HFILL }}, |
3054 | | |
3055 | 16 | { &hf_zbee_zcl_scenes_extension_set_cluster, |
3056 | 16 | { "Cluster", "zbee_zcl_general.scenes.extension_set.cluster", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_aps_cid_names), |
3057 | 16 | 0x00, NULL, HFILL }}, |
3058 | | |
3059 | 16 | { &hf_zbee_zcl_scenes_extension_set_onoff, |
3060 | 16 | { "On/Off", "zbee_zcl_general.scenes.extension_set.onoff", FT_UINT8, BASE_DEC, NULL, |
3061 | 16 | 0x00, NULL, HFILL }}, |
3062 | | |
3063 | 16 | { &hf_zbee_zcl_scenes_extension_set_level, |
3064 | 16 | { "Level", "zbee_zcl_general.scenes.extension_set.level", FT_UINT8, BASE_DEC, NULL, |
3065 | 16 | 0x00, NULL, HFILL }}, |
3066 | | |
3067 | 16 | { &hf_zbee_zcl_scenes_extension_set_x, |
3068 | 16 | { "Color X", "zbee_zcl_general.scenes.extension_set.color_x", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy), |
3069 | 16 | 0x00, NULL, HFILL }}, |
3070 | | |
3071 | 16 | { &hf_zbee_zcl_scenes_extension_set_y, |
3072 | 16 | { "Color Y", "zbee_zcl_general.scenes.extension_set.color_y", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy), |
3073 | 16 | 0x00, NULL, HFILL }}, |
3074 | | |
3075 | 16 | { &hf_zbee_zcl_scenes_extension_set_hue, |
3076 | 16 | { "Enhanced Hue", "zbee_zcl_general.scenes.extension_set.hue", FT_UINT16, BASE_DEC, NULL, |
3077 | 16 | 0x00, NULL, HFILL }}, |
3078 | | |
3079 | 16 | { &hf_zbee_zcl_scenes_extension_set_saturation, |
3080 | 16 | { "Saturation", "zbee_zcl_general.scenes.extension_set.saturation", FT_UINT8, BASE_DEC, NULL, |
3081 | 16 | 0x00, NULL, HFILL }}, |
3082 | | |
3083 | 16 | { &hf_zbee_zcl_scenes_extension_set_color_loop_active, |
3084 | 16 | { "Color Loop Active", "zbee_zcl_general.scenes.extension_set.color_loop_active", FT_BOOLEAN, BASE_NONE, NULL, |
3085 | 16 | 0x00, NULL, HFILL }}, |
3086 | | |
3087 | 16 | { &hf_zbee_zcl_scenes_extension_set_color_loop_direction, |
3088 | 16 | { "Color Loop Direction", "zbee_zcl_general.scenes.extension_set.color_loop_direction", FT_UINT8, BASE_DEC, VALS(zbee_zcl_scenes_color_loop_direction_values), |
3089 | 16 | 0x00, NULL, HFILL }}, |
3090 | | |
3091 | 16 | { &hf_zbee_zcl_scenes_extension_set_color_loop_time, |
3092 | 16 | { "Color Loop Time", "zbee_zcl_general.scenes.extension_set.color_loop_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_seconds), |
3093 | 16 | 0x00, NULL, HFILL }}, |
3094 | | |
3095 | 16 | { &hf_zbee_zcl_scenes_extension_set_lock_state, |
3096 | 16 | { "Lock State", "zbee_zcl_general.scenes.extension_set.lock_state", FT_UINT8, BASE_DEC, NULL, |
3097 | 16 | 0x00, NULL, HFILL }}, |
3098 | | |
3099 | 16 | { &hf_zbee_zcl_scenes_extension_set_lift_percentage, |
3100 | 16 | { "Current Position Lift Percentage", "zbee_zcl_general.scenes.extension_set.current_position_lift_percentage", FT_UINT8, BASE_DEC, NULL, |
3101 | 16 | 0x00, NULL, HFILL }}, |
3102 | | |
3103 | 16 | { &hf_zbee_zcl_scenes_extension_set_tilt_percentage, |
3104 | 16 | { "Current Position Tilt Percentage", "zbee_zcl_general.scenes.extension_set.current_position_tilt_percentage", FT_UINT8, BASE_DEC, NULL, |
3105 | 16 | 0x00, NULL, HFILL }}, |
3106 | | |
3107 | 16 | { &hf_zbee_zcl_scenes_extension_set_cooling_setpoint, |
3108 | 16 | { "Occupied Cooling Setpoint", "zbee_zcl_general.scenes.extension_set.occupied_cooling_setpoint", FT_INT16, BASE_CUSTOM, CF_FUNC(decode_setpoint), |
3109 | 16 | 0x00, NULL, HFILL }}, |
3110 | | |
3111 | 16 | { &hf_zbee_zcl_scenes_extension_set_heating_setpoint, |
3112 | 16 | { "Occupied Heating Setpoint", "zbee_zcl_general.scenes.extension_set.occupied_heating_setpoint", FT_INT16, BASE_CUSTOM, CF_FUNC(decode_setpoint), |
3113 | 16 | 0x00, NULL, HFILL }}, |
3114 | | |
3115 | 16 | { &hf_zbee_zcl_scenes_extension_set_system_mode, |
3116 | 16 | { "System Mode", "zbee_zcl_general.scenes.extension_set.system_mode", FT_UINT8, BASE_DEC, NULL, |
3117 | 16 | 0x00, NULL, HFILL }}, |
3118 | | |
3119 | 16 | { &hf_zbee_zcl_scenes_copy_mode, |
3120 | 16 | { "Scene Copy Mode", "zbee_zcl_general.scenes.copy_mode", FT_UINT8, BASE_DEC, VALS(zbee_zcl_scenes_copy_mode_values), |
3121 | 16 | 0x00, NULL, HFILL } }, |
3122 | | |
3123 | 16 | { &hf_zbee_zcl_scenes_srv_rx_cmd_id, |
3124 | 16 | { "Command", "zbee_zcl_general.scenes.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_scenes_srv_rx_cmd_names), |
3125 | 16 | 0x00, NULL, HFILL } }, |
3126 | | |
3127 | 16 | { &hf_zbee_zcl_scenes_srv_tx_cmd_id, |
3128 | 16 | { "Command", "zbee_zcl_general.scenes.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_scenes_srv_tx_cmd_names), |
3129 | 16 | 0x00, NULL, HFILL } } |
3130 | | |
3131 | 16 | }; |
3132 | | |
3133 | | /* ZCL Scenes subtrees */ |
3134 | 16 | static int *ett[] = { |
3135 | 16 | &ett_zbee_zcl_scenes, |
3136 | 16 | &ett_zbee_zcl_scenes_scene_ctrl, |
3137 | 16 | &ett_zbee_zcl_scenes_extension_field_set |
3138 | 16 | }; |
3139 | | |
3140 | | /* Register the ZigBee ZCL Scenes cluster protocol name and description */ |
3141 | 16 | proto_zbee_zcl_scenes = proto_register_protocol("ZigBee ZCL Scenes", "ZCL Scenes", ZBEE_PROTOABBREV_ZCL_SCENES); |
3142 | 16 | proto_register_field_array(proto_zbee_zcl_scenes, hf, array_length(hf)); |
3143 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
3144 | | |
3145 | | /* Register the ZigBee ZCL Scenes dissector. */ |
3146 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_SCENES, dissect_zbee_zcl_scenes, proto_zbee_zcl_scenes); |
3147 | | |
3148 | 16 | } /*proto_register_zbee_zcl_scenes*/ |
3149 | | |
3150 | | |
3151 | | /*FUNCTION:------------------------------------------------------ |
3152 | | * NAME |
3153 | | * proto_reg_handoff_zbee_zcl_scenes |
3154 | | * DESCRIPTION |
3155 | | * Hands off the ZCL Scenes dissector. |
3156 | | * PARAMETERS |
3157 | | * none |
3158 | | * RETURNS |
3159 | | * none |
3160 | | *--------------------------------------------------------------- |
3161 | | */ |
3162 | | void |
3163 | | proto_reg_handoff_zbee_zcl_scenes(void) |
3164 | 16 | { |
3165 | | |
3166 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_SCENES, |
3167 | 16 | proto_zbee_zcl_scenes, |
3168 | 16 | ett_zbee_zcl_scenes, |
3169 | 16 | ZBEE_ZCL_CID_SCENES, |
3170 | 16 | ZBEE_MFG_CODE_NONE, |
3171 | 16 | hf_zbee_zcl_scenes_attr_id, |
3172 | 16 | hf_zbee_zcl_scenes_attr_id, |
3173 | 16 | hf_zbee_zcl_scenes_srv_rx_cmd_id, |
3174 | 16 | hf_zbee_zcl_scenes_srv_tx_cmd_id, |
3175 | 16 | dissect_zcl_scenes_attr_data |
3176 | 16 | ); |
3177 | 16 | } /*proto_reg_handoff_zbee_zcl_scenes*/ |
3178 | | |
3179 | | |
3180 | | /* ########################################################################## */ |
3181 | | /* #### (0x0006) ON/OFF CLUSTER ############################################# */ |
3182 | | /* ########################################################################## */ |
3183 | | |
3184 | | /*************************/ |
3185 | | /* Defines */ |
3186 | | /*************************/ |
3187 | | |
3188 | | /* Attributes */ |
3189 | 145 | #define ZBEE_ZCL_ON_OFF_ATTR_ID_ONOFF 0x0000 |
3190 | 4 | #define ZBEE_ZCL_ON_OFF_ATTR_ID_GLOBALSCENECONTROL 0x4000 |
3191 | 3 | #define ZBEE_ZCL_ON_OFF_ATTR_ID_ONTIME 0x4001 |
3192 | 1 | #define ZBEE_ZCL_ON_OFF_ATTR_ID_OFFWAITTIME 0x4002 |
3193 | 3 | #define ZBEE_ZCL_ON_OFF_ATTR_ID_STARTUPONOFF 0x4003 |
3194 | | |
3195 | | /* Server Commands Received */ |
3196 | | #define ZBEE_ZCL_ON_OFF_CMD_OFF 0x00 /* Off */ |
3197 | | #define ZBEE_ZCL_ON_OFF_CMD_ON 0x01 /* On */ |
3198 | | #define ZBEE_ZCL_ON_OFF_CMD_TOGGLE 0x02 /* Toggle */ |
3199 | 1 | #define ZBEE_ZCL_ON_OFF_CMD_OFF_WITH_EFFECT 0x40 /* Off with effect */ |
3200 | | #define ZBEE_ZCL_ON_OFF_CMD_ON_WITH_RECALL_GLOBAL_SCENE 0x41 /* On with recall global scene */ |
3201 | 0 | #define ZBEE_ZCL_ON_OFF_CMD_ON_WITH_TIMED_OFF 0x42 /* On with timed off */ |
3202 | | |
3203 | | /* On/Off Control Field */ |
3204 | 16 | #define ZBEE_ZCL_ON_OFF_TIMED_OFF_CONTROL_MASK_ACCEPT_ONLY_WHEN_ON 0x01 |
3205 | 16 | #define ZBEE_ZCL_ON_OFF_TIMED_OFF_CONTROL_MASK_RESERVED 0xFE |
3206 | | |
3207 | | /*************************/ |
3208 | | /* Function Declarations */ |
3209 | | /*************************/ |
3210 | | |
3211 | | void proto_register_zbee_zcl_on_off(void); |
3212 | | void proto_reg_handoff_zbee_zcl_on_off(void); |
3213 | | |
3214 | | /* Command Dissector Helpers */ |
3215 | | static void dissect_zcl_on_off_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr); |
3216 | | |
3217 | | /* Private functions prototype */ |
3218 | | |
3219 | | /*************************/ |
3220 | | /* Global Variables */ |
3221 | | /*************************/ |
3222 | | |
3223 | | /* Initialize the protocol and registered fields */ |
3224 | | static int proto_zbee_zcl_on_off; |
3225 | | |
3226 | | static int hf_zbee_zcl_on_off_attr_id; |
3227 | | static int hf_zbee_zcl_on_off_attr_onoff; |
3228 | | static int hf_zbee_zcl_on_off_attr_globalscenecontrol; |
3229 | | static int hf_zbee_zcl_on_off_attr_ontime; |
3230 | | static int hf_zbee_zcl_on_off_attr_offwaittime; |
3231 | | static int hf_zbee_zcl_on_off_attr_startuponoff; |
3232 | | static int hf_zbee_zcl_on_off_srv_rx_cmd_id; |
3233 | | |
3234 | | static int hf_zbee_zcl_on_off_effect_identifier; |
3235 | | static int hf_zbee_zcl_on_off_effect_variant_delayed_all_off; |
3236 | | static int hf_zbee_zcl_on_off_effect_variant_dying_light; |
3237 | | static int hf_zbee_zcl_on_off_effect_variant_reserved; |
3238 | | |
3239 | | static int hf_zbee_zcl_on_off_timed_off_control_mask; |
3240 | | static int hf_zbee_zcl_on_off_timed_off_control_mask_accept_only_when_on; |
3241 | | static int hf_zbee_zcl_on_off_timed_off_control_mask_reserved; |
3242 | | |
3243 | | /* Initialize the subtree pointers */ |
3244 | | static int ett_zbee_zcl_on_off; |
3245 | | static int ett_zbee_zcl_on_off_timed_off_control_mask; |
3246 | | |
3247 | | /* Attributes */ |
3248 | | static const value_string zbee_zcl_on_off_attr_names[] = { |
3249 | | { ZBEE_ZCL_ON_OFF_ATTR_ID_ONOFF, "OnOff" }, |
3250 | | { ZBEE_ZCL_ON_OFF_ATTR_ID_GLOBALSCENECONTROL, "GlobalSceneControl" }, |
3251 | | { ZBEE_ZCL_ON_OFF_ATTR_ID_ONTIME, "OnTime" }, |
3252 | | { ZBEE_ZCL_ON_OFF_ATTR_ID_OFFWAITTIME, "OffWaitTime" }, |
3253 | | { ZBEE_ZCL_ON_OFF_ATTR_ID_STARTUPONOFF, "StartUpOnOff" }, |
3254 | | { 0, NULL } |
3255 | | }; |
3256 | | |
3257 | | /* Server Commands Generated */ |
3258 | | static const value_string zbee_zcl_on_off_srv_rx_cmd_names[] = { |
3259 | | { ZBEE_ZCL_ON_OFF_CMD_OFF, "Off" }, |
3260 | | { ZBEE_ZCL_ON_OFF_CMD_ON, "On" }, |
3261 | | { ZBEE_ZCL_ON_OFF_CMD_TOGGLE, "Toggle" }, |
3262 | | { ZBEE_ZCL_ON_OFF_CMD_OFF_WITH_EFFECT, "Off with effect" }, |
3263 | | { ZBEE_ZCL_ON_OFF_CMD_ON_WITH_RECALL_GLOBAL_SCENE, "On with recall global scene" }, |
3264 | | { ZBEE_ZCL_ON_OFF_CMD_ON_WITH_TIMED_OFF, "On with timed off" }, |
3265 | | { 0, NULL } |
3266 | | }; |
3267 | | |
3268 | | static const range_string zbee_zcl_on_off_effect_identifier_names[] = { |
3269 | | { 0x00, 0x00, "Delayed All Off" }, |
3270 | | { 0x01, 0x01, "Dying Light" }, |
3271 | | { 0x02, 0xFF, "Reserved" }, |
3272 | | { 0, 0, NULL } |
3273 | | }; |
3274 | | |
3275 | | static const range_string zbee_zcl_on_off_effect_variant_delayed_all_off_names[] = { |
3276 | | { 0x00, 0x00, "Fade to off in 0.8 seconds" }, |
3277 | | { 0x01, 0x01, "No fade" }, |
3278 | | { 0x02, 0x02, "50% dim down in 0.8 seconds then fade to off in 12 seconds" }, |
3279 | | { 0x03, 0xFF, "Reserved" }, |
3280 | | { 0, 0, NULL } |
3281 | | }; |
3282 | | |
3283 | | static const range_string zbee_zcl_on_off_effect_variant_dying_light_names[] = { |
3284 | | { 0x00, 0x00, "20% dim up in 0.5s then fade to off in 1 second" }, |
3285 | | { 0x01, 0xFF, "Reserved" }, |
3286 | | { 0, 0, NULL } |
3287 | | }; |
3288 | | |
3289 | | static const range_string zbee_zcl_on_off_effect_variant_reserved_names[] = { |
3290 | | { 0x00, 0xFF, "Reserved" }, |
3291 | | { 0, 0, NULL } |
3292 | | }; |
3293 | | |
3294 | | static const range_string zbee_zcl_on_off_startup_on_off_names[] = { |
3295 | | { 0x00, 0x00, "Set the OnOff attribute to Off" }, |
3296 | | { 0x01, 0x01, "Set the OnOff attribute to On" }, |
3297 | | { 0x02, 0x02, "Toggle the OnOff attribute" }, |
3298 | | { 0x03, 0xFE, "Reserved" }, |
3299 | | { 0xFF, 0xFF, "Set the OnOff attribute to its previous value" }, |
3300 | | { 0, 0, NULL } |
3301 | | }; |
3302 | | |
3303 | | /*************************/ |
3304 | | /* Function Bodies */ |
3305 | | /*************************/ |
3306 | | |
3307 | | /*FUNCTION:------------------------------------------------------ |
3308 | | * NAME |
3309 | | * dissect_zbee_zcl_onoff |
3310 | | * DESCRIPTION |
3311 | | * ZigBee ZCL OnOff cluster dissector for wireshark. |
3312 | | * PARAMETERS |
3313 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
3314 | | * packet_info *pinfo - pointer to packet information fields |
3315 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
3316 | | * void *data - pointer to ZCL packet structure. |
3317 | | * RETURNS |
3318 | | * int - length of parsed data. |
3319 | | *--------------------------------------------------------------- |
3320 | | */ |
3321 | | static int |
3322 | | dissect_zbee_zcl_on_off(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) |
3323 | 109 | { |
3324 | 109 | proto_tree *payload_tree; |
3325 | 109 | zbee_zcl_packet *zcl; |
3326 | 109 | unsigned offset = 0; |
3327 | 109 | uint8_t cmd_id; |
3328 | 109 | int rem_len; |
3329 | 109 | uint8_t effect_identifier = 0; |
3330 | | |
3331 | 109 | static int * const onoff_control_mask[] = { |
3332 | 109 | &hf_zbee_zcl_on_off_timed_off_control_mask_accept_only_when_on, |
3333 | 109 | &hf_zbee_zcl_on_off_timed_off_control_mask_reserved, |
3334 | 109 | NULL |
3335 | 109 | }; |
3336 | | |
3337 | | /* Reject the packet if data is NULL */ |
3338 | 109 | if (data == NULL) |
3339 | 0 | return 0; |
3340 | 109 | zcl = (zbee_zcl_packet *)data; |
3341 | 109 | cmd_id = zcl->cmd_id; |
3342 | | |
3343 | | /* Create a subtree for the ZCL Command frame, and add the command ID to it. */ |
3344 | 109 | if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { |
3345 | | /* Append the command name to the info column. */ |
3346 | 75 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
3347 | 75 | val_to_str_const(cmd_id, zbee_zcl_on_off_srv_rx_cmd_names, "Unknown Command"), |
3348 | 75 | zcl->tran_seqno); |
3349 | | |
3350 | | /* Add the command ID. */ |
3351 | 75 | proto_tree_add_item(tree, hf_zbee_zcl_on_off_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
3352 | 75 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
3353 | 75 | if (rem_len > 0) { |
3354 | 55 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_on_off, NULL, "Payload"); |
3355 | | |
3356 | 55 | switch (cmd_id) { |
3357 | 1 | case ZBEE_ZCL_ON_OFF_CMD_OFF_WITH_EFFECT: |
3358 | 1 | proto_tree_add_item_ret_uint8(payload_tree, hf_zbee_zcl_on_off_effect_identifier, tvb, offset, 1, ENC_NA, &effect_identifier); |
3359 | 1 | offset += 1; |
3360 | 1 | switch (effect_identifier) { |
3361 | 0 | case 0x00: |
3362 | 0 | proto_tree_add_item(payload_tree, hf_zbee_zcl_on_off_effect_variant_delayed_all_off, tvb, offset, 1, ENC_NA); |
3363 | 0 | break; |
3364 | 0 | case 0x01: |
3365 | 0 | proto_tree_add_item(payload_tree, hf_zbee_zcl_on_off_effect_variant_dying_light, tvb, offset, 1, ENC_NA); |
3366 | 0 | break; |
3367 | 1 | default: |
3368 | 1 | proto_tree_add_item(payload_tree, hf_zbee_zcl_on_off_effect_variant_reserved, tvb, offset, 1, ENC_NA); |
3369 | 1 | break; |
3370 | 1 | } |
3371 | 0 | break; |
3372 | | |
3373 | 0 | case ZBEE_ZCL_ON_OFF_CMD_ON_WITH_TIMED_OFF: |
3374 | 0 | proto_tree_add_bitmask(payload_tree, tvb, offset, hf_zbee_zcl_on_off_timed_off_control_mask, ett_zbee_zcl_on_off_timed_off_control_mask, onoff_control_mask, ENC_LITTLE_ENDIAN); |
3375 | 0 | offset += 1; |
3376 | |
|
3377 | 0 | dissect_zcl_on_off_attr_data(payload_tree, pinfo, tvb, &offset, ZBEE_ZCL_ON_OFF_ATTR_ID_ONTIME, FT_UINT16, false); |
3378 | 0 | dissect_zcl_on_off_attr_data(payload_tree, pinfo, tvb, &offset, ZBEE_ZCL_ON_OFF_ATTR_ID_OFFWAITTIME, FT_UINT16, false); |
3379 | 0 | break; |
3380 | | |
3381 | 54 | default: |
3382 | 54 | break; |
3383 | 55 | } |
3384 | 55 | } |
3385 | 75 | } |
3386 | | |
3387 | 108 | return tvb_captured_length(tvb); |
3388 | 109 | } /*dissect_zbee_zcl_on_off*/ |
3389 | | |
3390 | | |
3391 | | /*FUNCTION:------------------------------------------------------ |
3392 | | * NAME |
3393 | | * dissect_zcl_on_off_attr_data |
3394 | | * DESCRIPTION |
3395 | | * this function is called by ZCL foundation dissector in order to decode |
3396 | | * specific cluster attributes data. |
3397 | | * PARAMETERS |
3398 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
3399 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
3400 | | * unsigned *offset - pointer to buffer offset |
3401 | | * uint16_t attr_id - attribute identifier |
3402 | | * unsigned data_type - attribute data type |
3403 | | * bool client_attr- ZCL client |
3404 | | * RETURNS |
3405 | | * none |
3406 | | *--------------------------------------------------------------- |
3407 | | */ |
3408 | | void |
3409 | | dissect_zcl_on_off_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
3410 | 582 | { |
3411 | | /* Dissect attribute data type and data */ |
3412 | 582 | switch (attr_id) { |
3413 | | |
3414 | 145 | case ZBEE_ZCL_ON_OFF_ATTR_ID_ONOFF: |
3415 | 145 | proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_onoff, tvb, *offset, 1, ENC_NA); |
3416 | 145 | *offset += 1; |
3417 | 145 | break; |
3418 | | |
3419 | 4 | case ZBEE_ZCL_ON_OFF_ATTR_ID_GLOBALSCENECONTROL: |
3420 | 4 | proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_globalscenecontrol, tvb, *offset, 1, ENC_NA); |
3421 | 4 | *offset += 1; |
3422 | 4 | break; |
3423 | | |
3424 | 3 | case ZBEE_ZCL_ON_OFF_ATTR_ID_ONTIME: |
3425 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_ontime, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
3426 | 3 | *offset += 2; |
3427 | 3 | break; |
3428 | | |
3429 | 1 | case ZBEE_ZCL_ON_OFF_ATTR_ID_OFFWAITTIME: |
3430 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_offwaittime, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
3431 | 1 | *offset += 2; |
3432 | 1 | break; |
3433 | | |
3434 | 3 | case ZBEE_ZCL_ON_OFF_ATTR_ID_STARTUPONOFF: |
3435 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_startuponoff, tvb, *offset, 1, ENC_NA); |
3436 | 3 | *offset += 1; |
3437 | 3 | break; |
3438 | | |
3439 | 426 | default: |
3440 | 426 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
3441 | 426 | break; |
3442 | 582 | } |
3443 | | |
3444 | 582 | } /*dissect_zcl_on_off_attr_data*/ |
3445 | | |
3446 | | /*FUNCTION:------------------------------------------------------ |
3447 | | * NAME |
3448 | | * proto_register_zbee_zcl_on_off |
3449 | | * DESCRIPTION |
3450 | | * ZigBee ZCL OnOff cluster protocol registration routine. |
3451 | | * PARAMETERS |
3452 | | * none |
3453 | | * RETURNS |
3454 | | * void |
3455 | | *--------------------------------------------------------------- |
3456 | | */ |
3457 | | void |
3458 | | proto_register_zbee_zcl_on_off(void) |
3459 | 16 | { |
3460 | | /* Setup list of header fields */ |
3461 | 16 | static hf_register_info hf[] = { |
3462 | | |
3463 | 16 | { &hf_zbee_zcl_on_off_attr_id, |
3464 | 16 | { "Attribute", "zbee_zcl_general.onoff.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_on_off_attr_names), |
3465 | 16 | 0x00, NULL, HFILL } }, |
3466 | | |
3467 | 16 | { &hf_zbee_zcl_on_off_attr_onoff, |
3468 | 16 | { "On/off Control", "zbee_zcl_general.onoff.attr.onoff", FT_BOOLEAN, BASE_NONE, TFS(&tfs_on_off), |
3469 | 16 | 0x00, NULL, HFILL } }, |
3470 | | |
3471 | 16 | { &hf_zbee_zcl_on_off_attr_globalscenecontrol, |
3472 | 16 | { "Global Scene Control", "zbee_zcl_general.onoff.attr.globalscenecontrol", FT_BOOLEAN, BASE_NONE, NULL, |
3473 | 16 | 0x00, NULL, HFILL } }, |
3474 | | |
3475 | 16 | { &hf_zbee_zcl_on_off_attr_ontime, |
3476 | 16 | { "On Time", "zbee_zcl_general.onoff.attr.ontime", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms), |
3477 | 16 | 0x00, NULL, HFILL } }, |
3478 | | |
3479 | 16 | { &hf_zbee_zcl_on_off_attr_offwaittime, |
3480 | 16 | { "Off Wait Time", "zbee_zcl_general.onoff.attr.offwaittime", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms), |
3481 | 16 | 0x00, NULL, HFILL } }, |
3482 | | |
3483 | 16 | { &hf_zbee_zcl_on_off_attr_startuponoff, |
3484 | 16 | { "Startup On Off", "zbee_zcl_general.onoff.attr.startuponoff", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_zcl_on_off_startup_on_off_names), |
3485 | 16 | 0x00, NULL, HFILL } }, |
3486 | | |
3487 | 16 | { &hf_zbee_zcl_on_off_effect_identifier, |
3488 | 16 | { "Effect Identifier", "zbee_zcl_general.onoff.effect_identifier", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_zcl_on_off_effect_identifier_names), |
3489 | 16 | 0x00, NULL, HFILL } }, |
3490 | | |
3491 | 16 | { &hf_zbee_zcl_on_off_effect_variant_delayed_all_off, |
3492 | 16 | { "Effect Variant", "zbee_zcl_general.onoff.effect_variant", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_zcl_on_off_effect_variant_delayed_all_off_names), |
3493 | 16 | 0x00, NULL, HFILL } }, |
3494 | | |
3495 | 16 | { &hf_zbee_zcl_on_off_effect_variant_dying_light, |
3496 | 16 | { "Effect Variant", "zbee_zcl_general.onoff.effect_variant", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_zcl_on_off_effect_variant_dying_light_names), |
3497 | 16 | 0x00, NULL, HFILL } }, |
3498 | | |
3499 | 16 | { &hf_zbee_zcl_on_off_effect_variant_reserved, |
3500 | 16 | { "Effect Variant", "zbee_zcl_general.onoff.effect_variant", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_zcl_on_off_effect_variant_reserved_names), |
3501 | 16 | 0x00, NULL, HFILL } }, |
3502 | | |
3503 | 16 | { &hf_zbee_zcl_on_off_timed_off_control_mask, |
3504 | 16 | { "On/Off Control Mask", "zbee_zcl_general.onoff.onoff_control_mask", FT_UINT8, BASE_HEX, NULL, |
3505 | 16 | 0x00, NULL, HFILL } }, |
3506 | | |
3507 | 16 | { &hf_zbee_zcl_on_off_timed_off_control_mask_accept_only_when_on, |
3508 | 16 | { "Accept Only When On", "zbee_zcl_general.onoff.onoff_control_mask.accept_only_when_on", FT_UINT8, BASE_DEC, NULL, |
3509 | 16 | ZBEE_ZCL_ON_OFF_TIMED_OFF_CONTROL_MASK_ACCEPT_ONLY_WHEN_ON, NULL, HFILL } }, |
3510 | | |
3511 | 16 | { &hf_zbee_zcl_on_off_timed_off_control_mask_reserved, |
3512 | 16 | { "Reserved", "zbee_zcl_general.onoff.onoff_control_mask.reserved", FT_UINT8, BASE_DEC, NULL, |
3513 | 16 | ZBEE_ZCL_ON_OFF_TIMED_OFF_CONTROL_MASK_RESERVED, NULL, HFILL } }, |
3514 | | |
3515 | 16 | { &hf_zbee_zcl_on_off_srv_rx_cmd_id, |
3516 | 16 | { "Command", "zbee_zcl_general.onoff.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_on_off_srv_rx_cmd_names), |
3517 | 16 | 0x00, NULL, HFILL } } |
3518 | | |
3519 | 16 | }; |
3520 | | |
3521 | | /* ZCL OnOff subtrees */ |
3522 | 16 | static int *ett[] = { &ett_zbee_zcl_on_off, |
3523 | 16 | &ett_zbee_zcl_on_off_timed_off_control_mask }; |
3524 | | |
3525 | | /* Register the ZigBee ZCL OnOff cluster protocol name and description */ |
3526 | 16 | proto_zbee_zcl_on_off = proto_register_protocol("ZigBee ZCL OnOff", "ZCL OnOff", ZBEE_PROTOABBREV_ZCL_ONOFF); |
3527 | 16 | proto_register_field_array(proto_zbee_zcl_on_off, hf, array_length(hf)); |
3528 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
3529 | | |
3530 | | /* Register the ZigBee ZCL OnOff dissector. */ |
3531 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_ONOFF, dissect_zbee_zcl_on_off, proto_zbee_zcl_on_off); |
3532 | 16 | } /* proto_register_zbee_zcl_on_off */ |
3533 | | |
3534 | | /*FUNCTION:------------------------------------------------------ |
3535 | | * NAME |
3536 | | * proto_reg_handoff_zbee_zcl_on_off |
3537 | | * DESCRIPTION |
3538 | | * Hands off the Zcl OnOff cluster dissector. |
3539 | | * PARAMETERS |
3540 | | * none |
3541 | | * RETURNS |
3542 | | * void |
3543 | | *--------------------------------------------------------------- |
3544 | | */ |
3545 | | void |
3546 | | proto_reg_handoff_zbee_zcl_on_off(void) |
3547 | 16 | { |
3548 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ONOFF, |
3549 | 16 | proto_zbee_zcl_on_off, |
3550 | 16 | ett_zbee_zcl_on_off, |
3551 | 16 | ZBEE_ZCL_CID_ON_OFF, |
3552 | 16 | ZBEE_MFG_CODE_NONE, |
3553 | 16 | hf_zbee_zcl_on_off_attr_id, |
3554 | 16 | hf_zbee_zcl_on_off_attr_id, |
3555 | 16 | hf_zbee_zcl_on_off_srv_rx_cmd_id, |
3556 | 16 | -1, |
3557 | 16 | dissect_zcl_on_off_attr_data |
3558 | 16 | ); |
3559 | 16 | } /*proto_reg_handoff_zbee_zcl_on_off*/ |
3560 | | |
3561 | | /* ############################################################################################### */ |
3562 | | /* #### (0x0007) ON/OFF SWITCH CONFIGURATION CLUSTER ############################################# */ |
3563 | | /* ############################################################################################### */ |
3564 | | |
3565 | | /*************************/ |
3566 | | /* Defines */ |
3567 | | /*************************/ |
3568 | | |
3569 | | /* Attributes */ |
3570 | 275 | #define ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_TYPE 0x0000 /* Switch Type */ |
3571 | 11 | #define ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_ACTIONS 0x0010 /* Switch Actions */ |
3572 | | |
3573 | | /* No Server Commands Received */ |
3574 | | |
3575 | | /*************************/ |
3576 | | /* Function Declarations */ |
3577 | | /*************************/ |
3578 | | |
3579 | | void proto_register_zbee_zcl_on_off_switch_configuration(void); |
3580 | | void proto_reg_handoff_zbee_zcl_on_off_switch_configuration(void); |
3581 | | |
3582 | | /* Private functions prototype */ |
3583 | | |
3584 | | /*************************/ |
3585 | | /* Global Variables */ |
3586 | | /*************************/ |
3587 | | |
3588 | | /* Initialize the protocol and registered fields */ |
3589 | | static int proto_zbee_zcl_on_off_switch_configuration; |
3590 | | |
3591 | | static int hf_zbee_zcl_on_off_switch_configuration_attr_id; |
3592 | | static int hf_zbee_zcl_on_off_switch_configuration_attr_switch_type; |
3593 | | static int hf_zbee_zcl_on_off_switch_configuration_attr_switch_actions; |
3594 | | |
3595 | | /* Initialize the subtree pointers */ |
3596 | | static int ett_zbee_zcl_on_off_switch_configuration; |
3597 | | |
3598 | | /* Attributes */ |
3599 | | static const value_string zbee_zcl_on_off_switch_configuration_attr_names[] = { |
3600 | | { ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_TYPE, "Switch Type" }, |
3601 | | { ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_ACTIONS, "Switch Actions" }, |
3602 | | { 0, NULL } |
3603 | | }; |
3604 | | |
3605 | | /* Switch Type Names */ |
3606 | | static const value_string zbee_zcl_on_off_switch_configuration_switch_type_names[] = { |
3607 | | { 0x00, "Toggle" }, |
3608 | | { 0x01, "Momentary" }, |
3609 | | { 0, NULL } |
3610 | | }; |
3611 | | |
3612 | | /* Switch Actions Names */ |
3613 | | static const value_string zbee_zcl_on_off_switch_configuration_switch_actions_names[] = { |
3614 | | { 0x00, "On" }, |
3615 | | { 0x01, "Off" }, |
3616 | | { 0x02, "Toggle" }, |
3617 | | { 0, NULL } |
3618 | | }; |
3619 | | |
3620 | | /*************************/ |
3621 | | /* Function Bodies */ |
3622 | | /*************************/ |
3623 | | |
3624 | | /*FUNCTION:------------------------------------------------------ |
3625 | | * NAME |
3626 | | * dissect_zbee_zcl_on_off_switch_configuration |
3627 | | * DESCRIPTION |
3628 | | * ZigBee ZCL OnOff Switch Configuration cluster dissector for wireshark. |
3629 | | * PARAMETERS |
3630 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
3631 | | * packet_info *pinfo - pointer to packet information fields |
3632 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
3633 | | * RETURNS |
3634 | | * int - length of parsed data. |
3635 | | *--------------------------------------------------------------- |
3636 | | */ |
3637 | | static int |
3638 | | dissect_zbee_zcl_on_off_switch_configuration(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) |
3639 | 104 | { |
3640 | 104 | return tvb_captured_length(tvb); |
3641 | 104 | } /*dissect_zbee_zcl_on_off_switch_configuration*/ |
3642 | | |
3643 | | |
3644 | | /*FUNCTION:------------------------------------------------------ |
3645 | | * NAME |
3646 | | * dissect_zcl_on_off_switch_configuration_attr_data |
3647 | | * DESCRIPTION |
3648 | | * this function is called by ZCL foundation dissector in order to decode |
3649 | | * specific cluster attributes data. |
3650 | | * PARAMETERS |
3651 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
3652 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
3653 | | * unsigned *offset - pointer to buffer offset |
3654 | | * uint16_t attr_id - attribute identifier |
3655 | | * unsigned data_type - attribute data type |
3656 | | * bool client_attr- ZCL client |
3657 | | * RETURNS |
3658 | | * none |
3659 | | *--------------------------------------------------------------- |
3660 | | */ |
3661 | | static void |
3662 | | dissect_zcl_on_off_switch_configuration_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
3663 | 1.11k | { |
3664 | | /* Dissect attribute data type and data */ |
3665 | 1.11k | switch (attr_id) { |
3666 | | |
3667 | 275 | case ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_TYPE: |
3668 | 275 | proto_tree_add_item(tree, hf_zbee_zcl_on_off_switch_configuration_attr_switch_type, tvb, *offset, 1, ENC_NA); |
3669 | 275 | *offset += 1; |
3670 | 275 | break; |
3671 | | |
3672 | 11 | case ZBEE_ZCL_ON_OFF_SWITCH_CONFIGURATION_ATTR_ID_SWITCH_ACTIONS: |
3673 | 11 | proto_tree_add_item(tree, hf_zbee_zcl_on_off_switch_configuration_attr_switch_actions, tvb, *offset, 1, ENC_NA); |
3674 | 11 | *offset += 1; |
3675 | 11 | break; |
3676 | | |
3677 | 826 | default: |
3678 | 826 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
3679 | 826 | break; |
3680 | 1.11k | } |
3681 | | |
3682 | 1.11k | } /*dissect_zcl_on_off_switch_configuration_attr_data*/ |
3683 | | |
3684 | | |
3685 | | /*FUNCTION:------------------------------------------------------ |
3686 | | * NAME |
3687 | | * proto_register_zbee_zcl_on_off_switch_configuration |
3688 | | * DESCRIPTION |
3689 | | * ZigBee ZCL OnOff cluster protocol registration routine. |
3690 | | * PARAMETERS |
3691 | | * none |
3692 | | * RETURNS |
3693 | | * void |
3694 | | *--------------------------------------------------------------- |
3695 | | */ |
3696 | | void |
3697 | | proto_register_zbee_zcl_on_off_switch_configuration(void) |
3698 | 16 | { |
3699 | | /* Setup list of header fields */ |
3700 | 16 | static hf_register_info hf[] = { |
3701 | | |
3702 | 16 | { &hf_zbee_zcl_on_off_switch_configuration_attr_id, |
3703 | 16 | { "Attribute", "zbee_zcl_general.onoff_switch_configuration.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_on_off_switch_configuration_attr_names), |
3704 | 16 | 0x00, NULL, HFILL } }, |
3705 | | |
3706 | 16 | { &hf_zbee_zcl_on_off_switch_configuration_attr_switch_type, |
3707 | 16 | { "Switch Type", "zbee_zcl_general.onoff.attr.switch_type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_on_off_switch_configuration_switch_type_names), |
3708 | 16 | 0x00, NULL, HFILL } }, |
3709 | | |
3710 | 16 | { &hf_zbee_zcl_on_off_switch_configuration_attr_switch_actions, |
3711 | 16 | { "Switch Action", "zbee_zcl_general.onoff.attr.switch_actions", FT_UINT8, BASE_HEX, VALS(zbee_zcl_on_off_switch_configuration_switch_actions_names), |
3712 | 16 | 0x00, NULL, HFILL } } |
3713 | | |
3714 | 16 | }; |
3715 | | |
3716 | | /* ZCL Identify subtrees */ |
3717 | 16 | static int *ett[] = { |
3718 | 16 | &ett_zbee_zcl_on_off_switch_configuration |
3719 | 16 | }; |
3720 | | |
3721 | | /* Register the ZigBee ZCL OnOff Switch Configuration cluster protocol name and description */ |
3722 | 16 | 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); |
3723 | 16 | proto_register_field_array(proto_zbee_zcl_on_off_switch_configuration, hf, array_length(hf)); |
3724 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
3725 | | |
3726 | | /* Register the ZigBee ZCL OnOff dissector. */ |
3727 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_ONOFF_SWITCH_CONFIG, dissect_zbee_zcl_on_off_switch_configuration, proto_zbee_zcl_on_off_switch_configuration); |
3728 | 16 | } /* proto_register_zbee_zcl_on_off_switch_configuration */ |
3729 | | |
3730 | | /*FUNCTION:------------------------------------------------------ |
3731 | | * NAME |
3732 | | * proto_reg_handoff_zbee_zcl_on_off_switch_configuration |
3733 | | * DESCRIPTION |
3734 | | * Hands off the Zcl OnOff cluster dissector. |
3735 | | * PARAMETERS |
3736 | | * none |
3737 | | * RETURNS |
3738 | | * none |
3739 | | *--------------------------------------------------------------- |
3740 | | */ |
3741 | | void |
3742 | | proto_reg_handoff_zbee_zcl_on_off_switch_configuration(void) |
3743 | 16 | { |
3744 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ONOFF_SWITCH_CONFIG, |
3745 | 16 | proto_zbee_zcl_on_off_switch_configuration, |
3746 | 16 | ett_zbee_zcl_on_off_switch_configuration, |
3747 | 16 | ZBEE_ZCL_CID_ON_OFF_SWITCH_CONFIG, |
3748 | 16 | ZBEE_MFG_CODE_NONE, |
3749 | 16 | hf_zbee_zcl_on_off_switch_configuration_attr_id, |
3750 | 16 | hf_zbee_zcl_on_off_switch_configuration_attr_id, |
3751 | 16 | -1, -1, |
3752 | 16 | dissect_zcl_on_off_switch_configuration_attr_data |
3753 | 16 | ); |
3754 | 16 | } /*proto_reg_handoff_zbee_zcl_on_off_switch_configuration*/ |
3755 | | |
3756 | | /* ########################################################################## */ |
3757 | | /* #### (0x0009) ALARMS CLUSTER ############################################# */ |
3758 | | /* ########################################################################## */ |
3759 | | |
3760 | | /*************************/ |
3761 | | /* Defines */ |
3762 | | /*************************/ |
3763 | | |
3764 | | /* Attributes */ |
3765 | 34 | #define ZBEE_ZCL_ATTR_ID_ALARMS_ALARM_COUNT 0x0000 /* Alarm Count */ |
3766 | | |
3767 | | /* Server Commands Received */ |
3768 | 4 | #define ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM 0x00 /* Reset Alarm */ |
3769 | 1 | #define ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALL_ALARMS 0x01 /* Reset All Alarms */ |
3770 | 2 | #define ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM 0x02 /* Get Alarm */ |
3771 | 9 | #define ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM_LOG 0x03 /* Reset Alarm Log */ |
3772 | | |
3773 | | /* Server Commands Generated */ |
3774 | 4 | #define ZBEE_ZCL_CMD_ID_ALARMS_ALARM 0x00 /* Alarm */ |
3775 | 2 | #define ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM_RESPONSE 0x01 /* Get Alarm Response */ |
3776 | | |
3777 | | /*************************/ |
3778 | | /* Function Declarations */ |
3779 | | /*************************/ |
3780 | | |
3781 | | void proto_register_zbee_zcl_alarms(void); |
3782 | | void proto_reg_handoff_zbee_zcl_alarms(void); |
3783 | | |
3784 | | /* Private functions prototype */ |
3785 | | |
3786 | | /*************************/ |
3787 | | /* Global Variables */ |
3788 | | /*************************/ |
3789 | | /* Initialize the protocol and registered fields */ |
3790 | | static int proto_zbee_zcl_alarms; |
3791 | | |
3792 | | static int hf_zbee_zcl_alarms_attr_id; |
3793 | | static int hf_zbee_zcl_alarms_alarm_code; |
3794 | | static int hf_zbee_zcl_alarms_cluster_id; |
3795 | | static int hf_zbee_zcl_alarms_status; |
3796 | | static int hf_zbee_zcl_alarms_timestamp; |
3797 | | static int hf_zbee_zcl_alarms_srv_rx_cmd_id; |
3798 | | static int hf_zbee_zcl_alarms_srv_tx_cmd_id; |
3799 | | |
3800 | | /* Initialize the subtree pointers */ |
3801 | | static int ett_zbee_zcl_alarms; |
3802 | | |
3803 | | /* Attributes */ |
3804 | | static const value_string zbee_zcl_alarms_attr_names[] = { |
3805 | | { ZBEE_ZCL_ATTR_ID_ALARMS_ALARM_COUNT, "Alarm Count" }, |
3806 | | { 0, NULL } |
3807 | | }; |
3808 | | |
3809 | | /* Server Commands Received */ |
3810 | | static const value_string zbee_zcl_alarms_srv_rx_cmd_names[] = { |
3811 | | { ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM, "Reset Alarm" }, |
3812 | | { ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALL_ALARMS, "Reset All Alarms" }, |
3813 | | { ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM, "Get Alarm" }, |
3814 | | { ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM_LOG, "Reset Alarm Log" }, |
3815 | | { 0, NULL } |
3816 | | }; |
3817 | | |
3818 | | /* Server Commands Generated */ |
3819 | | static const value_string zbee_zcl_alarms_srv_tx_cmd_names[] = { |
3820 | | { ZBEE_ZCL_CMD_ID_ALARMS_ALARM, "Alarm" }, |
3821 | | { ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM_RESPONSE,"Get Alarm Response" }, |
3822 | | { 0, NULL } |
3823 | | }; |
3824 | | |
3825 | | /*************************/ |
3826 | | /* Function Bodies */ |
3827 | | /*************************/ |
3828 | | |
3829 | | /*FUNCTION:------------------------------------------------------ |
3830 | | * NAME |
3831 | | * dissect_zcl_alarms_attr_data |
3832 | | * DESCRIPTION |
3833 | | * this function is called by ZCL foundation dissector in order to decode |
3834 | | * specific cluster attributes data. |
3835 | | * PARAMETERS |
3836 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
3837 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
3838 | | * unsigned *offset - pointer to buffer offset |
3839 | | * uint16_t attr_id - attribute identifier |
3840 | | * unsigned data_type - attribute data type |
3841 | | * bool client_attr- ZCL client |
3842 | | * RETURNS |
3843 | | * none |
3844 | | *--------------------------------------------------------------- */ |
3845 | | static void |
3846 | | dissect_zcl_alarms_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
3847 | 308 | { |
3848 | | /* Dissect attribute data type and data */ |
3849 | 308 | switch ( attr_id ) { |
3850 | 34 | case ZBEE_ZCL_ATTR_ID_ALARMS_ALARM_COUNT: |
3851 | 308 | default: |
3852 | 308 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
3853 | 308 | break; |
3854 | 308 | } |
3855 | | |
3856 | 308 | } /*dissect_zcl_alarms_attr_data*/ |
3857 | | |
3858 | | /*FUNCTION:------------------------------------------------------ |
3859 | | * NAME |
3860 | | * dissect_zcl_alarms_alarm_and_reset_alarm |
3861 | | * DESCRIPTION |
3862 | | * this function decodes the Alarm and Reset Alarm payload. |
3863 | | * PARAMETERS |
3864 | | * tvb - the tv buffer of the current data_type |
3865 | | * tree - the tree to append this item to |
3866 | | * offset - offset of data in tvb |
3867 | | * RETURNS |
3868 | | * none |
3869 | | *--------------------------------------------------------------- |
3870 | | */ |
3871 | | static void |
3872 | | dissect_zcl_alarms_alarm_and_reset_alarm(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
3873 | 8 | { |
3874 | | /* Retrieve "Alarm Code" field */ |
3875 | 8 | proto_tree_add_item(tree, hf_zbee_zcl_alarms_alarm_code, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
3876 | 8 | *offset += 1; |
3877 | | |
3878 | | /* Retrieve "Cluster ID" field */ |
3879 | 8 | proto_tree_add_item(tree, hf_zbee_zcl_alarms_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
3880 | 8 | *offset += 2; |
3881 | | |
3882 | 8 | } /*dissect_zcl_alarms_alarm_and_reset_alarm*/ |
3883 | | |
3884 | | |
3885 | | /*FUNCTION:-------------------------------------------------------------------- |
3886 | | * NAME |
3887 | | * dissect_zcl_alarms_get_alarm_response |
3888 | | * DESCRIPTION |
3889 | | * this function decodes the Get Alarm Response payload |
3890 | | * PARAMETERS |
3891 | | * tvb - the tv buffer of the current data_type |
3892 | | * tree - the tree to append this item to |
3893 | | * offset - offset of data in tvb |
3894 | | * RETURNS |
3895 | | * none |
3896 | | *------------------------------------------------------------------------------ |
3897 | | */ |
3898 | | |
3899 | | static void |
3900 | | dissect_zcl_alarms_get_alarm_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
3901 | 2 | { |
3902 | 2 | uint8_t status; |
3903 | | |
3904 | | /* Retrieve "Status" field */ |
3905 | 2 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_alarms_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN, &status); |
3906 | 2 | *offset += 1; |
3907 | | |
3908 | 2 | if(status == ZBEE_ZCL_STAT_SUCCESS) |
3909 | 1 | { |
3910 | | /* Retrieve "Alarm Code" field */ |
3911 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_alarms_alarm_code, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
3912 | 1 | *offset += 1; |
3913 | | |
3914 | | /* Retrieve "Cluster ID" field */ |
3915 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_alarms_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
3916 | 1 | *offset += 2; |
3917 | | |
3918 | | /* Retrieve "Timestamp" field */ |
3919 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_alarms_timestamp, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
3920 | 1 | *offset += 4; |
3921 | 1 | } |
3922 | | |
3923 | 2 | } /*dissect_zcl_alarms_get_alarm_response*/ |
3924 | | |
3925 | | |
3926 | | |
3927 | | /*FUNCTION:------------------------------------------------------ |
3928 | | * NAME |
3929 | | * dissect_zbee_zcl_alarms |
3930 | | * DESCRIPTION |
3931 | | * ZigBee ZCL Alarms cluster dissector for wireshark. |
3932 | | * PARAMETERS |
3933 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
3934 | | * packet_info *pinfo - pointer to packet information fields |
3935 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
3936 | | * RETURNS |
3937 | | * none |
3938 | | *--------------------------------------------------------------- |
3939 | | */ |
3940 | | static int |
3941 | | dissect_zbee_zcl_alarms(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) |
3942 | 92 | { |
3943 | 92 | proto_tree *payload_tree; |
3944 | 92 | zbee_zcl_packet *zcl; |
3945 | 92 | unsigned offset = 0; |
3946 | 92 | uint8_t cmd_id; |
3947 | 92 | int rem_len; |
3948 | | |
3949 | | /* Reject the packet if data is NULL */ |
3950 | 92 | if (data == NULL) |
3951 | 0 | return 0; |
3952 | 92 | zcl = (zbee_zcl_packet *)data; |
3953 | 92 | cmd_id = zcl->cmd_id; |
3954 | | |
3955 | | /* Create a subtree for the ZCL Command frame, and add the command ID to it. */ |
3956 | 92 | if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { |
3957 | | /* Append the command name to the info column. */ |
3958 | 42 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
3959 | 42 | val_to_str_const(cmd_id, zbee_zcl_alarms_srv_rx_cmd_names, "Unknown Command"), |
3960 | 42 | zcl->tran_seqno); |
3961 | | |
3962 | | /* Add the command ID. */ |
3963 | 42 | proto_tree_add_item(tree, hf_zbee_zcl_alarms_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
3964 | | |
3965 | | /* Check if this command has a payload, then add the payload tree */ |
3966 | 42 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
3967 | 42 | if (rem_len > 0) { |
3968 | 38 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_alarms, NULL, "Payload"); |
3969 | | |
3970 | | /* Call the appropriate command dissector */ |
3971 | 38 | switch (cmd_id) { |
3972 | 4 | case ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM: |
3973 | 4 | dissect_zcl_alarms_alarm_and_reset_alarm(tvb, payload_tree, &offset); |
3974 | 4 | break; |
3975 | | |
3976 | 1 | case ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALL_ALARMS: |
3977 | 2 | case ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM: |
3978 | 9 | case ZBEE_ZCL_CMD_ID_ALARMS_RESET_ALARM_LOG: |
3979 | | /* No Payload */ |
3980 | 34 | default: |
3981 | 34 | break; |
3982 | 38 | } |
3983 | 38 | } |
3984 | 42 | } |
3985 | 50 | else { /* ZBEE_ZCL_FCF_TO_CLIENT */ |
3986 | | /* Append the command name to the info column. */ |
3987 | 50 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
3988 | 50 | val_to_str_const(cmd_id, zbee_zcl_alarms_srv_tx_cmd_names, "Unknown Command"), |
3989 | 50 | zcl->tran_seqno); |
3990 | | |
3991 | | /* Add the command ID. */ |
3992 | 50 | proto_tree_add_item(tree, hf_zbee_zcl_alarms_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
3993 | | |
3994 | | /* Check if this command has a payload, then add the payload tree */ |
3995 | 50 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
3996 | 50 | if (rem_len > 0) { |
3997 | 48 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_alarms, NULL, "Payload"); |
3998 | | |
3999 | | /* Call the appropriate command dissector */ |
4000 | 48 | switch (cmd_id) { |
4001 | 4 | case ZBEE_ZCL_CMD_ID_ALARMS_ALARM: |
4002 | 4 | dissect_zcl_alarms_alarm_and_reset_alarm(tvb, payload_tree, &offset); |
4003 | 4 | break; |
4004 | | |
4005 | 2 | case ZBEE_ZCL_CMD_ID_ALARMS_GET_ALARM_RESPONSE: |
4006 | 2 | dissect_zcl_alarms_get_alarm_response(tvb, payload_tree, &offset); |
4007 | 2 | break; |
4008 | | |
4009 | 42 | default: |
4010 | 42 | break; |
4011 | 48 | } |
4012 | 48 | } |
4013 | 50 | } |
4014 | | |
4015 | 92 | return tvb_captured_length(tvb); |
4016 | 92 | } /*dissect_zbee_zcl_alarms*/ |
4017 | | |
4018 | | |
4019 | | |
4020 | | |
4021 | | |
4022 | | /*FUNCTION:------------------------------------------------------ |
4023 | | * NAME |
4024 | | * proto_register_zbee_zcl_alarms |
4025 | | * DESCRIPTION |
4026 | | * ZigBee ZCL Alarms cluster protocol registration routine. |
4027 | | * PARAMETERS |
4028 | | * none |
4029 | | * RETURNS |
4030 | | * void |
4031 | | *--------------------------------------------------------------- |
4032 | | */ |
4033 | | void |
4034 | | proto_register_zbee_zcl_alarms(void) |
4035 | 16 | { |
4036 | | /* Setup list of header fields */ |
4037 | 16 | static hf_register_info hf[] = { |
4038 | | |
4039 | 16 | { &hf_zbee_zcl_alarms_attr_id, |
4040 | 16 | { "Attribute", "zbee_zcl_general.alarms.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_alarms_attr_names), |
4041 | 16 | 0x00, NULL, HFILL } }, |
4042 | | |
4043 | 16 | { &hf_zbee_zcl_alarms_alarm_code, |
4044 | 16 | { "Alarm Code", "zbee_zcl_general.alarms.alarm_code", FT_UINT8, BASE_HEX, NULL, |
4045 | 16 | 0x00, NULL, HFILL } }, |
4046 | | |
4047 | 16 | { &hf_zbee_zcl_alarms_cluster_id, |
4048 | 16 | { "Cluster ID", "zbee_zcl_general.alarms.cluster_id", FT_UINT16, BASE_HEX, NULL, |
4049 | 16 | 0x00, NULL, HFILL } }, |
4050 | | |
4051 | 16 | { &hf_zbee_zcl_alarms_status, |
4052 | 16 | { "Status", "zbee_zcl_general.alarms.status", FT_UINT8, BASE_DEC, VALS(zbee_zcl_status_names), |
4053 | 16 | 0x00, NULL, HFILL } }, |
4054 | | |
4055 | 16 | { &hf_zbee_zcl_alarms_timestamp, |
4056 | 16 | { "Timestamp", "zbee_zcl_general.alarms.timestamp", FT_UINT32, BASE_HEX, NULL, |
4057 | 16 | 0x00, NULL, HFILL } }, |
4058 | | |
4059 | 16 | { &hf_zbee_zcl_alarms_srv_rx_cmd_id, |
4060 | 16 | { "Command", "zbee_zcl_general.alarms.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_alarms_srv_rx_cmd_names), |
4061 | 16 | 0x00, NULL, HFILL } }, |
4062 | | |
4063 | 16 | { &hf_zbee_zcl_alarms_srv_tx_cmd_id, |
4064 | 16 | { "Command", "zbee_zcl_general.alarms.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_alarms_srv_tx_cmd_names), |
4065 | 16 | 0x00, NULL, HFILL } } |
4066 | | |
4067 | 16 | }; |
4068 | | |
4069 | | /* ZCL Alarms subtrees */ |
4070 | 16 | static int *ett[] = { |
4071 | 16 | &ett_zbee_zcl_alarms |
4072 | 16 | }; |
4073 | | |
4074 | | /* Register the ZigBee ZCL Alarms cluster protocol name and description */ |
4075 | 16 | proto_zbee_zcl_alarms = proto_register_protocol("ZigBee ZCL Alarms", "ZCL Alarms", ZBEE_PROTOABBREV_ZCL_ALARMS); |
4076 | 16 | proto_register_field_array(proto_zbee_zcl_alarms, hf, array_length(hf)); |
4077 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
4078 | | |
4079 | | /* Register the ZigBee ZCL Alarms dissector. */ |
4080 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_ALARMS, dissect_zbee_zcl_alarms, proto_zbee_zcl_alarms); |
4081 | | |
4082 | 16 | } /*proto_register_zbee_zcl_alarms*/ |
4083 | | |
4084 | | |
4085 | | /*FUNCTION:------------------------------------------------------ |
4086 | | * NAME |
4087 | | * proto_reg_handoff_zbee_zcl_alarms |
4088 | | * DESCRIPTION |
4089 | | * Hands off the ZCL Alarms dissector. |
4090 | | * PARAMETERS |
4091 | | * none |
4092 | | * RETURNS |
4093 | | * none |
4094 | | *--------------------------------------------------------------- |
4095 | | */ |
4096 | | void |
4097 | | proto_reg_handoff_zbee_zcl_alarms(void) |
4098 | 16 | { |
4099 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ALARMS, |
4100 | 16 | proto_zbee_zcl_alarms, |
4101 | 16 | ett_zbee_zcl_alarms, |
4102 | 16 | ZBEE_ZCL_CID_ALARMS, |
4103 | 16 | ZBEE_MFG_CODE_NONE, |
4104 | 16 | hf_zbee_zcl_alarms_attr_id, |
4105 | 16 | hf_zbee_zcl_alarms_attr_id, |
4106 | 16 | hf_zbee_zcl_alarms_srv_rx_cmd_id, |
4107 | 16 | hf_zbee_zcl_alarms_srv_tx_cmd_id, |
4108 | 16 | dissect_zcl_alarms_attr_data |
4109 | 16 | ); |
4110 | 16 | } /*proto_reg_handoff_zbee_zcl_alarms*/ |
4111 | | |
4112 | | |
4113 | | /* ########################################################################## */ |
4114 | | /* #### (0x000A) TIME CLUSTER ############################################### */ |
4115 | | /* ########################################################################## */ |
4116 | | |
4117 | | /*************************/ |
4118 | | /* Defines */ |
4119 | | /*************************/ |
4120 | | |
4121 | | /* Attributes */ |
4122 | 62 | #define ZBEE_ZCL_ATTR_ID_TIME_TIME 0x0000 /* Time */ |
4123 | 19 | #define ZBEE_ZCL_ATTR_ID_TIME_TIME_STATUS 0x0001 /* Time Status */ |
4124 | 62 | #define ZBEE_ZCL_ATTR_ID_TIME_TIME_ZONE 0x0002 /* Time Zone */ |
4125 | 62 | #define ZBEE_ZCL_ATTR_ID_TIME_DST_START 0x0003 /* Daylight Saving Time Start*/ |
4126 | 62 | #define ZBEE_ZCL_ATTR_ID_TIME_DST_END 0x0004 /* Daylight Saving Time End */ |
4127 | 62 | #define ZBEE_ZCL_ATTR_ID_TIME_DST_SHIFT 0x0005 /* Daylight Saving Time Shift */ |
4128 | 62 | #define ZBEE_ZCL_ATTR_ID_TIME_STD_TIME 0x0006 /* Standard Time */ |
4129 | 62 | #define ZBEE_ZCL_ATTR_ID_TIME_LOCAL_TIME 0x0007 /* Local Time */ |
4130 | 62 | #define ZBEE_ZCL_ATTR_ID_TIME_LAST_SET_TIME 0x0008 /* Last Set Time */ |
4131 | 62 | #define ZBEE_ZCL_ATTR_ID_TIME_VALID_UNTIL_TIME 0x0009 /* Valid Until Time */ |
4132 | | |
4133 | | /* Server commands received - none */ |
4134 | | |
4135 | | /* Server commands generated - none */ |
4136 | | |
4137 | | /* Time Status Mask Value */ |
4138 | 16 | #define ZBEE_ZCL_TIME_MASTER 0x01 /* Master Clock */ |
4139 | 16 | #define ZBEE_ZCL_TIME_SYNCHRONIZED 0x02 /* Synchronized */ |
4140 | 16 | #define ZBEE_ZCL_TIME_MASTER_ZONE_DST 0x04 /* Master for Time Zone and DST */ |
4141 | 16 | #define ZBEE_ZCL_TIME_SUPERSEDING 0x08 /* Superseded */ |
4142 | | |
4143 | | /*************************/ |
4144 | | /* Function Declarations */ |
4145 | | /*************************/ |
4146 | | |
4147 | | void proto_register_zbee_zcl_time(void); |
4148 | | void proto_reg_handoff_zbee_zcl_time(void); |
4149 | | |
4150 | | |
4151 | | /*************************/ |
4152 | | /* Global Variables */ |
4153 | | /*************************/ |
4154 | | /* Initialize the protocol and registered fields */ |
4155 | | static int proto_zbee_zcl_time; |
4156 | | |
4157 | | static int hf_zbee_zcl_time_attr_id; |
4158 | | static int hf_zbee_zcl_time_status; |
4159 | | static int hf_zbee_zcl_time_status_master; |
4160 | | static int hf_zbee_zcl_time_status_synchronized; |
4161 | | static int hf_zbee_zcl_time_status_master_zone_dst; |
4162 | | static int hf_zbee_zcl_time_status_superseding; |
4163 | | |
4164 | | /* Initialize the subtree pointers */ |
4165 | | static int ett_zbee_zcl_time; |
4166 | | static int ett_zbee_zcl_time_status_mask; |
4167 | | |
4168 | | /* Attributes */ |
4169 | | static const value_string zbee_zcl_time_attr_names[] = { |
4170 | | { ZBEE_ZCL_ATTR_ID_TIME_TIME, "Time" }, |
4171 | | { ZBEE_ZCL_ATTR_ID_TIME_TIME_STATUS, "Time Status" }, |
4172 | | { ZBEE_ZCL_ATTR_ID_TIME_TIME_ZONE, "Time Zone" }, |
4173 | | { ZBEE_ZCL_ATTR_ID_TIME_DST_START, "Daylight Saving Time Start" }, |
4174 | | { ZBEE_ZCL_ATTR_ID_TIME_DST_END, "Daylight Saving Time End" }, |
4175 | | { ZBEE_ZCL_ATTR_ID_TIME_DST_SHIFT, "Daylight Saving Time Shift" }, |
4176 | | { ZBEE_ZCL_ATTR_ID_TIME_STD_TIME, "Standard Time" }, |
4177 | | { ZBEE_ZCL_ATTR_ID_TIME_LOCAL_TIME, "Local Time" }, |
4178 | | { ZBEE_ZCL_ATTR_ID_TIME_LAST_SET_TIME, "Last Set Time" }, |
4179 | | { ZBEE_ZCL_ATTR_ID_TIME_VALID_UNTIL_TIME, "Valid Until Time" }, |
4180 | | { 0, NULL } |
4181 | | }; |
4182 | | |
4183 | | /*************************/ |
4184 | | /* Function Bodies */ |
4185 | | /*************************/ |
4186 | | |
4187 | | /*FUNCTION:------------------------------------------------------ |
4188 | | * NAME |
4189 | | * dissect_zcl_time_attr_data |
4190 | | * DESCRIPTION |
4191 | | * this function is called by ZCL foundation dissector in order to decode |
4192 | | * specific cluster attributes data. |
4193 | | * PARAMETERS |
4194 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
4195 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
4196 | | * unsigned *offset - pointer to buffer offset |
4197 | | * uint16_t attr_id - attribute identifier |
4198 | | * unsigned data_type - attribute data type |
4199 | | * bool client_attr- ZCL client |
4200 | | * RETURNS |
4201 | | * none |
4202 | | *--------------------------------------------------------------- */ |
4203 | | static void |
4204 | | dissect_zcl_time_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
4205 | 336 | { |
4206 | 336 | static int * const time_status_mask[] = { |
4207 | 336 | &hf_zbee_zcl_time_status_master, |
4208 | 336 | &hf_zbee_zcl_time_status_synchronized, |
4209 | 336 | &hf_zbee_zcl_time_status_master_zone_dst, |
4210 | 336 | &hf_zbee_zcl_time_status_superseding, |
4211 | 336 | NULL |
4212 | 336 | }; |
4213 | | |
4214 | | /* Dissect attribute data type and data */ |
4215 | 336 | switch (attr_id) { |
4216 | | |
4217 | 19 | case ZBEE_ZCL_ATTR_ID_TIME_TIME_STATUS: |
4218 | 19 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_time_status, ett_zbee_zcl_time_status_mask, time_status_mask, ENC_LITTLE_ENDIAN); |
4219 | 19 | *offset += 1; |
4220 | 19 | break; |
4221 | | |
4222 | 62 | case ZBEE_ZCL_ATTR_ID_TIME_TIME: |
4223 | 62 | case ZBEE_ZCL_ATTR_ID_TIME_TIME_ZONE: |
4224 | 62 | case ZBEE_ZCL_ATTR_ID_TIME_DST_START: |
4225 | 62 | case ZBEE_ZCL_ATTR_ID_TIME_DST_END: |
4226 | 62 | case ZBEE_ZCL_ATTR_ID_TIME_DST_SHIFT: |
4227 | 62 | case ZBEE_ZCL_ATTR_ID_TIME_STD_TIME: |
4228 | 62 | case ZBEE_ZCL_ATTR_ID_TIME_LOCAL_TIME: |
4229 | 62 | case ZBEE_ZCL_ATTR_ID_TIME_LAST_SET_TIME: |
4230 | 62 | case ZBEE_ZCL_ATTR_ID_TIME_VALID_UNTIL_TIME: |
4231 | 317 | default: |
4232 | 317 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
4233 | 317 | break; |
4234 | 336 | } |
4235 | | |
4236 | 336 | } /*dissect_zcl_time_attr_data*/ |
4237 | | /*FUNCTION:------------------------------------------------------ |
4238 | | * NAME |
4239 | | * dissect_zbee_zcl_time |
4240 | | * DESCRIPTION |
4241 | | * ZigBee ZCL Time cluster dissector for wireshark. |
4242 | | * PARAMETERS |
4243 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
4244 | | * packet_info *pinfo - pointer to packet information fields |
4245 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
4246 | | * RETURNS |
4247 | | * none |
4248 | | *--------------------------------------------------------------- |
4249 | | */ |
4250 | | |
4251 | | static int |
4252 | | dissect_zbee_zcl_time(tvbuff_t _U_ *tvb, packet_info _U_ * pinfo, proto_tree _U_* tree, void _U_* data) |
4253 | 2 | { |
4254 | | /* No commands is being received and generated by server |
4255 | | * No cluster specific commands are received by client |
4256 | | */ |
4257 | 2 | return 0; |
4258 | 2 | } /*dissect_zbee_zcl_time*/ |
4259 | | |
4260 | | /*FUNCTION:------------------------------------------------------ |
4261 | | * NAME |
4262 | | * proto_register_zbee_zcl_time |
4263 | | * DESCRIPTION |
4264 | | * ZigBee ZCL Time cluster protocol registration routine. |
4265 | | * PARAMETERS |
4266 | | * none |
4267 | | * RETURNS |
4268 | | * void |
4269 | | *--------------------------------------------------------------- |
4270 | | */ |
4271 | | void |
4272 | | proto_register_zbee_zcl_time(void) |
4273 | 16 | { |
4274 | | /* Setup list of header fields */ |
4275 | 16 | static hf_register_info hf[] = { |
4276 | | |
4277 | 16 | { &hf_zbee_zcl_time_attr_id, |
4278 | 16 | { "Attribute", "zbee_zcl_general.time.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_time_attr_names), |
4279 | 16 | 0x00, NULL, HFILL } }, |
4280 | | |
4281 | | /* start Time Status Mask fields */ |
4282 | 16 | { &hf_zbee_zcl_time_status, |
4283 | 16 | { "Time Status", "zbee_zcl_general.time.attr.time_status", FT_UINT8, BASE_HEX, NULL, |
4284 | 16 | 0x00, NULL, HFILL } }, |
4285 | | |
4286 | 16 | { &hf_zbee_zcl_time_status_master, |
4287 | 16 | { "Master", "zbee_zcl_general.time.attr.time_status.master", FT_BOOLEAN, 8, NULL, |
4288 | 16 | ZBEE_ZCL_TIME_MASTER, NULL, HFILL } }, |
4289 | | |
4290 | 16 | { &hf_zbee_zcl_time_status_synchronized, |
4291 | 16 | { "Synchronized", "zbee_zcl_general.time.attr.time_status.synchronized", FT_BOOLEAN, 8, NULL, |
4292 | 16 | ZBEE_ZCL_TIME_SYNCHRONIZED, NULL, HFILL } }, |
4293 | | |
4294 | 16 | { &hf_zbee_zcl_time_status_master_zone_dst, |
4295 | 16 | { "Master for Time Zone and DST", "zbee_zcl_general.time.attr.time_status.master_zone_dst", FT_BOOLEAN, 8, NULL, |
4296 | 16 | ZBEE_ZCL_TIME_MASTER_ZONE_DST, NULL, HFILL } }, |
4297 | | |
4298 | 16 | { &hf_zbee_zcl_time_status_superseding, |
4299 | 16 | { "Superseded", "zbee_zcl_general.time.attr.time_status.superseding", FT_BOOLEAN, 8, NULL, |
4300 | 16 | ZBEE_ZCL_TIME_SUPERSEDING, NULL, HFILL } } |
4301 | | /* end Time Status Mask fields */ |
4302 | 16 | }; |
4303 | | |
4304 | | /* ZCL Time subtrees */ |
4305 | 16 | static int *ett[] = { |
4306 | 16 | &ett_zbee_zcl_time, |
4307 | 16 | &ett_zbee_zcl_time_status_mask |
4308 | 16 | }; |
4309 | | |
4310 | | /* Register the ZigBee ZCL Time cluster protocol name and description */ |
4311 | 16 | proto_zbee_zcl_time = proto_register_protocol("ZigBee ZCL Time", "ZCL Time", ZBEE_PROTOABBREV_ZCL_TIME); |
4312 | 16 | proto_register_field_array(proto_zbee_zcl_time, hf, array_length(hf)); |
4313 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
4314 | | |
4315 | | /* Register the ZigBee ZCL Time dissector. */ |
4316 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_TIME, dissect_zbee_zcl_time, proto_zbee_zcl_time); |
4317 | 16 | } /*proto_register_zbee_zcl_time*/ |
4318 | | |
4319 | | /*FUNCTION:------------------------------------------------------ |
4320 | | * NAME |
4321 | | * proto_reg_handoff_zbee_zcl_time |
4322 | | * DESCRIPTION |
4323 | | * Hands off the ZCL Time dissector. |
4324 | | * PARAMETERS |
4325 | | * none |
4326 | | * RETURNS |
4327 | | * none |
4328 | | *--------------------------------------------------------------- |
4329 | | */ |
4330 | | void |
4331 | | proto_reg_handoff_zbee_zcl_time(void) |
4332 | 16 | { |
4333 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_TIME, |
4334 | 16 | proto_zbee_zcl_time, |
4335 | 16 | ett_zbee_zcl_time, |
4336 | 16 | ZBEE_ZCL_CID_TIME, |
4337 | 16 | ZBEE_MFG_CODE_NONE, |
4338 | 16 | hf_zbee_zcl_time_attr_id, |
4339 | 16 | hf_zbee_zcl_time_attr_id, |
4340 | 16 | -1, -1, |
4341 | 16 | dissect_zcl_time_attr_data |
4342 | 16 | ); |
4343 | 16 | } /*proto_reg_handoff_zbee_zcl_time*/ |
4344 | | |
4345 | | |
4346 | | |
4347 | | |
4348 | | /* ########################################################################## */ |
4349 | | /* #### (0x0008) LEVEL_CONTROL CLUSTER ###################################### */ |
4350 | | /* ########################################################################## */ |
4351 | | |
4352 | | /*************************/ |
4353 | | /* Defines */ |
4354 | | /*************************/ |
4355 | | |
4356 | | /* Attributes */ |
4357 | 197 | #define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_CURRENT_LEVEL 0x0000 /* Current Level */ |
4358 | 21 | #define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_REMAINING_TIME 0x0001 /* Remaining Time */ |
4359 | 11 | #define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ONOFF_TRANSIT_TIME 0x0010 /* OnOff Transition Time */ |
4360 | 23 | #define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ON_LEVEL 0x0011 /* On Level */ |
4361 | 2 | #define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_STARTUP_LEVEL 0x4000 /* Startup Level */ |
4362 | | |
4363 | | /* Server Commands Received */ |
4364 | 7 | #define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL 0x00 /* Move to Level */ |
4365 | 3 | #define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE 0x01 /* Move */ |
4366 | 17 | #define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP 0x02 /* Step */ |
4367 | 3 | #define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP 0x03 /* Stop */ |
4368 | 7 | #define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL_WITH_ONOFF 0x04 /* Move to Level with OnOff */ |
4369 | 3 | #define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_WITH_ONOFF 0x05 /* Move with OnOff */ |
4370 | 18 | #define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP_WITH_ONOFF 0x06 /* Step with OnOff */ |
4371 | 3 | #define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP_WITH_ONOFF 0x07 /* Stop with OnOff */ |
4372 | | |
4373 | | /*************************/ |
4374 | | /* Function Declarations */ |
4375 | | /*************************/ |
4376 | | |
4377 | | void proto_register_zbee_zcl_level_control(void); |
4378 | | void proto_reg_handoff_zbee_zcl_level_control(void); |
4379 | | |
4380 | | /* Private functions prototype */ |
4381 | | |
4382 | | /*************************/ |
4383 | | /* Global Variables */ |
4384 | | /*************************/ |
4385 | | /* Initialize the protocol and registered fields */ |
4386 | | static int proto_zbee_zcl_level_control; |
4387 | | |
4388 | | static int hf_zbee_zcl_level_control_attr_id; |
4389 | | static int hf_zbee_zcl_level_control_attr_current_level; |
4390 | | static int hf_zbee_zcl_level_control_attr_remaining_time; |
4391 | | static int hf_zbee_zcl_level_control_attr_onoff_transmit_time; |
4392 | | static int hf_zbee_zcl_level_control_attr_on_level; |
4393 | | static int hf_zbee_zcl_level_control_attr_startup_level; |
4394 | | static int hf_zbee_zcl_level_control_level; |
4395 | | static int hf_zbee_zcl_level_control_move_mode; |
4396 | | static int hf_zbee_zcl_level_control_rate; |
4397 | | static int hf_zbee_zcl_level_control_step_mode; |
4398 | | static int hf_zbee_zcl_level_control_step_size; |
4399 | | static int hf_zbee_zcl_level_control_transit_time; |
4400 | | static int hf_zbee_zcl_level_control_options_mask; |
4401 | | static int hf_zbee_zcl_level_control_options_override; |
4402 | | static int hf_zbee_zcl_level_control_srv_rx_cmd_id; |
4403 | | |
4404 | | /* Initialize the subtree pointers */ |
4405 | | static int ett_zbee_zcl_level_control; |
4406 | | |
4407 | | /* Attributes */ |
4408 | | static const value_string zbee_zcl_level_control_attr_names[] = { |
4409 | | { ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_CURRENT_LEVEL, "Current Level" }, |
4410 | | { ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_REMAINING_TIME, "Remaining Time" }, |
4411 | | { ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ONOFF_TRANSIT_TIME, "OnOff Transition Time" }, |
4412 | | { ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ON_LEVEL, "On Level" }, |
4413 | | { ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_STARTUP_LEVEL, "Startup Level" }, |
4414 | | { 0, NULL } |
4415 | | }; |
4416 | | |
4417 | | /* Server Commands Received */ |
4418 | | static const value_string zbee_zcl_level_control_srv_rx_cmd_names[] = { |
4419 | | { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL, "Move to Level" }, |
4420 | | { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE, "Move" }, |
4421 | | { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP, "Step" }, |
4422 | | { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP, "Stop" }, |
4423 | | { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL_WITH_ONOFF, "Move to Level with OnOff" }, |
4424 | | { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_WITH_ONOFF, "Move with OnOff" }, |
4425 | | { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP_WITH_ONOFF, "Step with OnOff" }, |
4426 | | { ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP_WITH_ONOFF, "Stop with OnOff" }, |
4427 | | { 0, NULL } |
4428 | | }; |
4429 | | |
4430 | | /* Move Mode Values */ |
4431 | | static const value_string zbee_zcl_level_control_move_step_mode_values[] = { |
4432 | | { 0x00, "Up" }, |
4433 | | { 0x01, "Down" }, |
4434 | | { 0, NULL } |
4435 | | }; |
4436 | | |
4437 | | static const range_string zbee_zcl_level_control_startup_level_names[] = { |
4438 | | { 0x00, 0x00, "Set the CurrentLevel attribute to the minimum" }, |
4439 | | { 0x01, 0xFE, "Set the CurrentLevel attribute to this value" }, |
4440 | | { 0xFF, 0xFF, "Set the CurrentLevel attribute to its previous value" }, |
4441 | | { 0, 0, NULL } |
4442 | | }; |
4443 | | |
4444 | | /*************************/ |
4445 | | /* Function Bodies */ |
4446 | | /*************************/ |
4447 | | /*FUNCTION:------------------------------------------------------ |
4448 | | * NAME |
4449 | | * dissect_zcl_level_control_move_to_level |
4450 | | * DESCRIPTION |
4451 | | * this function decodes the Move to Level payload. |
4452 | | * PARAMETERS |
4453 | | * tvb - the tv buffer of the current data_type |
4454 | | * tree - the tree to append this item to |
4455 | | * offset - offset of data in tvb |
4456 | | * RETURNS |
4457 | | * none |
4458 | | *--------------------------------------------------------------- |
4459 | | */ |
4460 | | static void |
4461 | | dissect_zcl_level_control_move_to_level(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
4462 | 7 | { |
4463 | | /* Retrieve "Level" field */ |
4464 | 7 | proto_tree_add_item(tree, hf_zbee_zcl_level_control_level, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
4465 | 7 | *offset += 1; |
4466 | | |
4467 | | /* Retrieve "Transition Time" field */ |
4468 | 7 | proto_tree_add_item(tree, hf_zbee_zcl_level_control_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
4469 | 7 | *offset += 2; |
4470 | | |
4471 | | /* Retrieve "OptionMask" field */ |
4472 | 7 | proto_tree_add_item(tree, hf_zbee_zcl_level_control_options_mask, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
4473 | 7 | *offset += 1; |
4474 | | |
4475 | | /* Retrieve "OptionsOverride" field */ |
4476 | 7 | proto_tree_add_item(tree, hf_zbee_zcl_level_control_options_override, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
4477 | 7 | *offset += 1; |
4478 | | |
4479 | 7 | } /*dissect_zcl_level_control_move_to_level*/ |
4480 | | |
4481 | | |
4482 | | /*FUNCTION:-------------------------------------------------------------------- |
4483 | | * NAME |
4484 | | * dissect_zcl_level_control_move |
4485 | | * DESCRIPTION |
4486 | | * this function decodes the Move payload |
4487 | | * PARAMETERS |
4488 | | * tvb - the tv buffer of the current data_type |
4489 | | * tree - the tree to append this item to |
4490 | | * offset - offset of data in tvb |
4491 | | * RETURNS |
4492 | | * none |
4493 | | *------------------------------------------------------------------------------ |
4494 | | */ |
4495 | | |
4496 | | static void |
4497 | | dissect_zcl_level_control_move(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
4498 | 3 | { |
4499 | | /* Retrieve "Move Mode" field */ |
4500 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_level_control_move_mode, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
4501 | 3 | *offset += 1; |
4502 | | |
4503 | | /* Retrieve "Rate" field */ |
4504 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_level_control_rate, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
4505 | 3 | *offset += 1; |
4506 | | |
4507 | 3 | } /*dissect_zcl_level_control_move*/ |
4508 | | |
4509 | | |
4510 | | /*FUNCTION:------------------------------------------------------------------- |
4511 | | * NAME |
4512 | | * dissect_zcl_level_control_step |
4513 | | * DESCRIPTION |
4514 | | * this function decodes the Step payload. |
4515 | | * PARAMETERS |
4516 | | * tvb - the tv buffer of the current data_type |
4517 | | * tree - the tree to append this item to |
4518 | | * offset - offset of data in tvb |
4519 | | * RETURNS |
4520 | | * none |
4521 | | *----------------------------------------------------------------------------- |
4522 | | */ |
4523 | | static void |
4524 | | dissect_zcl_level_control_step(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
4525 | 18 | { |
4526 | | /* Retrieve "Step Mode" field */ |
4527 | 18 | proto_tree_add_item(tree, hf_zbee_zcl_level_control_step_mode, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
4528 | 18 | *offset += 1; |
4529 | | |
4530 | | /* Retrieve "Step Size" field */ |
4531 | 18 | proto_tree_add_item(tree, hf_zbee_zcl_level_control_step_size, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
4532 | 18 | *offset += 1; |
4533 | | |
4534 | | /* Retrieve "Transition Time" field */ |
4535 | 18 | proto_tree_add_item(tree, hf_zbee_zcl_level_control_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
4536 | 18 | *offset += 2; |
4537 | | |
4538 | 18 | } /*dissect_zcl_level_control_step*/ |
4539 | | |
4540 | | |
4541 | | /*FUNCTION:------------------------------------------------------ |
4542 | | * NAME |
4543 | | * dissect_zcl_level_control_attr_data |
4544 | | * DESCRIPTION |
4545 | | * this function is called by ZCL foundation dissector in order to decode |
4546 | | * specific cluster attributes data. |
4547 | | * PARAMETERS |
4548 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
4549 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
4550 | | * unsigned *offset - pointer to buffer offset |
4551 | | * uint16_t attr_id - attribute identifier |
4552 | | * unsigned data_type - attribute data type |
4553 | | * RETURNS |
4554 | | * none |
4555 | | *--------------------------------------------------------------- |
4556 | | */ |
4557 | | |
4558 | | /*FUNCTION:------------------------------------------------------ |
4559 | | * NAME |
4560 | | * dissect_zbee_zcl_level_control |
4561 | | * DESCRIPTION |
4562 | | * ZigBee ZCL Level Control cluster dissector for wireshark. |
4563 | | * PARAMETERS |
4564 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
4565 | | * packet_info *pinfo - pointer to packet information fields |
4566 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
4567 | | * RETURNS |
4568 | | * none |
4569 | | *--------------------------------------------------------------- |
4570 | | */ |
4571 | | static int |
4572 | | dissect_zbee_zcl_level_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) |
4573 | 69 | { |
4574 | 69 | proto_tree *payload_tree; |
4575 | 69 | zbee_zcl_packet *zcl; |
4576 | 69 | unsigned offset = 0; |
4577 | 69 | uint8_t cmd_id; |
4578 | 69 | int rem_len; |
4579 | | |
4580 | | /* Reject the packet if data is NULL */ |
4581 | 69 | if (data == NULL) |
4582 | 0 | return 0; |
4583 | 69 | zcl = (zbee_zcl_packet *)data; |
4584 | 69 | cmd_id = zcl->cmd_id; |
4585 | | |
4586 | | /* Create a subtree for the ZCL Command frame, and add the command ID to it. */ |
4587 | 69 | if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { |
4588 | | /* Append the command name to the info column. */ |
4589 | 59 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
4590 | 59 | val_to_str_const(cmd_id, zbee_zcl_level_control_srv_rx_cmd_names, "Unknown Command"), |
4591 | 59 | zcl->tran_seqno); |
4592 | | |
4593 | | /* Add the command ID. */ |
4594 | 59 | proto_tree_add_item(tree, hf_zbee_zcl_level_control_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
4595 | | |
4596 | | /* Check if this command has a payload, then add the payload tree */ |
4597 | 59 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
4598 | 59 | if (rem_len > 0) { |
4599 | 49 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_level_control, NULL, "Payload"); |
4600 | | |
4601 | | /* Call the appropriate command dissector */ |
4602 | 49 | switch (cmd_id) { |
4603 | 7 | case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL: |
4604 | 7 | case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL_WITH_ONOFF: |
4605 | 7 | dissect_zcl_level_control_move_to_level(tvb, payload_tree, &offset); |
4606 | 7 | break; |
4607 | | |
4608 | 3 | case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE: |
4609 | 3 | case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_WITH_ONOFF: |
4610 | 3 | dissect_zcl_level_control_move(tvb, payload_tree, &offset); |
4611 | 3 | break; |
4612 | | |
4613 | 17 | case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP: |
4614 | 18 | case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STEP_WITH_ONOFF: |
4615 | 18 | dissect_zcl_level_control_step(tvb, payload_tree, &offset); |
4616 | 18 | break; |
4617 | | |
4618 | 3 | case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP: |
4619 | 3 | case ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_STOP_WITH_ONOFF: |
4620 | | /* No Payload */ |
4621 | 21 | default: |
4622 | 21 | break; |
4623 | 49 | } |
4624 | 49 | } |
4625 | 59 | } |
4626 | | |
4627 | 58 | return tvb_captured_length(tvb); |
4628 | 69 | } /*dissect_zbee_zcl_level_control*/ |
4629 | | |
4630 | | |
4631 | | |
4632 | | static void |
4633 | | dissect_zcl_level_control_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
4634 | 898 | { |
4635 | | /* Dissect attribute data type and data */ |
4636 | 898 | switch ( attr_id ) { |
4637 | 197 | case ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_CURRENT_LEVEL: |
4638 | 197 | proto_tree_add_item(tree, hf_zbee_zcl_level_control_attr_current_level, tvb, *offset, 1, ENC_NA); |
4639 | 197 | *offset += 1; |
4640 | 197 | break; |
4641 | | |
4642 | 21 | case ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_REMAINING_TIME: |
4643 | 21 | proto_tree_add_item(tree, hf_zbee_zcl_level_control_attr_remaining_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
4644 | 21 | *offset += 2; |
4645 | 21 | break; |
4646 | | |
4647 | 11 | case ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ONOFF_TRANSIT_TIME: |
4648 | 11 | proto_tree_add_item(tree, hf_zbee_zcl_level_control_attr_onoff_transmit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
4649 | 11 | *offset += 2; |
4650 | 11 | break; |
4651 | | |
4652 | 23 | case ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ON_LEVEL: |
4653 | 23 | proto_tree_add_item(tree, hf_zbee_zcl_level_control_attr_on_level, tvb, *offset, 1, ENC_NA); |
4654 | 23 | *offset += 1; |
4655 | 23 | break; |
4656 | | |
4657 | 2 | case ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_STARTUP_LEVEL: |
4658 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_level_control_attr_startup_level, tvb, *offset, 1, ENC_NA); |
4659 | 2 | *offset += 1; |
4660 | 2 | break; |
4661 | | |
4662 | 644 | default: |
4663 | 644 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
4664 | 644 | break; |
4665 | 898 | } |
4666 | | |
4667 | 898 | } /*dissect_zcl_level_control_attr_data*/ |
4668 | | |
4669 | | |
4670 | | /*FUNCTION:------------------------------------------------------ |
4671 | | * NAME |
4672 | | * proto_register_zbee_zcl_level_control |
4673 | | * DESCRIPTION |
4674 | | * ZigBee ZCL Level Control cluster protocol registration routine. |
4675 | | * PARAMETERS |
4676 | | * none |
4677 | | * RETURNS |
4678 | | * void |
4679 | | *--------------------------------------------------------------- |
4680 | | */ |
4681 | | void |
4682 | | proto_register_zbee_zcl_level_control(void) |
4683 | 16 | { |
4684 | | /* Setup list of header fields */ |
4685 | 16 | static hf_register_info hf[] = { |
4686 | | |
4687 | 16 | { &hf_zbee_zcl_level_control_attr_id, |
4688 | 16 | { "Attribute", "zbee_zcl_general.level_control.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_level_control_attr_names), |
4689 | 16 | 0x00, NULL, HFILL } }, |
4690 | | |
4691 | 16 | { &hf_zbee_zcl_level_control_attr_current_level, |
4692 | 16 | { "Current Level", "zbee_zcl_general.level_control.attr.current_level", FT_UINT8, BASE_DEC, NULL, |
4693 | 16 | 0x00, NULL, HFILL } }, |
4694 | | |
4695 | 16 | { &hf_zbee_zcl_level_control_attr_remaining_time, |
4696 | 16 | { "Remaining Time", "zbee_zcl_general.level_control.attr.remaining_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms), |
4697 | 16 | 0x00, NULL, HFILL } }, |
4698 | | |
4699 | 16 | { &hf_zbee_zcl_level_control_attr_onoff_transmit_time, |
4700 | 16 | { "Current Level", "zbee_zcl_general.level_control.attr.onoff_transmit_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms), |
4701 | 16 | 0x00, NULL, HFILL } }, |
4702 | | |
4703 | 16 | { &hf_zbee_zcl_level_control_attr_on_level, |
4704 | 16 | { "On Level", "zbee_zcl_general.level_control.attr.on_level", FT_UINT8, BASE_DEC, NULL, |
4705 | 16 | 0x00, NULL, HFILL } }, |
4706 | | |
4707 | 16 | { &hf_zbee_zcl_level_control_attr_startup_level, |
4708 | 16 | { "Startup Level", "zbee_zcl_general.level_control.attr.startup_level", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_zcl_level_control_startup_level_names), |
4709 | 16 | 0x00, NULL, HFILL } }, |
4710 | | |
4711 | 16 | { &hf_zbee_zcl_level_control_level, |
4712 | 16 | { "Level", "zbee_zcl_general.level_control.level", FT_UINT8, BASE_DEC, NULL, |
4713 | 16 | 0x00, NULL, HFILL } }, |
4714 | | |
4715 | 16 | { &hf_zbee_zcl_level_control_move_mode, |
4716 | 16 | { "Move Mode", "zbee_zcl_general.level_control.move_mode", FT_UINT8, BASE_HEX, VALS(zbee_zcl_level_control_move_step_mode_values), |
4717 | 16 | 0x00, NULL, HFILL } }, |
4718 | | |
4719 | 16 | { &hf_zbee_zcl_level_control_rate, |
4720 | 16 | { "Rate", "zbee_zcl_general.level_control.rate", FT_UINT8, BASE_DEC, NULL, |
4721 | 16 | 0x00, NULL, HFILL } }, |
4722 | | |
4723 | 16 | { &hf_zbee_zcl_level_control_step_mode, |
4724 | 16 | { "Step Mode", "zbee_zcl_general.level_control.step_mode", FT_UINT8, BASE_HEX, VALS(zbee_zcl_level_control_move_step_mode_values), |
4725 | 16 | 0x00, NULL, HFILL } }, |
4726 | | |
4727 | 16 | { &hf_zbee_zcl_level_control_step_size, |
4728 | 16 | { "Step Size", "zbee_zcl_general.level_control.step_size", FT_UINT8, BASE_DEC, NULL, |
4729 | 16 | 0x00, NULL, HFILL } }, |
4730 | | |
4731 | 16 | { &hf_zbee_zcl_level_control_transit_time, |
4732 | 16 | { "Transition Time", "zbee_zcl_general.level_control.transit_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms), |
4733 | 16 | 0x00, NULL, HFILL } }, |
4734 | | |
4735 | 16 | { &hf_zbee_zcl_level_control_options_mask, |
4736 | 16 | { "OptionsMask", "zbee_zcl_general.level_control.options_mask", FT_UINT8, BASE_HEX, NULL, |
4737 | 16 | 0x00, NULL, HFILL } }, |
4738 | | |
4739 | 16 | { &hf_zbee_zcl_level_control_options_override, |
4740 | 16 | { "OptionsOverride", "zbee_zcl_general.level_control.options_override", FT_UINT8, BASE_HEX, NULL, |
4741 | 16 | 0x00, NULL, HFILL } }, |
4742 | | |
4743 | 16 | { &hf_zbee_zcl_level_control_srv_rx_cmd_id, |
4744 | 16 | { "Command", "zbee_zcl_general.level_control.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_level_control_srv_rx_cmd_names), |
4745 | 16 | 0x00, NULL, HFILL } } |
4746 | | |
4747 | 16 | }; |
4748 | | |
4749 | | /* ZCL Identify subtrees */ |
4750 | 16 | static int *ett[] = { |
4751 | 16 | &ett_zbee_zcl_level_control |
4752 | 16 | }; |
4753 | | |
4754 | | /* Register the ZigBee ZCL Level Control cluster protocol name and description */ |
4755 | 16 | proto_zbee_zcl_level_control = proto_register_protocol("ZigBee ZCL Level Control", "ZCL Level Control", ZBEE_PROTOABBREV_ZCL_LEVEL_CONTROL); |
4756 | 16 | proto_register_field_array(proto_zbee_zcl_level_control, hf, array_length(hf)); |
4757 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
4758 | | |
4759 | | /* Register the ZigBee ZCL Level Control dissector. */ |
4760 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_LEVEL_CONTROL, dissect_zbee_zcl_level_control, proto_zbee_zcl_level_control); |
4761 | | |
4762 | 16 | } /*proto_register_zbee_zcl_level_control*/ |
4763 | | |
4764 | | |
4765 | | /*FUNCTION:------------------------------------------------------ |
4766 | | * NAME |
4767 | | * proto_reg_handoff_zbee_zcl_level_control |
4768 | | * DESCRIPTION |
4769 | | * Hands off the ZCL Level Control dissector. |
4770 | | * PARAMETERS |
4771 | | * none |
4772 | | * RETURNS |
4773 | | * none |
4774 | | *--------------------------------------------------------------- |
4775 | | */ |
4776 | | void |
4777 | | proto_reg_handoff_zbee_zcl_level_control(void) |
4778 | 16 | { |
4779 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_LEVEL_CONTROL, |
4780 | 16 | proto_zbee_zcl_level_control, |
4781 | 16 | ett_zbee_zcl_level_control, |
4782 | 16 | ZBEE_ZCL_CID_LEVEL_CONTROL, |
4783 | 16 | ZBEE_MFG_CODE_NONE, |
4784 | 16 | hf_zbee_zcl_level_control_attr_id, |
4785 | 16 | hf_zbee_zcl_level_control_attr_id, |
4786 | 16 | hf_zbee_zcl_level_control_srv_rx_cmd_id, |
4787 | 16 | -1, |
4788 | 16 | dissect_zcl_level_control_attr_data |
4789 | 16 | ); |
4790 | 16 | } /*proto_reg_handoff_zbee_zcl_level_control*/ |
4791 | | |
4792 | | |
4793 | | /* ########################################################################## */ |
4794 | | /* #### (0x000B) RSSI LOCATION CLUSTER ###################################### */ |
4795 | | /* ########################################################################## */ |
4796 | | |
4797 | | /*************************/ |
4798 | | /* Defines */ |
4799 | | /*************************/ |
4800 | | |
4801 | | /* Attributes */ |
4802 | 216 | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE 0x0000 /* Location Type */ |
4803 | 15 | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD 0x0001 /* Location Method */ |
4804 | 2 | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_AGE 0x0002 /* Location Age */ |
4805 | 3 | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_QUALITY_MEASURE 0x0003 /* Quality Measure */ |
4806 | 3 | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_OF_DEVICES 0x0004 /* Number of Devices */ |
4807 | 3 | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_1 0x0010 /* Coordinate 1 */ |
4808 | 3 | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_2 0x0011 /* Coordinate 2 */ |
4809 | 3 | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_3 0x0012 /* Coordinate 3 */ |
4810 | 3 | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_POWER 0x0013 /* Power */ |
4811 | 3 | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_PATH_LOSS_EXPONENT 0x0014 /* Path Loss Exponent */ |
4812 | 3 | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_REPORTING_PERIOD 0x0015 /* Reporting Period */ |
4813 | 3 | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_CALCULATION_PERIOD 0x0016 /* Calculation Period */ |
4814 | 3 | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_RSSI_MEAS 0x0017 /* Number RSSI Measurements */ |
4815 | | |
4816 | | /* Location Type Mask Values */ |
4817 | 16 | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_ABSOLUTE 0x01 /* Absolute/Measured */ |
4818 | 22 | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_2D 0x02 /* 2D/3D */ |
4819 | 22 | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_COORDINATE 0x0C /* Coordinate System */ |
4820 | 16 | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_RESERVED 0xF0 /* Coordinate System */ |
4821 | | |
4822 | | /* Location Method Values */ |
4823 | | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_LATERATION 0x00 /* Lateration */ |
4824 | | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_SIGNPOSTING 0x01 /* Signposting */ |
4825 | | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_RF_FINGERPRINTING 0x02 /* RF Fingerprinting */ |
4826 | | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_OUT_OF_BAND 0x03 /* Out of Band */ |
4827 | | #define ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_CENTRALIZED 0x04 /* Centralized */ |
4828 | | |
4829 | | /* Server Commands Received */ |
4830 | 5 | #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_ABSOLUTE_LOCATION 0x00 /* Set Absolute Location */ |
4831 | 8 | #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_DEVICE_CONFIG 0x01 /* Set Device Configuration */ |
4832 | 6 | #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_DEVICE_CONFIG 0x02 /* Get Device Configuration */ |
4833 | 6 | #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_LOCATION_DATA 0x03 /* Get Location Data */ |
4834 | 1 | #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_RESPONSE 0x04 /* RSSI Response */ |
4835 | 0 | #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SEND_PINGS 0x05 /* Send Pings */ |
4836 | 0 | #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_ANCHOR_NODE_ANNOUNCE 0x06 /* Anchor Node Announce */ |
4837 | | |
4838 | | |
4839 | | /* Server Commands Generated */ |
4840 | 6 | #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_DEVICE_CONFIG_RESPONSE 0x00 /* Device Configuration Response */ |
4841 | 5 | #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_RESPONSE 0x01 /* Location Data Response */ |
4842 | 1 | #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_NOTIF 0x02 /* Location Data Notification */ |
4843 | 5 | #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_COMPACT_LOCATION_DATA_NOTIF 0x03 /* Compact Location Data Notification */ |
4844 | 1 | #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_PING 0x04 /* RSSI Ping */ |
4845 | 0 | #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_REQUEST 0x05 /* RSSI Request */ |
4846 | 6 | #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REPORT_RSSI_MEAS 0x06 /* Report RSSI Measurements */ |
4847 | 1 | #define ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REQUEST_OWN_LOCATION 0x07 /* Request Own Location */ |
4848 | | |
4849 | | |
4850 | | /*************************/ |
4851 | | /* Function Declarations */ |
4852 | | /*************************/ |
4853 | | |
4854 | | void proto_register_zbee_zcl_rssi_location(void); |
4855 | | void proto_reg_handoff_zbee_zcl_rssi_location(void); |
4856 | | |
4857 | | /* Command Dissector Helpers */ |
4858 | | static void dissect_zcl_rssi_location_set_absolute_location (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
4859 | | static void dissect_zcl_rssi_location_set_device_config (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
4860 | | static void dissect_zcl_rssi_location_get_device_config (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
4861 | | static void dissect_zcl_rssi_location_get_location_data (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
4862 | | static void dissect_zcl_rssi_location_rssi_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
4863 | | static void dissect_zcl_rssi_location_send_pings (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
4864 | | static void dissect_zcl_rssi_location_anchor_node_announce (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
4865 | | |
4866 | | static void dissect_zcl_rssi_location_device_config_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
4867 | | static void dissect_zcl_rssi_location_location_data_response (tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset); |
4868 | | static void dissect_zcl_rssi_location_location_data_notif (tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset); |
4869 | | static void dissect_zcl_rssi_location_compact_location_data_notif (tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset); |
4870 | | static void dissect_zcl_rssi_location_rssi_ping (tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset); |
4871 | | static void dissect_zcl_rssi_location_report_rssi_meas (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
4872 | | static void dissect_zcl_rssi_location_request_own_location (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
4873 | | |
4874 | | static void dissect_zcl_rssi_location_attr_data (proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr); |
4875 | | |
4876 | | /* Private functions prototype */ |
4877 | | |
4878 | | /*************************/ |
4879 | | /* Global Variables */ |
4880 | | /*************************/ |
4881 | | /* Initialize the protocol and registered fields */ |
4882 | | static int proto_zbee_zcl_rssi_location; |
4883 | | |
4884 | | static int hf_zbee_zcl_rssi_location_attr_id; |
4885 | | static int hf_zbee_zcl_rssi_location_location_type; |
4886 | | static int hf_zbee_zcl_rssi_location_location_type_absolute; |
4887 | | static int hf_zbee_zcl_rssi_location_location_type_2D; |
4888 | | static int hf_zbee_zcl_rssi_location_location_type_coordinate_system; |
4889 | | static int hf_zbee_zcl_rssi_location_location_type_reserved; |
4890 | | static int hf_zbee_zcl_rssi_location_attr_id_location_method; |
4891 | | static int hf_zbee_zcl_rssi_location_coordinate1; |
4892 | | static int hf_zbee_zcl_rssi_location_coordinate2; |
4893 | | static int hf_zbee_zcl_rssi_location_coordinate3; |
4894 | | static int hf_zbee_zcl_rssi_location_power; |
4895 | | static int hf_zbee_zcl_rssi_location_path_loss_expo; |
4896 | | static int hf_zbee_zcl_rssi_location_calc_period; |
4897 | | static int hf_zbee_zcl_rssi_location_number_rssi_meas; |
4898 | | static int hf_zbee_zcl_rssi_location_reporting_period; |
4899 | | static int hf_zbee_zcl_rssi_location_target_add; |
4900 | | static int hf_zbee_zcl_rssi_location_header; |
4901 | | static int hf_zbee_zcl_rssi_location_header_abs_only; |
4902 | | static int hf_zbee_zcl_rssi_location_header_recalc; |
4903 | | static int hf_zbee_zcl_rssi_location_header_bcast_ind; |
4904 | | static int hf_zbee_zcl_rssi_location_header_bcast_res; |
4905 | | static int hf_zbee_zcl_rssi_location_header_compact_res; |
4906 | | static int hf_zbee_zcl_rssi_location_header_res; |
4907 | | static int hf_zbee_zcl_rssi_location_number_responses; |
4908 | | static int hf_zbee_zcl_rssi_location_replaying_device; |
4909 | | static int hf_zbee_zcl_rssi_location_rssi; |
4910 | | static int hf_zbee_zcl_rssi_location_anchor_node_add; |
4911 | | static int hf_zbee_zcl_rssi_location_status; |
4912 | | static int hf_zbee_zcl_rssi_location_quality_measure; |
4913 | | static int hf_zbee_zcl_rssi_location_location_age; |
4914 | | static int hf_zbee_zcl_rssi_location_reporting_add; |
4915 | | static int hf_zbee_zcl_rssi_location_no_of_neigh; |
4916 | | static int hf_zbee_zcl_rssi_location_neighbour_add; |
4917 | | static int hf_zbee_zcl_rssi_location_request_add; |
4918 | | static int hf_zbee_zcl_rssi_location_srv_rx_cmd_id; |
4919 | | static int hf_zbee_zcl_rssi_location_srv_tx_cmd_id; |
4920 | | |
4921 | | /* Initialize the subtree pointers */ |
4922 | | static int ett_zbee_zcl_rssi_location; |
4923 | | static int ett_zbee_zcl_rssi_location_location_type; |
4924 | | static int ett_zbee_zcl_rssi_location_header; |
4925 | | |
4926 | | /* Attributes */ |
4927 | | static const value_string zbee_zcl_rssi_location_attr_names[] = { |
4928 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE, "Location Type" }, |
4929 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD, "Location Method" }, |
4930 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_AGE, "Location Age" }, |
4931 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_QUALITY_MEASURE, "Quality Measure" }, |
4932 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_OF_DEVICES, "Number of Devices" }, |
4933 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_1, "Coordinate 1" }, |
4934 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_2, "Coordinate 2" }, |
4935 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_3, "Coordinate 3" }, |
4936 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_POWER, "Power" }, |
4937 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_PATH_LOSS_EXPONENT, "Path Loss Exponent" }, |
4938 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_REPORTING_PERIOD, "Reporting Period" }, |
4939 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_CALCULATION_PERIOD, "Calculation Period" }, |
4940 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_RSSI_MEAS, "Number RSSI Measurements" }, |
4941 | | { 0, NULL } |
4942 | | }; |
4943 | | |
4944 | | /* Server Commands Received */ |
4945 | | static const value_string zbee_zcl_rssi_location_srv_rx_cmd_names[] = { |
4946 | | { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_ABSOLUTE_LOCATION, "Set Absolute Location" }, |
4947 | | { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_DEVICE_CONFIG, "Set Device Configuration" }, |
4948 | | { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_DEVICE_CONFIG, "Get Device Configuration" }, |
4949 | | { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_LOCATION_DATA, "Get Location Data" }, |
4950 | | { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_RESPONSE, "RSSI Response" }, |
4951 | | { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SEND_PINGS, "Send Pings" }, |
4952 | | { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_ANCHOR_NODE_ANNOUNCE, "Anchor Node Announce" }, |
4953 | | { 0, NULL } |
4954 | | }; |
4955 | | |
4956 | | /* Server Commands Generated */ |
4957 | | static const value_string zbee_zcl_rssi_location_srv_tx_cmd_names[] = { |
4958 | | { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_DEVICE_CONFIG_RESPONSE, "Device Configuration Response" }, |
4959 | | { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_RESPONSE, "Location Data Response" }, |
4960 | | { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_NOTIF, "Location Data Notification" }, |
4961 | | { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_COMPACT_LOCATION_DATA_NOTIF, "Compact Location Data Notification" }, |
4962 | | { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_PING, "RSSI Ping" }, |
4963 | | { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_REQUEST, "RSSI Request" }, |
4964 | | { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REPORT_RSSI_MEAS, "Report RSSI Measurements" }, |
4965 | | { ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REQUEST_OWN_LOCATION, "Request Own Location" }, |
4966 | | { 0, NULL } |
4967 | | }; |
4968 | | |
4969 | | /* Location Method Values */ |
4970 | | static const value_string zbee_zcl_rssi_location_location_method_values[] = { |
4971 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_LATERATION, "Lateration" }, |
4972 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_SIGNPOSTING, "Signposting" }, |
4973 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_RF_FINGERPRINTING, "RF Fingerprinting" }, |
4974 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_OUT_OF_BAND, "Out of Band" }, |
4975 | | { ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD_CENTRALIZED, "Centralized" }, |
4976 | | { 0, NULL } |
4977 | | }; |
4978 | | |
4979 | | /* Location type absolute values*/ |
4980 | | static const value_string zbee_zcl_rssi_location_location_type_abs_values[] = { |
4981 | | {0, "Measured Location"}, |
4982 | | {1, "Absolute Location"}, |
4983 | | {0, NULL} |
4984 | | }; |
4985 | | |
4986 | | /* Location type 2D/3D values*/ |
4987 | | static const value_string zbee_zcl_rssi_location_location_type_2D_values[] = { |
4988 | | {0, "Three Dimensional"}, |
4989 | | {1, "Two Dimensional"}, |
4990 | | {0, NULL} |
4991 | | }; |
4992 | | |
4993 | | /* Location type Coordinate System values*/ |
4994 | | static const value_string zbee_zcl_rssi_location_location_type_coordinate_values[] = { |
4995 | | {0, "Rectangular"}, |
4996 | | {1, "Reserved"}, |
4997 | | {2, "Reserved"}, |
4998 | | {3, "Reserved"}, |
4999 | | {0, NULL} |
5000 | | }; |
5001 | | |
5002 | | /*************************/ |
5003 | | /* Function Bodies */ |
5004 | | /*************************/ |
5005 | | |
5006 | | /*FUNCTION:------------------------------------------------------ |
5007 | | * NAME |
5008 | | * dissect_zbee_zcl_rssi_location |
5009 | | * DESCRIPTION |
5010 | | * ZigBee ZCL RSSI Location cluster dissector for wireshark. |
5011 | | * PARAMETERS |
5012 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
5013 | | * packet_info *pinfo - pointer to packet information fields |
5014 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
5015 | | * RETURNS |
5016 | | * none |
5017 | | *--------------------------------------------------------------- |
5018 | | */ |
5019 | | static int |
5020 | | dissect_zbee_zcl_rssi_location(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) |
5021 | 172 | { |
5022 | 172 | proto_tree *payload_tree; |
5023 | 172 | zbee_zcl_packet *zcl; |
5024 | 172 | unsigned offset = 0; |
5025 | 172 | uint8_t cmd_id; |
5026 | 172 | int rem_len; |
5027 | | |
5028 | | /* Reject the packet if data is NULL */ |
5029 | 172 | if (data == NULL) |
5030 | 0 | return 0; |
5031 | 172 | zcl = (zbee_zcl_packet *)data; |
5032 | 172 | cmd_id = zcl->cmd_id; |
5033 | | |
5034 | | /* Create a subtree for the ZCL Command frame, and add the command ID to it. */ |
5035 | 172 | if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { |
5036 | | /* Append the command name to the info column. */ |
5037 | 92 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
5038 | 92 | val_to_str_const(cmd_id, zbee_zcl_rssi_location_srv_rx_cmd_names, "Unknown Command"), |
5039 | 92 | zcl->tran_seqno); |
5040 | | |
5041 | | /* Add the command ID. */ |
5042 | 92 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
5043 | | |
5044 | | /* Check if this command has a payload, then add the payload tree */ |
5045 | 92 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
5046 | 92 | if (rem_len > 0) { |
5047 | 58 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_rssi_location, NULL, "Payload"); |
5048 | | |
5049 | | /* Call the appropriate command dissector */ |
5050 | 58 | switch (cmd_id) { |
5051 | 5 | case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_ABSOLUTE_LOCATION: |
5052 | 5 | dissect_zcl_rssi_location_set_absolute_location(tvb, payload_tree, &offset); |
5053 | 5 | break; |
5054 | | |
5055 | 8 | case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SET_DEVICE_CONFIG: |
5056 | 8 | dissect_zcl_rssi_location_set_device_config(tvb, payload_tree, &offset); |
5057 | 8 | break; |
5058 | | |
5059 | 6 | case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_DEVICE_CONFIG: |
5060 | 6 | dissect_zcl_rssi_location_get_device_config(tvb, payload_tree, &offset); |
5061 | 6 | break; |
5062 | | |
5063 | 6 | case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_GET_LOCATION_DATA: |
5064 | 6 | dissect_zcl_rssi_location_get_location_data(tvb, payload_tree, &offset); |
5065 | 6 | break; |
5066 | | |
5067 | 1 | case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_RESPONSE: |
5068 | 1 | dissect_zcl_rssi_location_rssi_response(tvb, payload_tree, &offset); |
5069 | 1 | break; |
5070 | | |
5071 | 0 | case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_SEND_PINGS: |
5072 | 0 | dissect_zcl_rssi_location_send_pings(tvb, payload_tree, &offset); |
5073 | 0 | break; |
5074 | | |
5075 | 0 | case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_ANCHOR_NODE_ANNOUNCE: |
5076 | 0 | dissect_zcl_rssi_location_anchor_node_announce(tvb, payload_tree, &offset); |
5077 | 0 | break; |
5078 | | |
5079 | 32 | default: |
5080 | 32 | break; |
5081 | 58 | } |
5082 | 58 | } |
5083 | 92 | } |
5084 | 80 | else { /* ZBEE_ZCL_FCF_TO_CLIENT */ |
5085 | | /* Append the command name to the info column. */ |
5086 | 80 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
5087 | 80 | val_to_str_const(cmd_id, zbee_zcl_rssi_location_srv_tx_cmd_names, "Unknown Command"), |
5088 | 80 | zcl->tran_seqno); |
5089 | | |
5090 | | /* Add the command ID. */ |
5091 | 80 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
5092 | | |
5093 | | /* Check if this command has a payload, then add the payload tree */ |
5094 | 80 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
5095 | 80 | if (rem_len > 0) { |
5096 | 69 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_rssi_location, NULL, "Payload"); |
5097 | | |
5098 | | /* Call the appropriate command dissector */ |
5099 | 69 | switch (cmd_id) { |
5100 | 6 | case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_DEVICE_CONFIG_RESPONSE: |
5101 | 6 | dissect_zcl_rssi_location_device_config_response(tvb, payload_tree, &offset); |
5102 | 6 | break; |
5103 | 5 | case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_RESPONSE: |
5104 | 5 | dissect_zcl_rssi_location_location_data_response(tvb, pinfo, payload_tree, &offset); |
5105 | 5 | break; |
5106 | | |
5107 | 1 | case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_LOCATION_DATA_NOTIF: |
5108 | 1 | dissect_zcl_rssi_location_location_data_notif(tvb, pinfo, payload_tree, &offset); |
5109 | 1 | break; |
5110 | | |
5111 | 5 | case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_COMPACT_LOCATION_DATA_NOTIF: |
5112 | 5 | dissect_zcl_rssi_location_compact_location_data_notif(tvb, pinfo, payload_tree, &offset); |
5113 | 5 | break; |
5114 | | |
5115 | 1 | case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_PING: |
5116 | 1 | dissect_zcl_rssi_location_rssi_ping(tvb, pinfo, payload_tree, &offset); |
5117 | 1 | break; |
5118 | | |
5119 | 0 | case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_RSSI_REQUEST: |
5120 | | /* No Payload */ |
5121 | 0 | break; |
5122 | | |
5123 | 6 | case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REPORT_RSSI_MEAS: |
5124 | 6 | dissect_zcl_rssi_location_report_rssi_meas(tvb, payload_tree, &offset); |
5125 | 6 | break; |
5126 | | |
5127 | 1 | case ZBEE_ZCL_CMD_ID_RSSI_LOCATION_REQUEST_OWN_LOCATION: |
5128 | 1 | dissect_zcl_rssi_location_request_own_location(tvb, payload_tree, &offset); |
5129 | 1 | break; |
5130 | | |
5131 | 44 | default: |
5132 | 44 | break; |
5133 | 69 | } |
5134 | 69 | } |
5135 | 80 | } |
5136 | | |
5137 | 161 | return tvb_captured_length(tvb); |
5138 | 172 | } /*dissect_zbee_zcl_rssi_location*/ |
5139 | | |
5140 | | |
5141 | | /*FUNCTION:------------------------------------------------------ |
5142 | | * NAME |
5143 | | * dissect_zcl_rssi_location_set_absolute_location |
5144 | | * DESCRIPTION |
5145 | | * this function decodes the Set Absolute Location payload. |
5146 | | * PARAMETERS |
5147 | | * tvb - the tv buffer of the current data_type |
5148 | | * tree - the tree to append this item to |
5149 | | * offset - offset of data in tvb |
5150 | | * RETURNS |
5151 | | * none |
5152 | | *--------------------------------------------------------------- |
5153 | | */ |
5154 | | static void |
5155 | | dissect_zcl_rssi_location_set_absolute_location(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
5156 | 5 | { |
5157 | | /* Retrieve "Coordinate 1" field */ |
5158 | 5 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5159 | 5 | *offset += 2; |
5160 | | |
5161 | | /* Retrieve "Coordinate 2" field */ |
5162 | 5 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5163 | 5 | *offset += 2; |
5164 | | |
5165 | | /* Retrieve "Coordinate 3" field */ |
5166 | 5 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5167 | 5 | *offset += 2; |
5168 | | |
5169 | | /* Retrieve "Power" field */ |
5170 | 5 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5171 | 5 | *offset += 2; |
5172 | | |
5173 | | /* Retrieve "Path Loss Exponent" field */ |
5174 | 5 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_path_loss_expo, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5175 | 5 | *offset += 2; |
5176 | | |
5177 | 5 | } /*dissect_zcl_rssi_location_set_absolute_location*/ |
5178 | | |
5179 | | |
5180 | | /*FUNCTION:-------------------------------------------------------------------- |
5181 | | * NAME |
5182 | | * dissect_zcl_rssi_location_set_device_config |
5183 | | * DESCRIPTION |
5184 | | * this function decodes the Set Device Configuration payload. |
5185 | | * PARAMETERS |
5186 | | * tvb - the tv buffer of the current data_type |
5187 | | * tree - the tree to append this item to |
5188 | | * offset - offset of data in tvb |
5189 | | * RETURNS |
5190 | | * none |
5191 | | *------------------------------------------------------------------------------ |
5192 | | */ |
5193 | | static void |
5194 | | dissect_zcl_rssi_location_set_device_config(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
5195 | 8 | { |
5196 | | /* Retrieve "Power" field */ |
5197 | 8 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5198 | 8 | *offset += 2; |
5199 | | |
5200 | | /* Retrieve "Path Loss Exponent" field */ |
5201 | 8 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_path_loss_expo, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5202 | 8 | *offset += 2; |
5203 | | |
5204 | | /* Retrieve "Calculation Period" field */ |
5205 | 8 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_calc_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5206 | 8 | *offset += 2; |
5207 | | |
5208 | | /* Retrieve "Number RSSI Measurements" field */ |
5209 | 8 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_rssi_meas, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
5210 | 8 | *offset += 1; |
5211 | | |
5212 | | /* Retrieve "Reporting Period" field */ |
5213 | 8 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_reporting_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5214 | 8 | *offset += 2; |
5215 | | |
5216 | 8 | } /*dissect_zcl_rssi_location_set_device_config*/ |
5217 | | |
5218 | | |
5219 | | /*FUNCTION:------------------------------------------------------------------- |
5220 | | * NAME |
5221 | | * dissect_zcl_rssi_location_get_device_config |
5222 | | * DESCRIPTION |
5223 | | * this function decodes the Get Device Configuration payload. |
5224 | | * PARAMETERS |
5225 | | * tvb - the tv buffer of the current data_type |
5226 | | * tree - the tree to append this item to |
5227 | | * offset - offset of data in tvb |
5228 | | * RETURNS |
5229 | | * none |
5230 | | *----------------------------------------------------------------------------- |
5231 | | */ |
5232 | | static void |
5233 | | dissect_zcl_rssi_location_get_device_config(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
5234 | 6 | { |
5235 | | /* Retrieve "Target Address" field */ |
5236 | 6 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_target_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
5237 | 6 | *offset += 8; |
5238 | | |
5239 | 6 | } /*dissect_zcl_rssi_location_get_device_config*/ |
5240 | | |
5241 | | |
5242 | | /*FUNCTION:------------------------------------------------------------------- |
5243 | | * NAME |
5244 | | * dissect_zcl_rssi_location_get_location_data |
5245 | | * DESCRIPTION |
5246 | | * this function decodes the Get Location Data payload. |
5247 | | * PARAMETERS |
5248 | | * tvb - the tv buffer of the current data_type |
5249 | | * tree - the tree to append this item to |
5250 | | * offset - offset of data in tvb |
5251 | | * RETURNS |
5252 | | * none |
5253 | | *----------------------------------------------------------------------------- |
5254 | | */ |
5255 | | static void |
5256 | | dissect_zcl_rssi_location_get_location_data(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
5257 | 6 | { |
5258 | 6 | uint8_t header; |
5259 | | |
5260 | 6 | static int * const location_header_fields[] = { |
5261 | 6 | &hf_zbee_zcl_rssi_location_header_abs_only, |
5262 | 6 | &hf_zbee_zcl_rssi_location_header_recalc, |
5263 | 6 | &hf_zbee_zcl_rssi_location_header_bcast_ind, |
5264 | 6 | &hf_zbee_zcl_rssi_location_header_bcast_res, |
5265 | 6 | &hf_zbee_zcl_rssi_location_header_compact_res, |
5266 | 6 | &hf_zbee_zcl_rssi_location_header_res, |
5267 | 6 | NULL |
5268 | 6 | }; |
5269 | | |
5270 | | /* Retrieve "8-bit header" field */ |
5271 | 6 | header = tvb_get_uint8(tvb, *offset); |
5272 | 6 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_rssi_location_header, ett_zbee_zcl_rssi_location_header, location_header_fields, ENC_LITTLE_ENDIAN); |
5273 | 6 | *offset += 1; |
5274 | | |
5275 | | /* Retrieve the number responses field */ |
5276 | 6 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_responses, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
5277 | 6 | *offset += 1; |
5278 | | |
5279 | | /* Retrieve the IEEE address field */ |
5280 | 6 | if(header & 0x04) |
5281 | 0 | { |
5282 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_target_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
5283 | 0 | *offset += 8; |
5284 | 0 | } |
5285 | | |
5286 | 6 | } /*dissect_zcl_rssi_location_get_location_data*/ |
5287 | | |
5288 | | |
5289 | | /*FUNCTION:-------------------------------------------------------------------- |
5290 | | * NAME |
5291 | | * dissect_zcl_rssi_location_rssi_response |
5292 | | * DESCRIPTION |
5293 | | * this function decodes the RSSI Response payload. |
5294 | | * PARAMETERS |
5295 | | * tvb - the tv buffer of the current data_type |
5296 | | * tree - the tree to append this item to |
5297 | | * offset - offset of data in tvb |
5298 | | * RETURNS |
5299 | | * none |
5300 | | *------------------------------------------------------------------------------ |
5301 | | */ |
5302 | | static void |
5303 | | dissect_zcl_rssi_location_rssi_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
5304 | 1 | { |
5305 | | /* Retrieve "Replaying Device" field */ |
5306 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_replaying_device, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
5307 | 1 | *offset += 8; |
5308 | | |
5309 | | /* Retrieve "Coordinate 1" field */ |
5310 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5311 | 1 | *offset += 2; |
5312 | | |
5313 | | /* Retrieve "Coordinate 2" field */ |
5314 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5315 | 1 | *offset += 2; |
5316 | | |
5317 | | /* Retrieve "Coordinate 3" field */ |
5318 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5319 | 1 | *offset += 2; |
5320 | | |
5321 | | /* Retrieve "RSSI" field */ |
5322 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_rssi, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
5323 | 1 | *offset += 1; |
5324 | | |
5325 | | /* Retrieve "Number RSSI Measurements" field */ |
5326 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_rssi_meas, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
5327 | 1 | *offset += 1; |
5328 | | |
5329 | 1 | } /*dissect_zcl_rssi_location_rssi_response*/ |
5330 | | |
5331 | | |
5332 | | /*FUNCTION:------------------------------------------------------ |
5333 | | * NAME |
5334 | | * dissect_zcl_rssi_location_send_pings |
5335 | | * DESCRIPTION |
5336 | | * this function decodes the Send Pings payload. |
5337 | | * PARAMETERS |
5338 | | * tvb - the tv buffer of the current data_type |
5339 | | * tree - the tree to append this item to |
5340 | | * offset - offset of data in tvb |
5341 | | * RETURNS |
5342 | | * none |
5343 | | *--------------------------------------------------------------- |
5344 | | */ |
5345 | | static void |
5346 | | dissect_zcl_rssi_location_send_pings(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
5347 | 0 | { |
5348 | | /* Retrieve "Target Address" field */ |
5349 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_target_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
5350 | 0 | *offset += 8; |
5351 | | |
5352 | | /* Retrieve "Number RSSI Measurements" field */ |
5353 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_rssi_meas, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
5354 | 0 | *offset += 1; |
5355 | | |
5356 | | /* Retrieve "Calculation Period" field */ |
5357 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_calc_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5358 | 0 | *offset += 2; |
5359 | |
|
5360 | 0 | } /*dissect_zcl_rssi_location_send_pings*/ |
5361 | | |
5362 | | |
5363 | | /*FUNCTION:------------------------------------------------------ |
5364 | | * NAME |
5365 | | * dissect_zcl_rssi_location_anchor_node_announce |
5366 | | * DESCRIPTION |
5367 | | * this function decodes the Anchor Node Announce payload |
5368 | | * PARAMETERS |
5369 | | * tvb - the tv buffer of the current data_type |
5370 | | * tree - the tree to append this item to |
5371 | | * offset - offset of data in tvb |
5372 | | * RETURNS |
5373 | | * none |
5374 | | *--------------------------------------------------------------- |
5375 | | */ |
5376 | | static void |
5377 | | dissect_zcl_rssi_location_anchor_node_announce(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
5378 | 0 | { |
5379 | | /* Retrieve "Anchor Node Address" field */ |
5380 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_anchor_node_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
5381 | 0 | *offset += 8; |
5382 | | |
5383 | | /* Retrieve "Coordinate 1" field */ |
5384 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5385 | 0 | *offset += 2; |
5386 | | |
5387 | | /* Retrieve "Coordinate 2" field */ |
5388 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5389 | 0 | *offset += 2; |
5390 | | |
5391 | | /* Retrieve "Coordinate 3" field */ |
5392 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5393 | 0 | *offset += 2; |
5394 | |
|
5395 | 0 | } /*dissect_zcl_rssi_location_anchor_node_announce*/ |
5396 | | |
5397 | | |
5398 | | /*FUNCTION:-------------------------------------------------------------------- |
5399 | | * NAME |
5400 | | * dissect_zcl_rssi_location_device_config_response |
5401 | | * DESCRIPTION |
5402 | | * this function decodes the Device Configuration Response payload. |
5403 | | * PARAMETERS |
5404 | | * tvb - the tv buffer of the current data_type |
5405 | | * tree - the tree to append this item to |
5406 | | * offset - offset of data in tvb |
5407 | | * RETURNS |
5408 | | * none |
5409 | | *------------------------------------------------------------------------------ |
5410 | | */ |
5411 | | static void |
5412 | | dissect_zcl_rssi_location_device_config_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
5413 | 6 | { |
5414 | 6 | uint8_t status; |
5415 | | |
5416 | | /* Retrieve "Status" field */ |
5417 | 6 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_rssi_location_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN, &status); |
5418 | 6 | *offset += 1; |
5419 | | |
5420 | 6 | if(status == ZBEE_ZCL_STAT_SUCCESS) |
5421 | 2 | { |
5422 | | /* Retrieve "Power" field */ |
5423 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5424 | 2 | *offset += 2; |
5425 | | |
5426 | | /* Retrieve "Path Loss Exponent" field */ |
5427 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_path_loss_expo, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5428 | 2 | *offset += 2; |
5429 | | |
5430 | | /* Retrieve "Calculation Period" field */ |
5431 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_calc_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5432 | 2 | *offset += 2; |
5433 | | |
5434 | | /* Retrieve "Number RSSI Measurements" field */ |
5435 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_rssi_meas, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
5436 | 2 | *offset += 1; |
5437 | | |
5438 | | /* Retrieve "Reporting Period" field */ |
5439 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_reporting_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5440 | 2 | *offset += 2; |
5441 | 2 | } |
5442 | | |
5443 | 6 | } /*dissect_zcl_rssi_location_device_config_response*/ |
5444 | | |
5445 | | |
5446 | | /*FUNCTION:------------------------------------------------------ |
5447 | | * NAME |
5448 | | * dissect_zcl_rssi_location_location_data_response |
5449 | | * DESCRIPTION |
5450 | | * this function decodes the Location Data Response payload. |
5451 | | * PARAMETERS |
5452 | | * tvb - the tv buffer of the current data_type |
5453 | | * tree - the tree to append this item to |
5454 | | * offset - offset of data in tvb |
5455 | | * RETURNS |
5456 | | * none |
5457 | | *--------------------------------------------------------------- |
5458 | | */ |
5459 | | static void |
5460 | | dissect_zcl_rssi_location_location_data_response(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset) |
5461 | 5 | { |
5462 | 5 | uint8_t status; |
5463 | | |
5464 | | /* Retrieve "Status" field */ |
5465 | 5 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_rssi_location_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN, &status); |
5466 | 5 | *offset += 1; |
5467 | | |
5468 | 5 | if(status == ZBEE_ZCL_STAT_SUCCESS) |
5469 | 1 | { |
5470 | | /* Retrieve "Location Type" field */ |
5471 | 1 | dissect_zcl_rssi_location_attr_data(tree, pinfo, tvb, offset, ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE, ZBEE_ZCL_8_BIT_DATA, false); |
5472 | | |
5473 | | /* Retrieve "Coordinate 1" field */ |
5474 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5475 | 1 | *offset += 2; |
5476 | | |
5477 | | /* Retrieve "Coordinate 2" field */ |
5478 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5479 | 1 | *offset += 2; |
5480 | | |
5481 | | /* Retrieve "Coordinate 3" field */ |
5482 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5483 | 1 | *offset += 2; |
5484 | | |
5485 | | /* Retrieve "Power" field */ |
5486 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5487 | 1 | *offset += 2; |
5488 | | |
5489 | | /* Retrieve "Path Loss Exponent" field */ |
5490 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_path_loss_expo, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5491 | 1 | *offset += 2; |
5492 | | |
5493 | | /* Retrieve "Location Method" field */ |
5494 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_attr_id_location_method, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
5495 | 1 | *offset += 1; |
5496 | | |
5497 | | /* Retrieve "Quality Measure" field */ |
5498 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_quality_measure, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
5499 | 1 | *offset += 1; |
5500 | | |
5501 | | /* Retrieve "Location Age" field */ |
5502 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_location_age, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5503 | 1 | *offset += 2; |
5504 | 1 | } |
5505 | | |
5506 | 5 | } /*dissect_zcl_rssi_location_location_data_response*/ |
5507 | | |
5508 | | |
5509 | | /*FUNCTION:------------------------------------------------------ |
5510 | | * NAME |
5511 | | * dissect_zcl_rssi_location_location_data_notif |
5512 | | * DESCRIPTION |
5513 | | * this function decodes the Location Data Notification payload. |
5514 | | * PARAMETERS |
5515 | | * tvb - the tv buffer of the current data_type |
5516 | | * tree - the tree to append this item to |
5517 | | * offset - offset of data in tvb |
5518 | | * RETURNS |
5519 | | * none |
5520 | | *--------------------------------------------------------------- |
5521 | | */ |
5522 | | static void |
5523 | | dissect_zcl_rssi_location_location_data_notif(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset) |
5524 | 1 | { |
5525 | 1 | uint8_t temp; |
5526 | | |
5527 | | /* Retrieve "Location Type" field */ |
5528 | 1 | temp = tvb_get_uint8(tvb, *offset); |
5529 | 1 | dissect_zcl_rssi_location_attr_data(tree, pinfo, tvb, offset, ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE, ZBEE_ZCL_8_BIT_DATA, false); |
5530 | | |
5531 | | /* Retrieve "Coordinate 1" field */ |
5532 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5533 | 1 | *offset += 2; |
5534 | | |
5535 | | /* Retrieve "Coordinate 2" field */ |
5536 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5537 | 1 | *offset += 2; |
5538 | | |
5539 | 1 | if((temp & ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_2D) != 0x02) |
5540 | 1 | { |
5541 | | /* Retrieve "Coordinate 3" field */ |
5542 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5543 | 1 | *offset += 2; |
5544 | 1 | } |
5545 | | |
5546 | | /* Retrieve "Power" field */ |
5547 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5548 | 1 | *offset += 2; |
5549 | | |
5550 | | /* Retrieve "Path Loss Exponent" field */ |
5551 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_path_loss_expo, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5552 | 1 | *offset += 2; |
5553 | | |
5554 | 1 | if((temp & ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_COORDINATE) != 0x0C) |
5555 | 0 | { |
5556 | | /* Retrieve "Location Method" field */ |
5557 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_attr_id_location_method, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
5558 | 0 | *offset += 1; |
5559 | | |
5560 | | /* Retrieve "Quality Measure" field */ |
5561 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_quality_measure, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
5562 | 0 | *offset += 1; |
5563 | | |
5564 | | /* Retrieve "Location Age" field */ |
5565 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_location_age, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5566 | 0 | *offset += 2; |
5567 | |
|
5568 | 0 | } |
5569 | | |
5570 | 1 | } /*dissect_zcl_rssi_location_location_data_notif*/ |
5571 | | |
5572 | | |
5573 | | /*FUNCTION:------------------------------------------------------ |
5574 | | * NAME |
5575 | | * dissect_zcl_rssi_location_compact_location_data_notif |
5576 | | * DESCRIPTION |
5577 | | * this function decodes the Location Data Notification payload. |
5578 | | * PARAMETERS |
5579 | | * tvb - the tv buffer of the current data_type |
5580 | | * tree - the tree to append this item to |
5581 | | * offset - offset of data in tvb |
5582 | | * RETURNS |
5583 | | * none |
5584 | | *--------------------------------------------------------------- |
5585 | | */ |
5586 | | static void |
5587 | | dissect_zcl_rssi_location_compact_location_data_notif(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset) |
5588 | 5 | { |
5589 | 5 | uint8_t temp; |
5590 | | |
5591 | | /* Retrieve "Location Type" field */ |
5592 | 5 | temp = tvb_get_uint8(tvb, *offset); |
5593 | 5 | dissect_zcl_rssi_location_attr_data(tree, pinfo, tvb, offset, ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE, ZBEE_ZCL_8_BIT_DATA, false); |
5594 | | |
5595 | | /* Retrieve "Coordinate 1" field */ |
5596 | 5 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5597 | 5 | *offset += 2; |
5598 | | |
5599 | | /* Retrieve "Coordinate 2" field */ |
5600 | 5 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5601 | 5 | *offset += 2; |
5602 | | |
5603 | 5 | if((temp & ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_2D) != 0x02) |
5604 | 1 | { |
5605 | | /* Retrieve "Coordinate 3" field */ |
5606 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5607 | 1 | *offset += 2; |
5608 | 1 | } |
5609 | | |
5610 | 5 | if((temp & ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_COORDINATE) != 0x0C) |
5611 | 4 | { |
5612 | | /* Retrieve "Quality Measure" field */ |
5613 | 4 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_quality_measure, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
5614 | 4 | *offset += 1; |
5615 | | |
5616 | | /* Retrieve "Location Age" field */ |
5617 | 4 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_location_age, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5618 | 4 | *offset += 2; |
5619 | | |
5620 | 4 | } |
5621 | | |
5622 | 5 | } /*dissect_zcl_rssi_location_compact_location_data_notif*/ |
5623 | | |
5624 | | /*FUNCTION:------------------------------------------------------ |
5625 | | * NAME |
5626 | | * dissect_zcl_rssi_location_rssi_ping |
5627 | | * DESCRIPTION |
5628 | | * this function decodes the RSSI Ping payload. |
5629 | | * PARAMETERS |
5630 | | * tvb - the tv buffer of the current data_type |
5631 | | * tree - the tree to append this item to |
5632 | | * offset - offset of data in tvb |
5633 | | * RETURNS |
5634 | | * none |
5635 | | *--------------------------------------------------------------- |
5636 | | */ |
5637 | | static void |
5638 | | dissect_zcl_rssi_location_rssi_ping(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset) |
5639 | 1 | { |
5640 | | /* Retrieve "Location Type" field */ |
5641 | 1 | dissect_zcl_rssi_location_attr_data(tree, pinfo, tvb, offset, ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE, ZBEE_ZCL_8_BIT_DATA, false); |
5642 | | |
5643 | | |
5644 | 1 | } /*dissect_zcl_rssi_location_rssi_ping*/ |
5645 | | |
5646 | | |
5647 | | /*FUNCTION:------------------------------------------------------ |
5648 | | * NAME |
5649 | | * dissect_zcl_rssi_location_report_rssi_meas |
5650 | | * DESCRIPTION |
5651 | | * this function decodes the Report RSSI Measurements payload |
5652 | | * PARAMETERS |
5653 | | * tvb - the tv buffer of the current data_type |
5654 | | * tree - the tree to append this item to |
5655 | | * offset - offset of data in tvb |
5656 | | * RETURNS |
5657 | | * none |
5658 | | *--------------------------------------------------------------- |
5659 | | */ |
5660 | | static void |
5661 | | dissect_zcl_rssi_location_report_rssi_meas(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
5662 | 6 | { |
5663 | 6 | uint8_t count, i; |
5664 | | /* Retrieve "Reporting Address" field */ |
5665 | 6 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_reporting_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
5666 | 6 | *offset += 8; |
5667 | | |
5668 | | /* Retrieve "Number of Neighbours" field */ |
5669 | 6 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_rssi_location_no_of_neigh, tvb, *offset, 1, ENC_LITTLE_ENDIAN, &count); |
5670 | 6 | *offset += 1; |
5671 | | |
5672 | 17 | for( i = 0; i < count; i++) |
5673 | 11 | { |
5674 | | /* Retrieve "Neighbour Address" field */ |
5675 | 11 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_neighbour_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
5676 | 11 | *offset += 8; |
5677 | | |
5678 | | /* Retrieve "Coordinate 1" field */ |
5679 | 11 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate1, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5680 | 11 | *offset += 2; |
5681 | | |
5682 | | /* Retrieve "Coordinate 2" field */ |
5683 | 11 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate2, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5684 | 11 | *offset += 2; |
5685 | | |
5686 | | /* Retrieve "Coordinate 3" field */ |
5687 | 11 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_coordinate3, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
5688 | 11 | *offset += 2; |
5689 | | |
5690 | | /* Retrieve "RSSI" field */ |
5691 | 11 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_rssi, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
5692 | 11 | *offset += 1; |
5693 | | |
5694 | | /* Retrieve "Number RSSI Measurements" field */ |
5695 | 11 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_number_rssi_meas, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
5696 | 11 | *offset += 1; |
5697 | 11 | } |
5698 | | |
5699 | 6 | } /*dissect_zcl_rssi_location_report_rssi_meas*/ |
5700 | | |
5701 | | |
5702 | | /*FUNCTION:------------------------------------------------------------------- |
5703 | | * NAME |
5704 | | * dissect_zcl_rssi_location_request_own_location |
5705 | | * DESCRIPTION |
5706 | | * this function decodes the Request Own Location payload. |
5707 | | * PARAMETERS |
5708 | | * tvb - the tv buffer of the current data_type |
5709 | | * tree - the tree to append this item to |
5710 | | * offset - offset of data in tvb |
5711 | | * RETURNS |
5712 | | * none |
5713 | | *----------------------------------------------------------------------------- |
5714 | | */ |
5715 | | static void |
5716 | | dissect_zcl_rssi_location_request_own_location(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
5717 | 1 | { |
5718 | | /* Retrieve "Requesting Address Address" field */ |
5719 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_request_add, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
5720 | 1 | *offset += 8; |
5721 | | |
5722 | 1 | } /*dissect_zcl_rssi_location_request_own_location*/ |
5723 | | |
5724 | | |
5725 | | /*FUNCTION:------------------------------------------------------ |
5726 | | * NAME |
5727 | | * dissect_zcl_rssi_location_attr_data |
5728 | | * DESCRIPTION |
5729 | | * this function is called by ZCL foundation dissector in order to decode |
5730 | | * specific cluster attributes data. |
5731 | | * PARAMETERS |
5732 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
5733 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
5734 | | * unsigned *offset - pointer to buffer offset |
5735 | | * uint16_t attr_id - attribute identifier |
5736 | | * unsigned data_type - attribute data type |
5737 | | * bool client_attr- ZCL client |
5738 | | * RETURNS |
5739 | | * none |
5740 | | *--------------------------------------------------------------- |
5741 | | */ |
5742 | | void |
5743 | | dissect_zcl_rssi_location_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
5744 | 667 | { |
5745 | 667 | static int * const location_type[] = { |
5746 | 667 | &hf_zbee_zcl_rssi_location_location_type_absolute, |
5747 | 667 | &hf_zbee_zcl_rssi_location_location_type_2D, |
5748 | 667 | &hf_zbee_zcl_rssi_location_location_type_coordinate_system, |
5749 | 667 | &hf_zbee_zcl_rssi_location_location_type_reserved, |
5750 | 667 | NULL |
5751 | 667 | }; |
5752 | | |
5753 | | /* Dissect attribute data type and data */ |
5754 | 667 | switch ( attr_id ) { |
5755 | | |
5756 | 208 | case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE: |
5757 | 208 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_rssi_location_location_type, ett_zbee_zcl_rssi_location_location_type, location_type, ENC_LITTLE_ENDIAN); |
5758 | 208 | *offset += 1; |
5759 | 208 | break; |
5760 | | |
5761 | 15 | case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_METHOD: |
5762 | 15 | proto_tree_add_item(tree, hf_zbee_zcl_rssi_location_attr_id_location_method, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
5763 | 15 | *offset += 1; |
5764 | 15 | break; |
5765 | | |
5766 | 2 | case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_AGE: |
5767 | 3 | case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_QUALITY_MEASURE: |
5768 | 3 | case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_OF_DEVICES: |
5769 | 3 | case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_1: |
5770 | 3 | case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_2: |
5771 | 3 | case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_COORDINATE_3: |
5772 | 3 | case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_POWER: |
5773 | 3 | case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_PATH_LOSS_EXPONENT: |
5774 | 3 | case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_REPORTING_PERIOD: |
5775 | 3 | case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_CALCULATION_PERIOD: |
5776 | 3 | case ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_NUMBER_RSSI_MEAS: |
5777 | 444 | default: |
5778 | 444 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
5779 | 444 | break; |
5780 | 667 | } |
5781 | | |
5782 | 667 | } /*dissect_zcl_rssi_location_attr_data*/ |
5783 | | |
5784 | | |
5785 | | /*FUNCTION:------------------------------------------------------ |
5786 | | * NAME |
5787 | | * proto_register_zbee_zcl_rssi_location |
5788 | | * DESCRIPTION |
5789 | | * ZigBee ZCL RSSI Location cluster protocol registration routine. |
5790 | | * PARAMETERS |
5791 | | * none |
5792 | | * RETURNS |
5793 | | * void |
5794 | | *--------------------------------------------------------------- |
5795 | | */ |
5796 | | void |
5797 | | proto_register_zbee_zcl_rssi_location(void) |
5798 | 16 | { |
5799 | | /* Setup list of header fields */ |
5800 | 16 | static hf_register_info hf[] = { |
5801 | | |
5802 | 16 | { &hf_zbee_zcl_rssi_location_attr_id, |
5803 | 16 | { "Attribute", "zbee_zcl_general.rssi_location.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_rssi_location_attr_names), |
5804 | 16 | 0x00, NULL, HFILL } }, |
5805 | | |
5806 | | /* start Location Type fields */ |
5807 | 16 | { &hf_zbee_zcl_rssi_location_location_type, |
5808 | 16 | { "Location Type", "zbee_zcl_general.rssi_location.attr_id.location_type", FT_UINT8, BASE_HEX, NULL, |
5809 | 16 | 0x00, NULL, HFILL } }, |
5810 | | |
5811 | 16 | { &hf_zbee_zcl_rssi_location_location_type_absolute, |
5812 | 16 | { "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), |
5813 | 16 | ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_ABSOLUTE, NULL, HFILL } }, |
5814 | | |
5815 | 16 | { &hf_zbee_zcl_rssi_location_location_type_2D, |
5816 | 16 | { "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), |
5817 | 16 | ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_2D, NULL, HFILL } }, |
5818 | | |
5819 | 16 | { &hf_zbee_zcl_rssi_location_location_type_coordinate_system, |
5820 | 16 | { "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), |
5821 | 16 | ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_COORDINATE, NULL, HFILL } }, |
5822 | | |
5823 | 16 | { &hf_zbee_zcl_rssi_location_location_type_reserved, |
5824 | 16 | { "Reserved", "zbee_zcl_general.rssi_location.attr_id.location_type.reserved", FT_BOOLEAN, 8, NULL, |
5825 | 16 | ZBEE_ZCL_ATTR_ID_RSSI_LOCATION_LOCATION_TYPE_RESERVED, NULL, HFILL } }, |
5826 | | /* end Location Type fields */ |
5827 | | |
5828 | 16 | { &hf_zbee_zcl_rssi_location_attr_id_location_method, |
5829 | 16 | { "Location Method", "zbee_zcl_general.rssi_location.attr_id.location_method", FT_UINT8, BASE_HEX, VALS(zbee_zcl_rssi_location_location_method_values), |
5830 | 16 | 0x00, NULL, HFILL } }, |
5831 | | |
5832 | 16 | { &hf_zbee_zcl_rssi_location_coordinate1, |
5833 | 16 | { "Coordinate 1", "zbee_zcl_general.rssi_location.coordinate1", FT_UINT16, BASE_HEX, NULL, |
5834 | 16 | 0x00, NULL, HFILL } }, |
5835 | | |
5836 | 16 | { &hf_zbee_zcl_rssi_location_coordinate2, |
5837 | 16 | { "Coordinate 2", "zbee_zcl_general.rssi_location.coordinate2", FT_UINT16, BASE_HEX, NULL, |
5838 | 16 | 0x00, NULL, HFILL } }, |
5839 | | |
5840 | 16 | { &hf_zbee_zcl_rssi_location_coordinate3, |
5841 | 16 | { "Coordinate 3", "zbee_zcl_general.rssi_location.coordinate3", FT_UINT16, BASE_HEX, NULL, |
5842 | 16 | 0x00, NULL, HFILL } }, |
5843 | | |
5844 | 16 | { &hf_zbee_zcl_rssi_location_power, |
5845 | 16 | { "Power", "zbee_zcl_general.rssi_location.power", FT_UINT16, BASE_HEX, NULL, |
5846 | 16 | 0x00, NULL, HFILL } }, |
5847 | | |
5848 | 16 | { &hf_zbee_zcl_rssi_location_path_loss_expo, |
5849 | 16 | { "Path Loss Exponent", "zbee_zcl_general.rssi_location.path_loss_exponent", FT_UINT16, BASE_HEX, NULL, |
5850 | 16 | 0x00, NULL, HFILL } }, |
5851 | | |
5852 | 16 | { &hf_zbee_zcl_rssi_location_calc_period, |
5853 | 16 | { "Calculation Period", "zbee_zcl_general.rssi_location.calc_period", FT_UINT16, BASE_HEX, NULL, |
5854 | 16 | 0x00, NULL, HFILL } }, |
5855 | | |
5856 | 16 | { &hf_zbee_zcl_rssi_location_number_rssi_meas, |
5857 | 16 | { "Number RSSI Measurements", "zbee_zcl_general.rssi_location.number_rssi_meas", FT_UINT8, BASE_HEX, NULL, |
5858 | 16 | 0x00, NULL, HFILL } }, |
5859 | | |
5860 | 16 | { &hf_zbee_zcl_rssi_location_reporting_period, |
5861 | 16 | { "Reporting Period", "zbee_zcl_general.rssi_location.reporting_period", FT_UINT16, BASE_HEX, NULL, |
5862 | 16 | 0x00, NULL, HFILL } }, |
5863 | | |
5864 | 16 | { &hf_zbee_zcl_rssi_location_target_add, |
5865 | 16 | { "Target Address", "zbee_zcl_general.rssi_location.target_add", FT_UINT64, BASE_HEX, NULL, |
5866 | 16 | 0x00, NULL, HFILL } }, |
5867 | | |
5868 | 16 | { &hf_zbee_zcl_rssi_location_header, |
5869 | 16 | { "Header Data", "zbee_zcl_general.rssi_location.location_header", FT_UINT8, BASE_HEX, NULL, |
5870 | 16 | 0x00, NULL, HFILL } }, |
5871 | | |
5872 | 16 | { &hf_zbee_zcl_rssi_location_header_abs_only, |
5873 | 16 | { "Absolute Only", "zbee_zcl_general.rssi_location.header.abs_only", FT_BOOLEAN, 8, NULL, |
5874 | 16 | 0x01, NULL, HFILL } }, |
5875 | | |
5876 | 16 | { &hf_zbee_zcl_rssi_location_header_recalc, |
5877 | 16 | { "Recalculate", "zbee_zcl_general.rssi_location.header.recalc", FT_BOOLEAN, 8, NULL, |
5878 | 16 | 0x02, NULL, HFILL } }, |
5879 | | |
5880 | 16 | { &hf_zbee_zcl_rssi_location_header_bcast_ind, |
5881 | 16 | { "Broadcast Indicator", "zbee_zcl_general.rssi_location.header.bcast_ind", FT_BOOLEAN, 8, NULL, |
5882 | 16 | 0x04, NULL, HFILL } }, |
5883 | | |
5884 | 16 | { &hf_zbee_zcl_rssi_location_header_bcast_res, |
5885 | 16 | { "Broadcast Response", "zbee_zcl_general.rssi_location.header.bcast_response", FT_BOOLEAN, 8, NULL, |
5886 | 16 | 0x08, NULL, HFILL } }, |
5887 | | |
5888 | 16 | { &hf_zbee_zcl_rssi_location_header_compact_res, |
5889 | 16 | { "Compact Response", "zbee_zcl_general.rssi_location.compact_res", FT_BOOLEAN, 8, NULL, |
5890 | 16 | 0x10, NULL, HFILL } }, |
5891 | | |
5892 | 16 | { &hf_zbee_zcl_rssi_location_header_res, |
5893 | 16 | { "Reserved", "zbee_zcl_general.rssi_location.reserved", FT_BOOLEAN, 8, NULL, |
5894 | 16 | 0xE0, NULL, HFILL } }, |
5895 | | |
5896 | 16 | { &hf_zbee_zcl_rssi_location_number_responses, |
5897 | 16 | { "Number Responses", "zbee_zcl_general.rssi_location.number_responses", FT_UINT8, BASE_HEX, NULL, |
5898 | 16 | 0x00, NULL, HFILL } }, |
5899 | | |
5900 | 16 | { &hf_zbee_zcl_rssi_location_replaying_device, |
5901 | 16 | { "Replying Device", "zbee_zcl_general.rssi_location.replying_device", FT_UINT64, BASE_HEX, NULL, |
5902 | 16 | 0x00, NULL, HFILL } }, |
5903 | | |
5904 | 16 | { &hf_zbee_zcl_rssi_location_rssi, |
5905 | 16 | { "RSSI", "zbee_zcl_general.rssi_location.rssi", FT_UINT8, BASE_DEC, NULL, |
5906 | 16 | 0x00, NULL, HFILL } }, |
5907 | | |
5908 | 16 | { &hf_zbee_zcl_rssi_location_anchor_node_add, |
5909 | 16 | { "Anchor Node Address", "zbee_zcl_general.rssi_location.anchor_node_add", FT_UINT64, BASE_HEX, NULL, |
5910 | 16 | 0x00, NULL, HFILL } }, |
5911 | | |
5912 | 16 | { &hf_zbee_zcl_rssi_location_status, |
5913 | 16 | { "Status", "zbee_zcl_general.rssi_location.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names), |
5914 | 16 | 0x00, NULL, HFILL } }, |
5915 | | |
5916 | 16 | { &hf_zbee_zcl_rssi_location_quality_measure, |
5917 | 16 | { "Quality Measure", "zbee_zcl_general.rssi_location.quality_measure", FT_UINT8, BASE_HEX, NULL, |
5918 | 16 | 0x00, NULL, HFILL } }, |
5919 | | |
5920 | 16 | { &hf_zbee_zcl_rssi_location_location_age, |
5921 | 16 | { "Location Age", "zbee_zcl_general.rssi_location.location_age", FT_UINT16, BASE_HEX, NULL, |
5922 | 16 | 0x00, NULL, HFILL } }, |
5923 | | |
5924 | 16 | { &hf_zbee_zcl_rssi_location_reporting_add, |
5925 | 16 | { "Reporting Address", "zbee_zcl_general.rssi_location.reporting_add", FT_UINT64, BASE_HEX, NULL, |
5926 | 16 | 0x00, NULL, HFILL } }, |
5927 | | |
5928 | 16 | { &hf_zbee_zcl_rssi_location_no_of_neigh, |
5929 | 16 | { "Number of Neighbours", "zbee_zcl_general.rssi_location.no_of_neigh", FT_UINT8, BASE_DEC, NULL, |
5930 | 16 | 0x00, NULL, HFILL } }, |
5931 | | |
5932 | 16 | { &hf_zbee_zcl_rssi_location_neighbour_add, |
5933 | 16 | { "Neighbour Address", "zbee_zcl_general.rssi_location.neighbour_add", FT_UINT64, BASE_HEX, NULL, |
5934 | 16 | 0x00, NULL, HFILL } }, |
5935 | | |
5936 | 16 | { &hf_zbee_zcl_rssi_location_request_add, |
5937 | 16 | { "Requesting Address", "zbee_zcl_general.rssi_location.request_add", FT_UINT64, BASE_HEX, NULL, |
5938 | 16 | 0x00, NULL, HFILL } }, |
5939 | | |
5940 | 16 | { &hf_zbee_zcl_rssi_location_srv_rx_cmd_id, |
5941 | 16 | { "Command", "zbee_zcl_general.rssi_location.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_rssi_location_srv_rx_cmd_names), |
5942 | 16 | 0x00, NULL, HFILL } }, |
5943 | | |
5944 | 16 | { &hf_zbee_zcl_rssi_location_srv_tx_cmd_id, |
5945 | 16 | { "Command", "zbee_zcl_general.rssi_location.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_rssi_location_srv_tx_cmd_names), |
5946 | 16 | 0x00, NULL, HFILL } } |
5947 | | |
5948 | 16 | }; |
5949 | | |
5950 | | /* ZCL RSSI Location subtrees */ |
5951 | 16 | static int *ett[] = { |
5952 | 16 | &ett_zbee_zcl_rssi_location, |
5953 | 16 | &ett_zbee_zcl_rssi_location_location_type, |
5954 | 16 | &ett_zbee_zcl_rssi_location_header |
5955 | 16 | }; |
5956 | | |
5957 | | /* Register the ZigBee ZCL RSSI Location cluster protocol name and description */ |
5958 | 16 | proto_zbee_zcl_rssi_location = proto_register_protocol("ZigBee ZCL RSSI Location", "ZCL RSSI Location", ZBEE_PROTOABBREV_ZCL_RSSI_LOCATION); |
5959 | 16 | proto_register_field_array(proto_zbee_zcl_rssi_location, hf, array_length(hf)); |
5960 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
5961 | | |
5962 | | /* Register the ZigBee ZCL RSSI Location dissector. */ |
5963 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_RSSI_LOCATION, dissect_zbee_zcl_rssi_location, proto_zbee_zcl_rssi_location); |
5964 | | |
5965 | 16 | } /*proto_register_zbee_zcl_rssi_location*/ |
5966 | | |
5967 | | |
5968 | | /*FUNCTION:------------------------------------------------------ |
5969 | | * NAME |
5970 | | * proto_reg_handoff_zbee_zcl_rssi_location |
5971 | | * DESCRIPTION |
5972 | | * Hands off the ZCL RSSI Location dissector. |
5973 | | * PARAMETERS |
5974 | | * none |
5975 | | * RETURNS |
5976 | | * none |
5977 | | *--------------------------------------------------------------- |
5978 | | */ |
5979 | | void |
5980 | | proto_reg_handoff_zbee_zcl_rssi_location(void) |
5981 | 16 | { |
5982 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_RSSI_LOCATION, |
5983 | 16 | proto_zbee_zcl_rssi_location, |
5984 | 16 | ett_zbee_zcl_rssi_location, |
5985 | 16 | ZBEE_ZCL_CID_RSSI_LOCATION, |
5986 | 16 | ZBEE_MFG_CODE_NONE, |
5987 | 16 | hf_zbee_zcl_rssi_location_attr_id, |
5988 | 16 | hf_zbee_zcl_rssi_location_attr_id, |
5989 | 16 | hf_zbee_zcl_rssi_location_srv_rx_cmd_id, |
5990 | 16 | hf_zbee_zcl_rssi_location_srv_tx_cmd_id, |
5991 | 16 | dissect_zcl_rssi_location_attr_data |
5992 | 16 | ); |
5993 | 16 | } /*proto_reg_handoff_zbee_zcl_rssi_location*/ |
5994 | | |
5995 | | /****************************************************************************************************/ |
5996 | | /****************************************************************************************************/ |
5997 | | /****************************************************************************************************/ |
5998 | | |
5999 | | |
6000 | | /* Reliability Enumeration Values */ |
6001 | | #define ZBEE_ZCL_RELIABILITY_NO_FAULT_DETECTED 0x00 /* No Fault Detected */ |
6002 | | #define ZBEE_ZCL_RELIABILITY_NO_SENSOR 0x01 /* No Sensor */ |
6003 | | #define ZBEE_ZCL_RELIABILITY_OVER_RANGE 0x02 /* Over Range */ |
6004 | | #define ZBEE_ZCL_RELIABILITY_UNDER_RANGE 0x03 /* Under Range */ |
6005 | | #define ZBEE_ZCL_RELIABILITY_OPEN_LOOP 0x04 /* Open Loop */ |
6006 | | #define ZBEE_ZCL_RELIABILITY_SHORTED_LOOP 0x05 /* Shorted Loop */ |
6007 | | #define ZBEE_ZCL_RELIABILITY_NO_OUTPUT 0x06 /* No Output */ |
6008 | | #define ZBEE_ZCL_RELIABILITY_UNRELIABLE_OTHER 0x07 /* Unreliable Other */ |
6009 | | #define ZBEE_ZCL_RELIABILITY_PROCESS_ERROR 0x08 /* Process Error */ |
6010 | | #define ZBEE_ZCL_RELIABILITY_MULTI_STATE_FAULT 0x09 /* Multi-State Fault */ |
6011 | | #define ZBEE_ZCL_RELIABILITY_CONFIGURATION_ERROR 0x0A /* Configuration Error */ |
6012 | | |
6013 | | static const value_string zbee_zcl_reliability_names[] = { |
6014 | | {ZBEE_ZCL_RELIABILITY_NO_FAULT_DETECTED, "No Fault Detected"}, |
6015 | | {ZBEE_ZCL_RELIABILITY_NO_SENSOR, "No Sensor"}, |
6016 | | {ZBEE_ZCL_RELIABILITY_OVER_RANGE, "Over Range"}, |
6017 | | {ZBEE_ZCL_RELIABILITY_UNDER_RANGE, "Under Range"}, |
6018 | | {ZBEE_ZCL_RELIABILITY_OPEN_LOOP, "Open Loop"}, |
6019 | | {ZBEE_ZCL_RELIABILITY_SHORTED_LOOP, "Shorted Loop"}, |
6020 | | {ZBEE_ZCL_RELIABILITY_NO_OUTPUT, "No Output"}, |
6021 | | {ZBEE_ZCL_RELIABILITY_UNRELIABLE_OTHER, "Unreliable Other"}, |
6022 | | {ZBEE_ZCL_RELIABILITY_PROCESS_ERROR, "Process Error"}, |
6023 | | {ZBEE_ZCL_RELIABILITY_MULTI_STATE_FAULT, "Multi-State Fault"}, |
6024 | | {ZBEE_ZCL_RELIABILITY_CONFIGURATION_ERROR, "Configuration Error"}, |
6025 | | {0, NULL} |
6026 | | }; |
6027 | | |
6028 | | /* Status Flags Mask Values */ |
6029 | 144 | #define ZBEE_ZCL_STATUS_IN_ALARM 0x01 /* In Alarm Flag */ |
6030 | 144 | #define ZBEE_ZCL_STATUS_FAULT 0x02 /* Fault Flag */ |
6031 | 144 | #define ZBEE_ZCL_STATUS_OVERRIDDEN 0x04 /* Overridden Flag */ |
6032 | 144 | #define ZBEE_ZCL_STATUS_OUT_OF_SERVICE 0x08 /* Out of Service Flag */ |
6033 | | |
6034 | | |
6035 | | /* ########################################################################## */ |
6036 | | /* #### (0x000C) ANALOG INPUT (BASIC) CLUSTER ############################### */ |
6037 | | /* ########################################################################## */ |
6038 | | |
6039 | | /*************************/ |
6040 | | /* Defines */ |
6041 | | /*************************/ |
6042 | | |
6043 | | /*Attributes*/ |
6044 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_DESCRIPTION 0x001C /* Description */ |
6045 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MAX_PRESENT_VALUE 0x0041 /* Max Present Value */ |
6046 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MIN_PRESENT_VALUE 0x0045 /* Min Present Value */ |
6047 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */ |
6048 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_PRESENT_VALUE 0x0055 /* Present Value */ |
6049 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RELIABILITY 0x0067 /* Reliability */ |
6050 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RESOLUTION 0x006A /* Resolution */ |
6051 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_STATUS_FLAGS 0x006F /* Status Flags */ |
6052 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_ENGINEERING_UNITS 0x0075 /* Engineering Units */ |
6053 | 2 | #define ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */ |
6054 | | |
6055 | | /*Server commands received - none*/ |
6056 | | |
6057 | | /*Server commands generated - none*/ |
6058 | | |
6059 | | /*************************/ |
6060 | | /* Function Declarations */ |
6061 | | /*************************/ |
6062 | | |
6063 | | void proto_register_zbee_zcl_analog_input_basic(void); |
6064 | | void proto_reg_handoff_zbee_zcl_analog_input_basic(void); |
6065 | | |
6066 | | /* Private functions prototype */ |
6067 | | |
6068 | | /*************************/ |
6069 | | /* Global Variables */ |
6070 | | /*************************/ |
6071 | | /* Initialize the protocol and registered fields */ |
6072 | | static int proto_zbee_zcl_analog_input_basic; |
6073 | | |
6074 | | static int hf_zbee_zcl_analog_input_basic_attr_id; |
6075 | | static int hf_zbee_zcl_analog_input_basic_reliability; |
6076 | | static int hf_zbee_zcl_analog_input_basic_status_flags; |
6077 | | static int hf_zbee_zcl_analog_input_basic_status_in_alarm; |
6078 | | static int hf_zbee_zcl_analog_input_basic_status_fault; |
6079 | | static int hf_zbee_zcl_analog_input_basic_status_overridden; |
6080 | | static int hf_zbee_zcl_analog_input_basic_status_out_of_service; |
6081 | | |
6082 | | /* Initialize the subtree pointers */ |
6083 | | static int ett_zbee_zcl_analog_input_basic; |
6084 | | static int ett_zbee_zcl_analog_input_basic_status_flags; |
6085 | | |
6086 | | /* Attributes */ |
6087 | | static const value_string zbee_zcl_analog_input_basic_attr_names[] = { |
6088 | | { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_DESCRIPTION, "Description" }, |
6089 | | { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MAX_PRESENT_VALUE, "Max Present Value" }, |
6090 | | { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MIN_PRESENT_VALUE, "Min Present Value" }, |
6091 | | { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_OUT_OF_SERVICE, "Out of Service" }, |
6092 | | { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_PRESENT_VALUE, "Present Value" }, |
6093 | | { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RELIABILITY, "Reliability" }, |
6094 | | { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RESOLUTION, "Resolution" }, |
6095 | | { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_STATUS_FLAGS, "Status Flags" }, |
6096 | | { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_ENGINEERING_UNITS, "Engineering Units" }, |
6097 | | { ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_APPLICATION_TYPE, "Application Type" }, |
6098 | | { 0, NULL } |
6099 | | }; |
6100 | | |
6101 | | /*************************/ |
6102 | | /* Function Bodies */ |
6103 | | /*************************/ |
6104 | | |
6105 | | /*FUNCTION:------------------------------------------------------ |
6106 | | * NAME |
6107 | | * dissect_zbee_zcl_analog_input_basic |
6108 | | * DESCRIPTION |
6109 | | * ZigBee ZCL Analog Input Basic cluster dissector for wireshark. |
6110 | | * PARAMETERS |
6111 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
6112 | | * packet_info *pinfo - pointer to packet information fields |
6113 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
6114 | | * RETURNS |
6115 | | * int - length of parsed data. |
6116 | | *--------------------------------------------------------------- |
6117 | | */ |
6118 | | |
6119 | | static int |
6120 | | dissect_zbee_zcl_analog_input_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) |
6121 | 37 | { |
6122 | 37 | return tvb_captured_length(tvb); |
6123 | 37 | } /*dissect_zbee_zcl_analog_input_basic*/ |
6124 | | |
6125 | | |
6126 | | /*FUNCTION:------------------------------------------------------ |
6127 | | * NAME |
6128 | | * dissect_zcl_analog_input_basic_attr_data |
6129 | | * DESCRIPTION |
6130 | | * this function is called by ZCL foundation dissector in order to decode |
6131 | | * specific cluster attributes data. |
6132 | | * PARAMETERS |
6133 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
6134 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
6135 | | * unsigned *offset - pointer to buffer offset |
6136 | | * uint16_t attr_id - attribute identifier |
6137 | | * unsigned data_type - attribute data type |
6138 | | * bool client_attr- ZCL client |
6139 | | * RETURNS |
6140 | | * none |
6141 | | *--------------------------------------------------------------- |
6142 | | */ |
6143 | | static void |
6144 | | dissect_zcl_analog_input_basic_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
6145 | 177 | { |
6146 | 177 | static int * const status_flags[] = { |
6147 | 177 | &hf_zbee_zcl_analog_input_basic_status_in_alarm, |
6148 | 177 | &hf_zbee_zcl_analog_input_basic_status_fault, |
6149 | 177 | &hf_zbee_zcl_analog_input_basic_status_overridden, |
6150 | 177 | &hf_zbee_zcl_analog_input_basic_status_out_of_service, |
6151 | 177 | NULL |
6152 | 177 | }; |
6153 | | |
6154 | | /* Dissect attribute data type and data */ |
6155 | 177 | switch (attr_id) { |
6156 | | |
6157 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RELIABILITY: |
6158 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_analog_input_basic_reliability, tvb, *offset, 1, ENC_NA); |
6159 | 0 | *offset += 1; |
6160 | 0 | break; |
6161 | | |
6162 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_STATUS_FLAGS: |
6163 | 0 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_analog_input_basic_status_flags, ett_zbee_zcl_analog_input_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN); |
6164 | 0 | *offset += 1; |
6165 | 0 | break; |
6166 | | |
6167 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_DESCRIPTION: |
6168 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MAX_PRESENT_VALUE: |
6169 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_MIN_PRESENT_VALUE: |
6170 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_OUT_OF_SERVICE: |
6171 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_PRESENT_VALUE: |
6172 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_RESOLUTION: |
6173 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_ENGINEERING_UNITS: |
6174 | 2 | case ZBEE_ZCL_ATTR_ID_ANALOG_INPUT_BASIC_APPLICATION_TYPE: |
6175 | 177 | default: |
6176 | 177 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
6177 | 177 | break; |
6178 | 177 | } |
6179 | | |
6180 | 177 | } /*dissect_zcl_analog_input_basic_attr_data*/ |
6181 | | |
6182 | | |
6183 | | /*FUNCTION:------------------------------------------------------ |
6184 | | * NAME |
6185 | | * proto_register_zbee_zcl_analog_input_basic |
6186 | | * DESCRIPTION |
6187 | | * ZigBee ZCL Analog Input Basic cluster protocol registration routine. |
6188 | | * PARAMETERS |
6189 | | * none |
6190 | | * RETURNS |
6191 | | * none |
6192 | | *--------------------------------------------------------------- |
6193 | | */ |
6194 | | void |
6195 | | proto_register_zbee_zcl_analog_input_basic(void) |
6196 | 16 | { |
6197 | | /* Setup list of header fields */ |
6198 | 16 | static hf_register_info hf[] = { |
6199 | | |
6200 | 16 | { &hf_zbee_zcl_analog_input_basic_attr_id, |
6201 | 16 | { "Attribute", "zbee_zcl_general.analog_input_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_analog_input_basic_attr_names), |
6202 | 16 | 0x00, NULL, HFILL } }, |
6203 | | |
6204 | 16 | { &hf_zbee_zcl_analog_input_basic_reliability, |
6205 | 16 | { "Reliability", "zbee_zcl_general.analog_input_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names), |
6206 | 16 | 0x00, NULL, HFILL } }, |
6207 | | |
6208 | | /* start Status Flags fields */ |
6209 | 16 | { &hf_zbee_zcl_analog_input_basic_status_flags, |
6210 | 16 | { "Status Flags", "zbee_zcl_general.analog_input_basic.attr.status", FT_UINT8, BASE_HEX, NULL, |
6211 | 16 | 0x00, NULL, HFILL } }, |
6212 | | |
6213 | 16 | { &hf_zbee_zcl_analog_input_basic_status_in_alarm, |
6214 | 16 | { "In Alarm Status", "zbee_zcl_general.analog_input_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL, |
6215 | 16 | ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } }, |
6216 | | |
6217 | 16 | { &hf_zbee_zcl_analog_input_basic_status_fault, |
6218 | 16 | { "Fault Status", "zbee_zcl_general.analog_input_basic.attr.status.fault",FT_BOOLEAN, 8, NULL, |
6219 | 16 | ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } }, |
6220 | | |
6221 | 16 | { &hf_zbee_zcl_analog_input_basic_status_overridden, |
6222 | 16 | { "Overridden Status", "zbee_zcl_general.analog_input_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL, |
6223 | 16 | ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } }, |
6224 | | |
6225 | 16 | { &hf_zbee_zcl_analog_input_basic_status_out_of_service, |
6226 | 16 | { "Out of Service Status", "zbee_zcl_general.analog_input_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL, |
6227 | 16 | ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } } |
6228 | | /* end Status Flags fields */ |
6229 | 16 | }; |
6230 | | |
6231 | | /* ZCL Analog Input Basic subtrees */ |
6232 | 16 | static int *ett[] = { |
6233 | 16 | &ett_zbee_zcl_analog_input_basic, |
6234 | 16 | &ett_zbee_zcl_analog_input_basic_status_flags |
6235 | 16 | }; |
6236 | | |
6237 | | |
6238 | | |
6239 | | /* Register the ZigBee ZCL Analog Input Basic cluster protocol name and description */ |
6240 | 16 | proto_zbee_zcl_analog_input_basic = proto_register_protocol("ZigBee ZCL Analog Input Basic", "ZCL Analog Input Basic", ZBEE_PROTOABBREV_ZCL_ANALOG_INPUT_BASIC); |
6241 | 16 | proto_register_field_array(proto_zbee_zcl_analog_input_basic, hf, array_length(hf)); |
6242 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
6243 | | |
6244 | | /* Register the ZigBee ZCL Analog Input Basic dissector. */ |
6245 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_ANALOG_INPUT_BASIC, dissect_zbee_zcl_analog_input_basic, proto_zbee_zcl_analog_input_basic); |
6246 | 16 | } /*proto_register_zbee_zcl_analog_input_basic*/ |
6247 | | |
6248 | | /*FUNCTION:------------------------------------------------------ |
6249 | | * NAME |
6250 | | * proto_reg_handoff_zbee_zcl_analog_input_basic |
6251 | | * DESCRIPTION |
6252 | | * Hands off the ZCL Analog Input Basic dissector. |
6253 | | * PARAMETERS |
6254 | | * none |
6255 | | * RETURNS |
6256 | | * none |
6257 | | *--------------------------------------------------------------- |
6258 | | */ |
6259 | | void |
6260 | | proto_reg_handoff_zbee_zcl_analog_input_basic(void) |
6261 | 16 | { |
6262 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ANALOG_INPUT_BASIC, |
6263 | 16 | proto_zbee_zcl_analog_input_basic, |
6264 | 16 | ett_zbee_zcl_analog_input_basic, |
6265 | 16 | ZBEE_ZCL_CID_ANALOG_INPUT_BASIC, |
6266 | 16 | ZBEE_MFG_CODE_NONE, |
6267 | 16 | hf_zbee_zcl_analog_input_basic_attr_id, |
6268 | 16 | hf_zbee_zcl_analog_input_basic_attr_id, |
6269 | 16 | -1, -1, |
6270 | 16 | (zbee_zcl_fn_attr_data)dissect_zcl_analog_input_basic_attr_data |
6271 | 16 | ); |
6272 | 16 | } /*proto_reg_handoff_zbee_zcl_analog_input_basic*/ |
6273 | | |
6274 | | |
6275 | | /* ########################################################################## */ |
6276 | | /* #### (0x000D) ANALOG OUTPUT (BASIC) CLUSTER ############################## */ |
6277 | | /* ########################################################################## */ |
6278 | | |
6279 | | /*************************/ |
6280 | | /* Defines */ |
6281 | | /*************************/ |
6282 | | |
6283 | | /*Attributes*/ |
6284 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_DESCRIPTION 0x001C /* Description */ |
6285 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MAX_PRESENT_VALUE 0x0041 /* Max Present Value */ |
6286 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MIN_PRESENT_VALUE 0x0045 /* Min Present Value */ |
6287 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */ |
6288 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRESENT_VALUE 0x0055 /* Present Value */ |
6289 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRIORITY_ARRAY 0x0057 /* Priority Array */ |
6290 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELIABILITY 0x0067 /* Reliability */ |
6291 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELINQUISH_DEFAULT 0x0068 /* Relinquish Default */ |
6292 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RESOLUTION 0x006A /* Resolution */ |
6293 | 4 | #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_STATUS_FLAGS 0x006F /* Status Flags */ |
6294 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_ENGINEERING_UNITS 0x0075 /* Engineering Units */ |
6295 | 1 | #define ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */ |
6296 | | |
6297 | | /*Server commands received - none*/ |
6298 | | |
6299 | | /*Server commands generated - none*/ |
6300 | | |
6301 | | /*************************/ |
6302 | | /* Function Declarations */ |
6303 | | /*************************/ |
6304 | | |
6305 | | void proto_register_zbee_zcl_analog_output_basic(void); |
6306 | | void proto_reg_handoff_zbee_zcl_analog_output_basic(void); |
6307 | | |
6308 | | /* Private functions prototype */ |
6309 | | |
6310 | | /*************************/ |
6311 | | /* Global Variables */ |
6312 | | /*************************/ |
6313 | | /* Initialize the protocol and registered fields */ |
6314 | | static int proto_zbee_zcl_analog_output_basic; |
6315 | | |
6316 | | static int hf_zbee_zcl_analog_output_basic_attr_id; |
6317 | | static int hf_zbee_zcl_analog_output_basic_reliability; |
6318 | | static int hf_zbee_zcl_analog_output_basic_status_flags; |
6319 | | static int hf_zbee_zcl_analog_output_basic_status_in_alarm; |
6320 | | static int hf_zbee_zcl_analog_output_basic_status_fault; |
6321 | | static int hf_zbee_zcl_analog_output_basic_status_overridden; |
6322 | | static int hf_zbee_zcl_analog_output_basic_status_out_of_service; |
6323 | | static int hf_zbee_zcl_analog_output_basic_priority_array_bool; |
6324 | | static int hf_zbee_zcl_analog_output_basic_priority_array_sing_prec; |
6325 | | static int hf_zbee_zcl_analog_output_basic_priority_array; |
6326 | | static int hf_zbee_zcl_analog_output_basic_structure; |
6327 | | |
6328 | | /* Initialize the subtree pointers */ |
6329 | | static int ett_zbee_zcl_analog_output_basic; |
6330 | | static int ett_zbee_zcl_analog_output_basic_status_flags; |
6331 | | static int ett_zbee_zcl_analog_output_basic_priority_array; |
6332 | | static int ett_zbee_zcl_analog_output_basic_priority_array_structure; |
6333 | | |
6334 | | /* Attributes */ |
6335 | | static const value_string zbee_zcl_analog_output_basic_attr_names[] = { |
6336 | | { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_DESCRIPTION, "Description" }, |
6337 | | { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MAX_PRESENT_VALUE, "Max Present Value" }, |
6338 | | { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MIN_PRESENT_VALUE, "Min Present Value" }, |
6339 | | { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_OUT_OF_SERVICE, "Out of Service" }, |
6340 | | { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRESENT_VALUE, "Present Value" }, |
6341 | | { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRIORITY_ARRAY, "Priority Array" }, |
6342 | | { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELIABILITY, "Reliability" }, |
6343 | | { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELINQUISH_DEFAULT, "Relinquish Default" }, |
6344 | | { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RESOLUTION, "Resolution" }, |
6345 | | { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_STATUS_FLAGS, "Status Flags" }, |
6346 | | { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_ENGINEERING_UNITS, "Engineering Units" }, |
6347 | | { ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_APPLICATION_TYPE, "Application Type" }, |
6348 | | { 0, NULL } |
6349 | | }; |
6350 | | |
6351 | | /*************************/ |
6352 | | /* Function Bodies */ |
6353 | | /*************************/ |
6354 | | |
6355 | | /*FUNCTION:------------------------------------------------------ |
6356 | | * NAME |
6357 | | * dissect_zbee_zcl_analog_output_basic |
6358 | | * DESCRIPTION |
6359 | | * ZigBee ZCL Analog Output Basic cluster dissector for wireshark. |
6360 | | * PARAMETERS |
6361 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
6362 | | * packet_info *pinfo - pointer to packet information fields |
6363 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
6364 | | * RETURNS |
6365 | | * int - length of parsed data. |
6366 | | *--------------------------------------------------------------- |
6367 | | */ |
6368 | | |
6369 | | static int |
6370 | | dissect_zbee_zcl_analog_output_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) |
6371 | 21 | { |
6372 | 21 | return tvb_captured_length(tvb); |
6373 | 21 | } /*dissect_zbee_zcl_analog_output_basic*/ |
6374 | | |
6375 | | |
6376 | | /*FUNCTION:------------------------------------------------------ |
6377 | | * NAME |
6378 | | * dissect_zcl_analog_output_basic_attr_data |
6379 | | * DESCRIPTION |
6380 | | * this function is called by ZCL foundation dissector in order to decode |
6381 | | * specific cluster attributes data. |
6382 | | * PARAMETERS |
6383 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
6384 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
6385 | | * unsigned *offset - pointer to buffer offset |
6386 | | * uint16_t attr_id - attribute identifier |
6387 | | * unsigned data_type - attribute data type |
6388 | | * bool client_attr- ZCL client |
6389 | | * RETURNS |
6390 | | * none |
6391 | | *--------------------------------------------------------------- |
6392 | | */ |
6393 | | static void |
6394 | | dissect_zcl_analog_output_basic_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
6395 | 269 | { |
6396 | 269 | proto_item *ti = NULL, *tj = NULL; |
6397 | 269 | proto_tree *sub_tree = NULL, *sub = NULL; |
6398 | 269 | int i; |
6399 | | |
6400 | 269 | static int * const status_flags[] = { |
6401 | 269 | &hf_zbee_zcl_analog_output_basic_status_in_alarm, |
6402 | 269 | &hf_zbee_zcl_analog_output_basic_status_fault, |
6403 | 269 | &hf_zbee_zcl_analog_output_basic_status_overridden, |
6404 | 269 | &hf_zbee_zcl_analog_output_basic_status_out_of_service, |
6405 | 269 | NULL |
6406 | 269 | }; |
6407 | | |
6408 | | /* Dissect attribute data type and data */ |
6409 | 269 | switch (attr_id) { |
6410 | | |
6411 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRIORITY_ARRAY: |
6412 | 0 | ti = proto_tree_add_item(tree,hf_zbee_zcl_analog_output_basic_priority_array, tvb, *offset, 80, ENC_NA); |
6413 | 0 | sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_analog_output_basic_priority_array); |
6414 | |
|
6415 | 0 | for(i = 1; i <= 16; i++) |
6416 | 0 | { |
6417 | 0 | tj = proto_tree_add_item(sub_tree, hf_zbee_zcl_analog_output_basic_structure, tvb, *offset, 5, ENC_NA); |
6418 | 0 | proto_item_append_text(tj," %d",i); |
6419 | 0 | sub = proto_item_add_subtree(tj, ett_zbee_zcl_analog_output_basic_priority_array_structure); |
6420 | 0 | proto_tree_add_item(sub, hf_zbee_zcl_analog_output_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
6421 | 0 | *offset += 1; |
6422 | 0 | proto_tree_add_item(sub, hf_zbee_zcl_analog_output_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
6423 | 0 | *offset += 4; |
6424 | 0 | } |
6425 | 0 | break; |
6426 | | |
6427 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELIABILITY: |
6428 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_analog_output_basic_reliability, tvb, *offset, 1, ENC_NA); |
6429 | 0 | *offset += 1; |
6430 | 0 | break; |
6431 | | |
6432 | 4 | case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_STATUS_FLAGS: |
6433 | 4 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_analog_output_basic_status_flags, ett_zbee_zcl_analog_output_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN); |
6434 | 4 | *offset += 1; |
6435 | 4 | break; |
6436 | | |
6437 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_DESCRIPTION: |
6438 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MAX_PRESENT_VALUE: |
6439 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_MIN_PRESENT_VALUE: |
6440 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_OUT_OF_SERVICE: |
6441 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_PRESENT_VALUE: |
6442 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RELINQUISH_DEFAULT: |
6443 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_RESOLUTION: |
6444 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_ENGINEERING_UNITS: |
6445 | 1 | case ZBEE_ZCL_ATTR_ID_ANALOG_OUTPUT_BASIC_APPLICATION_TYPE: |
6446 | 265 | default: |
6447 | 265 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
6448 | 265 | break; |
6449 | 269 | } |
6450 | | |
6451 | 269 | } /*dissect_zcl_analog_output_basic_attr_data*/ |
6452 | | |
6453 | | |
6454 | | /*FUNCTION:------------------------------------------------------ |
6455 | | * NAME |
6456 | | * proto_register_zbee_zcl_analog_output_basic |
6457 | | * DESCRIPTION |
6458 | | * ZigBee ZCL Analog Output Basic cluster protocol registration routine. |
6459 | | * PARAMETERS |
6460 | | * none |
6461 | | * RETURNS |
6462 | | * none |
6463 | | *--------------------------------------------------------------- |
6464 | | */ |
6465 | | void |
6466 | | proto_register_zbee_zcl_analog_output_basic(void) |
6467 | 16 | { |
6468 | | /* Setup list of header fields */ |
6469 | 16 | static hf_register_info hf[] = { |
6470 | | |
6471 | 16 | { &hf_zbee_zcl_analog_output_basic_attr_id, |
6472 | 16 | { "Attribute", "zbee_zcl_general.analog_output_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_analog_output_basic_attr_names), |
6473 | 16 | 0x0, NULL, HFILL } }, |
6474 | | |
6475 | 16 | { &hf_zbee_zcl_analog_output_basic_reliability, |
6476 | 16 | { "Reliability", "zbee_zcl_general.analog_output_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names), |
6477 | 16 | 0x0, NULL, HFILL } }, |
6478 | | |
6479 | | /* start Status Flags fields */ |
6480 | 16 | { &hf_zbee_zcl_analog_output_basic_status_flags, |
6481 | 16 | { "Status Flags", "zbee_zcl_general.analog_output_basic.attr.status", FT_UINT8, BASE_HEX, NULL, |
6482 | 16 | 0x0, NULL, HFILL } }, |
6483 | | |
6484 | 16 | { &hf_zbee_zcl_analog_output_basic_status_in_alarm, |
6485 | 16 | { "In Alarm Status", "zbee_zcl_general.analog_output_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL, |
6486 | 16 | ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } }, |
6487 | | |
6488 | 16 | { &hf_zbee_zcl_analog_output_basic_status_fault, |
6489 | 16 | { "Fault Status", "zbee_zcl_general.analog_output_basic.attr.status.fault", FT_BOOLEAN, 8, NULL, |
6490 | 16 | ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } }, |
6491 | | |
6492 | 16 | { &hf_zbee_zcl_analog_output_basic_status_overridden, |
6493 | 16 | { "Overridden Status", "zbee_zcl_general.analog_output_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL, |
6494 | 16 | ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } }, |
6495 | | |
6496 | 16 | { &hf_zbee_zcl_analog_output_basic_status_out_of_service, |
6497 | 16 | { "Out of Service Status", "zbee_zcl_general.analog_output_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL, |
6498 | 16 | ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } }, |
6499 | | /* end Status Flags fields */ |
6500 | | |
6501 | 16 | { &hf_zbee_zcl_analog_output_basic_priority_array_bool, |
6502 | 16 | { "Valid/Invalid", "zbee_zcl_general.analog_output_basic.attr.priority_array.bool", FT_BOOLEAN, BASE_NONE, TFS(&tfs_invalid_valid), |
6503 | 16 | 0x0, NULL, HFILL } }, |
6504 | | |
6505 | 16 | { &hf_zbee_zcl_analog_output_basic_priority_array_sing_prec, |
6506 | 16 | { "Priority Value", "zbee_zcl_general.analog_output_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL, |
6507 | 16 | 0x0, NULL, HFILL } }, |
6508 | | |
6509 | 16 | { &hf_zbee_zcl_analog_output_basic_priority_array, |
6510 | 16 | { "Priority Array", "zbee_zcl_general.analog_output_basic.priority_array", FT_NONE, BASE_NONE, NULL, |
6511 | 16 | 0x0, NULL, HFILL } }, |
6512 | | |
6513 | 16 | { &hf_zbee_zcl_analog_output_basic_structure, |
6514 | 16 | { "Structure", "zbee_zcl_general.analog_output_basic.structure", FT_NONE, BASE_NONE, NULL, |
6515 | 16 | 0x0, NULL, HFILL } } |
6516 | 16 | }; |
6517 | | |
6518 | | /* ZCL Analog Output Basic subtrees */ |
6519 | 16 | static int *ett[] = { |
6520 | 16 | &ett_zbee_zcl_analog_output_basic, |
6521 | 16 | &ett_zbee_zcl_analog_output_basic_status_flags, |
6522 | 16 | &ett_zbee_zcl_analog_output_basic_priority_array, |
6523 | 16 | &ett_zbee_zcl_analog_output_basic_priority_array_structure |
6524 | 16 | }; |
6525 | | |
6526 | | |
6527 | | |
6528 | | /* Register the ZigBee ZCL Analog Output Basic cluster protocol name and description */ |
6529 | 16 | proto_zbee_zcl_analog_output_basic = proto_register_protocol("ZigBee ZCL Analog Output Basic", "ZCL Analog Output Basic", ZBEE_PROTOABBREV_ZCL_ANALOG_OUTPUT_BASIC); |
6530 | 16 | proto_register_field_array(proto_zbee_zcl_analog_output_basic, hf, array_length(hf)); |
6531 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
6532 | | |
6533 | | /* Register the ZigBee ZCL Analog Output Basic dissector. */ |
6534 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_ANALOG_OUTPUT_BASIC, dissect_zbee_zcl_analog_output_basic, proto_zbee_zcl_analog_output_basic); |
6535 | 16 | } /*proto_register_zbee_zcl_analog_output_basic*/ |
6536 | | |
6537 | | /*FUNCTION:------------------------------------------------------ |
6538 | | * NAME |
6539 | | * proto_reg_handoff_zbee_zcl_analog_output_basic |
6540 | | * DESCRIPTION |
6541 | | * Hands off the ZCL Analog Output Basic dissector. |
6542 | | * PARAMETERS |
6543 | | * none |
6544 | | * RETURNS |
6545 | | * none |
6546 | | *--------------------------------------------------------------- |
6547 | | */ |
6548 | | void |
6549 | | proto_reg_handoff_zbee_zcl_analog_output_basic(void) |
6550 | 16 | { |
6551 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ANALOG_OUTPUT_BASIC, |
6552 | 16 | proto_zbee_zcl_analog_output_basic, |
6553 | 16 | ett_zbee_zcl_analog_output_basic, |
6554 | 16 | ZBEE_ZCL_CID_ANALOG_OUTPUT_BASIC, |
6555 | 16 | ZBEE_MFG_CODE_NONE, |
6556 | 16 | hf_zbee_zcl_analog_output_basic_attr_id, |
6557 | 16 | hf_zbee_zcl_analog_output_basic_attr_id, |
6558 | 16 | -1, -1, |
6559 | 16 | dissect_zcl_analog_output_basic_attr_data |
6560 | 16 | ); |
6561 | 16 | } /*proto_reg_handoff_zbee_zcl_analog_output_basic*/ |
6562 | | |
6563 | | |
6564 | | /* ########################################################################## */ |
6565 | | /* #### (0x000E) ANALOG VALUE (BASIC) CLUSTER ############################### */ |
6566 | | /* ########################################################################## */ |
6567 | | |
6568 | | /*************************/ |
6569 | | /* Defines */ |
6570 | | /*************************/ |
6571 | | |
6572 | | /*Attributes*/ |
6573 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_DESCRIPTION 0x001C /* Description */ |
6574 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */ |
6575 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRESENT_VALUE 0x0055 /* Present Value */ |
6576 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRIORITY_ARRAY 0x0057 /* Priority Array */ |
6577 | 7 | #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELIABILITY 0x0067 /* Reliability */ |
6578 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELINQUISH_DEFAULT 0x0068 /* Relinquish Default */ |
6579 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_STATUS_FLAGS 0x006F /* Status Flags */ |
6580 | 0 | #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_ENGINEERING_UNITS 0x0075 /* Engineering Units */ |
6581 | 2 | #define ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */ |
6582 | | |
6583 | | /*Server commands received - none*/ |
6584 | | |
6585 | | /*Server commands generated - none*/ |
6586 | | |
6587 | | /*************************/ |
6588 | | /* Function Declarations */ |
6589 | | /*************************/ |
6590 | | |
6591 | | void proto_register_zbee_zcl_analog_value_basic(void); |
6592 | | void proto_reg_handoff_zbee_zcl_analog_value_basic(void); |
6593 | | |
6594 | | /* Private functions prototype */ |
6595 | | |
6596 | | /*************************/ |
6597 | | /* Global Variables */ |
6598 | | /*************************/ |
6599 | | /* Initialize the protocol and registered fields */ |
6600 | | static int proto_zbee_zcl_analog_value_basic; |
6601 | | |
6602 | | static int hf_zbee_zcl_analog_value_basic_attr_id; |
6603 | | static int hf_zbee_zcl_analog_value_basic_reliability; |
6604 | | static int hf_zbee_zcl_analog_value_basic_status_flags; |
6605 | | static int hf_zbee_zcl_analog_value_basic_status_in_alarm; |
6606 | | static int hf_zbee_zcl_analog_value_basic_status_fault; |
6607 | | static int hf_zbee_zcl_analog_value_basic_status_overridden; |
6608 | | static int hf_zbee_zcl_analog_value_basic_status_out_of_service; |
6609 | | static int hf_zbee_zcl_analog_value_basic_priority_array_bool; |
6610 | | static int hf_zbee_zcl_analog_value_basic_priority_array_sing_prec; |
6611 | | static int hf_zbee_zcl_analog_value_basic_priority_array; |
6612 | | static int hf_zbee_zcl_analog_value_basic_structure; |
6613 | | |
6614 | | /* Initialize the subtree pointers */ |
6615 | | static int ett_zbee_zcl_analog_value_basic; |
6616 | | static int ett_zbee_zcl_analog_value_basic_status_flags; |
6617 | | static int ett_zbee_zcl_analog_value_basic_priority_array; |
6618 | | static int ett_zbee_zcl_analog_value_basic_priority_array_structure; |
6619 | | |
6620 | | /* Attributes */ |
6621 | | static const value_string zbee_zcl_analog_value_basic_attr_names[] = { |
6622 | | { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_DESCRIPTION, "Description" }, |
6623 | | { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_OUT_OF_SERVICE, "Out of Service" }, |
6624 | | { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRESENT_VALUE, "Present Value" }, |
6625 | | { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRIORITY_ARRAY, "Priority Array" }, |
6626 | | { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELIABILITY, "Reliability" }, |
6627 | | { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELINQUISH_DEFAULT, "Relinquish Default" }, |
6628 | | { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_STATUS_FLAGS, "Status Flags" }, |
6629 | | { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_ENGINEERING_UNITS, "Engineering Units" }, |
6630 | | { ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_APPLICATION_TYPE, "Application Type" }, |
6631 | | { 0, NULL } |
6632 | | }; |
6633 | | |
6634 | | /*************************/ |
6635 | | /* Function Bodies */ |
6636 | | /*************************/ |
6637 | | |
6638 | | /*FUNCTION:------------------------------------------------------ |
6639 | | * NAME |
6640 | | * dissect_zbee_zcl_analog_value_basic |
6641 | | * DESCRIPTION |
6642 | | * ZigBee ZCL Analog Value Basic cluster dissector for wireshark. |
6643 | | * PARAMETERS |
6644 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
6645 | | * packet_info *pinfo - pointer to packet information fields |
6646 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
6647 | | * RETURNS |
6648 | | * int - length of parsed data. |
6649 | | *--------------------------------------------------------------- |
6650 | | */ |
6651 | | |
6652 | | static int |
6653 | | dissect_zbee_zcl_analog_value_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) |
6654 | 21 | { |
6655 | 21 | return tvb_captured_length(tvb); |
6656 | 21 | } /*dissect_zbee_zcl_analog_value_basic*/ |
6657 | | |
6658 | | |
6659 | | /*FUNCTION:------------------------------------------------------ |
6660 | | * NAME |
6661 | | * dissect_zcl_analog_value_basic_attr_data |
6662 | | * DESCRIPTION |
6663 | | * this function is called by ZCL foundation dissector in order to decode |
6664 | | * specific cluster attributes data. |
6665 | | * PARAMETERS |
6666 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
6667 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
6668 | | * unsigned *offset - pointer to buffer offset |
6669 | | * uint16_t attr_id - attribute identifier |
6670 | | * unsigned data_type - attribute data type |
6671 | | * bool client_attr- ZCL client |
6672 | | * RETURNS |
6673 | | * none |
6674 | | *--------------------------------------------------------------- |
6675 | | */ |
6676 | | static void |
6677 | | dissect_zcl_analog_value_basic_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
6678 | 163 | { |
6679 | 163 | proto_item *ti = NULL, *tj = NULL; |
6680 | 163 | proto_tree *sub_tree = NULL, *sub = NULL; |
6681 | 163 | int i; |
6682 | | |
6683 | 163 | static int * const status_flags[] = { |
6684 | 163 | &hf_zbee_zcl_analog_value_basic_status_in_alarm, |
6685 | 163 | &hf_zbee_zcl_analog_value_basic_status_fault, |
6686 | 163 | &hf_zbee_zcl_analog_value_basic_status_overridden, |
6687 | 163 | &hf_zbee_zcl_analog_value_basic_status_out_of_service, |
6688 | 163 | NULL |
6689 | 163 | }; |
6690 | | |
6691 | | /* Dissect attribute data type and data */ |
6692 | 163 | switch (attr_id) { |
6693 | | |
6694 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRIORITY_ARRAY: |
6695 | 0 | ti = proto_tree_add_item(tree,hf_zbee_zcl_analog_value_basic_priority_array, tvb, *offset, 80, ENC_NA); |
6696 | 0 | sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_analog_value_basic_priority_array); |
6697 | |
|
6698 | 0 | for( i = 1; i <= 16; i++) |
6699 | 0 | { |
6700 | 0 | tj = proto_tree_add_item(sub_tree, hf_zbee_zcl_analog_value_basic_structure, tvb, *offset, 5, ENC_NA); |
6701 | 0 | proto_item_append_text(tj," %d",i); |
6702 | 0 | sub = proto_item_add_subtree(tj, ett_zbee_zcl_analog_value_basic_priority_array_structure); |
6703 | 0 | proto_tree_add_item(sub, hf_zbee_zcl_analog_value_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
6704 | 0 | *offset += 1; |
6705 | 0 | proto_tree_add_item(sub, hf_zbee_zcl_analog_value_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
6706 | 0 | *offset += 4; |
6707 | 0 | } |
6708 | 0 | break; |
6709 | | |
6710 | 7 | case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELIABILITY: |
6711 | 7 | proto_tree_add_item(tree, hf_zbee_zcl_analog_value_basic_reliability, tvb, *offset, 1, ENC_NA); |
6712 | 7 | *offset += 1; |
6713 | 7 | break; |
6714 | | |
6715 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_STATUS_FLAGS: |
6716 | 0 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_analog_value_basic_status_flags, ett_zbee_zcl_analog_value_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN); |
6717 | 0 | *offset += 1; |
6718 | 0 | break; |
6719 | | |
6720 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_DESCRIPTION: |
6721 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_OUT_OF_SERVICE: |
6722 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_PRESENT_VALUE: |
6723 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_RELINQUISH_DEFAULT: |
6724 | 0 | case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_ENGINEERING_UNITS: |
6725 | 2 | case ZBEE_ZCL_ATTR_ID_ANALOG_VALUE_BASIC_APPLICATION_TYPE: |
6726 | 156 | default: |
6727 | 156 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
6728 | 156 | break; |
6729 | 163 | } |
6730 | | |
6731 | 163 | } /*dissect_zcl_analog_value_basic_attr_data*/ |
6732 | | |
6733 | | |
6734 | | /*FUNCTION:------------------------------------------------------ |
6735 | | * NAME |
6736 | | * proto_register_zbee_zcl_analog_value_basic |
6737 | | * DESCRIPTION |
6738 | | * ZigBee ZCL Analog Value Basic cluster protocol registration routine. |
6739 | | * PARAMETERS |
6740 | | * none |
6741 | | * RETURNS |
6742 | | * none |
6743 | | *--------------------------------------------------------------- |
6744 | | */ |
6745 | | void |
6746 | | proto_register_zbee_zcl_analog_value_basic(void) |
6747 | 16 | { |
6748 | | /* Setup list of header fields */ |
6749 | 16 | static hf_register_info hf[] = { |
6750 | | |
6751 | 16 | { &hf_zbee_zcl_analog_value_basic_attr_id, |
6752 | 16 | { "Attribute", "zbee_zcl_general.analog_value_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_analog_value_basic_attr_names), |
6753 | 16 | 0x00, NULL, HFILL } }, |
6754 | | |
6755 | 16 | { &hf_zbee_zcl_analog_value_basic_reliability, |
6756 | 16 | { "Reliability", "zbee_zcl_general.analog_value_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names), |
6757 | 16 | 0x00, NULL, HFILL } }, |
6758 | | |
6759 | | /* start Status Flags fields */ |
6760 | 16 | { &hf_zbee_zcl_analog_value_basic_status_flags, |
6761 | 16 | { "Status Flags", "zbee_zcl_general.analog_value_basic.attr.status", FT_UINT8, BASE_HEX, NULL, |
6762 | 16 | 0x00, NULL, HFILL } }, |
6763 | | |
6764 | 16 | { &hf_zbee_zcl_analog_value_basic_status_in_alarm, |
6765 | 16 | { "In Alarm Status", "zbee_zcl_general.analog_value_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL, |
6766 | 16 | ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } }, |
6767 | | |
6768 | 16 | { &hf_zbee_zcl_analog_value_basic_status_fault, |
6769 | 16 | { "Fault Status", "zbee_zcl_general.analog_value_basic.attr.status.fault", FT_BOOLEAN, 8, NULL, |
6770 | 16 | ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } }, |
6771 | | |
6772 | 16 | { &hf_zbee_zcl_analog_value_basic_status_overridden, |
6773 | 16 | { "Overridden Status", "zbee_zcl_general.analog_value_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL, |
6774 | 16 | ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } }, |
6775 | | |
6776 | 16 | { &hf_zbee_zcl_analog_value_basic_status_out_of_service, |
6777 | 16 | { "Out of Service Status", "zbee_zcl_general.analog_value_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL, |
6778 | 16 | ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } }, |
6779 | | /* end Status Flags fields */ |
6780 | | |
6781 | 16 | { &hf_zbee_zcl_analog_value_basic_priority_array_bool, |
6782 | 16 | { "Valid/Invalid", "zbee_zcl_general.analog_value_basic.attr.priority_array.bool", FT_BOOLEAN, BASE_NONE, TFS(&tfs_invalid_valid), |
6783 | 16 | 0x00, NULL, HFILL } }, |
6784 | | |
6785 | 16 | { &hf_zbee_zcl_analog_value_basic_priority_array_sing_prec, |
6786 | 16 | { "Priority Value", "zbee_zcl_general.analog_value_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL, |
6787 | 16 | 0x00, NULL, HFILL } }, |
6788 | | |
6789 | 16 | { &hf_zbee_zcl_analog_value_basic_priority_array, |
6790 | 16 | { "Priority Array", "zbee_zcl_general.analog_value_basic.priority_array", FT_NONE, BASE_NONE, NULL, |
6791 | 16 | 0x00, NULL, HFILL } }, |
6792 | | |
6793 | 16 | { &hf_zbee_zcl_analog_value_basic_structure, |
6794 | 16 | { "Structure", "zbee_zcl_general.analog_value_basic.structure", FT_NONE, BASE_NONE, NULL, |
6795 | 16 | 0x00, NULL, HFILL } } |
6796 | 16 | }; |
6797 | | |
6798 | | /* ZCL Analog Value Basic subtrees */ |
6799 | 16 | static int *ett[] = { |
6800 | 16 | &ett_zbee_zcl_analog_value_basic, |
6801 | 16 | &ett_zbee_zcl_analog_value_basic_status_flags, |
6802 | 16 | &ett_zbee_zcl_analog_value_basic_priority_array, |
6803 | 16 | &ett_zbee_zcl_analog_value_basic_priority_array_structure |
6804 | 16 | }; |
6805 | | |
6806 | | /* Register the ZigBee ZCL Analog Value Basic cluster protocol name and description */ |
6807 | 16 | proto_zbee_zcl_analog_value_basic = proto_register_protocol("ZigBee ZCL Analog Value Basic", "ZCL Analog Value Basic", ZBEE_PROTOABBREV_ZCL_ANALOG_VALUE_BASIC); |
6808 | 16 | proto_register_field_array(proto_zbee_zcl_analog_value_basic, hf, array_length(hf)); |
6809 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
6810 | | |
6811 | | /* Register the ZigBee ZCL Analog Value Basic dissector. */ |
6812 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_ANALOG_VALUE_BASIC, dissect_zbee_zcl_analog_value_basic, proto_zbee_zcl_analog_value_basic); |
6813 | 16 | } /*proto_register_zbee_zcl_analog_value_basic*/ |
6814 | | |
6815 | | /*FUNCTION:------------------------------------------------------ |
6816 | | * NAME |
6817 | | * proto_reg_handoff_zbee_zcl_analog_value_basic |
6818 | | * DESCRIPTION |
6819 | | * Hands off the ZCL Analog Value Basic dissector. |
6820 | | * PARAMETERS |
6821 | | * none |
6822 | | * RETURNS |
6823 | | * none |
6824 | | *--------------------------------------------------------------- |
6825 | | */ |
6826 | | void |
6827 | | proto_reg_handoff_zbee_zcl_analog_value_basic(void) |
6828 | 16 | { |
6829 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_ANALOG_VALUE_BASIC, |
6830 | 16 | proto_zbee_zcl_analog_value_basic, |
6831 | 16 | ett_zbee_zcl_analog_value_basic, |
6832 | 16 | ZBEE_ZCL_CID_ANALOG_VALUE_BASIC, |
6833 | 16 | ZBEE_MFG_CODE_NONE, |
6834 | 16 | hf_zbee_zcl_analog_value_basic_attr_id, |
6835 | 16 | hf_zbee_zcl_analog_value_basic_attr_id, |
6836 | 16 | -1, -1, |
6837 | 16 | dissect_zcl_analog_value_basic_attr_data |
6838 | 16 | ); |
6839 | 16 | } /*proto_reg_handoff_zbee_zcl_analog_value_basic*/ |
6840 | | |
6841 | | |
6842 | | /* ########################################################################## */ |
6843 | | /* #### (0x000F) BINARY INPUT (BASIC) CLUSTER ############################### */ |
6844 | | /* ########################################################################## */ |
6845 | | |
6846 | | /*************************/ |
6847 | | /* Defines */ |
6848 | | /*************************/ |
6849 | | |
6850 | | /*Attributes*/ |
6851 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_ACTIVE_TEXT 0x0004 /* Active Text */ |
6852 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_DESCRIPTION 0x001C /* Description */ |
6853 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_INACTIVE_TEXT 0x002E /* Inactive Text */ |
6854 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */ |
6855 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_POLARITY 0x0054 /* Polarity */ |
6856 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_PRESENT_VALUE 0x0055 /* Present Value */ |
6857 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_RELIABILITY 0x0067 /* Reliability */ |
6858 | 2 | #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_STATUS_FLAGS 0x006F /* Status Flags */ |
6859 | 4 | #define ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */ |
6860 | | |
6861 | | /*Server commands received - none*/ |
6862 | | |
6863 | | /*Server commands generated - none*/ |
6864 | | |
6865 | | static const value_string zbee_zcl_binary_input_polarity_values[] = { |
6866 | | {0, "Normal"}, |
6867 | | {1, "Reversed"}, |
6868 | | {0, NULL} |
6869 | | }; |
6870 | | |
6871 | | /*************************/ |
6872 | | /* Function Declarations */ |
6873 | | /*************************/ |
6874 | | |
6875 | | void proto_register_zbee_zcl_binary_input_basic(void); |
6876 | | void proto_reg_handoff_zbee_zcl_binary_input_basic(void); |
6877 | | |
6878 | | /* Private functions prototype */ |
6879 | | |
6880 | | /*************************/ |
6881 | | /* Global Variables */ |
6882 | | /*************************/ |
6883 | | /* Initialize the protocol and registered fields */ |
6884 | | static int proto_zbee_zcl_binary_input_basic; |
6885 | | |
6886 | | static int hf_zbee_zcl_binary_input_basic_attr_id; |
6887 | | static int hf_zbee_zcl_binary_input_basic_status_flags; |
6888 | | static int hf_zbee_zcl_binary_input_basic_status_in_alarm; |
6889 | | static int hf_zbee_zcl_binary_input_basic_status_fault; |
6890 | | static int hf_zbee_zcl_binary_input_basic_status_overridden; |
6891 | | static int hf_zbee_zcl_binary_input_basic_status_out_of_service; |
6892 | | static int hf_zbee_zcl_binary_input_basic_polarity; |
6893 | | static int hf_zbee_zcl_binary_input_basic_reliability; |
6894 | | |
6895 | | /* Initialize the subtree pointers */ |
6896 | | static int ett_zbee_zcl_binary_input_basic; |
6897 | | static int ett_zbee_zcl_binary_input_basic_status_flags; |
6898 | | |
6899 | | /* Attributes */ |
6900 | | static const value_string zbee_zcl_binary_input_basic_attr_names[] = { |
6901 | | { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_ACTIVE_TEXT, "Active Text" }, |
6902 | | { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_DESCRIPTION, "Description" }, |
6903 | | { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_INACTIVE_TEXT, "Inactive Text" }, |
6904 | | { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_OUT_OF_SERVICE, "Out of Service" }, |
6905 | | { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_POLARITY, "Polarity" }, |
6906 | | { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_PRESENT_VALUE, "Present Value" }, |
6907 | | { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_RELIABILITY, "Reliability" }, |
6908 | | { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_STATUS_FLAGS, "Status Flags" }, |
6909 | | { ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_APPLICATION_TYPE, "Application Type" }, |
6910 | | { 0, NULL } |
6911 | | }; |
6912 | | |
6913 | | /*************************/ |
6914 | | /* Function Bodies */ |
6915 | | /*************************/ |
6916 | | |
6917 | | /*FUNCTION:------------------------------------------------------ |
6918 | | * NAME |
6919 | | * dissect_zbee_zcl_binary_input_basic |
6920 | | * DESCRIPTION |
6921 | | * ZigBee ZCL Binary Input Basic cluster dissector for wireshark. |
6922 | | * PARAMETERS |
6923 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
6924 | | * packet_info *pinfo - pointer to packet information fields |
6925 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
6926 | | * RETURNS |
6927 | | * int - length of parsed data. |
6928 | | *--------------------------------------------------------------- |
6929 | | */ |
6930 | | |
6931 | | static int |
6932 | | dissect_zbee_zcl_binary_input_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) |
6933 | 5 | { |
6934 | 5 | return tvb_captured_length(tvb); |
6935 | 5 | } /*dissect_zbee_zcl_binary_input_basic*/ |
6936 | | |
6937 | | |
6938 | | /*FUNCTION:------------------------------------------------------ |
6939 | | * NAME |
6940 | | * dissect_zcl_binary_input_basic_attr_data |
6941 | | * DESCRIPTION |
6942 | | * this function is called by ZCL foundation dissector in order to decode |
6943 | | * specific cluster attributes data. |
6944 | | * PARAMETERS |
6945 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
6946 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
6947 | | * unsigned *offset - pointer to buffer offset |
6948 | | * uint16_t attr_id - attribute identifier |
6949 | | * unsigned data_type - attribute data type |
6950 | | * bool client_attr- ZCL client |
6951 | | * RETURNS |
6952 | | * none |
6953 | | *--------------------------------------------------------------- |
6954 | | */ |
6955 | | static void |
6956 | | dissect_zcl_binary_input_basic_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
6957 | 268 | { |
6958 | 268 | static int * const status_flags[] = { |
6959 | 268 | &hf_zbee_zcl_binary_input_basic_status_in_alarm, |
6960 | 268 | &hf_zbee_zcl_binary_input_basic_status_fault, |
6961 | 268 | &hf_zbee_zcl_binary_input_basic_status_overridden, |
6962 | 268 | &hf_zbee_zcl_binary_input_basic_status_out_of_service, |
6963 | 268 | NULL |
6964 | 268 | }; |
6965 | | |
6966 | | /* Dissect attribute data type and data */ |
6967 | 268 | switch (attr_id) { |
6968 | | |
6969 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_POLARITY: |
6970 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_binary_input_basic_polarity, tvb, *offset, 1, ENC_NA); |
6971 | 0 | *offset += 1; |
6972 | 0 | break; |
6973 | | |
6974 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_RELIABILITY: |
6975 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_binary_input_basic_reliability, tvb, *offset, 1, ENC_NA); |
6976 | 0 | *offset += 1; |
6977 | 0 | break; |
6978 | | |
6979 | 2 | case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_STATUS_FLAGS: |
6980 | 2 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_binary_input_basic_status_flags, ett_zbee_zcl_binary_input_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN); |
6981 | 2 | *offset += 1; |
6982 | 2 | break; |
6983 | | |
6984 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_ACTIVE_TEXT: |
6985 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_INACTIVE_TEXT: |
6986 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_DESCRIPTION: |
6987 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_OUT_OF_SERVICE: |
6988 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_PRESENT_VALUE: |
6989 | 4 | case ZBEE_ZCL_ATTR_ID_BINARY_INPUT_BASIC_APPLICATION_TYPE: |
6990 | 266 | default: |
6991 | 266 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
6992 | 266 | break; |
6993 | 268 | } |
6994 | | |
6995 | 268 | } /*dissect_zcl_binary_input_basic_attr_data*/ |
6996 | | |
6997 | | |
6998 | | /*FUNCTION:------------------------------------------------------ |
6999 | | * NAME |
7000 | | * proto_register_zbee_zcl_binary_input_basic |
7001 | | * DESCRIPTION |
7002 | | * ZigBee ZCL Binary Input Basic cluster protocol registration routine. |
7003 | | * PARAMETERS |
7004 | | * none |
7005 | | * RETURNS |
7006 | | * none |
7007 | | *--------------------------------------------------------------- |
7008 | | */ |
7009 | | void |
7010 | | proto_register_zbee_zcl_binary_input_basic(void) |
7011 | 16 | { |
7012 | | /* Setup list of header fields */ |
7013 | 16 | static hf_register_info hf[] = { |
7014 | | |
7015 | 16 | { &hf_zbee_zcl_binary_input_basic_attr_id, |
7016 | 16 | { "Attribute", "zbee_zcl_general.binary_input_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_binary_input_basic_attr_names), |
7017 | 16 | 0x00, NULL, HFILL } }, |
7018 | | |
7019 | 16 | { &hf_zbee_zcl_binary_input_basic_reliability, |
7020 | 16 | { "Reliability", "zbee_zcl_general.binary_input_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names), |
7021 | 16 | 0x00, NULL, HFILL } }, |
7022 | | |
7023 | | /* start Status Flags fields */ |
7024 | 16 | { &hf_zbee_zcl_binary_input_basic_status_flags, |
7025 | 16 | { "Status Flags", "zbee_zcl_general.binary_input_basic.attr.status", FT_UINT8, BASE_HEX, NULL, |
7026 | 16 | 0x00, NULL, HFILL } }, |
7027 | | |
7028 | 16 | { &hf_zbee_zcl_binary_input_basic_status_in_alarm, |
7029 | 16 | { "In Alarm Status", "zbee_zcl_general.binary_input_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL, |
7030 | 16 | ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } }, |
7031 | | |
7032 | 16 | { &hf_zbee_zcl_binary_input_basic_status_fault, |
7033 | 16 | { "Fault Status", "zbee_zcl_general.binary_input_basic.attr.status.fault", FT_BOOLEAN, 8, NULL, |
7034 | 16 | ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } }, |
7035 | | |
7036 | 16 | { &hf_zbee_zcl_binary_input_basic_status_overridden, |
7037 | 16 | { "Overridden Status", "zbee_zcl_general.binary_input_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL, |
7038 | 16 | ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } }, |
7039 | | |
7040 | 16 | { &hf_zbee_zcl_binary_input_basic_status_out_of_service, |
7041 | 16 | { "Out of Service Status", "zbee_zcl_general.binary_input_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL, |
7042 | 16 | ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } }, |
7043 | | /* end Status Flags fields */ |
7044 | | |
7045 | 16 | { &hf_zbee_zcl_binary_input_basic_polarity, |
7046 | 16 | { "Polarity", "zbee_zcl_general.binary_input_basic.attr.polarity", FT_UINT8, BASE_HEX, VALS(zbee_zcl_binary_input_polarity_values), |
7047 | 16 | 0x00, NULL, HFILL } } |
7048 | | |
7049 | 16 | }; |
7050 | | |
7051 | | /* ZCL Binary Input Basic subtrees */ |
7052 | 16 | static int *ett[] = { |
7053 | 16 | &ett_zbee_zcl_binary_input_basic, |
7054 | 16 | &ett_zbee_zcl_binary_input_basic_status_flags |
7055 | 16 | }; |
7056 | | |
7057 | | /* Register the ZigBee ZCL Binary Input Basic cluster protocol name and description */ |
7058 | 16 | proto_zbee_zcl_binary_input_basic = proto_register_protocol("ZigBee ZCL Binary Input Basic", "ZCL Binary Input Basic", ZBEE_PROTOABBREV_ZCL_BINARY_INPUT_BASIC); |
7059 | 16 | proto_register_field_array(proto_zbee_zcl_binary_input_basic, hf, array_length(hf)); |
7060 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
7061 | | |
7062 | | /* Register the ZigBee ZCL Binary Input Basic dissector. */ |
7063 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_BINARY_INPUT_BASIC, dissect_zbee_zcl_binary_input_basic, proto_zbee_zcl_binary_input_basic); |
7064 | 16 | } /*proto_register_zbee_zcl_binary_input_basic*/ |
7065 | | |
7066 | | /*FUNCTION:------------------------------------------------------ |
7067 | | * NAME |
7068 | | * proto_reg_handoff_zbee_zcl_binary_input_basic |
7069 | | * DESCRIPTION |
7070 | | * Hands off the ZCL Binary Input Basic dissector. |
7071 | | * PARAMETERS |
7072 | | * none |
7073 | | * RETURNS |
7074 | | * none |
7075 | | *--------------------------------------------------------------- |
7076 | | */ |
7077 | | void |
7078 | | proto_reg_handoff_zbee_zcl_binary_input_basic(void) |
7079 | 16 | { |
7080 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_BINARY_INPUT_BASIC, |
7081 | 16 | proto_zbee_zcl_binary_input_basic, |
7082 | 16 | ett_zbee_zcl_binary_input_basic, |
7083 | 16 | ZBEE_ZCL_CID_BINARY_INPUT_BASIC, |
7084 | 16 | ZBEE_MFG_CODE_NONE, |
7085 | 16 | hf_zbee_zcl_binary_input_basic_attr_id, |
7086 | 16 | hf_zbee_zcl_binary_input_basic_attr_id, |
7087 | 16 | -1, -1, |
7088 | 16 | dissect_zcl_binary_input_basic_attr_data |
7089 | 16 | ); |
7090 | 16 | } /*proto_reg_handoff_zbee_zcl_binary_input_basic*/ |
7091 | | |
7092 | | /* ########################################################################## */ |
7093 | | /* #### (0x0010) BINARY OUTPUT (BASIC) CLUSTER ############################## */ |
7094 | | /* ########################################################################## */ |
7095 | | |
7096 | | /*************************/ |
7097 | | /* Defines */ |
7098 | | /*************************/ |
7099 | | |
7100 | | /*Attributes*/ |
7101 | 2 | #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_ACTIVE_TEXT 0x0004 /* Active Text */ |
7102 | 2 | #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_DESCRIPTION 0x001C /* Description */ |
7103 | 2 | #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_INACTIVE_TEXT 0x002E /* Inactive Text */ |
7104 | 2 | #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_OFF_TIME 0x0042 /* Maximum Off Time */ |
7105 | 2 | #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_ON_TIME 0x0043 /* Minimum On Time */ |
7106 | 2 | #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */ |
7107 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_POLARITY 0x0054 /* Polarity */ |
7108 | 2 | #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRESENT_VALUE 0x0055 /* Present Value */ |
7109 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRIORITY_ARRAY 0x0057 /* Priority Array */ |
7110 | 2 | #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELIABILITY 0x0067 /* Reliability */ |
7111 | 2 | #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELINQUISH_DEFAULT 0x0068 /* Relinquish Default */ |
7112 | 1 | #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_STATUS_FLAGS 0x006F /* Status Flags */ |
7113 | 4 | #define ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */ |
7114 | | |
7115 | | /*Server commands received - none*/ |
7116 | | |
7117 | | /*Server commands generated - none*/ |
7118 | | |
7119 | | static const value_string zbee_zcl_binary_output_polarity_values[] = { |
7120 | | {0, "Normal"}, |
7121 | | {1, "Reversed"}, |
7122 | | {0, NULL} |
7123 | | }; |
7124 | | |
7125 | | /*************************/ |
7126 | | /* Function Declarations */ |
7127 | | /*************************/ |
7128 | | |
7129 | | void proto_register_zbee_zcl_binary_output_basic(void); |
7130 | | void proto_reg_handoff_zbee_zcl_binary_output_basic(void); |
7131 | | |
7132 | | /* Private functions prototype */ |
7133 | | |
7134 | | /*************************/ |
7135 | | /* Global Variables */ |
7136 | | /*************************/ |
7137 | | /* Initialize the protocol and registered fields */ |
7138 | | static int proto_zbee_zcl_binary_output_basic; |
7139 | | |
7140 | | static int hf_zbee_zcl_binary_output_basic_attr_id; |
7141 | | static int hf_zbee_zcl_binary_output_basic_status_flags; |
7142 | | static int hf_zbee_zcl_binary_output_basic_status_in_alarm; |
7143 | | static int hf_zbee_zcl_binary_output_basic_status_fault; |
7144 | | static int hf_zbee_zcl_binary_output_basic_status_overridden; |
7145 | | static int hf_zbee_zcl_binary_output_basic_status_out_of_service; |
7146 | | static int hf_zbee_zcl_binary_output_basic_priority_array_bool; |
7147 | | static int hf_zbee_zcl_binary_output_basic_priority_array_sing_prec; |
7148 | | static int hf_zbee_zcl_binary_output_basic_polarity; |
7149 | | static int hf_zbee_zcl_binary_output_basic_reliability; |
7150 | | static int hf_zbee_zcl_binary_output_basic_priority_array; |
7151 | | static int hf_zbee_zcl_binary_output_basic_structure; |
7152 | | |
7153 | | /* Initialize the subtree pointers */ |
7154 | | static int ett_zbee_zcl_binary_output_basic; |
7155 | | static int ett_zbee_zcl_binary_output_basic_status_flags; |
7156 | | static int ett_zbee_zcl_binary_output_basic_priority_array; |
7157 | | static int ett_zbee_zcl_binary_output_basic_priority_array_structure; |
7158 | | |
7159 | | /* Attributes */ |
7160 | | static const value_string zbee_zcl_binary_output_basic_attr_names[] = { |
7161 | | { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_ACTIVE_TEXT, "Active Text" }, |
7162 | | { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_DESCRIPTION, "Description" }, |
7163 | | { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_INACTIVE_TEXT, "Inactive Text" }, |
7164 | | { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_OFF_TIME, "Minimum Off Time" }, |
7165 | | { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_ON_TIME, "Minimum On Time" }, |
7166 | | { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_OUT_OF_SERVICE, "Out of Service" }, |
7167 | | { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_POLARITY, "Polarity" }, |
7168 | | { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRESENT_VALUE, "Present Value" }, |
7169 | | { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRIORITY_ARRAY, "Priority Array" }, |
7170 | | { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELIABILITY, "Reliability" }, |
7171 | | { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELINQUISH_DEFAULT, "Relinquish Default" }, |
7172 | | { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_STATUS_FLAGS, "Status Flags" }, |
7173 | | { ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_APPLICATION_TYPE, "Application Type" }, |
7174 | | { 0, NULL } |
7175 | | }; |
7176 | | |
7177 | | /*************************/ |
7178 | | /* Function Bodies */ |
7179 | | /*************************/ |
7180 | | |
7181 | | /*FUNCTION:------------------------------------------------------ |
7182 | | * NAME |
7183 | | * dissect_zbee_zcl_binary_output_basic |
7184 | | * DESCRIPTION |
7185 | | * ZigBee ZCL Binary Output Basic cluster dissector for wireshark. |
7186 | | * PARAMETERS |
7187 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
7188 | | * packet_info *pinfo - pointer to packet information fields |
7189 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
7190 | | * RETURNS |
7191 | | * int - length of parsed data. |
7192 | | *--------------------------------------------------------------- |
7193 | | */ |
7194 | | |
7195 | | static int |
7196 | | dissect_zbee_zcl_binary_output_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) |
7197 | 23 | { |
7198 | 23 | return tvb_captured_length(tvb); |
7199 | 23 | } /*dissect_zbee_zcl_binary_output_basic*/ |
7200 | | |
7201 | | |
7202 | | /*FUNCTION:------------------------------------------------------ |
7203 | | * NAME |
7204 | | * dissect_zcl_binary_output_basic_attr_data |
7205 | | * DESCRIPTION |
7206 | | * this function is called by ZCL foundation dissector in order to decode |
7207 | | * specific cluster attributes data. |
7208 | | * PARAMETERS |
7209 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
7210 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
7211 | | * unsigned *offset - pointer to buffer offset |
7212 | | * uint16_t attr_id - attribute identifier |
7213 | | * unsigned data_type - attribute data type |
7214 | | * bool client_attr- ZCL client |
7215 | | * RETURNS |
7216 | | * none |
7217 | | *--------------------------------------------------------------- |
7218 | | */ |
7219 | | static void |
7220 | | dissect_zcl_binary_output_basic_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
7221 | 298 | { |
7222 | 298 | proto_item *ti = NULL, *tj = NULL; |
7223 | 298 | proto_tree *sub_tree = NULL, *sub = NULL; |
7224 | 298 | int i; |
7225 | | |
7226 | 298 | static int * const status_flags[] = { |
7227 | 298 | &hf_zbee_zcl_binary_output_basic_status_in_alarm, |
7228 | 298 | &hf_zbee_zcl_binary_output_basic_status_fault, |
7229 | 298 | &hf_zbee_zcl_binary_output_basic_status_overridden, |
7230 | 298 | &hf_zbee_zcl_binary_output_basic_status_out_of_service, |
7231 | 298 | NULL |
7232 | 298 | }; |
7233 | | |
7234 | | /* Dissect attribute data type and data */ |
7235 | 298 | switch (attr_id) { |
7236 | | |
7237 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRIORITY_ARRAY: |
7238 | 0 | ti = proto_tree_add_item(tree,hf_zbee_zcl_binary_output_basic_priority_array, tvb, *offset, 80, ENC_NA); |
7239 | 0 | sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_binary_output_basic_priority_array); |
7240 | |
|
7241 | 0 | for(i = 1; i <= 16; i++) |
7242 | 0 | { |
7243 | 0 | tj = proto_tree_add_item(sub_tree, hf_zbee_zcl_binary_output_basic_structure, tvb, *offset, 5, ENC_NA); |
7244 | 0 | proto_item_append_text(tj," %d",i); |
7245 | 0 | sub = proto_item_add_subtree(tj, ett_zbee_zcl_binary_output_basic_priority_array_structure); |
7246 | 0 | proto_tree_add_item(sub, hf_zbee_zcl_binary_output_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
7247 | 0 | *offset += 1; |
7248 | 0 | proto_tree_add_item(sub, hf_zbee_zcl_binary_output_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
7249 | 0 | *offset += 4; |
7250 | 0 | } |
7251 | 0 | break; |
7252 | | |
7253 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_POLARITY: |
7254 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_binary_output_basic_polarity, tvb, *offset, 1, ENC_NA); |
7255 | 0 | *offset += 1; |
7256 | 0 | break; |
7257 | | |
7258 | 2 | case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELIABILITY: |
7259 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_binary_output_basic_reliability, tvb, *offset, 1, ENC_NA); |
7260 | 2 | *offset += 1; |
7261 | 2 | break; |
7262 | | |
7263 | 1 | case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_STATUS_FLAGS: |
7264 | 1 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_binary_output_basic_status_flags, ett_zbee_zcl_binary_output_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN); |
7265 | 1 | *offset += 1; |
7266 | 1 | break; |
7267 | | |
7268 | 2 | case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_ACTIVE_TEXT: |
7269 | 2 | case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_DESCRIPTION: |
7270 | 2 | case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_INACTIVE_TEXT: |
7271 | 2 | case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_OFF_TIME: |
7272 | 2 | case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_MIN_ON_TIME: |
7273 | 2 | case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_OUT_OF_SERVICE: |
7274 | 2 | case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_PRESENT_VALUE: |
7275 | 2 | case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_RELINQUISH_DEFAULT: |
7276 | 4 | case ZBEE_ZCL_ATTR_ID_BINARY_OUTPUT_BASIC_APPLICATION_TYPE: |
7277 | 295 | default: |
7278 | 295 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
7279 | 295 | break; |
7280 | 298 | } |
7281 | | |
7282 | 298 | } /*dissect_zcl_binary_output_basic_attr_data*/ |
7283 | | |
7284 | | |
7285 | | /*FUNCTION:------------------------------------------------------ |
7286 | | * NAME |
7287 | | * proto_register_zbee_zcl_binary_output_basic |
7288 | | * DESCRIPTION |
7289 | | * ZigBee ZCL Binary Output Basic cluster protocol registration routine. |
7290 | | * PARAMETERS |
7291 | | * none |
7292 | | * RETURNS |
7293 | | * none |
7294 | | *--------------------------------------------------------------- |
7295 | | */ |
7296 | | void |
7297 | | proto_register_zbee_zcl_binary_output_basic(void) |
7298 | 16 | { |
7299 | | /* Setup list of header fields */ |
7300 | 16 | static hf_register_info hf[] = { |
7301 | | |
7302 | 16 | { &hf_zbee_zcl_binary_output_basic_attr_id, |
7303 | 16 | { "Attribute", "zbee_zcl_general.binary_output_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_binary_output_basic_attr_names), |
7304 | 16 | 0x00, NULL, HFILL } }, |
7305 | | |
7306 | 16 | { &hf_zbee_zcl_binary_output_basic_reliability, |
7307 | 16 | { "Reliability", "zbee_zcl_general.binary_output_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names), |
7308 | 16 | 0x00, NULL, HFILL } }, |
7309 | | |
7310 | | /* start Status Flags fields */ |
7311 | 16 | { &hf_zbee_zcl_binary_output_basic_status_flags, |
7312 | 16 | { "Status Flags", "zbee_zcl_general.binary_output_basic.attr.status", FT_UINT8, BASE_HEX, NULL, |
7313 | 16 | 0x00, NULL, HFILL } }, |
7314 | | |
7315 | 16 | { &hf_zbee_zcl_binary_output_basic_status_in_alarm, |
7316 | 16 | { "In Alarm Status", "zbee_zcl_general.binary_output_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL, |
7317 | 16 | ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } }, |
7318 | | |
7319 | 16 | { &hf_zbee_zcl_binary_output_basic_status_fault, |
7320 | 16 | { "Fault Status", "zbee_zcl_general.binary_output_basic.attr.status.fault", FT_BOOLEAN, 8, NULL, |
7321 | 16 | ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } }, |
7322 | | |
7323 | 16 | { &hf_zbee_zcl_binary_output_basic_status_overridden, |
7324 | 16 | { "Overridden Status", "zbee_zcl_general.binary_output_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL, |
7325 | 16 | ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } }, |
7326 | | |
7327 | 16 | { &hf_zbee_zcl_binary_output_basic_status_out_of_service, |
7328 | 16 | { "Out of Service Status", "zbee_zcl_general.binary_output_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL, |
7329 | 16 | ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } }, |
7330 | | /* end Status Flags fields */ |
7331 | | |
7332 | 16 | { &hf_zbee_zcl_binary_output_basic_polarity, |
7333 | 16 | { "Polarity", "zbee_zcl_general.binary_output_basic.attr.polarity", FT_UINT8, BASE_HEX, VALS(zbee_zcl_binary_output_polarity_values), |
7334 | 16 | 0x00, NULL, HFILL } }, |
7335 | | |
7336 | 16 | { &hf_zbee_zcl_binary_output_basic_priority_array_bool, |
7337 | 16 | { "Valid/Invalid", "zbee_zcl_general.binary_output_basic.attr.priority_array.bool", FT_BOOLEAN, BASE_NONE, TFS(&tfs_invalid_valid), |
7338 | 16 | 0x00, NULL, HFILL } }, |
7339 | | |
7340 | 16 | { &hf_zbee_zcl_binary_output_basic_priority_array_sing_prec, |
7341 | 16 | { "Priority Value", "zbee_zcl_general.binary_output_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL, |
7342 | 16 | 0x00, NULL, HFILL } }, |
7343 | | |
7344 | 16 | { &hf_zbee_zcl_binary_output_basic_priority_array, |
7345 | 16 | { "Priority Array", "zbee_zcl_general.binary_output_basic.priority_array", FT_NONE, BASE_NONE, NULL, |
7346 | 16 | 0x00, NULL, HFILL } }, |
7347 | | |
7348 | 16 | { &hf_zbee_zcl_binary_output_basic_structure, |
7349 | 16 | { "Structure", "zbee_zcl_general.binary_output_basic.structure", FT_NONE, BASE_NONE, NULL, |
7350 | 16 | 0x00, NULL, HFILL } } |
7351 | 16 | }; |
7352 | | |
7353 | | /* ZCL Binary Output Basic subtrees */ |
7354 | 16 | static int *ett[] = { |
7355 | 16 | &ett_zbee_zcl_binary_output_basic, |
7356 | 16 | &ett_zbee_zcl_binary_output_basic_status_flags, |
7357 | 16 | &ett_zbee_zcl_binary_output_basic_priority_array, |
7358 | 16 | &ett_zbee_zcl_binary_output_basic_priority_array_structure |
7359 | 16 | }; |
7360 | | |
7361 | | /* Register the ZigBee ZCL Binary Output Basic cluster protocol name and description */ |
7362 | 16 | proto_zbee_zcl_binary_output_basic = proto_register_protocol("ZigBee ZCL Binary Output Basic", "ZCL Binary Output Basic", ZBEE_PROTOABBREV_ZCL_BINARY_OUTPUT_BASIC); |
7363 | 16 | proto_register_field_array(proto_zbee_zcl_binary_output_basic, hf, array_length(hf)); |
7364 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
7365 | | |
7366 | | /* Register the ZigBee ZCL Binary Output Basic dissector. */ |
7367 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_BINARY_OUTPUT_BASIC, dissect_zbee_zcl_binary_output_basic, proto_zbee_zcl_binary_output_basic); |
7368 | 16 | } /*proto_register_zbee_zcl_binary_output_basic*/ |
7369 | | |
7370 | | /*FUNCTION:------------------------------------------------------ |
7371 | | * NAME |
7372 | | * proto_reg_handoff_zbee_zcl_binary_output_basic |
7373 | | * DESCRIPTION |
7374 | | * Hands off the ZCL Binary Output Basic dissector. |
7375 | | * PARAMETERS |
7376 | | * none |
7377 | | * RETURNS |
7378 | | * none |
7379 | | *--------------------------------------------------------------- |
7380 | | */ |
7381 | | void |
7382 | | proto_reg_handoff_zbee_zcl_binary_output_basic(void) |
7383 | 16 | { |
7384 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_BINARY_OUTPUT_BASIC, |
7385 | 16 | proto_zbee_zcl_binary_output_basic, |
7386 | 16 | ett_zbee_zcl_binary_output_basic, |
7387 | 16 | ZBEE_ZCL_CID_BINARY_OUTPUT_BASIC, |
7388 | 16 | ZBEE_MFG_CODE_NONE, |
7389 | 16 | hf_zbee_zcl_binary_output_basic_attr_id, |
7390 | 16 | hf_zbee_zcl_binary_output_basic_attr_id, |
7391 | 16 | -1, -1, |
7392 | 16 | dissect_zcl_binary_output_basic_attr_data |
7393 | 16 | ); |
7394 | 16 | } /*proto_reg_handoff_zbee_zcl_binary_output_basic*/ |
7395 | | |
7396 | | /* ########################################################################## */ |
7397 | | /* #### (0x0011) BINARY VALUE (BASIC) CLUSTER ############################### */ |
7398 | | /* ########################################################################## */ |
7399 | | |
7400 | | /*************************/ |
7401 | | /* Defines */ |
7402 | | /*************************/ |
7403 | | |
7404 | | /*Attributes*/ |
7405 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_ACTIVE_TEXT 0x0004 /* Active Text */ |
7406 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_DESCRIPTION 0x001C /* Description */ |
7407 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_INACTIVE_TEXT 0x002E /* Inactive Text */ |
7408 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_OFF_TIME 0x0042 /* Maximum Off Time */ |
7409 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_ON_TIME 0x0043 /* Minimum On Time */ |
7410 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */ |
7411 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRESENT_VALUE 0x0055 /* Present Value */ |
7412 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRIORITY_ARRAY 0x0057 /* Priority Array */ |
7413 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELIABILITY 0x0067 /* Reliability */ |
7414 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELINQUISH_DEFAULT 0x0068 /* Relinquish Default */ |
7415 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_STATUS_FLAGS 0x006F /* Status Flags */ |
7416 | 0 | #define ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */ |
7417 | | |
7418 | | /*Server commands received - none*/ |
7419 | | |
7420 | | /*Server commands generated - none*/ |
7421 | | |
7422 | | /*************************/ |
7423 | | /* Function Declarations */ |
7424 | | /*************************/ |
7425 | | |
7426 | | void proto_register_zbee_zcl_binary_value_basic(void); |
7427 | | void proto_reg_handoff_zbee_zcl_binary_value_basic(void); |
7428 | | |
7429 | | /* Private functions prototype */ |
7430 | | |
7431 | | /*************************/ |
7432 | | /* Global Variables */ |
7433 | | /*************************/ |
7434 | | /* Initialize the protocol and registered fields */ |
7435 | | static int proto_zbee_zcl_binary_value_basic; |
7436 | | |
7437 | | static int hf_zbee_zcl_binary_value_basic_attr_id; |
7438 | | static int hf_zbee_zcl_binary_value_basic_status_flags; |
7439 | | static int hf_zbee_zcl_binary_value_basic_status_in_alarm; |
7440 | | static int hf_zbee_zcl_binary_value_basic_status_fault; |
7441 | | static int hf_zbee_zcl_binary_value_basic_status_overridden; |
7442 | | static int hf_zbee_zcl_binary_value_basic_status_out_of_service; |
7443 | | static int hf_zbee_zcl_binary_value_basic_priority_array_bool; |
7444 | | static int hf_zbee_zcl_binary_value_basic_priority_array_sing_prec; |
7445 | | static int hf_zbee_zcl_binary_value_basic_reliability; |
7446 | | static int hf_zbee_zcl_binary_value_basic_priority_array; |
7447 | | static int hf_zbee_zcl_binary_value_basic_structure; |
7448 | | |
7449 | | /* Initialize the subtree pointers */ |
7450 | | static int ett_zbee_zcl_binary_value_basic; |
7451 | | static int ett_zbee_zcl_binary_value_basic_status_flags; |
7452 | | static int ett_zbee_zcl_binary_value_basic_priority_array; |
7453 | | static int ett_zbee_zcl_binary_value_basic_priority_array_structure; |
7454 | | |
7455 | | /* Attributes */ |
7456 | | static const value_string zbee_zcl_binary_value_basic_attr_names[] = { |
7457 | | { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_ACTIVE_TEXT, "Active Text" }, |
7458 | | { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_DESCRIPTION, "Description" }, |
7459 | | { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_INACTIVE_TEXT, "Inactive Text" }, |
7460 | | { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_OFF_TIME, "Minimum Off Time" }, |
7461 | | { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_ON_TIME, "Minimum On Time" }, |
7462 | | { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_OUT_OF_SERVICE, "Out of Service" }, |
7463 | | { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRESENT_VALUE, "Present Value" }, |
7464 | | { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRIORITY_ARRAY, "Priority Array" }, |
7465 | | { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELIABILITY, "Reliability" }, |
7466 | | { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELINQUISH_DEFAULT, "Relinquish Default" }, |
7467 | | { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_STATUS_FLAGS, "Status Flags" }, |
7468 | | { ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_APPLICATION_TYPE, "Application Type" }, |
7469 | | { 0, NULL } |
7470 | | }; |
7471 | | |
7472 | | /*************************/ |
7473 | | /* Function Bodies */ |
7474 | | /*************************/ |
7475 | | |
7476 | | /*FUNCTION:------------------------------------------------------ |
7477 | | * NAME |
7478 | | * dissect_zbee_zcl_binary_value_basic |
7479 | | * DESCRIPTION |
7480 | | * ZigBee ZCL Binary Value Basic cluster dissector for wireshark. |
7481 | | * PARAMETERS |
7482 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
7483 | | * packet_info *pinfo - pointer to packet information fields |
7484 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
7485 | | * RETURNS |
7486 | | * int - length of parsed data. |
7487 | | *--------------------------------------------------------------- |
7488 | | */ |
7489 | | |
7490 | | static int |
7491 | | dissect_zbee_zcl_binary_value_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) |
7492 | 20 | { |
7493 | 20 | return tvb_captured_length(tvb); |
7494 | 20 | } /*dissect_zbee_zcl_binary_value_basic*/ |
7495 | | |
7496 | | |
7497 | | /*FUNCTION:------------------------------------------------------ |
7498 | | * NAME |
7499 | | * dissect_zcl_binary_value_basic_attr_data |
7500 | | * DESCRIPTION |
7501 | | * this function is called by ZCL foundation dissector in order to decode |
7502 | | * specific cluster attributes data. |
7503 | | * PARAMETERS |
7504 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
7505 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
7506 | | * unsigned *offset - pointer to buffer offset |
7507 | | * uint16_t attr_id - attribute identifier |
7508 | | * unsigned data_type - attribute data type |
7509 | | * bool client_attr- ZCL client |
7510 | | * RETURNS |
7511 | | * none |
7512 | | *--------------------------------------------------------------- |
7513 | | */ |
7514 | | static void |
7515 | | dissect_zcl_binary_value_basic_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
7516 | 101 | { |
7517 | 101 | proto_item *ti = NULL, *tj = NULL; |
7518 | 101 | proto_tree *sub_tree = NULL, *sub = NULL; |
7519 | 101 | int i; |
7520 | | |
7521 | 101 | static int * const status_flags[] = { |
7522 | 101 | &hf_zbee_zcl_binary_value_basic_status_in_alarm, |
7523 | 101 | &hf_zbee_zcl_binary_value_basic_status_fault, |
7524 | 101 | &hf_zbee_zcl_binary_value_basic_status_overridden, |
7525 | 101 | &hf_zbee_zcl_binary_value_basic_status_out_of_service, |
7526 | 101 | NULL |
7527 | 101 | }; |
7528 | | |
7529 | | /* Dissect attribute data type and data */ |
7530 | 101 | switch (attr_id) { |
7531 | | |
7532 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRIORITY_ARRAY: |
7533 | 0 | ti = proto_tree_add_item(tree,hf_zbee_zcl_binary_value_basic_priority_array, tvb, *offset, 80, ENC_NA); |
7534 | 0 | sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_binary_value_basic_priority_array); |
7535 | |
|
7536 | 0 | for( i = 1; i <= 16; i++) |
7537 | 0 | { |
7538 | 0 | tj = proto_tree_add_item(sub_tree, hf_zbee_zcl_binary_value_basic_structure, tvb, *offset, 5, ENC_NA); |
7539 | 0 | proto_item_append_text(tj," %d",i); |
7540 | 0 | sub = proto_item_add_subtree(tj, ett_zbee_zcl_binary_value_basic_priority_array_structure); |
7541 | 0 | proto_tree_add_item(sub, hf_zbee_zcl_binary_value_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
7542 | 0 | *offset += 1; |
7543 | 0 | proto_tree_add_item(sub, hf_zbee_zcl_binary_value_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
7544 | 0 | *offset += 4; |
7545 | 0 | } |
7546 | 0 | break; |
7547 | | |
7548 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELIABILITY: |
7549 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_binary_value_basic_reliability, tvb, *offset, 1, ENC_NA); |
7550 | 0 | *offset += 1; |
7551 | 0 | break; |
7552 | | |
7553 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_STATUS_FLAGS: |
7554 | 0 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_binary_value_basic_status_flags, ett_zbee_zcl_binary_value_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN); |
7555 | 0 | *offset += 1; |
7556 | 0 | break; |
7557 | | |
7558 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_ACTIVE_TEXT: |
7559 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_DESCRIPTION: |
7560 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_INACTIVE_TEXT: |
7561 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_OFF_TIME: |
7562 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_MIN_ON_TIME: |
7563 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_OUT_OF_SERVICE: |
7564 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_PRESENT_VALUE: |
7565 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_RELINQUISH_DEFAULT: |
7566 | 0 | case ZBEE_ZCL_ATTR_ID_BINARY_VALUE_BASIC_APPLICATION_TYPE: |
7567 | 101 | default: |
7568 | 101 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
7569 | 101 | break; |
7570 | 101 | } |
7571 | | |
7572 | 101 | } /*dissect_zcl_binary_value_basic_attr_data*/ |
7573 | | |
7574 | | |
7575 | | /*FUNCTION:------------------------------------------------------ |
7576 | | * NAME |
7577 | | * proto_register_zbee_zcl_binary_value_basic |
7578 | | * DESCRIPTION |
7579 | | * ZigBee ZCL Binary Value Basic cluster protocol registration routine. |
7580 | | * PARAMETERS |
7581 | | * none |
7582 | | * RETURNS |
7583 | | * none |
7584 | | *--------------------------------------------------------------- |
7585 | | */ |
7586 | | void |
7587 | | proto_register_zbee_zcl_binary_value_basic(void) |
7588 | 16 | { |
7589 | | /* Setup list of header fields */ |
7590 | 16 | static hf_register_info hf[] = { |
7591 | | |
7592 | 16 | { &hf_zbee_zcl_binary_value_basic_attr_id, |
7593 | 16 | { "Attribute", "zbee_zcl_general.binary_value_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_binary_value_basic_attr_names), |
7594 | 16 | 0x00, NULL, HFILL } }, |
7595 | | |
7596 | 16 | { &hf_zbee_zcl_binary_value_basic_reliability, |
7597 | 16 | { "Reliability", "zbee_zcl_general.binary_value_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names), |
7598 | 16 | 0x00, NULL, HFILL } }, |
7599 | | |
7600 | | /* start Status Flags fields */ |
7601 | 16 | { &hf_zbee_zcl_binary_value_basic_status_flags, |
7602 | 16 | { "Status Flags", "zbee_zcl_general.binary_value_basic.attr.status", FT_UINT8, BASE_HEX, NULL, |
7603 | 16 | 0x00, NULL, HFILL } }, |
7604 | | |
7605 | 16 | { &hf_zbee_zcl_binary_value_basic_status_in_alarm, |
7606 | 16 | { "In Alarm Status", "zbee_zcl_general.binary_value_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL, |
7607 | 16 | ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } }, |
7608 | | |
7609 | 16 | { &hf_zbee_zcl_binary_value_basic_status_fault, |
7610 | 16 | { "Fault Status", "zbee_zcl_general.binary_value_basic.attr.status.fault", FT_BOOLEAN, 8, NULL, |
7611 | 16 | ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } }, |
7612 | | |
7613 | 16 | { &hf_zbee_zcl_binary_value_basic_status_overridden, |
7614 | 16 | { "Overridden Status", "zbee_zcl_general.binary_value_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL, |
7615 | 16 | ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } }, |
7616 | | |
7617 | 16 | { &hf_zbee_zcl_binary_value_basic_status_out_of_service, |
7618 | 16 | { "Out of Service Status", "zbee_zcl_general.binary_value_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL, |
7619 | 16 | ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } }, |
7620 | | /* end Status Flags fields */ |
7621 | | |
7622 | 16 | { &hf_zbee_zcl_binary_value_basic_priority_array_bool, |
7623 | 16 | { "Valid/Invalid", "zbee_zcl_general.binary_value_basic.attr.priority_array.bool", FT_BOOLEAN, BASE_NONE, TFS(&tfs_invalid_valid), |
7624 | 16 | 0x00, NULL, HFILL } }, |
7625 | | |
7626 | 16 | { &hf_zbee_zcl_binary_value_basic_priority_array_sing_prec, |
7627 | 16 | { "Priority Value", "zbee_zcl_general.binary_value_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL, |
7628 | 16 | 0x00, NULL, HFILL } }, |
7629 | | |
7630 | 16 | { &hf_zbee_zcl_binary_value_basic_priority_array, |
7631 | 16 | { "Priority Array", "zbee_zcl_general.binary_value_basic.priority_array", FT_NONE, BASE_NONE, NULL, |
7632 | 16 | 0x00, NULL, HFILL } }, |
7633 | | |
7634 | 16 | { &hf_zbee_zcl_binary_value_basic_structure, |
7635 | 16 | { "Structure", "zbee_zcl_general.binary_value_basic.structure", FT_NONE, BASE_NONE, NULL, |
7636 | 16 | 0x00, NULL, HFILL } } |
7637 | 16 | }; |
7638 | | |
7639 | | /* ZCL Binary Value Basic subtrees */ |
7640 | 16 | static int *ett[] = { |
7641 | 16 | &ett_zbee_zcl_binary_value_basic, |
7642 | 16 | &ett_zbee_zcl_binary_value_basic_status_flags, |
7643 | 16 | &ett_zbee_zcl_binary_value_basic_priority_array, |
7644 | 16 | &ett_zbee_zcl_binary_value_basic_priority_array_structure |
7645 | 16 | }; |
7646 | | |
7647 | | /* Register the ZigBee ZCL Binary Value Basic cluster protocol name and description */ |
7648 | 16 | proto_zbee_zcl_binary_value_basic = proto_register_protocol("ZigBee ZCL Binary Value Basic", "ZCL Binary Value Basic", ZBEE_PROTOABBREV_ZCL_BINARY_VALUE_BASIC); |
7649 | 16 | proto_register_field_array(proto_zbee_zcl_binary_value_basic, hf, array_length(hf)); |
7650 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
7651 | | |
7652 | | /* Register the ZigBee ZCL Binary Value Basic dissector. */ |
7653 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_BINARY_VALUE_BASIC, dissect_zbee_zcl_binary_value_basic, proto_zbee_zcl_binary_value_basic); |
7654 | 16 | } /*proto_register_zbee_zcl_binary_value_basic*/ |
7655 | | |
7656 | | /*FUNCTION:------------------------------------------------------ |
7657 | | * NAME |
7658 | | * proto_reg_handoff_zbee_zcl_binary_value_basic |
7659 | | * DESCRIPTION |
7660 | | * Hands off the ZCL Binary Value Basic dissector. |
7661 | | * PARAMETERS |
7662 | | * none |
7663 | | * RETURNS |
7664 | | * none |
7665 | | *--------------------------------------------------------------- |
7666 | | */ |
7667 | | void |
7668 | | proto_reg_handoff_zbee_zcl_binary_value_basic(void) |
7669 | 16 | { |
7670 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_BINARY_VALUE_BASIC, |
7671 | 16 | proto_zbee_zcl_binary_value_basic, |
7672 | 16 | ett_zbee_zcl_binary_value_basic, |
7673 | 16 | ZBEE_ZCL_CID_BINARY_VALUE_BASIC, |
7674 | 16 | ZBEE_MFG_CODE_NONE, |
7675 | 16 | hf_zbee_zcl_binary_value_basic_attr_id, |
7676 | 16 | hf_zbee_zcl_binary_value_basic_attr_id, |
7677 | 16 | -1, -1, |
7678 | 16 | dissect_zcl_binary_value_basic_attr_data |
7679 | 16 | ); |
7680 | 16 | } /*proto_reg_handoff_zbee_zcl_binary_value_basic*/ |
7681 | | |
7682 | | |
7683 | | /* ########################################################################## */ |
7684 | | /* #### (0x0012) MULTISTATE INPUT (BASIC) CLUSTER ########################### */ |
7685 | | /* ########################################################################## */ |
7686 | | |
7687 | | /*************************/ |
7688 | | /* Defines */ |
7689 | | /*************************/ |
7690 | | |
7691 | | /*Attributes*/ |
7692 | | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_STATE_TEXT 0x000E /* State Text */ |
7693 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_DESCRIPTION 0x001C /* Description */ |
7694 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_NUMBER_OF_STATES 0x004A /* Number of States */ |
7695 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */ |
7696 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_PRESENT_VALUE 0x0055 /* Present Value */ |
7697 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_RELIABILITY 0x0067 /* Reliability */ |
7698 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_STATUS_FLAGS 0x006F /* Status Flags */ |
7699 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */ |
7700 | | |
7701 | | /*Server commands received - none*/ |
7702 | | |
7703 | | /*Server commands generated - none*/ |
7704 | | |
7705 | | /*************************/ |
7706 | | /* Function Declarations */ |
7707 | | /*************************/ |
7708 | | |
7709 | | void proto_register_zbee_zcl_multistate_input_basic(void); |
7710 | | void proto_reg_handoff_zbee_zcl_multistate_input_basic(void); |
7711 | | |
7712 | | /* Private functions prototype */ |
7713 | | |
7714 | | /*************************/ |
7715 | | /* Global Variables */ |
7716 | | /*************************/ |
7717 | | /* Initialize the protocol and registered fields */ |
7718 | | static int proto_zbee_zcl_multistate_input_basic; |
7719 | | |
7720 | | static int hf_zbee_zcl_multistate_input_basic_attr_id; |
7721 | | static int hf_zbee_zcl_multistate_input_basic_status_flags; |
7722 | | static int hf_zbee_zcl_multistate_input_basic_status_in_alarm; |
7723 | | static int hf_zbee_zcl_multistate_input_basic_status_fault; |
7724 | | static int hf_zbee_zcl_multistate_input_basic_status_overridden; |
7725 | | static int hf_zbee_zcl_multistate_input_basic_status_out_of_service; |
7726 | | static int hf_zbee_zcl_multistate_input_basic_reliability; |
7727 | | |
7728 | | /* Initialize the subtree pointers */ |
7729 | | static int ett_zbee_zcl_multistate_input_basic; |
7730 | | static int ett_zbee_zcl_multistate_input_basic_status_flags; |
7731 | | |
7732 | | /* Attributes */ |
7733 | | static const value_string zbee_zcl_multistate_input_basic_attr_names[] = { |
7734 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_STATE_TEXT, "State Text" }, |
7735 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_DESCRIPTION, "Description" }, |
7736 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_NUMBER_OF_STATES, "Number of States" }, |
7737 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_OUT_OF_SERVICE, "Out of Service" }, |
7738 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_PRESENT_VALUE, "Present Value" }, |
7739 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_RELIABILITY, "Reliability" }, |
7740 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_STATUS_FLAGS, "Status Flags" }, |
7741 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_APPLICATION_TYPE, "Application Type" }, |
7742 | | { 0, NULL } |
7743 | | }; |
7744 | | |
7745 | | /*************************/ |
7746 | | /* Function Bodies */ |
7747 | | /*************************/ |
7748 | | |
7749 | | /*FUNCTION:------------------------------------------------------ |
7750 | | * NAME |
7751 | | * dissect_zbee_zcl_multistate_input_basic |
7752 | | * DESCRIPTION |
7753 | | * ZigBee ZCL Multistate Input Basic cluster dissector for wireshark. |
7754 | | * PARAMETERS |
7755 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
7756 | | * packet_info *pinfo - pointer to packet information fields |
7757 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
7758 | | * RETURNS |
7759 | | * none |
7760 | | *--------------------------------------------------------------- |
7761 | | */ |
7762 | | |
7763 | | static int |
7764 | | dissect_zbee_zcl_multistate_input_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) |
7765 | 2 | { |
7766 | 2 | return tvb_captured_length(tvb); |
7767 | 2 | } /*dissect_zbee_zcl_multistate_input_basic*/ |
7768 | | |
7769 | | |
7770 | | /*FUNCTION:------------------------------------------------------ |
7771 | | * NAME |
7772 | | * dissect_zcl_multistate_input_basic_attr_data |
7773 | | * DESCRIPTION |
7774 | | * this function is called by ZCL foundation dissector in order to decode |
7775 | | * specific cluster attributes data. |
7776 | | * PARAMETERS |
7777 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
7778 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
7779 | | * unsigned *offset - pointer to buffer offset |
7780 | | * uint16_t attr_id - attribute identifier |
7781 | | * unsigned data_type - attribute data type |
7782 | | * bool client_attr- ZCL client |
7783 | | * RETURNS |
7784 | | * none |
7785 | | *--------------------------------------------------------------- |
7786 | | */ |
7787 | | static void |
7788 | | dissect_zcl_multistate_input_basic_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
7789 | 117 | { |
7790 | 117 | static int * const status_flags[] = { |
7791 | 117 | &hf_zbee_zcl_multistate_input_basic_status_in_alarm, |
7792 | 117 | &hf_zbee_zcl_multistate_input_basic_status_fault, |
7793 | 117 | &hf_zbee_zcl_multistate_input_basic_status_overridden, |
7794 | 117 | &hf_zbee_zcl_multistate_input_basic_status_out_of_service, |
7795 | 117 | NULL |
7796 | 117 | }; |
7797 | | |
7798 | | /* Dissect attribute data type and data */ |
7799 | 117 | switch (attr_id) { |
7800 | | |
7801 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_RELIABILITY: |
7802 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_multistate_input_basic_reliability, tvb, *offset, 1, ENC_NA); |
7803 | 0 | *offset += 1; |
7804 | 0 | break; |
7805 | | |
7806 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_STATUS_FLAGS: |
7807 | 0 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_multistate_input_basic_status_flags, ett_zbee_zcl_multistate_input_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN); |
7808 | 0 | *offset += 1; |
7809 | 0 | break; |
7810 | | |
7811 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_DESCRIPTION: |
7812 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_NUMBER_OF_STATES: |
7813 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_OUT_OF_SERVICE: |
7814 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_PRESENT_VALUE: |
7815 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_INPUT_BASIC_APPLICATION_TYPE: |
7816 | 117 | default: |
7817 | 117 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
7818 | 117 | break; |
7819 | 117 | } |
7820 | | |
7821 | 117 | } /*dissect_zcl_multistate_input_basic_attr_data*/ |
7822 | | |
7823 | | |
7824 | | /*FUNCTION:------------------------------------------------------ |
7825 | | * NAME |
7826 | | * proto_register_zbee_zcl_multistate_input_basic |
7827 | | * DESCRIPTION |
7828 | | * ZigBee ZCL Multistate Input Basic cluster protocol registration routine. |
7829 | | * PARAMETERS |
7830 | | * none |
7831 | | * RETURNS |
7832 | | * void |
7833 | | *--------------------------------------------------------------- |
7834 | | */ |
7835 | | void |
7836 | | proto_register_zbee_zcl_multistate_input_basic(void) |
7837 | 16 | { |
7838 | | /* Setup list of header fields */ |
7839 | 16 | static hf_register_info hf[] = { |
7840 | | |
7841 | 16 | { &hf_zbee_zcl_multistate_input_basic_attr_id, |
7842 | 16 | { "Attribute", "zbee_zcl_general.multistate_input_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_multistate_input_basic_attr_names), |
7843 | 16 | 0x00, NULL, HFILL } }, |
7844 | | |
7845 | 16 | { &hf_zbee_zcl_multistate_input_basic_reliability, |
7846 | 16 | { "Reliability", "zbee_zcl_general.multistate_input_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names), |
7847 | 16 | 0x00, NULL, HFILL } }, |
7848 | | |
7849 | | /* start Status Flags fields */ |
7850 | 16 | { &hf_zbee_zcl_multistate_input_basic_status_flags, |
7851 | 16 | { "Status Flags", "zbee_zcl_general.multistate_input_basic.attr.status", FT_UINT8, BASE_HEX, NULL, |
7852 | 16 | 0x00, NULL, HFILL } }, |
7853 | | |
7854 | 16 | { &hf_zbee_zcl_multistate_input_basic_status_in_alarm, |
7855 | 16 | { "In Alarm Status", "zbee_zcl_general.multistate_input_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL, |
7856 | 16 | ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } }, |
7857 | | |
7858 | 16 | { &hf_zbee_zcl_multistate_input_basic_status_fault, |
7859 | 16 | { "Fault Status", "zbee_zcl_general.multistate_input_basic.attr.status.fault", FT_BOOLEAN, 8, NULL, |
7860 | 16 | ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } }, |
7861 | | |
7862 | 16 | { &hf_zbee_zcl_multistate_input_basic_status_overridden, |
7863 | 16 | { "Overridden Status", "zbee_zcl_general.multistate_input_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL, |
7864 | 16 | ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } }, |
7865 | | |
7866 | 16 | { &hf_zbee_zcl_multistate_input_basic_status_out_of_service, |
7867 | 16 | { "Out of Service Status", "zbee_zcl_general.multistate_input_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL, |
7868 | 16 | ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } } |
7869 | | /* end Status Flags fields */ |
7870 | 16 | }; |
7871 | | |
7872 | | /* ZCL Multistate Input Basic subtrees */ |
7873 | 16 | static int *ett[] = { |
7874 | 16 | &ett_zbee_zcl_multistate_input_basic, |
7875 | 16 | &ett_zbee_zcl_multistate_input_basic_status_flags |
7876 | 16 | }; |
7877 | | |
7878 | | /* Register the ZigBee ZCL Multistate Input Basic cluster protocol name and description */ |
7879 | 16 | proto_zbee_zcl_multistate_input_basic = proto_register_protocol("ZigBee ZCL Multistate Input Basic", "ZCL Multistate Input Basic", ZBEE_PROTOABBREV_ZCL_MULTISTATE_INPUT_BASIC); |
7880 | 16 | proto_register_field_array(proto_zbee_zcl_multistate_input_basic, hf, array_length(hf)); |
7881 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
7882 | | |
7883 | | /* Register the ZigBee ZCL Multistate Input Basic dissector. */ |
7884 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_MULTISTATE_INPUT_BASIC, dissect_zbee_zcl_multistate_input_basic, proto_zbee_zcl_multistate_input_basic); |
7885 | 16 | } /*proto_register_zbee_zcl_multistate_input_basic*/ |
7886 | | |
7887 | | /*FUNCTION:------------------------------------------------------ |
7888 | | * NAME |
7889 | | * proto_reg_handoff_zbee_zcl_multistate_input_basic |
7890 | | * DESCRIPTION |
7891 | | * Hands off the ZCL Multistate Input Basic dissector. |
7892 | | * PARAMETERS |
7893 | | * none |
7894 | | * RETURNS |
7895 | | * none |
7896 | | *--------------------------------------------------------------- |
7897 | | */ |
7898 | | void |
7899 | | proto_reg_handoff_zbee_zcl_multistate_input_basic(void) |
7900 | 16 | { |
7901 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_MULTISTATE_INPUT_BASIC, |
7902 | 16 | proto_zbee_zcl_multistate_input_basic, |
7903 | 16 | ett_zbee_zcl_multistate_input_basic, |
7904 | 16 | ZBEE_ZCL_CID_MULTISTATE_INPUT_BASIC, |
7905 | 16 | ZBEE_MFG_CODE_NONE, |
7906 | 16 | hf_zbee_zcl_multistate_input_basic_attr_id, |
7907 | 16 | hf_zbee_zcl_multistate_input_basic_attr_id, |
7908 | 16 | -1, -1, |
7909 | 16 | dissect_zcl_multistate_input_basic_attr_data |
7910 | 16 | ); |
7911 | 16 | } /*proto_reg_handoff_zbee_zcl_multistate_input_basic*/ |
7912 | | |
7913 | | |
7914 | | /* ########################################################################## */ |
7915 | | /* #### (0x0013) MULTISTATE OUTPUT (BASIC) CLUSTER ########################## */ |
7916 | | /* ########################################################################## */ |
7917 | | |
7918 | | /*************************/ |
7919 | | /* Defines */ |
7920 | | /*************************/ |
7921 | | |
7922 | | /*Attributes*/ |
7923 | | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_STATE_TEXT 0x000E /* State Text */ |
7924 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_DESCRIPTION 0x001C /* Description */ |
7925 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_NUMBER_OF_STATES 0x004A /* Number of States */ |
7926 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */ |
7927 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRESENT_VALUE 0x0055 /* Present Value */ |
7928 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRIORITY_ARRAY 0x0057 /* Priority Array */ |
7929 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELIABILITY 0x0067 /* Reliability */ |
7930 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELINQUISH_DEFAULT 0x0068 /* Relinquish Default */ |
7931 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_STATUS_FLAGS 0x006F /* Status Flags */ |
7932 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */ |
7933 | | |
7934 | | /*Server commands received - none*/ |
7935 | | |
7936 | | /*Server commands generated - none*/ |
7937 | | |
7938 | | /*************************/ |
7939 | | /* Function Declarations */ |
7940 | | /*************************/ |
7941 | | |
7942 | | void proto_register_zbee_zcl_multistate_output_basic(void); |
7943 | | void proto_reg_handoff_zbee_zcl_multistate_output_basic(void); |
7944 | | |
7945 | | /* Private functions prototype */ |
7946 | | |
7947 | | /*************************/ |
7948 | | /* Global Variables */ |
7949 | | /*************************/ |
7950 | | /* Initialize the protocol and registered fields */ |
7951 | | static int proto_zbee_zcl_multistate_output_basic; |
7952 | | |
7953 | | static int hf_zbee_zcl_multistate_output_basic_attr_id; |
7954 | | static int hf_zbee_zcl_multistate_output_basic_status_flags; |
7955 | | static int hf_zbee_zcl_multistate_output_basic_status_in_alarm; |
7956 | | static int hf_zbee_zcl_multistate_output_basic_status_fault; |
7957 | | static int hf_zbee_zcl_multistate_output_basic_status_overridden; |
7958 | | static int hf_zbee_zcl_multistate_output_basic_status_out_of_service; |
7959 | | static int hf_zbee_zcl_multistate_output_basic_reliability; |
7960 | | static int hf_zbee_zcl_multistate_output_basic_priority_array_bool; |
7961 | | static int hf_zbee_zcl_multistate_output_basic_priority_array_sing_prec; |
7962 | | static int hf_zbee_zcl_multistate_output_basic_priority_array; |
7963 | | static int hf_zbee_zcl_multistate_output_basic_structure; |
7964 | | |
7965 | | /* Initialize the subtree pointers */ |
7966 | | static int ett_zbee_zcl_multistate_output_basic; |
7967 | | static int ett_zbee_zcl_multistate_output_basic_status_flags; |
7968 | | static int ett_zbee_zcl_multistate_output_basic_priority_array; |
7969 | | static int ett_zbee_zcl_multistate_output_basic_priority_array_structure; |
7970 | | |
7971 | | /* Attributes */ |
7972 | | static const value_string zbee_zcl_multistate_basic_attr_names[] = { |
7973 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_STATE_TEXT, "State Text" }, |
7974 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_DESCRIPTION, "Description" }, |
7975 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_NUMBER_OF_STATES, "Number of States" }, |
7976 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_OUT_OF_SERVICE, "Out of Service" }, |
7977 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRESENT_VALUE, "Present Value" }, |
7978 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRIORITY_ARRAY, "Priority Array" }, |
7979 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELIABILITY, "Reliability" }, |
7980 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELINQUISH_DEFAULT, "Relinquish Default" }, |
7981 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_STATUS_FLAGS, "Status Flags" }, |
7982 | | { ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_APPLICATION_TYPE, "Application Type" }, |
7983 | | { 0, NULL } |
7984 | | }; |
7985 | | |
7986 | | static const value_string zbee_zcl_multistate_output_basic_priority_array_bool_values[] = { |
7987 | | { 0x01, "Valid" }, |
7988 | | { 0x00, "Invalid" }, |
7989 | | { 0, NULL } |
7990 | | }; |
7991 | | |
7992 | | /*************************/ |
7993 | | /* Function Bodies */ |
7994 | | /*************************/ |
7995 | | |
7996 | | /*FUNCTION:------------------------------------------------------ |
7997 | | * NAME |
7998 | | * dissect_zbee_zcl_multistate_output_basic |
7999 | | * DESCRIPTION |
8000 | | * ZigBee ZCL Multistate Output Basic cluster dissector for wireshark. |
8001 | | * PARAMETERS |
8002 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
8003 | | * packet_info *pinfo - pointer to packet information fields |
8004 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
8005 | | * RETURNS |
8006 | | * none |
8007 | | *--------------------------------------------------------------- |
8008 | | */ |
8009 | | |
8010 | | static int |
8011 | | dissect_zbee_zcl_multistate_output_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) |
8012 | 9 | { |
8013 | 9 | return tvb_captured_length(tvb); |
8014 | 9 | } /*dissect_zbee_zcl_multistate_output_basic*/ |
8015 | | |
8016 | | |
8017 | | /*FUNCTION:------------------------------------------------------ |
8018 | | * NAME |
8019 | | * dissect_zcl_multistate_output_basic_attr_data |
8020 | | * DESCRIPTION |
8021 | | * this function is called by ZCL foundation dissector in order to decode |
8022 | | * specific cluster attributes data. |
8023 | | * PARAMETERS |
8024 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
8025 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
8026 | | * unsigned *offset - pointer to buffer offset |
8027 | | * uint16_t attr_id - attribute identifier |
8028 | | * unsigned data_type - attribute data type |
8029 | | * bool client_attr- ZCL client |
8030 | | * RETURNS |
8031 | | * none |
8032 | | *--------------------------------------------------------------- |
8033 | | */ |
8034 | | static void |
8035 | | dissect_zcl_multistate_output_basic_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
8036 | 65 | { |
8037 | 65 | proto_item *ti = NULL, *tj = NULL; |
8038 | 65 | proto_tree *sub_tree = NULL, *sub = NULL; |
8039 | 65 | int i; |
8040 | | |
8041 | 65 | static int * const status_flags[] = { |
8042 | 65 | &hf_zbee_zcl_multistate_output_basic_status_in_alarm, |
8043 | 65 | &hf_zbee_zcl_multistate_output_basic_status_fault, |
8044 | 65 | &hf_zbee_zcl_multistate_output_basic_status_overridden, |
8045 | 65 | &hf_zbee_zcl_multistate_output_basic_status_out_of_service, |
8046 | 65 | NULL |
8047 | 65 | }; |
8048 | | |
8049 | | /* Dissect attribute data type and data */ |
8050 | 65 | switch (attr_id) { |
8051 | | |
8052 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRIORITY_ARRAY: |
8053 | 0 | ti = proto_tree_add_item(tree,hf_zbee_zcl_multistate_output_basic_priority_array, tvb, *offset, 80, ENC_NA); |
8054 | 0 | sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_multistate_output_basic_priority_array); |
8055 | |
|
8056 | 0 | for( i = 1; i <= 16; i++) |
8057 | 0 | { |
8058 | 0 | tj = proto_tree_add_item(sub_tree, hf_zbee_zcl_multistate_output_basic_structure, tvb, *offset, 5, ENC_NA); |
8059 | 0 | proto_item_append_text(tj," %d",i); |
8060 | 0 | sub = proto_item_add_subtree(tj, ett_zbee_zcl_multistate_output_basic_priority_array_structure); |
8061 | 0 | proto_tree_add_item(sub, hf_zbee_zcl_multistate_output_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
8062 | 0 | *offset += 1; |
8063 | 0 | proto_tree_add_item(sub, hf_zbee_zcl_multistate_output_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
8064 | 0 | *offset += 4; |
8065 | 0 | } |
8066 | 0 | break; |
8067 | | |
8068 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELIABILITY: |
8069 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_multistate_output_basic_reliability, tvb, *offset, 1, ENC_NA); |
8070 | 0 | *offset += 1; |
8071 | 0 | break; |
8072 | | |
8073 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_STATUS_FLAGS: |
8074 | 0 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_multistate_output_basic_status_flags, ett_zbee_zcl_multistate_output_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN); |
8075 | 0 | *offset += 1; |
8076 | 0 | break; |
8077 | | |
8078 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_DESCRIPTION: |
8079 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_NUMBER_OF_STATES: |
8080 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_OUT_OF_SERVICE: |
8081 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_RELINQUISH_DEFAULT: |
8082 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_PRESENT_VALUE: |
8083 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_OUTPUT_BASIC_APPLICATION_TYPE: |
8084 | 65 | default: |
8085 | 65 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
8086 | 65 | break; |
8087 | 65 | } |
8088 | | |
8089 | 65 | } /*dissect_zcl_multistate_output_basic_attr_data*/ |
8090 | | |
8091 | | |
8092 | | /*FUNCTION:------------------------------------------------------ |
8093 | | * NAME |
8094 | | * proto_register_zbee_zcl_multistate_output_basic |
8095 | | * DESCRIPTION |
8096 | | * ZigBee ZCL Multistate Output Basic cluster protocol registration routine. |
8097 | | * PARAMETERS |
8098 | | * none |
8099 | | * RETURNS |
8100 | | * void |
8101 | | *--------------------------------------------------------------- |
8102 | | */ |
8103 | | void |
8104 | | proto_register_zbee_zcl_multistate_output_basic(void) |
8105 | 16 | { |
8106 | | /* Setup list of header fields */ |
8107 | 16 | static hf_register_info hf[] = { |
8108 | | |
8109 | 16 | { &hf_zbee_zcl_multistate_output_basic_attr_id, |
8110 | 16 | { "Attribute", "zbee_zcl_general.multistate_output_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_multistate_basic_attr_names), |
8111 | 16 | 0x00, NULL, HFILL } }, |
8112 | | |
8113 | 16 | { &hf_zbee_zcl_multistate_output_basic_reliability, |
8114 | 16 | { "Reliability", "zbee_zcl_general.multistate_output_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names), |
8115 | 16 | 0x00, NULL, HFILL } }, |
8116 | | |
8117 | | /* start Status Flags fields */ |
8118 | 16 | { &hf_zbee_zcl_multistate_output_basic_status_flags, |
8119 | 16 | { "Status Flags", "zbee_zcl_general.multistate_output_basic.attr.status", FT_UINT8, BASE_HEX, NULL, |
8120 | 16 | 0x00, NULL, HFILL } }, |
8121 | | |
8122 | 16 | { &hf_zbee_zcl_multistate_output_basic_status_in_alarm, |
8123 | 16 | { "In Alarm Status", "zbee_zcl_general.multistate_output_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL, |
8124 | 16 | ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } }, |
8125 | | |
8126 | 16 | { &hf_zbee_zcl_multistate_output_basic_status_fault, |
8127 | 16 | { "Fault Status", "zbee_zcl_general.multistate_output_basic.attr.status.fault", FT_BOOLEAN, 8, NULL, |
8128 | 16 | ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } }, |
8129 | | |
8130 | 16 | { &hf_zbee_zcl_multistate_output_basic_status_overridden, |
8131 | 16 | { "Overridden Status", "zbee_zcl_general.multistate_output_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL, |
8132 | 16 | ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } }, |
8133 | | |
8134 | 16 | { &hf_zbee_zcl_multistate_output_basic_status_out_of_service, |
8135 | 16 | { "Out of Service Status", "zbee_zcl_general.multistate_output_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL, |
8136 | 16 | ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } }, |
8137 | | /* end Status Flags fields */ |
8138 | | |
8139 | 16 | { &hf_zbee_zcl_multistate_output_basic_priority_array_bool, |
8140 | 16 | { "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), |
8141 | 16 | 0x00, NULL, HFILL } }, |
8142 | | |
8143 | 16 | { &hf_zbee_zcl_multistate_output_basic_priority_array_sing_prec, |
8144 | 16 | { "Priority Value", "zbee_zcl_general.multistate_output_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL, |
8145 | 16 | 0x00, NULL, HFILL } } , |
8146 | | |
8147 | 16 | { &hf_zbee_zcl_multistate_output_basic_priority_array, |
8148 | 16 | { "Priority Array", "zbee_zcl_general.multistate_output_basic.priority_array", FT_NONE, BASE_NONE, NULL, |
8149 | 16 | 0x00, NULL, HFILL } }, |
8150 | | |
8151 | 16 | { &hf_zbee_zcl_multistate_output_basic_structure, |
8152 | 16 | { "Structure", "zbee_zcl_general.multistate_output_basic.structure", FT_NONE, BASE_NONE, NULL, |
8153 | 16 | 0x00, NULL, HFILL } } |
8154 | 16 | }; |
8155 | | |
8156 | | /* ZCL Multistate Output Basic subtrees */ |
8157 | 16 | static int *ett[] = { |
8158 | 16 | &ett_zbee_zcl_multistate_output_basic, |
8159 | 16 | &ett_zbee_zcl_multistate_output_basic_status_flags, |
8160 | 16 | &ett_zbee_zcl_multistate_output_basic_priority_array, |
8161 | 16 | &ett_zbee_zcl_multistate_output_basic_priority_array_structure |
8162 | 16 | }; |
8163 | | |
8164 | | /* Register the ZigBee ZCL Multistate Output Basic cluster protocol name and description */ |
8165 | 16 | proto_zbee_zcl_multistate_output_basic = proto_register_protocol("ZigBee ZCL Multistate Output Basic", "ZCL Multistate Output Basic", ZBEE_PROTOABBREV_ZCL_MULTISTATE_OUTPUT_BASIC); |
8166 | 16 | proto_register_field_array(proto_zbee_zcl_multistate_output_basic, hf, array_length(hf)); |
8167 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
8168 | | |
8169 | | /* Register the ZigBee ZCL Multistate Output Basic dissector. */ |
8170 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_MULTISTATE_OUTPUT_BASIC, dissect_zbee_zcl_multistate_output_basic, proto_zbee_zcl_multistate_output_basic); |
8171 | 16 | } /*proto_register_zbee_zcl_multistate_output_basic*/ |
8172 | | |
8173 | | /*FUNCTION:------------------------------------------------------ |
8174 | | * NAME |
8175 | | * proto_reg_handoff_zbee_zcl_multistate_output_basic |
8176 | | * DESCRIPTION |
8177 | | * Hands off the ZCL Multistate Output Basic dissector. |
8178 | | * PARAMETERS |
8179 | | * none |
8180 | | * RETURNS |
8181 | | * none |
8182 | | *--------------------------------------------------------------- |
8183 | | */ |
8184 | | void |
8185 | | proto_reg_handoff_zbee_zcl_multistate_output_basic(void) |
8186 | 16 | { |
8187 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_MULTISTATE_OUTPUT_BASIC, |
8188 | 16 | proto_zbee_zcl_multistate_output_basic, |
8189 | 16 | ett_zbee_zcl_multistate_output_basic, |
8190 | 16 | ZBEE_ZCL_CID_MULTISTATE_OUTPUT_BASIC, |
8191 | 16 | ZBEE_MFG_CODE_NONE, |
8192 | 16 | hf_zbee_zcl_multistate_output_basic_attr_id, |
8193 | 16 | hf_zbee_zcl_multistate_output_basic_attr_id, |
8194 | 16 | -1,-1, |
8195 | 16 | dissect_zcl_multistate_output_basic_attr_data |
8196 | 16 | ); |
8197 | 16 | } /*proto_reg_handoff_zbee_zcl_multistate_output_basic*/ |
8198 | | |
8199 | | |
8200 | | /* ########################################################################## */ |
8201 | | /* #### (0x0014) MULTISTATE VALUE (BASIC) CLUSTER ########################### */ |
8202 | | /* ########################################################################## */ |
8203 | | |
8204 | | /*************************/ |
8205 | | /* Defines */ |
8206 | | /*************************/ |
8207 | | |
8208 | | /*Attributes*/ |
8209 | | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_STATE_TEXT 0x000E /* State Text */ |
8210 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_DESCRIPTION 0x001C /* Description */ |
8211 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_NUMBER_OF_STATES 0x004A /* Number of States */ |
8212 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_OUT_OF_SERVICE 0x0051 /* Out of Service */ |
8213 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_PRESENT_VALUE 0x0055 /* Present Value */ |
8214 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_PRIORITY_ARRAY 0x0057 /* Priority Array */ |
8215 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_RELIABILITY 0x0067 /* Reliability */ |
8216 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_RELINQUISH_DEFAULT 0x0068 /* Relinquish Default */ |
8217 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_STATUS_FLAGS 0x006F /* Status Flags */ |
8218 | 0 | #define ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_APPLICATION_TYPE 0x0100 /* Application Type */ |
8219 | | |
8220 | | /*Server commands received - none*/ |
8221 | | |
8222 | | /*Server commands generated - none*/ |
8223 | | |
8224 | | /*************************/ |
8225 | | /* Function Declarations */ |
8226 | | /*************************/ |
8227 | | |
8228 | | void proto_register_zbee_zcl_multistate_value_basic(void); |
8229 | | void proto_reg_handoff_zbee_zcl_multistate_value_basic(void); |
8230 | | |
8231 | | /* Private functions prototype */ |
8232 | | |
8233 | | /*************************/ |
8234 | | /* Global Variables */ |
8235 | | /*************************/ |
8236 | | /* Initialize the protocol and registered fields */ |
8237 | | static int proto_zbee_zcl_multistate_value_basic; |
8238 | | |
8239 | | static int hf_zbee_zcl_multistate_value_basic_attr_id; |
8240 | | static int hf_zbee_zcl_multistate_value_basic_status_flags; |
8241 | | static int hf_zbee_zcl_multistate_value_basic_status_in_alarm; |
8242 | | static int hf_zbee_zcl_multistate_value_basic_status_fault; |
8243 | | static int hf_zbee_zcl_multistate_value_basic_status_overridden; |
8244 | | static int hf_zbee_zcl_multistate_value_basic_status_out_of_service; |
8245 | | static int hf_zbee_zcl_multistate_value_basic_reliability; |
8246 | | static int hf_zbee_zcl_multistate_value_basic_priority_array_bool; |
8247 | | static int hf_zbee_zcl_multistate_value_basic_priority_array_sing_prec; |
8248 | | static int hf_zbee_zcl_multistate_value_basic_priority_array; |
8249 | | static int hf_zbee_zcl_multistate_value_basic_structure; |
8250 | | |
8251 | | |
8252 | | /* Initialize the subtree pointers */ |
8253 | | static int ett_zbee_zcl_multistate_value_basic; |
8254 | | static int ett_zbee_zcl_multistate_value_basic_status_flags; |
8255 | | static int ett_zbee_zcl_multistate_value_basic_priority_array; |
8256 | | static int ett_zbee_zcl_multistate_value_basic_priority_array_structure; |
8257 | | |
8258 | | |
8259 | | static const value_string zbee_zcl_multistate_value_basic_priority_array_bool_values[] = { |
8260 | | { 0x01, "Valid" }, |
8261 | | { 0x00, "Invalid" }, |
8262 | | { 0, NULL } |
8263 | | }; |
8264 | | |
8265 | | /*************************/ |
8266 | | /* Function Bodies */ |
8267 | | /*************************/ |
8268 | | |
8269 | | /*FUNCTION:------------------------------------------------------ |
8270 | | * NAME |
8271 | | * dissect_zbee_zcl_multistate_value_basic |
8272 | | * DESCRIPTION |
8273 | | * ZigBee ZCL Multistate Value Basic cluster dissector for wireshark. |
8274 | | * PARAMETERS |
8275 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
8276 | | * packet_info *pinfo - pointer to packet information fields |
8277 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
8278 | | * RETURNS |
8279 | | * none |
8280 | | *--------------------------------------------------------------- |
8281 | | */ |
8282 | | |
8283 | | static int |
8284 | | dissect_zbee_zcl_multistate_value_basic(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) |
8285 | 25 | { |
8286 | 25 | return tvb_captured_length(tvb); |
8287 | 25 | } /*dissect_zbee_zcl_multistate_value_basic*/ |
8288 | | |
8289 | | |
8290 | | /*FUNCTION:------------------------------------------------------ |
8291 | | * NAME |
8292 | | * dissect_zcl_multistate_value_basic_attr_data |
8293 | | * DESCRIPTION |
8294 | | * this function is called by ZCL foundation dissector in order to decode |
8295 | | * specific cluster attributes data. |
8296 | | * PARAMETERS |
8297 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
8298 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
8299 | | * unsigned *offset - pointer to buffer offset |
8300 | | * uint16_t attr_id - attribute identifier |
8301 | | * unsigned data_type - attribute data type |
8302 | | * bool client_attr- ZCL client |
8303 | | * RETURNS |
8304 | | * none |
8305 | | *--------------------------------------------------------------- |
8306 | | */ |
8307 | | static void |
8308 | | dissect_zcl_multistate_value_basic_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
8309 | 58 | { |
8310 | 58 | proto_item *ti = NULL, *tj = NULL; |
8311 | 58 | proto_tree *sub_tree = NULL, *sub = NULL; |
8312 | 58 | int i; |
8313 | | |
8314 | 58 | static int * const status_flags[] = { |
8315 | 58 | &hf_zbee_zcl_multistate_value_basic_status_in_alarm, |
8316 | 58 | &hf_zbee_zcl_multistate_value_basic_status_fault, |
8317 | 58 | &hf_zbee_zcl_multistate_value_basic_status_overridden, |
8318 | 58 | &hf_zbee_zcl_multistate_value_basic_status_out_of_service, |
8319 | 58 | NULL |
8320 | 58 | }; |
8321 | | |
8322 | | /* Dissect attribute data type and data */ |
8323 | 58 | switch (attr_id) { |
8324 | | |
8325 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_PRIORITY_ARRAY: |
8326 | 0 | ti = proto_tree_add_item(tree,hf_zbee_zcl_multistate_value_basic_priority_array, tvb, *offset, 80, ENC_NA); |
8327 | 0 | sub_tree = proto_item_add_subtree(ti, ett_zbee_zcl_multistate_value_basic_priority_array); |
8328 | |
|
8329 | 0 | for( i = 1; i <= 16; i++) |
8330 | 0 | { |
8331 | 0 | tj = proto_tree_add_item(sub_tree,hf_zbee_zcl_multistate_value_basic_structure, tvb, *offset, 5,ENC_NA); |
8332 | 0 | proto_item_append_text(tj," %d",i); |
8333 | 0 | sub = proto_item_add_subtree(tj, ett_zbee_zcl_multistate_value_basic_priority_array_structure); |
8334 | 0 | proto_tree_add_item(sub, hf_zbee_zcl_multistate_value_basic_priority_array_bool, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
8335 | 0 | *offset += 1; |
8336 | 0 | proto_tree_add_item(sub, hf_zbee_zcl_multistate_value_basic_priority_array_sing_prec, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
8337 | 0 | *offset += 4; |
8338 | 0 | } |
8339 | 0 | break; |
8340 | | |
8341 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_RELIABILITY: |
8342 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_multistate_value_basic_reliability, tvb, *offset, 1, ENC_NA); |
8343 | 0 | *offset += 1; |
8344 | 0 | break; |
8345 | | |
8346 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_STATUS_FLAGS: |
8347 | 0 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_multistate_value_basic_status_flags, ett_zbee_zcl_multistate_value_basic_status_flags, status_flags, ENC_LITTLE_ENDIAN); |
8348 | 0 | *offset += 1; |
8349 | 0 | break; |
8350 | | |
8351 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_DESCRIPTION: |
8352 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_NUMBER_OF_STATES: |
8353 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_OUT_OF_SERVICE: |
8354 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_RELINQUISH_DEFAULT: |
8355 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_PRESENT_VALUE: |
8356 | 0 | case ZBEE_ZCL_ATTR_ID_MULTISTATE_VALUE_BASIC_APPLICATION_TYPE: |
8357 | 58 | default: |
8358 | 58 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
8359 | 58 | break; |
8360 | 58 | } |
8361 | | |
8362 | 58 | } /*dissect_zcl_multistate_value_basic_attr_data*/ |
8363 | | |
8364 | | |
8365 | | /*FUNCTION:------------------------------------------------------ |
8366 | | * NAME |
8367 | | * proto_register_zbee_zcl_multistate_value_basic |
8368 | | * DESCRIPTION |
8369 | | * ZigBee ZCL Multistate Value Basic cluster protocol registration routine. |
8370 | | * PARAMETERS |
8371 | | * none |
8372 | | * RETURNS |
8373 | | * void |
8374 | | *--------------------------------------------------------------- |
8375 | | */ |
8376 | | void |
8377 | | proto_register_zbee_zcl_multistate_value_basic(void) |
8378 | 16 | { |
8379 | | /* Setup list of header fields */ |
8380 | 16 | static hf_register_info hf[] = { |
8381 | | |
8382 | 16 | { &hf_zbee_zcl_multistate_value_basic_attr_id, |
8383 | 16 | { "Attribute", "zbee_zcl_general.multistate_value_basic.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_multistate_basic_attr_names), |
8384 | 16 | 0x00, NULL, HFILL } }, |
8385 | | |
8386 | 16 | { &hf_zbee_zcl_multistate_value_basic_reliability, |
8387 | 16 | { "Reliability", "zbee_zcl_general.multistate_value_basic.attr.reliability", FT_UINT8, BASE_HEX, VALS(zbee_zcl_reliability_names), |
8388 | 16 | 0x00, NULL, HFILL } }, |
8389 | | |
8390 | | /* start Status Flags fields */ |
8391 | 16 | { &hf_zbee_zcl_multistate_value_basic_status_flags, |
8392 | 16 | { "Status Flags", "zbee_zcl_general.multistate_value_basic.attr.status", FT_UINT8, BASE_HEX, NULL, |
8393 | 16 | 0x00, NULL, HFILL } }, |
8394 | | |
8395 | 16 | { &hf_zbee_zcl_multistate_value_basic_status_in_alarm, |
8396 | 16 | { "In Alarm Status", "zbee_zcl_general.multistate_value_basic.attr.status.in_alarm", FT_BOOLEAN, 8, NULL, |
8397 | 16 | ZBEE_ZCL_STATUS_IN_ALARM, NULL, HFILL } }, |
8398 | | |
8399 | 16 | { &hf_zbee_zcl_multistate_value_basic_status_fault, |
8400 | 16 | { "Fault Status", "zbee_zcl_general.multistate_value_basic.attr.status.fault", FT_BOOLEAN, 8, NULL, |
8401 | 16 | ZBEE_ZCL_STATUS_FAULT, NULL, HFILL } }, |
8402 | | |
8403 | 16 | { &hf_zbee_zcl_multistate_value_basic_status_overridden, |
8404 | 16 | { "Overridden Status", "zbee_zcl_general.multistate_value_basic.attr.status.overridden", FT_BOOLEAN, 8, NULL, |
8405 | 16 | ZBEE_ZCL_STATUS_OVERRIDDEN, NULL, HFILL } }, |
8406 | | |
8407 | 16 | { &hf_zbee_zcl_multistate_value_basic_status_out_of_service, |
8408 | 16 | { "Out of Service Status", "zbee_zcl_general.multistate_value_basic.attr.status.out_of_service", FT_BOOLEAN, 8, NULL, |
8409 | 16 | ZBEE_ZCL_STATUS_OUT_OF_SERVICE, NULL, HFILL } }, |
8410 | | /* end Status Flags fields */ |
8411 | | |
8412 | 16 | { &hf_zbee_zcl_multistate_value_basic_priority_array_bool, |
8413 | 16 | { "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), |
8414 | 16 | 0x00, NULL, HFILL } }, |
8415 | | |
8416 | 16 | { &hf_zbee_zcl_multistate_value_basic_priority_array_sing_prec, |
8417 | 16 | { "Priority Value", "zbee_zcl_general.multistate_value_basic.attr.priority_array.sing_prec", FT_UINT32, BASE_HEX, NULL, |
8418 | 16 | 0x00, NULL, HFILL } }, |
8419 | | |
8420 | 16 | { &hf_zbee_zcl_multistate_value_basic_priority_array, |
8421 | 16 | { "Priority Array", "zbee_zcl_general.multistate_value_basic.priority_array", FT_NONE, BASE_NONE, NULL, |
8422 | 16 | 0x00, NULL, HFILL } }, |
8423 | | |
8424 | 16 | { &hf_zbee_zcl_multistate_value_basic_structure, |
8425 | 16 | { "Structure", "zbee_zcl_general.multistate_value_basic.structure", FT_NONE, BASE_NONE, NULL, |
8426 | 16 | 0x00, NULL, HFILL } } |
8427 | 16 | }; |
8428 | | |
8429 | | /* ZCL Multistate Value Basic subtrees */ |
8430 | 16 | static int *ett[] = { |
8431 | 16 | &ett_zbee_zcl_multistate_value_basic, |
8432 | 16 | &ett_zbee_zcl_multistate_value_basic_status_flags, |
8433 | 16 | &ett_zbee_zcl_multistate_value_basic_priority_array, |
8434 | 16 | &ett_zbee_zcl_multistate_value_basic_priority_array_structure |
8435 | 16 | }; |
8436 | | |
8437 | | /* Register the ZigBee ZCL Multistate Value Basic cluster protocol name and description */ |
8438 | 16 | proto_zbee_zcl_multistate_value_basic = proto_register_protocol("ZigBee ZCL Multistate Value Basic", "ZCL Multistate Value Basic", ZBEE_PROTOABBREV_ZCL_MULTISTATE_VALUE_BASIC); |
8439 | 16 | proto_register_field_array(proto_zbee_zcl_multistate_value_basic, hf, array_length(hf)); |
8440 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
8441 | | |
8442 | | /* Register the ZigBee ZCL Multistate Value Basic dissector. */ |
8443 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_MULTISTATE_VALUE_BASIC, dissect_zbee_zcl_multistate_value_basic, proto_zbee_zcl_multistate_value_basic); |
8444 | 16 | } /*proto_register_zbee_zcl_multistate_value_basic*/ |
8445 | | |
8446 | | /*FUNCTION:------------------------------------------------------ |
8447 | | * NAME |
8448 | | * proto_reg_handoff_zbee_zcl_multistate_value_basic |
8449 | | * DESCRIPTION |
8450 | | * Hands off the ZCL Multistate Value Basic dissector. |
8451 | | * PARAMETERS |
8452 | | * none |
8453 | | * RETURNS |
8454 | | * none |
8455 | | *--------------------------------------------------------------- |
8456 | | */ |
8457 | | void |
8458 | | proto_reg_handoff_zbee_zcl_multistate_value_basic(void) |
8459 | 16 | { |
8460 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_MULTISTATE_VALUE_BASIC, |
8461 | 16 | proto_zbee_zcl_multistate_value_basic, |
8462 | 16 | ett_zbee_zcl_multistate_value_basic, |
8463 | 16 | ZBEE_ZCL_CID_MULTISTATE_VALUE_BASIC, |
8464 | 16 | ZBEE_MFG_CODE_NONE, |
8465 | 16 | hf_zbee_zcl_multistate_value_basic_attr_id, |
8466 | 16 | hf_zbee_zcl_multistate_value_basic_attr_id, |
8467 | 16 | -1, -1, |
8468 | 16 | (zbee_zcl_fn_attr_data)dissect_zcl_multistate_value_basic_attr_data |
8469 | 16 | ); |
8470 | 16 | } /*proto_reg_handoff_zbee_zcl_multistate_value_basic*/ |
8471 | | |
8472 | | /* ########################################################################## */ |
8473 | | /* #### (0x0015) COMMISSIONING CLUSTER ###################################### */ |
8474 | | /* ########################################################################## */ |
8475 | | |
8476 | | /*************************/ |
8477 | | /* Defines */ |
8478 | | /*************************/ |
8479 | | |
8480 | | /* Attributes */ |
8481 | 37 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_SHORT_ADDRESS 0x0000 /* Short Address */ |
8482 | 39 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_EXTENDED_PAN_ID 0x0001 /* Extended PAN Id */ |
8483 | 39 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_PAN_ID 0x0002 /* PAN Id */ |
8484 | 39 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_CHANNEL_MASK 0x0003 /* Channel Mask */ |
8485 | 39 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_PROTOCOL_VERSION 0x0004 /* Protocol Version */ |
8486 | 0 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_STACK_PROFILE 0x0005 /* Stack Profile */ |
8487 | 1 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_STARTUP_CONTROL 0x0006 /* Startup Control */ |
8488 | 39 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_ADDRESS 0x0010 /* Trust Center Address */ |
8489 | 41 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_MASTER_KEY 0x0011 /* Trust Center Master Key */ |
8490 | 41 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY 0x0012 /* Network Key */ |
8491 | 41 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_USE_INSECURE_JOIN 0x0013 /* Use Insecure Join */ |
8492 | 41 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_PRECONFIGURED_LINK_KEY 0x0014 /* Preconfigured Link Key */ |
8493 | 41 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_SEQ_NUM 0x0015 /* Network Key Sequence Number */ |
8494 | 41 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_TYPE 0x0016 /* Network Key Type */ |
8495 | 41 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_MANAGER_ADDRESS 0x0017 /* Network Manager Address */ |
8496 | 41 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_SCAN_ATTEMPTS 0x0020 /* Scan Attempts */ |
8497 | 41 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_TIME_BETWEEN_SCANS 0x0021 /* Time Between Scans */ |
8498 | 41 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_REJOIN_INTERVAL 0x0022 /* Rejoin Interval */ |
8499 | 41 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_MAX_REJOIN_INTERVAL 0x0023 /* Max Rejoin Interval */ |
8500 | 41 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_INDIRECT_POLL_RATE 0x0030 /* Indirect Poll Rate */ |
8501 | 41 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_PARENT_RETRY_THRESHOLD 0x0031 /* Parent Retry Threshold */ |
8502 | 41 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_FLAG 0x0040 /* Concentrator Flag */ |
8503 | 41 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_RADIUS 0x0041 /* Concentrator Radius */ |
8504 | 41 | #define ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_DISCOVERY_TIME 0x0042 /* Concentrator Discovery Time */ |
8505 | | |
8506 | | /* Server Commands Received */ |
8507 | 8 | #define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE 0x00 /* Restart Device */ |
8508 | 1 | #define ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS 0x01 /* Save Startup Parameters */ |
8509 | 12 | #define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS 0x02 /* Restore Startup Parameters */ |
8510 | 12 | #define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS 0x03 /* Reset Startup Parameters */ |
8511 | | |
8512 | | /* Server Commands Generated */ |
8513 | 1 | #define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE_RESPONSE 0x00 /* Restart Device Response */ |
8514 | 2 | #define ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS_RESPONSE 0x01 /* Save Startup Parameters Response */ |
8515 | 2 | #define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS_RESPONSE 0x02 /* Restore Startup Parameters Response */ |
8516 | 2 | #define ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS_RESPONSE 0x03 /* Reset Startup Parameters Response */ |
8517 | | |
8518 | | /* Restart Device Options Field Mask Values */ |
8519 | 16 | #define ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_STARTUP_MODE 0x07 |
8520 | 16 | #define ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_IMMEDIATE 0x08 |
8521 | 16 | #define ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_RESERVED 0xF0 |
8522 | | |
8523 | | /* Reset Startup Parameters Options Field Mask Values */ |
8524 | 16 | #define ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESET_CURRENT 0x01 |
8525 | 16 | #define ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESET_ALL 0x02 |
8526 | 16 | #define ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_ERASE_INDEX 0x04 |
8527 | 16 | #define ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESERVED 0xFC |
8528 | | |
8529 | | |
8530 | | /*************************/ |
8531 | | /* Function Declarations */ |
8532 | | /*************************/ |
8533 | | |
8534 | | void proto_register_zbee_zcl_commissioning(void); |
8535 | | void proto_reg_handoff_zbee_zcl_commissioning(void); |
8536 | | |
8537 | | /* Command Dissector Helpers */ |
8538 | | static void dissect_zcl_commissioning_restart_device (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
8539 | | static void dissect_zcl_commissioning_save_restore_startup_parameters (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
8540 | | static void dissect_zcl_commissioning_reset_startup_parameters (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
8541 | | static void dissect_zcl_commissioning_response (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
8542 | | |
8543 | | /* Private functions prototype */ |
8544 | | |
8545 | | /*************************/ |
8546 | | /* Global Variables */ |
8547 | | /*************************/ |
8548 | | /* Initialize the protocol and registered fields */ |
8549 | | static int proto_zbee_zcl_commissioning; |
8550 | | |
8551 | | static int hf_zbee_zcl_commissioning_attr_id; |
8552 | | static int hf_zbee_zcl_commissioning_attr_stack_profile; |
8553 | | static int hf_zbee_zcl_commissioning_attr_startup_control; |
8554 | | static int hf_zbee_zcl_commissioning_restart_device_options; |
8555 | | static int hf_zbee_zcl_commissioning_restart_device_options_startup_mode; |
8556 | | static int hf_zbee_zcl_commissioning_restart_device_options_immediate; |
8557 | | static int hf_zbee_zcl_commissioning_restart_device_options_reserved; |
8558 | | static int hf_zbee_zcl_commissioning_delay; |
8559 | | static int hf_zbee_zcl_commissioning_jitter; |
8560 | | static int hf_zbee_zcl_commissioning_options; |
8561 | | static int hf_zbee_zcl_commissioning_index; |
8562 | | static int hf_zbee_zcl_commissioning_reset_startup_options; |
8563 | | static int hf_zbee_zcl_commissioning_reset_startup_options_reset_current; |
8564 | | static int hf_zbee_zcl_commissioning_reset_startup_options_reset_all; |
8565 | | static int hf_zbee_zcl_commissioning_reset_startup_options_erase_index; |
8566 | | static int hf_zbee_zcl_commissioning_reset_startup_options_reserved; |
8567 | | static int hf_zbee_zcl_commissioning_status; |
8568 | | static int hf_zbee_zcl_commissioning_srv_rx_cmd_id; |
8569 | | static int hf_zbee_zcl_commissioning_srv_tx_cmd_id; |
8570 | | |
8571 | | /* Initialize the subtree pointers */ |
8572 | | static int ett_zbee_zcl_commissioning; |
8573 | | static int ett_zbee_zcl_commissioning_restart_device_options; |
8574 | | static int ett_zbee_zcl_commissioning_reset_startup_options; |
8575 | | |
8576 | | /* Attributes */ |
8577 | | static const value_string zbee_zcl_commissioning_attr_names[] = { |
8578 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_SHORT_ADDRESS, "Short Address" }, |
8579 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_EXTENDED_PAN_ID, "Extended PAN Id" }, |
8580 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_PAN_ID, "PAN Id" }, |
8581 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_CHANNEL_MASK, "Channel Mask" }, |
8582 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_PROTOCOL_VERSION, "Protocol Version" }, |
8583 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_STACK_PROFILE, "Stack Profile" }, |
8584 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_STARTUP_CONTROL, "Startup Control" }, |
8585 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_ADDRESS, "Trust Center Address" }, |
8586 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_MASTER_KEY, "Trust Center Master Key" }, |
8587 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY, "Network Key" }, |
8588 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_USE_INSECURE_JOIN, "Use Insecure Join" }, |
8589 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_PRECONFIGURED_LINK_KEY, "Preconfigured Link Key" }, |
8590 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_SEQ_NUM, "Network Key Sequence Number" }, |
8591 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_TYPE, "Network Key Type" }, |
8592 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_MANAGER_ADDRESS, "Network Manager Address" }, |
8593 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_SCAN_ATTEMPTS, "Scan Attempts" }, |
8594 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_TIME_BETWEEN_SCANS, "Time Between Scans" }, |
8595 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_REJOIN_INTERVAL, "Rejoin Interval" }, |
8596 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_MAX_REJOIN_INTERVAL, "Max Rejoin Interval" }, |
8597 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_INDIRECT_POLL_RATE, "Indirect Poll Rate" }, |
8598 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_PARENT_RETRY_THRESHOLD, "Parent Retry Threshold" }, |
8599 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_FLAG, "Concentrator Flag" }, |
8600 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_RADIUS, "Concentrator Radius" }, |
8601 | | { ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_DISCOVERY_TIME, "Concentrator Discovery Time" }, |
8602 | | { 0, NULL } |
8603 | | }; |
8604 | | |
8605 | | /* Server Commands Received */ |
8606 | | static const value_string zbee_zcl_commissioning_srv_rx_cmd_names[] = { |
8607 | | { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE, "Commissioning - Restart Device" }, |
8608 | | { ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS, "Commissioning - Save Startup Parameters" }, |
8609 | | { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS, "Commissioning - Restore Startup Parameters" }, |
8610 | | { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS, "Commissioning - Reset Startup Parameters" }, |
8611 | | { 0, NULL } |
8612 | | }; |
8613 | | |
8614 | | /* Server Commands Generated */ |
8615 | | static const value_string zbee_zcl_commissioning_srv_tx_cmd_names[] = { |
8616 | | { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE_RESPONSE, "Commissioning - Restart Device Response" }, |
8617 | | { ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS_RESPONSE, "Commissioning - Save Startup Parameters Response" }, |
8618 | | { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS_RESPONSE, "Commissioning - Startup Parameters Response" }, |
8619 | | { ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS_RESPONSE, "Commissioning - Reset Startup Parameters Response" }, |
8620 | | { 0, NULL } |
8621 | | }; |
8622 | | |
8623 | | static const value_string zbee_zcl_commissioning_stack_profile_values[] = { |
8624 | | {0x01, "ZigBee Stack Profile"}, |
8625 | | {0x02, "ZigBee PRO Stack Profile"}, |
8626 | | {0, NULL} |
8627 | | }; |
8628 | | |
8629 | | static const value_string zbee_zcl_commissioning_startup_control_values[] = { |
8630 | | {0x00, "Device is part of the network indicated by the Extended PAN Id"}, |
8631 | | {0x01, "Device should form a network with the Extended PAN Id"}, |
8632 | | {0x02, "Device should rejoin the network with Extended PAN Id"}, |
8633 | | {0x03, "Device should join the network using MAC Association"}, |
8634 | | {0, NULL} |
8635 | | }; |
8636 | | |
8637 | | static const value_string zbee_zcl_commissioning_startup_mode_values[] ={ |
8638 | | {0, "Restart Device using current set of startup parameters"}, |
8639 | | {1, "Restart Device using current set of stack attributes"}, |
8640 | | {0, NULL} |
8641 | | }; |
8642 | | |
8643 | | /*************************/ |
8644 | | /* Function Bodies */ |
8645 | | /*************************/ |
8646 | | |
8647 | | /*FUNCTION:------------------------------------------------------ |
8648 | | * NAME |
8649 | | * dissect_zbee_zcl_commissioning |
8650 | | * DESCRIPTION |
8651 | | * ZigBee ZCL Commissioning cluster dissector for wireshark. |
8652 | | * PARAMETERS |
8653 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
8654 | | * packet_info *pinfo - pointer to packet information fields |
8655 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
8656 | | * RETURNS |
8657 | | * none |
8658 | | *--------------------------------------------------------------- |
8659 | | */ |
8660 | | static int |
8661 | | dissect_zbee_zcl_commissioning(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) |
8662 | 116 | { |
8663 | 116 | proto_tree *payload_tree; |
8664 | 116 | zbee_zcl_packet *zcl; |
8665 | 116 | unsigned offset = 0; |
8666 | 116 | uint8_t cmd_id; |
8667 | 116 | int rem_len; |
8668 | | |
8669 | | /* Reject the packet if data is NULL */ |
8670 | 116 | if (data == NULL) |
8671 | 0 | return 0; |
8672 | 116 | zcl = (zbee_zcl_packet *)data; |
8673 | 116 | cmd_id = zcl->cmd_id; |
8674 | | |
8675 | | /* Create a subtree for the ZCL Command frame, and add the command ID to it. */ |
8676 | 116 | if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { |
8677 | | /* Append the command name to the info column. */ |
8678 | 82 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
8679 | 82 | val_to_str_const(cmd_id, zbee_zcl_commissioning_srv_rx_cmd_names, "Unknown Command"), |
8680 | 82 | zcl->tran_seqno); |
8681 | | |
8682 | | /* Add the command ID. */ |
8683 | 82 | proto_tree_add_item(tree, hf_zbee_zcl_commissioning_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
8684 | | |
8685 | | /* Check if this command has a payload, then add the payload tree */ |
8686 | 82 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
8687 | 82 | if (rem_len > 0) { |
8688 | 58 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_commissioning, NULL, "Payload"); |
8689 | | |
8690 | | /* Call the appropriate command dissector */ |
8691 | 58 | switch (cmd_id) { |
8692 | 8 | case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE: |
8693 | 8 | dissect_zcl_commissioning_restart_device(tvb, payload_tree, &offset); |
8694 | 8 | break; |
8695 | | |
8696 | 12 | case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS: |
8697 | 12 | dissect_zcl_commissioning_reset_startup_parameters(tvb, payload_tree, &offset); |
8698 | 12 | break; |
8699 | | |
8700 | 1 | case ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS: |
8701 | 12 | case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS: |
8702 | 12 | dissect_zcl_commissioning_save_restore_startup_parameters(tvb, payload_tree, &offset); |
8703 | 12 | break; |
8704 | | |
8705 | 26 | default: |
8706 | 26 | break; |
8707 | 58 | } |
8708 | 58 | } |
8709 | 82 | } |
8710 | 34 | else { /* ZBEE_ZCL_FCF_TO_CLIENT */ |
8711 | | /* Append the command name to the info column. */ |
8712 | 34 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
8713 | 34 | val_to_str_const(cmd_id, zbee_zcl_commissioning_srv_tx_cmd_names, "Unknown Command"), |
8714 | 34 | zcl->tran_seqno); |
8715 | | |
8716 | | /* Add the command ID. */ |
8717 | 34 | proto_tree_add_item(tree, hf_zbee_zcl_commissioning_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
8718 | | |
8719 | | /* Check if this command has a payload, then add the payload tree */ |
8720 | 34 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
8721 | 34 | if (rem_len > 0) { |
8722 | 33 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_commissioning, NULL, "Payload"); |
8723 | | |
8724 | | /* Call the appropriate command dissector */ |
8725 | 33 | switch (cmd_id) { |
8726 | 1 | case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTART_DEVICE_RESPONSE: |
8727 | 2 | case ZBEE_ZCL_CMD_ID_COMMISSIONING_SAVE_STARTUP_PARAMETERS_RESPONSE: |
8728 | 2 | case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESTORE_STARTUP_PARAMETERS_RESPONSE: |
8729 | 2 | case ZBEE_ZCL_CMD_ID_COMMISSIONING_RESET_STARTUP_PARAMETERS_RESPONSE: |
8730 | 2 | dissect_zcl_commissioning_response(tvb, payload_tree, &offset); |
8731 | 2 | break; |
8732 | | |
8733 | 31 | default: |
8734 | 31 | break; |
8735 | 33 | } |
8736 | 33 | } |
8737 | 34 | } |
8738 | | |
8739 | 107 | return tvb_captured_length(tvb); |
8740 | 116 | } /*dissect_zbee_zcl_commissioning*/ |
8741 | | |
8742 | | |
8743 | | /*FUNCTION:------------------------------------------------------ |
8744 | | * NAME |
8745 | | * dissect_zcl_commissioning_restart_device |
8746 | | * DESCRIPTION |
8747 | | * this function decodes the Restart Device payload. |
8748 | | * PARAMETERS |
8749 | | * tvb - the tv buffer of the current data_type |
8750 | | * tree - the tree to append this item to |
8751 | | * offset - offset of data in tvb |
8752 | | * RETURNS |
8753 | | * none |
8754 | | *--------------------------------------------------------------- |
8755 | | */ |
8756 | | static void |
8757 | | dissect_zcl_commissioning_restart_device(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
8758 | 8 | { |
8759 | 8 | static int * const restart_device_mask[] = { |
8760 | 8 | &hf_zbee_zcl_commissioning_restart_device_options_startup_mode, |
8761 | 8 | &hf_zbee_zcl_commissioning_restart_device_options_immediate, |
8762 | 8 | &hf_zbee_zcl_commissioning_restart_device_options_reserved, |
8763 | 8 | NULL |
8764 | 8 | }; |
8765 | | |
8766 | | /* Retrieve "Options" field */ |
8767 | 8 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_commissioning_restart_device_options, ett_zbee_zcl_commissioning_restart_device_options, restart_device_mask, ENC_LITTLE_ENDIAN); |
8768 | 8 | *offset += 1; |
8769 | | |
8770 | | /* Retrieve "Delay" field */ |
8771 | 8 | proto_tree_add_item(tree, hf_zbee_zcl_commissioning_delay, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
8772 | 8 | *offset += 1; |
8773 | | |
8774 | | /* Retrieve "Jitter" field */ |
8775 | 8 | proto_tree_add_item(tree, hf_zbee_zcl_commissioning_jitter, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
8776 | 8 | *offset += 1; |
8777 | | |
8778 | 8 | } /*dissect_zcl_commissioning_restart_device*/ |
8779 | | |
8780 | | |
8781 | | /*FUNCTION:------------------------------------------------------ |
8782 | | * NAME |
8783 | | * dissect_zcl_commissioning_save_restore_startup_parameters |
8784 | | * DESCRIPTION |
8785 | | * this function decodes the Save and Restore payload. |
8786 | | * PARAMETERS |
8787 | | * tvb - the tv buffer of the current data_type |
8788 | | * tree - the tree to append this item to |
8789 | | * offset - offset of data in tvb |
8790 | | * RETURNS |
8791 | | * none |
8792 | | *--------------------------------------------------------------- |
8793 | | */ |
8794 | | static void |
8795 | | dissect_zcl_commissioning_save_restore_startup_parameters(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
8796 | 12 | { |
8797 | | /* Retrieve "Options" field */ |
8798 | 12 | proto_tree_add_item(tree, hf_zbee_zcl_commissioning_options, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
8799 | 12 | *offset += 1; |
8800 | | |
8801 | | /* Retrieve "Index" field */ |
8802 | 12 | proto_tree_add_item(tree, hf_zbee_zcl_commissioning_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
8803 | 12 | *offset += 1; |
8804 | | |
8805 | 12 | } /*dissect_zcl_commissioning_save_restore_startup_parameters*/ |
8806 | | |
8807 | | /*FUNCTION:------------------------------------------------------ |
8808 | | * NAME |
8809 | | * dissect_zcl_commissioning_reset_startup_parameters |
8810 | | * DESCRIPTION |
8811 | | * this function decodes the Reset Startup Parameters payload. |
8812 | | * PARAMETERS |
8813 | | * tvb - the tv buffer of the current data_type |
8814 | | * tree - the tree to append this item to |
8815 | | * offset - offset of data in tvb |
8816 | | * RETURNS |
8817 | | * none |
8818 | | *--------------------------------------------------------------- |
8819 | | */ |
8820 | | static void |
8821 | | dissect_zcl_commissioning_reset_startup_parameters(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
8822 | 12 | { |
8823 | 12 | static int * const reset_startup_mask[] = { |
8824 | 12 | &hf_zbee_zcl_commissioning_reset_startup_options_reset_current, |
8825 | 12 | &hf_zbee_zcl_commissioning_reset_startup_options_reset_all, |
8826 | 12 | &hf_zbee_zcl_commissioning_reset_startup_options_erase_index, |
8827 | 12 | &hf_zbee_zcl_commissioning_reset_startup_options_reserved, |
8828 | 12 | NULL |
8829 | 12 | }; |
8830 | | |
8831 | | /* Retrieve "Options" field */ |
8832 | 12 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_commissioning_reset_startup_options, ett_zbee_zcl_commissioning_reset_startup_options, reset_startup_mask, ENC_LITTLE_ENDIAN); |
8833 | 12 | *offset += 1; |
8834 | | |
8835 | | /* Retrieve "Index" field */ |
8836 | 12 | proto_tree_add_item(tree, hf_zbee_zcl_commissioning_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
8837 | 12 | *offset += 1; |
8838 | | |
8839 | 12 | } /*dissect_zcl_commissioning_reset_startup_parameters*/ |
8840 | | |
8841 | | /*FUNCTION:------------------------------------------------------ |
8842 | | * NAME |
8843 | | * dissect_zcl_commissioning_response |
8844 | | * DESCRIPTION |
8845 | | * this function decodes the Response payload. |
8846 | | * PARAMETERS |
8847 | | * tvb - the tv buffer of the current data_type |
8848 | | * tree - the tree to append this item to |
8849 | | * offset - offset of data in tvb |
8850 | | * RETURNS |
8851 | | * none |
8852 | | *--------------------------------------------------------------- |
8853 | | */ |
8854 | | static void |
8855 | | dissect_zcl_commissioning_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
8856 | 2 | { |
8857 | | /* Retrieve "Status" field */ |
8858 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_commissioning_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
8859 | 2 | *offset += 1; |
8860 | | |
8861 | 2 | } /*dissect_zcl_commissioning_response*/ |
8862 | | |
8863 | | |
8864 | | /*FUNCTION:------------------------------------------------------ |
8865 | | * NAME |
8866 | | * dissect_zcl_commissioning_attr_data |
8867 | | * DESCRIPTION |
8868 | | * this function is called by ZCL foundation dissector in order to decode |
8869 | | * specific cluster attributes data. |
8870 | | * PARAMETERS |
8871 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
8872 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
8873 | | * unsigned *offset - pointer to buffer offset |
8874 | | * uint16_t attr_id - attribute identifier |
8875 | | * unsigned data_type - attribute data type |
8876 | | * bool client_attr- ZCL client |
8877 | | * RETURNS |
8878 | | * none |
8879 | | *--------------------------------------------------------------- |
8880 | | */ |
8881 | | static void |
8882 | | dissect_zcl_commissioning_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
8883 | 143 | { |
8884 | | /* Dissect attribute data type and data */ |
8885 | 143 | switch ( attr_id ) { |
8886 | | |
8887 | 0 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_STACK_PROFILE: |
8888 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_commissioning_attr_stack_profile, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
8889 | 0 | *offset += 1; |
8890 | 0 | break; |
8891 | | |
8892 | 1 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_STARTUP_CONTROL: |
8893 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_commissioning_attr_startup_control, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
8894 | 1 | *offset += 1; |
8895 | 1 | break; |
8896 | | |
8897 | 37 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_SHORT_ADDRESS: |
8898 | 39 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_EXTENDED_PAN_ID: |
8899 | 39 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_PAN_ID: |
8900 | 39 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_CHANNEL_MASK: |
8901 | 39 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_PROTOCOL_VERSION: |
8902 | 39 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_ADDRESS: |
8903 | 41 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_TRUST_CENTER_MASTER_KEY: |
8904 | 41 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY: |
8905 | 41 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_USE_INSECURE_JOIN: |
8906 | 41 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_PRECONFIGURED_LINK_KEY: |
8907 | 41 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_SEQ_NUM: |
8908 | 41 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_KEY_TYPE: |
8909 | 41 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_NETWORK_MANAGER_ADDRESS: |
8910 | 41 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_SCAN_ATTEMPTS: |
8911 | 41 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_TIME_BETWEEN_SCANS: |
8912 | 41 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_REJOIN_INTERVAL: |
8913 | 41 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_MAX_REJOIN_INTERVAL: |
8914 | 41 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_INDIRECT_POLL_RATE: |
8915 | 41 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_PARENT_RETRY_THRESHOLD: |
8916 | 41 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_FLAG: |
8917 | 41 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_RADIUS: |
8918 | 41 | case ZBEE_ZCL_ATTR_ID_COMMISSIONING_CONCENTRATOR_DISCOVERY_TIME: |
8919 | 142 | default: |
8920 | 142 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
8921 | 142 | break; |
8922 | 143 | } |
8923 | | |
8924 | 143 | } /*dissect_zcl_commissioning_attr_data*/ |
8925 | | |
8926 | | |
8927 | | /*FUNCTION:------------------------------------------------------ |
8928 | | * NAME |
8929 | | * proto_register_zbee_zcl_commissioning |
8930 | | * DESCRIPTION |
8931 | | * ZigBee ZCL Commissioning cluster protocol registration routine. |
8932 | | * PARAMETERS |
8933 | | * none |
8934 | | * RETURNS |
8935 | | * void |
8936 | | *--------------------------------------------------------------- |
8937 | | */ |
8938 | | void |
8939 | | proto_register_zbee_zcl_commissioning(void) |
8940 | 16 | { |
8941 | | /* Setup list of header fields */ |
8942 | 16 | static hf_register_info hf[] = { |
8943 | | |
8944 | 16 | { &hf_zbee_zcl_commissioning_attr_id, |
8945 | 16 | { "Attribute", "zbee_zcl_general.commissioning.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_commissioning_attr_names), |
8946 | 16 | 0x00, NULL, HFILL } }, |
8947 | | |
8948 | 16 | { &hf_zbee_zcl_commissioning_attr_stack_profile, |
8949 | 16 | { "Stack Profile", "zbee_zcl_general.commissioning.attr.stack_profile", FT_UINT8, BASE_HEX, VALS(zbee_zcl_commissioning_stack_profile_values), |
8950 | 16 | 0x00, NULL, HFILL } }, |
8951 | | |
8952 | 16 | { &hf_zbee_zcl_commissioning_attr_startup_control, |
8953 | 16 | { "Startup Control", "zbee_zcl_general.commissioning.attr.startup_control", FT_UINT8, BASE_HEX, VALS(zbee_zcl_commissioning_startup_control_values), |
8954 | 16 | 0x00, NULL, HFILL } }, |
8955 | | |
8956 | | /* start Restart Device Options fields */ |
8957 | 16 | { &hf_zbee_zcl_commissioning_restart_device_options, |
8958 | 16 | { "Restart Device Options", "zbee_zcl_general.commissioning.restart_device_options", FT_UINT8, BASE_HEX, NULL, |
8959 | 16 | 0x00, NULL, HFILL } }, |
8960 | | |
8961 | 16 | { &hf_zbee_zcl_commissioning_restart_device_options_startup_mode, |
8962 | 16 | { "Startup Mode", "zbee_zcl_general.commissioning.restart_device_options.startup_mode", FT_UINT8, BASE_HEX, VALS(zbee_zcl_commissioning_startup_mode_values), |
8963 | 16 | ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_STARTUP_MODE, NULL, HFILL } }, |
8964 | | |
8965 | 16 | { &hf_zbee_zcl_commissioning_restart_device_options_immediate, |
8966 | 16 | { "Immediate", "zbee_zcl_general.commissioning.restart_device_options.immediate", FT_BOOLEAN, 8, NULL, |
8967 | 16 | ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_IMMEDIATE, NULL, HFILL } }, |
8968 | | |
8969 | 16 | { &hf_zbee_zcl_commissioning_restart_device_options_reserved, |
8970 | 16 | { "Reserved", "zbee_zcl_general.commissioning.restart_device_options.reserved", FT_BOOLEAN, 8, NULL, |
8971 | 16 | ZBEE_ZCL_COMMISSIONING_RESTART_DEVICE_OPTIONS_RESERVED, NULL, HFILL } }, |
8972 | | /* end Restart Device Options fields */ |
8973 | | |
8974 | 16 | { &hf_zbee_zcl_commissioning_delay, |
8975 | 16 | { "Delay", "zbee_zcl_general.commissioning.delay", FT_UINT8, BASE_DEC, NULL, |
8976 | 16 | 0x0, NULL, HFILL } }, |
8977 | | |
8978 | 16 | { &hf_zbee_zcl_commissioning_jitter, |
8979 | 16 | { "Jitter", "zbee_zcl_general.commissioning.jitter", FT_UINT8, BASE_DEC, NULL, |
8980 | 16 | 0x0, NULL, HFILL } }, |
8981 | | |
8982 | 16 | { &hf_zbee_zcl_commissioning_options, |
8983 | 16 | { "Options (Reserved)", "zbee_zcl_general.commissioning.options", FT_UINT8, BASE_HEX, NULL, |
8984 | 16 | 0x0, NULL, HFILL } }, |
8985 | | |
8986 | 16 | { &hf_zbee_zcl_commissioning_index, |
8987 | 16 | { "Index", "zbee_zcl_general.commissioning.index", FT_UINT8, BASE_DEC, NULL, |
8988 | 16 | 0x0, NULL, HFILL } }, |
8989 | | |
8990 | | /* start Reset Startup Options fields */ |
8991 | 16 | { &hf_zbee_zcl_commissioning_reset_startup_options, |
8992 | 16 | { "Reset Startup Options", "zbee_zcl_general.commissioning.reset_startup_options", FT_UINT8, BASE_HEX, NULL, |
8993 | 16 | 0x00, NULL, HFILL } }, |
8994 | | |
8995 | 16 | { &hf_zbee_zcl_commissioning_reset_startup_options_reset_current, |
8996 | 16 | { "Reset Current", "zbee_zcl_general.commissioning.reset_startup_options.current", FT_BOOLEAN, 8, NULL, |
8997 | 16 | ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESET_CURRENT, NULL, HFILL } }, |
8998 | | |
8999 | 16 | { &hf_zbee_zcl_commissioning_reset_startup_options_reset_all, |
9000 | 16 | { "Reset All", "zbee_zcl_general.commissioning.reset_startup_options.reset_all", FT_BOOLEAN, 8, NULL, |
9001 | 16 | ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESET_ALL, NULL, HFILL } }, |
9002 | | |
9003 | 16 | { &hf_zbee_zcl_commissioning_reset_startup_options_erase_index, |
9004 | 16 | { "Erase Index", "zbee_zcl_general.commissioning.reset_startup_options.erase_index", FT_BOOLEAN, 8, NULL, |
9005 | 16 | ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_ERASE_INDEX, NULL, HFILL } }, |
9006 | | |
9007 | 16 | { &hf_zbee_zcl_commissioning_reset_startup_options_reserved, |
9008 | 16 | { "Reserved", "zbee_zcl_general.commissioning.reset_startup_options.reserved", FT_BOOLEAN, 8, NULL, |
9009 | 16 | ZBEE_ZCL_COMMISSIONING_RESET_STARTUP_OPTIONS_RESERVED, NULL, HFILL } }, |
9010 | | /* end Reset Startup Options fields */ |
9011 | | |
9012 | 16 | { &hf_zbee_zcl_commissioning_status, |
9013 | 16 | { "Status", "zbee_zcl_general.commissioning.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names), |
9014 | 16 | 0x0, NULL, HFILL } }, |
9015 | | |
9016 | 16 | { &hf_zbee_zcl_commissioning_srv_rx_cmd_id, |
9017 | 16 | { "Command", "zbee_zcl_general.commissioning.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_commissioning_srv_rx_cmd_names), |
9018 | 16 | 0x00, NULL, HFILL } }, |
9019 | | |
9020 | 16 | { &hf_zbee_zcl_commissioning_srv_tx_cmd_id, |
9021 | 16 | { "Command", "zbee_zcl_general.commissioning.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_commissioning_srv_tx_cmd_names), |
9022 | 16 | 0x00, NULL, HFILL } } |
9023 | | |
9024 | 16 | }; |
9025 | | |
9026 | | /* ZCL Commissioning subtrees */ |
9027 | 16 | static int *ett[] = { |
9028 | 16 | &ett_zbee_zcl_commissioning, |
9029 | 16 | &ett_zbee_zcl_commissioning_restart_device_options, |
9030 | 16 | &ett_zbee_zcl_commissioning_reset_startup_options |
9031 | 16 | }; |
9032 | | |
9033 | | /* Register the ZigBee ZCL Commissioning cluster protocol name and description */ |
9034 | 16 | proto_zbee_zcl_commissioning = proto_register_protocol("ZigBee ZCL Commissioning", "ZCL Commissioning", ZBEE_PROTOABBREV_ZCL_COMMISSIONING); |
9035 | 16 | proto_register_field_array(proto_zbee_zcl_commissioning, hf, array_length(hf)); |
9036 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
9037 | | |
9038 | | /* Register the ZigBee ZCL Commissioning dissector. */ |
9039 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_COMMISSIONING, dissect_zbee_zcl_commissioning, proto_zbee_zcl_commissioning); |
9040 | | |
9041 | 16 | } /*proto_register_zbee_zcl_commissioning*/ |
9042 | | |
9043 | | |
9044 | | /*FUNCTION:------------------------------------------------------ |
9045 | | * NAME |
9046 | | * proto_reg_handoff_zbee_zcl_commissioning |
9047 | | * DESCRIPTION |
9048 | | * Hands off the ZCL Commissioning dissector. |
9049 | | * PARAMETERS |
9050 | | * none |
9051 | | * RETURNS |
9052 | | * none |
9053 | | *--------------------------------------------------------------- |
9054 | | */ |
9055 | | void |
9056 | | proto_reg_handoff_zbee_zcl_commissioning(void) |
9057 | 16 | { |
9058 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_COMMISSIONING, |
9059 | 16 | proto_zbee_zcl_commissioning, |
9060 | 16 | ett_zbee_zcl_commissioning, |
9061 | 16 | ZBEE_ZCL_CID_COMMISSIONING, |
9062 | 16 | ZBEE_MFG_CODE_NONE, |
9063 | 16 | hf_zbee_zcl_commissioning_attr_id, |
9064 | 16 | hf_zbee_zcl_commissioning_attr_id, |
9065 | 16 | hf_zbee_zcl_commissioning_srv_rx_cmd_id, |
9066 | 16 | hf_zbee_zcl_commissioning_srv_tx_cmd_id, |
9067 | 16 | dissect_zcl_commissioning_attr_data |
9068 | 16 | ); |
9069 | 16 | } /*proto_reg_handoff_zbee_zcl_commissioning*/ |
9070 | | |
9071 | | |
9072 | | /* ########################################################################## */ |
9073 | | /* #### (0x0016) PARTITION ################################################## */ |
9074 | | /* ########################################################################## */ |
9075 | | |
9076 | | /*************************/ |
9077 | | /* Defines */ |
9078 | | /*************************/ |
9079 | | |
9080 | 16 | #define ZBEE_ZCL_PART_NUM_GENERIC_ETT 3 |
9081 | 369 | #define ZBEE_ZCL_PART_NUM_NACK_ID_ETT 16 |
9082 | 272 | #define ZBEE_ZCL_PART_NUM_ATTRS_ID_ETT 16 |
9083 | | #define ZBEE_ZCL_PART_NUM_ETT (ZBEE_ZCL_PART_NUM_GENERIC_ETT + \ |
9084 | | ZBEE_ZCL_PART_NUM_NACK_ID_ETT + \ |
9085 | | ZBEE_ZCL_PART_NUM_ATTRS_ID_ETT) |
9086 | | |
9087 | 16 | #define ZBEE_ZCL_PART_OPT_1_BLOCK 0x01 |
9088 | 25 | #define ZBEE_ZCL_PART_OPT_INDIC_LEN 0x02 |
9089 | 16 | #define ZBEE_ZCL_PART_OPT_RESERVED 0xc0 |
9090 | | |
9091 | 122 | #define ZBEE_ZCL_PART_ACK_OPT_NACK_LEN 0x01 |
9092 | 16 | #define ZBEE_ZCL_PART_ACK_OPT_RESERVED 0xFE |
9093 | | |
9094 | | /* Attributes */ |
9095 | | #define ZBEE_ZCL_ATTR_ID_PART_MAX_IN_TRANSF_SIZE 0x0000 /* Maximum Incoming Transfer Size */ |
9096 | | #define ZBEE_ZCL_ATTR_ID_PART_MAX_OUT_TRANSF_SIZE 0x0001 /* Maximum Outgoing Transfer Size */ |
9097 | | #define ZBEE_ZCL_ATTR_ID_PART_PARTITIONED_FRAME_SIZE 0x0002 /* Partitioned Frame Size */ |
9098 | | #define ZBEE_ZCL_ATTR_ID_PART_LARGE_FRAME_SIZE 0x0003 /* Large Frame Size */ |
9099 | | #define ZBEE_ZCL_ATTR_ID_PART_ACK_FRAME_NUM 0x0004 /* Number of Ack Frame*/ |
9100 | | #define ZBEE_ZCL_ATTR_ID_PART_NACK_TIMEOUT 0x0005 /* Nack Timeout */ |
9101 | | #define ZBEE_ZCL_ATTR_ID_PART_INTERFRAME_DELEAY 0x0006 /* Interframe Delay */ |
9102 | | #define ZBEE_ZCL_ATTR_ID_PART_SEND_RETRIES_NUM 0x0007 /* Number of Send Retries */ |
9103 | | #define ZBEE_ZCL_ATTR_ID_PART_SENDER_TIMEOUT 0x0008 /* Sender Timeout */ |
9104 | | #define ZBEE_ZCL_ATTR_ID_PART_RECEIVER_TIMEOUT 0x0009 /* Receiver Timeout */ |
9105 | | |
9106 | | /* Server Commands Received */ |
9107 | 9 | #define ZBEE_ZCL_CMD_ID_PART_TRANSF_PART_FRAME 0x00 /* Transfer Partitioned Frame */ |
9108 | 1 | #define ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM 0x01 /* Read Handshake Param */ |
9109 | 13 | #define ZBEE_ZCL_CMD_ID_PART_WR_HANDSHAKE_PARAM 0x02 /* Write Handshake Param */ |
9110 | | |
9111 | | /* Server Commands Generated */ |
9112 | 12 | #define ZBEE_ZCL_CMD_ID_PART_MULTI_ACK 0x00 /* Multiple Ack */ |
9113 | 1 | #define ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM_RSP 0x01 /* Read Handshake Param Response */ |
9114 | | |
9115 | | |
9116 | | /*************************/ |
9117 | | /* Function Declarations */ |
9118 | | /*************************/ |
9119 | | |
9120 | | void proto_register_zbee_zcl_part(void); |
9121 | | void proto_reg_handoff_zbee_zcl_part(void); |
9122 | | |
9123 | | /* Command Dissector Helpers */ |
9124 | | static void dissect_zcl_part_trasfpartframe (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
9125 | | static void dissect_zcl_part_rdhandshakeparam (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool direction); |
9126 | | static void dissect_zcl_part_wrhandshakeparam (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool direction); |
9127 | | static void dissect_zcl_part_multiack (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
9128 | | static void dissect_zcl_part_rdhandshakeparamrsp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool direction); |
9129 | | |
9130 | | /* Private functions prototype */ |
9131 | | |
9132 | | /*************************/ |
9133 | | /* Global Variables */ |
9134 | | /*************************/ |
9135 | | |
9136 | | /* Initialize the protocol and registered fields */ |
9137 | | static int proto_zbee_zcl_part; |
9138 | | |
9139 | | static int hf_zbee_zcl_part_attr_id; |
9140 | | static int hf_zbee_zcl_part_srv_tx_cmd_id; |
9141 | | static int hf_zbee_zcl_part_srv_rx_cmd_id; |
9142 | | static int hf_zbee_zcl_part_opt; |
9143 | | static int hf_zbee_zcl_part_opt_first_block; |
9144 | | static int hf_zbee_zcl_part_opt_indic_len; |
9145 | | static int hf_zbee_zcl_part_opt_res; |
9146 | | static int hf_zbee_zcl_part_first_frame_id; |
9147 | | static int hf_zbee_zcl_part_part_indicator; |
9148 | | static int hf_zbee_zcl_part_part_frame; |
9149 | | static int hf_zbee_zcl_part_partitioned_cluster_id; |
9150 | | static int hf_zbee_zcl_part_ack_opt; |
9151 | | static int hf_zbee_zcl_part_ack_opt_nack_id_len; |
9152 | | static int hf_zbee_zcl_part_ack_opt_res; |
9153 | | static int hf_zbee_zcl_part_nack_id; |
9154 | | |
9155 | | /* Initialize the subtree pointers */ |
9156 | | static int ett_zbee_zcl_part; |
9157 | | static int ett_zbee_zcl_part_fragm_options; |
9158 | | static int ett_zbee_zcl_part_ack_opts; |
9159 | | static int ett_zbee_zcl_part_nack_id_list[ZBEE_ZCL_PART_NUM_NACK_ID_ETT]; |
9160 | | static int ett_zbee_zcl_part_attrs_id_list[ZBEE_ZCL_PART_NUM_ATTRS_ID_ETT]; |
9161 | | |
9162 | | /* Attributes */ |
9163 | | static const value_string zbee_zcl_part_attr_names[] = { |
9164 | | { ZBEE_ZCL_ATTR_ID_PART_MAX_IN_TRANSF_SIZE, "Maximum Incoming Transfer Size" }, |
9165 | | { ZBEE_ZCL_ATTR_ID_PART_MAX_OUT_TRANSF_SIZE, "Maximum Outgoing Transfer Size" }, |
9166 | | { ZBEE_ZCL_ATTR_ID_PART_PARTITIONED_FRAME_SIZE, "Partitioned Frame Size" }, |
9167 | | { ZBEE_ZCL_ATTR_ID_PART_LARGE_FRAME_SIZE, "Large Frame Size" }, |
9168 | | { ZBEE_ZCL_ATTR_ID_PART_ACK_FRAME_NUM, "Number of Ack Frame" }, |
9169 | | { ZBEE_ZCL_ATTR_ID_PART_NACK_TIMEOUT, "Nack Timeout" }, |
9170 | | { ZBEE_ZCL_ATTR_ID_PART_INTERFRAME_DELEAY, "Interframe Delay" }, |
9171 | | { ZBEE_ZCL_ATTR_ID_PART_SEND_RETRIES_NUM, "Number of Send Retries" }, |
9172 | | { ZBEE_ZCL_ATTR_ID_PART_SENDER_TIMEOUT, "Sender Timeout" }, |
9173 | | { ZBEE_ZCL_ATTR_ID_PART_RECEIVER_TIMEOUT, "Receiver Timeout" }, |
9174 | | { 0, NULL } |
9175 | | }; |
9176 | | |
9177 | | /* Server Commands Received */ |
9178 | | static const value_string zbee_zcl_part_srv_rx_cmd_names[] = { |
9179 | | { ZBEE_ZCL_CMD_ID_PART_TRANSF_PART_FRAME, "Transfer Partitioned Frame" }, |
9180 | | { ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM, "Read Handshake Param" }, |
9181 | | { ZBEE_ZCL_CMD_ID_PART_WR_HANDSHAKE_PARAM, "Write Handshake Param" }, |
9182 | | { 0, NULL } |
9183 | | }; |
9184 | | |
9185 | | /* Server Commands Generated */ |
9186 | | static const value_string zbee_zcl_part_srv_tx_cmd_names[] = { |
9187 | | { ZBEE_ZCL_CMD_ID_PART_MULTI_ACK, "Multiple Ack" }, |
9188 | | { ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM_RSP, "Read Handshake Param Response" }, |
9189 | | { 0, NULL } |
9190 | | }; |
9191 | | |
9192 | | /* ID Length */ |
9193 | | static const value_string zbee_zcl_part_id_length_names[] = { |
9194 | | { 0, "1-Byte length" }, |
9195 | | { 1, "2-Bytes length" }, |
9196 | | { 0, NULL } |
9197 | | }; |
9198 | | |
9199 | | /*************************/ |
9200 | | /* Function Bodies */ |
9201 | | /*************************/ |
9202 | | |
9203 | | /*FUNCTION:------------------------------------------------------ |
9204 | | * NAME |
9205 | | * dissect_zbee_zcl_part |
9206 | | * DESCRIPTION |
9207 | | * ZigBee ZCL Partition cluster dissector for wireshark. |
9208 | | * PARAMETERS |
9209 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
9210 | | * packet_info *pinfo - pointer to packet information fields |
9211 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
9212 | | * void *data - pointer to ZCL packet structure. |
9213 | | * RETURNS |
9214 | | * int - length of parsed data. |
9215 | | *--------------------------------------------------------------- |
9216 | | */ |
9217 | | static int |
9218 | | dissect_zbee_zcl_part(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) |
9219 | 144 | { |
9220 | 144 | proto_tree *payload_tree; |
9221 | 144 | zbee_zcl_packet *zcl; |
9222 | 144 | unsigned offset = 0; |
9223 | 144 | uint8_t cmd_id; |
9224 | 144 | int rem_len; |
9225 | | |
9226 | | /* Reject the packet if data is NULL */ |
9227 | 144 | if (data == NULL) |
9228 | 0 | return 0; |
9229 | 144 | zcl = (zbee_zcl_packet *)data; |
9230 | 144 | cmd_id = zcl->cmd_id; |
9231 | | |
9232 | | /* Create a subtree for the ZCL Command frame, and add the command ID to it. */ |
9233 | 144 | if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { |
9234 | | /* Append the command name to the info column. */ |
9235 | 98 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
9236 | 98 | val_to_str_const(cmd_id, zbee_zcl_part_srv_rx_cmd_names, "Unknown Command"), |
9237 | 98 | zcl->tran_seqno); |
9238 | | |
9239 | | /* Add the command ID. */ |
9240 | 98 | proto_tree_add_item(tree, hf_zbee_zcl_part_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
9241 | | |
9242 | | /* Check is this command has a payload, than add the payload tree */ |
9243 | 98 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
9244 | 98 | if (rem_len > 0) { |
9245 | 89 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_part, NULL, "Payload"); |
9246 | | |
9247 | | /* Call the appropriate command dissector */ |
9248 | 89 | switch (cmd_id) { |
9249 | 9 | case ZBEE_ZCL_CMD_ID_PART_TRANSF_PART_FRAME: |
9250 | 9 | dissect_zcl_part_trasfpartframe(tvb, payload_tree, &offset); |
9251 | 9 | break; |
9252 | | |
9253 | 1 | case ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM: |
9254 | 1 | dissect_zcl_part_rdhandshakeparam(tvb, pinfo, payload_tree, &offset, zcl->direction); |
9255 | 1 | break; |
9256 | | |
9257 | 13 | case ZBEE_ZCL_CMD_ID_PART_WR_HANDSHAKE_PARAM: |
9258 | 13 | dissect_zcl_part_wrhandshakeparam(tvb, pinfo, payload_tree, &offset, zcl->direction); |
9259 | 13 | break; |
9260 | | |
9261 | 66 | default: |
9262 | 66 | break; |
9263 | 89 | } |
9264 | 89 | } |
9265 | 98 | } |
9266 | 46 | else { /* ZBEE_ZCL_FCF_TO_CLIENT */ |
9267 | | /* Append the command name to the info column. */ |
9268 | 46 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
9269 | 46 | val_to_str_const(cmd_id, zbee_zcl_part_srv_tx_cmd_names, "Unknown Command"), |
9270 | 46 | zcl->tran_seqno); |
9271 | | |
9272 | | /* Add the command ID. */ |
9273 | 46 | proto_tree_add_item(tree, hf_zbee_zcl_part_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
9274 | | |
9275 | | /* Check is this command has a payload, than add the payload tree */ |
9276 | 46 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
9277 | 46 | if (rem_len > 0) { |
9278 | 44 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_part, NULL, "Payload"); |
9279 | | |
9280 | | /* Call the appropriate command dissector */ |
9281 | 44 | switch (cmd_id) { |
9282 | 12 | case ZBEE_ZCL_CMD_ID_PART_MULTI_ACK: |
9283 | 12 | dissect_zcl_part_multiack(tvb, payload_tree, &offset); |
9284 | 12 | break; |
9285 | | |
9286 | 1 | case ZBEE_ZCL_CMD_ID_PART_RD_HANDSHAKE_PARAM_RSP: |
9287 | 1 | dissect_zcl_part_rdhandshakeparamrsp(tvb, pinfo, payload_tree, &offset, zcl->direction); |
9288 | 1 | break; |
9289 | | |
9290 | 31 | default: |
9291 | 31 | break; |
9292 | 44 | } |
9293 | 44 | } |
9294 | 46 | } |
9295 | | |
9296 | 127 | return tvb_captured_length(tvb); |
9297 | 144 | } /*dissect_zbee_zcl_part*/ |
9298 | | |
9299 | | /*FUNCTION:------------------------------------------------------ |
9300 | | * NAME |
9301 | | * dissect_zcl_part_trasfpartframe |
9302 | | * DESCRIPTION |
9303 | | * This function manages the Transfer Partition Frame payload |
9304 | | * PARAMETERS |
9305 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
9306 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
9307 | | * offset - pointer of buffer offset |
9308 | | * RETURNS |
9309 | | * none |
9310 | | *--------------------------------------------------------------- |
9311 | | */ |
9312 | | static void dissect_zcl_part_trasfpartframe(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
9313 | 9 | { |
9314 | | |
9315 | 9 | uint8_t options; |
9316 | 9 | unsigned frame_len; |
9317 | | |
9318 | 9 | static int * const part_opt[] = { |
9319 | 9 | &hf_zbee_zcl_part_opt_first_block, |
9320 | 9 | &hf_zbee_zcl_part_opt_indic_len, |
9321 | 9 | &hf_zbee_zcl_part_opt_res, |
9322 | 9 | NULL |
9323 | 9 | }; |
9324 | | |
9325 | | /* Retrieve "Fragmentation Options" field */ |
9326 | 9 | options = tvb_get_uint8(tvb, *offset); |
9327 | 9 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_part_opt, ett_zbee_zcl_part_fragm_options, part_opt, ENC_NA); |
9328 | 9 | *offset += 1; |
9329 | | |
9330 | | /* Retrieve "PartitionIndicator" field */ |
9331 | 9 | if ((options & ZBEE_ZCL_PART_OPT_INDIC_LEN) == 0) |
9332 | 6 | { |
9333 | | /* 1-byte length */ |
9334 | 6 | proto_tree_add_item(tree, hf_zbee_zcl_part_part_indicator, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
9335 | 6 | *offset += 1; |
9336 | 6 | } |
9337 | 3 | else { |
9338 | | /* 2-bytes length */ |
9339 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_part_part_indicator, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
9340 | 3 | *offset += 2; |
9341 | 3 | } |
9342 | | |
9343 | | /* Retrieve "PartitionedFrame" field */ |
9344 | 9 | proto_tree_add_item_ret_length(tree, hf_zbee_zcl_part_part_frame, tvb, *offset, 1, ENC_NA|ENC_ZIGBEE, &frame_len); |
9345 | 9 | *offset += frame_len; |
9346 | | |
9347 | 9 | } /*dissect_zcl_part_trasfpartframe*/ |
9348 | | |
9349 | | /*FUNCTION:------------------------------------------------------ |
9350 | | * NAME |
9351 | | * dissect_zcl_part_rdhandshakeparam |
9352 | | * DESCRIPTION |
9353 | | * This function manages the ReadHandshakeParam payload |
9354 | | * PARAMETERS |
9355 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
9356 | | * packet_info *pinfo - pointer to packet information fields |
9357 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
9358 | | * offset - offset |
9359 | | * direction - ZCL direction |
9360 | | * RETURNS |
9361 | | * none |
9362 | | *--------------------------------------------------------------- |
9363 | | */ |
9364 | | static void |
9365 | | dissect_zcl_part_rdhandshakeparam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool direction) |
9366 | 1 | { |
9367 | | /* Retrieve "Partitioned Cluster ID" field */ |
9368 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_part_partitioned_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
9369 | 1 | *offset += 2; |
9370 | | |
9371 | | /* Dissect the attribute id list */ |
9372 | 1 | dissect_zcl_read_attr(tvb, pinfo, tree, offset, ZBEE_ZCL_CID_PARTITION, ZBEE_MFG_CODE_NONE, direction); |
9373 | 1 | } /*dissect_zcl_part_rdhandshakeparam*/ |
9374 | | |
9375 | | /*FUNCTION:------------------------------------------------------ |
9376 | | * NAME |
9377 | | * dissect_zcl_part_wrhandshakeparam |
9378 | | * DESCRIPTION |
9379 | | * This function manages the WriteAndShakeParam payload |
9380 | | * PARAMETERS |
9381 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
9382 | | * packet_info *pinfo - pointer to packet information fields |
9383 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
9384 | | * offset - offset |
9385 | | * direction - ZCL direction |
9386 | | * RETURNS |
9387 | | * none |
9388 | | *--------------------------------------------------------------- |
9389 | | */ |
9390 | | static void |
9391 | | dissect_zcl_part_wrhandshakeparam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool direction) |
9392 | 13 | { |
9393 | | /* Retrieve "Partitioned Cluster ID" field */ |
9394 | 13 | proto_tree_add_item(tree, hf_zbee_zcl_part_partitioned_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
9395 | 13 | *offset += 2; |
9396 | | |
9397 | | /* Dissect the attributes list */ |
9398 | 13 | dissect_zcl_write_attr(tvb, pinfo, tree, offset, ZBEE_ZCL_CID_PARTITION, ZBEE_MFG_CODE_NONE, direction); |
9399 | | |
9400 | 13 | } /*dissect_zcl_part_wrhandshakeparam*/ |
9401 | | |
9402 | | |
9403 | | /* Management of Cluster specific commands sent by the server */ |
9404 | | |
9405 | | /*FUNCTION:------------------------------------------------------ |
9406 | | * NAME |
9407 | | * dissect_zcl_part_multiack |
9408 | | * DESCRIPTION |
9409 | | * This function manages the MultipleACK payload |
9410 | | * PARAMETERS |
9411 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
9412 | | * packet_info *pinfo, - |
9413 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
9414 | | * offset - offset |
9415 | | * RETURNS |
9416 | | * none |
9417 | | *--------------------------------------------------------------- |
9418 | | */ |
9419 | | static void |
9420 | | dissect_zcl_part_multiack(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
9421 | 12 | { |
9422 | 12 | unsigned tvb_len = tvb_reported_length(tvb); |
9423 | 12 | unsigned i = 0; |
9424 | 12 | uint8_t options; |
9425 | | |
9426 | 12 | static int * const ack_opts[] = { |
9427 | 12 | &hf_zbee_zcl_part_ack_opt_nack_id_len, |
9428 | 12 | &hf_zbee_zcl_part_ack_opt_res, |
9429 | 12 | NULL |
9430 | 12 | }; |
9431 | | |
9432 | | /* Retrieve "Ack Options" field */ |
9433 | 12 | options = tvb_get_uint8(tvb, *offset); |
9434 | 12 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_part_ack_opt, ett_zbee_zcl_part_ack_opts, ack_opts, ENC_NA); |
9435 | 12 | *offset += 1; |
9436 | | |
9437 | | /* Retrieve "First Frame ID" field */ |
9438 | 12 | if ((options & ZBEE_ZCL_PART_ACK_OPT_NACK_LEN) == 0) |
9439 | 8 | { |
9440 | | /* 1-byte length */ |
9441 | 8 | proto_tree_add_item(tree, hf_zbee_zcl_part_first_frame_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
9442 | 8 | *offset += 1; |
9443 | 8 | } |
9444 | 4 | else { |
9445 | | /* 2-bytes length */ |
9446 | 4 | proto_tree_add_item(tree, hf_zbee_zcl_part_first_frame_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
9447 | 4 | *offset += 2; |
9448 | 4 | } |
9449 | | |
9450 | | /* Dissect the nack id list */ |
9451 | 106 | while ( *offset < tvb_len && i < ZBEE_ZCL_PART_NUM_NACK_ID_ETT ) |
9452 | 94 | { |
9453 | 94 | if ((options & ZBEE_ZCL_PART_ACK_OPT_NACK_LEN) == 0) |
9454 | 51 | { |
9455 | | /* 1-byte length */ |
9456 | 51 | proto_tree_add_item(tree, hf_zbee_zcl_part_nack_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
9457 | 51 | *offset += 1; |
9458 | 51 | } |
9459 | 43 | else { |
9460 | | /* 2-bytes length */ |
9461 | 43 | proto_tree_add_item(tree, hf_zbee_zcl_part_nack_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
9462 | 43 | *offset += 2; |
9463 | 43 | } |
9464 | | |
9465 | 94 | i++; |
9466 | 94 | } |
9467 | 12 | } /*dissect_zcl_part_multiack*/ |
9468 | | |
9469 | | /*FUNCTION:------------------------------------------------------ |
9470 | | * NAME |
9471 | | * dissect_zcl_part_rdhandshakeparamrsp |
9472 | | * DESCRIPTION |
9473 | | * This function manages the ReadHandshakeParamResponse payload |
9474 | | * PARAMETERS |
9475 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
9476 | | * packet_info *pinfo - pointer to packet information fields |
9477 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
9478 | | * offset - offset |
9479 | | * direction - ZCL direction |
9480 | | * RETURNS |
9481 | | * none |
9482 | | *--------------------------------------------------------------- |
9483 | | */ |
9484 | | static void |
9485 | | dissect_zcl_part_rdhandshakeparamrsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, bool direction) |
9486 | 1 | { |
9487 | | /* Retrieve "Partitioned Cluster ID" field */ |
9488 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_part_partitioned_cluster_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
9489 | 1 | *offset += 2; |
9490 | | |
9491 | | /* Dissect the attributes list */ |
9492 | 1 | dissect_zcl_read_attr_resp(tvb, pinfo, tree, offset, ZBEE_ZCL_CID_PARTITION, ZBEE_MFG_CODE_NONE, direction); |
9493 | 1 | } /*dissect_zcl_part_rdhandshakeparamrsp*/ |
9494 | | |
9495 | | |
9496 | | /*FUNCTION:------------------------------------------------------ |
9497 | | * NAME |
9498 | | * proto_register_zbee_zcl_part |
9499 | | * DESCRIPTION |
9500 | | * this function is called by ZCL foundation dissector in order to decode |
9501 | | * specific cluster attributes data. |
9502 | | * PARAMETERS |
9503 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
9504 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
9505 | | * unsigned *offset - pointer to buffer offset |
9506 | | * uint16_t attr_id - attribute identifier |
9507 | | * unsigned data_type - attribute data type |
9508 | | * RETURNS |
9509 | | * none |
9510 | | *--------------------------------------------------------------- |
9511 | | */ |
9512 | | void proto_register_zbee_zcl_part(void) |
9513 | 16 | { |
9514 | 16 | uint8_t i, j; |
9515 | | |
9516 | 16 | static hf_register_info hf[] = { |
9517 | | |
9518 | 16 | { &hf_zbee_zcl_part_attr_id, |
9519 | 16 | { "Attribute", "zbee_zcl_general.part.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_part_attr_names), |
9520 | 16 | 0x0, NULL, HFILL } }, |
9521 | | |
9522 | 16 | { &hf_zbee_zcl_part_srv_tx_cmd_id, |
9523 | 16 | { "Command", "zbee_zcl_general.part.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_part_srv_tx_cmd_names), |
9524 | 16 | 0x0, NULL, HFILL } }, |
9525 | | |
9526 | 16 | { &hf_zbee_zcl_part_srv_rx_cmd_id, |
9527 | 16 | { "Command", "zbee_zcl_general.part.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_part_srv_rx_cmd_names), |
9528 | 16 | 0x0, NULL, HFILL } }, |
9529 | | |
9530 | 16 | { &hf_zbee_zcl_part_opt, |
9531 | 16 | { "Fragmentation Options", "zbee_zcl_general.part.opt", FT_UINT8, BASE_HEX, |
9532 | 16 | NULL, 0x0, NULL, HFILL }}, |
9533 | | |
9534 | 16 | { &hf_zbee_zcl_part_opt_first_block, |
9535 | 16 | { "First Block", "zbee_zcl_general.part.opt.first_block", FT_UINT8, BASE_HEX, NULL, |
9536 | 16 | ZBEE_ZCL_PART_OPT_1_BLOCK, NULL, HFILL } }, |
9537 | | |
9538 | 16 | { &hf_zbee_zcl_part_opt_indic_len, |
9539 | 16 | { "Indicator length", "zbee_zcl_general.part.opt.indic_len", FT_UINT8, BASE_DEC, VALS(zbee_zcl_part_id_length_names), |
9540 | 16 | ZBEE_ZCL_PART_OPT_INDIC_LEN, NULL, HFILL } }, |
9541 | | |
9542 | 16 | { &hf_zbee_zcl_part_opt_res, |
9543 | 16 | { "Reserved", "zbee_zcl_general.part.opt.res", FT_UINT8, BASE_HEX, NULL, |
9544 | 16 | ZBEE_ZCL_PART_OPT_RESERVED, NULL, HFILL } }, |
9545 | | |
9546 | 16 | { &hf_zbee_zcl_part_first_frame_id, |
9547 | 16 | { "First Frame ID", "zbee_zcl_general.part.first_frame_id", FT_UINT16, BASE_DEC, NULL, |
9548 | 16 | 0x00, NULL, HFILL } }, |
9549 | | |
9550 | 16 | { &hf_zbee_zcl_part_part_indicator, |
9551 | 16 | { "Partition Indicator", "zbee_zcl_general.part.part_indicator", FT_UINT16, BASE_DEC, NULL, |
9552 | 16 | 0x00, NULL, HFILL } }, |
9553 | | |
9554 | 16 | { &hf_zbee_zcl_part_part_frame, |
9555 | 16 | { "Partition Frame", "zbee_zcl_general.part.part_frame", FT_UINT_BYTES, SEP_COLON, NULL, |
9556 | 16 | 0x00, NULL, HFILL } }, |
9557 | | |
9558 | 16 | { &hf_zbee_zcl_part_partitioned_cluster_id, |
9559 | 16 | { "Partitioned Cluster ID", "zbee_zcl_general.part.part_cluster_id", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_aps_cid_names), |
9560 | 16 | 0x00, NULL, HFILL } }, |
9561 | | |
9562 | 16 | { &hf_zbee_zcl_part_ack_opt, |
9563 | 16 | { "Ack Options", "zbee_zcl_general.ack_opt.part", FT_UINT8, BASE_HEX, |
9564 | 16 | NULL, 0x0, NULL, HFILL }}, |
9565 | | |
9566 | 16 | { &hf_zbee_zcl_part_ack_opt_nack_id_len, |
9567 | 16 | { "Nack Id Length", "zbee_zcl_general.ack_opt.part.nack_id.len", FT_UINT8, BASE_HEX, VALS(zbee_zcl_part_id_length_names), |
9568 | 16 | ZBEE_ZCL_PART_ACK_OPT_NACK_LEN, NULL, HFILL } }, |
9569 | | |
9570 | 16 | { &hf_zbee_zcl_part_ack_opt_res, |
9571 | 16 | { "Reserved", "zbee_zcl_general.part.ack_opt.reserved", FT_UINT8, BASE_HEX, NULL, |
9572 | 16 | ZBEE_ZCL_PART_ACK_OPT_RESERVED, NULL, HFILL } }, |
9573 | | |
9574 | 16 | { &hf_zbee_zcl_part_nack_id, |
9575 | 16 | { "Nack Id", "zbee_zcl_general.part.nack_id", FT_UINT16, BASE_DEC, NULL, |
9576 | 16 | 0x0, NULL, HFILL } } |
9577 | | |
9578 | 16 | }; |
9579 | | |
9580 | | /* ZCL Partition subtrees */ |
9581 | 16 | int *ett[ZBEE_ZCL_PART_NUM_ETT] = { |
9582 | 16 | &ett_zbee_zcl_part, |
9583 | 16 | &ett_zbee_zcl_part_fragm_options, |
9584 | 16 | &ett_zbee_zcl_part_ack_opts |
9585 | 16 | }; |
9586 | | |
9587 | | /* initialize attribute subtree types */ |
9588 | 272 | for ( i = 0, j = ZBEE_ZCL_PART_NUM_GENERIC_ETT; i < ZBEE_ZCL_PART_NUM_NACK_ID_ETT; i++, j++) { |
9589 | 256 | ett[j] = &ett_zbee_zcl_part_nack_id_list[i]; |
9590 | 256 | } |
9591 | | |
9592 | 272 | for ( i = 0; i < ZBEE_ZCL_PART_NUM_ATTRS_ID_ETT; i++, j++) { |
9593 | 256 | ett[j] = &ett_zbee_zcl_part_attrs_id_list[i]; |
9594 | 256 | } |
9595 | | |
9596 | | /* Register ZigBee ZCL Partition protocol with Wireshark. */ |
9597 | 16 | proto_zbee_zcl_part = proto_register_protocol("ZigBee ZCL Partition", "ZCL Partition", ZBEE_PROTOABBREV_ZCL_PART); |
9598 | 16 | proto_register_field_array(proto_zbee_zcl_part, hf, array_length(hf)); |
9599 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
9600 | | |
9601 | | /* Register the ZigBee ZCL Partition dissector. */ |
9602 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_PART, dissect_zbee_zcl_part, proto_zbee_zcl_part); |
9603 | 16 | } /* proto_register_zbee_zcl_part */ |
9604 | | |
9605 | | |
9606 | | /*FUNCTION:------------------------------------------------------ |
9607 | | * NAME |
9608 | | * proto_reg_handoff_zbee_zcl_part |
9609 | | * DESCRIPTION |
9610 | | * Registers the zigbee ZCL Partition cluster dissector with Wireshark. |
9611 | | * PARAMETERS |
9612 | | * none |
9613 | | * RETURNS |
9614 | | * void |
9615 | | *--------------------------------------------------------------- |
9616 | | */ |
9617 | | void proto_reg_handoff_zbee_zcl_part(void) |
9618 | 16 | { |
9619 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_PART, |
9620 | 16 | proto_zbee_zcl_part, |
9621 | 16 | ett_zbee_zcl_part, |
9622 | 16 | ZBEE_ZCL_CID_PARTITION, |
9623 | 16 | ZBEE_MFG_CODE_NONE, |
9624 | 16 | hf_zbee_zcl_part_attr_id, |
9625 | 16 | hf_zbee_zcl_part_attr_id, |
9626 | 16 | hf_zbee_zcl_part_srv_rx_cmd_id, |
9627 | 16 | hf_zbee_zcl_part_srv_tx_cmd_id, |
9628 | 16 | NULL |
9629 | 16 | ); |
9630 | | |
9631 | 16 | } /*proto_reg_handoff_zbee_zcl_part*/ |
9632 | | |
9633 | | /* ########################################################################## */ |
9634 | | /* #### (0x0019) OTA UPGRADE CLUSTER ######################################## */ |
9635 | | /* ########################################################################## */ |
9636 | | |
9637 | | /*************************/ |
9638 | | /* Defines */ |
9639 | | /*************************/ |
9640 | | |
9641 | | /* Attributes */ |
9642 | | #define ZBEE_ZCL_ATTR_ID_OTA_UPGRADE_SERVER_ID 0x0000 /* Upgrade Server ID */ |
9643 | | #define ZBEE_ZCL_ATTR_ID_OTA_FILE_OFFSET 0x0001 /* File Offset */ |
9644 | 34 | #define ZBEE_ZCL_ATTR_ID_OTA_CURRENT_FILE_VERSION 0x0002 /* Current File Version */ |
9645 | 15 | #define ZBEE_ZCL_ATTR_ID_OTA_CURRENT_ZB_STACK_VERSION 0x0003 /* Current ZigBee Stack Version */ |
9646 | 50 | #define ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_FILE_VERSION 0x0004 /* Downloaded File Version */ |
9647 | 30 | #define ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_ZB_STACK_VERSION 0x0005 /* Downloaded ZigBee Stack Version */ |
9648 | 7 | #define ZBEE_ZCL_ATTR_ID_OTA_IMAGE_UPGRADE_STATUS 0x0006 /* Image Upgrade Status */ |
9649 | 7 | #define ZBEE_ZCL_ATTR_ID_OTA_MANUFACTURER_ID 0x0007 /* Manufacturer ID */ |
9650 | 22 | #define ZBEE_ZCL_ATTR_ID_OTA_IMAGE_TYPE_ID 0x0008 /* Image Type ID */ |
9651 | 2 | #define ZBEE_ZCL_ATTR_ID_OTA_MIN_BLOCK_REQ_DELAY 0x0009 /* Minimum Block Request Delay */ |
9652 | | |
9653 | | /* Server Commands Generated */ |
9654 | 2 | #define ZBEE_ZCL_CMD_ID_OTA_IMAGE_NOTIFY 0x00 /* Image Notify */ |
9655 | 1 | #define ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_RSP 0x02 /* Query Next Image Response */ |
9656 | 1 | #define ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_RSP 0x05 /* Image Block Response */ |
9657 | 1 | #define ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_RSP 0x07 /* Upgrade End Response */ |
9658 | 20 | #define ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_RSP 0x09 /* Query Specific File Response */ |
9659 | | |
9660 | | /* Server Commands Received */ |
9661 | 6 | #define ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_REQ 0x01 /* Query Next Image Request */ |
9662 | 3 | #define ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_REQ 0x03 /* Image Block Request */ |
9663 | 2 | #define ZBEE_ZCL_CMD_ID_OTA_IMAGE_PAGE_REQ 0x04 /* Image Page Request */ |
9664 | 0 | #define ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_REQ 0x06 /* Upgrade End Request */ |
9665 | 0 | #define ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_REQ 0x08 /* Query Specific File Request */ |
9666 | | |
9667 | | /* Payload Type */ |
9668 | | #define ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ 0x00 /* Query Jitter */ |
9669 | 2 | #define ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC 0x01 /* Query Jitter and Manufacturer Code */ |
9670 | 2 | #define ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT 0x02 /* Query Jitter, Manufacturer Code and Image Type */ |
9671 | 2 | #define ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT_FV 0x03 /* Query Jitter, Manufacturer Code, Image Type and File Version */ |
9672 | | |
9673 | | /* Image Type */ |
9674 | | #define ZBEE_ZCL_OTA_IMG_TYPE_MFR_LOW 0x0000 /* Manufacturer Specific (Low value) */ |
9675 | | #define ZBEE_ZCL_OTA_IMG_TYPE_MFR_HIGH 0xffbf /* Manufacturer Specific (High value) */ |
9676 | | #define ZBEE_ZCL_OTA_IMG_TYPE_SECURITY 0xffc0 /* Security Credential */ |
9677 | | #define ZBEE_ZCL_OTA_IMG_TYPE_CONFIG 0xffc1 /* Configuration */ |
9678 | | #define ZBEE_ZCL_OTA_IMG_TYPE_LOG 0xffc2 /* Log */ |
9679 | | #define ZBEE_ZCL_OTA_IMG_TYPE_UNASSIGNED_LOW 0xffc3 /* Reserved: Unassigned (Low value) */ |
9680 | | #define ZBEE_ZCL_OTA_IMG_TYPE_UNASSIGNED_HIGH 0xfffe /* Reserved: Unassigned (High value) */ |
9681 | | #define ZBEE_ZCL_OTA_IMG_TYPE_WILD_CARD 0xffff /* Reserved: Wild Card */ |
9682 | | |
9683 | | /* ZigBee Stack Version */ |
9684 | | #define ZBEE_ZCL_OTA_ZB_STACK_VER_2006 0x0000 /* ZigBee 2006 */ |
9685 | | #define ZBEE_ZCL_OTA_ZB_STACK_VER_2007 0x0001 /* ZigBee 2007 */ |
9686 | | #define ZBEE_ZCL_OTA_ZB_STACK_VER_PRO 0x0002 /* ZigBee Pro */ |
9687 | | #define ZBEE_ZCL_OTA_ZB_STACK_VER_IP 0x0003 /* ZigBee IP */ |
9688 | | #define ZBEE_ZCL_OTA_ZB_STACK_VER_RESERVED_LO 0x0004 /* Reserved Low */ |
9689 | | #define ZBEE_ZCL_OTA_ZB_STACK_VER_RESERVED_HI 0xffff /* Reserved High */ |
9690 | | |
9691 | | /* Image Upgrade Status */ |
9692 | | #define ZBEE_ZCL_OTA_STATUS_NORMAL 0x00 /* Normal */ |
9693 | | #define ZBEE_ZCL_OTA_STATUS_DOWNLOAD_IN_PROGRESS 0x01 /* Download in progress */ |
9694 | | #define ZBEE_ZCL_OTA_STATUS_DOWNLOAD_COMPLETE 0x02 /* Download complete */ |
9695 | | #define ZBEE_ZCL_OTA_STATUS_WAITING_TO_UPGRADE 0x03 /* Waiting to upgrade */ |
9696 | | #define ZBEE_ZCL_OTA_STATUS_COUNT_DOWN 0x04 /* Count down */ |
9697 | | #define ZBEE_ZCL_OTA_STATUS_WAIT_FOR_MORE 0x05 /* Wait for more */ |
9698 | | /* 0x06-0xff - Reserved */ |
9699 | | /* File Version mask */ |
9700 | 16 | #define ZBEE_ZCL_OTA_FILE_VERS_APPL_RELEASE 0xFF000000 /* Application Release */ |
9701 | 16 | #define ZBEE_ZCL_OTA_FILE_VERS_APPL_BUILD 0x00FF0000 /* Application Build */ |
9702 | 16 | #define ZBEE_ZCL_OTA_FILE_VERS_STACK_RELEASE 0x0000FF00 /* Stack Release */ |
9703 | 16 | #define ZBEE_ZCL_OTA_FILE_VERS_STACK_BUILD 0x000000FF /* Stack Build */ |
9704 | | |
9705 | | /* Field Control bitmask field list for Query Next Image Request */ |
9706 | 22 | #define ZBEE_ZCL_OTA_QUERY_NEXT_IMAGE_REQ_FIELD_CTRL_HW_VER_PRESENT 0x01 /* bit 0 */ |
9707 | 16 | #define ZBEE_ZCL_OTA_QUERY_NEXT_IMAGE_REQ_FIELD_CTRL_RESERVED 0xfe /* bit 1-7 */ |
9708 | | |
9709 | | /* Field Control bitmask field list for Image Block Request */ |
9710 | 19 | #define ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT 0x01 /* bit 0 - Request node IEEE address Present */ |
9711 | 19 | #define ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_MIN_BLOCK_PERIOD_PRESENT 0x02 /* bit 1 - Minimum block period Present */ |
9712 | 16 | #define ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_RESERVED 0xfc /* bit 2-7 */ |
9713 | | |
9714 | | /* Field Control bitmask field list for Image Page Request */ |
9715 | 18 | #define ZBEE_ZCL_OTA_IMAGE_PAGE_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT 0x01 /* bit 0 - Request node IEEE address Present */ |
9716 | 16 | #define ZBEE_ZCL_OTA_IMAGE_PAGE_REQ_FIELD_CTRL_RESERVED 0xfe /* bit 1-7 */ |
9717 | | |
9718 | | /* OTA Time */ |
9719 | | #define ZBEE_ZCL_OTA_TIME_NOW 0x00000000 /* Now */ |
9720 | | #define ZBEE_ZCL_OTA_TIME_UTC_LO 0x00000001 /* UTC Low Boundary */ |
9721 | | #define ZBEE_ZCL_OTA_TIME_UTC_HI 0xfffffffe /* UTC High Boundary */ |
9722 | 0 | #define ZBEE_ZCL_OTA_TIME_WAIT 0xffffffff /* Wait for a Upgrade command (not used for RequestTime) */ |
9723 | | |
9724 | | /*************************/ |
9725 | | /* Function Declarations */ |
9726 | | /*************************/ |
9727 | | |
9728 | | void proto_register_zbee_zcl_ota(void); |
9729 | | void proto_reg_handoff_zbee_zcl_ota(void); |
9730 | | |
9731 | | /*************************/ |
9732 | | /* Global Variables */ |
9733 | | /*************************/ |
9734 | | /* Initialize the protocol and registered fields */ |
9735 | | static int proto_zbee_zcl_ota; |
9736 | | |
9737 | | static int hf_zbee_zcl_ota_attr_id; |
9738 | | static int hf_zbee_zcl_ota_srv_tx_cmd_id; |
9739 | | static int hf_zbee_zcl_ota_srv_rx_cmd_id; |
9740 | | static int hf_zbee_zcl_ota_image_upgrade_status; |
9741 | | static int hf_zbee_zcl_ota_zb_stack_ver; |
9742 | | static int hf_zbee_zcl_ota_file_offset; |
9743 | | static int hf_zbee_zcl_ota_payload_type; |
9744 | | static int hf_zbee_zcl_ota_query_jitter; |
9745 | | static int hf_zbee_zcl_ota_manufacturer_code; |
9746 | | static int hf_zbee_zcl_ota_image_type; |
9747 | | static int hf_zbee_zcl_ota_file_version; |
9748 | | static int hf_zbee_zcl_ota_file_version_appl_release; |
9749 | | static int hf_zbee_zcl_ota_file_version_appl_build; |
9750 | | static int hf_zbee_zcl_ota_file_version_stack_release; |
9751 | | static int hf_zbee_zcl_ota_file_version_stack_build; |
9752 | | static int hf_zbee_zcl_ota_query_next_image_req_field_ctrl; |
9753 | | static int hf_zbee_zcl_ota_query_next_image_req_field_ctrl_hw_ver_present; |
9754 | | static int hf_zbee_zcl_ota_query_next_image_req_field_ctrl_reserved; |
9755 | | static int hf_zbee_zcl_ota_image_block_req_field_ctrl; |
9756 | | static int hf_zbee_zcl_ota_image_block_req_field_ctrl_ieee_addr_present; |
9757 | | static int hf_zbee_zcl_ota_image_block_req_field_ctrl_min_block_period_present; |
9758 | | static int hf_zbee_zcl_ota_image_block_req_field_ctrl_reserved; |
9759 | | static int hf_zbee_zcl_ota_image_page_req_field_ctrl; |
9760 | | static int hf_zbee_zcl_ota_image_page_req_field_ctrl_ieee_addr_present; |
9761 | | static int hf_zbee_zcl_ota_image_page_req_field_ctrl_reserved; |
9762 | | static int hf_zbee_zcl_ota_hw_version; |
9763 | | static int hf_zbee_zcl_ota_status; |
9764 | | static int hf_zbee_zcl_ota_image_size; |
9765 | | static int hf_zbee_zcl_ota_max_data_size; |
9766 | | static int hf_zbee_zcl_ota_min_block_period; |
9767 | | static int hf_zbee_zcl_ota_req_node_addr; |
9768 | | static int hf_zbee_zcl_ota_current_time; |
9769 | | static int hf_zbee_zcl_ota_request_time_offset; |
9770 | | static int hf_zbee_zcl_ota_request_time_utc; |
9771 | | static int hf_zbee_zcl_ota_upgrade_time; |
9772 | | static int hf_zbee_zcl_ota_upgrade_time_utc; |
9773 | | static int hf_zbee_zcl_ota_data_size; |
9774 | | static int hf_zbee_zcl_ota_image_data; |
9775 | | static int hf_zbee_zcl_ota_page_size; |
9776 | | static int hf_zbee_zcl_ota_rsp_spacing; |
9777 | | |
9778 | | /* Initialize the subtree pointers */ |
9779 | | static int ett_zbee_zcl_ota; |
9780 | | static int ett_zbee_zcl_ota_query_next_image_req_field_ctrl; |
9781 | | static int ett_zbee_zcl_ota_image_block_req_field_ctrl; |
9782 | | static int ett_zbee_zcl_ota_image_page_req_field_ctrl; |
9783 | | static int ett_zbee_zcl_ota_file_version; |
9784 | | |
9785 | | /* Attributes */ |
9786 | | static const value_string zbee_zcl_ota_attr_names[] = { |
9787 | | { ZBEE_ZCL_ATTR_ID_OTA_UPGRADE_SERVER_ID, "Upgrade Server ID" }, |
9788 | | { ZBEE_ZCL_ATTR_ID_OTA_FILE_OFFSET, "File Offset" }, |
9789 | | { ZBEE_ZCL_ATTR_ID_OTA_CURRENT_FILE_VERSION, "Current File Version" }, |
9790 | | { ZBEE_ZCL_ATTR_ID_OTA_CURRENT_ZB_STACK_VERSION, "Current ZigBee Stack Version" }, |
9791 | | { ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_FILE_VERSION, "Downloaded File Version" }, |
9792 | | { ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_ZB_STACK_VERSION, "Downloaded ZigBee Stack Version" }, |
9793 | | { ZBEE_ZCL_ATTR_ID_OTA_IMAGE_UPGRADE_STATUS, "Image Upgrade Status" }, |
9794 | | { ZBEE_ZCL_ATTR_ID_OTA_MANUFACTURER_ID, "Manufacturer ID" }, |
9795 | | { ZBEE_ZCL_ATTR_ID_OTA_IMAGE_TYPE_ID, "Image Type ID" }, |
9796 | | { ZBEE_ZCL_ATTR_ID_OTA_MIN_BLOCK_REQ_DELAY, "Minimum Block Request Delay" }, |
9797 | | { 0, NULL } |
9798 | | }; |
9799 | | |
9800 | | /* Server Commands Received */ |
9801 | | static const value_string zbee_zcl_ota_srv_rx_cmd_names[] = { |
9802 | | { ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_REQ, "Query Next Image Request" }, |
9803 | | { ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_REQ, "Image Block Request" }, |
9804 | | { ZBEE_ZCL_CMD_ID_OTA_IMAGE_PAGE_REQ, "Image Page Request" }, |
9805 | | { ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_REQ, "Upgrade End Request" }, |
9806 | | { ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_REQ, "Query Specific File Request" }, |
9807 | | { 0, NULL } |
9808 | | }; |
9809 | | |
9810 | | /* Server Commands Generated */ |
9811 | | static const value_string zbee_zcl_ota_srv_tx_cmd_names[] = { |
9812 | | { ZBEE_ZCL_CMD_ID_OTA_IMAGE_NOTIFY, "Image Notify" }, |
9813 | | { ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_RSP, "Query Next Image Response" }, |
9814 | | { ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_RSP, "Image Block Response" }, |
9815 | | { ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_RSP, "Upgrade End Response" }, |
9816 | | { ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_RSP, "Query Specific File Response" }, |
9817 | | { 0, NULL } |
9818 | | }; |
9819 | | |
9820 | | /* Payload Type */ |
9821 | | static const value_string zbee_zcl_ota_payload_type_names[] = { |
9822 | | { ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ, "Query Jitter" }, |
9823 | | { ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC, "Query Jitter and Manufacturer Code" }, |
9824 | | { ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT, "Query Jitter, Manufacturer Code and Image Type" }, |
9825 | | { ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT_FV, "Query Jitter, Manufacturer Code, Image Type and File Version" }, |
9826 | | { 0, NULL } |
9827 | | }; |
9828 | | |
9829 | | /* Image Upgrade Status */ |
9830 | | static const value_string zbee_zcl_ota_image_upgrade_attr_status_names[] = { |
9831 | | { ZBEE_ZCL_OTA_STATUS_NORMAL, "Normal" }, |
9832 | | { ZBEE_ZCL_OTA_STATUS_DOWNLOAD_IN_PROGRESS, "Download in progress" }, |
9833 | | { ZBEE_ZCL_OTA_STATUS_DOWNLOAD_COMPLETE, "Download complete" }, |
9834 | | { ZBEE_ZCL_OTA_STATUS_WAITING_TO_UPGRADE, "Waiting to upgrade" }, |
9835 | | { ZBEE_ZCL_OTA_STATUS_COUNT_DOWN, "Count down" }, |
9836 | | { ZBEE_ZCL_OTA_STATUS_WAIT_FOR_MORE, "Wait for more" }, |
9837 | | { 0, NULL } |
9838 | | }; |
9839 | | |
9840 | | /* ZigBee Stack Version */ |
9841 | | static const range_string zbee_zcl_ota_zb_stack_ver_names[] = { |
9842 | | { ZBEE_ZCL_OTA_ZB_STACK_VER_2006, ZBEE_ZCL_OTA_ZB_STACK_VER_2006, "ZigBee 2006" }, |
9843 | | { ZBEE_ZCL_OTA_ZB_STACK_VER_2007, ZBEE_ZCL_OTA_ZB_STACK_VER_2007, "ZigBee 2007" }, |
9844 | | { ZBEE_ZCL_OTA_ZB_STACK_VER_PRO, ZBEE_ZCL_OTA_ZB_STACK_VER_PRO, "ZigBee Pro" }, |
9845 | | { ZBEE_ZCL_OTA_ZB_STACK_VER_IP, ZBEE_ZCL_OTA_ZB_STACK_VER_IP, "ZigBee IP" }, |
9846 | | { ZBEE_ZCL_OTA_ZB_STACK_VER_RESERVED_LO, ZBEE_ZCL_OTA_ZB_STACK_VER_RESERVED_HI, "Reserved" }, |
9847 | | { 0, 0, NULL }, |
9848 | | }; |
9849 | | |
9850 | | /* Image Type */ |
9851 | | static const range_string zbee_zcl_ota_image_type_names[] = { |
9852 | | {ZBEE_ZCL_OTA_IMG_TYPE_MFR_LOW, ZBEE_ZCL_OTA_IMG_TYPE_MFR_HIGH, "Manufacturer Specific" }, |
9853 | | {ZBEE_ZCL_OTA_IMG_TYPE_SECURITY, ZBEE_ZCL_OTA_IMG_TYPE_SECURITY, "Security Credential" }, |
9854 | | {ZBEE_ZCL_OTA_IMG_TYPE_CONFIG, ZBEE_ZCL_OTA_IMG_TYPE_CONFIG, "Configuration" }, |
9855 | | {ZBEE_ZCL_OTA_IMG_TYPE_LOG, ZBEE_ZCL_OTA_IMG_TYPE_LOG, "Log" }, |
9856 | | {ZBEE_ZCL_OTA_IMG_TYPE_UNASSIGNED_LOW, ZBEE_ZCL_OTA_IMG_TYPE_UNASSIGNED_HIGH, "Reserved: Unassigned" }, |
9857 | | {ZBEE_ZCL_OTA_IMG_TYPE_WILD_CARD, ZBEE_ZCL_OTA_IMG_TYPE_WILD_CARD, "Reserved: Wild Card" }, |
9858 | | { 0, 0, NULL } |
9859 | | }; |
9860 | | |
9861 | | /** |
9862 | | * This table matches a Zigbee time value of 0x00000000, which means |
9863 | | * "now" in some contexts. |
9864 | | */ |
9865 | | const time_value_string now_strings[] = { |
9866 | | { NSTIME_INIT_ZBEE(0x00000000), "Now" }, |
9867 | | { NSTIME_INIT_ZERO, NULL } |
9868 | | }; |
9869 | | |
9870 | | static const time_value_string upgrade_time_utc_strings[] = { |
9871 | | { NSTIME_INIT_ZBEE(ZBEE_ZCL_OTA_TIME_WAIT), "Wait for upgrade command" }, |
9872 | | { NSTIME_INIT_ZERO, NULL } |
9873 | | }; |
9874 | | |
9875 | | /*************************/ |
9876 | | /* Function Bodies */ |
9877 | | /*************************/ |
9878 | | |
9879 | | /*FUNCTION:------------------------------------------------------ |
9880 | | * NAME |
9881 | | * decode_zcl_ota_req_time |
9882 | | * DESCRIPTION |
9883 | | * this function decode the request time field |
9884 | | * PARAMETERS |
9885 | | * RETURNS |
9886 | | * none |
9887 | | *--------------------------------------------------------------- |
9888 | | */ |
9889 | | static void |
9890 | | decode_zcl_ota_req_time(char *s, uint32_t value) |
9891 | 0 | { |
9892 | 0 | if (value == ZBEE_ZCL_OTA_TIME_WAIT) { |
9893 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "Wrong Value"); |
9894 | 0 | } |
9895 | 0 | else { |
9896 | | /* offset from now */ |
9897 | 0 | char *tmp = signed_time_secs_to_str(NULL, value); |
9898 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "%s from now", tmp); |
9899 | 0 | wmem_free(NULL, tmp); |
9900 | 0 | } |
9901 | |
|
9902 | 0 | return; |
9903 | 0 | } /*decode_zcl_ota_req_time*/ |
9904 | | |
9905 | | /*FUNCTION:------------------------------------------------------ |
9906 | | * NAME |
9907 | | * decode_zcl_ota_upgr_time |
9908 | | * DESCRIPTION |
9909 | | * this function decode the upgrade time field |
9910 | | * PARAMETERS |
9911 | | * RETURNS |
9912 | | * none |
9913 | | *--------------------------------------------------------------- |
9914 | | */ |
9915 | | static void |
9916 | | decode_zcl_ota_upgr_time(char *s, uint32_t value) |
9917 | 0 | { |
9918 | 0 | if (value == ZBEE_ZCL_OTA_TIME_WAIT) { |
9919 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "Wait for upgrade command"); |
9920 | 0 | } |
9921 | 0 | else { |
9922 | | /* offset from now */ |
9923 | 0 | char *tmp = signed_time_secs_to_str(NULL, value); |
9924 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "%s from now", tmp); |
9925 | 0 | wmem_free(NULL, tmp); |
9926 | 0 | } |
9927 | |
|
9928 | 0 | return; |
9929 | 0 | } /*decode_zcl_ota_upgr_time*/ |
9930 | | |
9931 | | /*FUNCTION:------------------------------------------------------ |
9932 | | * NAME |
9933 | | * decode_zcl_ota_size_in_bytes |
9934 | | * DESCRIPTION |
9935 | | * this function decodes size in bytes |
9936 | | * PARAMETERS |
9937 | | * RETURNS |
9938 | | * none |
9939 | | *--------------------------------------------------------------- |
9940 | | */ |
9941 | | static void |
9942 | | decode_zcl_ota_size_in_bytes(char *s, uint32_t value) |
9943 | 0 | { |
9944 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "%u [Bytes]", value); |
9945 | 0 | } /*decode_zcl_ota_size_in_bytes*/ |
9946 | | |
9947 | | /*FUNCTION:------------------------------------------------------ |
9948 | | * NAME |
9949 | | * dissect_zcl_ota_file_version_field |
9950 | | * DESCRIPTION |
9951 | | * this function is called in order to decode "FileVersion" field, |
9952 | | * PARAMETERS |
9953 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
9954 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
9955 | | * unsigned *offset - pointer to buffer offset |
9956 | | * RETURNS |
9957 | | * none |
9958 | | *--------------------------------------------------------------- |
9959 | | */ |
9960 | | static void |
9961 | | dissect_zcl_ota_file_version_field(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
9962 | 64 | { |
9963 | 64 | static int * const file_version[] = { |
9964 | 64 | &hf_zbee_zcl_ota_file_version_appl_release, |
9965 | 64 | &hf_zbee_zcl_ota_file_version_appl_build, |
9966 | 64 | &hf_zbee_zcl_ota_file_version_stack_release, |
9967 | 64 | &hf_zbee_zcl_ota_file_version_stack_build, |
9968 | 64 | NULL |
9969 | 64 | }; |
9970 | | |
9971 | | /* 'File Version' field present, retrieves it */ |
9972 | | /* File version is Little endian. as well as all ZigBee data structures: |
9973 | | "The endianness used in each data field shall be little endian in order |
9974 | | to be compliant with general ZigBee messages." |
9975 | | File version A: 0x10053519 represents application release 1.0 build 05 with stack release 3.5 b19 |
9976 | | */ |
9977 | 64 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_ota_file_version, ett_zbee_zcl_ota_file_version, file_version, ENC_LITTLE_ENDIAN); |
9978 | 64 | *offset += 4; |
9979 | 64 | } /*dissect_zcl_ota_file_version_field*/ |
9980 | | |
9981 | | /*FUNCTION:------------------------------------------------------ |
9982 | | * NAME |
9983 | | * dissect_zcl_ota_field_ctrl_field |
9984 | | * DESCRIPTION |
9985 | | * this function is called in order to decode "FileVersion" field, |
9986 | | * PARAMETERS |
9987 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
9988 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
9989 | | * unsigned *offset - pointer to buffer offset |
9990 | | * int hf_hdr - hf_hdr |
9991 | | * int ett - ett subtree index |
9992 | | * int* const *fields - fields an array of pointers to int that lists all the fields of the bitmask |
9993 | | * RETURNS |
9994 | | * uint8_t - field ctrl value |
9995 | | *--------------------------------------------------------------- |
9996 | | */ |
9997 | | static uint8_t |
9998 | | dissect_zcl_ota_field_ctrl_field(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, int hf_hdr, int ett, int * const *fields) |
9999 | 11 | { |
10000 | 11 | uint8_t field; |
10001 | | |
10002 | | /* Retrieve 'Field Control' field */ |
10003 | 11 | field = tvb_get_uint8(tvb, *offset); |
10004 | 11 | proto_tree_add_bitmask(tree, tvb, *offset, hf_hdr, ett, fields, ENC_NA); |
10005 | 11 | *offset += 1; |
10006 | | |
10007 | 11 | return field; |
10008 | 11 | } /*dissect_zcl_ota_field_ctrl_field*/ |
10009 | | |
10010 | | /*FUNCTION:------------------------------------------------------ |
10011 | | * NAME |
10012 | | * dissect_zcl_ota_imagenotify |
10013 | | * DESCRIPTION |
10014 | | * this function is called in order to decode "ImageNotify", |
10015 | | * PARAMETERS |
10016 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
10017 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
10018 | | * unsigned *offset - pointer to buffer offset |
10019 | | * RETURNS |
10020 | | * none |
10021 | | *--------------------------------------------------------------- |
10022 | | */ |
10023 | | static void |
10024 | | dissect_zcl_ota_imagenotify(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
10025 | 2 | { |
10026 | 2 | uint8_t payload_type; |
10027 | | |
10028 | | /* Retrieve 'Payload type' field */ |
10029 | 2 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_ota_payload_type, tvb, *offset, 1, ENC_NA, &payload_type); |
10030 | 2 | *offset += 1; |
10031 | | |
10032 | | /* Retrieve 'Query Jitter' field */ |
10033 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_ota_query_jitter, tvb, *offset, 1, ENC_NA); |
10034 | 2 | *offset += 1; |
10035 | | |
10036 | | /* Check if there are optional fields */ |
10037 | | |
10038 | 2 | if (payload_type >= ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC) { |
10039 | | /* 'Manufacturer Code' field present, retrieves it */ |
10040 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10041 | 1 | *offset += 2; |
10042 | 1 | } |
10043 | | |
10044 | 2 | if (payload_type >= ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT) { |
10045 | | /* 'Image Type' field present, retrieves it */ |
10046 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10047 | 1 | *offset += 2; |
10048 | 1 | } |
10049 | | |
10050 | 2 | if (payload_type >= ZBEE_ZCL_OTA_PAYLOAD_TYPE_QJ_MC_IT_FV) { |
10051 | | /* 'File Version' field present, retrieves it */ |
10052 | 1 | dissect_zcl_ota_file_version_field(tvb, tree, offset); |
10053 | 1 | } |
10054 | | |
10055 | 2 | } /*dissect_zcl_ota_imagenotify*/ |
10056 | | |
10057 | | /*FUNCTION:------------------------------------------------------ |
10058 | | * NAME |
10059 | | * dissect_zcl_ota_querynextimagereq |
10060 | | * DESCRIPTION |
10061 | | * this function is called in order to decode "QueryNextImageRequest", |
10062 | | * PARAMETERS |
10063 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
10064 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
10065 | | * unsigned *offset - pointer to buffer offset |
10066 | | * RETURNS |
10067 | | * none |
10068 | | *--------------------------------------------------------------- |
10069 | | */ |
10070 | | static void |
10071 | | dissect_zcl_ota_querynextimagereq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
10072 | 6 | { |
10073 | 6 | static int * const fields[] = { |
10074 | 6 | &hf_zbee_zcl_ota_query_next_image_req_field_ctrl_hw_ver_present, |
10075 | 6 | &hf_zbee_zcl_ota_query_next_image_req_field_ctrl_reserved, |
10076 | 6 | NULL |
10077 | 6 | }; |
10078 | | |
10079 | 6 | uint8_t field_ctrl; |
10080 | | |
10081 | | /* Retrieve 'Field Control' field */ |
10082 | 6 | 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); |
10083 | | |
10084 | | /* Retrieve 'Manufacturer Code' field */ |
10085 | 6 | proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10086 | 6 | *offset += 2; |
10087 | | |
10088 | | /* Retrieve 'Image Type' field */ |
10089 | 6 | proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10090 | 6 | *offset += 2; |
10091 | | |
10092 | | /* Retrieve 'File Version' field */ |
10093 | 6 | dissect_zcl_ota_file_version_field(tvb, tree, offset); |
10094 | | |
10095 | | /* Check if there are optional fields */ |
10096 | 6 | if (field_ctrl & ZBEE_ZCL_OTA_QUERY_NEXT_IMAGE_REQ_FIELD_CTRL_HW_VER_PRESENT) { |
10097 | | /* 'Hardware Version' field present, retrieves it */ |
10098 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_ota_hw_version, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10099 | 3 | *offset += 2; |
10100 | 3 | } |
10101 | 6 | } /*dissect_zcl_ota_querynextimagereq*/ |
10102 | | |
10103 | | /*FUNCTION:------------------------------------------------------ |
10104 | | * NAME |
10105 | | * dissect_zcl_ota_querynextimagersp |
10106 | | * DESCRIPTION |
10107 | | * this function is called in order to decode "QueryNextImageResponse", |
10108 | | * PARAMETERS |
10109 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
10110 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
10111 | | * unsigned *offset - pointer to buffer offset |
10112 | | * RETURNS |
10113 | | * none |
10114 | | *--------------------------------------------------------------- |
10115 | | */ |
10116 | | static void |
10117 | | dissect_zcl_ota_querynextimagersp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
10118 | 1 | { |
10119 | 1 | uint8_t status; |
10120 | | |
10121 | | /* Retrieve 'Status' field */ |
10122 | 1 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_ota_status, tvb, *offset, 1, ENC_NA, &status); |
10123 | 1 | *offset += 1; |
10124 | | |
10125 | | /* Check if there are optional fields */ |
10126 | 1 | if (status == ZBEE_ZCL_STAT_SUCCESS) { |
10127 | | /* Retrieve 'Manufacturer Code' field */ |
10128 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10129 | 0 | *offset += 2; |
10130 | | |
10131 | | /* Retrieve 'Image Type' field */ |
10132 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10133 | 0 | *offset += 2; |
10134 | | |
10135 | | /* Retrieve 'File Version' field */ |
10136 | 0 | dissect_zcl_ota_file_version_field(tvb, tree, offset); |
10137 | | |
10138 | | /* Retrieve 'Image Size' field */ |
10139 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_image_size, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
10140 | 0 | *offset += 4; |
10141 | 0 | } |
10142 | | |
10143 | 1 | } /*dissect_zcl_ota_querynextimagersp*/ |
10144 | | |
10145 | | /*FUNCTION:------------------------------------------------------ |
10146 | | * NAME |
10147 | | * dissect_zcl_ota_imageblockreq |
10148 | | * DESCRIPTION |
10149 | | * this function is called in order to decode "ImageBlockRequest", |
10150 | | * PARAMETERS |
10151 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
10152 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
10153 | | * unsigned *offset - pointer to buffer offset |
10154 | | * RETURNS |
10155 | | * none |
10156 | | *--------------------------------------------------------------- |
10157 | | */ |
10158 | | static void |
10159 | | dissect_zcl_ota_imageblockreq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
10160 | 3 | { |
10161 | 3 | static int * const fields[] = { |
10162 | 3 | &hf_zbee_zcl_ota_image_block_req_field_ctrl_ieee_addr_present, |
10163 | 3 | &hf_zbee_zcl_ota_image_block_req_field_ctrl_min_block_period_present, |
10164 | 3 | &hf_zbee_zcl_ota_image_block_req_field_ctrl_reserved, |
10165 | 3 | NULL |
10166 | 3 | }; |
10167 | | |
10168 | 3 | uint8_t field_ctrl; |
10169 | | |
10170 | | /* Retrieve 'Field Control' field */ |
10171 | 3 | 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); |
10172 | | |
10173 | | /* Retrieve 'Manufacturer Code' field */ |
10174 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10175 | 3 | *offset += 2; |
10176 | | |
10177 | | /* Retrieve 'Image Type' field */ |
10178 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10179 | 3 | *offset += 2; |
10180 | | |
10181 | | /* Retrieve 'File Version' field */ |
10182 | 3 | dissect_zcl_ota_file_version_field(tvb, tree, offset); |
10183 | | |
10184 | | /* Retrieve 'File Offset' field */ |
10185 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_ota_file_offset, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
10186 | 3 | *offset += 4; |
10187 | | |
10188 | | /* Retrieve 'Maximum Data Size' field */ |
10189 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_ota_max_data_size, tvb, *offset, 1, ENC_NA); |
10190 | 3 | *offset += 1; |
10191 | | |
10192 | | /* Check if there are optional fields */ |
10193 | 3 | if (field_ctrl & ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT) { |
10194 | | /* 'Request Node Address' field present, retrieve it */ |
10195 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_ota_req_node_addr, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
10196 | 1 | *offset += 8; |
10197 | 1 | } |
10198 | 3 | if (field_ctrl & ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_MIN_BLOCK_PERIOD_PRESENT) { |
10199 | | /* 'Minimum Block Period' field present, retrieve it */ |
10200 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_ota_min_block_period, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10201 | 1 | *offset += 2; |
10202 | 1 | } |
10203 | 3 | } /*dissect_zcl_ota_imageblockreq*/ |
10204 | | |
10205 | | /*FUNCTION:------------------------------------------------------ |
10206 | | * NAME |
10207 | | * dissect_zcl_ota_imagepagereq |
10208 | | * DESCRIPTION |
10209 | | * this function is called in order to decode "ImagePageRequest", |
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 | | */ |
10218 | | static void |
10219 | | dissect_zcl_ota_imagepagereq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
10220 | 2 | { |
10221 | 2 | static int * const fields[] = { |
10222 | 2 | &hf_zbee_zcl_ota_image_page_req_field_ctrl_ieee_addr_present, |
10223 | 2 | &hf_zbee_zcl_ota_image_page_req_field_ctrl_reserved, |
10224 | 2 | NULL |
10225 | 2 | }; |
10226 | | |
10227 | 2 | uint8_t field_ctrl; |
10228 | | |
10229 | | /* Retrieve 'Field Control' field */ |
10230 | 2 | 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); |
10231 | | |
10232 | | /* Retrieve 'Manufacturer Code' field */ |
10233 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10234 | 2 | *offset += 2; |
10235 | | |
10236 | | /* Retrieve 'Image Type' field */ |
10237 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10238 | 2 | *offset += 2; |
10239 | | |
10240 | | /* Retrieve 'File Version' field */ |
10241 | 2 | dissect_zcl_ota_file_version_field(tvb, tree, offset); |
10242 | | |
10243 | | /* Retrieve 'File Offset' field */ |
10244 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_ota_file_offset, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
10245 | 2 | *offset += 4; |
10246 | | |
10247 | | /* Retrieve 'Maximum Data Size' field */ |
10248 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_ota_max_data_size, tvb, *offset, 1, ENC_NA); |
10249 | 2 | *offset += 1; |
10250 | | |
10251 | | /* Retrieve 'Page Size' field */ |
10252 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_ota_page_size, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10253 | 2 | *offset += 2; |
10254 | | |
10255 | | /* Retrieve 'Response Spacing' field */ |
10256 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_ota_rsp_spacing, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10257 | 2 | *offset += 2; |
10258 | | |
10259 | | /* Check if there are optional fields */ |
10260 | 2 | if (field_ctrl & ZBEE_ZCL_OTA_IMAGE_PAGE_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT) { |
10261 | | /* 'Request Node Address' field present, retrieves it */ |
10262 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_req_node_addr, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
10263 | 0 | *offset += 8; |
10264 | 0 | } |
10265 | 2 | } /*dissect_zcl_ota_imagepagereq*/ |
10266 | | |
10267 | | /*FUNCTION:------------------------------------------------------ |
10268 | | * NAME |
10269 | | * dissect_zcl_ota_imageblockrsp |
10270 | | * DESCRIPTION |
10271 | | * this function is called in order to decode "ImageBlockResponse", |
10272 | | * PARAMETERS |
10273 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
10274 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
10275 | | * unsigned *offset - pointer to buffer offset |
10276 | | * RETURNS |
10277 | | * none |
10278 | | *--------------------------------------------------------------- |
10279 | | */ |
10280 | | static void |
10281 | | dissect_zcl_ota_imageblockrsp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
10282 | 1 | { |
10283 | 1 | uint8_t status; |
10284 | 1 | uint8_t data_size; |
10285 | | |
10286 | | /* Retrieve 'Status' field */ |
10287 | 1 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_ota_status, tvb, *offset, 1, ENC_NA, &status); |
10288 | 1 | *offset += 1; |
10289 | | |
10290 | 1 | if (status == ZBEE_ZCL_STAT_SUCCESS) { |
10291 | | /* Retrieve 'Manufacturer Code' field */ |
10292 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10293 | 0 | *offset += 2; |
10294 | | |
10295 | | /* Retrieve 'Image Type' field */ |
10296 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10297 | 0 | *offset += 2; |
10298 | | |
10299 | | /* Retrieve 'File Version' field */ |
10300 | 0 | dissect_zcl_ota_file_version_field(tvb, tree, offset); |
10301 | | |
10302 | | /* Retrieve 'File Offset' field */ |
10303 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_file_offset, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
10304 | 0 | *offset += 4; |
10305 | | |
10306 | | /* Retrieve 'Data Size' field */ |
10307 | 0 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_ota_data_size, tvb, *offset, 1, ENC_NA, &data_size); |
10308 | 0 | *offset += 1; |
10309 | | |
10310 | | /* Retrieve 'Image Data' field */ |
10311 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_image_data, tvb, *offset, data_size, ENC_NA); |
10312 | 0 | *offset += data_size; |
10313 | 0 | } |
10314 | 1 | else if (status == ZBEE_ZCL_STAT_OTA_WAIT_FOR_DATA) { |
10315 | | /* If 'Current Time' is zero, 'Request Time' is an offset from now; |
10316 | | * if it's non-zero, 'Request Time' is UTC. |
10317 | | */ |
10318 | 0 | uint32_t current_time; |
10319 | | |
10320 | | /* Retrieve 'Current Time' field */ |
10321 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_current_time, tvb, *offset, 4, ENC_TIME_ZBEE_ZCL|ENC_LITTLE_ENDIAN); |
10322 | 0 | current_time = tvb_get_letohl(tvb, *offset); |
10323 | 0 | *offset += 4; |
10324 | | |
10325 | | /* Retrieve 'Request Time' field */ |
10326 | 0 | if (current_time == 0) { |
10327 | | /* Request Time is offset time from now */ |
10328 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_request_time_offset, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
10329 | 0 | } else { |
10330 | | /* Request Time is UTC time */ |
10331 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_request_time_utc, tvb, *offset, 4, ENC_TIME_ZBEE_ZCL|ENC_LITTLE_ENDIAN); |
10332 | | /* XXX - compute delta between Request Time and Current Time |
10333 | | * and display as offset time from now? |
10334 | | */ |
10335 | 0 | } |
10336 | 0 | *offset += 4; |
10337 | 0 | } |
10338 | 1 | else { |
10339 | | /* */ |
10340 | 1 | } |
10341 | | |
10342 | 1 | } /*dissect_zcl_ota_imageblockrsp*/ |
10343 | | |
10344 | | /*FUNCTION:------------------------------------------------------ |
10345 | | * NAME |
10346 | | * dissect_zcl_ota_upgradeendreq |
10347 | | * DESCRIPTION |
10348 | | * this function is called in order to decode "UpgradeEndRequest", |
10349 | | * PARAMETERS |
10350 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
10351 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
10352 | | * unsigned *offset - pointer to buffer offset |
10353 | | * RETURNS |
10354 | | * none |
10355 | | *--------------------------------------------------------------- |
10356 | | */ |
10357 | | static void |
10358 | | dissect_zcl_ota_upgradeendreq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
10359 | 0 | { |
10360 | | /* Retrieve 'Status' field */ |
10361 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_status, tvb, *offset, 1, ENC_NA); |
10362 | 0 | *offset += 1; |
10363 | | |
10364 | | /* Retrieve 'Manufacturer Code' field */ |
10365 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10366 | 0 | *offset += 2; |
10367 | | |
10368 | | /* Retrieve 'Image Type' field */ |
10369 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10370 | 0 | *offset += 2; |
10371 | | |
10372 | | /* Retrieve 'File Version' field */ |
10373 | 0 | dissect_zcl_ota_file_version_field(tvb, tree, offset); |
10374 | |
|
10375 | 0 | } /*dissect_zcl_ota_upgradeendreq*/ |
10376 | | |
10377 | | /*FUNCTION:------------------------------------------------------ |
10378 | | * NAME |
10379 | | * dissect_zcl_ota_upgradeendrsp |
10380 | | * DESCRIPTION |
10381 | | * this function is called in order to decode "UpgradeEndResponse", |
10382 | | * PARAMETERS |
10383 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
10384 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
10385 | | * unsigned *offset - pointer to buffer offset |
10386 | | * RETURNS |
10387 | | * none |
10388 | | *--------------------------------------------------------------- |
10389 | | */ |
10390 | | static void |
10391 | | dissect_zcl_ota_upgradeendrsp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
10392 | 1 | { |
10393 | 1 | uint32_t current_time = 0; |
10394 | | |
10395 | | /* Retrieve 'Manufacturer Code' field */ |
10396 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10397 | 1 | *offset += 2; |
10398 | | |
10399 | | /* Retrieve 'Image Type' field */ |
10400 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10401 | 1 | *offset += 2; |
10402 | | |
10403 | | /* Retrieve 'File Version' field */ |
10404 | 1 | dissect_zcl_ota_file_version_field(tvb, tree, offset); |
10405 | | |
10406 | | /* Retrieve 'Current Time' field */ |
10407 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_ota_current_time, tvb, *offset, 4, ENC_TIME_ZBEE_ZCL|ENC_LITTLE_ENDIAN); |
10408 | 1 | current_time = tvb_get_letohl(tvb, *offset); |
10409 | 1 | *offset += 4; |
10410 | | |
10411 | | /* Retrieve 'Upgrade Time' field */ |
10412 | 1 | if (current_time == 0) |
10413 | 0 | { |
10414 | | /* Upgrade Time is offset time from now */ |
10415 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_upgrade_time, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
10416 | 0 | } |
10417 | 1 | else |
10418 | 1 | { |
10419 | | /* Upgrade Time is UTC time */ |
10420 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_ota_upgrade_time_utc, tvb, *offset, 4, ENC_TIME_ZBEE_ZCL|ENC_LITTLE_ENDIAN); |
10421 | 1 | } |
10422 | 1 | *offset += 4; |
10423 | | |
10424 | 1 | } /*dissect_zcl_ota_upgradeendrsp*/ |
10425 | | |
10426 | | /*FUNCTION:------------------------------------------------------ |
10427 | | * NAME |
10428 | | * dissect_zcl_ota_queryspecfilereq |
10429 | | * DESCRIPTION |
10430 | | * this function is called in order to decode "QuerySpecificFileRequest", |
10431 | | * PARAMETERS |
10432 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
10433 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
10434 | | * unsigned *offset - pointer to buffer offset |
10435 | | * RETURNS |
10436 | | * none |
10437 | | *--------------------------------------------------------------- |
10438 | | */ |
10439 | | static void |
10440 | | dissect_zcl_ota_queryspecfilereq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
10441 | 0 | { |
10442 | | /* 'Request Node Address' field present, retrieves it */ |
10443 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_req_node_addr, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
10444 | 0 | *offset += 8; |
10445 | | |
10446 | | /* Retrieve 'Manufacturer Code' field */ |
10447 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10448 | 0 | *offset += 2; |
10449 | | |
10450 | | /* Retrieve 'Image Type' field */ |
10451 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10452 | 0 | *offset += 2; |
10453 | | |
10454 | | /* Retrieve 'File Version' field */ |
10455 | 0 | dissect_zcl_ota_file_version_field(tvb, tree, offset); |
10456 | | |
10457 | | /* Retrieve 'ZigBee Stack Version' field */ |
10458 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_ota_zb_stack_ver, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10459 | 0 | *offset += 2; |
10460 | |
|
10461 | 0 | } /*dissect_zcl_ota_queryspecfilereq*/ |
10462 | | |
10463 | | /*FUNCTION:------------------------------------------------------ |
10464 | | * NAME |
10465 | | * dissect_zcl_ota_queryspecfilersp |
10466 | | * DESCRIPTION |
10467 | | * this function is called in order to decode "QuerySpecificFileResponse", |
10468 | | * PARAMETERS |
10469 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
10470 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
10471 | | * unsigned *offset - pointer to buffer offset |
10472 | | * RETURNS |
10473 | | * none |
10474 | | *--------------------------------------------------------------- |
10475 | | */ |
10476 | | static void |
10477 | | dissect_zcl_ota_queryspecfilersp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
10478 | 20 | { |
10479 | 20 | uint8_t status; |
10480 | | |
10481 | | /* Retrieve 'Status' field */ |
10482 | 20 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_ota_status, tvb, *offset, 1, ENC_NA, &status); |
10483 | 20 | *offset += 1; |
10484 | | |
10485 | 20 | if (status == ZBEE_ZCL_STAT_SUCCESS) { |
10486 | | /* Retrieve 'Manufacturer Code' field */ |
10487 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10488 | 1 | *offset += 2; |
10489 | | |
10490 | | /* Retrieve 'Image Type' field */ |
10491 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10492 | 1 | *offset += 2; |
10493 | | |
10494 | | /* Retrieve 'File Version' field */ |
10495 | 1 | dissect_zcl_ota_file_version_field(tvb, tree, offset); |
10496 | | |
10497 | | /* Retrieve 'Image Size' field */ |
10498 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_ota_image_size, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
10499 | 1 | *offset += 4; |
10500 | 1 | } |
10501 | | |
10502 | 20 | } /*dissect_zcl_ota_queryspecfilersp*/ |
10503 | | |
10504 | | |
10505 | | /*FUNCTION:------------------------------------------------------ |
10506 | | * NAME |
10507 | | * dissect_zcl_ota_attr_data |
10508 | | * DESCRIPTION |
10509 | | * this function is called by ZCL foundation dissector in order to decode |
10510 | | * specific cluster attributes data. |
10511 | | * PARAMETERS |
10512 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
10513 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
10514 | | * unsigned *offset - pointer to buffer offset |
10515 | | * uint16_t attr_id - attribute identifier |
10516 | | * unsigned data_type - attribute data type |
10517 | | * bool client_attr- ZCL client |
10518 | | * RETURNS |
10519 | | * none |
10520 | | *--------------------------------------------------------------- |
10521 | | */ |
10522 | | static void |
10523 | | dissect_zcl_ota_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
10524 | 1.84k | { |
10525 | | /* Dissect attribute data type and data */ |
10526 | 1.84k | switch ( attr_id ) |
10527 | 1.84k | { |
10528 | 34 | case ZBEE_ZCL_ATTR_ID_OTA_CURRENT_FILE_VERSION: |
10529 | 50 | case ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_FILE_VERSION: |
10530 | 50 | dissect_zcl_ota_file_version_field(tvb, tree, offset); |
10531 | 50 | break; |
10532 | | |
10533 | 15 | case ZBEE_ZCL_ATTR_ID_OTA_CURRENT_ZB_STACK_VERSION: |
10534 | 30 | case ZBEE_ZCL_ATTR_ID_OTA_DOWNLOADED_ZB_STACK_VERSION: |
10535 | 30 | proto_tree_add_item(tree, hf_zbee_zcl_ota_zb_stack_ver, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10536 | 30 | *offset += 2; |
10537 | 30 | break; |
10538 | | |
10539 | 7 | case ZBEE_ZCL_ATTR_ID_OTA_IMAGE_UPGRADE_STATUS: |
10540 | 7 | proto_tree_add_item(tree, hf_zbee_zcl_ota_image_upgrade_status, tvb, *offset, 1, ENC_NA); |
10541 | 7 | *offset += 1; |
10542 | 7 | break; |
10543 | | |
10544 | 7 | case ZBEE_ZCL_ATTR_ID_OTA_MANUFACTURER_ID: |
10545 | 7 | proto_tree_add_item(tree, hf_zbee_zcl_ota_manufacturer_code, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10546 | 7 | *offset += 2; |
10547 | 7 | break; |
10548 | | |
10549 | 22 | case ZBEE_ZCL_ATTR_ID_OTA_IMAGE_TYPE_ID: |
10550 | 22 | proto_tree_add_item(tree, hf_zbee_zcl_ota_image_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
10551 | 22 | *offset += 2; |
10552 | 22 | break; |
10553 | | |
10554 | 2 | case ZBEE_ZCL_ATTR_ID_OTA_MIN_BLOCK_REQ_DELAY: |
10555 | 1.72k | default: |
10556 | 1.72k | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
10557 | 1.72k | break; |
10558 | 1.84k | } |
10559 | 1.84k | } /*dissect_zcl_ota_attr_data*/ |
10560 | | |
10561 | | |
10562 | | /*FUNCTION:------------------------------------------------------ |
10563 | | * NAME |
10564 | | * dissect_zbee_zcl_ota |
10565 | | * DESCRIPTION |
10566 | | * ZigBee ZCL OTA cluster dissector for wireshark. |
10567 | | * PARAMETERS |
10568 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
10569 | | * packet_info *pinfo - pointer to packet information fields |
10570 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
10571 | | * void *data - pointer to ZCL packet structure. |
10572 | | * RETURNS |
10573 | | * int - length of parsed data. |
10574 | | *--------------------------------------------------------------- |
10575 | | */ |
10576 | | static int |
10577 | | dissect_zbee_zcl_ota(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
10578 | 119 | { |
10579 | 119 | proto_tree *payload_tree; |
10580 | 119 | zbee_zcl_packet *zcl; |
10581 | 119 | unsigned offset = 0; |
10582 | 119 | uint8_t cmd_id; |
10583 | 119 | int rem_len; |
10584 | | |
10585 | | /* Reject the packet if data is NULL */ |
10586 | 119 | if (data == NULL) |
10587 | 0 | return 0; |
10588 | 119 | zcl = (zbee_zcl_packet *)data; |
10589 | 119 | cmd_id = zcl->cmd_id; |
10590 | | |
10591 | | /* Create a subtree for the ZCL Command frame, and add the command ID to it. */ |
10592 | 119 | if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { |
10593 | | /* Append the command name to the info column. */ |
10594 | 56 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
10595 | 56 | val_to_str_const(cmd_id, zbee_zcl_ota_srv_rx_cmd_names, "Unknown Command"), |
10596 | 56 | zcl->tran_seqno); |
10597 | | |
10598 | | /* Add the command ID. */ |
10599 | 56 | proto_tree_add_item(tree, hf_zbee_zcl_ota_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
10600 | | |
10601 | | /* Check is this command has a payload, than add the payload tree */ |
10602 | 56 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
10603 | 56 | if (rem_len > 0) { |
10604 | 41 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_ota, NULL, "Payload"); |
10605 | | |
10606 | | /* Call the appropriate command dissector */ |
10607 | 41 | switch (cmd_id) { |
10608 | 6 | case ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_REQ: |
10609 | 6 | dissect_zcl_ota_querynextimagereq(tvb, payload_tree, &offset); |
10610 | 6 | break; |
10611 | | |
10612 | 3 | case ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_REQ: |
10613 | 3 | dissect_zcl_ota_imageblockreq(tvb, payload_tree, &offset); |
10614 | 3 | break; |
10615 | | |
10616 | 2 | case ZBEE_ZCL_CMD_ID_OTA_IMAGE_PAGE_REQ: |
10617 | 2 | dissect_zcl_ota_imagepagereq(tvb, payload_tree, &offset); |
10618 | 2 | break; |
10619 | | |
10620 | 0 | case ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_REQ: |
10621 | 0 | dissect_zcl_ota_upgradeendreq(tvb, payload_tree, &offset); |
10622 | 0 | break; |
10623 | | |
10624 | 0 | case ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_REQ: |
10625 | 0 | dissect_zcl_ota_queryspecfilereq(tvb, payload_tree, &offset); |
10626 | 0 | break; |
10627 | | |
10628 | 30 | default: |
10629 | 30 | break; |
10630 | 41 | } |
10631 | 41 | } |
10632 | 56 | } |
10633 | 63 | else { /* ZBEE_ZCL_FCF_TO_CLIENT */ |
10634 | | /* Append the command name to the info column. */ |
10635 | 63 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
10636 | 63 | val_to_str_const(cmd_id, zbee_zcl_ota_srv_tx_cmd_names, "Unknown Command"), |
10637 | 63 | zcl->tran_seqno); |
10638 | | |
10639 | | /* Add the command ID. */ |
10640 | 63 | proto_tree_add_item(tree, hf_zbee_zcl_ota_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
10641 | | |
10642 | | /* Check is this command has a payload, than add the payload tree */ |
10643 | 63 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
10644 | 63 | if (rem_len > 0) { |
10645 | 58 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_ota, NULL, "Payload"); |
10646 | | |
10647 | | /* Call the appropriate command dissector */ |
10648 | 58 | switch (cmd_id) { |
10649 | 2 | case ZBEE_ZCL_CMD_ID_OTA_IMAGE_NOTIFY: |
10650 | 2 | dissect_zcl_ota_imagenotify(tvb, payload_tree, &offset); |
10651 | 2 | break; |
10652 | | |
10653 | 1 | case ZBEE_ZCL_CMD_ID_OTA_QUERY_NEXT_IMAGE_RSP: |
10654 | 1 | dissect_zcl_ota_querynextimagersp(tvb, payload_tree, &offset); |
10655 | 1 | break; |
10656 | | |
10657 | 1 | case ZBEE_ZCL_CMD_ID_OTA_IMAGE_BLOCK_RSP: |
10658 | 1 | dissect_zcl_ota_imageblockrsp(tvb, payload_tree, &offset); |
10659 | 1 | break; |
10660 | | |
10661 | 1 | case ZBEE_ZCL_CMD_ID_OTA_UPGRADE_END_RSP: |
10662 | 1 | dissect_zcl_ota_upgradeendrsp(tvb, payload_tree, &offset); |
10663 | 1 | break; |
10664 | | |
10665 | 20 | case ZBEE_ZCL_CMD_ID_OTA_QUERY_SPEC_FILE_RSP: |
10666 | 20 | dissect_zcl_ota_queryspecfilersp(tvb, payload_tree, &offset); |
10667 | 20 | break; |
10668 | | |
10669 | 33 | default: |
10670 | 33 | break; |
10671 | 58 | } |
10672 | 58 | } |
10673 | 63 | } |
10674 | | |
10675 | 117 | return tvb_captured_length(tvb); |
10676 | 119 | } /*dissect_zbee_zcl_ota*/ |
10677 | | |
10678 | | /*FUNCTION:------------------------------------------------------ |
10679 | | * NAME |
10680 | | * proto_register_zbee_zcl_ota |
10681 | | * DESCRIPTION |
10682 | | * this function is called by ZCL foundation dissector in order to decode |
10683 | | * specific cluster attributes data. |
10684 | | * PARAMETERS |
10685 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
10686 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
10687 | | * unsigned *offset - pointer to buffer offset |
10688 | | * uint16_t attr_id - attribute identifier |
10689 | | * unsigned data_type - attribute data type |
10690 | | * RETURNS |
10691 | | * none |
10692 | | *--------------------------------------------------------------- |
10693 | | */ |
10694 | | void proto_register_zbee_zcl_ota(void) |
10695 | 16 | { |
10696 | 16 | static hf_register_info hf[] = { |
10697 | | |
10698 | 16 | { &hf_zbee_zcl_ota_attr_id, |
10699 | 16 | { "Attribute", "zbee_zcl_general.ota.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_ota_attr_names), |
10700 | 16 | 0x0, NULL, HFILL } }, |
10701 | | |
10702 | 16 | { &hf_zbee_zcl_ota_srv_tx_cmd_id, |
10703 | 16 | { "Command", "zbee_zcl_general.ota.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ota_srv_tx_cmd_names), |
10704 | 16 | 0x0, NULL, HFILL } }, |
10705 | | |
10706 | 16 | { &hf_zbee_zcl_ota_srv_rx_cmd_id, |
10707 | 16 | { "Command", "zbee_zcl_general.ota.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ota_srv_rx_cmd_names), |
10708 | 16 | 0x0, NULL, HFILL } }, |
10709 | | |
10710 | 16 | { &hf_zbee_zcl_ota_image_upgrade_status, |
10711 | 16 | { "Image Upgrade Status", "zbee_zcl_general.ota.status_attr", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ota_image_upgrade_attr_status_names), |
10712 | 16 | 0x0, NULL, HFILL } }, |
10713 | | |
10714 | 16 | { &hf_zbee_zcl_ota_zb_stack_ver, |
10715 | 16 | { "ZigBee Stack Version", "zbee_zcl_general.ota.zb_stack.ver", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, |
10716 | 16 | RVALS(zbee_zcl_ota_zb_stack_ver_names), 0x0, NULL, HFILL } }, |
10717 | | |
10718 | 16 | { &hf_zbee_zcl_ota_payload_type, |
10719 | 16 | { "Payload Type", "zbee_zcl_general.ota.payload.type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ota_payload_type_names), |
10720 | 16 | 0x0, NULL, HFILL } }, |
10721 | | |
10722 | 16 | { &hf_zbee_zcl_ota_query_jitter, |
10723 | 16 | { "Query Jitter", "zbee_zcl_general.ota.query_jitter", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_seconds), |
10724 | 16 | 0x0, NULL, HFILL } }, |
10725 | | |
10726 | 16 | { &hf_zbee_zcl_ota_manufacturer_code, |
10727 | 16 | { "Manufacturer Code", "zbee_zcl_general.ota.manufacturer_code", FT_UINT16, BASE_HEX, VALS(zbee_mfr_code_names), |
10728 | 16 | 0x0, NULL, HFILL } }, |
10729 | | |
10730 | 16 | { &hf_zbee_zcl_ota_image_type, |
10731 | 16 | { "Image Type", "zbee_zcl_general.ota.image.type", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, |
10732 | 16 | RVALS(zbee_zcl_ota_image_type_names), 0x0, NULL, HFILL } }, |
10733 | | |
10734 | | /* Begin FileVersion fields */ |
10735 | 16 | { &hf_zbee_zcl_ota_file_version, |
10736 | 16 | { "File Version", "zbee_zcl_general.ota.file.version", FT_UINT32, BASE_HEX, NULL, |
10737 | 16 | 0x0, NULL, HFILL } }, |
10738 | | |
10739 | 16 | { &hf_zbee_zcl_ota_file_version_appl_release, |
10740 | 16 | { "Application Release", "zbee_zcl_general.ota.file.version.appl.release", FT_UINT32, BASE_DEC, NULL, |
10741 | 16 | ZBEE_ZCL_OTA_FILE_VERS_APPL_RELEASE, NULL, HFILL } }, |
10742 | | |
10743 | 16 | { &hf_zbee_zcl_ota_file_version_appl_build, |
10744 | 16 | { "Application Build", "zbee_zcl_general.ota.file.version.appl.build", FT_UINT32, BASE_DEC, NULL, |
10745 | 16 | ZBEE_ZCL_OTA_FILE_VERS_APPL_BUILD, NULL, HFILL } }, |
10746 | | |
10747 | 16 | { &hf_zbee_zcl_ota_file_version_stack_release, |
10748 | 16 | { "Stack Release", "zbee_zcl_general.ota.file.version.stack.release", FT_UINT32, BASE_DEC, NULL, |
10749 | 16 | ZBEE_ZCL_OTA_FILE_VERS_STACK_RELEASE, NULL, HFILL } }, |
10750 | | |
10751 | 16 | { &hf_zbee_zcl_ota_file_version_stack_build, |
10752 | 16 | { "Stack Build", "zbee_zcl_general.ota.file.version.stack.build", FT_UINT32, BASE_DEC, NULL, |
10753 | 16 | ZBEE_ZCL_OTA_FILE_VERS_STACK_BUILD, NULL, HFILL } }, |
10754 | | /* End FileVersion fields */ |
10755 | | |
10756 | | /* Begin FieldControl fields Query Next Image Request */ |
10757 | 16 | { &hf_zbee_zcl_ota_query_next_image_req_field_ctrl, |
10758 | 16 | { "Field Control", "zbee_zcl_general.ota.query_next_image_req.field_ctrl", |
10759 | 16 | FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, |
10760 | | |
10761 | 16 | { &hf_zbee_zcl_ota_query_next_image_req_field_ctrl_hw_ver_present, |
10762 | 16 | { "Hardware Version", "zbee_zcl_general.ota.query_next_image_req.field_ctrl.hw_ver_present", |
10763 | 16 | FT_BOOLEAN, 8, TFS(&tfs_present_not_present), ZBEE_ZCL_OTA_QUERY_NEXT_IMAGE_REQ_FIELD_CTRL_HW_VER_PRESENT, NULL, HFILL } }, |
10764 | | |
10765 | 16 | { &hf_zbee_zcl_ota_query_next_image_req_field_ctrl_reserved, |
10766 | 16 | { "Reserved", "zbee_zcl_general.ota.query_next_image_req.field_ctrl.reserved", FT_UINT8, BASE_HEX, NULL, |
10767 | 16 | ZBEE_ZCL_OTA_QUERY_NEXT_IMAGE_REQ_FIELD_CTRL_RESERVED, NULL, HFILL } }, |
10768 | | /* End FieldControl fields Query Next Image Request */ |
10769 | | |
10770 | | /* Begin FieldControl fields Image Block Request */ |
10771 | 16 | { &hf_zbee_zcl_ota_image_block_req_field_ctrl, |
10772 | 16 | { "Field Control", "zbee_zcl_general.ota.image_block_req.field_ctrl", |
10773 | 16 | FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, |
10774 | | |
10775 | 16 | { &hf_zbee_zcl_ota_image_block_req_field_ctrl_ieee_addr_present, |
10776 | 16 | { "Request Node Address", "zbee_zcl_general.ota.image_block_req.field_ctrl.request_node_addr_present", |
10777 | 16 | FT_BOOLEAN, 8, TFS(&tfs_present_not_present), ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT, NULL, HFILL } }, |
10778 | | |
10779 | 16 | { &hf_zbee_zcl_ota_image_block_req_field_ctrl_min_block_period_present, |
10780 | 16 | { "Minimum Block Period", "zbee_zcl_general.ota.image_block_req.field_ctrl.min_block_period", |
10781 | 16 | FT_BOOLEAN, 8, TFS(&tfs_present_not_present), ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_MIN_BLOCK_PERIOD_PRESENT, NULL, HFILL } }, |
10782 | | |
10783 | 16 | { &hf_zbee_zcl_ota_image_block_req_field_ctrl_reserved, |
10784 | 16 | { "Reserved", "zbee_zcl_general.ota.query_next_image_req.field_ctrl.reserved", FT_UINT8, BASE_HEX, NULL, |
10785 | 16 | ZBEE_ZCL_OTA_IMAGE_BLOCK_REQ_FIELD_CTRL_RESERVED, NULL, HFILL } }, |
10786 | | /* End FieldControl fields Image Block Request */ |
10787 | | |
10788 | | /* Begin FieldControl fields Image Page Request */ |
10789 | 16 | { &hf_zbee_zcl_ota_image_page_req_field_ctrl, |
10790 | 16 | { "Field Control", "zbee_zcl_general.ota.image_page_req.field_ctrl", |
10791 | 16 | FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, |
10792 | | |
10793 | 16 | { &hf_zbee_zcl_ota_image_page_req_field_ctrl_ieee_addr_present, |
10794 | 16 | { "Request Node Address", "zbee_zcl_general.ota.query_next_image_req.field_ctrl.request_node_addr_present", |
10795 | 16 | FT_BOOLEAN, 8, TFS(&tfs_present_not_present), ZBEE_ZCL_OTA_IMAGE_PAGE_REQ_FIELD_CTRL_REQUEST_NODE_ADDR_PRESENT, NULL, HFILL } }, |
10796 | | |
10797 | 16 | { &hf_zbee_zcl_ota_image_page_req_field_ctrl_reserved, |
10798 | 16 | { "Reserved", "zbee_zcl_general.ota.image_page_req.field_ctrl.reserved", FT_UINT8, BASE_HEX, NULL, |
10799 | 16 | ZBEE_ZCL_OTA_IMAGE_PAGE_REQ_FIELD_CTRL_RESERVED, NULL, HFILL } }, |
10800 | | /* End FieldControl fields Image Page Request */ |
10801 | | |
10802 | 16 | { &hf_zbee_zcl_ota_hw_version, |
10803 | 16 | { "Hardware Version", "zbee_zcl_general.ota.hw_ver", FT_UINT16, BASE_HEX, NULL, |
10804 | 16 | 0x0, NULL, HFILL } }, |
10805 | | |
10806 | 16 | { &hf_zbee_zcl_ota_status, |
10807 | 16 | { "Status", "zbee_zcl_general.ota.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names), |
10808 | 16 | 0x0, NULL, HFILL } }, |
10809 | | |
10810 | 16 | { &hf_zbee_zcl_ota_image_size, |
10811 | 16 | { "Image Size", "zbee_zcl_general.ota.image.size", FT_UINT32, BASE_CUSTOM, CF_FUNC(decode_zcl_ota_size_in_bytes), |
10812 | 16 | 0x0, NULL, HFILL } }, |
10813 | | |
10814 | 16 | { &hf_zbee_zcl_ota_file_offset, |
10815 | 16 | { "File Offset", "zbee_zcl_general.ota.file.offset", FT_UINT32, BASE_DEC, NULL, |
10816 | 16 | 0x0, NULL, HFILL } }, |
10817 | | |
10818 | 16 | { &hf_zbee_zcl_ota_max_data_size, |
10819 | 16 | { "Max Data Size", "zbee_zcl_general.ota.max_data_size", FT_UINT8, BASE_DEC, NULL, |
10820 | 16 | 0x0, NULL, HFILL } }, |
10821 | | |
10822 | 16 | { &hf_zbee_zcl_ota_min_block_period, |
10823 | 16 | { "Minimum Block Period", "zbee_zcl_general.ota.min_block_period", FT_UINT16, BASE_DEC, NULL, |
10824 | 16 | 0x0, NULL, HFILL } }, |
10825 | | |
10826 | 16 | { &hf_zbee_zcl_ota_req_node_addr, |
10827 | 16 | { "Ieee Address", "zbee_zcl_general.ota.ieee_addr", FT_UINT64, BASE_HEX, NULL, |
10828 | 16 | 0x0, NULL, HFILL } }, |
10829 | | |
10830 | 16 | { &hf_zbee_zcl_ota_page_size, |
10831 | 16 | { "Page Size", "zbee_zcl_general.ota.page.size", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_ota_size_in_bytes), |
10832 | 16 | 0x0, NULL, HFILL } }, |
10833 | | |
10834 | 16 | { &hf_zbee_zcl_ota_rsp_spacing, |
10835 | 16 | { "Response Spacing", "zbee_zcl_general.ota.rsp_spacing", FT_UINT16, BASE_HEX, NULL, |
10836 | 16 | 0x0, NULL, HFILL } }, |
10837 | | |
10838 | 16 | { &hf_zbee_zcl_ota_current_time, |
10839 | 16 | { "Current Time", "zbee_zcl_general.ota.current_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, TIME_VALS(now_strings), |
10840 | 16 | 0x0, NULL, HFILL }}, |
10841 | | |
10842 | 16 | { &hf_zbee_zcl_ota_request_time_offset, |
10843 | 16 | { "Request Time (offset)", "zbee_zcl_general.ota.request_time_offset", FT_UINT32, BASE_CUSTOM, CF_FUNC(decode_zcl_ota_req_time), |
10844 | 16 | 0x0, NULL, HFILL }}, |
10845 | | |
10846 | 16 | { &hf_zbee_zcl_ota_request_time_utc, |
10847 | 16 | { "Request Time (UTC)", "zbee_zcl_general.ota.request_time_utc", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, TIME_VALS(now_strings), |
10848 | 16 | 0x0, NULL, HFILL }}, |
10849 | | |
10850 | 16 | { &hf_zbee_zcl_ota_upgrade_time, |
10851 | 16 | { "Upgrade Time", "zbee_zcl_general.ota.upgrade_time", FT_UINT32, BASE_CUSTOM, CF_FUNC(decode_zcl_ota_upgr_time), |
10852 | 16 | 0x0, NULL, HFILL }}, |
10853 | | |
10854 | 16 | { &hf_zbee_zcl_ota_upgrade_time_utc, |
10855 | 16 | { "Upgrade Time", "zbee_zcl_general.ota.upgrade_time_utc", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, TIME_VALS(upgrade_time_utc_strings), |
10856 | 16 | 0x0, NULL, HFILL }}, |
10857 | | |
10858 | 16 | { &hf_zbee_zcl_ota_data_size, |
10859 | 16 | { "Data Size", "zbee_zcl_general.ota.data_size", FT_UINT8, BASE_DEC, NULL, |
10860 | 16 | 0x00, NULL, HFILL } }, |
10861 | | |
10862 | 16 | { &hf_zbee_zcl_ota_image_data, |
10863 | 16 | { "Image Data", "zbee_zcl_general.ota.image.data", FT_BYTES, SEP_COLON, NULL, |
10864 | 16 | 0x00, NULL, HFILL } } |
10865 | 16 | }; |
10866 | | |
10867 | | /* ZCL OTA subtrees */ |
10868 | 16 | int *ett[] = { |
10869 | 16 | &ett_zbee_zcl_ota, |
10870 | 16 | &ett_zbee_zcl_ota_query_next_image_req_field_ctrl, |
10871 | 16 | &ett_zbee_zcl_ota_image_block_req_field_ctrl, |
10872 | 16 | &ett_zbee_zcl_ota_image_page_req_field_ctrl, |
10873 | 16 | &ett_zbee_zcl_ota_file_version |
10874 | 16 | }; |
10875 | | |
10876 | | /* Register ZigBee ZCL Ota protocol with Wireshark. */ |
10877 | 16 | proto_zbee_zcl_ota = proto_register_protocol("ZigBee ZCL OTA", "ZCL OTA", ZBEE_PROTOABBREV_ZCL_OTA); |
10878 | 16 | proto_register_field_array(proto_zbee_zcl_ota, hf, array_length(hf)); |
10879 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
10880 | | |
10881 | | /* Register the ZigBee ZCL OTA dissector. */ |
10882 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_OTA, dissect_zbee_zcl_ota, proto_zbee_zcl_ota); |
10883 | | |
10884 | 16 | } /* proto_register_zbee_zcl_ota */ |
10885 | | |
10886 | | |
10887 | | /*FUNCTION:------------------------------------------------------ |
10888 | | * NAME |
10889 | | * proto_reg_handoff_zbee_zcl_ota |
10890 | | * DESCRIPTION |
10891 | | * Registers the zigbee ZCL OTA cluster dissector with Wireshark. |
10892 | | * PARAMETERS |
10893 | | * none |
10894 | | * RETURNS |
10895 | | * void |
10896 | | *--------------------------------------------------------------- |
10897 | | */ |
10898 | | void proto_reg_handoff_zbee_zcl_ota(void) |
10899 | 16 | { |
10900 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_OTA, |
10901 | 16 | proto_zbee_zcl_ota, |
10902 | 16 | ett_zbee_zcl_ota, |
10903 | 16 | ZBEE_ZCL_CID_OTA_UPGRADE, |
10904 | 16 | ZBEE_MFG_CODE_NONE, |
10905 | 16 | hf_zbee_zcl_ota_attr_id, |
10906 | 16 | hf_zbee_zcl_ota_attr_id, |
10907 | 16 | hf_zbee_zcl_ota_srv_rx_cmd_id, |
10908 | 16 | hf_zbee_zcl_ota_srv_tx_cmd_id, |
10909 | 16 | dissect_zcl_ota_attr_data |
10910 | 16 | ); |
10911 | | |
10912 | 16 | } /*proto_reg_handoff_zbee_zcl_ota*/ |
10913 | | |
10914 | | /* ########################################################################## */ |
10915 | | /* #### (0x001A) POWER PROFILE CLUSTER ###################################### */ |
10916 | | /* ########################################################################## */ |
10917 | | |
10918 | | /*************************/ |
10919 | | /* Defines */ |
10920 | | /*************************/ |
10921 | | |
10922 | 16 | #define ZBEE_ZCL_PWR_PROF_NUM_GENERIC_ETT 4 |
10923 | 96 | #define ZBEE_ZCL_PWR_PROF_NUM_PWR_PROF_ETT 5 |
10924 | 412 | #define ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT 16 |
10925 | | #define ZBEE_ZCL_PWR_PROF_NUM_ETT (ZBEE_ZCL_PWR_PROF_NUM_GENERIC_ETT + \ |
10926 | | ZBEE_ZCL_PWR_PROF_NUM_PWR_PROF_ETT + \ |
10927 | | ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT) |
10928 | | |
10929 | | /* Attributes */ |
10930 | 361 | #define ZBEE_ZCL_ATTR_ID_PWR_PROF_TOT_PROF_NUM 0x0000 /* Total Profile Number */ |
10931 | 11 | #define ZBEE_ZCL_ATTR_ID_PWR_PROF_MULTIPLE_SCHED 0x0001 /* Multiple Schedule */ |
10932 | 12 | #define ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_FORMAT 0x0002 /* Energy Formatting */ |
10933 | 9 | #define ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_REMOTE 0x0003 /* Energy Remote */ |
10934 | 20 | #define ZBEE_ZCL_ATTR_ID_PWR_PROF_SCHED_MODE 0x0004 /* Schedule Mode */ |
10935 | | |
10936 | | /* Server Commands Received */ |
10937 | 7 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_REQ 0x00 /* Power Profile Request */ |
10938 | 0 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_REQ 0x01 /* Power Profile State Request */ |
10939 | 2 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_RSP 0x02 /* Get Power Profile Price Response */ |
10940 | 3 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE_RSP 0x03 /* Get Overall Schedule Price Response */ |
10941 | 2 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_NOTIF 0x04 /* Energy Phases Schedule Notification */ |
10942 | 5 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_RSP 0x05 /* Energy Phases Schedule Response */ |
10943 | 7 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_REQ 0x06 /* Power Profile Schedule Constraints Request */ |
10944 | 7 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_REQ 0x07 /* Energy Phases Schedule State Request */ |
10945 | 2 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT_RSP 0x08 /* Get Power Profile Price Extended Response */ |
10946 | | |
10947 | | /* Server Commands Generated */ |
10948 | 14 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_NOTIF 0x00 /* Power Profile Notification */ |
10949 | 17 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_RSP 0x01 /* Power Profile Response */ |
10950 | 2 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_RSP 0x02 /* Power Profile State Response */ |
10951 | 4 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE 0x03 /* Get Power Profile Price */ |
10952 | 4 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_NOTIF 0x04 /* Power Profile State Notification */ |
10953 | 0 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE 0x05 /* Get Overall Schedule Price */ |
10954 | 5 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_REQ 0x06 /* Energy Phases Schedule Request */ |
10955 | 0 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_RSP 0x07 /* Energy Phases Schedule State Response */ |
10956 | 0 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_NOITIF 0x08 /* Energy Phases Schedule State Notification */ |
10957 | 23 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_NOTIF 0x09 /* Power Profile Schedule Constraints Notification */ |
10958 | 37 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_RSP 0x0A /* Power Profile Schedule Constraints Response */ |
10959 | 8 | #define ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT 0x0B /* Get Power Profile Price Extended */ |
10960 | | |
10961 | | /* Power Profile StateId */ |
10962 | | #define ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_IDLE 0x00 /* Power Profile Idle */ |
10963 | | #define ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_PROGRAMMED 0x01 /* Power Profile Programmed */ |
10964 | | #define ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_RUNNING 0x03 /* Energy Phase Running */ |
10965 | | #define ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_PAUSE 0x04 /* Energy Phase Pause */ |
10966 | | #define ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_WAITING_TO_START 0x05 /* Energy Phase Waiting to Start */ |
10967 | | #define ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_WAITING_PAUSED 0x06 /* Energy Phase Waiting Pause */ |
10968 | | #define ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_ENDED 0x07 /* Power Profile Ended */ |
10969 | | |
10970 | | /* Energy Formatting bitmask field list */ |
10971 | 16 | #define ZBEE_ZCL_OPT_PWRPROF_NUM_R_DIGIT 0x07 /* bits 0..2 */ |
10972 | 16 | #define ZBEE_ZCL_OPT_PWRPROF_NUM_L_DIGIT 0x78 /* bits 3..6 */ |
10973 | 16 | #define ZBEE_ZCL_OPT_PWRPROF_NO_LEADING_ZERO 0x80 /* bit 7 */ |
10974 | | |
10975 | | /* Schedule Mode bitmask field list */ |
10976 | 16 | #define ZBEE_ZCL_OPT_PWRPROF_SCHED_CHEAPEST 0x01 /* bit 0 */ |
10977 | 16 | #define ZBEE_ZCL_OPT_PWRPROF_SCHED_GREENEST 0x02 /* bit 1 */ |
10978 | 16 | #define ZBEE_ZCL_OPT_PWRPROF_SCHED_RESERVED 0xfc /* bits 2..7 */ |
10979 | | |
10980 | | /* Options bitmask field list */ |
10981 | 16 | #define ZBEE_ZCL_OPT_PWRPROF_STIME_PRESENT 0x01 /* bit 0 */ |
10982 | 16 | #define ZBEE_ZCL_OPT_PWRPROF_RESERVED 0xfe /* bits 1..7 */ |
10983 | | |
10984 | | /*************************/ |
10985 | | /* Function Declarations */ |
10986 | | /*************************/ |
10987 | | |
10988 | | void proto_register_zbee_zcl_pwr_prof(void); |
10989 | | void proto_reg_handoff_zbee_zcl_pwr_prof(void); |
10990 | | |
10991 | | /* Command Dissector Helpers */ |
10992 | | static void dissect_zcl_pwr_prof_pwrprofreq (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
10993 | | static void dissect_zcl_pwr_prof_getpwrprofpricersp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
10994 | | static void dissect_zcl_pwr_prof_getoverallschedpricersp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
10995 | | static void dissect_zcl_pwr_prof_enphsschednotif (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
10996 | | |
10997 | | static void dissect_zcl_energy_phase (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
10998 | | static void dissect_zcl_pwr_prof_pwrprofnotif (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
10999 | | static void dissect_zcl_power_profile (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
11000 | | static void dissect_zcl_pwr_prof_pwrprofstatersp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
11001 | | static void dissect_zcl_pwr_prof_pwrprofschedcontrsnotif (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
11002 | | static void dissect_zcl_pwr_prof_pwrprofpriceext (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
11003 | | |
11004 | | /* Private functions prototype */ |
11005 | | static void decode_power_profile_id (char *s, uint8_t id); |
11006 | | static void decode_price_in_cents (char *s, uint32_t value); |
11007 | | static void decode_power_in_watt (char *s, uint16_t value); |
11008 | | static void decode_energy (char *s, uint16_t value); |
11009 | | |
11010 | | /*************************/ |
11011 | | /* Global Variables */ |
11012 | | /*************************/ |
11013 | | /* Initialize the protocol and registered fields */ |
11014 | | static int proto_zbee_zcl_pwr_prof; |
11015 | | |
11016 | | static int hf_zbee_zcl_pwr_prof_attr_id; |
11017 | | static int hf_zbee_zcl_pwr_prof_tot_prof_num; |
11018 | | static int hf_zbee_zcl_pwr_prof_multiple_sched; |
11019 | | static int hf_zbee_zcl_pwr_prof_energy_format; |
11020 | | static int hf_zbee_zcl_pwr_prof_energy_format_rdigit; |
11021 | | static int hf_zbee_zcl_pwr_prof_energy_format_ldigit; |
11022 | | static int hf_zbee_zcl_pwr_prof_energy_format_noleadingzero; |
11023 | | static int hf_zbee_zcl_pwr_prof_energy_remote; |
11024 | | static int hf_zbee_zcl_pwr_prof_sched_mode; |
11025 | | static int hf_zbee_zcl_pwr_prof_sched_mode_cheapest; |
11026 | | static int hf_zbee_zcl_pwr_prof_sched_mode_greenest; |
11027 | | static int hf_zbee_zcl_pwr_prof_sched_mode_reserved; |
11028 | | static int hf_zbee_zcl_pwr_prof_srv_tx_cmd_id; |
11029 | | static int hf_zbee_zcl_pwr_prof_srv_rx_cmd_id; |
11030 | | static int hf_zbee_zcl_pwr_prof_pwr_prof_id; |
11031 | | static int hf_zbee_zcl_pwr_prof_currency; |
11032 | | static int hf_zbee_zcl_pwr_prof_price; |
11033 | | static int hf_zbee_zcl_pwr_prof_price_trailing_digit; |
11034 | | static int hf_zbee_zcl_pwr_prof_num_of_sched_phases; |
11035 | | static int hf_zbee_zcl_pwr_prof_scheduled_time; |
11036 | | static int hf_zbee_zcl_pwr_prof_pwr_prof_count; |
11037 | | static int hf_zbee_zcl_pwr_prof_num_of_trans_phases; |
11038 | | static int hf_zbee_zcl_pwr_prof_energy_phase_id; |
11039 | | static int hf_zbee_zcl_pwr_prof_macro_phase_id; |
11040 | | static int hf_zbee_zcl_pwr_prof_expect_duration; |
11041 | | static int hf_zbee_zcl_pwr_prof_peak_power; |
11042 | | static int hf_zbee_zcl_pwr_prof_energy; |
11043 | | static int hf_zbee_zcl_pwr_prof_max_active_delay; |
11044 | | static int hf_zbee_zcl_pwr_prof_pwr_prof_rem_ctrl; |
11045 | | static int hf_zbee_zcl_pwr_prof_pwr_prof_state; |
11046 | | static int hf_zbee_zcl_pwr_prof_start_after; |
11047 | | static int hf_zbee_zcl_pwr_prof_stop_before; |
11048 | | static int hf_zbee_zcl_pwr_prof_options; |
11049 | | static int hf_zbee_zcl_pwr_prof_options_01; |
11050 | | static int hf_zbee_zcl_pwr_prof_options_res; |
11051 | | static int hf_zbee_zcl_pwr_prof_pwr_prof_stime; |
11052 | | |
11053 | | /* Initialize the subtree pointers */ |
11054 | | static int ett_zbee_zcl_pwr_prof; |
11055 | | static int ett_zbee_zcl_pwr_prof_options; |
11056 | | static int ett_zbee_zcl_pwr_prof_en_format; |
11057 | | static int ett_zbee_zcl_pwr_prof_sched_mode; |
11058 | | static int ett_zbee_zcl_pwr_prof_pwrprofiles[ZBEE_ZCL_PWR_PROF_NUM_PWR_PROF_ETT]; |
11059 | | static int ett_zbee_zcl_pwr_prof_enphases[ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT]; |
11060 | | |
11061 | | /* Attributes */ |
11062 | | static const value_string zbee_zcl_pwr_prof_attr_names[] = { |
11063 | | { ZBEE_ZCL_ATTR_ID_PWR_PROF_TOT_PROF_NUM, "Total Profile Number" }, |
11064 | | { ZBEE_ZCL_ATTR_ID_PWR_PROF_MULTIPLE_SCHED, "Multiple Scheduling" }, |
11065 | | { ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_FORMAT, "Energy Formatting" }, |
11066 | | { ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_REMOTE, "Energy Remote" }, |
11067 | | { ZBEE_ZCL_ATTR_ID_PWR_PROF_SCHED_MODE, "Schedule Mode" }, |
11068 | | { 0, NULL } |
11069 | | }; |
11070 | | |
11071 | | /* Server Commands Received */ |
11072 | | static const value_string zbee_zcl_pwr_prof_srv_rx_cmd_names[] = { |
11073 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_REQ, "Power Profile Request" }, |
11074 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_REQ, "Power Profile State Request" }, |
11075 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_RSP, "Get Power Profile Price Response" }, |
11076 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE_RSP, "Get Overall Schedule Price Response" }, |
11077 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_NOTIF, "Energy Phases Schedule Notification" }, |
11078 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_RSP, "Energy Phases Schedule Response" }, |
11079 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_REQ, "Power Profile Schedule Constraints Request" }, |
11080 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_REQ, "Energy Phases Schedule State Request" }, |
11081 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT_RSP, "Get Power Profile Price Extended Response" }, |
11082 | | { 0, NULL } |
11083 | | }; |
11084 | | |
11085 | | /* Server Commands Generated */ |
11086 | | static const value_string zbee_zcl_pwr_prof_srv_tx_cmd_names[] = { |
11087 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_NOTIF, "Power Profile Notification" }, |
11088 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_RSP, "Power Profile Response" }, |
11089 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_RSP, "Power Profile State Response" }, |
11090 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE, "Get Power Profile Price" }, |
11091 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_NOTIF, "Power Profile State Notification" }, |
11092 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE, "Get Overall Schedule Price" }, |
11093 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_REQ, "Energy Phases Schedule Request" }, |
11094 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_RSP, "Energy Phases Schedule State Response" }, |
11095 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_NOITIF, "Energy Phases Schedule State Notification" }, |
11096 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_NOTIF, "Power Profile Schedule Constraints Notification" }, |
11097 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_RSP, "Power Profile Schedule Constraints Response" }, |
11098 | | { ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT, "Get Power Profile Price Extended" }, |
11099 | | { 0, NULL } |
11100 | | }; |
11101 | | |
11102 | | /* Currencies (values defined by ISO 4217) */ |
11103 | | static const value_string zbee_zcl_currecy_names[] = { |
11104 | | { 0x03D2, "EUR" }, |
11105 | | { 0x033A, "GBP" }, |
11106 | | { 0x0348, "USD" }, |
11107 | | { 0, NULL } |
11108 | | }; |
11109 | | |
11110 | | /* Power Profile State */ |
11111 | | static const value_string zbee_zcl_pwr_prof_state_names[] = { |
11112 | | { ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_IDLE, "Power Profile Idle" }, |
11113 | | { ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_PROGRAMMED, "Power Profile Programmed" }, |
11114 | | { ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_RUNNING, "Energy Phase Running" }, |
11115 | | { ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_PAUSE, "Energy Phase Pause" }, |
11116 | | { ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_WAITING_TO_START, "Energy Phase Waiting to Start" }, |
11117 | | { ZBEE_ZCL_PWR_PROF_STATE_ID_EN_PH_WAITING_PAUSED, "Energy Phase Waiting Paused" }, |
11118 | | { ZBEE_ZCL_PWR_PROF_STATE_ID_PWR_PROF_ENDED, "Power Profile Ended" }, |
11119 | | { 0, NULL } |
11120 | | }; |
11121 | | |
11122 | | /*************************/ |
11123 | | /* Function Bodies */ |
11124 | | /*************************/ |
11125 | | |
11126 | | /*FUNCTION:------------------------------------------------------ |
11127 | | * NAME |
11128 | | * dissect_zbee_zcl_pwr_prof |
11129 | | * DESCRIPTION |
11130 | | * ZigBee ZCL Power Profile cluster dissector for wireshark. |
11131 | | * PARAMETERS |
11132 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
11133 | | * packet_info *pinfo - pointer to packet information fields |
11134 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
11135 | | * void *data - pointer to ZCL packet structure. |
11136 | | * RETURNS |
11137 | | * int - length of parsed data. |
11138 | | *--------------------------------------------------------------- |
11139 | | */ |
11140 | | static int |
11141 | | dissect_zbee_zcl_pwr_prof (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
11142 | 190 | { |
11143 | 190 | proto_tree *payload_tree; |
11144 | 190 | zbee_zcl_packet *zcl; |
11145 | 190 | unsigned offset = 0; |
11146 | 190 | uint8_t cmd_id; |
11147 | 190 | int rem_len; |
11148 | | |
11149 | | /* Reject the packet if data is NULL */ |
11150 | 190 | if (data == NULL) |
11151 | 0 | return 0; |
11152 | 190 | zcl = (zbee_zcl_packet *)data; |
11153 | 190 | cmd_id = zcl->cmd_id; |
11154 | | |
11155 | | /* Create a subtree for the ZCL Command frame, and add the command ID to it. */ |
11156 | 190 | if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { |
11157 | | /* Append the command name to the info column. */ |
11158 | 71 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
11159 | 71 | val_to_str_const(cmd_id, zbee_zcl_pwr_prof_srv_rx_cmd_names, "Unknown Command"), |
11160 | 71 | zcl->tran_seqno); |
11161 | | |
11162 | | /* Add the command ID. */ |
11163 | 71 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
11164 | | |
11165 | | /* Check is this command has a payload, than add the payload tree */ |
11166 | 71 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
11167 | 71 | if (rem_len > 0) { |
11168 | 63 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_pwr_prof, NULL, "Payload"); |
11169 | | |
11170 | | /* Call the appropriate command dissector */ |
11171 | 63 | switch (cmd_id) { |
11172 | 7 | case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_REQ: |
11173 | 7 | case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_REQ: |
11174 | 7 | case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_REQ: |
11175 | 7 | dissect_zcl_pwr_prof_pwrprofreq(tvb, payload_tree, &offset); |
11176 | 7 | break; |
11177 | | |
11178 | 0 | case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_REQ: |
11179 | | /* No payload */ |
11180 | 0 | break; |
11181 | | |
11182 | 2 | case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_RSP: |
11183 | 2 | case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT_RSP: |
11184 | 2 | dissect_zcl_pwr_prof_getpwrprofpricersp(tvb, payload_tree, &offset); |
11185 | 2 | break; |
11186 | | |
11187 | 3 | case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE_RSP: |
11188 | 3 | dissect_zcl_pwr_prof_getoverallschedpricersp(tvb, payload_tree, &offset); |
11189 | 3 | break; |
11190 | | |
11191 | 2 | case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_NOTIF: |
11192 | 5 | case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_RSP: |
11193 | 5 | dissect_zcl_pwr_prof_enphsschednotif(tvb, payload_tree, &offset); |
11194 | 5 | break; |
11195 | | |
11196 | 46 | default: |
11197 | 46 | break; |
11198 | 63 | } |
11199 | 63 | } |
11200 | 71 | } |
11201 | 119 | else { /* ZBEE_ZCL_FCF_TO_CLIENT */ |
11202 | | /* Append the command name to the info column. */ |
11203 | 119 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
11204 | 119 | val_to_str_const(cmd_id, zbee_zcl_pwr_prof_srv_tx_cmd_names, "Unknown Command"), |
11205 | 119 | zcl->tran_seqno); |
11206 | | |
11207 | | /* Add the command ID. */ |
11208 | 119 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
11209 | | |
11210 | | /* Check is this command has a payload, than add the payload tree */ |
11211 | 119 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
11212 | 119 | if (rem_len > 0) { |
11213 | 113 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_pwr_prof, NULL, "Payload"); |
11214 | | |
11215 | | /* Call the appropriate command dissector */ |
11216 | 113 | switch (cmd_id) { |
11217 | 14 | case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_NOTIF: |
11218 | 17 | case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_RSP: |
11219 | 17 | dissect_zcl_pwr_prof_pwrprofnotif(tvb, payload_tree, &offset); |
11220 | 17 | break; |
11221 | | |
11222 | 2 | case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_RSP: |
11223 | 4 | case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_NOTIF: |
11224 | 4 | dissect_zcl_pwr_prof_pwrprofstatersp(tvb, payload_tree, &offset); |
11225 | 4 | break; |
11226 | | |
11227 | 0 | case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE: |
11228 | | /* no payload */ |
11229 | 0 | break; |
11230 | | |
11231 | 0 | case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_RSP: |
11232 | 0 | case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_NOITIF: |
11233 | 0 | dissect_zcl_pwr_prof_enphsschednotif(tvb, payload_tree, &offset); |
11234 | 0 | break; |
11235 | | |
11236 | 4 | case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE: |
11237 | 5 | case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_REQ: |
11238 | 5 | dissect_zcl_pwr_prof_pwrprofreq(tvb, payload_tree, &offset); |
11239 | 5 | break; |
11240 | | |
11241 | 23 | case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_NOTIF: |
11242 | 37 | case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_RSP: |
11243 | 37 | dissect_zcl_pwr_prof_pwrprofschedcontrsnotif(tvb, payload_tree, &offset); |
11244 | 37 | break; |
11245 | | |
11246 | 8 | case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT: |
11247 | 8 | dissect_zcl_pwr_prof_pwrprofpriceext(tvb, payload_tree, &offset); |
11248 | 8 | break; |
11249 | | |
11250 | 42 | default: |
11251 | 42 | break; |
11252 | 113 | } |
11253 | 113 | } |
11254 | 119 | } |
11255 | | |
11256 | 173 | return tvb_captured_length(tvb); |
11257 | 190 | } /*dissect_zbee_zcl_pwr_prof*/ |
11258 | | |
11259 | | /*FUNCTION:------------------------------------------------------ |
11260 | | * NAME |
11261 | | * dissect_zcl_pwr_prof_pwrprofreq |
11262 | | * DESCRIPTION |
11263 | | * this function is called in order to decode "PowerProfileRequest", |
11264 | | * "PowerProfileScheduleConstraintsRequest", "EnergyPhasesScheduleStateRequest", |
11265 | | * "GetPowerProfilePrice" and "EnergyPhasesScheduleRequest" payload. |
11266 | | * PARAMETERS |
11267 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
11268 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
11269 | | * unsigned *offset - pointer to buffer offset |
11270 | | * RETURNS |
11271 | | * none |
11272 | | *--------------------------------------------------------------- |
11273 | | */ |
11274 | | static void |
11275 | | dissect_zcl_pwr_prof_pwrprofreq(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
11276 | 12 | { |
11277 | | /* Retrieve "Power Profile Id" field */ |
11278 | 12 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA); |
11279 | 12 | *offset += 1; |
11280 | | |
11281 | 12 | } /*dissect_zcl_pwr_prof_pwrprofreq*/ |
11282 | | |
11283 | | |
11284 | | /*FUNCTION:------------------------------------------------------ |
11285 | | * NAME |
11286 | | * dissect_zcl_pwr_prof_getpwrprofpricersp |
11287 | | * DESCRIPTION |
11288 | | * this function is called in order to decode "GetPowerProfilePriceResponse" |
11289 | | * and "PowerProfilePriceExtendedResponse" payload. |
11290 | | * PARAMETERS |
11291 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
11292 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
11293 | | * unsigned *offset - pointer to buffer offset |
11294 | | * RETURNS |
11295 | | * none |
11296 | | *--------------------------------------------------------------- |
11297 | | */ |
11298 | | static void |
11299 | | dissect_zcl_pwr_prof_getpwrprofpricersp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
11300 | 2 | { |
11301 | | /* Retrieve "Power Profile Id" field */ |
11302 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA); |
11303 | 2 | *offset += 1; |
11304 | | |
11305 | | /* Retrieve "Currency" field */ |
11306 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_currency, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
11307 | 2 | *offset += 2; |
11308 | | |
11309 | | /* Retrieve "Price" field */ |
11310 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_price, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
11311 | 2 | *offset += 4; |
11312 | | |
11313 | | /* Retrieve "Price Trailing Digit" field */ |
11314 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_price_trailing_digit, tvb, *offset, 1, ENC_NA); |
11315 | 2 | *offset += 1; |
11316 | | |
11317 | 2 | } /*dissect_zcl_pwr_prof_getpwrprofpricersp*/ |
11318 | | |
11319 | | |
11320 | | /*FUNCTION:------------------------------------------------------ |
11321 | | * NAME |
11322 | | * dissect_zcl_pwr_prof_getoverallschedpricersp |
11323 | | * DESCRIPTION |
11324 | | * this function is called in order to decode "GetOverallSchedulePriceResponse" |
11325 | | * payload. |
11326 | | * PARAMETERS |
11327 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
11328 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
11329 | | * unsigned *offset - pointer to buffer offset |
11330 | | * RETURNS |
11331 | | * none |
11332 | | *--------------------------------------------------------------- |
11333 | | */ |
11334 | | static void |
11335 | | dissect_zcl_pwr_prof_getoverallschedpricersp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
11336 | 3 | { |
11337 | | /* Retrieve "Currency" field */ |
11338 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_currency, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
11339 | 3 | *offset += 2; |
11340 | | |
11341 | | /* Retrieve "Price" field */ |
11342 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_price, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
11343 | 3 | *offset += 4; |
11344 | | |
11345 | | /* Retrieve "Price Trailing Digit" field */ |
11346 | 3 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_price_trailing_digit, tvb, *offset, 1, ENC_NA); |
11347 | 3 | *offset += 1; |
11348 | | |
11349 | 3 | } /*dissect_zcl_pwr_prof_getoverallschedpricersp*/ |
11350 | | |
11351 | | |
11352 | | /*FUNCTION:------------------------------------------------------ |
11353 | | * NAME |
11354 | | * dissect_zcl_sched_energy_phase |
11355 | | * DESCRIPTION |
11356 | | * this function is called in order to decode "ScheduledEnergyPhases" |
11357 | | * element. |
11358 | | * PARAMETERS |
11359 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
11360 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
11361 | | * unsigned *offset - pointer to buffer offset |
11362 | | * RETURNS |
11363 | | * none |
11364 | | *--------------------------------------------------------------- |
11365 | | */ |
11366 | | static void |
11367 | | dissect_zcl_sched_energy_phase(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
11368 | 23 | { |
11369 | | /* Energy Phase ID */ |
11370 | 23 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_energy_phase_id, tvb, *offset, 1, ENC_NA); |
11371 | 23 | *offset += 1; |
11372 | | |
11373 | | /* Scheduled Time */ |
11374 | 23 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_scheduled_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
11375 | 23 | *offset += 2; |
11376 | | |
11377 | 23 | } /*dissect_zcl_sched_energy_phase*/ |
11378 | | |
11379 | | |
11380 | | /*FUNCTION:------------------------------------------------------ |
11381 | | * NAME |
11382 | | * dissect_zcl_pwr_prof_enphsschednotif |
11383 | | * DESCRIPTION |
11384 | | * this function is called in order to decode "EnergyPhasesScheduleNotification" |
11385 | | * and "EnergyPhasesScheduleResponse" payload. |
11386 | | * PARAMETERS |
11387 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
11388 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
11389 | | * unsigned *offset - pointer to buffer offset |
11390 | | * RETURNS |
11391 | | * none |
11392 | | *--------------------------------------------------------------- |
11393 | | */ |
11394 | | static void |
11395 | | dissect_zcl_pwr_prof_enphsschednotif(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
11396 | 5 | { |
11397 | 5 | proto_tree *sub_tree = NULL; |
11398 | | |
11399 | 5 | unsigned i; |
11400 | 5 | uint8_t num_of_sched_phases; |
11401 | | |
11402 | | /* Retrieve "Power Profile Id" field */ |
11403 | 5 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA); |
11404 | 5 | *offset += 1; |
11405 | | |
11406 | | /* Retrieve "Number of Scheduled Phases" field */ |
11407 | 5 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_pwr_prof_num_of_sched_phases, tvb, *offset, 1, ENC_NA, &num_of_sched_phases); |
11408 | 5 | *offset += 1; |
11409 | | |
11410 | | /* Scheduled Energy Phases decoding */ |
11411 | 29 | for (i=0 ; (i<num_of_sched_phases && i < ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT); i++) { |
11412 | | /* Create subtree */ |
11413 | 24 | sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 1, |
11414 | 24 | ett_zbee_zcl_pwr_prof_enphases[i], NULL, "Energy Phase #%u", i); |
11415 | | |
11416 | 24 | dissect_zcl_sched_energy_phase(tvb, sub_tree, offset); |
11417 | 24 | } |
11418 | 5 | } /*dissect_zcl_pwr_prof_enphsschednotif*/ |
11419 | | |
11420 | | |
11421 | | /*FUNCTION:------------------------------------------------------ |
11422 | | * NAME |
11423 | | * dissect_zcl_energy_phase |
11424 | | * DESCRIPTION |
11425 | | * this function is called in order to decode "EnergyPhases" |
11426 | | * element. |
11427 | | * PARAMETERS |
11428 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
11429 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
11430 | | * unsigned *offset - pointer to buffer offset |
11431 | | * RETURNS |
11432 | | * none |
11433 | | *--------------------------------------------------------------- |
11434 | | */ |
11435 | | static void |
11436 | | dissect_zcl_energy_phase(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
11437 | 111 | { |
11438 | 111 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_energy_phase_id, tvb, *offset, 1, ENC_NA); |
11439 | 111 | *offset += 1; |
11440 | | |
11441 | 111 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_macro_phase_id, tvb, *offset, 1, ENC_NA); |
11442 | 111 | *offset += 1; |
11443 | | |
11444 | 111 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_expect_duration, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
11445 | 111 | *offset += 2; |
11446 | | |
11447 | 111 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_peak_power, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
11448 | 111 | *offset += 2; |
11449 | | |
11450 | 111 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_energy, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
11451 | 111 | *offset += 2; |
11452 | | |
11453 | 111 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_max_active_delay, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
11454 | 111 | *offset += 2; |
11455 | | |
11456 | 111 | } /*dissect_zcl_energy_phase*/ |
11457 | | |
11458 | | |
11459 | | /*FUNCTION:------------------------------------------------------ |
11460 | | * NAME |
11461 | | * dissect_zcl_pwr_prof_pwrprofnotif |
11462 | | * DESCRIPTION |
11463 | | * this function is called in order to decode "PowerProfileNotification" |
11464 | | * and "PowerProfileResponse" payload. |
11465 | | * PARAMETERS |
11466 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
11467 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
11468 | | * unsigned *offset - pointer to buffer offset |
11469 | | * RETURNS |
11470 | | * none |
11471 | | *--------------------------------------------------------------- |
11472 | | */ |
11473 | | static void |
11474 | | dissect_zcl_pwr_prof_pwrprofnotif(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
11475 | 17 | { |
11476 | 17 | proto_tree *sub_tree = NULL; |
11477 | | |
11478 | 17 | unsigned i; |
11479 | 17 | uint8_t total_profile_number; |
11480 | 17 | uint8_t num_of_transferred_phases; |
11481 | | |
11482 | | /* Retrieve "Total Profile Number" field */ |
11483 | 17 | total_profile_number = tvb_get_uint8(tvb, *offset); |
11484 | 17 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_tot_prof_num, tvb, *offset, 1, ENC_NA); |
11485 | 17 | *offset += 1; |
11486 | | |
11487 | 17 | if ( total_profile_number != 0 ) { |
11488 | | /* Retrieve "Power Profile Id" field */ |
11489 | 15 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA); |
11490 | 15 | *offset += 1; |
11491 | | |
11492 | | /* Retrieve "Number of Transferred Phases" field */ |
11493 | 15 | num_of_transferred_phases = tvb_get_uint8(tvb, *offset); |
11494 | 15 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_num_of_trans_phases, tvb, *offset, 1, ENC_NA); |
11495 | 15 | *offset += 1; |
11496 | | |
11497 | | /* Energy Phases decoding */ |
11498 | 126 | for ( i=0 ; (i<num_of_transferred_phases && i < ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT); i++) { |
11499 | | /* Create subtree */ |
11500 | 111 | sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 1, |
11501 | 111 | ett_zbee_zcl_pwr_prof_enphases[i], NULL, "Energy Phase #%u", i); |
11502 | | |
11503 | 111 | dissect_zcl_energy_phase(tvb, sub_tree, offset); |
11504 | 111 | } |
11505 | 15 | } |
11506 | 17 | } |
11507 | | |
11508 | | |
11509 | | /*FUNCTION:------------------------------------------------------ |
11510 | | * NAME |
11511 | | * dissect_zcl_power_profile |
11512 | | * DESCRIPTION |
11513 | | * this function is called in order to decode "PowerProfile" |
11514 | | * element. |
11515 | | * PARAMETERS |
11516 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
11517 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
11518 | | * unsigned *offset - pointer to buffer offset |
11519 | | * RETURNS |
11520 | | * none |
11521 | | *--------------------------------------------------------------- |
11522 | | */ |
11523 | | static void |
11524 | | dissect_zcl_power_profile(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
11525 | 9 | { |
11526 | | /* Power Profile Id */ |
11527 | 9 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA); |
11528 | 9 | *offset += 1; |
11529 | | |
11530 | | /* Energy Phase Id */ |
11531 | 9 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_energy_phase_id, tvb, *offset, 1, ENC_NA); |
11532 | 9 | *offset += 1; |
11533 | | |
11534 | | /* Power Profile Remote Control */ |
11535 | 9 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_rem_ctrl, tvb, *offset, 1, ENC_NA); |
11536 | 9 | *offset += 1; |
11537 | | |
11538 | | /* Power Profile State */ |
11539 | 9 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_state, tvb, *offset, 1, ENC_NA); |
11540 | 9 | *offset += 1; |
11541 | | |
11542 | 9 | } /*dissect_zcl_power_profile*/ |
11543 | | |
11544 | | |
11545 | | /*FUNCTION:------------------------------------------------------ |
11546 | | * NAME |
11547 | | * dissect_zcl_pwr_prof_pwrprofstatersp |
11548 | | * DESCRIPTION |
11549 | | * this function is called in order to decode "PowerProfileStateResponse" |
11550 | | * and "PowerProfileStateNotification" payload. |
11551 | | * PARAMETERS |
11552 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
11553 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
11554 | | * unsigned *offset - pointer to buffer offset |
11555 | | * RETURNS |
11556 | | * none |
11557 | | *--------------------------------------------------------------- |
11558 | | */ |
11559 | | static void |
11560 | | dissect_zcl_pwr_prof_pwrprofstatersp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
11561 | 4 | { |
11562 | 4 | proto_tree *sub_tree = NULL; |
11563 | | |
11564 | 4 | unsigned i; |
11565 | 4 | uint8_t power_profile_count; |
11566 | | |
11567 | | /* Retrieve "Total Profile Number" field */ |
11568 | 4 | power_profile_count = MIN(tvb_get_uint8(tvb, *offset), ZBEE_ZCL_PWR_PROF_NUM_PWR_PROF_ETT); |
11569 | 4 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_count, tvb, *offset, 1, ENC_NA); |
11570 | 4 | *offset += 1; |
11571 | | |
11572 | | /* Energy Phases decoding */ |
11573 | 13 | for (i=0 ; i<power_profile_count ; i++) { |
11574 | | /* Create subtree */ |
11575 | 9 | sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 1, |
11576 | 9 | ett_zbee_zcl_pwr_prof_pwrprofiles[i], NULL, "Power Profile #%u", i); |
11577 | | |
11578 | 9 | dissect_zcl_power_profile(tvb, sub_tree, offset); |
11579 | 9 | } |
11580 | 4 | } /*dissect_zcl_pwr_prof_pwrprofstatersp*/ |
11581 | | |
11582 | | |
11583 | | /*FUNCTION:------------------------------------------------------ |
11584 | | * NAME |
11585 | | * dissect_zcl_pwr_prof_pwrprofschedcontrsnotif |
11586 | | * DESCRIPTION |
11587 | | * this function is called in order to decode "PowerProfileScheduleConstraintsNotification" |
11588 | | * and "PowerProfileScheduleConstraintsResponse" payload. |
11589 | | * PARAMETERS |
11590 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
11591 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
11592 | | * unsigned *offset - pointer to buffer offset |
11593 | | * RETURNS |
11594 | | * none |
11595 | | *--------------------------------------------------------------- |
11596 | | */ |
11597 | | static void |
11598 | | dissect_zcl_pwr_prof_pwrprofschedcontrsnotif(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
11599 | 37 | { |
11600 | | /* Retrieve "Power Profile Id" field */ |
11601 | 37 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA); |
11602 | 37 | *offset += 1; |
11603 | | |
11604 | | /* Retrieve "Start After" field */ |
11605 | 37 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_start_after, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
11606 | 37 | *offset += 2; |
11607 | | |
11608 | | /* Retrieve "Stop Before" field */ |
11609 | 37 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_stop_before, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
11610 | 37 | *offset += 2; |
11611 | | |
11612 | 37 | } /*dissect_zcl_pwr_prof_pwrprofschedcontrsnotif*/ |
11613 | | |
11614 | | |
11615 | | /*FUNCTION:------------------------------------------------------ |
11616 | | * NAME |
11617 | | * dissect_zcl_pwr_prof_pwrprofpriceext |
11618 | | * DESCRIPTION |
11619 | | * this function is called in order to decode "GetPowerProfilePriceExtended" |
11620 | | * and "PowerProfileScheduleConstraintsResponse" payload. |
11621 | | * PARAMETERS |
11622 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
11623 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
11624 | | * unsigned *offset - pointer to buffer offset |
11625 | | * RETURNS |
11626 | | * none |
11627 | | *--------------------------------------------------------------- |
11628 | | */ |
11629 | | static void |
11630 | | dissect_zcl_pwr_prof_pwrprofpriceext(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
11631 | 8 | { |
11632 | 8 | static int * const options[] = { |
11633 | 8 | &hf_zbee_zcl_pwr_prof_options_01, |
11634 | 8 | &hf_zbee_zcl_pwr_prof_options_res, |
11635 | 8 | NULL |
11636 | 8 | }; |
11637 | | |
11638 | | /* Retrieve "Options" field */ |
11639 | 8 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_pwr_prof_options, ett_zbee_zcl_pwr_prof_options, options, ENC_NA); |
11640 | 8 | *offset += 1; |
11641 | | |
11642 | | /* Retrieve "Power Profile Id" field */ |
11643 | 8 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_id, tvb, *offset, 1, ENC_NA); |
11644 | 8 | *offset += 1; |
11645 | | |
11646 | | /* Retrieve "Power Profile Start Time" field */ |
11647 | 8 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_pwr_prof_stime, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
11648 | 8 | *offset += 2; |
11649 | | |
11650 | 8 | } /*dissect_zcl_pwr_prof_pwrprofpriceext*/ |
11651 | | |
11652 | | |
11653 | | /*FUNCTION:------------------------------------------------------ |
11654 | | * NAME |
11655 | | * dissect_zcl_pwr_prof_attr_data |
11656 | | * DESCRIPTION |
11657 | | * this function is called by ZCL foundation dissector in order to decode |
11658 | | * specific cluster attributes data. |
11659 | | * PARAMETERS |
11660 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
11661 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
11662 | | * unsigned *offset - pointer to buffer offset |
11663 | | * uint16_t attr_id - attribute identifier |
11664 | | * unsigned data_type - attribute data type |
11665 | | * bool client_attr- ZCL client |
11666 | | * RETURNS |
11667 | | * none |
11668 | | *--------------------------------------------------------------- |
11669 | | */ |
11670 | | static void |
11671 | | dissect_zcl_pwr_prof_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
11672 | 1.63k | { |
11673 | 1.63k | static int * const format_fields[] = { |
11674 | 1.63k | &hf_zbee_zcl_pwr_prof_energy_format_rdigit, |
11675 | 1.63k | &hf_zbee_zcl_pwr_prof_energy_format_ldigit, |
11676 | 1.63k | &hf_zbee_zcl_pwr_prof_energy_format_noleadingzero, |
11677 | 1.63k | NULL |
11678 | 1.63k | }; |
11679 | 1.63k | static int * const modes[] = { |
11680 | 1.63k | &hf_zbee_zcl_pwr_prof_sched_mode_cheapest, |
11681 | 1.63k | &hf_zbee_zcl_pwr_prof_sched_mode_greenest, |
11682 | 1.63k | &hf_zbee_zcl_pwr_prof_sched_mode_reserved, |
11683 | 1.63k | NULL |
11684 | 1.63k | }; |
11685 | | |
11686 | | /* Dissect attribute data type and data */ |
11687 | 1.63k | switch ( attr_id ) |
11688 | 1.63k | { |
11689 | 361 | case ZBEE_ZCL_ATTR_ID_PWR_PROF_TOT_PROF_NUM: |
11690 | 361 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_tot_prof_num, tvb, *offset, 1, ENC_NA); |
11691 | 361 | *offset += 1; |
11692 | 361 | break; |
11693 | | |
11694 | 11 | case ZBEE_ZCL_ATTR_ID_PWR_PROF_MULTIPLE_SCHED: |
11695 | 11 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_multiple_sched, tvb, *offset, 1, ENC_NA); |
11696 | 11 | *offset += 1; |
11697 | 11 | break; |
11698 | | |
11699 | 12 | case ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_FORMAT: |
11700 | 12 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_pwr_prof_energy_format, ett_zbee_zcl_pwr_prof_en_format, format_fields, ENC_NA); |
11701 | 12 | *offset += 1; |
11702 | 12 | break; |
11703 | | |
11704 | 9 | case ZBEE_ZCL_ATTR_ID_PWR_PROF_ENERGY_REMOTE: |
11705 | 9 | proto_tree_add_item(tree, hf_zbee_zcl_pwr_prof_energy_remote, tvb, *offset, 1, ENC_NA); |
11706 | 9 | *offset += 1; |
11707 | 9 | break; |
11708 | | |
11709 | 20 | case ZBEE_ZCL_ATTR_ID_PWR_PROF_SCHED_MODE: |
11710 | 20 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_pwr_prof_sched_mode, ett_zbee_zcl_pwr_prof_sched_mode, modes, ENC_NA); |
11711 | 20 | *offset += 1; |
11712 | 20 | break; |
11713 | | |
11714 | 1.22k | default: |
11715 | 1.22k | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
11716 | 1.22k | break; |
11717 | 1.63k | } |
11718 | 1.63k | } /*dissect_zcl_pwr_prof_attr_data*/ |
11719 | | |
11720 | | |
11721 | | /*FUNCTION:------------------------------------------------------ |
11722 | | * NAME |
11723 | | * decode_power_profile_id |
11724 | | * DESCRIPTION |
11725 | | * this function decodes the power profile custom type |
11726 | | * PARAMETERS |
11727 | | * unsigned *s - string to display |
11728 | | * uint16_t value - value to decode |
11729 | | * RETURNS |
11730 | | * none |
11731 | | *--------------------------------------------------------------- |
11732 | | */ |
11733 | | static void |
11734 | | decode_power_profile_id(char *s, uint8_t id) |
11735 | 0 | { |
11736 | 0 | if (id == 0) { |
11737 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "%u (All)", id); |
11738 | 0 | } |
11739 | 0 | else { |
11740 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "%u", id); |
11741 | 0 | } |
11742 | 0 | } /*decode_power_profile_id*/ |
11743 | | |
11744 | | |
11745 | | /*FUNCTION:------------------------------------------------------ |
11746 | | * NAME |
11747 | | * decode_price_in_cents |
11748 | | * DESCRIPTION |
11749 | | * this function decodes price type variable |
11750 | | * PARAMETERS |
11751 | | * unsigned *s - string to display |
11752 | | * uint16_t value - value to decode |
11753 | | * RETURNS |
11754 | | * none |
11755 | | *--------------------------------------------------------------- |
11756 | | */ |
11757 | | static void |
11758 | | decode_price_in_cents(char *s, uint32_t value) |
11759 | 0 | { |
11760 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "%u cents", value); |
11761 | 0 | } /* decode_price_in_cents */ |
11762 | | |
11763 | | |
11764 | | /*FUNCTION:------------------------------------------------------ |
11765 | | * NAME |
11766 | | * decode_power_in_watt |
11767 | | * DESCRIPTION |
11768 | | * this function decodes watt power type variable |
11769 | | * PARAMETERS |
11770 | | * unsigned *s - string to display |
11771 | | * uint16_t value - value to decode |
11772 | | * RETURNS |
11773 | | * none |
11774 | | *--------------------------------------------------------------- |
11775 | | */ |
11776 | | static void |
11777 | | decode_power_in_watt(char *s, uint16_t value) |
11778 | 0 | { |
11779 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "%d Watt", value); |
11780 | 0 | } /* decode_power_in_watt */ |
11781 | | |
11782 | | /*FUNCTION:------------------------------------------------------ |
11783 | | * NAME |
11784 | | * decode_energy |
11785 | | * DESCRIPTION |
11786 | | * this function decodes energy type variable |
11787 | | * PARAMETERS |
11788 | | * unsigned *s - string to display |
11789 | | * uint16_t value - value to decode |
11790 | | * RETURNS |
11791 | | * none |
11792 | | *--------------------------------------------------------------- |
11793 | | */ |
11794 | | static void |
11795 | | decode_energy(char *s, uint16_t value) |
11796 | 0 | { |
11797 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "%d Watt per hours", value); |
11798 | 0 | } /* decode_energy */ |
11799 | | |
11800 | | /*FUNCTION:------------------------------------------------------ |
11801 | | * NAME |
11802 | | * func_decode_delayinminute |
11803 | | * DESCRIPTION |
11804 | | * this function decodes minute delay type variable |
11805 | | * PARAMETERS |
11806 | | * unsigned *s - string to display |
11807 | | * uint16_t value - value to decode |
11808 | | * RETURNS |
11809 | | * none |
11810 | | *--------------------------------------------------------------- |
11811 | | */ |
11812 | | static void |
11813 | | func_decode_delayinminute(char *s, uint16_t value) |
11814 | 0 | { |
11815 | 0 | if (value == 0) { |
11816 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "%d minutes (Not permitted)", value); |
11817 | 0 | } |
11818 | 0 | else { |
11819 | 0 | snprintf(s, ITEM_LABEL_LENGTH, "%d minutes", value); |
11820 | 0 | } |
11821 | |
|
11822 | 0 | } /* func_decode_delayinminute*/ |
11823 | | |
11824 | | |
11825 | | /*FUNCTION:------------------------------------------------------ |
11826 | | * NAME |
11827 | | * proto_register_zbee_zcl_pwr_prof |
11828 | | * DESCRIPTION |
11829 | | * ZigBee ZCL PowerProfile cluster protocol registration routine. |
11830 | | * PARAMETERS |
11831 | | * none |
11832 | | * RETURNS |
11833 | | * void |
11834 | | *--------------------------------------------------------------- |
11835 | | */ |
11836 | | void |
11837 | | proto_register_zbee_zcl_pwr_prof(void) |
11838 | 16 | { |
11839 | 16 | unsigned i, j; |
11840 | | |
11841 | 16 | static hf_register_info hf[] = { |
11842 | | |
11843 | 16 | { &hf_zbee_zcl_pwr_prof_tot_prof_num, |
11844 | 16 | { "Total Profile Number", "zbee_zcl_general.pwrprof.attr.totprofnum", FT_UINT8, BASE_DEC, NULL, 0x0, |
11845 | 16 | NULL, HFILL } }, |
11846 | | |
11847 | 16 | { &hf_zbee_zcl_pwr_prof_multiple_sched, |
11848 | 16 | { "Multiple Scheduling", "zbee_zcl_general.pwrprof.attr.multiplesched", FT_BOOLEAN, BASE_NONE, |
11849 | 16 | TFS(&tfs_supported_not_supported), 0x0, NULL, HFILL } }, |
11850 | | |
11851 | | /* Begin EnergyFormatting fields */ |
11852 | 16 | { &hf_zbee_zcl_pwr_prof_energy_format, |
11853 | 16 | { "Data", "zbee_zcl_general.pwrprof.attr.energyformat", |
11854 | 16 | FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, |
11855 | | |
11856 | 16 | { &hf_zbee_zcl_pwr_prof_energy_format_rdigit, |
11857 | 16 | { "Number of Digits to the right of the Decimal Point", "zbee_zcl_general.pwrprof.attr.energyformat.rdigit", |
11858 | 16 | FT_UINT8, BASE_DEC, NULL, ZBEE_ZCL_OPT_PWRPROF_NUM_R_DIGIT, NULL, HFILL } }, |
11859 | | |
11860 | 16 | { &hf_zbee_zcl_pwr_prof_energy_format_ldigit, |
11861 | 16 | { "Number of Digits to the left of the Decimal Point", "zbee_zcl_general.pwrprof.attr.energyformat.ldigit", |
11862 | 16 | FT_UINT8, BASE_DEC, NULL, ZBEE_ZCL_OPT_PWRPROF_NUM_L_DIGIT, NULL, HFILL } }, |
11863 | | |
11864 | 16 | { &hf_zbee_zcl_pwr_prof_energy_format_noleadingzero, |
11865 | 16 | { "Suppress leading zeros.", "zbee_zcl_general.pwrprof.attr.energyformat.noleadingzero", |
11866 | 16 | FT_BOOLEAN, 8, NULL, ZBEE_ZCL_OPT_PWRPROF_NO_LEADING_ZERO, NULL, HFILL } }, |
11867 | | /* End EnergyFormatting fields */ |
11868 | | |
11869 | 16 | { &hf_zbee_zcl_pwr_prof_energy_remote, |
11870 | 16 | { "Energy Remote", "zbee_zcl_general.pwrprof.attr.energyremote", FT_BOOLEAN, BASE_NONE, |
11871 | 16 | TFS(&tfs_enabled_disabled), 0x0, NULL, HFILL } }, |
11872 | | |
11873 | | /* Begin ScheduleMode fields */ |
11874 | 16 | { &hf_zbee_zcl_pwr_prof_sched_mode, |
11875 | 16 | { "Schedule Mode", "zbee_zcl_general.pwrprof.attr.schedmode", |
11876 | 16 | FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, |
11877 | | |
11878 | 16 | { &hf_zbee_zcl_pwr_prof_sched_mode_cheapest, |
11879 | 16 | { "Schedule Mode Cheapest", "zbee_zcl_general.pwrprof.attr.schedmode.cheapest", |
11880 | 16 | FT_BOOLEAN, 8, TFS(&tfs_active_inactive), ZBEE_ZCL_OPT_PWRPROF_SCHED_CHEAPEST, NULL, HFILL } }, |
11881 | | |
11882 | 16 | { &hf_zbee_zcl_pwr_prof_sched_mode_greenest, |
11883 | 16 | { "Schedule Mode Greenest", "zbee_zcl_general.pwrprof.attr.schedmode.greenest", |
11884 | 16 | FT_BOOLEAN, 8, TFS(&tfs_active_inactive), ZBEE_ZCL_OPT_PWRPROF_SCHED_GREENEST, NULL, HFILL } }, |
11885 | | |
11886 | 16 | { &hf_zbee_zcl_pwr_prof_sched_mode_reserved, |
11887 | 16 | { "Schedule Mode Reserved", "zbee_zcl_general.pwrprof.attr.schedmode.reserved", |
11888 | 16 | FT_UINT8, BASE_HEX, NULL, ZBEE_ZCL_OPT_PWRPROF_SCHED_RESERVED, NULL, HFILL } }, |
11889 | | /* End ScheduleMode fields */ |
11890 | | |
11891 | 16 | { &hf_zbee_zcl_pwr_prof_attr_id, |
11892 | 16 | { "Attribute", "zbee_zcl_general.pwrprof.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_pwr_prof_attr_names), |
11893 | 16 | 0x0, NULL, HFILL } }, |
11894 | | |
11895 | 16 | { &hf_zbee_zcl_pwr_prof_srv_tx_cmd_id, |
11896 | 16 | { "Command", "zbee_zcl_general.pwrprof.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_pwr_prof_srv_tx_cmd_names), |
11897 | 16 | 0x0, NULL, HFILL } }, |
11898 | | |
11899 | 16 | { &hf_zbee_zcl_pwr_prof_srv_rx_cmd_id, |
11900 | 16 | { "Command", "zbee_zcl_general.pwrprof.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_pwr_prof_srv_rx_cmd_names), |
11901 | 16 | 0x0, NULL, HFILL } }, |
11902 | | |
11903 | 16 | { &hf_zbee_zcl_pwr_prof_pwr_prof_id, |
11904 | 16 | { "Power Profile ID", "zbee_zcl_general.pwrprof.pwrprofid", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_power_profile_id), 0x00, |
11905 | 16 | "Identifier of the specific profile", HFILL } }, |
11906 | | |
11907 | 16 | { &hf_zbee_zcl_pwr_prof_currency, |
11908 | 16 | { "Currency", "zbee_zcl_general.pwrprof.currency", FT_UINT16, BASE_HEX, VALS(zbee_zcl_currecy_names), 0x0, |
11909 | 16 | "Local unit of currency (ISO 4217) used in the price field.", HFILL } }, |
11910 | | |
11911 | 16 | { &hf_zbee_zcl_pwr_prof_price, |
11912 | 16 | { "Price", "zbee_zcl_general.pwrprof.price", FT_UINT32, BASE_CUSTOM, CF_FUNC(decode_price_in_cents), 0x0, |
11913 | 16 | "Price of the energy of a specific Power Profile.", HFILL } }, |
11914 | | |
11915 | 16 | { &hf_zbee_zcl_pwr_prof_price_trailing_digit, |
11916 | 16 | { "Price Trailing Digit", "zbee_zcl_general.pwrprof.pricetrailingdigit", FT_UINT8, BASE_DEC, NULL, 0x0, |
11917 | 16 | "Number of digits to the right of the decimal point.", HFILL } }, |
11918 | | |
11919 | 16 | { &hf_zbee_zcl_pwr_prof_num_of_sched_phases, |
11920 | 16 | { "Number of Scheduled Phases", "zbee_zcl_general.pwrprof.numofschedphases", FT_UINT8, BASE_DEC, NULL, 0x0, |
11921 | 16 | "Total number of the energy phases of the Power Profile that need to be scheduled.", HFILL } }, |
11922 | | |
11923 | 16 | { &hf_zbee_zcl_pwr_prof_energy_phase_id, |
11924 | 16 | { "Energy Phase ID", "zbee_zcl_general.pwrprof.energyphaseid", FT_UINT8, BASE_DEC, NULL, 0x0, |
11925 | 16 | "Identifier of the specific phase.", HFILL } }, |
11926 | | |
11927 | 16 | { &hf_zbee_zcl_pwr_prof_scheduled_time, |
11928 | 16 | { "Scheduled Time", "zbee_zcl_general.pwrprof.scheduledtime", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_minutes), 0x0, |
11929 | 16 | NULL, HFILL } }, |
11930 | | |
11931 | 16 | { &hf_zbee_zcl_pwr_prof_macro_phase_id, |
11932 | 16 | { "Macro Phase ID", "zbee_zcl_general.pwrprof.macrophaseid", FT_UINT8, BASE_DEC, NULL, 0x0, |
11933 | 16 | "Identifier of the specific energy phase.", HFILL } }, |
11934 | | |
11935 | 16 | { &hf_zbee_zcl_pwr_prof_expect_duration, |
11936 | 16 | { "Expected Duration", "zbee_zcl_general.pwrprof.expectduration", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_minutes), 0x0, |
11937 | 16 | "The estimated duration of the specific phase.", HFILL } }, |
11938 | | |
11939 | 16 | { &hf_zbee_zcl_pwr_prof_num_of_trans_phases, |
11940 | 16 | { "Number of Transferred Phases", "zbee_zcl_general.pwrprof.numoftransphases", FT_UINT8, BASE_DEC, NULL, 0x0, |
11941 | 16 | NULL, HFILL } }, |
11942 | | |
11943 | 16 | { &hf_zbee_zcl_pwr_prof_peak_power, |
11944 | 16 | { "Peak Power", "zbee_zcl_general.pwrprof.peakpower", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_power_in_watt), 0x0, |
11945 | 16 | "The estimated power for the specific phase.", HFILL } }, |
11946 | | |
11947 | 16 | { &hf_zbee_zcl_pwr_prof_energy, |
11948 | 16 | { "Energy", "zbee_zcl_general.pwrprof.energy", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_energy), 0x0, |
11949 | 16 | "The estimated energy consumption for the accounted phase.", HFILL } }, |
11950 | | |
11951 | 16 | { &hf_zbee_zcl_pwr_prof_max_active_delay, |
11952 | 16 | { "Max Activation Delay", "zbee_zcl_general.pwrprof.maxactivdelay", FT_UINT16, BASE_CUSTOM, CF_FUNC(func_decode_delayinminute), 0x0, |
11953 | 16 | "The maximum interruption time between the end of the previous phase and the beginning of the specific phase.", HFILL } }, |
11954 | | |
11955 | 16 | { &hf_zbee_zcl_pwr_prof_pwr_prof_count, |
11956 | 16 | { "Power Profile Count", "zbee_zcl_general.pwrprof.pwrprofcount", FT_UINT8, BASE_DEC, NULL, 0x0, |
11957 | 16 | NULL, HFILL } }, |
11958 | | |
11959 | 16 | { &hf_zbee_zcl_pwr_prof_pwr_prof_rem_ctrl, |
11960 | 16 | { "Power Profile Remote Control", "zbee_zcl_general.pwrprof.pwrprofremctrl", FT_BOOLEAN, BASE_NONE, TFS(&tfs_enabled_disabled), 0x00, |
11961 | 16 | "It indicates if the PowerProfile is currently remotely controllable or not.", HFILL } }, |
11962 | | |
11963 | 16 | { &hf_zbee_zcl_pwr_prof_pwr_prof_state, |
11964 | 16 | { "Power Profile State", "zbee_zcl_general.pwrprof.pwrprofstate", FT_UINT8, BASE_HEX, VALS(zbee_zcl_pwr_prof_state_names), |
11965 | 16 | 0x0, NULL, HFILL } }, |
11966 | | |
11967 | 16 | { &hf_zbee_zcl_pwr_prof_start_after, |
11968 | 16 | { "Start After", "zbee_zcl_general.pwrprof.startafter", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_minutes), 0x0, |
11969 | 16 | NULL, HFILL } }, |
11970 | | |
11971 | 16 | { &hf_zbee_zcl_pwr_prof_stop_before, |
11972 | 16 | { "Stop Before", "zbee_zcl_general.pwrprof.stopbefore", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_minutes), 0x0, |
11973 | 16 | NULL, HFILL } }, |
11974 | | |
11975 | | /* Begin Options fields */ |
11976 | 16 | { &hf_zbee_zcl_pwr_prof_options, |
11977 | 16 | { "Options", "zbee_zcl_general.pwrprof.options", FT_UINT8, BASE_HEX, NULL, |
11978 | 16 | 0x0, NULL, HFILL } }, |
11979 | | |
11980 | 16 | { &hf_zbee_zcl_pwr_prof_options_01, |
11981 | 16 | { "PowerProfileStartTime Field Present", "zbee_zcl_general.pwrprof.options.01", FT_BOOLEAN, 8, NULL, |
11982 | 16 | ZBEE_ZCL_OPT_PWRPROF_STIME_PRESENT, NULL, HFILL } }, |
11983 | | |
11984 | 16 | { &hf_zbee_zcl_pwr_prof_options_res, |
11985 | 16 | { "Reserved", "zbee_zcl_general.pwrprof.options.reserved", FT_UINT8, BASE_HEX, NULL, |
11986 | 16 | ZBEE_ZCL_OPT_PWRPROF_RESERVED, NULL, HFILL } }, |
11987 | | /* End Options fields */ |
11988 | | |
11989 | 16 | { &hf_zbee_zcl_pwr_prof_pwr_prof_stime, |
11990 | 16 | { "Power Profile Start Time", "zbee_zcl_general.pwrprof.pwrprofstime", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_minutes), 0x0, |
11991 | 16 | NULL, HFILL } } |
11992 | | |
11993 | 16 | }; |
11994 | | |
11995 | | /* ZCL PowerProfile subtrees */ |
11996 | 16 | static int *ett[ZBEE_ZCL_PWR_PROF_NUM_ETT] = { |
11997 | 16 | &ett_zbee_zcl_pwr_prof, |
11998 | 16 | &ett_zbee_zcl_pwr_prof_options, |
11999 | 16 | &ett_zbee_zcl_pwr_prof_en_format, |
12000 | 16 | &ett_zbee_zcl_pwr_prof_sched_mode |
12001 | 16 | }; |
12002 | | |
12003 | | /* initialize attribute subtree types */ |
12004 | 96 | for ( i = 0, j = ZBEE_ZCL_PWR_PROF_NUM_GENERIC_ETT; i < ZBEE_ZCL_PWR_PROF_NUM_PWR_PROF_ETT; i++, j++ ) { |
12005 | 80 | ett[j] = &ett_zbee_zcl_pwr_prof_pwrprofiles[i]; |
12006 | 80 | } |
12007 | | |
12008 | 272 | for ( i = 0; i < ZBEE_ZCL_PWR_PROF_NUM_EN_PHS_ETT; i++, j++ ) { |
12009 | 256 | ett[j] = &ett_zbee_zcl_pwr_prof_enphases[i]; |
12010 | 256 | } |
12011 | | |
12012 | | /* Register the ZigBee ZCL PowerProfile cluster protocol name and description */ |
12013 | 16 | proto_zbee_zcl_pwr_prof = proto_register_protocol("ZigBee ZCL Power Profile", "ZCL Power Profile", ZBEE_PROTOABBREV_ZCL_PWRPROF); |
12014 | 16 | proto_register_field_array(proto_zbee_zcl_pwr_prof, hf, array_length(hf)); |
12015 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
12016 | | |
12017 | | /* Register the ZigBee ZCL Power Profile dissector. */ |
12018 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_PWRPROF, dissect_zbee_zcl_pwr_prof, proto_zbee_zcl_pwr_prof); |
12019 | 16 | } /* proto_register_zbee_zcl_pwr_prof */ |
12020 | | |
12021 | | |
12022 | | /*FUNCTION:------------------------------------------------------ |
12023 | | * NAME |
12024 | | * proto_reg_handoff_zbee_zcl_pwr_prof |
12025 | | * DESCRIPTION |
12026 | | * Hands off the Zcl Power Profile cluster dissector. |
12027 | | * PARAMETERS |
12028 | | * none |
12029 | | * RETURNS |
12030 | | * void |
12031 | | *--------------------------------------------------------------- |
12032 | | */ |
12033 | | void |
12034 | | proto_reg_handoff_zbee_zcl_pwr_prof(void) |
12035 | 16 | { |
12036 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_PWRPROF, |
12037 | 16 | proto_zbee_zcl_pwr_prof, |
12038 | 16 | ett_zbee_zcl_pwr_prof, |
12039 | 16 | ZBEE_ZCL_CID_POWER_PROFILE, |
12040 | 16 | ZBEE_MFG_CODE_NONE, |
12041 | 16 | hf_zbee_zcl_pwr_prof_attr_id, |
12042 | 16 | hf_zbee_zcl_pwr_prof_attr_id, |
12043 | 16 | hf_zbee_zcl_pwr_prof_srv_rx_cmd_id, |
12044 | 16 | hf_zbee_zcl_pwr_prof_srv_tx_cmd_id, |
12045 | 16 | dissect_zcl_pwr_prof_attr_data |
12046 | 16 | ); |
12047 | 16 | } /*proto_reg_handoff_zbee_zcl_pwr_prof*/ |
12048 | | |
12049 | | /* ########################################################################## */ |
12050 | | /* #### (0x001B) APPLIANCE CONTROL CLUSTER ################################## */ |
12051 | | /* ########################################################################## */ |
12052 | | |
12053 | | /*************************/ |
12054 | | /* Defines */ |
12055 | | /*************************/ |
12056 | | |
12057 | 16 | #define ZBEE_ZCL_APPL_CTRL_NUM_GENERIC_ETT 3 |
12058 | 705 | #define ZBEE_ZCL_APPL_CTRL_NUM_FUNC_ETT 32 |
12059 | | #define ZBEE_ZCL_APPL_CTRL_NUM_ETT (ZBEE_ZCL_APPL_CTRL_NUM_GENERIC_ETT + \ |
12060 | | ZBEE_ZCL_APPL_CTRL_NUM_FUNC_ETT) |
12061 | | |
12062 | | /* Attributes */ |
12063 | 95 | #define ZBEE_ZCL_ATTR_ID_APPL_CTRL_START_TIME 0x0000 /* Start Time */ |
12064 | 99 | #define ZBEE_ZCL_ATTR_ID_APPL_CTRL_FINISH_TIME 0x0001 /* Finish Time */ |
12065 | 100 | #define ZBEE_ZCL_ATTR_ID_APPL_CTRL_REMAINING_TIME 0x0002 /* Remaining Time */ |
12066 | | |
12067 | | /* Server Commands Received */ |
12068 | 9 | #define ZBEE_ZCL_CMD_ID_APPL_CTRL_EXECUTION_CMD 0x00 /* Execution of a Command */ |
12069 | 2 | #define ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE 0x01 /* Signal State */ |
12070 | 24 | #define ZBEE_ZCL_CMD_ID_APPL_CTRL_WRITE_FUNCS 0x02 /* Write Functions */ |
12071 | 2 | #define ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE_RESUME 0x03 /* Overload Pause Resume */ |
12072 | 3 | #define ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE 0x04 /* Overload Pause */ |
12073 | 1 | #define ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_WARNING 0x05 /* Overload Warning */ |
12074 | | |
12075 | | /* Server Commands Generated */ |
12076 | 2 | #define ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_RSP 0x00 /* Signal State Response */ |
12077 | 2 | #define ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_NOTIF 0x01 /* Signal State Notification */ |
12078 | | |
12079 | | /* Execution Of a Command - Command Ids list */ |
12080 | | #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_RESERVED 0x00 /* Reserved */ |
12081 | | #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START 0x01 /* Start appliance cycle */ |
12082 | | #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP 0x02 /* Stop appliance cycle */ |
12083 | | #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_PAUSE 0x03 /* Pause appliance cycle */ |
12084 | | #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START_SUPERFREEZING 0x04 /* Start superfreezing cycle */ |
12085 | | #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP_SUPERFREEZING 0x05 /* Stop superfreezing cycle */ |
12086 | | #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START_SUPERCOOLING 0x06 /* Start supercooling cycle */ |
12087 | | #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP_SUPERCOOLING 0x07 /* Stop supercooling cycle */ |
12088 | | #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_DISABLE_GAS 0x08 /* Disable gas */ |
12089 | | #define ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_ENABLE_GAS 0x09 /* Enable gas */ |
12090 | | |
12091 | | /* CECED Time mask */ |
12092 | 16 | #define ZBEE_ZCL_APPL_CTRL_TIME_MM 0x003f /* Minutes */ |
12093 | 16 | #define ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_TYPE 0x00c0 /* Encoding Type */ |
12094 | 16 | #define ZBEE_ZCL_APPL_CTRL_TIME_HH 0xff00 /* Hours */ |
12095 | | |
12096 | | /* Time encoding values */ |
12097 | | #define ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_REL 0x00 |
12098 | | #define ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_ABS 0x01 |
12099 | | |
12100 | | /* Overload Warnings */ |
12101 | | #define ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_1 0x00 |
12102 | | #define ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_2 0x01 |
12103 | | #define ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_3 0x02 |
12104 | | #define ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_4 0x03 |
12105 | | #define ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_5 0x04 |
12106 | | |
12107 | | /* Appliance Status Ids list */ |
12108 | | #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_RESERVED 0x00 /* Reserved */ |
12109 | | #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_OFF 0x01 /* Appliance in off state */ |
12110 | | #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_STANDBY 0x02 /* Appliance in stand-by */ |
12111 | | #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG 0x03 /* Appliance already programmed */ |
12112 | | #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG_WAITING_TO_START 0x04 /* Appliance already programmed and ready to start */ |
12113 | | #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_RUNNING 0x05 /* Appliance is running */ |
12114 | | #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_PAUSE 0x06 /* Appliance is in pause */ |
12115 | | #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_END_PRG 0x07 /* Appliance end programmed tasks */ |
12116 | | #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_FAILURE 0x08 /* Appliance is in a failure state */ |
12117 | | #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG_INTERRUPTED 0x09 /* The appliance programmed tasks have been interrupted */ |
12118 | | #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_IDLE 0x1a /* Appliance in idle state */ |
12119 | | #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_RINSE_HOLD 0x1b /* Appliance rinse hold */ |
12120 | | #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_SERVICE 0x1c /* Appliance in service state */ |
12121 | | #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERFREEZING 0x1d /* Appliance in superfreezing state */ |
12122 | | #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERCOOLING 0x1e /* Appliance in supercooling state */ |
12123 | | #define ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERHEATING 0x1f /* Appliance in superheating state */ |
12124 | | |
12125 | | /* Remote Enable Flags mask */ |
12126 | 16 | #define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_FLAGS 0x0f |
12127 | 16 | #define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_STATUS2 0xf0 |
12128 | | |
12129 | | /* Remote Enable Flags values */ |
12130 | | #define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_DIS 0x00 /* Disabled */ |
12131 | | #define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_EN_REM_EN_CTRL 0x01 /* Enable Remote and Energy Control */ |
12132 | | #define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_TEMP_LOCK_DIS 0x07 /* Temporarily locked/disabled */ |
12133 | | #define ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_EN_REM_CTRL 0x0f /* Enable Remote Control */ |
12134 | | |
12135 | | /* Device Status 2 values */ |
12136 | | #define ZBEE_ZCL_APPL_CTRL_STATUS2_PROPRIETARY_0 0x00 /* Proprietary */ |
12137 | | #define ZBEE_ZCL_APPL_CTRL_STATUS2_PROPRIETARY_1 0x01 /* Proprietary */ |
12138 | | #define ZBEE_ZCL_APPL_CTRL_STATUS2_IRIS_SYMPTOM_CODE 0x02 /* Iris symptom code */ |
12139 | | |
12140 | | /*************************/ |
12141 | | /* Function Declarations */ |
12142 | | /*************************/ |
12143 | | |
12144 | | void proto_register_zbee_zcl_appl_ctrl(void); |
12145 | | void proto_reg_handoff_zbee_zcl_appl_ctrl(void); |
12146 | | |
12147 | | /* Command Dissector Helpers */ |
12148 | | static void dissect_zcl_appl_ctrl_exec_cmd (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
12149 | | static void dissect_zcl_appl_ctrl_wr_funcs (tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset); |
12150 | | static void dissect_zcl_appl_ctrl_ovrl_warning (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
12151 | | static void dissect_zcl_appl_ctrl_signal_state_rsp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset); |
12152 | | |
12153 | | static void dissect_zcl_appl_ctrl_attr_data (proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr); |
12154 | | |
12155 | | /* Private functions prototype */ |
12156 | | |
12157 | | /*************************/ |
12158 | | /* Global Variables */ |
12159 | | /*************************/ |
12160 | | /* Initialize the protocol and registered fields */ |
12161 | | static int proto_zbee_zcl_appl_ctrl; |
12162 | | |
12163 | | static int hf_zbee_zcl_appl_ctrl_attr_id; |
12164 | | static int hf_zbee_zcl_appl_ctrl_time; |
12165 | | static int hf_zbee_zcl_appl_ctrl_time_mm; |
12166 | | static int hf_zbee_zcl_appl_ctrl_time_encoding_type; |
12167 | | static int hf_zbee_zcl_appl_ctrl_time_hh; |
12168 | | static int hf_zbee_zcl_appl_ctrl_srv_tx_cmd_id; |
12169 | | static int hf_zbee_zcl_appl_ctrl_srv_rx_cmd_id; |
12170 | | static int hf_zbee_zcl_appl_ctrl_exec_cmd_id; |
12171 | | static int hf_zbee_zcl_appl_ctrl_attr_func_id; |
12172 | | static int hf_zbee_zcl_appl_ctrl_attr_func_data_type; |
12173 | | static int hf_zbee_zcl_appl_ctrl_warning_id; |
12174 | | static int hf_zbee_zcl_appl_ctrl_appl_status; |
12175 | | static int hf_zbee_zcl_appl_ctrl_rem_en_flags_raw; |
12176 | | static int hf_zbee_zcl_appl_ctrl_rem_en_flags; |
12177 | | static int hf_zbee_zcl_appl_ctrl_status2; |
12178 | | static int hf_zbee_zcl_appl_ctrl_status2_array; |
12179 | | |
12180 | | /* Initialize the subtree pointers */ |
12181 | | static int ett_zbee_zcl_appl_ctrl; |
12182 | | static int ett_zbee_zcl_appl_ctrl_flags; |
12183 | | static int ett_zbee_zcl_appl_ctrl_time; |
12184 | | static int ett_zbee_zcl_appl_ctrl_func[ZBEE_ZCL_APPL_CTRL_NUM_FUNC_ETT]; |
12185 | | |
12186 | | /* Attributes */ |
12187 | | static const value_string zbee_zcl_appl_ctrl_attr_names[] = { |
12188 | | { ZBEE_ZCL_ATTR_ID_APPL_CTRL_START_TIME, "Start Time" }, |
12189 | | { ZBEE_ZCL_ATTR_ID_APPL_CTRL_FINISH_TIME, "Finish Time" }, |
12190 | | { ZBEE_ZCL_ATTR_ID_APPL_CTRL_REMAINING_TIME, "Remaining Time" }, |
12191 | | { 0, NULL } |
12192 | | }; |
12193 | | static value_string_ext zbee_zcl_appl_ctrl_attr_names_ext = VALUE_STRING_EXT_INIT(zbee_zcl_appl_ctrl_attr_names); |
12194 | | |
12195 | | /* Server Commands Received */ |
12196 | | static const value_string zbee_zcl_appl_ctrl_srv_rx_cmd_names[] = { |
12197 | | { ZBEE_ZCL_CMD_ID_APPL_CTRL_EXECUTION_CMD, "Execution of a Command" }, |
12198 | | { ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE, "Signal State" }, |
12199 | | { ZBEE_ZCL_CMD_ID_APPL_CTRL_WRITE_FUNCS, "Write Functions" }, |
12200 | | { ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE_RESUME, "Overload Pause Resume" }, |
12201 | | { ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE, "Overload Pause" }, |
12202 | | { ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_WARNING, "Overload Warning" }, |
12203 | | { 0, NULL } |
12204 | | }; |
12205 | | |
12206 | | /* Server Commands Generated */ |
12207 | | static const value_string zbee_zcl_appl_ctrl_srv_tx_cmd_names[] = { |
12208 | | { ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_RSP, "Signal State Response" }, |
12209 | | { ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_NOTIF, "Signal State Notification" }, |
12210 | | { 0, NULL } |
12211 | | }; |
12212 | | |
12213 | | /* Execution Of a Command - Command Name */ |
12214 | | static const value_string zbee_zcl_appl_ctrl_exec_cmd_names[] = { |
12215 | | { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_RESERVED, "Reserved" }, |
12216 | | { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START, "Start" }, |
12217 | | { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP, "Stop" }, |
12218 | | { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_PAUSE, "Pause" }, |
12219 | | { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START_SUPERFREEZING, "Start Superfreezing" }, |
12220 | | { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP_SUPERFREEZING, "Stop Superfreezing" }, |
12221 | | { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_START_SUPERCOOLING, "Start Supercooling" }, |
12222 | | { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_STOP_SUPERCOOLING, "Stop Supercooling" }, |
12223 | | { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_DISABLE_GAS, "Disable Gas" }, |
12224 | | { ZBEE_ZCL_APPL_CTRL_EXEC_CMD_ID_ENABLE_GAS, "Enable Gas" }, |
12225 | | { 0, NULL } |
12226 | | }; |
12227 | | |
12228 | | /* Appliance Status Names list */ |
12229 | | static const value_string zbee_zcl_appl_ctrl_appl_status_names[] = { |
12230 | | { ZBEE_ZCL_APPL_CTRL_ID_STATUS_RESERVED, "Reserved" }, |
12231 | | { ZBEE_ZCL_APPL_CTRL_ID_STATUS_OFF, "Off" }, |
12232 | | { ZBEE_ZCL_APPL_CTRL_ID_STATUS_STANDBY, "Stand-by" }, |
12233 | | { ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG, "Programmed" }, |
12234 | | { ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG_WAITING_TO_START, "Waiting to Start" }, |
12235 | | { ZBEE_ZCL_APPL_CTRL_ID_STATUS_RUNNING, "Running" }, |
12236 | | { ZBEE_ZCL_APPL_CTRL_ID_STATUS_PAUSE, "Pause" }, |
12237 | | { ZBEE_ZCL_APPL_CTRL_ID_STATUS_END_PRG, "End Programmed" }, |
12238 | | { ZBEE_ZCL_APPL_CTRL_ID_STATUS_FAILURE, "Failure" }, |
12239 | | { ZBEE_ZCL_APPL_CTRL_ID_STATUS_PRG_INTERRUPTED, "Programming Interrupted" }, |
12240 | | { ZBEE_ZCL_APPL_CTRL_ID_STATUS_IDLE, "Idle" }, |
12241 | | { ZBEE_ZCL_APPL_CTRL_ID_STATUS_RINSE_HOLD, "Raise Hold" }, |
12242 | | { ZBEE_ZCL_APPL_CTRL_ID_STATUS_SERVICE, "Service" }, |
12243 | | { ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERFREEZING, "Superfreezing" }, |
12244 | | { ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERCOOLING, "Supercooling" }, |
12245 | | { ZBEE_ZCL_APPL_CTRL_ID_STATUS_SUPERHEATING, "Superheating" }, |
12246 | | { 0, NULL } |
12247 | | }; |
12248 | | |
12249 | | /* Remote Enable Flags Names list */ |
12250 | | static const value_string zbee_zcl_appl_ctrl_rem_flags_names[] = { |
12251 | | { ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_DIS, "Disable" }, |
12252 | | { ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_EN_REM_EN_CTRL, "Enable Remote and Energy Control" }, |
12253 | | { ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_TEMP_LOCK_DIS, "Temporarily locked/disabled" }, |
12254 | | { ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_EN_REM_CTRL, "Enable Remote Control" }, |
12255 | | { 0, NULL } |
12256 | | }; |
12257 | | |
12258 | | /* Appliance Status 2 Names list */ |
12259 | | static const value_string zbee_zcl_appl_ctrl_status2_names[] = { |
12260 | | { ZBEE_ZCL_APPL_CTRL_STATUS2_PROPRIETARY_0, "Proprietary" }, |
12261 | | { ZBEE_ZCL_APPL_CTRL_STATUS2_PROPRIETARY_1, "Proprietary" }, |
12262 | | { ZBEE_ZCL_APPL_CTRL_STATUS2_IRIS_SYMPTOM_CODE, "Iris symptom code" }, |
12263 | | { 0, NULL } |
12264 | | }; |
12265 | | |
12266 | | /* Overload Warning Names list */ |
12267 | | static const value_string zbee_zcl_appl_ctrl_ovrl_warning_names[] = { |
12268 | | { ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_1, "Overall power above 'available power' level" }, |
12269 | | { ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_2, "Overall power above 'power threshold' level" }, |
12270 | | { ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_3, "Overall power back below the 'available power' level" }, |
12271 | | { ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_4, "Overall power back below the 'power threshold' level" }, |
12272 | | { ZBEE_ZCL_APPL_CTRL_ID_OVRL_WARN_5, "Overall power will be potentially above 'available power' level if the appliance starts" }, |
12273 | | { 0, NULL } |
12274 | | }; |
12275 | | |
12276 | | /* CEDEC Time Encoding Names list */ |
12277 | | static const value_string zbee_zcl_appl_ctrl_time_encoding_type_names[] = { |
12278 | | { ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_REL, "Relative" }, |
12279 | | { ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_ABS, "Absolute" }, |
12280 | | { 0, NULL } |
12281 | | }; |
12282 | | |
12283 | | /*************************/ |
12284 | | /* Function Bodies */ |
12285 | | /*************************/ |
12286 | | |
12287 | | /*FUNCTION:------------------------------------------------------ |
12288 | | * NAME |
12289 | | * dissect_zbee_zcl_appl_ctrl |
12290 | | * DESCRIPTION |
12291 | | * ZigBee ZCL Appliance Control cluster dissector for wireshark. |
12292 | | * PARAMETERS |
12293 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
12294 | | * packet_info *pinfo - pointer to packet information fields |
12295 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
12296 | | * void *data - pointer to ZCL packet structure. |
12297 | | * RETURNS |
12298 | | * int - length of parsed data. |
12299 | | *--------------------------------------------------------------- |
12300 | | */ |
12301 | | static int |
12302 | | dissect_zbee_zcl_appl_ctrl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) |
12303 | 85 | { |
12304 | 85 | proto_tree *payload_tree; |
12305 | 85 | zbee_zcl_packet *zcl; |
12306 | 85 | unsigned offset = 0; |
12307 | 85 | uint8_t cmd_id; |
12308 | 85 | int rem_len; |
12309 | | |
12310 | | /* Reject the packet if data is NULL */ |
12311 | 85 | if (data == NULL) |
12312 | 0 | return 0; |
12313 | 85 | zcl = (zbee_zcl_packet *)data; |
12314 | 85 | cmd_id = zcl->cmd_id; |
12315 | | |
12316 | | /* Create a subtree for the ZCL Command frame, and add the command ID to it. */ |
12317 | 85 | if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { |
12318 | | /* Append the command name to the info column. */ |
12319 | 59 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
12320 | 59 | val_to_str_const(cmd_id, zbee_zcl_appl_ctrl_srv_rx_cmd_names, "Unknown Command"), |
12321 | 59 | zcl->tran_seqno); |
12322 | | |
12323 | | /* Add the command ID. */ |
12324 | 59 | proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
12325 | | |
12326 | | /* Check is this command has a payload, than add the payload tree */ |
12327 | 59 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
12328 | 59 | if (rem_len > 0) { |
12329 | 51 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_appl_ctrl, NULL, "Payload"); |
12330 | | |
12331 | | /* Call the appropriate command dissector */ |
12332 | 51 | switch (cmd_id) { |
12333 | 9 | case ZBEE_ZCL_CMD_ID_APPL_CTRL_EXECUTION_CMD: |
12334 | 9 | dissect_zcl_appl_ctrl_exec_cmd(tvb, payload_tree, &offset); |
12335 | 9 | break; |
12336 | | |
12337 | 2 | case ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE: |
12338 | 2 | case ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE_RESUME: |
12339 | 3 | case ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE: |
12340 | | /* No payload */ |
12341 | 3 | break; |
12342 | | |
12343 | 24 | case ZBEE_ZCL_CMD_ID_APPL_CTRL_WRITE_FUNCS: |
12344 | 24 | dissect_zcl_appl_ctrl_wr_funcs(tvb, pinfo, payload_tree, &offset); |
12345 | 24 | break; |
12346 | | |
12347 | 1 | case ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_WARNING: |
12348 | 1 | dissect_zcl_appl_ctrl_ovrl_warning(tvb, payload_tree, &offset); |
12349 | 1 | break; |
12350 | | |
12351 | 14 | default: |
12352 | 14 | break; |
12353 | 51 | } |
12354 | 51 | } |
12355 | 59 | } |
12356 | 26 | else { /* ZBEE_ZCL_FCF_TO_CLIENT */ |
12357 | | /* Append the command name to the info column. */ |
12358 | 26 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
12359 | 26 | val_to_str_const(cmd_id, zbee_zcl_appl_ctrl_srv_tx_cmd_names, "Unknown Command"), |
12360 | 26 | zcl->tran_seqno); |
12361 | | |
12362 | | /* Add the command ID. */ |
12363 | 26 | proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
12364 | | |
12365 | | /* Check is this command has a payload, than add the payload tree */ |
12366 | 26 | rem_len = tvb_reported_length_remaining(tvb, ++offset); |
12367 | 26 | if (rem_len > 0) { |
12368 | 25 | payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_appl_ctrl, NULL, "Payload"); |
12369 | | |
12370 | | /* Call the appropriate command dissector */ |
12371 | 25 | switch (cmd_id) { |
12372 | 2 | case ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_RSP: |
12373 | 2 | case ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_NOTIF: |
12374 | 2 | dissect_zcl_appl_ctrl_signal_state_rsp(tvb, payload_tree, &offset); |
12375 | 2 | break; |
12376 | | |
12377 | 23 | default: |
12378 | 23 | break; |
12379 | 25 | } |
12380 | 25 | } |
12381 | 26 | } |
12382 | | |
12383 | 63 | return tvb_captured_length(tvb); |
12384 | 85 | } |
12385 | | |
12386 | | |
12387 | | /*FUNCTION:------------------------------------------------------ |
12388 | | * NAME |
12389 | | * dissect_zcl_appl_ctrl_exec_cmd |
12390 | | * DESCRIPTION |
12391 | | * this function is called in order to decode "ExecutionOfACommand" |
12392 | | * payload. |
12393 | | * PARAMETERS |
12394 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
12395 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
12396 | | * unsigned *offset - pointer to buffer offset |
12397 | | * RETURNS |
12398 | | * none |
12399 | | *--------------------------------------------------------------- |
12400 | | */ |
12401 | | static void |
12402 | | dissect_zcl_appl_ctrl_exec_cmd(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
12403 | 9 | { |
12404 | | /* Retrieve "Command Id" field */ |
12405 | 9 | proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_exec_cmd_id, tvb, *offset, 1, ENC_NA); |
12406 | 9 | *offset += 1; |
12407 | 9 | } /*dissect_zcl_appl_ctrl_exec_cmd*/ |
12408 | | |
12409 | | |
12410 | | /*FUNCTION:------------------------------------------------------ |
12411 | | * NAME |
12412 | | * dissect_zcl_appl_ctrl_attr_func |
12413 | | * DESCRIPTION |
12414 | | * this function is called in order to decode "Function" element. |
12415 | | * PARAMETERS |
12416 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
12417 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
12418 | | * unsigned *offset - pointer to buffer offset |
12419 | | * RETURNS |
12420 | | * none |
12421 | | *--------------------------------------------------------------- |
12422 | | */ |
12423 | | static void |
12424 | | dissect_zcl_appl_ctrl_attr_func(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset) |
12425 | 176 | { |
12426 | 176 | uint8_t func_data_type; |
12427 | 176 | uint16_t func_id; |
12428 | | |
12429 | | /* ID */ |
12430 | 176 | proto_tree_add_item_ret_uint16(tree, hf_zbee_zcl_appl_ctrl_attr_func_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN, &func_id); |
12431 | 176 | *offset += 2; |
12432 | | |
12433 | 176 | proto_item_append_text(tree, ", %s", |
12434 | 176 | val_to_str_ext_const(func_id, &zbee_zcl_appl_ctrl_attr_names_ext, "Reserved")); |
12435 | | |
12436 | | /* Data Type */ |
12437 | 176 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_appl_ctrl_attr_func_data_type, tvb, *offset, 1, ENC_NA, &func_data_type); |
12438 | 176 | *offset += 1; |
12439 | | |
12440 | | /* Function Data Dissector */ |
12441 | 176 | dissect_zcl_appl_ctrl_attr_data(tree, pinfo, tvb, offset, func_id, func_data_type, false); |
12442 | | |
12443 | 176 | } /*dissect_zcl_appl_ctrl_attr_func*/ |
12444 | | |
12445 | | |
12446 | | /*FUNCTION:------------------------------------------------------ |
12447 | | * NAME |
12448 | | * dissect_zcl_appl_ctrl_wr_funcs |
12449 | | * DESCRIPTION |
12450 | | * this function is called in order to decode "WriteFunctions" |
12451 | | * payload. |
12452 | | * PARAMETERS |
12453 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
12454 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
12455 | | * unsigned *offset - pointer to buffer offset |
12456 | | * RETURNS |
12457 | | * none |
12458 | | *--------------------------------------------------------------- |
12459 | | */ |
12460 | | static void |
12461 | | dissect_zcl_appl_ctrl_wr_funcs(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned *offset) |
12462 | 24 | { |
12463 | 24 | proto_tree *sub_tree = NULL; |
12464 | 24 | unsigned tvb_len; |
12465 | 24 | unsigned i = 0; |
12466 | | |
12467 | 24 | tvb_len = tvb_reported_length(tvb); |
12468 | 200 | while ( *offset < tvb_len && i < ZBEE_ZCL_APPL_CTRL_NUM_FUNC_ETT ) { |
12469 | | /* Create subtree for attribute status field */ |
12470 | 176 | sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 0, |
12471 | 176 | ett_zbee_zcl_appl_ctrl_func[i], NULL, "Function #%d", i); |
12472 | 176 | i++; |
12473 | | |
12474 | | /* Dissect the attribute identifier */ |
12475 | 176 | dissect_zcl_appl_ctrl_attr_func(tvb, pinfo, sub_tree, offset); |
12476 | 176 | } |
12477 | | |
12478 | 24 | } /*dissect_zcl_appl_ctrl_wr_funcs*/ |
12479 | | |
12480 | | |
12481 | | /*FUNCTION:------------------------------------------------------ |
12482 | | * NAME |
12483 | | * dissect_zcl_appl_ctrl_ovrl_warning |
12484 | | * DESCRIPTION |
12485 | | * this function is called in order to decode "OverloadWarning" |
12486 | | * payload. |
12487 | | * PARAMETERS |
12488 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
12489 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
12490 | | * unsigned *offset - pointer to buffer offset |
12491 | | * RETURNS |
12492 | | * none |
12493 | | *--------------------------------------------------------------- |
12494 | | */ |
12495 | | static void |
12496 | | dissect_zcl_appl_ctrl_ovrl_warning(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
12497 | 1 | { |
12498 | | /* Retrieve "Warning Id" field */ |
12499 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_warning_id, tvb, *offset, 1, ENC_NA); |
12500 | 1 | *offset += 1; |
12501 | | |
12502 | 1 | } /*dissect_zcl_appl_ctrl_ovrl_warning*/ |
12503 | | |
12504 | | |
12505 | | /*FUNCTION:------------------------------------------------------ |
12506 | | * NAME |
12507 | | * dissect_zcl_appl_ctrl_signal_state_rsp |
12508 | | * DESCRIPTION |
12509 | | * this function is called in order to decode "SignalStateResponse" |
12510 | | * "SignalStateNotification" payload. |
12511 | | * PARAMETERS |
12512 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
12513 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
12514 | | * unsigned *offset - pointer to buffer offset |
12515 | | * RETURNS |
12516 | | * none |
12517 | | *--------------------------------------------------------------- |
12518 | | */ |
12519 | | static void |
12520 | | dissect_zcl_appl_ctrl_signal_state_rsp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
12521 | 2 | { |
12522 | 2 | static int * const flags[] = { |
12523 | 2 | &hf_zbee_zcl_appl_ctrl_rem_en_flags, |
12524 | 2 | &hf_zbee_zcl_appl_ctrl_status2, |
12525 | 2 | NULL |
12526 | 2 | }; |
12527 | | |
12528 | | /* Retrieve "Appliance Status" field */ |
12529 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_appl_status, tvb, *offset, 1, ENC_NA); |
12530 | 2 | *offset += 1; |
12531 | | |
12532 | | /* Retrieve "Remote Enable" field */ |
12533 | 2 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_appl_ctrl_rem_en_flags_raw, ett_zbee_zcl_appl_ctrl_flags, flags, ENC_NA); |
12534 | 2 | *offset += 1; |
12535 | | |
12536 | | /* Retrieve "Appliance Status 2" field */ |
12537 | 2 | proto_tree_add_item(tree, hf_zbee_zcl_appl_ctrl_status2_array, tvb, *offset, 3, ENC_BIG_ENDIAN); |
12538 | 2 | } /*dissect_zcl_appl_ctrl_signal_state_rsp*/ |
12539 | | |
12540 | | /*FUNCTION:------------------------------------------------------ |
12541 | | * NAME |
12542 | | * dissect_zcl_appl_ctrl_attr_data |
12543 | | * DESCRIPTION |
12544 | | * this function is called by ZCL foundation dissector in order to decode |
12545 | | * specific cluster attributes data. |
12546 | | * PARAMETERS |
12547 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
12548 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
12549 | | * unsigned *offset - pointer to buffer offset |
12550 | | * uint16_t attr_id - attribute identifier |
12551 | | * unsigned data_type - attribute data type |
12552 | | * bool client_attr- ZCL client |
12553 | | * RETURNS |
12554 | | * none |
12555 | | *--------------------------------------------------------------- |
12556 | | */ |
12557 | | static void |
12558 | | dissect_zcl_appl_ctrl_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr) |
12559 | 440 | { |
12560 | 440 | static int * const flags[] = { |
12561 | 440 | &hf_zbee_zcl_appl_ctrl_time_mm, |
12562 | 440 | &hf_zbee_zcl_appl_ctrl_time_encoding_type, |
12563 | 440 | &hf_zbee_zcl_appl_ctrl_time_hh, |
12564 | 440 | NULL |
12565 | 440 | }; |
12566 | | |
12567 | | /* Dissect attribute data type and data */ |
12568 | 440 | switch (attr_id) { |
12569 | | |
12570 | 95 | case ZBEE_ZCL_ATTR_ID_APPL_CTRL_START_TIME: |
12571 | 99 | case ZBEE_ZCL_ATTR_ID_APPL_CTRL_FINISH_TIME: |
12572 | 100 | case ZBEE_ZCL_ATTR_ID_APPL_CTRL_REMAINING_TIME: |
12573 | 100 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_appl_ctrl_time, ett_zbee_zcl_appl_ctrl_time, flags, ENC_LITTLE_ENDIAN); |
12574 | 100 | *offset += 2; |
12575 | 100 | break; |
12576 | | |
12577 | 340 | default: |
12578 | 340 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
12579 | 340 | break; |
12580 | 440 | } |
12581 | 440 | } /*dissect_zcl_appl_ctrl_attr_data*/ |
12582 | | |
12583 | | |
12584 | | /*FUNCTION:------------------------------------------------------ |
12585 | | * NAME |
12586 | | * proto_register_zbee_zcl_appl_ctrl |
12587 | | * DESCRIPTION |
12588 | | * this function registers the ZCL Appliance Control dissector |
12589 | | * and all its information. |
12590 | | * PARAMETERS |
12591 | | * none |
12592 | | * RETURNS |
12593 | | * none |
12594 | | *--------------------------------------------------------------- |
12595 | | */ |
12596 | | void |
12597 | | proto_register_zbee_zcl_appl_ctrl(void) |
12598 | 16 | { |
12599 | 16 | unsigned i, j; |
12600 | | |
12601 | 16 | static hf_register_info hf[] = { |
12602 | | |
12603 | 16 | { &hf_zbee_zcl_appl_ctrl_attr_id, |
12604 | 16 | { "Attribute", "zbee_zcl_general.applctrl.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_appl_ctrl_attr_names), |
12605 | 16 | 0x0, NULL, HFILL } }, |
12606 | | |
12607 | 16 | { &hf_zbee_zcl_appl_ctrl_time, |
12608 | 16 | { "Data", "zbee_zcl_general.applctrl.time", FT_UINT16, BASE_HEX, NULL, 0x0, |
12609 | 16 | NULL, HFILL } }, |
12610 | | |
12611 | 16 | { &hf_zbee_zcl_appl_ctrl_time_mm, |
12612 | 16 | { "Minutes", "zbee_zcl_general.applctrl.time.mm", FT_UINT16, BASE_DEC, NULL, ZBEE_ZCL_APPL_CTRL_TIME_MM, |
12613 | 16 | NULL, HFILL } }, |
12614 | | |
12615 | 16 | { &hf_zbee_zcl_appl_ctrl_time_encoding_type, |
12616 | 16 | { "Encoding Type", "zbee_zcl_general.applctrl.time.encoding_type", FT_UINT16, BASE_HEX, VALS(zbee_zcl_appl_ctrl_time_encoding_type_names), |
12617 | 16 | ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_TYPE, NULL, HFILL } }, |
12618 | | |
12619 | 16 | { &hf_zbee_zcl_appl_ctrl_time_hh, |
12620 | 16 | { "Hours", "zbee_zcl_general.applctrl.time.hh", FT_UINT16, BASE_DEC, NULL, ZBEE_ZCL_APPL_CTRL_TIME_HH, |
12621 | 16 | NULL, HFILL } }, |
12622 | | |
12623 | 16 | { &hf_zbee_zcl_appl_ctrl_srv_tx_cmd_id, |
12624 | 16 | { "Command", "zbee_zcl_general.applctrl.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_srv_tx_cmd_names), |
12625 | 16 | 0x0, NULL, HFILL } }, |
12626 | | |
12627 | 16 | { &hf_zbee_zcl_appl_ctrl_srv_rx_cmd_id, |
12628 | 16 | { "Command", "zbee_zcl_general.applctrl.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_srv_rx_cmd_names), |
12629 | 16 | 0x0, NULL, HFILL } }, |
12630 | | |
12631 | 16 | { &hf_zbee_zcl_appl_ctrl_appl_status, |
12632 | 16 | { "Appliance Status", "zbee_zcl_general.applctrl.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_appl_status_names), |
12633 | 16 | 0x0, NULL, HFILL } }, |
12634 | | |
12635 | 16 | { &hf_zbee_zcl_appl_ctrl_rem_en_flags_raw, |
12636 | 16 | { "Remote Enable Flags", "zbee_zcl_general.applctrl.remote_enable_flags", FT_UINT8, BASE_HEX, NULL, |
12637 | 16 | 0x0, NULL, HFILL } }, |
12638 | | |
12639 | 16 | { &hf_zbee_zcl_appl_ctrl_rem_en_flags, |
12640 | 16 | { "Remote Enable Flags", "zbee_zcl_general.applctrl.remenflags", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_rem_flags_names), |
12641 | 16 | ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_FLAGS, NULL, HFILL } }, |
12642 | | |
12643 | 16 | { &hf_zbee_zcl_appl_ctrl_status2, |
12644 | 16 | { "Appliance Status 2", "zbee_zcl_general.applctrl.status2", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_status2_names), |
12645 | 16 | ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_STATUS2, NULL, HFILL } }, |
12646 | | |
12647 | 16 | { &hf_zbee_zcl_appl_ctrl_status2_array, |
12648 | 16 | { "Appliance Status 2", "zbee_zcl_general.applctrl.status2.array", FT_UINT24, BASE_HEX, NULL, |
12649 | 16 | 0x00, NULL, HFILL } }, |
12650 | | |
12651 | 16 | { &hf_zbee_zcl_appl_ctrl_exec_cmd_id, |
12652 | 16 | { "Command", "zbee_zcl_general.applctrl.execcmd.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_exec_cmd_names), |
12653 | 16 | 0x0, NULL, HFILL } }, |
12654 | | |
12655 | 16 | { &hf_zbee_zcl_appl_ctrl_attr_func_id, |
12656 | 16 | { "ID", "zbee_zcl_general.applctrl.attr_func.id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_appl_ctrl_attr_names), |
12657 | 16 | 0x0, NULL, HFILL } }, |
12658 | | |
12659 | 16 | { &hf_zbee_zcl_appl_ctrl_attr_func_data_type, |
12660 | 16 | { "Data Type", "zbee_zcl_general.applctrl.attr_func.datatype", FT_UINT8, BASE_HEX, VALS(zbee_zcl_short_data_type_names), |
12661 | 16 | 0x0, NULL, HFILL } }, |
12662 | | |
12663 | 16 | { &hf_zbee_zcl_appl_ctrl_warning_id, |
12664 | 16 | { "Warning", "zbee_zcl_general.applctrl.ovrlwarning.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_appl_ctrl_ovrl_warning_names), |
12665 | 16 | 0x0, NULL, HFILL } } |
12666 | | |
12667 | 16 | }; |
12668 | | |
12669 | | /* ZCL ApplianceControl subtrees */ |
12670 | 16 | int *ett[ZBEE_ZCL_APPL_CTRL_NUM_ETT] = { |
12671 | 16 | &ett_zbee_zcl_appl_ctrl, |
12672 | 16 | &ett_zbee_zcl_appl_ctrl_flags, |
12673 | 16 | &ett_zbee_zcl_appl_ctrl_time |
12674 | 16 | }; |
12675 | | |
12676 | | /* initialize attribute subtree types */ |
12677 | 528 | for ( i = 0, j = ZBEE_ZCL_APPL_CTRL_NUM_GENERIC_ETT; i < ZBEE_ZCL_APPL_CTRL_NUM_FUNC_ETT; i++, j++) { |
12678 | 512 | ett[j] = &ett_zbee_zcl_appl_ctrl_func[i]; |
12679 | 512 | } |
12680 | | |
12681 | | /* Register the ZigBee ZCL ApplianceControl cluster protocol name and description */ |
12682 | 16 | proto_zbee_zcl_appl_ctrl = proto_register_protocol("ZigBee ZCL Appliance Control", "ZCL Appliance Control", ZBEE_PROTOABBREV_ZCL_APPLCTRL); |
12683 | 16 | proto_register_field_array(proto_zbee_zcl_appl_ctrl, hf, array_length(hf)); |
12684 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
12685 | | |
12686 | | /* Register the ZigBee ZCL Appliance Control dissector. */ |
12687 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_APPLCTRL, dissect_zbee_zcl_appl_ctrl, proto_zbee_zcl_appl_ctrl); |
12688 | 16 | } /*proto_register_zbee_zcl_appl_ctrl*/ |
12689 | | |
12690 | | |
12691 | | /*FUNCTION:------------------------------------------------------ |
12692 | | * NAME |
12693 | | * proto_reg_handoff_zbee_zcl_appl_ctrl |
12694 | | * DESCRIPTION |
12695 | | * Hands off the Zcl Appliance Control dissector. |
12696 | | * PARAMETERS |
12697 | | * none |
12698 | | * RETURNS |
12699 | | * void |
12700 | | *--------------------------------------------------------------- |
12701 | | */ |
12702 | | void |
12703 | | proto_reg_handoff_zbee_zcl_appl_ctrl(void) |
12704 | 16 | { |
12705 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_APPLCTRL, |
12706 | 16 | proto_zbee_zcl_appl_ctrl, |
12707 | 16 | ett_zbee_zcl_appl_ctrl, |
12708 | 16 | ZBEE_ZCL_CID_APPLIANCE_CONTROL, |
12709 | 16 | ZBEE_MFG_CODE_NONE, |
12710 | 16 | hf_zbee_zcl_appl_ctrl_attr_id, |
12711 | 16 | hf_zbee_zcl_appl_ctrl_attr_id, |
12712 | 16 | hf_zbee_zcl_appl_ctrl_srv_rx_cmd_id, |
12713 | 16 | hf_zbee_zcl_appl_ctrl_srv_tx_cmd_id, |
12714 | 16 | dissect_zcl_appl_ctrl_attr_data |
12715 | 16 | ); |
12716 | 16 | } /*proto_reg_handoff_zbee_zcl_appl_ctrl*/ |
12717 | | |
12718 | | /* ########################################################################## */ |
12719 | | /* #### (0x0020) POLL CONTROL CLUSTER ####################################### */ |
12720 | | /* ########################################################################## */ |
12721 | | |
12722 | | /*************************/ |
12723 | | /* Defines */ |
12724 | | /*************************/ |
12725 | | |
12726 | | /* Poll Control Attributes */ |
12727 | | #define ZBEE_ZCL_ATTR_ID_POLL_CTRL_CHECK_IN 0x0000 |
12728 | | #define ZBEE_ZCL_ATTR_ID_POLL_CTRL_LONG_POLL 0x0001 |
12729 | | #define ZBEE_ZCL_ATTR_ID_POLL_CTRL_SHORT_POLL 0x0002 |
12730 | | #define ZBEE_ZCL_ATTR_ID_POLL_CTRL_FAST_POLL 0x0003 |
12731 | | #define ZBEE_ZCL_ATTR_ID_POLL_CTRL_CHECK_IN_MIN 0x0004 |
12732 | | #define ZBEE_ZCL_ATTR_ID_POLL_CTRL_LONG_POLL_MIN 0x0005 |
12733 | | #define ZBEE_ZCL_ATTR_ID_POLL_CTRL_FAST_POLL_TIMEOUT 0x0006 |
12734 | | |
12735 | | static const value_string zbee_zcl_poll_ctrl_attr_names[] = { |
12736 | | { ZBEE_ZCL_ATTR_ID_POLL_CTRL_CHECK_IN, "Check-inInterval" }, |
12737 | | { ZBEE_ZCL_ATTR_ID_POLL_CTRL_LONG_POLL, "LongPollInterval" }, |
12738 | | { ZBEE_ZCL_ATTR_ID_POLL_CTRL_SHORT_POLL, "ShortPollInterval" }, |
12739 | | { ZBEE_ZCL_ATTR_ID_POLL_CTRL_FAST_POLL, "FastPollTimeout" }, |
12740 | | { ZBEE_ZCL_ATTR_ID_POLL_CTRL_CHECK_IN_MIN, "Check-inIntervalMin" }, |
12741 | | { ZBEE_ZCL_ATTR_ID_POLL_CTRL_LONG_POLL_MIN, "LongPollIntervalMin" }, |
12742 | | { ZBEE_ZCL_ATTR_ID_POLL_CTRL_FAST_POLL_TIMEOUT, "FastPollTimeoutMax" }, |
12743 | | { 0, NULL } |
12744 | | }; |
12745 | | |
12746 | | /* Server-to-client command IDs. */ |
12747 | 1 | #define ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN 0x00 |
12748 | | static const value_string zbee_zcl_poll_ctrl_srv_tx_cmd_names[] = { |
12749 | | { ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN, "Check-in" }, |
12750 | | { 0, NULL } |
12751 | | }; |
12752 | | |
12753 | | /* Client-to-server command IDs. */ |
12754 | 10 | #define ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN_RESPONSE 0x00 |
12755 | 0 | #define ZBEE_ZCL_CMD_ID_POLL_CTRL_FAST_POLL_STOP 0x01 |
12756 | 0 | #define ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_LONG_POLL 0x02 |
12757 | 1 | #define ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_SHORT_POLL 0x03 |
12758 | | static const value_string zbee_zcl_poll_ctrl_srv_rx_cmd_names[] = { |
12759 | | { ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN_RESPONSE, "Check-in Response" }, |
12760 | | { ZBEE_ZCL_CMD_ID_POLL_CTRL_FAST_POLL_STOP, "Fast Poll Stop" }, |
12761 | | { ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_LONG_POLL, "Set Long Poll Interval" }, |
12762 | | { ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_SHORT_POLL, "Set Short Poll Interval" }, |
12763 | | { 0, NULL } |
12764 | | }; |
12765 | | |
12766 | | /*************************/ |
12767 | | /* Global Variables */ |
12768 | | /*************************/ |
12769 | | /* Initialize the protocol and registered fields */ |
12770 | | static int proto_zbee_zcl_poll_ctrl; |
12771 | | |
12772 | | static int hf_zbee_zcl_poll_ctrl_attr_id; |
12773 | | static int hf_zbee_zcl_poll_ctrl_srv_rx_cmd_id; |
12774 | | static int hf_zbee_zcl_poll_ctrl_srv_tx_cmd_id; |
12775 | | static int hf_zbee_zcl_poll_ctrl_start_fast_polling; |
12776 | | static int hf_zbee_zcl_poll_ctrl_fast_poll_timeout; |
12777 | | static int hf_zbee_zcl_poll_ctrl_new_long_poll_interval; |
12778 | | static int hf_zbee_zcl_poll_ctrl_new_short_poll_interval; |
12779 | | |
12780 | | static int ett_zbee_zcl_poll_ctrl; |
12781 | | |
12782 | | /*************************/ |
12783 | | /* Function Declarations */ |
12784 | | /*************************/ |
12785 | | void proto_register_zbee_zcl_poll_ctrl(void); |
12786 | | void proto_reg_handoff_zbee_zcl_poll_ctrl(void); |
12787 | | |
12788 | | /*FUNCTION:------------------------------------------------------ |
12789 | | * NAME |
12790 | | * dissect_zbee_zcl_poll_ctrl |
12791 | | * DESCRIPTION |
12792 | | * ZigBee ZCL Poll Control cluster dissector for wireshark. |
12793 | | * PARAMETERS |
12794 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
12795 | | * packet_info *pinfo - pointer to packet information fields |
12796 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
12797 | | * void *data - pointer to ZCL packet structure. |
12798 | | * RETURNS |
12799 | | * int - length of parsed data. |
12800 | | *--------------------------------------------------------------- |
12801 | | */ |
12802 | | static int |
12803 | | dissect_zbee_zcl_poll_ctrl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) |
12804 | 64 | { |
12805 | 64 | zbee_zcl_packet *zcl; |
12806 | 64 | unsigned offset = 0; |
12807 | 64 | uint8_t cmd_id; |
12808 | | |
12809 | | /* Reject the packet if data is NULL */ |
12810 | 64 | if (data == NULL) |
12811 | 0 | return 0; |
12812 | 64 | zcl = (zbee_zcl_packet *)data; |
12813 | 64 | cmd_id = zcl->cmd_id; |
12814 | | |
12815 | 64 | if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { |
12816 | | /* Append the command name to the info column. */ |
12817 | 43 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
12818 | 43 | val_to_str_const(cmd_id, zbee_zcl_poll_ctrl_srv_rx_cmd_names, "Unknown Command"), |
12819 | 43 | zcl->tran_seqno); |
12820 | | |
12821 | | /* Add the command ID. */ |
12822 | 43 | proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
12823 | 43 | offset++; |
12824 | | |
12825 | | /* Handle the command dissection. */ |
12826 | 43 | switch (cmd_id) { |
12827 | 10 | case ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN_RESPONSE: |
12828 | 10 | proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_start_fast_polling, tvb, offset, 1, ENC_NA); |
12829 | 10 | offset++; |
12830 | 10 | proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_fast_poll_timeout, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
12831 | 10 | break; |
12832 | | |
12833 | 0 | case ZBEE_ZCL_CMD_ID_POLL_CTRL_FAST_POLL_STOP: |
12834 | | /* no payload. */ |
12835 | 0 | break; |
12836 | | |
12837 | 0 | case ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_LONG_POLL: |
12838 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_new_long_poll_interval, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
12839 | 0 | break; |
12840 | | |
12841 | 1 | case ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_SHORT_POLL: |
12842 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_new_short_poll_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
12843 | 1 | break; |
12844 | | |
12845 | 32 | default: |
12846 | 32 | break; |
12847 | 43 | } /* switch */ |
12848 | 43 | } else { |
12849 | | /* Append the command name to the info column. */ |
12850 | 21 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
12851 | 21 | val_to_str_const(cmd_id, zbee_zcl_poll_ctrl_srv_tx_cmd_names, "Unknown Command"), |
12852 | 21 | zcl->tran_seqno); |
12853 | | |
12854 | | /* Add the command ID. */ |
12855 | 21 | proto_tree_add_item(tree, hf_zbee_zcl_poll_ctrl_srv_tx_cmd_id, tvb, offset, 1, ENC_NA); |
12856 | 21 | offset++; |
12857 | | |
12858 | | /* Handle the command dissection. */ |
12859 | 21 | switch (cmd_id) { |
12860 | 1 | case ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN: |
12861 | | /* No payload - fall through. */ |
12862 | 21 | default: |
12863 | 21 | break; |
12864 | 21 | } /* switch */ |
12865 | 21 | } |
12866 | | |
12867 | 64 | return tvb_captured_length(tvb); |
12868 | 64 | } /* dissect_zbee_zcl_poll_ctrl */ |
12869 | | |
12870 | | |
12871 | | /*FUNCTION:------------------------------------------------------ |
12872 | | * NAME |
12873 | | * dissect_zcl_poll_ctrl_attr_data |
12874 | | * DESCRIPTION |
12875 | | * this function is called by ZCL foundation dissector in order to decode |
12876 | | * specific cluster attributes data. |
12877 | | * PARAMETERS |
12878 | | * proto_tree *tree - pointer to data tree Wireshark uses to display packet. |
12879 | | * tvbuff_t *tvb - pointer to buffer containing raw packet. |
12880 | | * unsigned *offset - pointer to buffer offset |
12881 | | * uint16_t attr_id - attribute identifier |
12882 | | * unsigned data_type - attribute data type |
12883 | | * bool client_attr- ZCL client |
12884 | | * RETURNS |
12885 | | * none |
12886 | | *--------------------------------------------------------------- |
12887 | | */ |
12888 | | static void |
12889 | | dissect_zcl_poll_ctrl_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id _U_, unsigned data_type, bool client_attr) |
12890 | 171 | { |
12891 | | /* Dissect attribute data type and data */ |
12892 | 171 | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
12893 | | |
12894 | 171 | } /*dissect_zcl_poll_ctrl_attr_data*/ |
12895 | | |
12896 | | /*FUNCTION:------------------------------------------------------ |
12897 | | * NAME |
12898 | | * proto_register_zbee_zcl_poll_ctrl |
12899 | | * DESCRIPTION |
12900 | | * ZigBee ZCL Poll Control cluster protocol registration. |
12901 | | * PARAMETERS |
12902 | | * none |
12903 | | * RETURNS |
12904 | | * void |
12905 | | *--------------------------------------------------------------- |
12906 | | */ |
12907 | | void |
12908 | | proto_register_zbee_zcl_poll_ctrl(void) |
12909 | 16 | { |
12910 | | /* Setup list of header fields */ |
12911 | 16 | static hf_register_info hf[] = { |
12912 | | |
12913 | 16 | { &hf_zbee_zcl_poll_ctrl_attr_id, |
12914 | 16 | { "Attribute", "zbee_zcl_general.poll.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_poll_ctrl_attr_names), |
12915 | 16 | 0x0, NULL, HFILL } }, |
12916 | | |
12917 | 16 | { &hf_zbee_zcl_poll_ctrl_srv_rx_cmd_id, |
12918 | 16 | { "Command", "zbee_zcl_general.poll.cmd.srv_rx.id", FT_UINT8, BASE_HEX, |
12919 | 16 | VALS(zbee_zcl_poll_ctrl_srv_rx_cmd_names), 0x0, NULL, HFILL }}, |
12920 | | |
12921 | 16 | { &hf_zbee_zcl_poll_ctrl_srv_tx_cmd_id, |
12922 | 16 | { "Command", "zbee_zcl_general.poll.cmd.srv_tx.id", FT_UINT8, BASE_HEX, |
12923 | 16 | VALS(zbee_zcl_poll_ctrl_srv_tx_cmd_names), 0x0, NULL, HFILL }}, |
12924 | | |
12925 | 16 | { &hf_zbee_zcl_poll_ctrl_start_fast_polling, |
12926 | 16 | { "Start Fast Polling", "zbee_zcl_general.poll.start", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
12927 | 16 | NULL, HFILL }}, |
12928 | | |
12929 | 16 | { &hf_zbee_zcl_poll_ctrl_fast_poll_timeout, |
12930 | 16 | { "Fast Poll Timeout (quarterseconds)", "zbee_zcl_general.poll.fast_timeout", FT_UINT16, BASE_DEC, NULL, |
12931 | 16 | 0x0, NULL, HFILL }}, |
12932 | | |
12933 | 16 | { &hf_zbee_zcl_poll_ctrl_new_long_poll_interval, |
12934 | 16 | { "New Long Poll Interval", "zbee_zcl_general.poll.new_long_interval", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, |
12935 | 16 | HFILL }}, |
12936 | | |
12937 | 16 | { &hf_zbee_zcl_poll_ctrl_new_short_poll_interval, |
12938 | 16 | { "New Short Poll Interval", "zbee_zcl_general.poll.new_short_interval", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, |
12939 | 16 | HFILL }} |
12940 | 16 | }; |
12941 | | |
12942 | | /* ZCL Poll Control subtrees */ |
12943 | 16 | static int *ett[] = { |
12944 | 16 | &ett_zbee_zcl_poll_ctrl |
12945 | 16 | }; |
12946 | | |
12947 | | /* Register the ZigBee ZCL Poll Control cluster protocol name and description */ |
12948 | 16 | proto_zbee_zcl_poll_ctrl = proto_register_protocol("ZigBee ZCL Poll Control", "ZCL Poll Control", ZBEE_PROTOABBREV_ZCL_POLL); |
12949 | 16 | proto_register_field_array(proto_zbee_zcl_poll_ctrl, hf, array_length(hf)); |
12950 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
12951 | | |
12952 | | /* Register the ZigBee ZCL Poll Control dissector. */ |
12953 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_POLL, dissect_zbee_zcl_poll_ctrl, proto_zbee_zcl_poll_ctrl); |
12954 | 16 | } /*proto_register_zbee_zcl_poll_ctrl*/ |
12955 | | |
12956 | | /*FUNCTION:------------------------------------------------------ |
12957 | | * NAME |
12958 | | * proto_reg_handoff_zbee_zcl_poll_ctrl |
12959 | | * DESCRIPTION |
12960 | | * Hands off the ZCL Poll Control dissector. |
12961 | | * PARAMETERS |
12962 | | * none |
12963 | | * RETURNS |
12964 | | * none |
12965 | | *--------------------------------------------------------------- |
12966 | | */ |
12967 | | void |
12968 | | proto_reg_handoff_zbee_zcl_poll_ctrl(void) |
12969 | 16 | { |
12970 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_POLL, |
12971 | 16 | proto_zbee_zcl_poll_ctrl, |
12972 | 16 | ett_zbee_zcl_poll_ctrl, |
12973 | 16 | ZBEE_ZCL_CID_POLL_CONTROL, |
12974 | 16 | ZBEE_MFG_CODE_NONE, |
12975 | 16 | hf_zbee_zcl_poll_ctrl_attr_id, |
12976 | 16 | hf_zbee_zcl_poll_ctrl_attr_id, |
12977 | 16 | hf_zbee_zcl_poll_ctrl_srv_rx_cmd_id, |
12978 | 16 | hf_zbee_zcl_poll_ctrl_srv_tx_cmd_id, |
12979 | 16 | dissect_zcl_poll_ctrl_attr_data |
12980 | 16 | ); |
12981 | 16 | } /*proto_reg_handoff_zbee_zcl_poll_ctrl*/ |
12982 | | |
12983 | | |
12984 | | |
12985 | | /* ########################################################################## */ |
12986 | | /* #### (0x0021) GREEN POWER CLUSTER ######################################## */ |
12987 | | /* ########################################################################## */ |
12988 | | |
12989 | | /*************************/ |
12990 | | /* Defines */ |
12991 | | /*************************/ |
12992 | | |
12993 | | /* Green Power Attributes */ |
12994 | | |
12995 | | #define ZBEE_ZCL_ATTR_GPS_MAX_SINK_TABLE_ENTRIES 0x0000 |
12996 | 318 | #define ZBEE_ZCL_ATTR_GPS_SINK_TABLE 0x0001 |
12997 | 40 | #define ZBEE_ZCL_ATTR_GPS_COMMUNICATION_MODE 0x0002 |
12998 | 82 | #define ZBEE_ZCL_ATTR_GPS_COMMISSIONING_EXIT_MODE 0x0003 |
12999 | | #define ZBEE_ZCL_ATTR_GPS_COMMISSIONING_WINDOW 0x0004 |
13000 | 44 | #define ZBEE_ZCL_ATTR_GPS_SECURITY_LEVEL 0x0005 |
13001 | 50 | #define ZBEE_ZCL_ATTR_GPS_FUNCTIONALITY 0x0006 |
13002 | 7 | #define ZBEE_ZCL_ATTR_GPS_ACTIVE_FUNCTIONALITY 0x0007 |
13003 | | #define ZBEE_ZCL_ATTR_GPP_MAX_PROXY_TABLE_ENTRIES 0x0010 |
13004 | 136 | #define ZBEE_ZCL_ATTR_GPP_PROXY_TABLE 0x0011 |
13005 | | #define ZBEE_ZCL_ATTR_GPP_NOTIFICATION_RETRY_NUMBER 0x0012 |
13006 | | #define ZBEE_ZCL_ATTR_GPP_NOTIFICATION_RETRY_TIMER 0x0013 |
13007 | | #define ZBEE_ZCL_ATTR_GPP_MAX_SEARCH_COUNTER 0x0014 |
13008 | | #define ZBEE_ZCL_ATTR_GPP_BLOCKED_GPDID 0x0015 |
13009 | 14 | #define ZBEE_ZCL_ATTR_GPP_FUNCTIONALITY 0x0016 |
13010 | 11 | #define ZBEE_ZCL_ATTR_GPP_ACTIVE_FUNCTIONALITY 0x0017 |
13011 | | #define ZBEE_ZCL_ATTR_GP_SHARED_SECURITY_KEY_TYPE 0x0020 |
13012 | | #define ZBEE_ZCL_ATTR_GP_SHARED_SECURITY_KEY 0x0021 |
13013 | | #define ZBEE_ZCL_ATTR_GP_LINK_KEY 0x0022 |
13014 | | |
13015 | | static const value_string zbee_zcl_gp_attr_names[] = { |
13016 | | { ZBEE_ZCL_ATTR_GPS_MAX_SINK_TABLE_ENTRIES, "gpsMaxSinkTableEntries" }, |
13017 | | { ZBEE_ZCL_ATTR_GPS_SINK_TABLE, "SinkTable" }, |
13018 | | { ZBEE_ZCL_ATTR_GPS_COMMUNICATION_MODE, "gpsCommunicationMode" }, |
13019 | | { ZBEE_ZCL_ATTR_GPS_COMMISSIONING_EXIT_MODE, "gpsCommissioningExitMode" }, |
13020 | | { ZBEE_ZCL_ATTR_GPS_COMMISSIONING_WINDOW, "gpsCommissioningWindow" }, |
13021 | | { ZBEE_ZCL_ATTR_GPS_SECURITY_LEVEL, "gpsSecurityLevel" }, |
13022 | | { ZBEE_ZCL_ATTR_GPS_FUNCTIONALITY, "gpsFunctionality" }, |
13023 | | { ZBEE_ZCL_ATTR_GPS_ACTIVE_FUNCTIONALITY, "gpsActiveFunctionality" }, |
13024 | | { ZBEE_ZCL_ATTR_GPP_MAX_PROXY_TABLE_ENTRIES, "gppMaxProxyTableEntries" }, |
13025 | | { ZBEE_ZCL_ATTR_GPP_PROXY_TABLE, "ProxyTable" }, |
13026 | | { ZBEE_ZCL_ATTR_GPP_NOTIFICATION_RETRY_NUMBER, "gppNotificationRetryNumber" }, |
13027 | | { ZBEE_ZCL_ATTR_GPP_NOTIFICATION_RETRY_TIMER, "gppNotificationRetryTimer" }, |
13028 | | { ZBEE_ZCL_ATTR_GPP_MAX_SEARCH_COUNTER, "gppMaxSearchCounter" }, |
13029 | | { ZBEE_ZCL_ATTR_GPP_BLOCKED_GPDID, "gppBlockedGPDID" }, |
13030 | | { ZBEE_ZCL_ATTR_GPP_FUNCTIONALITY, "gppFunctionality" }, |
13031 | | { ZBEE_ZCL_ATTR_GPP_ACTIVE_FUNCTIONALITY, "gppActiveFunctionality" }, |
13032 | | { ZBEE_ZCL_ATTR_GP_SHARED_SECURITY_KEY_TYPE, "gpSharedSecurityKeyType" }, |
13033 | | { ZBEE_ZCL_ATTR_GP_SHARED_SECURITY_KEY, "gpSharedSecurityKey" }, |
13034 | | { ZBEE_ZCL_ATTR_GP_LINK_KEY, "gpLinkKey" }, |
13035 | | { 0, NULL } |
13036 | | }; |
13037 | | |
13038 | | /* Server-to-client command IDs. */ |
13039 | 6 | #define ZBEE_ZCL_CMD_ID_GP_NOTIFICATION_RESPONSE 0x00 |
13040 | 9 | #define ZBEE_ZCL_CMD_ID_GP_PAIRING 0x01 |
13041 | 10 | #define ZBEE_ZCL_CMD_ID_GP_PROXY_COMMISSIONING_MODE 0x02 |
13042 | 1 | #define ZBEE_ZCL_CMD_ID_GP_RESPONSE 0x06 |
13043 | 0 | #define ZBEE_ZCL_CMD_ID_GP_TRANS_TBL_RESPONSE 0x08 |
13044 | 51 | #define ZBEE_ZCL_CMD_ID_GP_SINK_TABLE_RESPONSE 0x0a |
13045 | 2 | #define ZBEE_ZCL_CMD_ID_GP_PROXY_TABLE_REQUEST 0x0b |
13046 | | |
13047 | | static const value_string zbee_zcl_gp_srv_tx_cmd_names[] = { |
13048 | | { ZBEE_ZCL_CMD_ID_GP_NOTIFICATION_RESPONSE, "GP Notification Response" }, |
13049 | | { ZBEE_ZCL_CMD_ID_GP_PAIRING, "GP Pairing" }, |
13050 | | { ZBEE_ZCL_CMD_ID_GP_PROXY_COMMISSIONING_MODE, "GP Proxy Commissioning Mode" }, |
13051 | | { ZBEE_ZCL_CMD_ID_GP_RESPONSE, "GP Response" }, |
13052 | | { ZBEE_ZCL_CMD_ID_GP_TRANS_TBL_RESPONSE, "GP Translation Table Response" }, |
13053 | | { ZBEE_ZCL_CMD_ID_GP_SINK_TABLE_RESPONSE, "GP Sink Table Response" }, |
13054 | | { ZBEE_ZCL_CMD_ID_GP_PROXY_TABLE_REQUEST, "GP Proxy Table Request" }, |
13055 | | { 0, NULL } |
13056 | | }; |
13057 | | |
13058 | | /* Client-to-server command IDs. */ |
13059 | 33 | #define ZBEE_CMD_ID_GP_NOTIFICATION 0x00 |
13060 | 32 | #define ZBEE_CMD_ID_GP_PAIRING_SEARCH 0x01 |
13061 | 34 | #define ZBEE_CMD_ID_GP_TUNNELING_STOP 0x03 |
13062 | 3 | #define ZBEE_CMD_ID_GP_COMMISSIONING_NOTIFICATION 0x04 |
13063 | 2 | #define ZBEE_CMD_ID_GP_SINK_COMMISSIONING_MODE 0x05 |
13064 | 0 | #define ZBEE_CMD_ID_GP_TRANSLATION_TABLE_UPDATE_COMMAND 0x07 |
13065 | 1 | #define ZBEE_CMD_ID_GP_TRANSLATION_TABLE_REQUEST 0x08 |
13066 | 57 | #define ZBEE_CMD_ID_GP_PAIRING_CONFIGURATION 0x09 |
13067 | 5 | #define ZBEE_CMD_ID_GP_SINK_TABLE_REQUEST 0x0a |
13068 | 3 | #define ZBEE_CMD_ID_GP_PROXY_TABLE_RESPONSE 0x0b |
13069 | | |
13070 | | static const value_string zbee_zcl_gp_srv_rx_cmd_names[] = { |
13071 | | { ZBEE_CMD_ID_GP_NOTIFICATION, "GP Notification" }, |
13072 | | { ZBEE_CMD_ID_GP_PAIRING_SEARCH, "GP Pairing Search" }, |
13073 | | { ZBEE_CMD_ID_GP_TUNNELING_STOP, "GP Tunneling Stop" }, |
13074 | | { ZBEE_CMD_ID_GP_COMMISSIONING_NOTIFICATION, "GP Commissioning Notification" }, |
13075 | | { ZBEE_CMD_ID_GP_SINK_COMMISSIONING_MODE, "GP Sink Commissioning Mode" }, |
13076 | | { ZBEE_CMD_ID_GP_TRANSLATION_TABLE_UPDATE_COMMAND, "GP Translation Table Update" }, |
13077 | | { ZBEE_CMD_ID_GP_TRANSLATION_TABLE_REQUEST, "GP Translation Table Request" }, |
13078 | | { ZBEE_CMD_ID_GP_PAIRING_CONFIGURATION, "GP Pairing Configuration" }, |
13079 | | { ZBEE_CMD_ID_GP_SINK_TABLE_REQUEST, "GP Sink Table Request" }, |
13080 | | { ZBEE_CMD_ID_GP_PROXY_TABLE_RESPONSE, "GP Proxy Table Response" }, |
13081 | | { 0, NULL } |
13082 | | }; |
13083 | | |
13084 | | static const value_string zbee_zcl_gp_comm_mode_actions[] = { |
13085 | | { 0, "Exit commissioning mode" }, |
13086 | | { 1, "Enter commissioning mode" }, |
13087 | | { 0, NULL } |
13088 | | }; |
13089 | | |
13090 | | static const value_string zbee_zcl_gp_app_ids[] = { |
13091 | | { 0, "0b000 4b SrcID; no Endpoint" }, |
13092 | | { 2, "0b010 8b IEEE; Endpoint presents" }, |
13093 | | { 0, NULL } |
13094 | | }; |
13095 | | |
13096 | | static const value_string zbee_zcl_gp_secur_levels[] = { |
13097 | | { 0, "No security" }, |
13098 | | { 1, "Reserved" }, |
13099 | | { 2, "4B frame counter and 4B MIC only" }, |
13100 | | { 3, "Encryption & 4B frame counter and 4B MIC" }, |
13101 | | { 0, NULL } |
13102 | | }; |
13103 | | |
13104 | | static const value_string zbee_zcl_gp_secur_key_types[] = { |
13105 | | { 0, "No key" }, |
13106 | | { 1, "ZigBee NWK key" }, |
13107 | | { 2, "GPD group key" }, |
13108 | | { 3, "NWK-key derived GPD group key" }, |
13109 | | { 4, "(individual) out-of-the-box GPD key" }, |
13110 | | { 7, "Derived individual GPD key" }, |
13111 | | { 0, NULL } |
13112 | | }; |
13113 | | |
13114 | | static const value_string zbee_zcl_gp_communication_modes[] = { |
13115 | | { 0, "Full unicast" }, |
13116 | | { 1, "Groupcast to DGroupID" }, |
13117 | | { 2, "Groupcast to pre-commissioned GroupID" }, |
13118 | | { 3, "Lightweight unicast" }, |
13119 | | { 0, NULL } |
13120 | | }; |
13121 | | |
13122 | | static const value_string zbee_zcl_gp_lqi_vals[] = { |
13123 | | { 0, "Poor" }, |
13124 | | { 1, "Moderate" }, |
13125 | | { 2, "High" }, |
13126 | | { 3, "Excellent" }, |
13127 | | { 0, NULL } |
13128 | | }; |
13129 | | |
13130 | | static const value_string zbee_zcl_gp_channels[] = { |
13131 | | { 0, "Channel 11" }, |
13132 | | { 1, "Channel 12" }, |
13133 | | { 2, "Channel 13" }, |
13134 | | { 3, "Channel 14" }, |
13135 | | { 4, "Channel 15" }, |
13136 | | { 5, "Channel 16" }, |
13137 | | { 6, "Channel 17" }, |
13138 | | { 7, "Channel 18" }, |
13139 | | { 8, "Channel 19" }, |
13140 | | { 9, "Channel 20" }, |
13141 | | { 10, "Channel 21" }, |
13142 | | { 11, "Channel 22" }, |
13143 | | { 12, "Channel 23" }, |
13144 | | { 13, "Channel 24" }, |
13145 | | { 14, "Channel 25" }, |
13146 | | { 15, "Channel 26" }, |
13147 | | { 0, NULL } |
13148 | | }; |
13149 | | |
13150 | | static const value_string zbee_gp_pc_actions[] = { |
13151 | | { 0, "No action" }, |
13152 | | { 1, "Extend Sink Table entry" }, |
13153 | | { 2, "Replace Sink Table entry" }, |
13154 | | { 3, "Remove a pairing" }, |
13155 | | { 4, "Remove GPD" }, |
13156 | | { 0, NULL } |
13157 | | }; |
13158 | | |
13159 | | static const value_string zbee_zcl_gp_proxy_sink_tbl_req_type[] = { |
13160 | | { 0, "Request table entries by GPD ID" }, |
13161 | | { 1, "Request table entries by Index" }, |
13162 | | { 0, NULL } |
13163 | | }; |
13164 | | |
13165 | 26 | #define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ACTION 1 |
13166 | 32 | #define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_EXIT_MODE (7<<1) |
13167 | 26 | #define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_COMMISSIONING_WINDOW_EXPIRATION ((1<<0)<<1) |
13168 | 16 | #define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_PAIRING_SUCCESS ((1<<1)<<1) |
13169 | 16 | #define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_GP_PROXY_COMM_MODE ((1<<2)<<1) |
13170 | 26 | #define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_CHANNEL_PRESENT (1<<4) |
13171 | 16 | #define ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_UNICAST (1<<5) |
13172 | | |
13173 | | |
13174 | 19 | #define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_APP_ID (7<<0) |
13175 | 16 | #define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_RX_AFTER_TX (1<<3) |
13176 | 16 | #define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_LEVEL (3<<4) |
13177 | 16 | #define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_KEY_TYPE (7<<6) |
13178 | 19 | #define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_FAILED (1<<9) |
13179 | 16 | #define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_BIDIR_CAP (1<<10) |
13180 | 19 | #define ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_PROXY_INFO_PRESENT (1<<11) |
13181 | | |
13182 | 16 | #define ZBEE_ZCL_GP_GPP_GPD_LINK_RSSI 0x3f |
13183 | 16 | #define ZBEE_ZCL_GP_GPP_GPD_LINK_LQI (3<<6) |
13184 | | |
13185 | 49 | #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_APP_ID (7<<0) |
13186 | 16 | #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_UNICAST (1<<3) |
13187 | 16 | #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_DERIVED_GROUP (1<<4) |
13188 | 16 | #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_COMMISSIONED_GROUP (1<<5) |
13189 | 16 | #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_SECUR_LEVEL (3<<6) |
13190 | 16 | #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_SECUR_KEY_TYPE (7<<8) |
13191 | 16 | #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_RX_AFTER_TX (1<<11) |
13192 | 16 | #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_TX_Q_FULL (1<<12) |
13193 | 16 | #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_BIDIR_CAP (1<<13) |
13194 | 49 | #define ZBEE_ZCL_GP_NOTIFICATION_OPTION_PROXY_INFO_PRESENT (1<<14) |
13195 | | |
13196 | 25 | #define ZBEE_ZCL_GP_PAIRING_OPTION_APP_ID (7<<0) |
13197 | 25 | #define ZBEE_ZCL_GP_PAIRING_OPTION_ADD_SINK (1<<3) |
13198 | 34 | #define ZBEE_ZCL_GP_PAIRING_OPTION_REMOVE_GPD (1<<4) |
13199 | 40 | #define ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE (3<<5) |
13200 | 16 | #define ZBEE_ZCL_GP_PAIRING_OPTION_GPD_FIXED (1<<7) |
13201 | 16 | #define ZBEE_ZCL_GP_PAIRING_OPTION_GPD_MAC_SEQ_NUM_CAP (1<<8) |
13202 | 16 | #define ZBEE_ZCL_GP_PAIRING_OPTION_SECUR_LEVEL (3<<9) |
13203 | 16 | #define ZBEE_ZCL_GP_PAIRING_OPTION_SECUR_KEY_TYPE (7<<11) |
13204 | 25 | #define ZBEE_ZCL_GP_PAIRING_OPTION_GPD_FRAME_CNT_PRESENT (1<<14) |
13205 | 25 | #define ZBEE_ZCL_GP_PAIRING_OPTION_GPD_SECUR_KEY_PRESENT (1<<15) |
13206 | 25 | #define ZBEE_ZCL_GP_PAIRING_OPTION_ASSIGNED_ALIAS_PRESENT (1<<16) |
13207 | 25 | #define ZBEE_ZCL_GP_PAIRING_OPTION_FWD_RADIUS_PRESENT (1<<17) |
13208 | | |
13209 | 17 | #define ZBEE_ZCL_GP_RESPONSE_OPTION_APP_ID (7<<0) |
13210 | 16 | #define ZBEE_ZCL_GP_RESPONSE_OPTION_TX_ON_ENDPOINT_MATCH (1<<3) |
13211 | | |
13212 | 16 | #define ZBEE_ZCL_GP_RESPONSE_TX_CHANNEL (0xf<<0) |
13213 | | |
13214 | 16 | #define ZBEE_ZCL_GP_CMD_PC_ACTIONS_ACTION (7<<0) |
13215 | 16 | #define ZBEE_ZCL_GP_CMD_PC_ACTIONS_SEND_GP_PAIRING (1<<3) |
13216 | | |
13217 | 73 | #define ZBEE_ZCL_GP_CMD_PC_OPT_APP_ID (7<<0) |
13218 | 73 | #define ZBEE_ZCL_GP_CMD_PC_OPT_COMMUNICATION_MODE (3<<3) |
13219 | 16 | #define ZBEE_ZCL_GP_CMD_PC_OPT_SEQ_NUMBER_CAP (1<<5) |
13220 | 16 | #define ZBEE_ZCL_GP_CMD_PC_OPT_RX_ON_CAP (1<<6) |
13221 | 16 | #define ZBEE_ZCL_GP_CMD_PC_OPT_FIXED_LOCATION (1<<7) |
13222 | 73 | #define ZBEE_ZCL_GP_CMD_PC_OPT_ASSIGNED_ALIAS (1<<8) |
13223 | 73 | #define ZBEE_ZCL_GP_CMD_PC_OPT_SECURITY_USE (1<<9) |
13224 | 73 | #define ZBEE_ZCL_GP_CMD_PC_OPT_APP_INFO_PRESENT (1<<10) |
13225 | 378 | #define ZBEE_ZCL_GP_COMMUNICATION_MODE_GROUPCAST_PRECOMMISSIONED 2 |
13226 | 57 | #define ZBEE_ZCL_GP_PAIRING_CONFIGURATION_OPTION_COMMUNICATION_MODE_SHIFT 3 |
13227 | 16 | #define ZBEE_ZCL_GP_CMD_PC_SECUR_LEVEL (3<<0) |
13228 | 16 | #define ZBEE_ZCL_GP_CMD_PC_SECUR_KEY_TYPE (7<<2) |
13229 | 54 | #define ZBEE_ZCL_GP_CMD_PC_APP_INFO_MANUF_ID_PRESENT (1<<0) |
13230 | 54 | #define ZBEE_ZCL_GP_CMD_PC_APP_INFO_MODEL_ID_PRESENT (1<<1) |
13231 | 54 | #define ZBEE_ZCL_GP_CMD_PC_APP_INFO_GPD_COMMANDS_PRESENT (1<<2) |
13232 | 54 | #define ZBEE_ZCL_GP_CMD_PC_APP_INFO_CLUSTER_LIST_PRESENT (1<<3) |
13233 | 39 | #define ZBEE_ZCL_GP_CLUSTER_LIST_LEN_SRV (0xf<<0) |
13234 | 39 | #define ZBEE_ZCL_GP_CLUSTER_LIST_LEN_CLI (0xf<<4) |
13235 | 23 | #define ZBEE_ZCL_GP_CLUSTER_LIST_LEN_CLI_SHIFT 4 |
13236 | | |
13237 | 23 | #define ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_APP_ID (0x07<<0) |
13238 | 23 | #define ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_REQ_TYPE (0x03<<3) |
13239 | 7 | #define ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_REQ_TYPE_SHIFT 3 |
13240 | | |
13241 | 942 | #define ZBEE_ZCL_GP_SINK_TBL_OPT_APP_ID (7<<0) |
13242 | 658 | #define ZBEE_ZCL_GP_SINK_TBL_OPT_COMMUNICATION_MODE (3<<3) |
13243 | 264 | #define ZBEE_ZCL_GP_SINK_TBL_OPT_SEQ_NUMBER_CAP (1<<5) |
13244 | 16 | #define ZBEE_ZCL_GP_SINK_TBL_OPT_RX_ON_CAP (1<<6) |
13245 | 16 | #define ZBEE_ZCL_GP_SINK_TBL_OPT_FIXED_LOCATION (1<<7) |
13246 | 337 | #define ZBEE_ZCL_GP_SINK_TBL_OPT_ASSIGNED_ALIAS (1<<8) |
13247 | 979 | #define ZBEE_ZCL_GP_SINK_TBL_OPT_SECURITY_USE (1<<9) |
13248 | | |
13249 | 1.53k | #define ZBEE_ZCL_GP_PROXY_TBL_OPT_APP_ID (7<<0) |
13250 | 699 | #define ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_ACTIVE (1<<3) |
13251 | 199 | #define ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_VALID (1<<4) |
13252 | 594 | #define ZBEE_ZCL_GP_PROXY_TBL_OPT_SEQ_NUMBER_CAP (1<<5) |
13253 | 699 | #define ZBEE_ZCL_GP_PROXY_TBL_OPT_LW_UCAST_GPS (1<<6) |
13254 | 16 | #define ZBEE_ZCL_GP_PROXY_TBL_OPT_DERIVED_GROUP_GPS (1<<7) |
13255 | 699 | #define ZBEE_ZCL_GP_PROXY_TBL_OPT_COMM_GROUP_GPS (1<<8) |
13256 | 16 | #define ZBEE_ZCL_GP_PROXY_TBL_OPT_FIRST_TO_FORWARD (1<<9) |
13257 | 16 | #define ZBEE_ZCL_GP_PROXY_TBL_OPT_IN_RANGE (1<<10) |
13258 | 16 | #define ZBEE_ZCL_GP_PROXY_TBL_OPT_GPD_FIXED (1<<11) |
13259 | 16 | #define ZBEE_ZCL_GP_PROXY_TBL_OPT_HAS_ALL_UCAST_ROUTES (1<<12) |
13260 | 699 | #define ZBEE_ZCL_GP_PROXY_TBL_OPT_ASSIGNED_ALIAS (1<<13) |
13261 | 2.06k | #define ZBEE_ZCL_GP_PROXY_TBL_OPT_SECURITY_USE (1<<14) |
13262 | 699 | #define ZBEE_ZCL_GP_PROXY_TBL_OPT_OPTIONS_EXTENTIONS (1<<15) |
13263 | | |
13264 | 699 | #define ZBEE_ZCL_GP_PROXY_TBL_EXT_OPT_FULL_UCAST_GPS (1<<0) |
13265 | | |
13266 | 16 | #define ZBEE_ZCL_GP_SECUR_OPT_SECUR_LEVEL (3<<0) |
13267 | 16 | #define ZBEE_ZCL_GP_SECUR_OPT_SECUR_KEY_TYPE (7<<2) |
13268 | | |
13269 | | /* Sink Commissioning Mode command */ |
13270 | 16 | #define ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_ACTION (1<<0) |
13271 | 16 | #define ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_GPM_IN_SECUR (1<<1) |
13272 | 16 | #define ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_GPM_IN_PAIRING (1<<2) |
13273 | 16 | #define ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_PROXIES (1<<3) |
13274 | | |
13275 | | /* gppFunctionality attribute */ |
13276 | 16 | #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GP_FEATURE (1<<0) |
13277 | 16 | #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_DIRECT_COMM (1<<1) |
13278 | 16 | #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_DERIVED_GCAST_COMM (1<<2) |
13279 | 16 | #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_PRE_COMMISSIONED_GCAST_COMM (1<<3) |
13280 | 16 | #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_FULL_UCAST_COMM (1<<4) |
13281 | 16 | #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_LW_UCAST_COMM (1<<5) |
13282 | 16 | #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_BIDIR_OP (1<<7) |
13283 | 16 | #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_PROXY_TBL_MAINTENANCE (1<<8) |
13284 | 16 | #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GP_COMMISSIONING (1<<10) |
13285 | 16 | #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_CT_BASED_COMMISSIONING (1<<11) |
13286 | 16 | #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_MAINTENANCE_OF_GPD (1<<12) |
13287 | 16 | #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_00 (1<<13) |
13288 | 16 | #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_01 (1<<14) |
13289 | 16 | #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_10 (1<<15) |
13290 | 16 | #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_11 (1<<16) |
13291 | 16 | #define ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_IEEE_ADDRESS (1<<19) |
13292 | | /* gppActiveFunctionality attribute */ |
13293 | 16 | #define ZBEE_ZCL_GP_ATTR_GPP_ACTIVE_FUNC_FLD_GP_FUNCTIONALITY (1<<0) |
13294 | | |
13295 | | /* gpsFunctionality attribute */ |
13296 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GP_FEATURE (1<<0) |
13297 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_DIRECT_COMM (1<<1) |
13298 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_DERIVED_GCAST_COMM (1<<2) |
13299 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PRE_COMMISSIONED_GCAST_COMM (1<<3) |
13300 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_FULL_UCAST_COMM (1<<4) |
13301 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_LW_UCAST_COMM (1<<5) |
13302 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXIMITY_BIDIR_OP (1<<6) |
13303 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MULTI_HOP_BIDIR_OP (1<<7) |
13304 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXY_TBL_MAINTENANCE (1<<8) |
13305 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXIMITY_COMMISSIONING (1<<9) |
13306 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MULTI_HOP_COMMISSIONING (1<<10) |
13307 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_CT_BASED_COMMISSIONING (1<<11) |
13308 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MAINTENANCE_OF_GPD (1<<12) |
13309 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_00 (1<<13) |
13310 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_01 (1<<14) |
13311 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_10 (1<<15) |
13312 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_11 (1<<16) |
13313 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_SINK_TBL_BASED_GCAST_FORWARDING (1<<17) |
13314 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_TRANSLATION_TABLE (1<<18) |
13315 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_IEEE_ADDRESS (1<<19) |
13316 | | /* gpsActiveFunctionality attribute */ |
13317 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_ACTIVE_FUNC_FLD_GP_FUNCTIONALITY (1<<0) |
13318 | | |
13319 | | /* gpsCommissioningExitMode attribute */ |
13320 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_COMM_WINDOW_EXPIRE (1<<0) |
13321 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_PAIRING_SUCCESS (1<<1) |
13322 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_GP_PROXY_COMM_MODE (1<<2) |
13323 | | |
13324 | | /* gpsCommunicationMode attribute */ |
13325 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_COMMUNICATION_MODE_FLD_MODE (3<<0) |
13326 | | |
13327 | | /* gpsSecurityLevel attribute */ |
13328 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_MIN_GPD_SECUR_LVL (3<<0) |
13329 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_PROTECTION_WITH_GP_LINK_KEY (1<<2) |
13330 | 16 | #define ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_INVOLVE_TC (1<<3) |
13331 | | |
13332 | | /* Definitions for application IDs. */ |
13333 | 823 | #define ZBEE_ZCL_GP_APP_ID_DEFAULT 0x00 |
13334 | 211 | #define ZBEE_ZCL_GP_APP_ID_ZGP 0x02 |
13335 | | |
13336 | | /** Definitions for Request type sub-field of the Options field of the |
13337 | | * GP Sink Table Request and GP Proxy Table request commands |
13338 | | */ |
13339 | 7 | #define ZBEE_ZCL_GP_PROXY_SINK_TABLE_REQ_CMD_REQUSET_BY_GPD_ID 0 |
13340 | 6 | #define ZBEE_ZCL_GP_PROXY_SINK_TABLE_REQ_CMD_REQUSET_BY_INDEX 1 |
13341 | | |
13342 | | /*************************/ |
13343 | | /* Global Variables */ |
13344 | | /*************************/ |
13345 | | /* Initialize the protocol and registered fields */ |
13346 | | static int proto_zbee_zcl_gp; |
13347 | | |
13348 | | static int hf_zbee_zcl_gp_attr_id; |
13349 | | static int hf_zbee_zcl_gp_srv_rx_cmd_id; |
13350 | | static int hf_zbee_zcl_gp_srv_tx_cmd_id; |
13351 | | |
13352 | | static int ett_zbee_zcl_gp; |
13353 | | |
13354 | | /* GP_PROXY_COMMISSIONING_MODE */ |
13355 | | static int ett_zbee_gp_cmd_proxy_commissioning_mode_options; |
13356 | | static int ett_zbee_gp_cmd_proxy_commissioning_mode_exit_mode; |
13357 | | static int hf_zbee_gp_cmd_proxy_commissioning_mode_options; |
13358 | | static int hf_zbee_gp_cmd_pcm_opt_action; |
13359 | | static int hf_zbee_gp_cmd_pcm_opt_exit_mode; |
13360 | | static int hf_zbee_gp_cmd_pcm_opt_channel_present; |
13361 | | static int hf_zbee_gp_cmd_pcm_opt_unicast_comm; |
13362 | | static int hf_zbee_gp_cmd_proxy_commissioning_mode_exit_mode; |
13363 | | static int hf_zbee_gp_cmd_pcm_exit_mode_on_comm_window_expire; |
13364 | | static int hf_zbee_gp_cmd_pcm_exit_mode_on_pairing_success; |
13365 | | static int hf_zbee_gp_cmd_pcm_exit_mode_on_gp_proxy_comm_mode; |
13366 | | static int hf_zbee_zcl_gp_commissioning_window; |
13367 | | static int hf_zbee_zcl_gp_channel; |
13368 | | |
13369 | | /* GP_COMMISSIONING_NOTIFICATION */ |
13370 | | static int hf_zbee_gp_cmd_comm_notif_opt_app_id; |
13371 | | static int hf_zbee_gp_cmd_comm_notif_opt_rx_after_tx; |
13372 | | static int hf_zbee_gp_cmd_comm_notif_opt_secur_level; |
13373 | | static int hf_zbee_gp_cmd_comm_notif_opt_secur_key_type; |
13374 | | static int hf_zbee_gp_cmd_comm_notif_opt_secur_fail; |
13375 | | static int hf_zbee_gp_cmd_comm_notif_opt_bidir_cap; |
13376 | | static int hf_zbee_gp_cmd_comm_notif_opt_proxy_info_present; |
13377 | | static int hf_zbee_gp_cmd_commissioning_notification_options; |
13378 | | static int ett_zbee_gp_cmd_commissioning_notification_options; |
13379 | | static int hf_zbee_gp_src_id; |
13380 | | static int hf_zbee_gp_ieee; |
13381 | | static int hf_zbee_gp_endpoint; |
13382 | | static int hf_zbee_gp_secur_frame_counter; |
13383 | | static int hf_zbee_gp_gpd_command_id; |
13384 | | static int hf_zbee_gp_short_addr; |
13385 | | static int hf_zbee_gp_gpp_gpd_link; |
13386 | | static int hf_zbee_gp_mic; |
13387 | | static int ett_zbee_gp_gpp_gpd_link; |
13388 | | static int hf_zbee_gpp_gpd_link_rssi; |
13389 | | static int hf_zbee_gpp_gpd_link_lqi; |
13390 | | static int hf_zbee_gp_gpd_payload_size; |
13391 | | |
13392 | | |
13393 | | /* GP_NOTIFICATION */ |
13394 | | static int hf_zbee_gp_cmd_notification_options; |
13395 | | static int ett_zbee_gp_cmd_notification_options; |
13396 | | static int hf_zbee_gp_cmd_notif_opt_app_id; |
13397 | | static int hf_zbee_gp_cmd_notif_opt_also_unicast; |
13398 | | static int hf_zbee_gp_cmd_notif_opt_also_derived_group; |
13399 | | static int hf_zbee_gp_cmd_notif_opt_also_comm_group; |
13400 | | static int hf_zbee_gp_cmd_notif_opt_secur_level; |
13401 | | static int hf_zbee_gp_cmd_notif_opt_secur_key_type; |
13402 | | static int hf_zbee_gp_cmd_notif_opt_rx_after_tx; |
13403 | | static int hf_zbee_gp_cmd_notif_opt_tx_q_full; |
13404 | | static int hf_zbee_gp_cmd_notif_opt_bidir_cap; |
13405 | | static int hf_zbee_gp_cmd_notif_opt_proxy_info_present; |
13406 | | |
13407 | | /* GP_PAIRING */ |
13408 | | static int hf_zbee_gp_cmd_pairing_opt_app_id; |
13409 | | static int hf_zbee_gp_cmd_pairing_opt_add_sink; |
13410 | | static int hf_zbee_gp_cmd_pairing_opt_remove_gpd; |
13411 | | static int hf_zbee_gp_cmd_pairing_opt_communication_mode; |
13412 | | static int hf_zbee_gp_cmd_pairing_opt_gpd_fixed; |
13413 | | static int hf_zbee_gp_cmd_pairing_opt_gpd_mac_seq_num_cap; |
13414 | | static int hf_zbee_gp_cmd_pairing_opt_secur_level; |
13415 | | static int hf_zbee_gp_cmd_pairing_opt_secur_key_type; |
13416 | | static int hf_zbee_gp_cmd_pairing_opt_gpd_frame_cnt_present; |
13417 | | static int hf_zbee_gp_cmd_pairing_opt_gpd_secur_key_present; |
13418 | | static int hf_zbee_gp_cmd_pairing_opt_assigned_alias_present; |
13419 | | static int hf_zbee_gp_cmd_pairing_opt_fwd_radius_present; |
13420 | | static int hf_zbee_gp_cmd_pairing_options; |
13421 | | static int ett_zbee_gp_cmd_pairing_options; |
13422 | | static int hf_zbee_gp_sink_ieee; |
13423 | | static int hf_zbee_gp_sink_nwk; |
13424 | | static int hf_zbee_gp_sink_group_id; |
13425 | | static int hf_zbee_gp_device_id; |
13426 | | static int hf_zbee_gp_assigned_alias; |
13427 | | static int hf_zbee_gp_forwarding_radius; |
13428 | | static int hf_zbee_gp_gpd_key; |
13429 | | static int hf_zbee_gp_groupcast_radius; |
13430 | | |
13431 | | /* GP Response */ |
13432 | | static int hf_zbee_gp_cmd_response_options; |
13433 | | static int ett_zbee_gp_cmd_response_options; |
13434 | | static int hf_zbee_gp_cmd_response_tx_channel; |
13435 | | static int ett_zbee_gp_cmd_response_tx_channel; |
13436 | | static int hf_zbee_gp_cmd_resp_opt_app_id; |
13437 | | static int hf_zbee_gp_cmd_resp_opt_tx_on_ep_match; |
13438 | | static int hf_zbee_gp_tmp_master_short_addr; |
13439 | | static int hf_zbee_gp_cmd_resp_tx_channel; |
13440 | | |
13441 | | /* GP_PAIRING_CONFIGURATION */ |
13442 | | static int hf_zbee_gp_cmd_pc_actions_action; |
13443 | | static int hf_zbee_gp_cmd_pc_actions_send_gp_pairing; |
13444 | | static int hf_zbee_gp_cmd_pc_opt_app_id; |
13445 | | static int hf_zbee_gp_cmd_pc_opt_communication_mode; |
13446 | | static int hf_zbee_gp_cmd_pc_opt_seq_number_cap; |
13447 | | static int hf_zbee_gp_cmd_px_opt_rx_on_cap; |
13448 | | static int hf_zbee_gp_cmd_pc_opt_fixed_location; |
13449 | | static int hf_zbee_gp_cmd_pc_opt_assigned_alias; |
13450 | | static int hf_zbee_gp_cmd_pc_opt_security_use; |
13451 | | static int hf_zbee_gp_cmd_pc_opt_app_info_present; |
13452 | | static int hf_zbee_gp_cmd_pc_secur_level; |
13453 | | static int hf_zbee_gp_cmd_pc_secur_key_type; |
13454 | | static int hf_zbee_gp_cmd_pc_app_info_manuf_id_present; |
13455 | | static int hf_zbee_gp_cmd_pc_app_info_model_id_present; |
13456 | | static int hf_zbee_gp_cmd_pc_app_info_gpd_commands_present; |
13457 | | static int hf_zbee_gp_cmd_pc_app_info_cluster_list_present; |
13458 | | static int hf_zbee_gp_cmd_pc_actions; |
13459 | | static int ett_zbee_gp_cmd_pc_actions; |
13460 | | static int hf_zbee_gp_cmd_pc_options; |
13461 | | static int ett_zbee_gp_cmd_pc_options; |
13462 | | static int ett_zbee_zcl_gp_group_list; |
13463 | | static int hf_zbee_gp_group_list_len; |
13464 | | static int hf_zbee_gp_group_list_group_id; |
13465 | | static int hf_zbee_gp_group_list_alias; |
13466 | | static int hf_zbee_gp_cmd_pc_secur_options; |
13467 | | static int ett_zbee_gp_cmd_pc_secur_options; |
13468 | | static int hf_zbee_gp_n_paired_endpoints; |
13469 | | static int hf_zbee_gp_paired_endpoint; |
13470 | | static int hf_zbee_gp_cmd_pc_app_info; |
13471 | | static int ett_zbee_gp_cmd_pc_app_info; |
13472 | | static int hf_zbee_zcl_gp_manufacturer_id; |
13473 | | static int hf_zbee_zcl_gp_model_id; |
13474 | | static int hf_zbee_gp_n_gpd_commands; |
13475 | | static int hf_zbee_gp_gpd_command; |
13476 | | static int hf_zbee_gp_n_srv_clusters; |
13477 | | static int hf_zbee_gp_n_cli_clusters; |
13478 | | static int hf_zbee_gp_gpd_cluster_id; |
13479 | | static int ett_zbee_zcl_gp_ep; |
13480 | | static int ett_zbee_zcl_gp_cmds; |
13481 | | static int ett_zbee_zcl_gp_clusters; |
13482 | | static int ett_zbee_zcl_gp_srv_clusters; |
13483 | | static int ett_zbee_zcl_gp_cli_clusters; |
13484 | | |
13485 | | /* GP_SINK_TABLE_REQUEST and GP_PROXY_TABLE_REQUEST */ |
13486 | | static int ett_zbee_zcl_proxy_sink_tbl_req_options; |
13487 | | static int hf_zbee_zcl_proxy_sink_tbl_req_options; |
13488 | | static int hf_zbee_zcl_proxy_sink_tbl_req_fld_app_id; |
13489 | | static int hf_zbee_zcl_proxy_sink_tbl_req_fld_req_type; |
13490 | | static int hf_zbee_zcl_proxy_sink_tbl_req_index; |
13491 | | |
13492 | | /* GP_SINK_TABLE_RESPONSE and GP_PROXY_TABLE_RESPONSE */ |
13493 | | static int hf_zbee_zcl_proxy_sink_tbl_resp_status; |
13494 | | static int hf_zbee_zcl_proxy_sink_tbl_resp_entries_total; |
13495 | | static int hf_zbee_zcl_proxy_sink_tbl_resp_start_index; |
13496 | | static int hf_zbee_zcl_proxy_sink_tbl_resp_entries_count; |
13497 | | |
13498 | | /* GP SINK_COMMISSIONING_MODE */ |
13499 | | static int ett_zbee_zcl_gp_cmd_sink_comm_mode_options; |
13500 | | static int hf_zbee_zcl_gp_cmd_sink_comm_mode_options; |
13501 | | |
13502 | | static int hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_action; |
13503 | | static int hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_secur; |
13504 | | static int hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_pairing; |
13505 | | static int hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_proxies; |
13506 | | |
13507 | | static int hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_secur; |
13508 | | static int hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_pairing; |
13509 | | static int hf_zbee_gp_zcl_cmd_sink_comm_mode_sink_ep; |
13510 | | |
13511 | | /* GP Sink Table Attribute */ |
13512 | | static int ett_zbee_gp_sink_tbl; |
13513 | | static int ett_zbee_gp_sink_tbl_entry; |
13514 | | static int ett_zbee_gp_sink_tbl_entry_options; |
13515 | | |
13516 | | static int hf_zbee_gp_sink_tbl_length; |
13517 | | static int hf_zbee_gp_sink_tbl_entry_options; |
13518 | | |
13519 | | static int hf_zbee_gp_sink_tbl_entry_options_app_id; |
13520 | | static int hf_zbee_gp_sink_tbl_entry_options_comm_mode; |
13521 | | static int hf_zbee_gp_sink_tbl_entry_options_seq_num_cap; |
13522 | | static int hf_zbee_gp_sink_tbl_entry_options_rx_on_cap; |
13523 | | static int hf_zbee_gp_sink_tbl_entry_options_fixed_loc; |
13524 | | static int hf_zbee_gp_sink_tbl_entry_options_assigned_alias; |
13525 | | static int hf_zbee_gp_sink_tbl_entry_options_sec_use; |
13526 | | |
13527 | | static int ett_zbee_gp_sec_options; |
13528 | | static int hf_zbee_gp_sec_options; |
13529 | | static int hf_zbee_gp_sec_options_sec_level; |
13530 | | static int hf_zbee_gp_sec_options_sec_key_type; |
13531 | | |
13532 | | /* GP Proxy Table Attribute */ |
13533 | | static int ett_zbee_gp_proxy_tbl; |
13534 | | static int ett_zbee_gp_proxy_tbl_entry; |
13535 | | static int ett_zbee_gp_proxy_tbl_entry_options; |
13536 | | static int ett_zbee_gp_proxy_tbl_entry_ext_options; |
13537 | | |
13538 | | static int hf_zbee_gp_proxy_tbl_length; |
13539 | | static int hf_zbee_gp_proxy_tbl_entry_options; |
13540 | | static int hf_zbee_gp_proxy_tbl_entry_ext_options; |
13541 | | |
13542 | | static int hf_zbee_gp_proxy_tbl_entry_options_app_id; |
13543 | | static int hf_zbee_gp_proxy_tbl_entry_options_entry_active; |
13544 | | static int hf_zbee_gp_proxy_tbl_entry_options_entry_valid; |
13545 | | static int hf_zbee_gp_proxy_tbl_entry_options_seq_num_cap; |
13546 | | static int hf_zbee_gp_proxy_tbl_entry_options_lw_ucast_gps; |
13547 | | static int hf_zbee_gp_proxy_tbl_entry_options_derived_group_gps; |
13548 | | static int hf_zbee_gp_proxy_tbl_entry_options_comm_group_gps; |
13549 | | static int hf_zbee_gp_proxy_tbl_entry_options_first_to_forward; |
13550 | | static int hf_zbee_gp_proxy_tbl_entry_options_in_range; |
13551 | | static int hf_zbee_gp_proxy_tbl_entry_options_gpd_fixed; |
13552 | | static int hf_zbee_gp_proxy_tbl_entry_options_has_all_ucast_routes; |
13553 | | static int hf_zbee_gp_proxy_tbl_entry_options_assigned_alias; |
13554 | | static int hf_zbee_gp_proxy_tbl_entry_options_sec_use; |
13555 | | static int hf_zbee_gp_proxy_tbl_entry_options_opt_ext; |
13556 | | |
13557 | | static int hf_zbee_gp_proxy_tbl_entry_search_counter; |
13558 | | |
13559 | | static int hf_zbee_gp_proxy_tbl_entry_ext_options_full_ucast_gps; |
13560 | | |
13561 | | static int ett_zbee_gp_sink_address_list; |
13562 | | static int hf_zbee_gp_sink_address_list_length; |
13563 | | |
13564 | | /* GP gppFunctionality Attribute */ |
13565 | | static int ett_zbee_zcl_gp_attr_gpp_func; |
13566 | | static int hf_zbee_zcl_gp_attr_gpp_func; |
13567 | | |
13568 | | static int hf_zbee_zcl_gp_attr_gpp_func_fld_gp_feature; |
13569 | | static int hf_zbee_zcl_gp_attr_gpp_func_fld_direct_comm; |
13570 | | static int hf_zbee_zcl_gp_attr_gpp_func_fld_derived_gcast_comm; |
13571 | | static int hf_zbee_zcl_gp_attr_gpp_func_fld_pre_commissioned_gcast_comm; |
13572 | | static int hf_zbee_zcl_gp_attr_gpp_func_fld_full_ucast_comm; |
13573 | | static int hf_zbee_zcl_gp_attr_gpp_func_fld_lw_ucast_comm; |
13574 | | static int hf_zbee_zcl_gp_attr_gpp_func_fld_bidir_op; |
13575 | | static int hf_zbee_zcl_gp_attr_gpp_func_fld_proxy_tbl_maintenance; |
13576 | | static int hf_zbee_zcl_gp_attr_gpp_func_fld_gp_commissioning; |
13577 | | static int hf_zbee_zcl_gp_attr_gpp_func_fld_ct_based_commissioning; |
13578 | | static int hf_zbee_zcl_gp_attr_gpp_func_fld_maintenance_of_gpd; |
13579 | | static int hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_00; |
13580 | | static int hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_01; |
13581 | | static int hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_10; |
13582 | | static int hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_11; |
13583 | | static int hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_ieee_address; |
13584 | | |
13585 | | /* GP gppActiveFunctionality Attribute */ |
13586 | | static int ett_zbee_zcl_gp_attr_gpp_active_func; |
13587 | | static int hf_zbee_zcl_gp_attr_gpp_active_func; |
13588 | | static int hf_zbee_zcl_gp_attr_gpp_active_func_fld_gp_functionality; |
13589 | | |
13590 | | /* GP gpsFunctionality Attribute */ |
13591 | | static int ett_zbee_zcl_gp_attr_gps_func; |
13592 | | static int hf_zbee_zcl_gp_attr_gps_func; |
13593 | | |
13594 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_gp_feature; |
13595 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_direct_comm; |
13596 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_derived_gcast_comm; |
13597 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_pre_commissioned_gcast_comm; |
13598 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_full_ucast_comm; |
13599 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_lw_ucast_comm; |
13600 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_proximity_bidir_op; |
13601 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_bidir_op; |
13602 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_proxy_tbl_maintenance; |
13603 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_proximity_commissioning; |
13604 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_commissioning; |
13605 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_ct_based_commissioning; |
13606 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_maintenance_of_gpd; |
13607 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_00; |
13608 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_01; |
13609 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_10; |
13610 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_11; |
13611 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_sink_tbl_based_gcast_forwarding; |
13612 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_translation_table; |
13613 | | static int hf_zbee_zcl_gp_attr_gps_func_fld_gpd_ieee_address; |
13614 | | |
13615 | | /* GP gppActiveFunctionality Attribute */ |
13616 | | static int ett_zbee_zcl_gp_attr_gps_active_func; |
13617 | | static int hf_zbee_zcl_gp_attr_gps_active_func; |
13618 | | static int hf_zbee_zcl_gp_attr_gps_active_func_fld_gp_functionality; |
13619 | | |
13620 | | /* GP gpsCommissioningExitMode Attribute */ |
13621 | | static int ett_zbee_zcl_gp_attr_gps_comm_exit_mode; |
13622 | | static int hf_zbee_zcl_gp_attr_gps_comm_exit_mode; |
13623 | | static int hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_comm_window_expire; |
13624 | | static int hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_pairing_success; |
13625 | | static int hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_gp_proxy_comm_mode; |
13626 | | |
13627 | | /* GP gpsCommunicationMode Attribute */ |
13628 | | static int ett_zbee_zcl_gp_attr_gps_communication_mode; |
13629 | | static int hf_zbee_zcl_gp_attr_gps_communication_mode; |
13630 | | static int hf_zbee_zcl_gp_attr_gps_communication_mode_fld_mode; |
13631 | | |
13632 | | /* GP gpsSecurityLevel Attribute */ |
13633 | | static int ett_zbee_zcl_gp_attr_gps_secur_lvl; |
13634 | | static int hf_zbee_zcl_gp_attr_gps_secur_lvl; |
13635 | | static int hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_min_gpd_secur_lvl; |
13636 | | static int hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_protection_with_gp_link_key; |
13637 | | static int hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_involve_tc; |
13638 | | |
13639 | | /*************************/ |
13640 | | /* Function Declarations */ |
13641 | | /*************************/ |
13642 | | void proto_register_zbee_zcl_gp(void); |
13643 | | void proto_reg_handoff_zbee_zcl_gp(void); |
13644 | | |
13645 | | static dissector_handle_t zgp_handle; |
13646 | | |
13647 | | |
13648 | | /** |
13649 | | * dissect_zbee_zcl_gp_payload |
13650 | | * |
13651 | | * ZigBee ZCL Green Power data payload cluster dissector for wireshark. |
13652 | | * |
13653 | | * @param tvb - pointer to buffer containing raw packet. |
13654 | | * @param pinfo - pointer to packet information fields |
13655 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
13656 | | * @param offset - offset in a buffer |
13657 | | * |
13658 | | * @return new offset. |
13659 | | */ |
13660 | | static int |
13661 | | dissect_zbee_zcl_gp_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset) |
13662 | 29 | { |
13663 | 29 | unsigned payload_size; |
13664 | | |
13665 | 29 | proto_tree_add_item(tree, hf_zbee_gp_gpd_command_id, tvb, offset, 1, ENC_NA); |
13666 | 29 | offset += 1; |
13667 | | |
13668 | 29 | proto_tree_add_item_ret_uint(tree, hf_zbee_gp_gpd_payload_size, tvb, offset, 1, ENC_NA, &payload_size); |
13669 | 29 | offset += 1; |
13670 | | |
13671 | 29 | if (payload_size != 0 && payload_size != 0xff) { |
13672 | 23 | tvbuff_t *gtvb = tvb_new_composite(); |
13673 | 23 | bool writable = col_get_writable(pinfo->cinfo, COL_INFO); |
13674 | | |
13675 | | /* remove payload length and put command id instead */ |
13676 | 23 | tvb_composite_append(gtvb, tvb_new_subset_length(tvb, offset-2, 1)); |
13677 | 23 | tvb_composite_append(gtvb, tvb_new_subset_length(tvb, offset, payload_size)); |
13678 | 23 | tvb_composite_finalize(gtvb); |
13679 | | /* prevent overwriting COL_INFO */ |
13680 | 23 | col_set_writable(pinfo->cinfo, COL_INFO, false); |
13681 | 23 | call_dissector_only(zgp_handle, gtvb, pinfo, tree, NULL); |
13682 | 23 | col_set_writable(pinfo->cinfo, COL_INFO, writable); |
13683 | 23 | offset += payload_size; |
13684 | 23 | } |
13685 | 29 | return offset; |
13686 | 29 | } |
13687 | | |
13688 | | /** |
13689 | | * dissect_zbee_zcl_gp_group_list |
13690 | | * |
13691 | | * ZigBee ZCL Green Power Group List dissector for wireshark. |
13692 | | * |
13693 | | * @param tvb - pointer to buffer containing raw packet. |
13694 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
13695 | | * @param offset - offset in a buffer |
13696 | | * @param text - string attached to Group list subtree |
13697 | | * @return new offset. |
13698 | | */ |
13699 | | static int |
13700 | | dissect_zbee_zcl_gp_group_list(tvbuff_t *tvb, proto_tree *tree, unsigned offset, const char* text) |
13701 | 120 | { |
13702 | 120 | uint8_t len = tvb_get_uint8(tvb, offset); |
13703 | 120 | proto_tree *gl_tree = proto_tree_add_subtree_format(tree, tvb, offset, len*4+1, |
13704 | 120 | ett_zbee_zcl_gp_group_list, NULL, "%s #%d", text, len); |
13705 | | |
13706 | 120 | proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_len, tvb, offset, 1, ENC_NA); |
13707 | 120 | offset += 1; |
13708 | 1.08k | while (len) { |
13709 | 966 | proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_group_id, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
13710 | 966 | offset += 2; |
13711 | 966 | proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_alias, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
13712 | 966 | offset += 2; |
13713 | 966 | len--; |
13714 | 966 | } |
13715 | | |
13716 | 120 | return offset; |
13717 | 120 | } /*dissect_zbee_zcl_gp_group_list*/ |
13718 | | |
13719 | | /** |
13720 | | * dissect_zbee_zcl_gp_sink_address_list |
13721 | | * |
13722 | | * ZigBee ZCL Green Power Sink Address List dissector for wireshark. |
13723 | | * |
13724 | | * @param tvb - pointer to buffer containing raw packet. |
13725 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
13726 | | * @param offset - offset in a buffer |
13727 | | * @param text - string attached to Sink Address list subtree |
13728 | | * @return new offset. |
13729 | | */ |
13730 | | static int |
13731 | | dissect_zbee_zcl_gp_sink_address_list(tvbuff_t *tvb, proto_tree *tree, unsigned offset, const char* text) |
13732 | 60 | { |
13733 | 60 | uint8_t len = tvb_get_uint8(tvb, offset); |
13734 | 60 | proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, offset, len*10+1, |
13735 | 60 | ett_zbee_gp_sink_address_list, NULL, "%s #%d", text, len); |
13736 | | |
13737 | 60 | proto_tree_add_item(subtree, hf_zbee_gp_sink_address_list_length, tvb, offset, 1, ENC_NA); |
13738 | 60 | offset += 1; |
13739 | 397 | while (len) { |
13740 | 337 | proto_tree_add_item(subtree, hf_zbee_gp_sink_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
13741 | 337 | offset += 8; |
13742 | 337 | proto_tree_add_item(subtree, hf_zbee_gp_sink_nwk, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
13743 | 337 | offset += 2; |
13744 | 337 | len--; |
13745 | 337 | } |
13746 | | |
13747 | 60 | return offset; |
13748 | 60 | } /*dissect_zbee_zcl_gp_sink_address_list*/ |
13749 | | |
13750 | | /** |
13751 | | * dissect_zbee_zcl_gp_sink_table_entry |
13752 | | * |
13753 | | * ZigBee ZCL Green Power Sink Table entry dissector for wireshark. |
13754 | | * |
13755 | | * @param tvb - pointer to buffer containing raw packet. |
13756 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
13757 | | * @param offset - offset in a buffer |
13758 | | * @param idx - entry index |
13759 | | * |
13760 | | * @return 1 if entry parsed, 0 - otherwise. |
13761 | | */ |
13762 | | static int |
13763 | | dissect_zbee_zcl_gp_sink_table_entry(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, unsigned idx) |
13764 | 463 | { |
13765 | 463 | uint16_t options = 0; |
13766 | 463 | uint16_t app_id, comm_mode; |
13767 | 463 | proto_tree *subtree; |
13768 | 463 | static int * const n_options[] = { |
13769 | 463 | &hf_zbee_gp_sink_tbl_entry_options_app_id, |
13770 | 463 | &hf_zbee_gp_sink_tbl_entry_options_comm_mode, |
13771 | 463 | &hf_zbee_gp_sink_tbl_entry_options_seq_num_cap, |
13772 | 463 | &hf_zbee_gp_sink_tbl_entry_options_rx_on_cap, |
13773 | 463 | &hf_zbee_gp_sink_tbl_entry_options_fixed_loc, |
13774 | 463 | &hf_zbee_gp_sink_tbl_entry_options_assigned_alias, |
13775 | 463 | &hf_zbee_gp_sink_tbl_entry_options_sec_use, |
13776 | 463 | NULL |
13777 | 463 | }; |
13778 | 463 | static int * const n_secur_options[] = { |
13779 | 463 | &hf_zbee_gp_sec_options_sec_level, |
13780 | 463 | &hf_zbee_gp_sec_options_sec_key_type, |
13781 | 463 | NULL |
13782 | 463 | }; |
13783 | | |
13784 | 463 | subtree = proto_tree_add_subtree_format(tree, tvb, *offset, -1, ett_zbee_gp_sink_tbl_entry, |
13785 | 463 | NULL, "Sink Table Entry #%d", idx); |
13786 | | |
13787 | | /* Options - 2 bytes */ |
13788 | 463 | options = tvb_get_uint16(tvb, *offset, ENC_LITTLE_ENDIAN); |
13789 | 463 | proto_tree_add_bitmask(subtree, tvb, *offset, hf_zbee_gp_sink_tbl_entry_options, |
13790 | 463 | ett_zbee_gp_sink_tbl_entry_options, n_options, ENC_LITTLE_ENDIAN); |
13791 | 463 | *offset += 2; |
13792 | | |
13793 | 463 | app_id = (options & ZBEE_ZCL_GP_SINK_TBL_OPT_APP_ID) >> ws_ctz(ZBEE_ZCL_GP_SINK_TBL_OPT_APP_ID); |
13794 | 463 | switch (app_id) { |
13795 | 260 | case ZBEE_ZCL_GP_APP_ID_DEFAULT: |
13796 | | /* Add 4 byte SRC ID */ |
13797 | 260 | proto_tree_add_item(subtree, hf_zbee_gp_src_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
13798 | 260 | *offset += 4; |
13799 | 260 | break; |
13800 | 87 | case ZBEE_ZCL_GP_APP_ID_ZGP: |
13801 | | /* Add IEEE address and endpoint (9 bytes) */ |
13802 | 87 | proto_tree_add_item(subtree, hf_zbee_gp_ieee, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
13803 | 87 | *offset += 8; |
13804 | 87 | proto_tree_add_item(subtree, hf_zbee_gp_endpoint, tvb, *offset, 1, ENC_NA); |
13805 | 87 | *offset += 1; |
13806 | 87 | break; |
13807 | 113 | default: |
13808 | | /* Bad entry - stop Sink Table Entry parsing */ |
13809 | 113 | return 0; |
13810 | 463 | } |
13811 | | |
13812 | | /* Device ID - 1 byte */ |
13813 | 321 | proto_tree_add_item(subtree, hf_zbee_gp_device_id, tvb, *offset, 1, ENC_NA); |
13814 | 321 | *offset += 1; |
13815 | | |
13816 | | /* Group list */ |
13817 | 321 | comm_mode = (options & ZBEE_ZCL_GP_SINK_TBL_OPT_COMMUNICATION_MODE) >> |
13818 | 321 | ws_ctz(ZBEE_ZCL_GP_SINK_TBL_OPT_COMMUNICATION_MODE); |
13819 | 321 | if (comm_mode == ZBEE_ZCL_GP_COMMUNICATION_MODE_GROUPCAST_PRECOMMISSIONED) { |
13820 | 28 | *offset = dissect_zbee_zcl_gp_group_list(tvb, subtree, *offset, "GroupList"); |
13821 | 28 | } |
13822 | | |
13823 | | /* GPD Assigned Alias: 2 bytes */ |
13824 | 321 | if (options & ZBEE_ZCL_GP_SINK_TBL_OPT_ASSIGNED_ALIAS) { |
13825 | 64 | proto_tree_add_item(subtree, hf_zbee_gp_assigned_alias, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
13826 | 64 | *offset += 2; |
13827 | 64 | } |
13828 | | |
13829 | | /* Groupcast radius: 1 byte */ |
13830 | 321 | proto_tree_add_item(subtree, hf_zbee_gp_groupcast_radius, tvb, *offset, 1, ENC_NA); |
13831 | 321 | *offset += 1; |
13832 | | |
13833 | | /* Security options: 1 byte */ |
13834 | 321 | if (options & ZBEE_ZCL_GP_SINK_TBL_OPT_SECURITY_USE) { |
13835 | 58 | proto_tree_add_bitmask(subtree, tvb, *offset, hf_zbee_gp_sec_options, |
13836 | 58 | ett_zbee_gp_sec_options, n_secur_options, ENC_NA); |
13837 | 58 | *offset += 1; |
13838 | 58 | } |
13839 | | |
13840 | | /* GPD Frame Counter: 4 bytes */ |
13841 | 321 | if ((options & ZBEE_ZCL_GP_SINK_TBL_OPT_SECURITY_USE) || (options & ZBEE_ZCL_GP_SINK_TBL_OPT_SEQ_NUMBER_CAP)) { |
13842 | 116 | proto_tree_add_item(subtree, hf_zbee_gp_secur_frame_counter, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
13843 | 116 | *offset += 4; |
13844 | 116 | } |
13845 | | |
13846 | | /* GPD key: 16 bytes */ |
13847 | 321 | if (options & ZBEE_ZCL_GP_SINK_TBL_OPT_SECURITY_USE) { |
13848 | 57 | proto_tree_add_item(subtree, hf_zbee_gp_gpd_key, tvb, *offset, 16, ENC_NA); |
13849 | 57 | *offset += 16; |
13850 | 57 | } |
13851 | | |
13852 | 321 | return 1; |
13853 | 463 | } |
13854 | | |
13855 | | /** |
13856 | | * dissect_zbee_zcl_gp_sink_table |
13857 | | * |
13858 | | * ZigBee ZCL Green Power Sink Table dissector for wireshark. |
13859 | | * |
13860 | | * @param tvb - pointer to buffer containing raw packet. |
13861 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
13862 | | * @param offset - offset in a buffer |
13863 | | * |
13864 | | * @return new offset. |
13865 | | */ |
13866 | | static int |
13867 | | dissect_zbee_zcl_gp_sink_table(tvbuff_t *tvb, proto_tree *tree, unsigned offset) |
13868 | 159 | { |
13869 | 159 | uint16_t sink_tbl_len, n_parsed_octets; |
13870 | 159 | uint8_t n_tbl_entries; |
13871 | 159 | proto_tree *sink_tbl_tree; |
13872 | | |
13873 | 159 | n_parsed_octets = 0; |
13874 | 159 | n_tbl_entries = 0; |
13875 | 159 | sink_tbl_len = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN); |
13876 | | |
13877 | 159 | sink_tbl_tree = proto_tree_add_subtree_format(tree, tvb, offset, sink_tbl_len, |
13878 | 159 | ett_zbee_gp_sink_tbl, NULL, "Sink Table: length = %d", sink_tbl_len); |
13879 | 159 | proto_tree_add_item(sink_tbl_tree, hf_zbee_gp_sink_tbl_length, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
13880 | 159 | offset += 2; |
13881 | 159 | if (sink_tbl_len == 0) { |
13882 | 34 | return offset; |
13883 | 34 | } |
13884 | | |
13885 | 414 | while (n_parsed_octets < sink_tbl_len) { |
13886 | 409 | unsigned old_offset = offset; |
13887 | 409 | if (dissect_zbee_zcl_gp_sink_table_entry(tvb, sink_tbl_tree, &offset, n_tbl_entries + 1)) { |
13888 | 289 | n_parsed_octets += offset - old_offset; |
13889 | 289 | } |
13890 | 120 | else { |
13891 | | /* Bad Sink Table Entry - stop Sink Table attribute dissection */ |
13892 | 120 | break; |
13893 | 120 | } |
13894 | | |
13895 | 289 | ++n_tbl_entries; |
13896 | 289 | } |
13897 | | |
13898 | 125 | return offset; |
13899 | 159 | } /*dissect_zbee_zcl_gp_sink_table*/ |
13900 | | |
13901 | | /** |
13902 | | * dissect_zbee_zcl_gp_proxy_table_entry |
13903 | | * |
13904 | | * ZigBee ZCL Green Power Proxy Table entry dissector for wireshark. |
13905 | | * |
13906 | | * @param tvb - pointer to buffer containing raw packet. |
13907 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
13908 | | * @param offset - offset in a buffer |
13909 | | * @param idx - entry index |
13910 | | * |
13911 | | * @return 1 if entry parsed, 0 - otherwise. |
13912 | | */ |
13913 | | static int |
13914 | | dissect_zbee_zcl_gp_proxy_table_entry(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, unsigned idx) |
13915 | 759 | { |
13916 | 759 | uint16_t options = 0; |
13917 | 759 | uint16_t ext_options = 0; |
13918 | 759 | uint16_t app_id; |
13919 | 759 | proto_tree *subtree; |
13920 | 759 | static int * const n_options[] = { |
13921 | 759 | &hf_zbee_gp_proxy_tbl_entry_options_app_id, |
13922 | 759 | &hf_zbee_gp_proxy_tbl_entry_options_entry_active, |
13923 | 759 | &hf_zbee_gp_proxy_tbl_entry_options_entry_valid, |
13924 | 759 | &hf_zbee_gp_proxy_tbl_entry_options_seq_num_cap, |
13925 | 759 | &hf_zbee_gp_proxy_tbl_entry_options_lw_ucast_gps, |
13926 | 759 | &hf_zbee_gp_proxy_tbl_entry_options_derived_group_gps, |
13927 | 759 | &hf_zbee_gp_proxy_tbl_entry_options_comm_group_gps, |
13928 | 759 | &hf_zbee_gp_proxy_tbl_entry_options_first_to_forward, |
13929 | 759 | &hf_zbee_gp_proxy_tbl_entry_options_in_range, |
13930 | 759 | &hf_zbee_gp_proxy_tbl_entry_options_gpd_fixed, |
13931 | 759 | &hf_zbee_gp_proxy_tbl_entry_options_has_all_ucast_routes, |
13932 | 759 | &hf_zbee_gp_proxy_tbl_entry_options_assigned_alias, |
13933 | 759 | &hf_zbee_gp_proxy_tbl_entry_options_sec_use, |
13934 | 759 | &hf_zbee_gp_proxy_tbl_entry_options_opt_ext, |
13935 | 759 | NULL |
13936 | 759 | }; |
13937 | 759 | static int * const n_ext_options[] = { |
13938 | 759 | &hf_zbee_gp_proxy_tbl_entry_ext_options_full_ucast_gps, |
13939 | 759 | NULL |
13940 | 759 | }; |
13941 | 759 | static int * const n_secur_options[] = { |
13942 | 759 | &hf_zbee_gp_sec_options_sec_level, |
13943 | 759 | &hf_zbee_gp_sec_options_sec_key_type, |
13944 | 759 | NULL |
13945 | 759 | }; |
13946 | | |
13947 | 759 | subtree = proto_tree_add_subtree_format(tree, tvb, *offset, -1, |
13948 | 759 | ett_zbee_gp_proxy_tbl_entry, NULL, "Proxy Table Entry #%d", idx); |
13949 | | |
13950 | | /* Options - 2 bytes */ |
13951 | 759 | options = tvb_get_uint16(tvb, *offset, ENC_LITTLE_ENDIAN); |
13952 | 759 | proto_tree_add_bitmask(subtree, tvb, *offset, hf_zbee_gp_proxy_tbl_entry_options, |
13953 | 759 | ett_zbee_gp_proxy_tbl_entry_options, n_options, ENC_LITTLE_ENDIAN); |
13954 | 759 | *offset += 2; |
13955 | | |
13956 | 759 | app_id = (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_APP_ID) >> ws_ctz(ZBEE_ZCL_GP_PROXY_TBL_OPT_APP_ID); |
13957 | 759 | switch (app_id) { |
13958 | 562 | case ZBEE_ZCL_GP_APP_ID_DEFAULT: |
13959 | | /* Add 4 byte SRC ID */ |
13960 | 562 | proto_tree_add_item(subtree, hf_zbee_gp_src_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
13961 | 562 | *offset += 4; |
13962 | 562 | break; |
13963 | 123 | case ZBEE_ZCL_GP_APP_ID_ZGP: |
13964 | | /* Add IEEE address and endpoint (9 bytes) */ |
13965 | 123 | proto_tree_add_item(subtree, hf_zbee_gp_ieee, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
13966 | 123 | *offset += 8; |
13967 | 123 | proto_tree_add_item(subtree, hf_zbee_gp_endpoint, tvb, *offset, 1, ENC_NA); |
13968 | 123 | *offset += 1; |
13969 | 123 | break; |
13970 | 74 | default: |
13971 | | /* Bad entry - stop Proxy Table entry parsing */ |
13972 | 74 | return 0; |
13973 | 759 | } |
13974 | | |
13975 | | |
13976 | | /* Assigned Alias - 2 bytes */ |
13977 | 683 | if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_ASSIGNED_ALIAS) { |
13978 | 148 | proto_tree_add_item(subtree, hf_zbee_gp_assigned_alias, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
13979 | 148 | *offset += 2; |
13980 | 148 | } |
13981 | | |
13982 | | /* Security Options - 1 byte */ |
13983 | 683 | if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_SECURITY_USE) { |
13984 | 105 | proto_tree_add_bitmask(subtree, tvb, *offset, hf_zbee_gp_sec_options, |
13985 | 105 | ett_zbee_gp_sec_options, n_secur_options, ENC_NA); |
13986 | 105 | *offset += 1; |
13987 | 105 | } |
13988 | | |
13989 | | /* GPD Frame Counter: 4 bytes */ |
13990 | 683 | if ((options & ZBEE_ZCL_GP_PROXY_TBL_OPT_SECURITY_USE) || (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_SEQ_NUMBER_CAP)) { |
13991 | 212 | proto_tree_add_item(subtree, hf_zbee_gp_secur_frame_counter, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
13992 | 212 | *offset += 4; |
13993 | 212 | } |
13994 | | |
13995 | | /* GPD key: 16 bytes */ |
13996 | 683 | if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_SECURITY_USE) { |
13997 | 105 | proto_tree_add_item(subtree, hf_zbee_gp_gpd_key, tvb, *offset, 16, ENC_NA); |
13998 | 105 | *offset += 16; |
13999 | 105 | } |
14000 | | |
14001 | 683 | if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_LW_UCAST_GPS) { |
14002 | 44 | *offset = dissect_zbee_zcl_gp_sink_address_list(tvb, subtree, *offset, "Lightweight Sink Address list"); |
14003 | 44 | } |
14004 | | |
14005 | | /* Sink Group list */ |
14006 | 683 | if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_COMM_GROUP_GPS) { |
14007 | 92 | *offset = dissect_zbee_zcl_gp_group_list(tvb, subtree, *offset, "Sink GroupList"); |
14008 | 92 | } |
14009 | | |
14010 | | /* Groupcast radius: 1 byte */ |
14011 | 683 | proto_tree_add_item(subtree, hf_zbee_gp_groupcast_radius, tvb, *offset, 1, ENC_NA); |
14012 | 683 | *offset += 1; |
14013 | | |
14014 | | /* Search Counter: 1 byte */ |
14015 | 683 | if (!(options & ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_ACTIVE) || !(options & ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_VALID)) { |
14016 | 609 | proto_tree_add_item(subtree, hf_zbee_gp_proxy_tbl_entry_search_counter, tvb, *offset, 1, ENC_NA); |
14017 | 609 | *offset += 1; |
14018 | 609 | } |
14019 | | |
14020 | | /* Extended Options: 2 bytes */ |
14021 | 683 | if (options & ZBEE_ZCL_GP_PROXY_TBL_OPT_OPTIONS_EXTENTIONS) { |
14022 | 89 | ext_options = tvb_get_uint16(tvb, *offset, ENC_LITTLE_ENDIAN); |
14023 | 89 | proto_tree_add_bitmask(subtree, tvb, *offset, hf_zbee_gp_proxy_tbl_entry_ext_options, |
14024 | 89 | ett_zbee_gp_proxy_tbl_entry_ext_options, n_ext_options, ENC_LITTLE_ENDIAN); |
14025 | 89 | *offset += 1; |
14026 | 89 | } |
14027 | | |
14028 | | /* Full unicast sink address list */ |
14029 | 683 | if (ext_options & ZBEE_ZCL_GP_PROXY_TBL_EXT_OPT_FULL_UCAST_GPS) { |
14030 | 16 | *offset = dissect_zbee_zcl_gp_sink_address_list(tvb, subtree, *offset, "Full unicast Sink Address list"); |
14031 | 16 | } |
14032 | | |
14033 | 683 | return 1; |
14034 | 759 | } |
14035 | | |
14036 | | /** |
14037 | | * dissect_zbee_zcl_gp_proxy_table |
14038 | | * |
14039 | | * ZigBee ZCL Green Power Proxy Table dissector for wireshark. |
14040 | | * |
14041 | | * @param tvb - pointer to buffer containing raw packet. |
14042 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
14043 | | * @param offset - offset in a buffer |
14044 | | * |
14045 | | * @return new offset. |
14046 | | */ |
14047 | | static int |
14048 | | dissect_zbee_zcl_gp_proxy_table(tvbuff_t *tvb, proto_tree *tree, unsigned offset) |
14049 | 128 | { |
14050 | 128 | uint16_t proxy_tbl_len, n_parsed_octets; |
14051 | 128 | uint8_t n_tbl_entries; |
14052 | 128 | proto_tree *proxy_tbl_tree; |
14053 | | |
14054 | 128 | n_parsed_octets = 0; |
14055 | 128 | n_tbl_entries = 0; |
14056 | 128 | proxy_tbl_len = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN); |
14057 | | |
14058 | 128 | proxy_tbl_tree = proto_tree_add_subtree_format(tree, tvb, offset, proxy_tbl_len, |
14059 | 128 | ett_zbee_gp_proxy_tbl, NULL, "Proxy Table: length = %d", proxy_tbl_len); |
14060 | 128 | proto_tree_add_item(proxy_tbl_tree, hf_zbee_gp_proxy_tbl_length, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
14061 | 128 | offset += 2; |
14062 | 128 | if (proxy_tbl_len == 0) { |
14063 | 12 | return offset; |
14064 | 12 | } |
14065 | | |
14066 | 759 | while (n_parsed_octets < proxy_tbl_len) { |
14067 | 757 | unsigned old_offset = offset; |
14068 | 757 | if (dissect_zbee_zcl_gp_proxy_table_entry(tvb, proxy_tbl_tree, &offset, n_tbl_entries + 1)) { |
14069 | 643 | n_parsed_octets += offset - old_offset; |
14070 | 643 | } |
14071 | 114 | else { |
14072 | | /* Bad Proxy Table entry - stop Proxy Table attribute dissection */ |
14073 | 114 | break; |
14074 | 114 | } |
14075 | | |
14076 | 643 | ++n_tbl_entries; |
14077 | 643 | } |
14078 | | |
14079 | 116 | return offset; |
14080 | 128 | } /*dissect_zbee_zcl_gp_proxy_table*/ |
14081 | | |
14082 | | /** |
14083 | | * dissect_zbee_zcl_gp_attr_gpp_functionality |
14084 | | * |
14085 | | * ZigBee ZCL Green Power gppFunctionality dissector for wireshark. |
14086 | | * |
14087 | | * @param tvb - pointer to buffer containing raw packet. |
14088 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
14089 | | * @param offset - offset in a buffer |
14090 | | * |
14091 | | * @return new offset. |
14092 | | */ |
14093 | | static int |
14094 | | dissect_zbee_zcl_gp_attr_gpp_functionality(tvbuff_t *tvb, proto_tree *tree, unsigned offset) |
14095 | 14 | { |
14096 | 14 | static int * const n_fields[] = { |
14097 | 14 | &hf_zbee_zcl_gp_attr_gpp_func_fld_gp_feature, |
14098 | 14 | &hf_zbee_zcl_gp_attr_gpp_func_fld_direct_comm, |
14099 | 14 | &hf_zbee_zcl_gp_attr_gpp_func_fld_derived_gcast_comm, |
14100 | 14 | &hf_zbee_zcl_gp_attr_gpp_func_fld_pre_commissioned_gcast_comm, |
14101 | 14 | &hf_zbee_zcl_gp_attr_gpp_func_fld_full_ucast_comm, |
14102 | 14 | &hf_zbee_zcl_gp_attr_gpp_func_fld_lw_ucast_comm, |
14103 | 14 | &hf_zbee_zcl_gp_attr_gpp_func_fld_bidir_op, |
14104 | 14 | &hf_zbee_zcl_gp_attr_gpp_func_fld_proxy_tbl_maintenance, |
14105 | 14 | &hf_zbee_zcl_gp_attr_gpp_func_fld_gp_commissioning, |
14106 | 14 | &hf_zbee_zcl_gp_attr_gpp_func_fld_ct_based_commissioning, |
14107 | 14 | &hf_zbee_zcl_gp_attr_gpp_func_fld_maintenance_of_gpd, |
14108 | 14 | &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_00, |
14109 | 14 | &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_01, |
14110 | 14 | &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_10, |
14111 | 14 | &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_11, |
14112 | 14 | &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_ieee_address, |
14113 | 14 | NULL |
14114 | 14 | }; |
14115 | | |
14116 | 14 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gpp_func, |
14117 | 14 | ett_zbee_zcl_gp_attr_gpp_func, n_fields, ENC_LITTLE_ENDIAN); |
14118 | 14 | offset += 3; |
14119 | | |
14120 | 14 | return offset; |
14121 | 14 | } /*dissect_zbee_zcl_gp_attr_gpp_functionality*/ |
14122 | | |
14123 | | /** |
14124 | | * dissect_zbee_zcl_gp_attr_gpp_active_functionality |
14125 | | * |
14126 | | * ZigBee ZCL Green Power gppActiveFunctionality dissector for wireshark. |
14127 | | * |
14128 | | * @param tvb - pointer to buffer containing raw packet. |
14129 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
14130 | | * @param offset - offset in a buffer |
14131 | | * |
14132 | | * @return new offset. |
14133 | | */ |
14134 | | static int |
14135 | | dissect_zbee_zcl_gp_attr_gpp_active_functionality(tvbuff_t *tvb, proto_tree *tree, unsigned offset) |
14136 | 11 | { |
14137 | 11 | static int * const n_fields[] = { |
14138 | 11 | &hf_zbee_zcl_gp_attr_gpp_active_func_fld_gp_functionality, |
14139 | 11 | NULL |
14140 | 11 | }; |
14141 | | |
14142 | 11 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gpp_active_func, |
14143 | 11 | ett_zbee_zcl_gp_attr_gpp_active_func, n_fields, ENC_LITTLE_ENDIAN); |
14144 | 11 | offset += 3; |
14145 | | |
14146 | 11 | return offset; |
14147 | 11 | } /*dissect_zbee_zcl_gp_attr_gpp_active_functionality*/ |
14148 | | |
14149 | | /** |
14150 | | * dissect_zbee_zcl_gp_attr_gps_functionality |
14151 | | * |
14152 | | * ZigBee ZCL Green Power gpsFunctionality dissector for wireshark. |
14153 | | * |
14154 | | * @param tvb - pointer to buffer containing raw packet. |
14155 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
14156 | | * @param offset - offset in a buffer |
14157 | | * |
14158 | | * @return new offset. |
14159 | | */ |
14160 | | static int |
14161 | | dissect_zbee_zcl_gp_attr_gps_functionality(tvbuff_t *tvb, proto_tree *tree, unsigned offset) |
14162 | 50 | { |
14163 | 50 | static int * const n_fields[] = { |
14164 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_gp_feature, |
14165 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_direct_comm, |
14166 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_derived_gcast_comm, |
14167 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_pre_commissioned_gcast_comm, |
14168 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_full_ucast_comm, |
14169 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_lw_ucast_comm, |
14170 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_proximity_bidir_op, |
14171 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_bidir_op, |
14172 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_proxy_tbl_maintenance, |
14173 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_proximity_commissioning, |
14174 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_commissioning, |
14175 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_ct_based_commissioning, |
14176 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_maintenance_of_gpd, |
14177 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_00, |
14178 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_01, |
14179 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_10, |
14180 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_11, |
14181 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_sink_tbl_based_gcast_forwarding, |
14182 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_translation_table, |
14183 | 50 | &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_ieee_address, |
14184 | 50 | NULL |
14185 | 50 | }; |
14186 | | |
14187 | 50 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gps_func, |
14188 | 50 | ett_zbee_zcl_gp_attr_gps_func, n_fields, ENC_LITTLE_ENDIAN); |
14189 | 50 | offset += 3; |
14190 | | |
14191 | 50 | return offset; |
14192 | 50 | } /*dissect_zbee_zcl_gp_attr_gps_functionality*/ |
14193 | | |
14194 | | /** |
14195 | | * dissect_zbee_zcl_gp_attr_gps_active_functionality |
14196 | | * |
14197 | | * ZigBee ZCL Green Power gpsActiveFunctionality dissector for wireshark. |
14198 | | * |
14199 | | * @param tvb - pointer to buffer containing raw packet. |
14200 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
14201 | | * @param offset - offset in a buffer |
14202 | | * |
14203 | | * @return new offset. |
14204 | | */ |
14205 | | static int |
14206 | | dissect_zbee_zcl_gp_attr_gps_active_functionality(tvbuff_t *tvb, proto_tree *tree, unsigned offset) |
14207 | 7 | { |
14208 | 7 | static int * const n_fields[] = { |
14209 | 7 | &hf_zbee_zcl_gp_attr_gps_active_func_fld_gp_functionality, |
14210 | 7 | NULL |
14211 | 7 | }; |
14212 | | |
14213 | 7 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gps_active_func, |
14214 | 7 | ett_zbee_zcl_gp_attr_gps_active_func, n_fields, ENC_LITTLE_ENDIAN); |
14215 | 7 | offset += 3; |
14216 | | |
14217 | 7 | return offset; |
14218 | 7 | } /*dissect_zbee_zcl_gp_attr_gps_active_functionality*/ |
14219 | | |
14220 | | /** |
14221 | | * dissect_zbee_zcl_gp_attr_gps_communication_mode |
14222 | | * |
14223 | | * ZigBee ZCL Green Power gpsCommunicationMode dissector for wireshark. |
14224 | | * |
14225 | | * @param tvb - pointer to buffer containing raw packet. |
14226 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
14227 | | * @param offset - offset in a buffer |
14228 | | * |
14229 | | * @return new offset. |
14230 | | */ |
14231 | | static int |
14232 | | dissect_zbee_zcl_gp_attr_gps_communication_mode(tvbuff_t *tvb, proto_tree *tree, unsigned offset) |
14233 | 40 | { |
14234 | 40 | static int * const n_fields[] = { |
14235 | 40 | &hf_zbee_zcl_gp_attr_gps_communication_mode_fld_mode, |
14236 | 40 | NULL |
14237 | 40 | }; |
14238 | | |
14239 | 40 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gps_communication_mode, |
14240 | 40 | ett_zbee_zcl_gp_attr_gps_communication_mode, n_fields, ENC_NA); |
14241 | 40 | offset += 1; |
14242 | | |
14243 | 40 | return offset; |
14244 | 40 | } /*dissect_zbee_zcl_gp_attr_gps_communication_mode*/ |
14245 | | |
14246 | | /** |
14247 | | * dissect_zbee_zcl_gp_attr_gps_comm_exit_mode |
14248 | | * |
14249 | | * ZigBee ZCL Green Power gpsCommissioningExitMode dissector for wireshark. |
14250 | | * |
14251 | | * @param tvb - pointer to buffer containing raw packet. |
14252 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
14253 | | * @param offset - offset in a buffer |
14254 | | * |
14255 | | * @return new offset. |
14256 | | */ |
14257 | | static int |
14258 | | dissect_zbee_zcl_gp_attr_gps_comm_exit_mode(tvbuff_t *tvb, proto_tree *tree, unsigned offset) |
14259 | 82 | { |
14260 | 82 | static int * const n_fields[] = { |
14261 | 82 | &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_comm_window_expire, |
14262 | 82 | &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_pairing_success, |
14263 | 82 | &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_gp_proxy_comm_mode, |
14264 | 82 | NULL |
14265 | 82 | }; |
14266 | | |
14267 | 82 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gps_comm_exit_mode, |
14268 | 82 | ett_zbee_zcl_gp_attr_gps_comm_exit_mode, n_fields, ENC_NA); |
14269 | 82 | offset += 1; |
14270 | | |
14271 | 82 | return offset; |
14272 | 82 | } /*dissect_zbee_zcl_gp_attr_gps_comm_exit_mode*/ |
14273 | | |
14274 | | /** |
14275 | | * dissect_zbee_zcl_gp_attr_gps_secur_lvl |
14276 | | * |
14277 | | * ZigBee ZCL Green Power gpsSecurityLevel dissector for wireshark. |
14278 | | * |
14279 | | * @param tvb - pointer to buffer containing raw packet. |
14280 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
14281 | | * @param offset - offset in a buffer |
14282 | | * |
14283 | | * @return new offset. |
14284 | | */ |
14285 | | static int |
14286 | | dissect_zbee_zcl_gp_attr_gps_secur_lvl(tvbuff_t *tvb, proto_tree *tree, unsigned offset) |
14287 | 44 | { |
14288 | 44 | static int * const n_fields[] = { |
14289 | 44 | &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_min_gpd_secur_lvl, |
14290 | 44 | &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_protection_with_gp_link_key, |
14291 | 44 | &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_involve_tc, |
14292 | 44 | NULL |
14293 | 44 | }; |
14294 | | |
14295 | 44 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_gp_attr_gps_secur_lvl, |
14296 | 44 | ett_zbee_zcl_gp_attr_gps_secur_lvl, n_fields, ENC_NA); |
14297 | 44 | offset += 1; |
14298 | | |
14299 | 44 | return offset; |
14300 | 44 | } /*dissect_zbee_zcl_gp_attr_gps_secur_lvl*/ |
14301 | | |
14302 | | /** |
14303 | | * dissect_zcl_gp_proxy_sink_table_request |
14304 | | * |
14305 | | * ZigBee ZCL Green Power cluster dissector for Proxy Table Request |
14306 | | * and Sink Table Request commands |
14307 | | * |
14308 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
14309 | | * @param tvb - pointer to buffer containing raw packet. |
14310 | | * @param offset - pointer to buffer offset |
14311 | | */ |
14312 | | static void |
14313 | | dissect_zcl_gp_proxy_sink_table_request(proto_tree *tree, tvbuff_t *tvb, unsigned *offset) |
14314 | 7 | { |
14315 | | /* get Options field */ |
14316 | 7 | uint8_t options = tvb_get_uint8(tvb, *offset); |
14317 | 7 | uint8_t app_id, req_type; |
14318 | 7 | static int * const n_options[] = { |
14319 | 7 | &hf_zbee_zcl_proxy_sink_tbl_req_fld_app_id, |
14320 | 7 | &hf_zbee_zcl_proxy_sink_tbl_req_fld_req_type, |
14321 | 7 | NULL |
14322 | 7 | }; |
14323 | | |
14324 | 7 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_proxy_sink_tbl_req_options, |
14325 | 7 | ett_zbee_zcl_proxy_sink_tbl_req_options, n_options, ENC_NA); |
14326 | 7 | *offset += 1; |
14327 | 7 | app_id = options & ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_APP_ID; |
14328 | 7 | req_type = (options & ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_REQ_TYPE) >> |
14329 | 7 | ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_REQ_TYPE_SHIFT; |
14330 | 7 | if (req_type == ZBEE_ZCL_GP_PROXY_SINK_TABLE_REQ_CMD_REQUSET_BY_GPD_ID) { |
14331 | | /* Include GPD ID and/or Endpoint */ |
14332 | 1 | if (app_id == ZBEE_ZCL_GP_APP_ID_DEFAULT) { |
14333 | | /* App_id = 000: GPD SRC ID only */ |
14334 | 0 | proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN); |
14335 | 0 | *offset += 4; |
14336 | 0 | } |
14337 | 1 | else if (app_id == ZBEE_ZCL_GP_APP_ID_ZGP) { |
14338 | | /* App_id = 010: MAC address + Endpoint */ |
14339 | 0 | proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
14340 | 0 | *offset += 8; |
14341 | 0 | proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, *offset, 1, ENC_NA); |
14342 | 0 | *offset += 1; |
14343 | 0 | } |
14344 | 1 | } |
14345 | 6 | else if (req_type == ZBEE_ZCL_GP_PROXY_SINK_TABLE_REQ_CMD_REQUSET_BY_INDEX) { |
14346 | | /* Include index only */ |
14347 | 6 | proto_tree_add_item(tree, hf_zbee_zcl_proxy_sink_tbl_req_index, tvb, *offset, 1, ENC_NA); |
14348 | 6 | *offset += 1; |
14349 | 6 | } |
14350 | 7 | } /*dissect_zcl_gp_proxy_sink_table_request*/ |
14351 | | |
14352 | | /** |
14353 | | * dissect_zcl_gp_proxy_sink_table_response |
14354 | | * |
14355 | | * ZigBee ZCL Green Power cluster dissector for Proxy Table response |
14356 | | * and Sink Table Request commands |
14357 | | * |
14358 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
14359 | | * @param tvb - pointer to buffer containing raw packet. |
14360 | | * @param offset - pointer to buffer offset |
14361 | | * @param attr_id - attribute (should be ZBEE_ZCL_ATTR_GPS_SINK_TABLE or |
14362 | | * ZBEE_ZCL_ATTR_GPP_PROXY_TABLE) that will be reported |
14363 | | */ |
14364 | | static void |
14365 | | dissect_zcl_gp_proxy_sink_table_response(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id) |
14366 | 54 | { |
14367 | 54 | uint8_t entries_count, start_index; |
14368 | 54 | unsigned i, stop; |
14369 | | |
14370 | 54 | if ( !((attr_id == ZBEE_ZCL_ATTR_GPS_SINK_TABLE) || (attr_id == ZBEE_ZCL_ATTR_GPP_PROXY_TABLE)) ) { |
14371 | 0 | return; |
14372 | 0 | } |
14373 | | |
14374 | 54 | proto_tree_add_item(tree, hf_zbee_zcl_proxy_sink_tbl_resp_status, tvb, *offset, 1, ENC_NA); |
14375 | 54 | *offset += 1; |
14376 | 54 | proto_tree_add_item(tree, hf_zbee_zcl_proxy_sink_tbl_resp_entries_total, tvb, *offset, 1, ENC_NA); |
14377 | 54 | *offset += 1; |
14378 | 54 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_proxy_sink_tbl_resp_start_index, tvb, *offset, 1, ENC_NA, &start_index); |
14379 | 54 | *offset += 1; |
14380 | 54 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_proxy_sink_tbl_resp_entries_count, tvb, *offset, 1, ENC_NA, &entries_count); |
14381 | 54 | *offset += 1; |
14382 | | |
14383 | 82 | for (i = 0, stop = 0; i < entries_count && !stop; i++) { |
14384 | 56 | switch (attr_id) { |
14385 | 54 | case ZBEE_ZCL_ATTR_GPS_SINK_TABLE: |
14386 | 54 | stop = !dissect_zbee_zcl_gp_sink_table_entry(tvb, tree, (unsigned*) offset, start_index + i); |
14387 | 54 | break; |
14388 | 2 | case ZBEE_ZCL_ATTR_GPP_PROXY_TABLE: |
14389 | 2 | stop = !dissect_zbee_zcl_gp_proxy_table_entry(tvb, tree, (unsigned*) offset, start_index + i); |
14390 | 2 | break; |
14391 | 56 | } |
14392 | 56 | } |
14393 | 54 | } /*dissect_zcl_gp_proxy_sink_table_response*/ |
14394 | | |
14395 | | /** |
14396 | | * dissect_zcl_gp_sink_comm_mode |
14397 | | * |
14398 | | * ZigBee ZCL Green Power cluster dissector for Sink Commissioning Mode |
14399 | | * and Sink Table Request commands |
14400 | | * |
14401 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
14402 | | * @param tvb - pointer to buffer containing raw packet. |
14403 | | * @param offset - pointer to buffer offset |
14404 | | */ |
14405 | | static void |
14406 | | dissect_zcl_gp_sink_comm_mode(proto_tree *tree, tvbuff_t *tvb, unsigned *offset) |
14407 | 2 | { |
14408 | 2 | static int * const n_options[] = { |
14409 | 2 | &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_action, |
14410 | 2 | &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_secur, |
14411 | 2 | &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_pairing, |
14412 | 2 | &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_proxies, |
14413 | 2 | NULL |
14414 | 2 | }; |
14415 | | |
14416 | 2 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_gp_cmd_sink_comm_mode_options, |
14417 | 2 | ett_zbee_zcl_gp_cmd_sink_comm_mode_options, n_options, ENC_NA); |
14418 | 2 | *offset += 1; |
14419 | 2 | proto_tree_add_item(tree, hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_secur, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
14420 | 2 | *offset += 2; |
14421 | 2 | proto_tree_add_item(tree, hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_pairing, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
14422 | 2 | *offset += 2; |
14423 | 2 | proto_tree_add_item(tree, hf_zbee_gp_zcl_cmd_sink_comm_mode_sink_ep, tvb, *offset, 1, ENC_NA); |
14424 | 2 | *offset += 1; |
14425 | 2 | } /*dissect_zcl_gp_sink_comm_mode*/ |
14426 | | |
14427 | | /** |
14428 | | * dissect_zbee_zcl_gp |
14429 | | * |
14430 | | * ZigBee ZCL Green Power cluster dissector for wireshark. |
14431 | | * |
14432 | | * @param tvb - pointer to buffer containing raw packet. |
14433 | | * @param pinfo - pointer to packet information fields |
14434 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
14435 | | * @param data - pointer to ZCL packet structure. |
14436 | | * |
14437 | | * @return length of parsed data. |
14438 | | */ |
14439 | | static int |
14440 | | dissect_zbee_zcl_gp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) |
14441 | 404 | { |
14442 | 404 | static int * const gpp_gpd_link[] = { |
14443 | 404 | &hf_zbee_gpp_gpd_link_rssi, |
14444 | 404 | &hf_zbee_gpp_gpd_link_lqi, |
14445 | 404 | NULL |
14446 | 404 | }; |
14447 | | |
14448 | 404 | zbee_zcl_packet *zcl; |
14449 | 404 | unsigned offset = 0; |
14450 | 404 | uint8_t cmd_id; |
14451 | | |
14452 | | /* Reject the packet if data is NULL */ |
14453 | 404 | if (data == NULL) |
14454 | 0 | return 0; |
14455 | 404 | zcl = (zbee_zcl_packet *)data; |
14456 | 404 | cmd_id = zcl->cmd_id; |
14457 | | |
14458 | 404 | if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { |
14459 | | /* Append the command name to the info column. */ |
14460 | 268 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
14461 | 268 | val_to_str_const(cmd_id, zbee_zcl_gp_srv_rx_cmd_names, "Unknown Command"), |
14462 | 268 | zcl->tran_seqno); |
14463 | | |
14464 | | /* Add the command ID. */ |
14465 | 268 | proto_tree_add_item(tree, hf_zbee_zcl_gp_srv_rx_cmd_id, tvb, offset, 1, ENC_NA); |
14466 | 268 | offset++; |
14467 | | |
14468 | | /* Handle the command dissection. */ |
14469 | 268 | switch (cmd_id) { |
14470 | 33 | case ZBEE_CMD_ID_GP_NOTIFICATION: |
14471 | 33 | { |
14472 | 33 | static int * const n_options[] = { |
14473 | 33 | &hf_zbee_gp_cmd_notif_opt_app_id, |
14474 | 33 | &hf_zbee_gp_cmd_notif_opt_also_unicast, |
14475 | 33 | &hf_zbee_gp_cmd_notif_opt_also_derived_group, |
14476 | 33 | &hf_zbee_gp_cmd_notif_opt_also_comm_group, |
14477 | 33 | &hf_zbee_gp_cmd_notif_opt_secur_level, |
14478 | 33 | &hf_zbee_gp_cmd_notif_opt_secur_key_type, |
14479 | 33 | &hf_zbee_gp_cmd_notif_opt_rx_after_tx, |
14480 | 33 | &hf_zbee_gp_cmd_notif_opt_tx_q_full, |
14481 | 33 | &hf_zbee_gp_cmd_notif_opt_bidir_cap, |
14482 | 33 | &hf_zbee_gp_cmd_notif_opt_proxy_info_present, |
14483 | 33 | NULL |
14484 | 33 | }; |
14485 | 33 | uint16_t options = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN); |
14486 | | |
14487 | 33 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_notification_options, |
14488 | 33 | ett_zbee_gp_cmd_notification_options, n_options, ENC_LITTLE_ENDIAN); |
14489 | 33 | offset += 2; |
14490 | 33 | if ((options & ZBEE_ZCL_GP_NOTIFICATION_OPTION_APP_ID) == 0) { |
14491 | 5 | proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
14492 | 5 | offset += 4; |
14493 | 5 | } |
14494 | 28 | else { |
14495 | 28 | proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
14496 | 28 | offset += 8; |
14497 | 28 | proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, offset, 1, ENC_NA); |
14498 | 28 | offset += 1; |
14499 | 28 | } |
14500 | 33 | proto_tree_add_item(tree, hf_zbee_gp_secur_frame_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
14501 | 33 | offset += 4; |
14502 | | |
14503 | 33 | offset = dissect_zbee_zcl_gp_payload(tvb, pinfo, tree, offset); |
14504 | | |
14505 | 33 | if (options & ZBEE_ZCL_GP_NOTIFICATION_OPTION_PROXY_INFO_PRESENT) { |
14506 | 22 | proto_tree_add_item(tree, hf_zbee_gp_short_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
14507 | 22 | offset += 2; |
14508 | 22 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_gpp_gpd_link, |
14509 | 22 | ett_zbee_gp_gpp_gpd_link, |
14510 | 22 | gpp_gpd_link, ENC_LITTLE_ENDIAN); |
14511 | 22 | offset += 1; |
14512 | 22 | } |
14513 | 33 | break; |
14514 | 0 | } |
14515 | | |
14516 | 32 | case ZBEE_CMD_ID_GP_PAIRING_SEARCH: |
14517 | 34 | case ZBEE_CMD_ID_GP_TUNNELING_STOP: |
14518 | | /* TODO: add commands parse */ |
14519 | 34 | break; |
14520 | | |
14521 | 3 | case ZBEE_CMD_ID_GP_COMMISSIONING_NOTIFICATION: |
14522 | 3 | { |
14523 | 3 | static int * const commn_options[] = { |
14524 | 3 | &hf_zbee_gp_cmd_comm_notif_opt_app_id, |
14525 | 3 | &hf_zbee_gp_cmd_comm_notif_opt_rx_after_tx, |
14526 | 3 | &hf_zbee_gp_cmd_comm_notif_opt_secur_level, |
14527 | 3 | &hf_zbee_gp_cmd_comm_notif_opt_secur_key_type, |
14528 | 3 | &hf_zbee_gp_cmd_comm_notif_opt_secur_fail, |
14529 | 3 | &hf_zbee_gp_cmd_comm_notif_opt_bidir_cap, |
14530 | 3 | &hf_zbee_gp_cmd_comm_notif_opt_proxy_info_present, |
14531 | 3 | NULL |
14532 | 3 | }; |
14533 | 3 | uint16_t options = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN); |
14534 | | |
14535 | 3 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_commissioning_notification_options, |
14536 | 3 | ett_zbee_gp_cmd_commissioning_notification_options, commn_options, ENC_LITTLE_ENDIAN); |
14537 | 3 | offset += 2; |
14538 | 3 | if ((options & ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_APP_ID) == 0) { |
14539 | 1 | proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
14540 | 1 | offset += 4; |
14541 | 1 | } |
14542 | 2 | else { |
14543 | 2 | proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
14544 | 2 | offset += 8; |
14545 | 2 | proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, offset, 1, ENC_NA); |
14546 | 2 | offset += 1; |
14547 | 2 | } |
14548 | 3 | proto_tree_add_item(tree, hf_zbee_gp_secur_frame_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
14549 | 3 | offset += 4; |
14550 | | |
14551 | 3 | offset = dissect_zbee_zcl_gp_payload(tvb, pinfo, tree, offset); |
14552 | | |
14553 | 3 | if (options & ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_PROXY_INFO_PRESENT) { |
14554 | 1 | proto_tree_add_item(tree, hf_zbee_gp_short_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
14555 | 1 | offset += 2; |
14556 | 1 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_gpp_gpd_link, |
14557 | 1 | ett_zbee_gp_gpp_gpd_link, |
14558 | 1 | gpp_gpd_link, ENC_LITTLE_ENDIAN); |
14559 | 1 | offset += 1; |
14560 | 1 | } |
14561 | 3 | if (options & ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_FAILED) { |
14562 | 2 | proto_tree_add_item(tree, hf_zbee_gp_mic, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
14563 | 2 | offset += 4; |
14564 | 2 | } |
14565 | 3 | break; |
14566 | 32 | } |
14567 | | |
14568 | 57 | case ZBEE_CMD_ID_GP_PAIRING_CONFIGURATION: |
14569 | 57 | { |
14570 | 57 | static int * const pc_actions[] = { |
14571 | 57 | &hf_zbee_gp_cmd_pc_actions_action, |
14572 | 57 | &hf_zbee_gp_cmd_pc_actions_send_gp_pairing, |
14573 | 57 | NULL |
14574 | 57 | }; |
14575 | 57 | static int * const pc_options[] = { |
14576 | 57 | &hf_zbee_gp_cmd_pc_opt_app_id, |
14577 | 57 | &hf_zbee_gp_cmd_pc_opt_communication_mode, |
14578 | 57 | &hf_zbee_gp_cmd_pc_opt_seq_number_cap, |
14579 | 57 | &hf_zbee_gp_cmd_px_opt_rx_on_cap, |
14580 | 57 | &hf_zbee_gp_cmd_pc_opt_fixed_location, |
14581 | 57 | &hf_zbee_gp_cmd_pc_opt_assigned_alias, |
14582 | 57 | &hf_zbee_gp_cmd_pc_opt_security_use, |
14583 | 57 | &hf_zbee_gp_cmd_pc_opt_app_info_present, |
14584 | 57 | NULL |
14585 | 57 | }; |
14586 | 57 | uint16_t options; |
14587 | | |
14588 | 57 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_pc_actions, |
14589 | 57 | ett_zbee_gp_cmd_pc_actions, pc_actions, ENC_NA); |
14590 | 57 | offset += 1; |
14591 | | |
14592 | 57 | options = tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN); |
14593 | | |
14594 | 57 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_pc_options, |
14595 | 57 | ett_zbee_gp_cmd_pc_options, pc_options, ENC_LITTLE_ENDIAN); |
14596 | 57 | offset += 2; |
14597 | | |
14598 | 57 | if ((options & ZBEE_ZCL_GP_CMD_PC_OPT_APP_ID) == 0) { |
14599 | 6 | proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
14600 | 6 | offset += 4; |
14601 | 6 | } |
14602 | 51 | else { |
14603 | 51 | proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
14604 | 51 | offset += 8; |
14605 | 51 | proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, offset, 1, ENC_NA); |
14606 | 51 | offset += 1; |
14607 | 51 | } |
14608 | | |
14609 | 57 | proto_tree_add_item(tree, hf_zbee_gp_device_id, tvb, offset, 1, ENC_NA); |
14610 | 57 | offset += 1; |
14611 | | |
14612 | 57 | if (((options & ZBEE_ZCL_GP_CMD_PC_OPT_COMMUNICATION_MODE) >> ZBEE_ZCL_GP_PAIRING_CONFIGURATION_OPTION_COMMUNICATION_MODE_SHIFT) |
14613 | 57 | == ZBEE_ZCL_GP_COMMUNICATION_MODE_GROUPCAST_PRECOMMISSIONED) { |
14614 | 12 | uint8_t len = tvb_get_uint8(tvb, offset); |
14615 | 12 | proto_tree *gl_tree = proto_tree_add_subtree_format(tree, tvb, offset, len*4+1, ett_zbee_zcl_gp_group_list, NULL, "GroupList #%d", len); |
14616 | | |
14617 | 12 | proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_len, tvb, offset, 1, ENC_NA); |
14618 | 12 | offset += 1; |
14619 | 193 | while (len) |
14620 | 181 | { |
14621 | 181 | proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_group_id, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
14622 | 181 | offset += 2; |
14623 | 181 | proto_tree_add_item(gl_tree, hf_zbee_gp_group_list_alias, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
14624 | 181 | offset += 2; |
14625 | 181 | len--; |
14626 | 181 | } |
14627 | 12 | } |
14628 | | |
14629 | 57 | if (options & ZBEE_ZCL_GP_CMD_PC_OPT_ASSIGNED_ALIAS) { |
14630 | 21 | proto_tree_add_item(tree, hf_zbee_gp_assigned_alias, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
14631 | 21 | offset += 2; |
14632 | 21 | } |
14633 | | |
14634 | 57 | proto_tree_add_item(tree, hf_zbee_gp_forwarding_radius, tvb, offset, 1, ENC_NA); |
14635 | 57 | offset += 1; |
14636 | | |
14637 | 57 | if (options & ZBEE_ZCL_GP_CMD_PC_OPT_SECURITY_USE) { |
14638 | 35 | static int * const secur_options[] = { |
14639 | 35 | &hf_zbee_gp_cmd_pc_secur_level, |
14640 | 35 | &hf_zbee_gp_cmd_pc_secur_key_type, |
14641 | 35 | NULL |
14642 | 35 | }; |
14643 | 35 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_pc_secur_options, |
14644 | 35 | ett_zbee_gp_cmd_pc_secur_options, secur_options, ENC_NA); |
14645 | 35 | offset += 1; |
14646 | 35 | proto_tree_add_item(tree, hf_zbee_gp_secur_frame_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
14647 | 35 | offset += 4; |
14648 | 35 | proto_tree_add_item(tree, hf_zbee_gp_gpd_key, tvb, offset, 16, ENC_NA); |
14649 | 35 | offset += 16; |
14650 | 35 | } |
14651 | 57 | { |
14652 | 57 | uint8_t n_paired_endpoints = tvb_get_uint8(tvb, offset); |
14653 | 57 | proto_tree *ep_tree = proto_tree_add_subtree_format(tree, tvb, offset, n_paired_endpoints+1, ett_zbee_zcl_gp_ep, NULL, "Paired Endpoints #%d", n_paired_endpoints); |
14654 | 57 | proto_tree_add_item(ep_tree, hf_zbee_gp_n_paired_endpoints, tvb, offset, 1, ENC_NA); |
14655 | 57 | offset += 1; |
14656 | 57 | if (n_paired_endpoints != 0 && n_paired_endpoints != 0xfd |
14657 | 44 | && n_paired_endpoints != 0xfe && n_paired_endpoints != 0xff) |
14658 | 38 | { |
14659 | 2.09k | while (n_paired_endpoints) |
14660 | 2.05k | { |
14661 | 2.05k | proto_tree_add_item(ep_tree, hf_zbee_gp_paired_endpoint, tvb, offset, 1, ENC_NA); |
14662 | 2.05k | offset += 1; |
14663 | 2.05k | n_paired_endpoints--; |
14664 | 2.05k | } |
14665 | 38 | } |
14666 | 57 | } |
14667 | 57 | if (options & ZBEE_ZCL_GP_CMD_PC_OPT_APP_INFO_PRESENT) { |
14668 | 38 | static int * const app_info[] = { |
14669 | 38 | &hf_zbee_gp_cmd_pc_app_info_manuf_id_present, |
14670 | 38 | &hf_zbee_gp_cmd_pc_app_info_model_id_present, |
14671 | 38 | &hf_zbee_gp_cmd_pc_app_info_gpd_commands_present, |
14672 | 38 | &hf_zbee_gp_cmd_pc_app_info_cluster_list_present, |
14673 | 38 | NULL |
14674 | 38 | }; |
14675 | 38 | uint8_t appi = tvb_get_uint8(tvb, offset); |
14676 | | |
14677 | 38 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_pc_app_info, |
14678 | 38 | ett_zbee_gp_cmd_pc_app_info, app_info, ENC_NA); |
14679 | 38 | offset += 1; |
14680 | 38 | if (appi & ZBEE_ZCL_GP_CMD_PC_APP_INFO_MANUF_ID_PRESENT) { |
14681 | 22 | proto_tree_add_item(tree, hf_zbee_zcl_gp_manufacturer_id, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
14682 | 22 | offset += 2; |
14683 | 22 | } |
14684 | 38 | if (appi & ZBEE_ZCL_GP_CMD_PC_APP_INFO_MODEL_ID_PRESENT) { |
14685 | 24 | proto_tree_add_item(tree, hf_zbee_zcl_gp_model_id, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
14686 | 24 | offset += 2; |
14687 | 24 | } |
14688 | 38 | if (appi & ZBEE_ZCL_GP_CMD_PC_APP_INFO_GPD_COMMANDS_PRESENT) { |
14689 | 24 | uint8_t n_commands = tvb_get_uint8(tvb, offset); |
14690 | 24 | proto_tree *c_tree = proto_tree_add_subtree_format(tree, tvb, offset, n_commands+1, ett_zbee_zcl_gp_cmds, NULL, "GPD CommandID list #%d", n_commands); |
14691 | 24 | proto_tree_add_item(c_tree, hf_zbee_gp_n_gpd_commands, tvb, offset, 1, ENC_NA); |
14692 | 24 | offset += 1; |
14693 | 1.75k | while (n_commands) |
14694 | 1.73k | { |
14695 | 1.73k | proto_tree_add_item(c_tree, hf_zbee_gp_gpd_command, tvb, offset, 1, ENC_NA); |
14696 | 1.73k | offset += 1; |
14697 | 1.73k | n_commands--; |
14698 | 1.73k | } |
14699 | 24 | } |
14700 | 38 | if (appi & ZBEE_ZCL_GP_CMD_PC_APP_INFO_CLUSTER_LIST_PRESENT) { |
14701 | 23 | uint8_t n = tvb_get_uint8(tvb, offset); |
14702 | 23 | uint8_t n_srv_clusters = n & ZBEE_ZCL_GP_CLUSTER_LIST_LEN_SRV; |
14703 | 23 | uint8_t n_cli_clusters = (n & ZBEE_ZCL_GP_CLUSTER_LIST_LEN_CLI) >> ZBEE_ZCL_GP_CLUSTER_LIST_LEN_CLI_SHIFT; |
14704 | 23 | proto_tree *cl_tree = proto_tree_add_subtree_format(tree, tvb, offset, n*2+1, ett_zbee_zcl_gp_clusters, NULL, "Cluster List #%d/%d", n_srv_clusters, n_cli_clusters); |
14705 | 23 | proto_tree_add_item(cl_tree, hf_zbee_gp_n_srv_clusters, tvb, offset, 1, ENC_NA); |
14706 | 23 | proto_tree_add_item(cl_tree, hf_zbee_gp_n_cli_clusters, tvb, offset, 1, ENC_NA); |
14707 | 23 | offset += 1; |
14708 | 23 | if (n_srv_clusters) |
14709 | 18 | { |
14710 | 18 | proto_tree *s_tree = proto_tree_add_subtree_format(cl_tree, tvb, offset, n_srv_clusters*2, ett_zbee_zcl_gp_srv_clusters, NULL, "Server clusters #%d", n_srv_clusters); |
14711 | 133 | while (n_srv_clusters) |
14712 | 115 | { |
14713 | 115 | proto_tree_add_item(s_tree, hf_zbee_gp_gpd_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
14714 | 115 | offset += 2; |
14715 | 115 | n_srv_clusters--; |
14716 | 115 | } |
14717 | 18 | } |
14718 | 23 | if (n_cli_clusters) |
14719 | 15 | { |
14720 | 15 | proto_tree *c_tree = proto_tree_add_subtree_format(cl_tree, tvb, offset, n_cli_clusters*2, ett_zbee_zcl_gp_cli_clusters, NULL, "Client clusters #%d", n_cli_clusters); |
14721 | 93 | while (n_cli_clusters) |
14722 | 78 | { |
14723 | 78 | proto_tree_add_item(c_tree, hf_zbee_gp_gpd_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
14724 | 78 | offset += 2; |
14725 | 78 | n_cli_clusters--; |
14726 | 78 | } |
14727 | 15 | } |
14728 | 23 | } |
14729 | 38 | } |
14730 | 57 | break; |
14731 | 32 | } |
14732 | | |
14733 | 2 | case ZBEE_CMD_ID_GP_SINK_COMMISSIONING_MODE: |
14734 | 2 | dissect_zcl_gp_sink_comm_mode(tree, tvb, &offset); |
14735 | 2 | break; |
14736 | 0 | case ZBEE_CMD_ID_GP_TRANSLATION_TABLE_UPDATE_COMMAND: |
14737 | 1 | case ZBEE_CMD_ID_GP_TRANSLATION_TABLE_REQUEST: |
14738 | | /* TODO: add commands parse */ |
14739 | 1 | break; |
14740 | 5 | case ZBEE_CMD_ID_GP_SINK_TABLE_REQUEST: |
14741 | 5 | dissect_zcl_gp_proxy_sink_table_request(tree, tvb, &offset); |
14742 | 5 | break; |
14743 | 3 | case ZBEE_CMD_ID_GP_PROXY_TABLE_RESPONSE: |
14744 | 3 | dissect_zcl_gp_proxy_sink_table_response(tree, tvb, &offset, ZBEE_ZCL_ATTR_GPP_PROXY_TABLE); |
14745 | 3 | break; |
14746 | | |
14747 | 130 | default: |
14748 | 130 | break; |
14749 | 268 | } /* switch */ |
14750 | 268 | } else { |
14751 | | /* Append the command name to the info column. */ |
14752 | 136 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
14753 | 136 | val_to_str_const(cmd_id, zbee_zcl_gp_srv_tx_cmd_names, "Unknown Command"), |
14754 | 136 | zcl->tran_seqno); |
14755 | | |
14756 | | /* Add the command ID. */ |
14757 | 136 | proto_tree_add_item(tree, hf_zbee_zcl_gp_srv_tx_cmd_id, tvb, offset, 1, ENC_NA); |
14758 | 136 | offset++; |
14759 | | |
14760 | | /* Handle the command dissection. */ |
14761 | 136 | switch (cmd_id) { |
14762 | 6 | case ZBEE_ZCL_CMD_ID_GP_NOTIFICATION_RESPONSE: |
14763 | | /* TODO: add commands parse */ |
14764 | 6 | break; |
14765 | | |
14766 | 9 | case ZBEE_ZCL_CMD_ID_GP_PAIRING: |
14767 | 9 | { |
14768 | 9 | static int * const p_options[] = { |
14769 | 9 | &hf_zbee_gp_cmd_pairing_opt_app_id, |
14770 | 9 | &hf_zbee_gp_cmd_pairing_opt_add_sink, |
14771 | 9 | &hf_zbee_gp_cmd_pairing_opt_remove_gpd, |
14772 | 9 | &hf_zbee_gp_cmd_pairing_opt_communication_mode, |
14773 | 9 | &hf_zbee_gp_cmd_pairing_opt_gpd_fixed, |
14774 | 9 | &hf_zbee_gp_cmd_pairing_opt_gpd_mac_seq_num_cap, |
14775 | 9 | &hf_zbee_gp_cmd_pairing_opt_secur_level, |
14776 | 9 | &hf_zbee_gp_cmd_pairing_opt_secur_key_type, |
14777 | 9 | &hf_zbee_gp_cmd_pairing_opt_gpd_frame_cnt_present, |
14778 | 9 | &hf_zbee_gp_cmd_pairing_opt_gpd_secur_key_present, |
14779 | 9 | &hf_zbee_gp_cmd_pairing_opt_assigned_alias_present, |
14780 | 9 | &hf_zbee_gp_cmd_pairing_opt_fwd_radius_present, |
14781 | 9 | NULL |
14782 | 9 | }; |
14783 | 9 | uint32_t options = tvb_get_uint24(tvb, offset, ENC_LITTLE_ENDIAN); |
14784 | | |
14785 | 9 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_pairing_options, |
14786 | 9 | ett_zbee_gp_cmd_pairing_options, p_options, ENC_LITTLE_ENDIAN); |
14787 | 9 | offset += 3; |
14788 | 9 | if ((options & ZBEE_ZCL_GP_PAIRING_OPTION_APP_ID) == 0) { |
14789 | 3 | proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
14790 | 3 | offset += 4; |
14791 | 3 | } |
14792 | 6 | else { |
14793 | 6 | proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
14794 | 6 | offset += 8; |
14795 | 6 | proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, offset, 1, ENC_NA); |
14796 | 6 | offset += 1; |
14797 | 6 | } |
14798 | 9 | if ((options & ZBEE_ZCL_GP_PAIRING_OPTION_REMOVE_GPD) == 0 && |
14799 | | /* see Table 37 */ |
14800 | 3 | (options & ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE) == ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE) { |
14801 | 0 | proto_tree_add_item(tree, hf_zbee_gp_sink_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
14802 | 0 | offset += 8; |
14803 | 0 | proto_tree_add_item(tree, hf_zbee_gp_sink_nwk, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
14804 | 0 | offset += 2; |
14805 | 0 | } |
14806 | 9 | if ((options & ZBEE_ZCL_GP_PAIRING_OPTION_REMOVE_GPD) == 0 && |
14807 | 3 | (options & ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE) != ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE && |
14808 | 3 | (options & ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE) != 0) { |
14809 | 0 | proto_tree_add_item(tree, hf_zbee_gp_sink_group_id, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
14810 | 0 | offset += 2; |
14811 | 0 | } |
14812 | 9 | if (options & ZBEE_ZCL_GP_PAIRING_OPTION_ADD_SINK) { |
14813 | 0 | proto_tree_add_item(tree, hf_zbee_gp_device_id, tvb, offset, 1, ENC_NA); |
14814 | 0 | offset += 1; |
14815 | 0 | } |
14816 | 9 | if (options & ZBEE_ZCL_GP_PAIRING_OPTION_GPD_FRAME_CNT_PRESENT) { |
14817 | 4 | proto_tree_add_item(tree, hf_zbee_gp_secur_frame_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
14818 | 4 | offset += 4; |
14819 | 4 | } |
14820 | 9 | if (options & ZBEE_ZCL_GP_PAIRING_OPTION_GPD_SECUR_KEY_PRESENT) { |
14821 | 1 | proto_tree_add_item(tree, hf_zbee_gp_gpd_key, tvb, offset, 16, ENC_NA); |
14822 | 1 | offset += 16; |
14823 | 1 | } |
14824 | 9 | if (options & ZBEE_ZCL_GP_PAIRING_OPTION_ASSIGNED_ALIAS_PRESENT) { |
14825 | 2 | proto_tree_add_item(tree, hf_zbee_gp_assigned_alias, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
14826 | 2 | offset += 2; |
14827 | 2 | } |
14828 | 9 | if (options & ZBEE_ZCL_GP_PAIRING_OPTION_FWD_RADIUS_PRESENT) { |
14829 | 2 | proto_tree_add_item(tree, hf_zbee_gp_forwarding_radius, tvb, offset, 1, ENC_NA); |
14830 | 2 | offset += 1; |
14831 | 2 | } |
14832 | 9 | break; |
14833 | 0 | } |
14834 | | |
14835 | 10 | case ZBEE_ZCL_CMD_ID_GP_PROXY_COMMISSIONING_MODE: |
14836 | 10 | { |
14837 | 10 | static int * const pcm_options[] = { |
14838 | 10 | &hf_zbee_gp_cmd_pcm_opt_action, |
14839 | 10 | &hf_zbee_gp_cmd_pcm_opt_exit_mode, |
14840 | 10 | &hf_zbee_gp_cmd_pcm_opt_channel_present, |
14841 | 10 | &hf_zbee_gp_cmd_pcm_opt_unicast_comm, |
14842 | 10 | NULL |
14843 | 10 | }; |
14844 | 10 | uint8_t options = tvb_get_uint8(tvb, offset); |
14845 | 10 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_proxy_commissioning_mode_options, |
14846 | 10 | ett_zbee_gp_cmd_proxy_commissioning_mode_options, pcm_options, ENC_NA); |
14847 | 10 | if (options & ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ACTION) { |
14848 | 6 | static int * const exit_mode[] = { |
14849 | 6 | &hf_zbee_gp_cmd_pcm_exit_mode_on_comm_window_expire, |
14850 | 6 | &hf_zbee_gp_cmd_pcm_exit_mode_on_pairing_success, |
14851 | 6 | &hf_zbee_gp_cmd_pcm_exit_mode_on_gp_proxy_comm_mode, |
14852 | 6 | NULL |
14853 | 6 | }; |
14854 | 6 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_proxy_commissioning_mode_exit_mode, |
14855 | 6 | ett_zbee_gp_cmd_proxy_commissioning_mode_exit_mode, exit_mode, ENC_NA); |
14856 | 6 | } |
14857 | 10 | offset += 1; |
14858 | 10 | if (options & ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_COMMISSIONING_WINDOW_EXPIRATION) { |
14859 | 4 | proto_tree_add_item(tree, hf_zbee_zcl_gp_commissioning_window, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
14860 | 4 | offset += 2; |
14861 | 4 | } |
14862 | 10 | if (options & ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_CHANNEL_PRESENT) { |
14863 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_gp_channel, tvb, offset, 1, ENC_NA); |
14864 | 0 | offset += 1; |
14865 | 0 | } |
14866 | 10 | break; |
14867 | 0 | } |
14868 | | |
14869 | 1 | case ZBEE_ZCL_CMD_ID_GP_RESPONSE: |
14870 | 1 | { |
14871 | 1 | static int * const rsp_options[] = { |
14872 | 1 | &hf_zbee_gp_cmd_resp_opt_app_id, |
14873 | 1 | &hf_zbee_gp_cmd_resp_opt_tx_on_ep_match, |
14874 | 1 | NULL |
14875 | 1 | }; |
14876 | 1 | static int * const tx_ch[] = { |
14877 | 1 | &hf_zbee_gp_cmd_resp_tx_channel, |
14878 | 1 | NULL |
14879 | 1 | }; |
14880 | 1 | uint8_t options = tvb_get_uint8(tvb, offset); |
14881 | | |
14882 | 1 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_response_options, |
14883 | 1 | ett_zbee_gp_cmd_response_options, rsp_options, ENC_LITTLE_ENDIAN); |
14884 | 1 | offset += 1; |
14885 | 1 | proto_tree_add_item(tree, hf_zbee_gp_tmp_master_short_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
14886 | 1 | offset += 2; |
14887 | 1 | proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_gp_cmd_response_tx_channel, |
14888 | 1 | ett_zbee_gp_cmd_response_tx_channel, tx_ch, ENC_LITTLE_ENDIAN); |
14889 | 1 | offset += 1; |
14890 | | |
14891 | 1 | if ((options & ZBEE_ZCL_GP_RESPONSE_OPTION_APP_ID) == 0) { |
14892 | 0 | proto_tree_add_item(tree, hf_zbee_gp_src_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
14893 | 0 | offset += 4; |
14894 | 0 | } |
14895 | 1 | else { |
14896 | 1 | proto_tree_add_item(tree, hf_zbee_gp_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN); |
14897 | 1 | offset += 8; |
14898 | 1 | proto_tree_add_item(tree, hf_zbee_gp_endpoint, tvb, offset, 1, ENC_NA); |
14899 | 1 | offset += 1; |
14900 | 1 | } |
14901 | | |
14902 | 1 | offset = dissect_zbee_zcl_gp_payload(tvb, pinfo, tree, offset); |
14903 | 1 | break; |
14904 | 0 | } |
14905 | 0 | case ZBEE_ZCL_CMD_ID_GP_TRANS_TBL_RESPONSE: |
14906 | | /* TODO: add commands parse */ |
14907 | 0 | break; |
14908 | 51 | case ZBEE_ZCL_CMD_ID_GP_SINK_TABLE_RESPONSE: |
14909 | 51 | dissect_zcl_gp_proxy_sink_table_response(tree, tvb, &offset, ZBEE_ZCL_ATTR_GPS_SINK_TABLE); |
14910 | 51 | break; |
14911 | 2 | case ZBEE_ZCL_CMD_ID_GP_PROXY_TABLE_REQUEST: |
14912 | 2 | dissect_zcl_gp_proxy_sink_table_request(tree, tvb, &offset); |
14913 | 2 | break; |
14914 | 57 | default: |
14915 | 57 | break; |
14916 | 136 | } /* switch */ |
14917 | 136 | } |
14918 | | |
14919 | | /* Call the data dissector for any leftover bytes. */ |
14920 | 329 | if (tvb_captured_length(tvb) > offset) { |
14921 | 285 | call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree); |
14922 | 285 | } |
14923 | | |
14924 | 329 | return tvb_captured_length(tvb); |
14925 | 404 | } /* dissect_zbee_zcl_gp */ |
14926 | | |
14927 | | |
14928 | | /** |
14929 | | * dissect_zcl_gp_attr_data |
14930 | | * |
14931 | | * this function is called by ZCL foundation dissector in order to decode |
14932 | | * specific cluster attributes data. |
14933 | | * |
14934 | | * @param tree - pointer to data tree Wireshark uses to display packet. |
14935 | | * @param tvb - pointer to buffer containing raw packet. |
14936 | | * @param offset - pointer to buffer offset |
14937 | | * @param attr_id - attribute identifier |
14938 | | * @param data_type - attribute data type |
14939 | | * @param client_attr - ZCL client |
14940 | | */ |
14941 | | static void |
14942 | | dissect_zcl_gp_attr_data(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id _U_, unsigned data_type, bool client_attr) |
14943 | 6.70k | { |
14944 | | /* Dissect attribute data type and data */ |
14945 | 6.70k | switch (attr_id) { |
14946 | 159 | case ZBEE_ZCL_ATTR_GPS_SINK_TABLE: |
14947 | 159 | *offset = dissect_zbee_zcl_gp_sink_table(tvb, tree, *offset); |
14948 | 159 | break; |
14949 | 40 | case ZBEE_ZCL_ATTR_GPS_COMMUNICATION_MODE: |
14950 | 40 | *offset = dissect_zbee_zcl_gp_attr_gps_communication_mode(tvb, tree, *offset); |
14951 | 40 | break; |
14952 | 82 | case ZBEE_ZCL_ATTR_GPS_COMMISSIONING_EXIT_MODE: |
14953 | 82 | *offset = dissect_zbee_zcl_gp_attr_gps_comm_exit_mode(tvb, tree, *offset); |
14954 | 82 | break; |
14955 | 44 | case ZBEE_ZCL_ATTR_GPS_SECURITY_LEVEL: |
14956 | 44 | *offset = dissect_zbee_zcl_gp_attr_gps_secur_lvl(tvb, tree, *offset); |
14957 | 44 | break; |
14958 | 50 | case ZBEE_ZCL_ATTR_GPS_FUNCTIONALITY: |
14959 | 50 | *offset = dissect_zbee_zcl_gp_attr_gps_functionality(tvb, tree, *offset); |
14960 | 50 | break; |
14961 | 7 | case ZBEE_ZCL_ATTR_GPS_ACTIVE_FUNCTIONALITY: |
14962 | 7 | *offset = dissect_zbee_zcl_gp_attr_gps_active_functionality(tvb, tree, *offset); |
14963 | 7 | break; |
14964 | 128 | case ZBEE_ZCL_ATTR_GPP_PROXY_TABLE: |
14965 | 128 | *offset = dissect_zbee_zcl_gp_proxy_table(tvb, tree, *offset); |
14966 | 128 | break; |
14967 | 14 | case ZBEE_ZCL_ATTR_GPP_FUNCTIONALITY: |
14968 | 14 | *offset = dissect_zbee_zcl_gp_attr_gpp_functionality(tvb, tree, *offset); |
14969 | 14 | break; |
14970 | 11 | case ZBEE_ZCL_ATTR_GPP_ACTIVE_FUNCTIONALITY: |
14971 | 11 | *offset = dissect_zbee_zcl_gp_attr_gpp_active_functionality(tvb, tree, *offset); |
14972 | 11 | break; |
14973 | 6.17k | default: |
14974 | 6.17k | dissect_zcl_attr_data(tvb, pinfo, tree, offset, data_type, client_attr); |
14975 | 6.70k | } |
14976 | | |
14977 | | |
14978 | 6.70k | } /*dissect_zcl_gp_attr_data*/ |
14979 | | |
14980 | | /** |
14981 | | * proto_register_zbee_zcl_gp |
14982 | | * |
14983 | | * ZigBee ZCL Green Power cluster protocol registration. |
14984 | | */ |
14985 | | void |
14986 | | proto_register_zbee_zcl_gp(void) |
14987 | 16 | { |
14988 | | /* Setup list of header fields */ |
14989 | 16 | static hf_register_info hf[] = { |
14990 | | |
14991 | 16 | { &hf_zbee_zcl_gp_attr_id, |
14992 | 16 | { "Attribute", "zbee_zcl_general.gp.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_gp_attr_names), |
14993 | 16 | 0x0, NULL, HFILL } }, |
14994 | | |
14995 | 16 | { &hf_zbee_zcl_gp_srv_rx_cmd_id, |
14996 | 16 | { "Command", "zbee_zcl_general.gp.cmd.srv_rx.id", FT_UINT8, BASE_HEX, |
14997 | 16 | VALS(zbee_zcl_gp_srv_rx_cmd_names), 0x0, NULL, HFILL }}, |
14998 | | |
14999 | 16 | { &hf_zbee_zcl_gp_srv_tx_cmd_id, |
15000 | 16 | { "Command", "zbee_zcl_general.gp.cmd.srv_tx.id", FT_UINT8, BASE_HEX, |
15001 | 16 | VALS(zbee_zcl_gp_srv_tx_cmd_names), 0x0, NULL, HFILL }}, |
15002 | | |
15003 | | /* GP Proxy Commissioning Mode command */ |
15004 | 16 | { &hf_zbee_gp_cmd_proxy_commissioning_mode_options, |
15005 | 16 | { "Options", "zbee_zcl_general.gp.proxy_comm_mode.options", FT_UINT8, BASE_HEX, |
15006 | 16 | NULL, 0x0, NULL, HFILL }}, |
15007 | 16 | { &hf_zbee_zcl_gp_commissioning_window, |
15008 | 16 | { "Commissioning window", "zbee_zcl_general.gp.proxy_comm_mode.comm_window", FT_UINT16, BASE_DEC, |
15009 | 16 | NULL, 0x0, "Commissioning window in seconds", HFILL }}, |
15010 | 16 | { &hf_zbee_zcl_gp_channel, |
15011 | 16 | { "Channel", "zbee_zcl_general.gp.proxy_comm_mode.channel", FT_UINT8, BASE_DEC, |
15012 | 16 | NULL, 0x0, "Identifier of the channel the devices SHOULD switch to on reception", HFILL }}, |
15013 | 16 | { &hf_zbee_gp_cmd_pcm_opt_action, |
15014 | 16 | { "Action", "zbee_zcl_general.gp.proxy_comm_mode.opt.action", FT_UINT8, BASE_DEC, |
15015 | 16 | VALS(zbee_zcl_gp_comm_mode_actions), ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ACTION, NULL, HFILL }}, |
15016 | 16 | { &hf_zbee_gp_cmd_pcm_opt_exit_mode, |
15017 | 16 | { "Exit mode", "zbee_zcl_general.gp.proxy_comm_mode.opt.exit_mode", FT_UINT8, BASE_HEX, |
15018 | 16 | NULL, ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_EXIT_MODE, "Commissioning mode exit requirements", HFILL }}, |
15019 | 16 | { &hf_zbee_gp_cmd_pcm_opt_channel_present, |
15020 | 16 | { "Channel present", "zbee_zcl_general.gp.proxy_comm_mode.opt.ch_present", FT_BOOLEAN, 8, |
15021 | 16 | NULL, ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_CHANNEL_PRESENT, "If set to 0b1, it indicates that the Channel field is present", HFILL }}, |
15022 | 16 | { &hf_zbee_gp_cmd_pcm_opt_unicast_comm, |
15023 | 16 | { "Unicast", "zbee_zcl_general.gp.proxy_comm_mode.opt.unicast", FT_BOOLEAN, 8, |
15024 | 16 | NULL, ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_UNICAST, "Send the GP Commissioning Notification commands in broadcast (0) vs unicast (1)", HFILL }}, |
15025 | 16 | { &hf_zbee_gp_cmd_proxy_commissioning_mode_exit_mode, |
15026 | 16 | { "Exit mode", "zbee_zcl_general.gp.proxy_comm_mode.opt.exit_mode", FT_UINT8, BASE_HEX, |
15027 | 16 | NULL, ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_EXIT_MODE, "Commissioning mode exit requirements", HFILL }}, |
15028 | 16 | { &hf_zbee_gp_cmd_pcm_exit_mode_on_comm_window_expire, |
15029 | 16 | { "On Window expire", "zbee_zcl_general.gp.proxy_comm_mode.opt.exit_mode.win_expire", FT_BOOLEAN, 8, |
15030 | 16 | NULL, ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_COMMISSIONING_WINDOW_EXPIRATION, "On CommissioningWindow expiration", HFILL }}, |
15031 | 16 | { &hf_zbee_gp_cmd_pcm_exit_mode_on_pairing_success, |
15032 | 16 | { "On first Pairing success", "zbee_zcl_general.gp.proxy_comm_mode.opt.exit_mode.pair_succs", FT_BOOLEAN, 8, |
15033 | 16 | NULL, ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_PAIRING_SUCCESS, NULL, HFILL }}, |
15034 | 16 | { &hf_zbee_gp_cmd_pcm_exit_mode_on_gp_proxy_comm_mode, |
15035 | 16 | { "On GP Proxy Commissioning Mode", "zbee_zcl_general.gp.proxy_comm_mode.opt.exit_mode.proxy_comm_mode", FT_BOOLEAN, 8, |
15036 | 16 | NULL, ZBEE_ZCL_GP_PROXY_COMMISSIONING_MODE_OPTION_ON_GP_PROXY_COMM_MODE, "On GP Proxy Commissioning Mode (exit)", HFILL }}, |
15037 | | |
15038 | | /* GP Commissioning Notification command */ |
15039 | 16 | { &hf_zbee_gp_cmd_commissioning_notification_options, |
15040 | 16 | { "Options", "zbee_zcl_general.gp.comm_notif.options", FT_UINT16, BASE_HEX, |
15041 | 16 | NULL, 0x0, NULL, HFILL }}, |
15042 | 16 | { &hf_zbee_gp_cmd_comm_notif_opt_app_id, |
15043 | 16 | { "ApplicationID", "zbee_zcl_general.gp.comm_notif.opt.app_id", FT_UINT16, BASE_HEX, |
15044 | 16 | VALS(zbee_zcl_gp_app_ids), ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_APP_ID, NULL, HFILL }}, |
15045 | 16 | { &hf_zbee_gp_cmd_comm_notif_opt_rx_after_tx, |
15046 | 16 | { "RxAfterTx", "zbee_zcl_general.gp.comm_notif.opt.rx_after_tx", FT_BOOLEAN, 16, |
15047 | 16 | NULL, ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_RX_AFTER_TX, NULL, HFILL }}, |
15048 | 16 | { &hf_zbee_gp_cmd_comm_notif_opt_secur_level, |
15049 | 16 | { "SecurityLevel", "zbee_zcl_general.gp.comm_notif.opt.secur_lev", FT_UINT16, BASE_HEX, |
15050 | 16 | VALS(zbee_zcl_gp_secur_levels), ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_LEVEL, NULL, HFILL }}, |
15051 | 16 | { &hf_zbee_gp_cmd_comm_notif_opt_secur_key_type, |
15052 | 16 | { "SecurityKeyType", "zbee_zcl_general.gp.comm_notif.opt.secur_key_type", FT_UINT16, BASE_HEX, |
15053 | 16 | VALS(zbee_zcl_gp_secur_key_types), ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_KEY_TYPE, NULL, HFILL }}, |
15054 | 16 | { &hf_zbee_gp_cmd_comm_notif_opt_secur_fail, |
15055 | 16 | { "Security processing failed", "zbee_zcl_general.gp.comm_notif.opt.secur_failed", FT_BOOLEAN, 16, |
15056 | 16 | NULL, ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_SECUR_FAILED, NULL, HFILL }}, |
15057 | 16 | { &hf_zbee_gp_cmd_comm_notif_opt_bidir_cap, |
15058 | 16 | { "Bidirectional Capability", "zbee_zcl_general.gp.comm_notif.opt.bidir_cap", FT_BOOLEAN, 16, |
15059 | 16 | NULL, ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_BIDIR_CAP, NULL, HFILL }}, |
15060 | 16 | { &hf_zbee_gp_cmd_comm_notif_opt_proxy_info_present, |
15061 | 16 | { "Proxy info present", "zbee_zcl_general.gp.comm_notif.opt.proxy_info", FT_BOOLEAN, 16, |
15062 | 16 | NULL, ZBEE_ZCL_GP_COMMISSIONING_NOTIFICATION_OPTION_PROXY_INFO_PRESENT, NULL, HFILL }}, |
15063 | 16 | { &hf_zbee_gp_src_id, |
15064 | 16 | { "SrcID", "zbee_zcl_general.gp.src_id", FT_UINT32, BASE_HEX, |
15065 | 16 | NULL, 0, "GPD Source identifier", HFILL }}, |
15066 | 16 | { &hf_zbee_gp_ieee, |
15067 | 16 | { "GPD IEEE", "zbee_zcl_general.gp.gpd_ieee", FT_EUI64, BASE_NONE, |
15068 | 16 | NULL, 0, "GPD IEEE address", HFILL }}, |
15069 | 16 | { &hf_zbee_gp_endpoint, |
15070 | 16 | { "Endpoint", "zbee_zcl_general.gp.endpoint", FT_UINT8, BASE_HEX, |
15071 | 16 | NULL, 0, NULL, HFILL }}, |
15072 | 16 | { &hf_zbee_gp_secur_frame_counter, |
15073 | 16 | { "Frame counter", "zbee_zcl_general.gp.frame_cnt", FT_UINT32, BASE_DEC, |
15074 | 16 | NULL, 0, "GPD security frame counter", HFILL }}, |
15075 | 16 | { &hf_zbee_gp_gpd_command_id, |
15076 | 16 | { "ZGPD CommandID", "zbee_zcl_general.gp.command_id", FT_UINT8, BASE_HEX | BASE_EXT_STRING, |
15077 | 16 | &zbee_nwk_gp_cmd_names_ext, 0x0, NULL, HFILL }}, |
15078 | 16 | { &hf_zbee_gp_short_addr, |
15079 | 16 | { "GPP short address", "zbee_zcl_general.gp.gpp_short", FT_UINT16, BASE_HEX, |
15080 | 16 | NULL, 0, NULL, HFILL }}, |
15081 | 16 | { &hf_zbee_gp_gpp_gpd_link, |
15082 | 16 | { "GPP-GPD link", "zbee_zcl_general.gp.gpd_gpp_link", FT_UINT8, BASE_HEX, |
15083 | 16 | NULL, 0, NULL, HFILL }}, |
15084 | 16 | { &hf_zbee_gp_mic, |
15085 | 16 | { "MIC", "zbee_zcl_general.gp.mic", FT_UINT32, BASE_HEX, |
15086 | 16 | NULL, 0, NULL, HFILL }}, |
15087 | 16 | { &hf_zbee_gpp_gpd_link_rssi, |
15088 | 16 | { "RSSI", "zbee_zcl_general.gp.gpp_gpd_link.rssi", FT_UINT8, BASE_HEX, |
15089 | 16 | NULL, ZBEE_ZCL_GP_GPP_GPD_LINK_RSSI, NULL, HFILL }}, |
15090 | 16 | { &hf_zbee_gpp_gpd_link_lqi, |
15091 | 16 | { "LQI", "zbee_zcl_general.gp.gpp_gpd_link.lqi", FT_UINT8, BASE_HEX, |
15092 | 16 | VALS(zbee_zcl_gp_lqi_vals), ZBEE_ZCL_GP_GPP_GPD_LINK_LQI, NULL, HFILL }}, |
15093 | 16 | { &hf_zbee_gp_gpd_payload_size, |
15094 | 16 | { "Payload size", "zbee_zcl_general.gp.payload_size", FT_UINT8, BASE_DEC, |
15095 | 16 | NULL, 0, NULL, HFILL }}, |
15096 | | |
15097 | | /* GP Notification */ |
15098 | 16 | { &hf_zbee_gp_cmd_notification_options, |
15099 | 16 | { "Options", "zbee_zcl_general.gp.notif.opt", FT_UINT16, BASE_HEX, |
15100 | 16 | NULL, 0, NULL, HFILL }}, |
15101 | 16 | { &hf_zbee_gp_cmd_notif_opt_app_id, |
15102 | 16 | { "ApplicationID", "zbee_zcl_general.gp.notif.opt.app_id", FT_UINT16, BASE_HEX, |
15103 | 16 | VALS(zbee_zcl_gp_app_ids), ZBEE_ZCL_GP_NOTIFICATION_OPTION_APP_ID, NULL, HFILL }}, |
15104 | 16 | { &hf_zbee_gp_cmd_notif_opt_also_unicast, |
15105 | 16 | { "Also Unicast", "zbee_zcl_general.gp.notif.opt.also_unicast", FT_BOOLEAN, 16, |
15106 | 16 | NULL, ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_UNICAST, NULL, HFILL }}, |
15107 | 16 | { &hf_zbee_gp_cmd_notif_opt_also_derived_group, |
15108 | 16 | { "Also Derived Group", "zbee_zcl_general.gp.notif.opt.also_derived_grp", FT_BOOLEAN, 16, |
15109 | 16 | NULL, ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_DERIVED_GROUP, NULL, HFILL }}, |
15110 | 16 | { &hf_zbee_gp_cmd_notif_opt_also_comm_group, |
15111 | 16 | { "Also Commissioned Group", "zbee_zcl_general.gp.notif.opt.also_comm_grp", FT_BOOLEAN, 16, |
15112 | 16 | NULL, ZBEE_ZCL_GP_NOTIFICATION_OPTION_ALSO_COMMISSIONED_GROUP, NULL, HFILL }}, |
15113 | 16 | { &hf_zbee_gp_cmd_notif_opt_secur_level, |
15114 | 16 | { "SecurityLevel", "zbee_zcl_general.gp.notif.opt.secur_lev", FT_UINT16, BASE_HEX, |
15115 | 16 | VALS(zbee_zcl_gp_secur_levels), ZBEE_ZCL_GP_NOTIFICATION_OPTION_SECUR_LEVEL, NULL, HFILL }}, |
15116 | 16 | { &hf_zbee_gp_cmd_notif_opt_secur_key_type, |
15117 | 16 | { "SecurityKeyType", "zbee_zcl_general.gp.notif.opt.secur_key_type", FT_UINT16, BASE_HEX, |
15118 | 16 | VALS(zbee_zcl_gp_secur_key_types), ZBEE_ZCL_GP_NOTIFICATION_OPTION_SECUR_KEY_TYPE, NULL, HFILL }}, |
15119 | 16 | { &hf_zbee_gp_cmd_notif_opt_rx_after_tx, |
15120 | 16 | { "RxAfterTx", "zbee_zcl_general.gp.comm_notif.opt.rx_after_tx", FT_BOOLEAN, 16, |
15121 | 16 | NULL, ZBEE_ZCL_GP_NOTIFICATION_OPTION_RX_AFTER_TX, NULL, HFILL }}, |
15122 | 16 | { &hf_zbee_gp_cmd_notif_opt_tx_q_full, |
15123 | 16 | { "gpTxQueueFull", "zbee_zcl_general.gp.comm_notif.opt.tx_q_full", FT_BOOLEAN, 16, |
15124 | 16 | NULL, ZBEE_ZCL_GP_NOTIFICATION_OPTION_TX_Q_FULL, NULL, HFILL }}, |
15125 | 16 | { &hf_zbee_gp_cmd_notif_opt_bidir_cap, |
15126 | 16 | { "Bidirectional Capability", "zbee_zcl_general.gp.notif.opt.bidir_cap", FT_BOOLEAN, 16, |
15127 | 16 | NULL, ZBEE_ZCL_GP_NOTIFICATION_OPTION_BIDIR_CAP, NULL, HFILL }}, |
15128 | 16 | { &hf_zbee_gp_cmd_notif_opt_proxy_info_present, |
15129 | 16 | { "Proxy info present", "zbee_zcl_general.gp.notif.opt.proxy_info", FT_BOOLEAN, 16, |
15130 | 16 | NULL, ZBEE_ZCL_GP_NOTIFICATION_OPTION_PROXY_INFO_PRESENT, NULL, HFILL }}, |
15131 | | |
15132 | | |
15133 | | /* GP Pairing */ |
15134 | 16 | { &hf_zbee_gp_cmd_pairing_opt_app_id, |
15135 | 16 | { "ApplicationID", "zbee_zcl_general.gp.pairing.opt.app_id", FT_UINT24, BASE_HEX, |
15136 | 16 | VALS(zbee_zcl_gp_app_ids), ZBEE_ZCL_GP_PAIRING_OPTION_APP_ID, NULL, HFILL }}, |
15137 | 16 | { &hf_zbee_gp_cmd_pairing_opt_add_sink, |
15138 | 16 | { "Add Sink", "zbee_zcl_general.gp.pairing.opt.add_sink", FT_BOOLEAN, 24, |
15139 | 16 | NULL, ZBEE_ZCL_GP_PAIRING_OPTION_ADD_SINK, NULL, HFILL }}, |
15140 | 16 | { &hf_zbee_gp_cmd_pairing_opt_remove_gpd, |
15141 | 16 | { "Remove GPD", "zbee_zcl_general.gp.pairing.opt.remove_gpd", FT_BOOLEAN, 24, |
15142 | 16 | NULL, ZBEE_ZCL_GP_PAIRING_OPTION_REMOVE_GPD, NULL, HFILL }}, |
15143 | 16 | { &hf_zbee_gp_cmd_pairing_opt_communication_mode, |
15144 | 16 | { "Communication mode", "zbee_zcl_general.gp.pairing.opt.comm_mode", FT_UINT24, BASE_HEX, |
15145 | 16 | VALS(zbee_zcl_gp_communication_modes), ZBEE_ZCL_GP_PAIRING_OPTION_COMMUNICATION_MODE, NULL, HFILL }}, |
15146 | 16 | { &hf_zbee_gp_cmd_pairing_opt_gpd_fixed, |
15147 | 16 | { "GPD Fixed", "zbee_zcl_general.gp.pairing.opt.gpd_fixed", FT_BOOLEAN, 24, |
15148 | 16 | NULL, ZBEE_ZCL_GP_PAIRING_OPTION_GPD_FIXED, NULL, HFILL }}, |
15149 | 16 | { &hf_zbee_gp_cmd_pairing_opt_gpd_mac_seq_num_cap, |
15150 | 16 | { "MAC Seq number cap", "zbee_zcl_general.gp.pairing.opt.seq_num_cap", FT_BOOLEAN, 24, |
15151 | 16 | NULL, ZBEE_ZCL_GP_PAIRING_OPTION_GPD_MAC_SEQ_NUM_CAP, "GPD MAC sequence number capabilities", HFILL }}, |
15152 | 16 | { &hf_zbee_gp_cmd_pairing_opt_secur_level, |
15153 | 16 | { "SecurityLevel", "zbee_zcl_general.gp.pairing.opt.secur_lev", FT_UINT24, BASE_HEX, |
15154 | 16 | VALS(zbee_zcl_gp_secur_levels), ZBEE_ZCL_GP_PAIRING_OPTION_SECUR_LEVEL, NULL, HFILL }}, |
15155 | 16 | { &hf_zbee_gp_cmd_pairing_opt_secur_key_type, |
15156 | 16 | { "SecurityKeyType", "zbee_zcl_general.gp.pairing.opt.secur_key_type", FT_UINT24, BASE_HEX, |
15157 | 16 | VALS(zbee_zcl_gp_secur_key_types), ZBEE_ZCL_GP_PAIRING_OPTION_SECUR_KEY_TYPE, NULL, HFILL }}, |
15158 | 16 | { &hf_zbee_gp_cmd_pairing_opt_gpd_frame_cnt_present, |
15159 | 16 | { "Frame Counter present", "zbee_zcl_general.gp.pairing.opt.frame_counter_present", FT_BOOLEAN, 24, |
15160 | 16 | NULL, ZBEE_ZCL_GP_PAIRING_OPTION_GPD_FRAME_CNT_PRESENT, "GPD security Frame Counter present", HFILL }}, |
15161 | 16 | { &hf_zbee_gp_cmd_pairing_opt_gpd_secur_key_present, |
15162 | 16 | { "Key present", "zbee_zcl_general.gp.pairing.opt.key_present", FT_BOOLEAN, 24, |
15163 | 16 | NULL, ZBEE_ZCL_GP_PAIRING_OPTION_GPD_SECUR_KEY_PRESENT, "GPD security key present", HFILL }}, |
15164 | 16 | { &hf_zbee_gp_cmd_pairing_opt_assigned_alias_present, |
15165 | 16 | { "Assigned Alias present", "zbee_zcl_general.gp.pairing.opt.asn_alias_present", FT_BOOLEAN, 24, |
15166 | 16 | NULL, ZBEE_ZCL_GP_PAIRING_OPTION_ASSIGNED_ALIAS_PRESENT, NULL, HFILL }}, |
15167 | 16 | { &hf_zbee_gp_cmd_pairing_opt_fwd_radius_present, |
15168 | 16 | { "Forwarding Radius present", "zbee_zcl_general.gp.pairing.opt.fwd_radius_present", FT_BOOLEAN, 24, |
15169 | 16 | NULL, ZBEE_ZCL_GP_PAIRING_OPTION_FWD_RADIUS_PRESENT, NULL, HFILL }}, |
15170 | 16 | { &hf_zbee_gp_cmd_pairing_options, |
15171 | 16 | { "Options", "zbee_zcl_general.gp.pairing.opt", FT_UINT24, BASE_HEX, |
15172 | 16 | NULL, 0, NULL, HFILL }}, |
15173 | 16 | { &hf_zbee_gp_sink_ieee, |
15174 | 16 | { "Sink IEEE", "zbee_zcl_general.gp.sink_ieee", FT_EUI64, BASE_NONE, |
15175 | 16 | NULL, 0, "Sink IEEE address", HFILL }}, |
15176 | 16 | { &hf_zbee_gp_sink_nwk, |
15177 | 16 | { "Sink NWK", "zbee_zcl_general.gp.sink_nwk", FT_UINT16, BASE_HEX, |
15178 | 16 | NULL, 0, "Sink NWK address", HFILL }}, |
15179 | 16 | { &hf_zbee_gp_sink_group_id, |
15180 | 16 | { "Sink GroupID", "zbee_zcl_general.gp.sink_grp", FT_UINT16, BASE_HEX, |
15181 | 16 | NULL, 0, NULL, HFILL }}, |
15182 | 16 | { &hf_zbee_gp_device_id, |
15183 | 16 | { "DeviceID", "zbee_zcl_general.gp.dev_id", FT_UINT8, BASE_HEX, |
15184 | 16 | VALS(zbee_nwk_gp_device_ids_names), 0, NULL, HFILL }}, |
15185 | 16 | { &hf_zbee_gp_assigned_alias, |
15186 | 16 | { "Assigned alias", "zbee_zcl_general.gp.asn_alias", FT_UINT16, BASE_HEX, |
15187 | 16 | NULL, 0, NULL, HFILL }}, |
15188 | 16 | { &hf_zbee_gp_forwarding_radius, |
15189 | 16 | { "Forwarding Radius", "zbee_zcl_general.gp.fw_radius", FT_UINT8, BASE_HEX, |
15190 | 16 | NULL, 0, NULL, HFILL }}, |
15191 | 16 | { &hf_zbee_gp_gpd_key, |
15192 | 16 | { "GPD key", "zbee_zcl_general.gp.gpd_key", FT_BYTES, BASE_NONE, |
15193 | 16 | NULL, 0, NULL, HFILL }}, |
15194 | 16 | { &hf_zbee_gp_groupcast_radius, |
15195 | 16 | { "Groupcast radius", "zbee_zcl_general.gp.groupcast_radius", FT_UINT8, BASE_DEC, |
15196 | 16 | NULL, 0, NULL, HFILL }}, |
15197 | | |
15198 | | /* GP Response */ |
15199 | 16 | { &hf_zbee_gp_cmd_response_options, |
15200 | 16 | { "Options", "zbee_zcl_general.gp.response.opt", FT_UINT8, BASE_HEX, |
15201 | 16 | NULL, 0, NULL, HFILL }}, |
15202 | 16 | { &hf_zbee_gp_cmd_resp_opt_app_id, |
15203 | 16 | { "ApplicationID", "zbee_zcl_general.gp.response.opt.app_id", FT_UINT8, BASE_HEX, |
15204 | 16 | NULL, ZBEE_ZCL_GP_RESPONSE_OPTION_APP_ID, NULL, HFILL }}, |
15205 | 16 | { &hf_zbee_gp_cmd_resp_opt_tx_on_ep_match, |
15206 | 16 | { "Transmit on endpoint match", "zbee_zcl_general.gp.response.opt.tx_on_ep_match", FT_UINT8, BASE_HEX, |
15207 | 16 | NULL, ZBEE_ZCL_GP_RESPONSE_OPTION_TX_ON_ENDPOINT_MATCH, NULL, HFILL }}, |
15208 | 16 | { &hf_zbee_gp_cmd_response_tx_channel, |
15209 | 16 | { "TempMaster Tx channel", "zbee_zcl_general.gp.response.tmpmaster_tx_chan", FT_UINT8, BASE_HEX, |
15210 | 16 | NULL, 0, NULL, HFILL }}, |
15211 | 16 | { &hf_zbee_gp_cmd_resp_tx_channel, |
15212 | 16 | { "Transmit channel", "zbee_zcl_general.gp.response.opt.tx_chan", FT_UINT8, BASE_HEX, |
15213 | 16 | VALS(zbee_zcl_gp_channels), ZBEE_ZCL_GP_RESPONSE_TX_CHANNEL, NULL, HFILL }}, |
15214 | 16 | { &hf_zbee_gp_tmp_master_short_addr, |
15215 | 16 | { "TempMaster short address", "zbee_zcl_general.gp.response.tmpmaster_addr", FT_UINT16, BASE_HEX, |
15216 | 16 | NULL, 0, NULL, HFILL }}, |
15217 | | |
15218 | | /* GP Pairing Configuration */ |
15219 | 16 | { &hf_zbee_gp_cmd_pc_actions_action, |
15220 | 16 | { "Action", "zbee_zcl_general.gp.pc.action.action", FT_UINT8, BASE_HEX, |
15221 | 16 | VALS(zbee_gp_pc_actions), ZBEE_ZCL_GP_CMD_PC_ACTIONS_ACTION, NULL, HFILL }}, |
15222 | 16 | { &hf_zbee_gp_cmd_pc_actions_send_gp_pairing, |
15223 | 16 | { "Send GP Pairing", "zbee_zcl_general.gp.pc.action.send_gp_pairing", FT_BOOLEAN, 8, |
15224 | 16 | NULL, ZBEE_ZCL_GP_CMD_PC_ACTIONS_SEND_GP_PAIRING, NULL, HFILL }}, |
15225 | 16 | { &hf_zbee_gp_cmd_pc_opt_app_id, |
15226 | 16 | { "ApplicationID", "zbee_zcl_general.gp.pp.opt.app_id", FT_UINT16, BASE_HEX, |
15227 | 16 | NULL, ZBEE_ZCL_GP_CMD_PC_OPT_APP_ID, NULL, HFILL }}, |
15228 | 16 | { &hf_zbee_gp_cmd_pc_opt_communication_mode, |
15229 | 16 | { "Communication mode", "zbee_zcl_general.gp.pc.opt.comm_mode", FT_UINT16, BASE_HEX, |
15230 | 16 | VALS(zbee_zcl_gp_communication_modes), ZBEE_ZCL_GP_CMD_PC_OPT_COMMUNICATION_MODE, NULL, HFILL }}, |
15231 | 16 | { &hf_zbee_gp_cmd_pc_opt_seq_number_cap, |
15232 | 16 | { "Sequence number capabilities", "zbee_zcl_general.gp.pc.opt.seq_num_cap", FT_BOOLEAN, 16, |
15233 | 16 | NULL, ZBEE_ZCL_GP_CMD_PC_OPT_SEQ_NUMBER_CAP, NULL, HFILL }}, |
15234 | 16 | { &hf_zbee_gp_cmd_px_opt_rx_on_cap, |
15235 | 16 | { "RxOnCapability", "zbee_zcl_general.gp.pc.opt.rx_on_cap", FT_BOOLEAN, 16, |
15236 | 16 | NULL, ZBEE_ZCL_GP_CMD_PC_OPT_RX_ON_CAP, NULL, HFILL }}, |
15237 | 16 | { &hf_zbee_gp_cmd_pc_opt_fixed_location, |
15238 | 16 | { "FixedLocation", "zbee_zcl_general.gp.pc.opt.fixed_loc", FT_BOOLEAN, 16, |
15239 | 16 | NULL, ZBEE_ZCL_GP_CMD_PC_OPT_FIXED_LOCATION, NULL, HFILL }}, |
15240 | 16 | { &hf_zbee_gp_cmd_pc_opt_assigned_alias, |
15241 | 16 | { "AssignedAlias", "zbee_zcl_general.gp.pc.opt.asn_alias", FT_BOOLEAN, 16, |
15242 | 16 | NULL, ZBEE_ZCL_GP_CMD_PC_OPT_ASSIGNED_ALIAS, NULL, HFILL }}, |
15243 | 16 | { &hf_zbee_gp_cmd_pc_opt_security_use, |
15244 | 16 | { "Security use", "zbee_zcl_general.gp.pc.opt.secur_use", FT_BOOLEAN, 16, |
15245 | 16 | NULL, ZBEE_ZCL_GP_CMD_PC_OPT_SECURITY_USE, NULL, HFILL }}, |
15246 | 16 | { &hf_zbee_gp_cmd_pc_opt_app_info_present, |
15247 | 16 | { "Application in-formation present", "zbee_zcl_general.gp.pc.opt.app_info_present", FT_BOOLEAN, 16, |
15248 | 16 | NULL, ZBEE_ZCL_GP_CMD_PC_OPT_APP_INFO_PRESENT, NULL, HFILL }}, |
15249 | 16 | { &hf_zbee_gp_cmd_pc_secur_level, |
15250 | 16 | { "SecurityLevel", "zbee_zcl_general.gp.pc.secur.secur_lev", FT_UINT8, BASE_HEX, |
15251 | 16 | VALS(zbee_zcl_gp_secur_levels), ZBEE_ZCL_GP_CMD_PC_SECUR_LEVEL, NULL, HFILL }}, |
15252 | 16 | { &hf_zbee_gp_cmd_pc_secur_key_type, |
15253 | 16 | { "SecurityKeyType", "zbee_zcl_general.gp.pc.secur.secur_key_type", FT_UINT8, BASE_HEX, |
15254 | 16 | VALS(zbee_zcl_gp_secur_key_types), ZBEE_ZCL_GP_CMD_PC_SECUR_KEY_TYPE, NULL, HFILL }}, |
15255 | 16 | { &hf_zbee_gp_cmd_pc_app_info_manuf_id_present, |
15256 | 16 | { "ManufacturerID present", "zbee_zcl_general.gp.pc.app.manuf_id_present", FT_BOOLEAN, 8, |
15257 | 16 | NULL, ZBEE_ZCL_GP_CMD_PC_APP_INFO_MANUF_ID_PRESENT, NULL, HFILL }}, |
15258 | 16 | { &hf_zbee_gp_cmd_pc_app_info_model_id_present, |
15259 | 16 | { "ModelID present", "zbee_zcl_general.gp.pc.app.model_id_present", FT_BOOLEAN, 8, |
15260 | 16 | NULL, ZBEE_ZCL_GP_CMD_PC_APP_INFO_MODEL_ID_PRESENT, NULL, HFILL }}, |
15261 | 16 | { &hf_zbee_gp_cmd_pc_app_info_gpd_commands_present, |
15262 | 16 | { "GPD commands present", "zbee_zcl_general.gp.pc.app.gpd_cmds_present", FT_BOOLEAN, 8, |
15263 | 16 | NULL, ZBEE_ZCL_GP_CMD_PC_APP_INFO_GPD_COMMANDS_PRESENT, NULL, HFILL }}, |
15264 | 16 | { &hf_zbee_gp_cmd_pc_app_info_cluster_list_present, |
15265 | 16 | { "Cluster list present", "zbee_zcl_general.gp.pc.app.cluster_list_present", FT_BOOLEAN, 8, |
15266 | 16 | NULL, ZBEE_ZCL_GP_CMD_PC_APP_INFO_CLUSTER_LIST_PRESENT, NULL, HFILL }}, |
15267 | 16 | { &hf_zbee_gp_cmd_pc_actions, |
15268 | 16 | { "Actions", "zbee_zcl_general.gp.pc.actions", FT_UINT8, BASE_HEX, |
15269 | 16 | NULL, 0, NULL, HFILL }}, |
15270 | 16 | { &hf_zbee_gp_cmd_pc_options, |
15271 | 16 | { "Options", "zbee_zcl_general.gp.pc.options", FT_UINT16, BASE_HEX, |
15272 | 16 | NULL, 0, NULL, HFILL }}, |
15273 | 16 | { &hf_zbee_gp_group_list_len, |
15274 | 16 | { "Group list length", "zbee_zcl_general.gp.group_list.len", FT_UINT8, BASE_DEC, |
15275 | 16 | NULL, 0, NULL, HFILL }}, |
15276 | 16 | { &hf_zbee_gp_group_list_group_id, |
15277 | 16 | { "Group id", "zbee_zcl_general.gp.group_list.group", FT_UINT16, BASE_HEX, |
15278 | 16 | NULL, 0, NULL, HFILL }}, |
15279 | 16 | { &hf_zbee_gp_group_list_alias, |
15280 | 16 | { "Alias", "zbee_zcl_general.gp.group_list.alias", FT_UINT16, BASE_HEX, |
15281 | 16 | NULL, 0, NULL, HFILL }}, |
15282 | 16 | { &hf_zbee_gp_cmd_pc_secur_options, |
15283 | 16 | { "Security Options", "zbee_zcl_general.gp.pc.secur_options", FT_UINT8, BASE_HEX, |
15284 | 16 | NULL, 0, NULL, HFILL }}, |
15285 | 16 | { &hf_zbee_gp_n_paired_endpoints, |
15286 | 16 | { "Number of paired endpoints", "zbee_zcl_general.gp.pc.n_ep", FT_UINT8, BASE_DEC, |
15287 | 16 | NULL, 0, NULL, HFILL }}, |
15288 | 16 | { &hf_zbee_gp_paired_endpoint, |
15289 | 16 | { "Paired endpoint", "zbee_zcl_general.gp.pc.endpoint", FT_UINT8, BASE_HEX, |
15290 | 16 | NULL, 0, NULL, HFILL }}, |
15291 | 16 | { &hf_zbee_gp_cmd_pc_app_info, |
15292 | 16 | { "Application information", "zbee_zcl_general.gp.pc.app_info", FT_UINT8, BASE_HEX, |
15293 | 16 | NULL, 0, NULL, HFILL }}, |
15294 | 16 | { &hf_zbee_zcl_gp_manufacturer_id, |
15295 | 16 | { "Manufacturer ID", "zbee_zcl_general.gp.pc.manufacturer_id", FT_UINT16, BASE_HEX, |
15296 | 16 | VALS(zbee_mfr_code_names), 0x0, NULL, HFILL }}, |
15297 | 16 | { &hf_zbee_zcl_gp_model_id, |
15298 | 16 | { "Model ID", "zbee_zcl_general.gp.pc.model_id", FT_UINT16, BASE_HEX, |
15299 | 16 | NULL, 0, NULL, HFILL }}, |
15300 | 16 | { &hf_zbee_gp_n_gpd_commands, |
15301 | 16 | { "Number of GPD commands", "zbee_zcl_general.gp.pc.n_gpd_commands", FT_UINT8, BASE_DEC, |
15302 | 16 | NULL, 0, NULL, HFILL }}, |
15303 | 16 | { &hf_zbee_gp_gpd_command, |
15304 | 16 | { "ZGPD Command ID", "zbee_zcl_general.gp.pc.gpd_command", FT_UINT8, BASE_HEX | BASE_EXT_STRING, |
15305 | 16 | &zbee_nwk_gp_cmd_names_ext, 0x0, NULL, HFILL }}, |
15306 | 16 | { &hf_zbee_gp_n_srv_clusters, |
15307 | 16 | { "Number of Server clusters", "zbee_zcl_general.gp.pc.n_srv_clusters", FT_UINT8, BASE_DEC, |
15308 | 16 | NULL, ZBEE_ZCL_GP_CLUSTER_LIST_LEN_SRV, NULL, HFILL }}, |
15309 | 16 | { &hf_zbee_gp_n_cli_clusters, |
15310 | 16 | { "Number of Client clusters", "zbee_zcl_general.gp.pc.n_clnt_clusters", FT_UINT8, BASE_DEC, |
15311 | 16 | NULL, ZBEE_ZCL_GP_CLUSTER_LIST_LEN_CLI, NULL, HFILL }}, |
15312 | 16 | { &hf_zbee_gp_gpd_cluster_id, |
15313 | 16 | { "Cluster ID", "zbee_zcl_general.gp.pc.cluster", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_aps_cid_names), |
15314 | 16 | 0x0, NULL, HFILL }}, |
15315 | | |
15316 | | /* GP Sink Table Request and GP Proxy Table Request commands */ |
15317 | 16 | { &hf_zbee_zcl_proxy_sink_tbl_req_options, |
15318 | 16 | { "Options", "zbee_zcl_general.gp.proxy_sink_tbl_req.options", FT_UINT8, BASE_HEX, |
15319 | 16 | NULL, 0, NULL, HFILL }}, |
15320 | 16 | { &hf_zbee_zcl_proxy_sink_tbl_req_fld_app_id, |
15321 | 16 | { "Application ID", "zbee_zcl_general.gp.proxy_sink_tbl_req.options.app_id", FT_UINT8, BASE_HEX, |
15322 | 16 | NULL, ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_APP_ID, NULL, HFILL }}, |
15323 | 16 | { &hf_zbee_zcl_proxy_sink_tbl_req_fld_req_type, |
15324 | 16 | { "Request type", "zbee_zcl_general.gp.proxy_sink_tbl_req.options.req_type", FT_UINT8, BASE_HEX, |
15325 | 16 | VALS(zbee_zcl_gp_proxy_sink_tbl_req_type), ZBEE_ZCL_GP_PROXY_SINK_TBL_REQ_CMD_REQ_TYPE, NULL, HFILL }}, |
15326 | 16 | { &hf_zbee_zcl_proxy_sink_tbl_req_index, |
15327 | 16 | { "Index", "zbee_zcl_general.gp.proxy_sink_tbl_req.index", FT_UINT8, BASE_DEC, |
15328 | 16 | NULL, 0, NULL, HFILL }}, |
15329 | | |
15330 | | /* GP Sink Table Response and GP Proxy Table Response commands */ |
15331 | 16 | { &hf_zbee_zcl_proxy_sink_tbl_resp_status, |
15332 | 16 | { "Status", "zbee_zcl_general.gp.proxy_sink_tbl_resp.status", FT_UINT8, BASE_HEX, |
15333 | 16 | VALS(zbee_zcl_status_names), 0, NULL, HFILL }}, |
15334 | 16 | { &hf_zbee_zcl_proxy_sink_tbl_resp_entries_total, |
15335 | 16 | { "Total number of non-empty entries", "zbee_zcl_general.gp.proxy_sink_tbl_resp.entries_total", FT_UINT8, BASE_DEC, |
15336 | 16 | NULL, 0, NULL, HFILL }}, |
15337 | 16 | { &hf_zbee_zcl_proxy_sink_tbl_resp_start_index, |
15338 | 16 | { "Start index", "zbee_zcl_general.gp.proxy_sink_tbl_resp.start_index", FT_UINT8, BASE_DEC, |
15339 | 16 | NULL, 0, NULL, HFILL }}, |
15340 | 16 | { &hf_zbee_zcl_proxy_sink_tbl_resp_entries_count, |
15341 | 16 | { "Entries count", "zbee_zcl_general.gp.proxy_sink_tbl_resp.entries_count", FT_UINT8, BASE_DEC, |
15342 | 16 | NULL, 0, NULL, HFILL }}, |
15343 | | |
15344 | | /* GP Sink Commissioning Mode command */ |
15345 | 16 | { &hf_zbee_zcl_gp_cmd_sink_comm_mode_options, |
15346 | 16 | { "Options", "zbee_zcl_general.gp.sink_comm_mode.options", FT_UINT8, BASE_HEX, |
15347 | 16 | NULL, 0, NULL, HFILL }}, |
15348 | | |
15349 | 16 | { &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_action, |
15350 | 16 | { "Action", "zbee_zcl_general.gp.sink_comm_mode.options.action", FT_BOOLEAN, 8, |
15351 | 16 | NULL, ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_ACTION, NULL, HFILL }}, |
15352 | 16 | { &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_secur, |
15353 | 16 | { "Involve GPM in security", "zbee_zcl_general.gp.sink_comm_mode.options.inv_gpm_in_secur", FT_BOOLEAN, 8, |
15354 | 16 | NULL, ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_GPM_IN_SECUR, NULL, HFILL }}, |
15355 | 16 | { &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_gpm_in_pairing, |
15356 | 16 | { "Involve GPM in pairing", "zbee_zcl_general.gp.sink_comm_mode.options.inv_gpm_in_pairing", FT_BOOLEAN, 8, |
15357 | 16 | NULL, ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_GPM_IN_PAIRING, NULL, HFILL }}, |
15358 | 16 | { &hf_zbee_zcl_gp_cmd_sink_comm_mode_options_fld_inv_proxies, |
15359 | 16 | { "Involve proxies", "zbee_zcl_general.gp.sink_comm_mode.options.inv_proxies", FT_BOOLEAN, 8, |
15360 | 16 | NULL, ZBEE_ZCL_GP_CMD_SINK_COMM_MODE_OPTIONS_FLD_INV_PROXIES, NULL, HFILL }}, |
15361 | | |
15362 | 16 | { &hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_secur, |
15363 | 16 | { "GPM address for security", "zbee_zcl_general.gp.sink_comm_mode.gpm_addr_for_secur", FT_UINT16, BASE_HEX, |
15364 | 16 | NULL, 0, NULL, HFILL }}, |
15365 | 16 | { &hf_zbee_gp_zcl_cmd_sink_comm_mode_gpm_addr_for_pairing, |
15366 | 16 | { "GPM address for pairing", "zbee_zcl_general.gp.sink_comm_mode.gpm_addr_for_pairing", FT_UINT16, BASE_HEX, |
15367 | 16 | NULL, 0, NULL, HFILL }}, |
15368 | 16 | { &hf_zbee_gp_zcl_cmd_sink_comm_mode_sink_ep, |
15369 | 16 | { "Sink Endpoint", "zbee_zcl_general.gp.sink_comm_mode.sink_ep", FT_UINT8, BASE_DEC, |
15370 | 16 | NULL, 0, NULL, HFILL }}, |
15371 | | |
15372 | | /* GP Sink Table attribute */ |
15373 | 16 | { &hf_zbee_gp_sink_tbl_length, |
15374 | 16 | { "Sink Table length", "zbee_zcl_general.gp.sink_tbl_len", FT_UINT16, BASE_DEC, |
15375 | 16 | NULL, 0, NULL, HFILL }}, |
15376 | 16 | { &hf_zbee_gp_sink_tbl_entry_options, |
15377 | 16 | { "Options", "zbee_zcl_general.gp.sink_tbl.entry.opt", FT_UINT16, BASE_HEX, |
15378 | 16 | NULL, 0, NULL, HFILL }}, |
15379 | 16 | { &hf_zbee_gp_sec_options, |
15380 | 16 | { "Security Options", "zbee_zcl_general.gp.secur", FT_UINT8, BASE_HEX, |
15381 | 16 | NULL, 0, NULL, HFILL }}, |
15382 | | |
15383 | 16 | { &hf_zbee_gp_sink_tbl_entry_options_app_id, |
15384 | 16 | { "ApplicationID", "zbee_zcl_general.gp.sink_tbl.entry.opt.app_id", FT_UINT16, BASE_HEX, |
15385 | 16 | NULL, ZBEE_ZCL_GP_SINK_TBL_OPT_APP_ID, NULL, HFILL }}, |
15386 | 16 | { &hf_zbee_gp_sink_tbl_entry_options_comm_mode, |
15387 | 16 | { "Communication Mode", "zbee_zcl_general.gp.sink_tbl.entry.opt.comm_mode", FT_UINT16, BASE_HEX, |
15388 | 16 | VALS(zbee_zcl_gp_communication_modes), ZBEE_ZCL_GP_SINK_TBL_OPT_COMMUNICATION_MODE, NULL, HFILL }}, |
15389 | 16 | { &hf_zbee_gp_sink_tbl_entry_options_seq_num_cap, |
15390 | 16 | { "Sequence number capabilities", "zbee_zcl_general.gp.sink_tbl.entry.opt.seq_num_cap", FT_BOOLEAN, 16, |
15391 | 16 | NULL, ZBEE_ZCL_GP_SINK_TBL_OPT_SEQ_NUMBER_CAP, NULL, HFILL }}, |
15392 | 16 | { &hf_zbee_gp_sink_tbl_entry_options_rx_on_cap, |
15393 | 16 | { "Rx On Capability", "zbee_zcl_general.gp.sink_tbl.entry.opt.rx_on_cap", FT_BOOLEAN, 16, |
15394 | 16 | NULL, ZBEE_ZCL_GP_SINK_TBL_OPT_RX_ON_CAP, NULL, HFILL }}, |
15395 | 16 | { &hf_zbee_gp_sink_tbl_entry_options_fixed_loc, |
15396 | 16 | { "Fixed Location", "zbee_zcl_general.gp.sink_tbl.entry.opt.fixed_loc", FT_BOOLEAN, 16, |
15397 | 16 | NULL, ZBEE_ZCL_GP_SINK_TBL_OPT_FIXED_LOCATION, NULL, HFILL }}, |
15398 | 16 | { &hf_zbee_gp_sink_tbl_entry_options_assigned_alias, |
15399 | 16 | { "Assigned Alias", "zbee_zcl_general.gp.sink_tbl.entry.opt.asn_alias", FT_BOOLEAN, 16, |
15400 | 16 | NULL, ZBEE_ZCL_GP_SINK_TBL_OPT_ASSIGNED_ALIAS, NULL, HFILL }}, |
15401 | 16 | { &hf_zbee_gp_sink_tbl_entry_options_sec_use, |
15402 | 16 | { "Security use", "zbee_zcl_general.gp.sink_tbl.entry.opt.secur_use", FT_BOOLEAN, 16, |
15403 | 16 | NULL, ZBEE_ZCL_GP_SINK_TBL_OPT_SECURITY_USE, NULL, HFILL }}, |
15404 | | |
15405 | 16 | { &hf_zbee_gp_sec_options_sec_level, |
15406 | 16 | { "Security Level", "zbee_zcl_general.gp.secur.secur_lev", FT_UINT8, BASE_HEX, |
15407 | 16 | VALS(zbee_zcl_gp_secur_levels), ZBEE_ZCL_GP_SECUR_OPT_SECUR_LEVEL, NULL, HFILL }}, |
15408 | 16 | { &hf_zbee_gp_sec_options_sec_key_type, |
15409 | 16 | { "Security Key Type", "zbee_zcl_general.gp.secur.secur_key_type", FT_UINT8, BASE_HEX, |
15410 | 16 | VALS(zbee_zcl_gp_secur_key_types), ZBEE_ZCL_GP_SECUR_OPT_SECUR_KEY_TYPE, NULL, HFILL }}, |
15411 | | |
15412 | | /* GP Proxy Table attribute */ |
15413 | 16 | { &hf_zbee_gp_proxy_tbl_length, |
15414 | 16 | { "Proxy Table length", "zbee_zcl_general.gp.proxy_tbl_len", FT_UINT16, BASE_DEC, |
15415 | 16 | NULL, 0, NULL, HFILL }}, |
15416 | 16 | { &hf_zbee_gp_proxy_tbl_entry_options, |
15417 | 16 | { "Options", "zbee_zcl_general.gp.proxy_tbl.entry.opt", FT_UINT16, BASE_HEX, |
15418 | 16 | NULL, 0, NULL, HFILL }}, |
15419 | 16 | { &hf_zbee_gp_proxy_tbl_entry_ext_options, |
15420 | 16 | { "Extended Options", "zbee_zcl_general.gp.proxy_tbl.entry.ext_opt", FT_UINT8, BASE_HEX, |
15421 | 16 | NULL, 0, NULL, HFILL }}, |
15422 | | |
15423 | 16 | { &hf_zbee_gp_proxy_tbl_entry_options_app_id, |
15424 | 16 | { "ApplicationID", "zbee_zcl_general.gp.proxy_tbl.entry.opt.app_id", FT_UINT16, BASE_HEX, |
15425 | 16 | NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_APP_ID, NULL, HFILL }}, |
15426 | 16 | { &hf_zbee_gp_proxy_tbl_entry_options_entry_active, |
15427 | 16 | { "EntryActive", "zbee_zcl_general.gp.proxy_tbl.entry.opt.entry_active", FT_BOOLEAN, 16, |
15428 | 16 | NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_ACTIVE, NULL, HFILL }}, |
15429 | 16 | { &hf_zbee_gp_proxy_tbl_entry_options_entry_valid, |
15430 | 16 | { "EntryValid", "zbee_zcl_general.gp.proxy_tbl.entry.opt.entry_valid", FT_BOOLEAN, 16, |
15431 | 16 | NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_ENTRY_VALID, NULL, HFILL }}, |
15432 | 16 | { &hf_zbee_gp_proxy_tbl_entry_options_seq_num_cap, |
15433 | 16 | { "Sequence number capabilities", "zbee_zcl_general.gp.proxy_tbl.entry.opt.seq_num_cap", FT_BOOLEAN, 16, |
15434 | 16 | NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_SEQ_NUMBER_CAP, NULL, HFILL }}, |
15435 | 16 | { &hf_zbee_gp_proxy_tbl_entry_options_lw_ucast_gps, |
15436 | 16 | { "Lightweight Unicast GPS", "zbee_zcl_general.gp.proxy_tbl.entry.opt.lw_ucast_gps", FT_BOOLEAN, 16, |
15437 | 16 | NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_LW_UCAST_GPS, NULL, HFILL }}, |
15438 | 16 | { &hf_zbee_gp_proxy_tbl_entry_options_derived_group_gps, |
15439 | 16 | { "Derived Group GPS", "zbee_zcl_general.gp.proxy_tbl.entry.opt.derived_group_gps", FT_BOOLEAN, 16, |
15440 | 16 | NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_DERIVED_GROUP_GPS, NULL, HFILL }}, |
15441 | 16 | { &hf_zbee_gp_proxy_tbl_entry_options_comm_group_gps, |
15442 | 16 | { "Commissioned Group GPS", "zbee_zcl_general.gp.proxy_tbl.entry.opt.comm_group_gps", FT_BOOLEAN, 16, |
15443 | 16 | NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_COMM_GROUP_GPS, NULL, HFILL }}, |
15444 | 16 | { &hf_zbee_gp_proxy_tbl_entry_options_first_to_forward, |
15445 | 16 | { "FirstToForward", "zbee_zcl_general.gp.proxy_tbl.entry.opt.first_to_forward", FT_BOOLEAN, 16, |
15446 | 16 | NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_FIRST_TO_FORWARD, NULL, HFILL }}, |
15447 | 16 | { &hf_zbee_gp_proxy_tbl_entry_options_in_range, |
15448 | 16 | { "InRange", "zbee_zcl_general.gp.proxy_tbl.entry.opt.in_range", FT_BOOLEAN, 16, |
15449 | 16 | NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_IN_RANGE, NULL, HFILL }}, |
15450 | 16 | { &hf_zbee_gp_proxy_tbl_entry_options_gpd_fixed, |
15451 | 16 | { "GPD Fixed", "zbee_zcl_general.gp.proxy_tbl.entry.opt.gpd_fixed", FT_BOOLEAN, 16, |
15452 | 16 | NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_GPD_FIXED, NULL, HFILL }}, |
15453 | 16 | { &hf_zbee_gp_proxy_tbl_entry_options_has_all_ucast_routes, |
15454 | 16 | { "HasAllUnicastRoutes", "zbee_zcl_general.gp.proxy_tbl.entry.opt.has_all_ucast_routes", FT_BOOLEAN, 16, |
15455 | 16 | NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_HAS_ALL_UCAST_ROUTES, NULL, HFILL }}, |
15456 | 16 | { &hf_zbee_gp_proxy_tbl_entry_options_assigned_alias, |
15457 | 16 | { "AssignedAlias", "zbee_zcl_general.gp.proxy_tbl.entry.opt.asn_alias", FT_BOOLEAN, 16, |
15458 | 16 | NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_ASSIGNED_ALIAS, NULL, HFILL }}, |
15459 | 16 | { &hf_zbee_gp_proxy_tbl_entry_options_sec_use, |
15460 | 16 | { "SecurityUse", "zbee_zcl_general.gp.proxy_tbl.entry.opt.secur_use", FT_BOOLEAN, 16, |
15461 | 16 | NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_SECURITY_USE, NULL, HFILL }}, |
15462 | 16 | { &hf_zbee_gp_proxy_tbl_entry_options_opt_ext, |
15463 | 16 | { "Options Extension", "zbee_zcl_general.gp.proxy_tbl.entry.opt.ext_opt", FT_BOOLEAN, 16, |
15464 | 16 | NULL, ZBEE_ZCL_GP_PROXY_TBL_OPT_OPTIONS_EXTENTIONS, NULL, HFILL }}, |
15465 | | |
15466 | 16 | { &hf_zbee_gp_proxy_tbl_entry_search_counter, |
15467 | 16 | { "Search Counter", "zbee_zcl_general.gp.proxy_tbl.entry.search_counter", FT_UINT8, BASE_DEC, |
15468 | 16 | NULL, 0, NULL, HFILL }}, |
15469 | | |
15470 | 16 | { &hf_zbee_gp_proxy_tbl_entry_ext_options_full_ucast_gps, |
15471 | 16 | { "Full unicast GPS", "zbee_zcl_general.gp.proxy_tbl.entry.ext_opt.full_ucast_gps", FT_BOOLEAN, 16, |
15472 | 16 | NULL, ZBEE_ZCL_GP_PROXY_TBL_EXT_OPT_FULL_UCAST_GPS, NULL, HFILL }}, |
15473 | | |
15474 | 16 | { &hf_zbee_gp_sink_address_list_length, |
15475 | 16 | { "Sink Address list length", "zbee_zcl_general.gp.sink_addr_list_len", FT_UINT8, BASE_DEC, |
15476 | 16 | NULL, 0, NULL, HFILL }}, |
15477 | | |
15478 | | /* gppFunctionality attribute */ |
15479 | 16 | { &hf_zbee_zcl_gp_attr_gpp_func, |
15480 | 16 | { "gppFunctionality", "zbee_zcl_general.gp.attr.gpp_func", FT_UINT24, BASE_HEX, |
15481 | 16 | NULL, 0, NULL, HFILL }}, |
15482 | | |
15483 | 16 | { &hf_zbee_zcl_gp_attr_gpp_func_fld_gp_feature, |
15484 | 16 | { "GP feature", "zbee_zcl_general.gp.attr.gpp_func.gp_feature", FT_BOOLEAN, 24, |
15485 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GP_FEATURE, NULL, HFILL }}, |
15486 | 16 | { &hf_zbee_zcl_gp_attr_gpp_func_fld_direct_comm, |
15487 | 16 | { "Direct communication", "zbee_zcl_general.gp.attr.gpp_func.direct_comm", FT_BOOLEAN, 24, |
15488 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_DIRECT_COMM, NULL, HFILL }}, |
15489 | 16 | { &hf_zbee_zcl_gp_attr_gpp_func_fld_derived_gcast_comm, |
15490 | 16 | { "Derived groupcast communication", "zbee_zcl_general.gp.attr.gpp_func.derived_gcast_comm", FT_BOOLEAN, 24, |
15491 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_DERIVED_GCAST_COMM, NULL, HFILL }}, |
15492 | 16 | { &hf_zbee_zcl_gp_attr_gpp_func_fld_pre_commissioned_gcast_comm, |
15493 | 16 | { "Pre-commissioned groupcast communication", "zbee_zcl_general.gp.attr.gpp_func.pre_commissioned_gcast_comm", FT_BOOLEAN, 24, |
15494 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_PRE_COMMISSIONED_GCAST_COMM, NULL, HFILL }}, |
15495 | 16 | { &hf_zbee_zcl_gp_attr_gpp_func_fld_full_ucast_comm, |
15496 | 16 | { "Full unicast communication", "zbee_zcl_general.gp.attr.gpp_func.full_ucast_comm", FT_BOOLEAN, 24, |
15497 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_FULL_UCAST_COMM, NULL, HFILL }}, |
15498 | 16 | { &hf_zbee_zcl_gp_attr_gpp_func_fld_lw_ucast_comm, |
15499 | 16 | { "Lightweight unicast communication", "zbee_zcl_general.gp.attr.gpp_func.lw_ucast_comm", FT_BOOLEAN, 24, |
15500 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_LW_UCAST_COMM, NULL, HFILL }}, |
15501 | 16 | { &hf_zbee_zcl_gp_attr_gpp_func_fld_bidir_op, |
15502 | 16 | { "Bidirectional operation", "zbee_zcl_general.gp.attr.gpp_func.bidir_op", FT_BOOLEAN, 24, |
15503 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_BIDIR_OP, NULL, HFILL }}, |
15504 | 16 | { &hf_zbee_zcl_gp_attr_gpp_func_fld_proxy_tbl_maintenance, |
15505 | 16 | { "Proxy Table maintenance", "zbee_zcl_general.gp.attr.gpp_func.proxy_tbl_maintenance", FT_BOOLEAN, 24, |
15506 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_PROXY_TBL_MAINTENANCE, NULL, HFILL }}, |
15507 | 16 | { &hf_zbee_zcl_gp_attr_gpp_func_fld_gp_commissioning, |
15508 | 16 | { "GP commissioning", "zbee_zcl_general.gp.attr.gpp_func.gp_commissioning", FT_BOOLEAN, 24, |
15509 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GP_COMMISSIONING, NULL, HFILL }}, |
15510 | 16 | { &hf_zbee_zcl_gp_attr_gpp_func_fld_ct_based_commissioning, |
15511 | 16 | { "CT-based commissioning", "zbee_zcl_general.gp.attr.gpp_func.ct_based_commissioning", FT_BOOLEAN, 24, |
15512 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_CT_BASED_COMMISSIONING, NULL, HFILL }}, |
15513 | 16 | { &hf_zbee_zcl_gp_attr_gpp_func_fld_maintenance_of_gpd, |
15514 | 16 | { "Maintenance of GPD", "zbee_zcl_general.gp.attr.gpp_func.maintenance_of_gpd", FT_BOOLEAN, 24, |
15515 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_MAINTENANCE_OF_GPD, NULL, HFILL }}, |
15516 | 16 | { &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_00, |
15517 | 16 | { "gpdSecurityLevel = 0b00", "zbee_zcl_general.gp.attr.gpp_func.gpd_secur_lvl_00", FT_BOOLEAN, 24, |
15518 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_00, NULL, HFILL }}, |
15519 | 16 | { &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_01, |
15520 | 16 | { "Deprecated: gpdSecurityLevel = 0b01", "zbee_zcl_general.gp.attr.gpp_func.gpd_secur_lvl_01", FT_BOOLEAN, 24, |
15521 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_01, NULL, HFILL }}, |
15522 | 16 | { &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_10, |
15523 | 16 | { "gpdSecurityLevel = 0b10", "zbee_zcl_general.gp.attr.gpp_func.gpd_secur_lvl_10", FT_BOOLEAN, 24, |
15524 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_10, NULL, HFILL }}, |
15525 | 16 | { &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_secur_lvl_11, |
15526 | 16 | { "gpdSecurityLevel = 0b11", "zbee_zcl_general.gp.attr.gpp_func.gpd_secur_lvl_11", FT_BOOLEAN, 24, |
15527 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_SECUR_LVL_11, NULL, HFILL }}, |
15528 | 16 | { &hf_zbee_zcl_gp_attr_gpp_func_fld_gpd_ieee_address, |
15529 | 16 | { "GPD IEEE address", "zbee_zcl_general.gp.attr.gpp_func.gpd_ieee_address", FT_BOOLEAN, 24, |
15530 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPP_FUNC_FLD_GPD_IEEE_ADDRESS, NULL, HFILL }}, |
15531 | | |
15532 | | /* gppActiveFunctionality attribute */ |
15533 | 16 | { &hf_zbee_zcl_gp_attr_gpp_active_func, |
15534 | 16 | { "gppActiveFunctionality", "zbee_zcl_general.gp.attr.gpp_active_func", FT_UINT24, BASE_HEX, |
15535 | 16 | NULL, 0, NULL, HFILL }}, |
15536 | | |
15537 | 16 | { &hf_zbee_zcl_gp_attr_gpp_active_func_fld_gp_functionality, |
15538 | 16 | { "GP functionality", "zbee_zcl_general.gp.attr.gpp_active_func.gp_functionality", FT_BOOLEAN, 24, |
15539 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPP_ACTIVE_FUNC_FLD_GP_FUNCTIONALITY, NULL, HFILL }}, |
15540 | | |
15541 | | /* gpsFunctionality attribute */ |
15542 | 16 | { &hf_zbee_zcl_gp_attr_gps_func, |
15543 | 16 | { "gpsFunctionality", "zbee_zcl_general.gp.attr.gps_func", FT_UINT24, BASE_HEX, |
15544 | 16 | NULL, 0, NULL, HFILL }}, |
15545 | | |
15546 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_gp_feature, |
15547 | 16 | { "GP feature", "zbee_zcl_general.gp.attr.gps_func.gp_feature", FT_BOOLEAN, 24, |
15548 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GP_FEATURE, NULL, HFILL }}, |
15549 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_direct_comm, |
15550 | 16 | { "Direct communication", "zbee_zcl_general.gp.attr.gps_func.direct_comm", FT_BOOLEAN, 24, |
15551 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_DIRECT_COMM, NULL, HFILL }}, |
15552 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_derived_gcast_comm, |
15553 | 16 | { "Derived groupcast communication", "zbee_zcl_general.gp.attr.gps_func.derived_gcast_comm", FT_BOOLEAN, 24, |
15554 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_DERIVED_GCAST_COMM, NULL, HFILL }}, |
15555 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_pre_commissioned_gcast_comm, |
15556 | 16 | { "Pre-commissioned groupcast communication", "zbee_zcl_general.gp.attr.gps_func.pre_commissioned_gcast_comm", FT_BOOLEAN, 24, |
15557 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PRE_COMMISSIONED_GCAST_COMM, NULL, HFILL }}, |
15558 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_full_ucast_comm, |
15559 | 16 | { "Full unicast communication", "zbee_zcl_general.gp.attr.gps_func.full_ucast_comm", FT_BOOLEAN, 24, |
15560 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_FULL_UCAST_COMM, NULL, HFILL }}, |
15561 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_lw_ucast_comm, |
15562 | 16 | { "Lightweight unicast communication", "zbee_zcl_general.gp.attr.gps_func.lw_ucast_comm", FT_BOOLEAN, 24, |
15563 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_LW_UCAST_COMM, NULL, HFILL }}, |
15564 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_proximity_bidir_op, |
15565 | 16 | { "Proximity bidirectional operation", "zbee_zcl_general.gp.attr.gps_func.proximity_bidir_op", FT_BOOLEAN, 24, |
15566 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXIMITY_BIDIR_OP, NULL, HFILL }}, |
15567 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_bidir_op, |
15568 | 16 | { "Multi-hop bidirectional operation", "zbee_zcl_general.gp.attr.gps_func.multi_hop_bidir_op", FT_BOOLEAN, 24, |
15569 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MULTI_HOP_BIDIR_OP, NULL, HFILL }}, |
15570 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_proxy_tbl_maintenance, |
15571 | 16 | { "Proxy Table maintenance", "zbee_zcl_general.gp.attr.gps_func.proxy_tbl_maintenance", FT_BOOLEAN, 24, |
15572 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXY_TBL_MAINTENANCE, NULL, HFILL }}, |
15573 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_proximity_commissioning, |
15574 | 16 | { "Proximity commissioning", "zbee_zcl_general.gp.attr.gps_func.proximity_commissioning", FT_BOOLEAN, 24, |
15575 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_PROXIMITY_COMMISSIONING, NULL, HFILL }}, |
15576 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_multi_hop_commissioning, |
15577 | 16 | { "Multi-hop commissioning","zbee_zcl_general.gp.attr.gps_func.multi_hop_commissioning", FT_BOOLEAN, 24, |
15578 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MULTI_HOP_COMMISSIONING, NULL, HFILL }}, |
15579 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_ct_based_commissioning, |
15580 | 16 | { "CT-based commissioning", "zbee_zcl_general.gp.attr.gps_func.ct_based_commissioning", FT_BOOLEAN, 24, |
15581 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_CT_BASED_COMMISSIONING, NULL, HFILL }}, |
15582 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_maintenance_of_gpd, |
15583 | 16 | { "Maintenance of GPD", "zbee_zcl_general.gp.attr.gps_func.maintenance_of_gpd", FT_BOOLEAN, 24, |
15584 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_MAINTENANCE_OF_GPD, NULL, HFILL }}, |
15585 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_00, |
15586 | 16 | { "gpdSecurityLevel = 0b00", "zbee_zcl_general.gp.attr.gps_func.gpd_secur_lvl_00", FT_BOOLEAN, 24, |
15587 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_00, NULL, HFILL }}, |
15588 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_01, |
15589 | 16 | { "Deprecated: gpdSecurityLevel = 0b01", "zbee_zcl_general.gp.attr.gps_func.gpd_secur_lvl_01", FT_BOOLEAN, 24, |
15590 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_01, NULL, HFILL }}, |
15591 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_10, |
15592 | 16 | { "gpdSecurityLevel = 0b10", "zbee_zcl_general.gp.attr.gps_func.gpd_secur_lvl_10", FT_BOOLEAN, 24, |
15593 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_10, NULL, HFILL }}, |
15594 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_secur_lvl_11, |
15595 | 16 | { "gpdSecurityLevel = 0b11", "zbee_zcl_general.gp.attr.gps_func.gpd_secur_lvl_11", FT_BOOLEAN, 24, |
15596 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_SECUR_LVL_11, NULL, HFILL }}, |
15597 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_sink_tbl_based_gcast_forwarding, |
15598 | 16 | { "Sink Table-based groupcast forwarding", "zbee_zcl_general.gp.attr.gps_func.sink_tbl_based_gcast_forwarding", FT_BOOLEAN, 24, |
15599 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_SINK_TBL_BASED_GCAST_FORWARDING, NULL, HFILL }}, |
15600 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_translation_table, |
15601 | 16 | { "Translation Table", "zbee_zcl_general.gp.attr.gps_func.translation_table", FT_BOOLEAN, 24, |
15602 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_TRANSLATION_TABLE, NULL, HFILL }}, |
15603 | 16 | { &hf_zbee_zcl_gp_attr_gps_func_fld_gpd_ieee_address, |
15604 | 16 | { "GPD IEEE address", "zbee_zcl_general.gp.attr.gps_func.gpd_ieee_address", FT_BOOLEAN, 24, |
15605 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_FUNC_FLD_GPD_IEEE_ADDRESS, NULL, HFILL }}, |
15606 | | |
15607 | | /* gpsActiveFunctionality attribute */ |
15608 | 16 | { &hf_zbee_zcl_gp_attr_gps_active_func, |
15609 | 16 | { "gpsActiveFunctionality", "zbee_zcl_general.gp.attr.gps_active_func", FT_UINT24, BASE_HEX, |
15610 | 16 | NULL, 0, NULL, HFILL }}, |
15611 | | |
15612 | 16 | { &hf_zbee_zcl_gp_attr_gps_active_func_fld_gp_functionality, |
15613 | 16 | { "GP functionality", "zbee_zcl_general.gp.attr.gps_active_func.gp_functionality", FT_BOOLEAN, 24, |
15614 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_ACTIVE_FUNC_FLD_GP_FUNCTIONALITY, NULL, HFILL }}, |
15615 | | |
15616 | | /* gpsCommunicationMode attribute */ |
15617 | 16 | { &hf_zbee_zcl_gp_attr_gps_communication_mode, |
15618 | 16 | { "gpsCommunicationMode", "zbee_zcl_general.gp.attr.gps_communication_mode", FT_UINT8, BASE_HEX, |
15619 | 16 | NULL, 0, NULL, HFILL }}, |
15620 | | |
15621 | 16 | { &hf_zbee_zcl_gp_attr_gps_communication_mode_fld_mode, |
15622 | 16 | { "Mode", "zbee_zcl_general.gp.attr.gps_communication_mode.mode", FT_UINT8, BASE_HEX, |
15623 | 16 | VALS(zbee_zcl_gp_communication_modes), ZBEE_ZCL_GP_ATTR_GPS_COMMUNICATION_MODE_FLD_MODE, NULL, HFILL }}, |
15624 | | |
15625 | | /* gpsCommissioningExitMode attribute */ |
15626 | 16 | { &hf_zbee_zcl_gp_attr_gps_comm_exit_mode, |
15627 | 16 | { "gpsCommissioningExitMode", "zbee_zcl_general.gp.attr.gps_comm_exit_mode", FT_UINT8, BASE_HEX, |
15628 | 16 | NULL, 0, NULL, HFILL }}, |
15629 | | |
15630 | 16 | { &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_comm_window_expire, |
15631 | 16 | { "On CommissioningWindow expiration", "zbee_zcl_general.gp.attr.gps_comm_exit_mode.on_comm_window_expire", |
15632 | 16 | FT_BOOLEAN, 8, NULL, ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_COMM_WINDOW_EXPIRE, NULL, HFILL }}, |
15633 | 16 | { &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_pairing_success, |
15634 | 16 | { "On first Pairing success", "zbee_zcl_general.gp.attr.gps_comm_exit_mode.on_pairing_success", |
15635 | 16 | FT_BOOLEAN, 8, NULL, ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_PAIRING_SUCCESS, NULL, HFILL }}, |
15636 | 16 | { &hf_zbee_zcl_gp_attr_gps_comm_exit_mode_fld_on_gp_proxy_comm_mode, |
15637 | 16 | { "On GP Proxy Commissioning Mode (exit)", "zbee_zcl_general.gp.attr.gps_comm_exit_mode.on_gp_proxy_comm_mode", |
15638 | 16 | FT_BOOLEAN, 8, NULL, ZBEE_ZCL_GP_ATTR_GPS_COMM_EXIT_MODE_FLD_ON_GP_PROXY_COMM_MODE, NULL, HFILL }}, |
15639 | | |
15640 | | /* gpsSecurityLevel attribute */ |
15641 | 16 | { &hf_zbee_zcl_gp_attr_gps_secur_lvl, |
15642 | 16 | { "gpsSecurityLevel", "zbee_zcl_general.gp.attr.gps_secur_lvl", FT_UINT8, BASE_HEX, |
15643 | 16 | NULL, 0, NULL, HFILL }}, |
15644 | | |
15645 | 16 | { &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_min_gpd_secur_lvl, |
15646 | 16 | { "Minimal GPD Security Level", "zbee_zcl_general.gp.attr.gps_secur_lvl.min_gpd_secur_lvl", FT_UINT8, BASE_HEX, |
15647 | 16 | VALS(zbee_zcl_gp_secur_levels), ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_MIN_GPD_SECUR_LVL, NULL, HFILL }}, |
15648 | 16 | { &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_protection_with_gp_link_key, |
15649 | 16 | { "Protection with gpLinkKey", "zbee_zcl_general.gp.attr.gps_secur_lvl.protection_with_gp_link_key", FT_BOOLEAN, 8, |
15650 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_PROTECTION_WITH_GP_LINK_KEY, NULL, HFILL }}, |
15651 | 16 | { &hf_zbee_zcl_gp_attr_gps_secur_lvl_fld_involve_tc, |
15652 | 16 | { "Involve TC", "zbee_zcl_general.gp.attr.gps_secur_lvl.involve_tc", FT_BOOLEAN, 8, |
15653 | 16 | NULL, ZBEE_ZCL_GP_ATTR_GPS_SECUR_LVL_FLD_INVOLVE_TC, NULL, HFILL }} |
15654 | 16 | }; |
15655 | | |
15656 | | /* ZCL Green Power subtrees */ |
15657 | 16 | static int *ett[] = { |
15658 | 16 | &ett_zbee_zcl_gp, |
15659 | 16 | &ett_zbee_gp_cmd_proxy_commissioning_mode_options, |
15660 | 16 | &ett_zbee_gp_cmd_proxy_commissioning_mode_exit_mode, |
15661 | 16 | &ett_zbee_gp_cmd_commissioning_notification_options, |
15662 | 16 | &ett_zbee_gp_gpp_gpd_link, |
15663 | 16 | &ett_zbee_gp_cmd_notification_options, |
15664 | 16 | &ett_zbee_gp_cmd_pairing_options, |
15665 | 16 | &ett_zbee_gp_cmd_response_options, |
15666 | 16 | &ett_zbee_gp_cmd_response_tx_channel, |
15667 | 16 | &ett_zbee_gp_cmd_pc_actions, |
15668 | 16 | &ett_zbee_gp_cmd_pc_options, |
15669 | 16 | &ett_zbee_zcl_gp_group_list, |
15670 | 16 | &ett_zbee_gp_cmd_pc_secur_options, |
15671 | 16 | &ett_zbee_gp_cmd_pc_app_info, |
15672 | 16 | &ett_zbee_zcl_gp_ep, |
15673 | 16 | &ett_zbee_zcl_gp_cmds, |
15674 | 16 | &ett_zbee_zcl_gp_clusters, |
15675 | 16 | &ett_zbee_zcl_gp_srv_clusters, |
15676 | 16 | &ett_zbee_zcl_gp_cli_clusters, |
15677 | 16 | &ett_zbee_zcl_proxy_sink_tbl_req_options, |
15678 | 16 | &ett_zbee_zcl_gp_cmd_sink_comm_mode_options, |
15679 | 16 | &ett_zbee_gp_sink_tbl, |
15680 | 16 | &ett_zbee_gp_sink_tbl_entry, |
15681 | 16 | &ett_zbee_gp_sink_tbl_entry_options, |
15682 | 16 | &ett_zbee_gp_sec_options, |
15683 | 16 | &ett_zbee_gp_proxy_tbl, |
15684 | 16 | &ett_zbee_gp_proxy_tbl_entry, |
15685 | 16 | &ett_zbee_gp_proxy_tbl_entry_options, |
15686 | 16 | &ett_zbee_gp_proxy_tbl_entry_ext_options, |
15687 | 16 | &ett_zbee_gp_sink_address_list, |
15688 | 16 | &ett_zbee_zcl_gp_attr_gpp_func, |
15689 | 16 | &ett_zbee_zcl_gp_attr_gpp_active_func, |
15690 | 16 | &ett_zbee_zcl_gp_attr_gps_func, |
15691 | 16 | &ett_zbee_zcl_gp_attr_gps_active_func, |
15692 | 16 | &ett_zbee_zcl_gp_attr_gps_communication_mode, |
15693 | 16 | &ett_zbee_zcl_gp_attr_gps_comm_exit_mode, |
15694 | 16 | &ett_zbee_zcl_gp_attr_gps_secur_lvl |
15695 | 16 | }; |
15696 | | |
15697 | | |
15698 | | /* Register the ZigBee ZCL Green Power cluster protocol name and description */ |
15699 | 16 | proto_zbee_zcl_gp = proto_register_protocol("ZigBee ZCL Green Power", "ZCL Green Power", ZBEE_PROTOABBREV_ZCL_GP); |
15700 | 16 | proto_register_field_array(proto_zbee_zcl_gp, hf, array_length(hf)); |
15701 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
15702 | | |
15703 | | /* Register the ZigBee ZCL Green Power dissector. */ |
15704 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_GP, dissect_zbee_zcl_gp, proto_zbee_zcl_gp); |
15705 | 16 | } /*proto_register_zbee_zcl_gp*/ |
15706 | | |
15707 | | /** |
15708 | | * proto_reg_handoff_zbee_zcl_gp |
15709 | | * |
15710 | | * Hands off the ZCL Green Power dissector. |
15711 | | */ |
15712 | | void |
15713 | | proto_reg_handoff_zbee_zcl_gp(void) |
15714 | 16 | { |
15715 | 16 | zgp_handle = find_dissector(ZBEE_PROTOABBREV_NWK_GP_CMD); |
15716 | | |
15717 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_GP, |
15718 | 16 | proto_zbee_zcl_gp, |
15719 | 16 | ett_zbee_zcl_gp, |
15720 | 16 | ZBEE_ZCL_CID_GP, |
15721 | 16 | ZBEE_MFG_CODE_NONE, |
15722 | 16 | hf_zbee_zcl_gp_attr_id, |
15723 | 16 | hf_zbee_zcl_gp_attr_id, |
15724 | 16 | hf_zbee_zcl_gp_srv_rx_cmd_id, |
15725 | 16 | hf_zbee_zcl_gp_srv_tx_cmd_id, |
15726 | 16 | dissect_zcl_gp_attr_data |
15727 | 16 | ); |
15728 | 16 | } /*proto_reg_handoff_zbee_zcl_gp*/ |
15729 | | |
15730 | | /* ########################################################################## */ |
15731 | | /* #### (0x1000) TOUCHLINK COMMISSIONING CLUSTER ############################ */ |
15732 | | /* ########################################################################## */ |
15733 | | |
15734 | | /*************************/ |
15735 | | /* Defines */ |
15736 | | /*************************/ |
15737 | | /*Server commands received*/ |
15738 | 1 | #define ZBEE_ZCL_CMD_ID_SCAN_REQUEST 0x00 |
15739 | 1 | #define ZBEE_ZCL_CMD_ID_DEVICE_INFO_REQUEST 0x02 |
15740 | 0 | #define ZBEE_ZCL_CMD_ID_IDENTIFY_REQUEST 0x06 |
15741 | 0 | #define ZBEE_ZCL_CMD_ID_FACTORT_RESET_REQUEST 0x07 |
15742 | 0 | #define ZBEE_ZCL_CMD_ID_NETWORK_START_REQUEST 0x10 |
15743 | 0 | #define ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_REQUEST 0x12 |
15744 | 0 | #define ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_REQUEST 0x14 |
15745 | 0 | #define ZBEE_ZCL_CMD_ID_NETWORK_UPDATE_REQUEST 0x16 |
15746 | 1 | #define ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_REQUEST 0x41 |
15747 | 1 | #define ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_REQUEST 0x42 |
15748 | | |
15749 | | /*Server commands generated*/ |
15750 | 0 | #define ZBEE_ZCL_CMD_ID_SCAN_RESPONSE 0x01 |
15751 | 0 | #define ZBEE_ZCL_CMD_ID_DEVICE_INFO_RESPONSE 0x03 |
15752 | 0 | #define ZBEE_ZCL_CMD_ID_NETWORK_START_RESPONSE 0x11 |
15753 | 1 | #define ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_RESPONSE 0x13 |
15754 | 1 | #define ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_RESPONSE 0x15 |
15755 | 1 | #define ZBEE_ZCL_CMD_ID_ENDPOINT_INFORMATION 0x40 |
15756 | 0 | #define ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_RESPONSE 0x41 |
15757 | 0 | #define ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_RESPONSE 0x42 |
15758 | | |
15759 | | /*ZigBee Information Mask Value*/ |
15760 | 16 | #define ZBEE_ZCL_TOUCHLINK_ZBEE_INFO_TYPE 0x03 |
15761 | 16 | #define ZBEE_ZCL_TOUCHLINK_ZBEE_INFO_RXIDLE 0x04 |
15762 | | |
15763 | | /*Touchlink Information Mask Values*/ |
15764 | 16 | #define ZBEE_ZCL_TOUCHLINK_INFO_FACTORY 0x01 |
15765 | 16 | #define ZBEE_ZCL_TOUCHLINK_INFO_ASSIGNMENT 0x02 |
15766 | 16 | #define ZBEE_ZCL_TOUCHLINK_INFO_INITIATOR 0x10 |
15767 | 16 | #define ZBEE_ZCL_TOUCHLINK_INFO_UNDEFINED 0x20 |
15768 | 16 | #define ZBEE_ZCL_TOUCHLINK_INFO_PROFILE_INTEROP 0x80 |
15769 | | |
15770 | | /*Touchlink Key Indices*/ |
15771 | 16 | #define ZBEE_ZCL_TOUCHLINK_KEYID_DEVELOPMENT 0 |
15772 | 16 | #define ZBEE_ZCL_TOUCHLINK_KEYID_MASTER 4 |
15773 | 16 | #define ZBEE_ZCL_TOUCHLINK_KEYID_CERTIFICATION 15 |
15774 | | |
15775 | | /*************************/ |
15776 | | /* Function Declarations */ |
15777 | | /*************************/ |
15778 | | void proto_register_zbee_zcl_touchlink(void); |
15779 | | void proto_reg_handoff_zbee_zcl_touchlink(void); |
15780 | | |
15781 | | /*************************/ |
15782 | | /* Global Variables */ |
15783 | | /*************************/ |
15784 | | /* Initialize the protocol and registered fields */ |
15785 | | static int proto_zbee_zcl_touchlink; |
15786 | | |
15787 | | static int hf_zbee_zcl_touchlink_rx_cmd_id; |
15788 | | static int hf_zbee_zcl_touchlink_tx_cmd_id; |
15789 | | static int hf_zbee_zcl_touchlink_transaction_id; |
15790 | | static int hf_zbee_zcl_touchlink_zbee; |
15791 | | static int hf_zbee_zcl_touchlink_zbee_type; |
15792 | | static int hf_zbee_zcl_touchlink_zbee_rxidle; |
15793 | | static int hf_zbee_zcl_touchlink_info; |
15794 | | static int hf_zbee_zcl_touchlink_info_factory; |
15795 | | static int hf_zbee_zcl_touchlink_info_assignment; |
15796 | | static int hf_zbee_zcl_touchlink_info_initiator; |
15797 | | static int hf_zbee_zcl_touchlink_info_undefined; |
15798 | | static int hf_zbee_zcl_touchlink_info_profile_introp; |
15799 | | static int hf_zbee_zcl_touchlink_start_index; |
15800 | | static int hf_zbee_zcl_touchlink_ident_duration; |
15801 | | |
15802 | | static int hf_zbee_zcl_touchlink_rssi_correction; |
15803 | | static int hf_zbee_zcl_touchlink_response_id; |
15804 | | static int hf_zbee_zcl_touchlink_ext_panid; |
15805 | | static int hf_zbee_zcl_touchlink_nwk_update_id; |
15806 | | static int hf_zbee_zcl_touchlink_channel; |
15807 | | static int hf_zbee_zcl_touchlink_nwk_addr; |
15808 | | static int hf_zbee_zcl_touchlink_ext_addr; |
15809 | | static int hf_zbee_zcl_touchlink_panid; |
15810 | | static int hf_zbee_zcl_touchlink_sub_devices; |
15811 | | static int hf_zbee_zcl_touchlink_total_groups; |
15812 | | static int hf_zbee_zcl_touchlink_total_endpoints; |
15813 | | static int hf_zbee_zcl_touchlink_endpoint; |
15814 | | static int hf_zbee_zcl_touchlink_profile_id; |
15815 | | static int hf_zbee_zcl_touchlink_device_id; |
15816 | | static int hf_zbee_zcl_touchlink_version; |
15817 | | static int hf_zbee_zcl_touchlink_group_count; |
15818 | | static int hf_zbee_zcl_touchlink_group_begin; |
15819 | | static int hf_zbee_zcl_touchlink_group_end; |
15820 | | static int hf_zbee_zcl_touchlink_group_type; |
15821 | | static int hf_zbee_zcl_touchlink_group_id; |
15822 | | static int hf_zbee_zcl_touchlink_addr_range_begin; |
15823 | | static int hf_zbee_zcl_touchlink_addr_range_end; |
15824 | | static int hf_zbee_zcl_touchlink_group_range_begin; |
15825 | | static int hf_zbee_zcl_touchlink_group_range_end; |
15826 | | static int hf_zbee_zcl_touchlink_key_bitmask; |
15827 | | static int hf_zbee_zcl_touchlink_key_bit_dev; |
15828 | | static int hf_zbee_zcl_touchlink_key_bit_master; |
15829 | | static int hf_zbee_zcl_touchlink_key_bit_cert; |
15830 | | static int hf_zbee_zcl_touchlink_key_index; |
15831 | | static int hf_zbee_zcl_touchlink_key; |
15832 | | static int hf_zbee_zcl_touchlink_network_key; |
15833 | | static int hf_zbee_zcl_touchlink_init_addr; |
15834 | | static int hf_zbee_zcl_touchlink_init_eui64; |
15835 | | static int hf_zbee_zcl_touchlink_status; |
15836 | | static int hf_zbee_zcl_touchlink_device_record_count; |
15837 | | static int hf_zbee_zcl_touchlink_sort; |
15838 | | |
15839 | | /* Initialize the subtree pointers */ |
15840 | | static int ett_zbee_zcl_touchlink; |
15841 | | static int ett_zbee_zcl_touchlink_zbee; |
15842 | | static int ett_zbee_zcl_touchlink_info; |
15843 | | static int ett_zbee_zcl_touchlink_keybits; |
15844 | | static int ett_zbee_zcl_touchlink_groups; |
15845 | | static int ett_zbee_zcl_touchlink_device_record; |
15846 | | static int ett_zbee_zcl_touchlink_device_records; |
15847 | | static int ett_zbee_zcl_touchlink_endpoint; |
15848 | | static int ett_zbee_zcl_touchlink_endpoints; |
15849 | | |
15850 | | static expert_field ei_zbee_zcl_touchlink_no_key = EI_INIT; |
15851 | | |
15852 | | static GHashTable * zcl_touchlink_commissioning_map = NULL; |
15853 | | |
15854 | | struct zcl_touchlink_commissioning_data { |
15855 | | unsigned transaction_id; |
15856 | | unsigned response_id; |
15857 | | }; |
15858 | | |
15859 | | /* Command names */ |
15860 | | static const value_string zbee_zcl_touchlink_rx_cmd_names[] = { |
15861 | | { ZBEE_ZCL_CMD_ID_SCAN_REQUEST, "Scan Request" }, |
15862 | | { ZBEE_ZCL_CMD_ID_DEVICE_INFO_REQUEST, "Device Information Request" }, |
15863 | | { ZBEE_ZCL_CMD_ID_IDENTIFY_REQUEST, "Identify Request" }, |
15864 | | { ZBEE_ZCL_CMD_ID_FACTORT_RESET_REQUEST, "Reset to Factory New Request" }, |
15865 | | { ZBEE_ZCL_CMD_ID_NETWORK_START_REQUEST, "Network Start Request" }, |
15866 | | { ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_REQUEST, "Network Join Router Request" }, |
15867 | | { ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_REQUEST, "Network Join End Device Request" }, |
15868 | | { ZBEE_ZCL_CMD_ID_NETWORK_UPDATE_REQUEST, "Network Update Request" }, |
15869 | | { ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_REQUEST, "Get Group Identifiers Request" }, |
15870 | | { ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_REQUEST, "Get Endpoint List Request" }, |
15871 | | { 0, NULL } |
15872 | | }; |
15873 | | static const value_string zbee_zcl_touchlink_tx_cmd_names[] = { |
15874 | | { ZBEE_ZCL_CMD_ID_SCAN_RESPONSE, "Scan Response" }, |
15875 | | { ZBEE_ZCL_CMD_ID_DEVICE_INFO_RESPONSE, "Device Information Response" }, |
15876 | | { ZBEE_ZCL_CMD_ID_NETWORK_START_RESPONSE, "Network Start Response" }, |
15877 | | { ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_RESPONSE, "Network Join Router Response" }, |
15878 | | { ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_RESPONSE, "Network Join End Device Response" }, |
15879 | | { ZBEE_ZCL_CMD_ID_ENDPOINT_INFORMATION, "Endpoint Information" }, |
15880 | | { ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_RESPONSE, "Get Group Identifiers Response" }, |
15881 | | { ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_RESPONSE, "Get Endpoint List Response" }, |
15882 | | { 0, NULL } |
15883 | | }; |
15884 | | |
15885 | | /* ZigBee logical types */ |
15886 | | static const value_string zbee_zcl_touchlink_zbee_type_names[] = { |
15887 | | { 0, "coordinator" }, |
15888 | | { 1, "router" }, |
15889 | | { 2, "end device" }, |
15890 | | { 0, NULL } |
15891 | | }; |
15892 | | |
15893 | | static const value_string zbee_zcl_touchlink_status_names[] = { |
15894 | | { 0x00, "Success" }, |
15895 | | { 0x01, "Failure" }, |
15896 | | { 0, NULL } |
15897 | | }; |
15898 | | |
15899 | | static const value_string zbee_zcl_touchlink_profile_interop_names[] = { |
15900 | | { 0, "ZLL" }, |
15901 | | { 1, "Zigbee 3.0" }, |
15902 | | { 0, NULL } |
15903 | | }; |
15904 | | |
15905 | | static const value_string zbee_zcl_touchlink_keyid_names[] = { |
15906 | | { ZBEE_ZCL_TOUCHLINK_KEYID_DEVELOPMENT, "Development Key" }, |
15907 | | { ZBEE_ZCL_TOUCHLINK_KEYID_MASTER, "Master Key" }, |
15908 | | { ZBEE_ZCL_TOUCHLINK_KEYID_CERTIFICATION, "Certification Key" }, |
15909 | | { 0, NULL } |
15910 | | }; |
15911 | | |
15912 | | #define ZBEE_ZCL_TOUCHLINK_NUM_KEYID 16 |
15913 | | #define ZBEE_ZCL_TOUCHLINK_KEY_SIZE 16 |
15914 | | |
15915 | | /*************************/ |
15916 | | /* Function Bodies */ |
15917 | | /*************************/ |
15918 | | |
15919 | | /* Functions for Touchlink Commissioning hashtables. {{{ */ |
15920 | | static int |
15921 | | zcl_touchlink_comissioning_equal (const void *v, const void *v2) |
15922 | 4 | { |
15923 | 4 | if (v == NULL || v2 == NULL) { |
15924 | 0 | return 0; |
15925 | 0 | } |
15926 | | |
15927 | 4 | const unsigned *val1; |
15928 | 4 | const unsigned *val2; |
15929 | 4 | val1 = (const unsigned *)v; |
15930 | 4 | val2 = (const unsigned *)v2; |
15931 | | |
15932 | 4 | if (*val1 == *val2) { |
15933 | 4 | return 1; |
15934 | 4 | } |
15935 | 0 | return 0; |
15936 | 4 | } |
15937 | | |
15938 | | static unsigned |
15939 | | zcl_touchlink_comissioning_hash (const void *v) |
15940 | 16 | { |
15941 | 16 | unsigned hash; |
15942 | 16 | const unsigned * id; |
15943 | | |
15944 | 16 | if (v == NULL) { |
15945 | 0 | return 0; |
15946 | 0 | } |
15947 | | |
15948 | 16 | id = (const unsigned*) v; |
15949 | 16 | hash = *id; |
15950 | | |
15951 | 16 | return hash; |
15952 | 16 | } |
15953 | | /* Functions for Touchlink Commissioning hashtables. }}} */ |
15954 | | |
15955 | | /** |
15956 | | *This function decodes the Scan Request payload. |
15957 | | * |
15958 | | *@param tvb the tv buffer of the current data_type |
15959 | | *@param tree the tree to append this item to |
15960 | | *@param offset offset of data in tvb |
15961 | | */ |
15962 | | static void |
15963 | | dissect_zcl_touchlink_scan_request(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
15964 | 1 | { |
15965 | 1 | static int * const zbee_info_flags[] = { |
15966 | 1 | &hf_zbee_zcl_touchlink_zbee_type, |
15967 | 1 | &hf_zbee_zcl_touchlink_zbee_rxidle, |
15968 | 1 | NULL |
15969 | 1 | }; |
15970 | 1 | static int * const zll_info_flags[] = { |
15971 | 1 | &hf_zbee_zcl_touchlink_info_factory, |
15972 | 1 | &hf_zbee_zcl_touchlink_info_assignment, |
15973 | 1 | &hf_zbee_zcl_touchlink_info_initiator, |
15974 | 1 | &hf_zbee_zcl_touchlink_info_undefined, |
15975 | 1 | &hf_zbee_zcl_touchlink_info_profile_introp, |
15976 | 1 | NULL |
15977 | 1 | }; |
15978 | 1 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_touchlink_zbee, ett_zbee_zcl_touchlink_zbee, zbee_info_flags, ENC_LITTLE_ENDIAN); |
15979 | 1 | *offset += 1; |
15980 | 1 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_touchlink_info, ett_zbee_zcl_touchlink_info, zll_info_flags, ENC_LITTLE_ENDIAN); |
15981 | 1 | *offset += 1; |
15982 | 1 | } /*dissect_zcl_touchlink_scan_request*/ |
15983 | | |
15984 | | /** |
15985 | | *This function decodes the Identify Request payload. |
15986 | | * |
15987 | | *@param tvb the tv buffer of the current data_type |
15988 | | *@param tree the tree to append this item to |
15989 | | *@param offset offset of data in tvb |
15990 | | */ |
15991 | | static void |
15992 | | dissect_zcl_touchlink_identify_request(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
15993 | 0 | { |
15994 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ident_duration, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
15995 | 0 | *offset += 2; |
15996 | 0 | } /*dissect_zcl_touchlink_identify_request*/ |
15997 | | |
15998 | | /** |
15999 | | *This function decodes the Network Start Request payload. |
16000 | | * |
16001 | | *@param tvb the tv buffer of the current data_type |
16002 | | *@param tree the tree to append this item to |
16003 | | *@param offset offset of data in tvb |
16004 | | */ |
16005 | | static void |
16006 | | dissect_zcl_touchlink_network_start_request(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
16007 | 0 | { |
16008 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_panid, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
16009 | 0 | *offset += 8; |
16010 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_key_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16011 | 0 | *offset += 1; |
16012 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_key, tvb, *offset, 16, ENC_NA); |
16013 | 0 | *offset += 16; |
16014 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_channel, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16015 | 0 | *offset += 1; |
16016 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_panid, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16017 | 0 | *offset += 2; |
16018 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16019 | 0 | *offset += 2; |
16020 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16021 | 0 | *offset += 2; |
16022 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16023 | 0 | *offset += 2; |
16024 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_addr_range_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16025 | 0 | *offset += 2; |
16026 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_addr_range_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16027 | 0 | *offset += 2; |
16028 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_range_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16029 | 0 | *offset += 2; |
16030 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_range_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16031 | 0 | *offset += 2; |
16032 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_init_eui64, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
16033 | 0 | *offset += 8; |
16034 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_init_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16035 | 0 | *offset += 2; |
16036 | 0 | } /*dissect_zcl_touchlink_network_start_request*/ |
16037 | | |
16038 | | /** |
16039 | | *This function decodes the Network Join Router/EndDevice Request payloads. |
16040 | | * |
16041 | | *@param tvb the tv buffer of the current data_type |
16042 | | *@param tree the tree to append this item to |
16043 | | *@param offset offset of data in tvb |
16044 | | */ |
16045 | | static void |
16046 | | dissect_zcl_touchlink_network_join_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, struct zcl_touchlink_commissioning_data * commissioning_data) |
16047 | 0 | { |
16048 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_panid, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
16049 | 0 | *offset += 8; |
16050 | 0 | uint32_t key_index; |
16051 | 0 | proto_tree_add_item_ret_uint(tree, hf_zbee_zcl_touchlink_key_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN, &key_index); |
16052 | 0 | *offset += 1; |
16053 | 0 | proto_item* it_key = proto_tree_add_item(tree, hf_zbee_zcl_touchlink_key, tvb, *offset, 16, ENC_NA); |
16054 | 0 | const uint8_t *encrypted_network_key = tvb_get_ptr(tvb, *offset, 16); |
16055 | 0 | *offset += 16; |
16056 | |
|
16057 | 0 | static const uint8_t Touchlink_Certification_Key[16] = {0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf}; |
16058 | 0 | uint8_t Touchlink_Master_Key[16]; |
16059 | 0 | uint8_t network_key[16] = {0}; |
16060 | 0 | const uint8_t * key = NULL; |
16061 | 0 | uint8_t * decrypted_network_key = NULL; |
16062 | 0 | if(key_index == ZBEE_ZCL_TOUCHLINK_KEYID_MASTER || key_index == ZBEE_ZCL_TOUCHLINK_KEYID_CERTIFICATION){ |
16063 | 0 | if(key_index == ZBEE_ZCL_TOUCHLINK_KEYID_MASTER){ |
16064 | 0 | if(!zbee_sec_get_key_from_keyring("Touchlink Master Key", Touchlink_Master_Key)){ |
16065 | 0 | expert_add_info_format(pinfo, it_key, &ei_zbee_zcl_touchlink_no_key, "No key named 'Touchlink Master Key' found, cannot decrypt transport key"); |
16066 | 0 | }else{ |
16067 | 0 | key = Touchlink_Master_Key; |
16068 | 0 | } |
16069 | 0 | }else if(key_index == ZBEE_ZCL_TOUCHLINK_KEYID_CERTIFICATION){ |
16070 | 0 | key = Touchlink_Certification_Key; |
16071 | 0 | } |
16072 | 0 | if(key){ |
16073 | 0 | uint8_t expanded_input[16]; |
16074 | 0 | expanded_input[0x0] = (commissioning_data->transaction_id >> 24) & 0xFF; |
16075 | 0 | expanded_input[0x1] = (commissioning_data->transaction_id >> 16) & 0xFF; |
16076 | 0 | expanded_input[0x2] = (commissioning_data->transaction_id >> 8) & 0xFF; |
16077 | 0 | expanded_input[0x3] = (commissioning_data->transaction_id >> 0) & 0xFF; |
16078 | 0 | expanded_input[0x4] = (commissioning_data->transaction_id >> 24) & 0xFF; |
16079 | 0 | expanded_input[0x5] = (commissioning_data->transaction_id >> 16) & 0xFF; |
16080 | 0 | expanded_input[0x6] = (commissioning_data->transaction_id >> 8) & 0xFF; |
16081 | 0 | expanded_input[0x7] = (commissioning_data->transaction_id >> 0) & 0xFF; |
16082 | 0 | expanded_input[0x8] = (commissioning_data->response_id >> 24) & 0xFF; |
16083 | 0 | expanded_input[0x9] = (commissioning_data->response_id >> 16) & 0xFF; |
16084 | 0 | expanded_input[0xA] = (commissioning_data->response_id >> 8) & 0xFF; |
16085 | 0 | expanded_input[0xB] = (commissioning_data->response_id >> 0) & 0xFF; |
16086 | 0 | expanded_input[0xC] = (commissioning_data->response_id >> 24) & 0xFF; |
16087 | 0 | expanded_input[0xD] = (commissioning_data->response_id >> 16) & 0xFF; |
16088 | 0 | expanded_input[0xE] = (commissioning_data->response_id >> 8) & 0xFF; |
16089 | 0 | expanded_input[0xF] = (commissioning_data->response_id >> 0) & 0xFF; |
16090 | 0 | 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]); |
16091 | 0 | 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]); |
16092 | |
|
16093 | 0 | gcry_cipher_hd_t hd1; |
16094 | 0 | gcry_error_t err; |
16095 | 0 | if (gcry_cipher_open(&hd1, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_ECB, 0)) { |
16096 | 0 | gcry_cipher_close(hd1); |
16097 | 0 | ws_debug("touchlink: can't open aes128 cipher handle"); |
16098 | 0 | return; |
16099 | 0 | } |
16100 | 0 | if ((err = gcry_cipher_setkey(hd1, key, 16))) { |
16101 | 0 | gcry_cipher_close(hd1); |
16102 | 0 | ws_debug("touchlink: can't set aes128 cipher key"); |
16103 | 0 | ws_debug("libgcrypt: %d %s %s", gcry_err_code(err), gcry_strsource(err), gcry_strerror(err)); |
16104 | 0 | return; |
16105 | 0 | } |
16106 | | |
16107 | 0 | uint8_t transport_key[16] = {0}; |
16108 | 0 | if (gcry_cipher_encrypt(hd1, transport_key, 16, expanded_input, 16)) { |
16109 | 0 | ws_debug("can\'t decrypt aes128"); |
16110 | 0 | return; |
16111 | 0 | } |
16112 | | |
16113 | 0 | ws_debug("transport_key: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", transport_key[0x0], transport_key[0x1], transport_key[0x2], transport_key[0x3], transport_key[0x4], transport_key[0x5], transport_key[0x6], transport_key[0x7], transport_key[0x8], transport_key[0x9], transport_key[0xA], transport_key[0xB], transport_key[0xC], transport_key[0xD], transport_key[0xE], transport_key[0xF]); |
16114 | |
|
16115 | 0 | gcry_cipher_close(hd1); |
16116 | |
|
16117 | 0 | gcry_cipher_hd_t hd2; |
16118 | 0 | if (gcry_cipher_open(&hd2, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_ECB, 0)) { |
16119 | 0 | gcry_cipher_close(hd2); |
16120 | 0 | ws_debug("touchlink: can't open aes128 cipher handle"); |
16121 | 0 | return; |
16122 | 0 | } |
16123 | 0 | if ((err = gcry_cipher_setkey(hd2, transport_key, 16))) { |
16124 | 0 | gcry_cipher_close(hd2); |
16125 | 0 | ws_debug("touchlink: can't set aes128 cipher key"); |
16126 | 0 | ws_debug("libgcrypt: %d %s %s", gcry_err_code(err), gcry_strsource(err), gcry_strerror(err)); |
16127 | 0 | return; |
16128 | 0 | } |
16129 | | |
16130 | 0 | ws_debug("encrypted_network_key: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", encrypted_network_key[0x0], encrypted_network_key[0x1], encrypted_network_key[0x2], encrypted_network_key[0x3], encrypted_network_key[0x4], encrypted_network_key[0x5], encrypted_network_key[0x6], encrypted_network_key[0x7], encrypted_network_key[0x8], encrypted_network_key[0x9], encrypted_network_key[0xA], encrypted_network_key[0xB], encrypted_network_key[0xC], encrypted_network_key[0xD], encrypted_network_key[0xE], encrypted_network_key[0xF]); |
16131 | |
|
16132 | 0 | if (gcry_cipher_decrypt(hd2, network_key, 16, encrypted_network_key, 16)) { |
16133 | 0 | ws_debug("can\'t decrypt aes128"); |
16134 | 0 | return; |
16135 | 0 | } |
16136 | | |
16137 | 0 | ws_debug("network_key: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", network_key[0x0], network_key[0x1], network_key[0x2], network_key[0x3], network_key[0x4], network_key[0x5], network_key[0x6], network_key[0x7], network_key[0x8], network_key[0x9], network_key[0xA], network_key[0xB], network_key[0xC], network_key[0xD], network_key[0xE], network_key[0xF]); |
16138 | |
|
16139 | 0 | gcry_cipher_close(hd2); |
16140 | |
|
16141 | 0 | proto_tree_add_bytes(tree, hf_zbee_zcl_touchlink_network_key, tvb, *offset-16, 16, network_key); |
16142 | 0 | decrypted_network_key = network_key; |
16143 | 0 | } |
16144 | 0 | }else if(key_index == ZBEE_ZCL_TOUCHLINK_KEYID_DEVELOPMENT){ |
16145 | 0 | uint8_t expanded_input[16]; |
16146 | 0 | expanded_input[0x0] = 'P'; |
16147 | 0 | expanded_input[0x1] = 'h'; |
16148 | 0 | expanded_input[0x2] = 'L'; |
16149 | 0 | expanded_input[0x3] = 'i'; |
16150 | 0 | expanded_input[0x4] = (commissioning_data->transaction_id >> 24) & 0xFF; |
16151 | 0 | expanded_input[0x5] = (commissioning_data->transaction_id >> 16) & 0xFF; |
16152 | 0 | expanded_input[0x6] = (commissioning_data->transaction_id >> 8) & 0xFF; |
16153 | 0 | expanded_input[0x7] = (commissioning_data->transaction_id >> 0) & 0xFF; |
16154 | 0 | expanded_input[0x8] = 'C'; |
16155 | 0 | expanded_input[0x9] = 'L'; |
16156 | 0 | expanded_input[0xA] = 'S'; |
16157 | 0 | expanded_input[0xB] = 'N'; |
16158 | 0 | expanded_input[0xC] = (commissioning_data->response_id >> 24) & 0xFF; |
16159 | 0 | expanded_input[0xD] = (commissioning_data->response_id >> 16) & 0xFF; |
16160 | 0 | expanded_input[0xE] = (commissioning_data->response_id >> 8) & 0xFF; |
16161 | 0 | expanded_input[0xF] = (commissioning_data->response_id >> 0) & 0xFF; |
16162 | 0 | 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]); |
16163 | |
|
16164 | 0 | gcry_cipher_hd_t hd; |
16165 | 0 | gcry_error_t err; |
16166 | 0 | if (gcry_cipher_open(&hd, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_ECB, 0)) { |
16167 | 0 | gcry_cipher_close(hd); |
16168 | 0 | ws_debug("touchlink: can't open aes128 cipher handle"); |
16169 | 0 | return; |
16170 | 0 | } |
16171 | 0 | if ((err = gcry_cipher_setkey(hd, expanded_input, 16))) { |
16172 | 0 | gcry_cipher_close(hd); |
16173 | 0 | ws_debug("touchlink: can't set aes128 cipher key"); |
16174 | 0 | ws_debug("libgcrypt: %d %s %s", gcry_err_code(err), gcry_strsource(err), gcry_strerror(err)); |
16175 | 0 | return; |
16176 | 0 | } |
16177 | | |
16178 | 0 | ws_debug("encrypted_network_key: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", encrypted_network_key[0x0], encrypted_network_key[0x1], encrypted_network_key[0x2], encrypted_network_key[0x3], encrypted_network_key[0x4], encrypted_network_key[0x5], encrypted_network_key[0x6], encrypted_network_key[0x7], encrypted_network_key[0x8], encrypted_network_key[0x9], encrypted_network_key[0xA], encrypted_network_key[0xB], encrypted_network_key[0xC], encrypted_network_key[0xD], encrypted_network_key[0xE], encrypted_network_key[0xF]); |
16179 | |
|
16180 | 0 | if (gcry_cipher_decrypt(hd, network_key, 16, encrypted_network_key, 16)) { |
16181 | 0 | ws_debug("can\'t decrypt aes128"); |
16182 | 0 | return; |
16183 | 0 | } |
16184 | | |
16185 | 0 | ws_debug("network_key: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", network_key[0x0], network_key[0x1], network_key[0x2], network_key[0x3], network_key[0x4], network_key[0x5], network_key[0x6], network_key[0x7], network_key[0x8], network_key[0x9], network_key[0xA], network_key[0xB], network_key[0xC], network_key[0xD], network_key[0xE], network_key[0xF]); |
16186 | |
|
16187 | 0 | gcry_cipher_close(hd); |
16188 | |
|
16189 | 0 | proto_tree_add_bytes(tree, hf_zbee_zcl_touchlink_network_key, tvb, *offset-16, 16, network_key); |
16190 | 0 | decrypted_network_key = network_key; |
16191 | 0 | }else{ |
16192 | 0 | expert_add_info_format(pinfo, it_key, &ei_zbee_zcl_touchlink_no_key, "Unsupported key %d, cannot decrypt transport key", key_index); |
16193 | 0 | } |
16194 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_update_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16195 | 0 | *offset += 1; |
16196 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_channel, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16197 | 0 | *offset += 1; |
16198 | 0 | uint32_t panid; |
16199 | 0 | proto_tree_add_item_ret_uint(tree, hf_zbee_zcl_touchlink_panid, tvb, *offset, 2, ENC_LITTLE_ENDIAN, &panid); |
16200 | 0 | *offset += 2; |
16201 | 0 | if(decrypted_network_key){ |
16202 | 0 | zbee_sec_add_key_to_keyring_panid(pinfo, decrypted_network_key, panid); |
16203 | 0 | } |
16204 | |
|
16205 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16206 | 0 | *offset += 2; |
16207 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16208 | 0 | *offset += 2; |
16209 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16210 | 0 | *offset += 2; |
16211 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_addr_range_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16212 | 0 | *offset += 2; |
16213 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_addr_range_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16214 | 0 | *offset += 2; |
16215 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_range_begin, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16216 | 0 | *offset += 2; |
16217 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_range_end, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16218 | 0 | *offset += 2; |
16219 | 0 | } /*dissect_zcl_touchlink_network_join_request*/ |
16220 | | |
16221 | | /** |
16222 | | *This function decodes the Scan Response payload. |
16223 | | * |
16224 | | *@param tvb the tv buffer of the current data_type |
16225 | | *@param tree the tree to append this item to |
16226 | | *@param offset offset of data in tvb |
16227 | | */ |
16228 | | static void |
16229 | | dissect_zcl_touchlink_network_update_request(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
16230 | 0 | { |
16231 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_panid, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
16232 | 0 | *offset += 8; |
16233 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_update_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16234 | 0 | *offset += 1; |
16235 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_channel, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16236 | 0 | *offset += 1; |
16237 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_panid, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16238 | 0 | *offset += 2; |
16239 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16240 | 0 | *offset += 2; |
16241 | 0 | } /*dissect_zcl_touchlink_network_update_request*/ |
16242 | | |
16243 | | |
16244 | | /** |
16245 | | *This function decodes the Device Information Request payload. |
16246 | | * |
16247 | | *@param tvb the tv buffer of the current data_type |
16248 | | *@param tree the tree to append this item to |
16249 | | *@param offset offset of data in tvb |
16250 | | */ |
16251 | | static void |
16252 | | dissect_zcl_touchlink_device_info_request(tvbuff_t *tvb, proto_tree *tree, guint *offset) |
16253 | 1 | { |
16254 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_start_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16255 | 1 | *offset += 1; |
16256 | 1 | } /* dissect_zcl_touchlink_device_info_request */ |
16257 | | |
16258 | | /** |
16259 | | *This function decodes the Scan Response payload. |
16260 | | * |
16261 | | *@param tvb the tv buffer of the current data_type |
16262 | | *@param tree the tree to append this item to |
16263 | | *@param offset offset of data in tvb |
16264 | | */ |
16265 | | static void |
16266 | | dissect_zcl_touchlink_scan_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, struct zcl_touchlink_commissioning_data * commissioning_data) |
16267 | 0 | { |
16268 | 0 | static int * const zbee_info_flags[] = { |
16269 | 0 | &hf_zbee_zcl_touchlink_zbee_type, |
16270 | 0 | &hf_zbee_zcl_touchlink_zbee_rxidle, |
16271 | 0 | NULL |
16272 | 0 | }; |
16273 | 0 | static int * const zll_info_flags[] = { |
16274 | 0 | &hf_zbee_zcl_touchlink_info_factory, |
16275 | 0 | &hf_zbee_zcl_touchlink_info_assignment, |
16276 | 0 | &hf_zbee_zcl_touchlink_info_initiator, |
16277 | 0 | &hf_zbee_zcl_touchlink_info_undefined, |
16278 | 0 | &hf_zbee_zcl_touchlink_info_profile_introp, |
16279 | 0 | NULL |
16280 | 0 | }; |
16281 | 0 | static int * const zll_keybit_flags[] = { |
16282 | 0 | &hf_zbee_zcl_touchlink_key_bit_dev, |
16283 | 0 | &hf_zbee_zcl_touchlink_key_bit_master, |
16284 | 0 | &hf_zbee_zcl_touchlink_key_bit_cert, |
16285 | 0 | NULL |
16286 | 0 | }; |
16287 | 0 | uint8_t subdev; |
16288 | | |
16289 | | /* Parse out the fixed-format stuff */ |
16290 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_rssi_correction, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16291 | 0 | *offset += 1; |
16292 | 0 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_touchlink_zbee, ett_zbee_zcl_touchlink_zbee, zbee_info_flags, ENC_LITTLE_ENDIAN); |
16293 | 0 | *offset += 1; |
16294 | 0 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_touchlink_info, ett_zbee_zcl_touchlink_info, zll_info_flags, ENC_LITTLE_ENDIAN); |
16295 | 0 | *offset += 1; |
16296 | 0 | proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_touchlink_key_bitmask, ett_zbee_zcl_touchlink_keybits, zll_keybit_flags, ENC_LITTLE_ENDIAN); |
16297 | 0 | *offset += 2; |
16298 | 0 | proto_tree_add_item_ret_uint(tree, hf_zbee_zcl_touchlink_response_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN, &commissioning_data->response_id); |
16299 | 0 | *offset += 4; |
16300 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_panid, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
16301 | 0 | *offset += 8; |
16302 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_update_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16303 | 0 | *offset += 1; |
16304 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_channel, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16305 | 0 | *offset += 1; |
16306 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_panid, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16307 | 0 | *offset += 2; |
16308 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16309 | 0 | *offset += 2; |
16310 | 0 | subdev = tvb_get_uint8(tvb, *offset); |
16311 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_sub_devices, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16312 | 0 | *offset += 1; |
16313 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_total_groups, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16314 | 0 | *offset += 1; |
16315 | | |
16316 | | /* The remaining fields are only present when sub-devices is one. */ |
16317 | 0 | if (subdev == 1) { |
16318 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_endpoint, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16319 | 0 | *offset += 1; |
16320 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_profile_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16321 | 0 | *offset += 2; |
16322 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_device_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16323 | 0 | *offset += 2; |
16324 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_version, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16325 | 0 | *offset += 1; |
16326 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_group_count, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16327 | 0 | *offset += 1; |
16328 | 0 | } |
16329 | 0 | } /*dissect_zcl_touchlink_scan_response*/ |
16330 | | |
16331 | | /** |
16332 | | *This function decodes the Network Start Response payload. |
16333 | | * |
16334 | | *@param tvb the tv buffer of the current data_type |
16335 | | *@param tree the tree to append this item to |
16336 | | *@param offset offset of data in tvb |
16337 | | */ |
16338 | | static void |
16339 | | dissect_zcl_touchlink_network_start_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
16340 | 0 | { |
16341 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16342 | 0 | *offset += 1; |
16343 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_panid, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
16344 | 0 | *offset += 8; |
16345 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_update_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16346 | 0 | *offset += 1; |
16347 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_channel, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16348 | 0 | *offset += 1; |
16349 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_panid, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16350 | 0 | *offset += 2; |
16351 | 0 | } /* dissect_zcl_touchlink_network_start_response */ |
16352 | | |
16353 | | /** |
16354 | | *This function decodes the Network Join Router/EndDevice Response payloads. |
16355 | | * |
16356 | | *@param tvb the tv buffer of the current data_type |
16357 | | *@param tree the tree to append this item to |
16358 | | *@param offset offset of data in tvb |
16359 | | */ |
16360 | | static void |
16361 | | dissect_zcl_touchlink_network_join_response(tvbuff_t *tvb, proto_tree *tree, guint *offset) |
16362 | 1 | { |
16363 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16364 | 1 | *offset += 1; |
16365 | 1 | } /*dissect_zcl_touchlink_network_join_response*/ |
16366 | | |
16367 | | /** |
16368 | | *This function decodes the Device Information Response payload. |
16369 | | * |
16370 | | *@param tvb the tv buffer of the current data_type |
16371 | | *@param tree the tree to append this item to |
16372 | | *@param offset offset of data in tvb |
16373 | | */ |
16374 | | static void |
16375 | | dissect_zcl_touchlink_device_info_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
16376 | 0 | { |
16377 | 0 | proto_tree *list_tree; |
16378 | 0 | uint8_t count, idx; |
16379 | |
|
16380 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_sub_devices, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16381 | 0 | *offset += 1; |
16382 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_start_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16383 | 0 | *offset += 1; |
16384 | 0 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_touchlink_device_record_count, tvb, *offset, 1, ENC_LITTLE_ENDIAN, &count); |
16385 | 0 | *offset += 1; |
16386 | |
|
16387 | 0 | list_tree = proto_tree_add_subtree(tree, tvb, *offset, count * 16, ett_zbee_zcl_touchlink_device_records, NULL, "Device Records"); |
16388 | 0 | for (idx = 0; idx < count; idx++) { |
16389 | 0 | proto_tree *record_tree; |
16390 | 0 | unsigned record_start = *offset; |
16391 | | |
16392 | | // Create subtree for this record |
16393 | 0 | record_tree = proto_tree_add_subtree_format( |
16394 | 0 | list_tree, tvb, record_start, 16, |
16395 | 0 | ett_zbee_zcl_touchlink_device_record, NULL, |
16396 | 0 | "Device Record %u", (idx + 1) // numbering |
16397 | 0 | ); |
16398 | |
|
16399 | 0 | proto_tree_add_item(record_tree, hf_zbee_zcl_touchlink_ext_addr, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
16400 | 0 | *offset += 8; |
16401 | 0 | proto_tree_add_item(record_tree, hf_zbee_zcl_touchlink_endpoint, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16402 | 0 | *offset += 1; |
16403 | 0 | proto_tree_add_item(record_tree, hf_zbee_zcl_touchlink_profile_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16404 | 0 | *offset += 2; |
16405 | 0 | proto_tree_add_item(record_tree, hf_zbee_zcl_touchlink_device_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16406 | 0 | *offset += 2; |
16407 | 0 | proto_tree_add_item(record_tree, hf_zbee_zcl_touchlink_version, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16408 | 0 | *offset += 1; |
16409 | 0 | proto_tree_add_item(record_tree, hf_zbee_zcl_touchlink_group_count, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16410 | 0 | *offset += 1; |
16411 | 0 | proto_tree_add_item(record_tree, hf_zbee_zcl_touchlink_sort, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16412 | 0 | *offset += 1; |
16413 | 0 | } |
16414 | 0 | } /* dissect_zcl_touchlink_device_info_response */ |
16415 | | |
16416 | | /** |
16417 | | *This function decodes the Endpoint Information payload. |
16418 | | * |
16419 | | *@param tvb the tv buffer of the current data_type |
16420 | | *@param tree the tree to append this item to |
16421 | | *@param offset offset of data in tvb |
16422 | | */ |
16423 | | static void |
16424 | | dissect_zcl_touchlink_endpoint_info(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
16425 | 1 | { |
16426 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_ext_addr, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
16427 | 1 | *offset += 8; |
16428 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_nwk_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16429 | 1 | *offset += 2; |
16430 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_endpoint, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16431 | 1 | *offset += 1; |
16432 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_profile_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16433 | 1 | *offset += 2; |
16434 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_device_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16435 | 1 | *offset += 2; |
16436 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_version, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16437 | 1 | *offset += 1; |
16438 | 1 | } /* dissect_zcl_touchlink_endpoint_info */ |
16439 | | |
16440 | | /** |
16441 | | *This function decodes the Get Group Identifiers Response payload. |
16442 | | * |
16443 | | *@param tvb the tv buffer of the current data_type |
16444 | | *@param tree the tree to append this item to |
16445 | | *@param offset offset of data in tvb |
16446 | | */ |
16447 | | static void |
16448 | | dissect_zcl_touchlink_group_id_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
16449 | 0 | { |
16450 | 0 | proto_tree *list_tree; |
16451 | 0 | uint8_t count; |
16452 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_total_groups, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16453 | 0 | *offset += 1; |
16454 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_start_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16455 | 0 | *offset += 1; |
16456 | 0 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_touchlink_group_count, tvb, *offset, 1, ENC_LITTLE_ENDIAN, &count); |
16457 | 0 | *offset += 1; |
16458 | |
|
16459 | 0 | list_tree = proto_tree_add_subtree(tree, tvb, *offset, count * 3, ett_zbee_zcl_touchlink_groups, NULL, "Group Information Records"); |
16460 | 0 | while (count--) { |
16461 | 0 | proto_tree_add_item(list_tree, hf_zbee_zcl_touchlink_group_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16462 | 0 | *offset += 2; |
16463 | 0 | proto_tree_add_item(list_tree, hf_zbee_zcl_touchlink_group_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16464 | 0 | *offset += 1; |
16465 | 0 | } |
16466 | 0 | } /* dissect_zcl_touchlink_group_id_response */ |
16467 | | |
16468 | | /** |
16469 | | *This function decodes the Get Endpoint List Response payload. |
16470 | | * |
16471 | | *@param tvb the tv buffer of the current data_type |
16472 | | *@param tree the tree to append this item to |
16473 | | *@param offset offset of data in tvb |
16474 | | */ |
16475 | | static void |
16476 | | dissect_zcl_touchlink_endpoint_list_response(tvbuff_t *tvb, proto_tree *tree, unsigned *offset) |
16477 | 0 | { |
16478 | 0 | proto_tree *list_tree; |
16479 | 0 | uint8_t count, idx; |
16480 | |
|
16481 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_total_endpoints, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16482 | 0 | *offset += 1; |
16483 | 0 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_start_index, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16484 | 0 | *offset += 1; |
16485 | 0 | proto_tree_add_item_ret_uint8(tree, hf_zbee_zcl_touchlink_group_count, tvb, *offset, 1, ENC_LITTLE_ENDIAN, &count); |
16486 | 0 | *offset += 1; |
16487 | |
|
16488 | 0 | list_tree = proto_tree_add_subtree(tree, tvb, *offset, count * 8, ett_zbee_zcl_touchlink_endpoints, NULL, "Endpoint Information Records"); |
16489 | 0 | for (idx = 0; idx < count; idx++) { |
16490 | 0 | proto_tree *record_tree; |
16491 | 0 | unsigned record_start = *offset; |
16492 | | |
16493 | | // Create subtree for this record |
16494 | 0 | record_tree = proto_tree_add_subtree_format( |
16495 | 0 | list_tree, tvb, record_start, 8, |
16496 | 0 | ett_zbee_zcl_touchlink_endpoint, NULL, |
16497 | 0 | "Endpoint Record %u", (idx + 1) // numbering |
16498 | 0 | ); |
16499 | |
|
16500 | 0 | proto_tree_add_item(record_tree, hf_zbee_zcl_touchlink_nwk_addr, tvb, *offset, 2, ENC_LITTLE_ENDIAN); |
16501 | 0 | *offset += 2; |
16502 | 0 | proto_tree_add_item(record_tree, hf_zbee_zcl_touchlink_endpoint, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16503 | 0 | *offset += 1; |
16504 | 0 | proto_tree_add_item(record_tree, hf_zbee_zcl_touchlink_profile_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16505 | 0 | *offset += 2; |
16506 | 0 | proto_tree_add_item(record_tree, hf_zbee_zcl_touchlink_device_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16507 | 0 | *offset += 2; |
16508 | 0 | proto_tree_add_item(record_tree, hf_zbee_zcl_touchlink_version, tvb, *offset, 1, ENC_LITTLE_ENDIAN); |
16509 | 0 | *offset += 1; |
16510 | 0 | } |
16511 | 0 | } /* dissect_zcl_touchlink_endpoint_list_response */ |
16512 | | |
16513 | | /** |
16514 | | *ZigBee ZCL Touchlink Commissioning cluster dissector for wireshark. |
16515 | | * |
16516 | | *@param tvb pointer to buffer containing raw packet. |
16517 | | *@param pinfo pointer to packet information fields |
16518 | | *@param tree pointer to data tree Wireshark uses to display packet. |
16519 | | */ |
16520 | | static int |
16521 | | dissect_zbee_zcl_touchlink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) |
16522 | 10 | { |
16523 | 10 | zbee_zcl_packet *zcl; |
16524 | 10 | unsigned offset = 0; |
16525 | 10 | uint8_t cmd_id; |
16526 | 10 | int hf_cmd_id; |
16527 | 10 | const value_string *vals_cmd_id; |
16528 | 10 | struct zcl_touchlink_commissioning_data *commissioning_data = NULL; |
16529 | | |
16530 | | /* Reject the packet if data is NULL */ |
16531 | 10 | if (data == NULL) |
16532 | 0 | return 0; |
16533 | 10 | zcl = (zbee_zcl_packet *)data; |
16534 | 10 | cmd_id = zcl->cmd_id; |
16535 | | |
16536 | 10 | if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { |
16537 | 4 | hf_cmd_id = hf_zbee_zcl_touchlink_rx_cmd_id; |
16538 | 4 | vals_cmd_id = zbee_zcl_touchlink_rx_cmd_names; |
16539 | 6 | } else { |
16540 | 6 | hf_cmd_id = hf_zbee_zcl_touchlink_tx_cmd_id; |
16541 | 6 | vals_cmd_id = zbee_zcl_touchlink_tx_cmd_names; |
16542 | 6 | } |
16543 | | |
16544 | | /* Append the command name to the info column. */ |
16545 | 10 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u", |
16546 | 10 | val_to_str_const(cmd_id, vals_cmd_id, "Unknown Command"), |
16547 | 10 | zcl->tran_seqno); |
16548 | | /* Add the command ID. */ |
16549 | 10 | if (tree) { |
16550 | 10 | proto_tree_add_item(tree, hf_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
16551 | 10 | } |
16552 | 10 | offset++; |
16553 | | |
16554 | | /* All commands in the touchlink commissioning command set (0x00-0x3f) |
16555 | | * are cluster inter-PAN command frames and begin with a transaction |
16556 | | * identifier. */ |
16557 | 10 | unsigned transaction_id = 0; |
16558 | 10 | if (cmd_id < 0x40) { |
16559 | 6 | proto_tree_add_item_ret_uint(tree, hf_zbee_zcl_touchlink_transaction_id, tvb, offset, 4, ENC_LITTLE_ENDIAN, &transaction_id); |
16560 | 6 | offset += 4; |
16561 | 6 | } |
16562 | | |
16563 | 10 | ws_noisy("transaction_id=%08X\n", transaction_id); |
16564 | 10 | commissioning_data = (struct zcl_touchlink_commissioning_data *)g_hash_table_lookup(zcl_touchlink_commissioning_map, &transaction_id); |
16565 | 10 | if(!commissioning_data){ |
16566 | 6 | ws_debug("creating commissioning_data for transaction_id=%08X\n", transaction_id); |
16567 | 6 | commissioning_data = wmem_new0(wmem_file_scope(), struct zcl_touchlink_commissioning_data); |
16568 | 6 | commissioning_data->transaction_id = transaction_id; |
16569 | 6 | g_hash_table_insert(zcl_touchlink_commissioning_map, &commissioning_data->transaction_id, commissioning_data); |
16570 | 6 | } |
16571 | | |
16572 | | /* Create a subtree for the ZCL Command frame, and add the command ID to it. */ |
16573 | 10 | if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) { |
16574 | | /* Call the appropriate command dissector */ |
16575 | 4 | switch (cmd_id) { |
16576 | 1 | case ZBEE_ZCL_CMD_ID_SCAN_REQUEST: |
16577 | 1 | dissect_zcl_touchlink_scan_request(tvb, tree, &offset); |
16578 | 1 | break; |
16579 | | |
16580 | 0 | case ZBEE_ZCL_CMD_ID_IDENTIFY_REQUEST: |
16581 | 0 | dissect_zcl_touchlink_identify_request(tvb, tree, &offset); |
16582 | 0 | break; |
16583 | | |
16584 | 0 | case ZBEE_ZCL_CMD_ID_FACTORT_RESET_REQUEST: |
16585 | | /* No payload */ |
16586 | 0 | break; |
16587 | | |
16588 | 0 | case ZBEE_ZCL_CMD_ID_NETWORK_START_REQUEST: |
16589 | 0 | dissect_zcl_touchlink_network_start_request(tvb, tree, &offset); |
16590 | 0 | break; |
16591 | | |
16592 | 0 | case ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_REQUEST: |
16593 | 0 | case ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_REQUEST: |
16594 | 0 | dissect_zcl_touchlink_network_join_request(tvb, pinfo, tree, &offset, commissioning_data); |
16595 | 0 | break; |
16596 | | |
16597 | 0 | case ZBEE_ZCL_CMD_ID_NETWORK_UPDATE_REQUEST: |
16598 | 0 | dissect_zcl_touchlink_network_update_request(tvb, tree, &offset); |
16599 | 0 | break; |
16600 | | |
16601 | 1 | case ZBEE_ZCL_CMD_ID_DEVICE_INFO_REQUEST: |
16602 | 1 | dissect_zcl_touchlink_device_info_request(tvb, tree, &offset); |
16603 | 1 | break; |
16604 | | |
16605 | 1 | case ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_REQUEST: |
16606 | 1 | case ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_REQUEST: |
16607 | 1 | proto_tree_add_item(tree, hf_zbee_zcl_touchlink_start_index, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
16608 | 1 | offset++; |
16609 | 1 | break; |
16610 | | |
16611 | 1 | default: |
16612 | 1 | break; |
16613 | 4 | } |
16614 | 4 | } |
16615 | 6 | else { |
16616 | | /* Call the appropriate command dissector */ |
16617 | 6 | switch (cmd_id) { |
16618 | 0 | case ZBEE_ZCL_CMD_ID_SCAN_RESPONSE: |
16619 | 0 | dissect_zcl_touchlink_scan_response(tvb, tree, &offset, commissioning_data); |
16620 | 0 | break; |
16621 | | |
16622 | 0 | case ZBEE_ZCL_CMD_ID_NETWORK_START_RESPONSE: |
16623 | 0 | dissect_zcl_touchlink_network_start_response(tvb, tree, &offset); |
16624 | 0 | break; |
16625 | | |
16626 | 1 | case ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ROUTER_RESPONSE: |
16627 | 1 | case ZBEE_ZCL_CMD_ID_NETWORK_JOIN_ENDDEV_RESPONSE: |
16628 | 1 | dissect_zcl_touchlink_network_join_response(tvb, tree, &offset); |
16629 | 1 | break; |
16630 | | |
16631 | 0 | case ZBEE_ZCL_CMD_ID_DEVICE_INFO_RESPONSE: |
16632 | 0 | dissect_zcl_touchlink_device_info_response(tvb, tree, &offset); |
16633 | 0 | break; |
16634 | | |
16635 | 1 | case ZBEE_ZCL_CMD_ID_ENDPOINT_INFORMATION: |
16636 | 1 | dissect_zcl_touchlink_endpoint_info(tvb, tree, &offset); |
16637 | 1 | break; |
16638 | | |
16639 | 0 | case ZBEE_ZCL_CMD_ID_GET_GROUP_IDENTIFIERS_RESPONSE: |
16640 | 0 | dissect_zcl_touchlink_group_id_response(tvb, tree, &offset); |
16641 | 0 | break; |
16642 | | |
16643 | 0 | case ZBEE_ZCL_CMD_ID_GET_ENDPOINT_LIST_RESPONSE: |
16644 | 0 | dissect_zcl_touchlink_endpoint_list_response(tvb, tree, &offset); |
16645 | 0 | break; |
16646 | | |
16647 | 4 | default: |
16648 | 4 | break; |
16649 | 6 | } |
16650 | 6 | } |
16651 | | |
16652 | | /* Dump leftover data. */ |
16653 | 10 | if (tvb_captured_length_remaining(tvb, offset) > 0) { |
16654 | 10 | tvbuff_t *excess = tvb_new_subset_remaining(tvb, offset); |
16655 | 10 | call_data_dissector(excess, pinfo, proto_tree_get_root(tree)); |
16656 | 10 | } |
16657 | 10 | return offset; |
16658 | 10 | } /*dissect_zbee_zcl_touchlink*/ |
16659 | | |
16660 | | static void |
16661 | | zbee_zcl_touchlink_init(void) |
16662 | 16 | { |
16663 | | /* Empty the commissioning map, as a new dissection pass is |
16664 | | going to be done, so all of the entries in that map, |
16665 | | which were allocated with file scope, have been freed. */ |
16666 | 16 | if (zcl_touchlink_commissioning_map != NULL) { |
16667 | 16 | g_hash_table_remove_all(zcl_touchlink_commissioning_map); |
16668 | 16 | } |
16669 | 16 | } |
16670 | | |
16671 | | /** |
16672 | | *ZigBee ZCL Touchlink Commissioning cluster protocol registration routine. |
16673 | | * |
16674 | | */ |
16675 | | void |
16676 | | proto_register_zbee_zcl_touchlink(void) |
16677 | 16 | { |
16678 | | /* Setup list of header fields */ |
16679 | 16 | static hf_register_info hf[] = { |
16680 | 16 | { &hf_zbee_zcl_touchlink_rx_cmd_id, |
16681 | 16 | { "Command", "zbee_zcl_general.touchlink.rx_cmd_id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_touchlink_rx_cmd_names), |
16682 | 16 | 0x00, NULL, HFILL } }, |
16683 | 16 | { &hf_zbee_zcl_touchlink_tx_cmd_id, |
16684 | 16 | { "Command", "zbee_zcl_general.touchlink.tx_cmd_id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_touchlink_tx_cmd_names), |
16685 | 16 | 0x00, NULL, HFILL } }, |
16686 | 16 | { &hf_zbee_zcl_touchlink_transaction_id, |
16687 | 16 | { "Transaction ID", "zbee_zcl_general.touchlink.transaction_id", FT_UINT32, BASE_HEX, NULL, |
16688 | 16 | 0x00, NULL, HFILL } }, |
16689 | | |
16690 | | /* ZigBee Information Bitmask */ |
16691 | 16 | { &hf_zbee_zcl_touchlink_zbee, |
16692 | 16 | { "ZigBee Information", "zbee_zcl_general.touchlink.zbee", FT_UINT8, BASE_HEX, NULL, |
16693 | 16 | 0x0, NULL, HFILL }}, |
16694 | | |
16695 | 16 | { &hf_zbee_zcl_touchlink_zbee_type, |
16696 | 16 | { "Logical type", "zbee_zcl_general.touchlink.zbee.type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_touchlink_zbee_type_names), |
16697 | 16 | ZBEE_ZCL_TOUCHLINK_ZBEE_INFO_TYPE, NULL, HFILL } }, |
16698 | | |
16699 | 16 | { &hf_zbee_zcl_touchlink_zbee_rxidle, |
16700 | 16 | { "Rx on when idle", "zbee_zcl_general.touchlink.zbee.rxidle", FT_BOOLEAN, 8, TFS(&tfs_yes_no), |
16701 | 16 | ZBEE_ZCL_TOUCHLINK_ZBEE_INFO_RXIDLE, NULL, HFILL } }, |
16702 | | |
16703 | | /* Touchlink Information Bitmask */ |
16704 | 16 | { &hf_zbee_zcl_touchlink_info, |
16705 | 16 | { "Touchlink Information", "zbee_zcl_general.touchlink.info", FT_UINT8, BASE_HEX, NULL, |
16706 | 16 | 0x0, NULL, HFILL }}, |
16707 | | |
16708 | 16 | { &hf_zbee_zcl_touchlink_info_factory, |
16709 | 16 | { "Factory new", "zbee_zcl_general.touchlink.info.factory", FT_BOOLEAN, 8, TFS(&tfs_yes_no), |
16710 | 16 | ZBEE_ZCL_TOUCHLINK_INFO_FACTORY, NULL, HFILL } }, |
16711 | | |
16712 | 16 | { &hf_zbee_zcl_touchlink_info_assignment, |
16713 | 16 | { "Address assignment", "zbee_zcl_general.touchlink.info.assignment", FT_BOOLEAN, 8, TFS(&tfs_yes_no), |
16714 | 16 | ZBEE_ZCL_TOUCHLINK_INFO_ASSIGNMENT, NULL, HFILL } }, |
16715 | | |
16716 | 16 | { &hf_zbee_zcl_touchlink_info_initiator, |
16717 | 16 | { "Link initiator", "zbee_zcl_general.touchlink.info.initiator", FT_BOOLEAN, 8, TFS(&tfs_yes_no), |
16718 | 16 | ZBEE_ZCL_TOUCHLINK_INFO_INITIATOR, NULL, HFILL } }, |
16719 | | |
16720 | 16 | { &hf_zbee_zcl_touchlink_info_undefined, |
16721 | 16 | { "Undefined", "zbee_zcl_general.touchlink.info.undefined", FT_BOOLEAN, 8, NULL, |
16722 | 16 | ZBEE_ZCL_TOUCHLINK_INFO_UNDEFINED, NULL, HFILL } }, |
16723 | | |
16724 | 16 | { &hf_zbee_zcl_touchlink_info_profile_introp, |
16725 | 16 | { "Profile Interop", "zbee_zcl_general.touchlink.info.profile.interop", FT_UINT8, BASE_HEX, VALS(zbee_zcl_touchlink_profile_interop_names), |
16726 | 16 | ZBEE_ZCL_TOUCHLINK_INFO_PROFILE_INTEROP, NULL, HFILL } }, |
16727 | | |
16728 | | /* Touchlink Key Information Bitmask */ |
16729 | 16 | { &hf_zbee_zcl_touchlink_key_bitmask, |
16730 | 16 | { "Key Bitmask", "zbee_zcl_general.touchlink.key_bitmask", FT_UINT16, BASE_HEX, NULL, |
16731 | 16 | 0x00, NULL, HFILL } }, |
16732 | | |
16733 | 16 | { &hf_zbee_zcl_touchlink_key_bit_dev, |
16734 | 16 | { "Development Key", "zbee_zcl_general.touchlink.key_bitmask.dev", FT_BOOLEAN, 16, TFS(&tfs_yes_no), |
16735 | 16 | (1<<ZBEE_ZCL_TOUCHLINK_KEYID_DEVELOPMENT), NULL, HFILL } }, |
16736 | | |
16737 | 16 | { &hf_zbee_zcl_touchlink_key_bit_master, |
16738 | 16 | { "Master Key", "zbee_zcl_general.touchlink.key_bitmask.master", FT_BOOLEAN, 16, TFS(&tfs_yes_no), |
16739 | 16 | (1<<ZBEE_ZCL_TOUCHLINK_KEYID_MASTER), NULL, HFILL } }, |
16740 | | |
16741 | 16 | { &hf_zbee_zcl_touchlink_key_bit_cert, |
16742 | 16 | { "Certification Key", "zbee_zcl_general.touchlink.key_bitmask.cert", FT_BOOLEAN, 16, TFS(&tfs_yes_no), |
16743 | 16 | (1<<ZBEE_ZCL_TOUCHLINK_KEYID_CERTIFICATION), NULL, HFILL } }, |
16744 | | |
16745 | 16 | { &hf_zbee_zcl_touchlink_start_index, |
16746 | 16 | { "Start index", "zbee_zcl_general.touchlink.index", FT_UINT8, BASE_DEC, NULL, |
16747 | 16 | 0x00, NULL, HFILL } }, |
16748 | | |
16749 | 16 | { &hf_zbee_zcl_touchlink_device_record_count, |
16750 | 16 | { "Device Record Count", "zbee_zcl_general.touchlink.device_record_count", FT_UINT8, BASE_DEC, NULL, |
16751 | 16 | 0x00, NULL, HFILL } }, |
16752 | | |
16753 | 16 | { &hf_zbee_zcl_touchlink_sort, |
16754 | 16 | { "Sort", "zbee_zcl_general.touchlink.sort", FT_UINT8, BASE_DEC, NULL, |
16755 | 16 | 0x00, NULL, HFILL } }, |
16756 | | |
16757 | 16 | { &hf_zbee_zcl_touchlink_ident_duration, |
16758 | 16 | { "Identify duration", "zbee_zcl_general.touchlink.duration", FT_UINT16, BASE_DEC, NULL, |
16759 | 16 | 0x00, NULL, HFILL } }, |
16760 | | |
16761 | 16 | { &hf_zbee_zcl_touchlink_rssi_correction, |
16762 | 16 | { "RSSI Correction", "zbee_zcl_general.touchlink.rssi_correction", FT_UINT8, BASE_DEC, NULL, |
16763 | 16 | 0x00, NULL, HFILL } }, |
16764 | | |
16765 | 16 | { &hf_zbee_zcl_touchlink_response_id, |
16766 | 16 | { "Response ID", "zbee_zcl_general.touchlink.response_id", FT_UINT32, BASE_HEX, NULL, |
16767 | 16 | 0x00, NULL, HFILL } }, |
16768 | | |
16769 | 16 | { &hf_zbee_zcl_touchlink_ext_panid, |
16770 | 16 | { "Extended PAN ID", "zbee_zcl_general.touchlink.ext_panid", FT_EUI64, BASE_NONE, NULL, |
16771 | 16 | 0x0, NULL, HFILL } }, |
16772 | | |
16773 | 16 | { &hf_zbee_zcl_touchlink_nwk_update_id, |
16774 | 16 | { "Network Update ID", "zbee_zcl_general.touchlink.nwk_update_id", FT_UINT8, BASE_DEC, NULL, |
16775 | 16 | 0x00, NULL, HFILL } }, |
16776 | | |
16777 | 16 | { &hf_zbee_zcl_touchlink_channel, |
16778 | 16 | { "Logical Channel", "zbee_zcl_general.touchlink.channel", FT_UINT8, BASE_DEC, NULL, |
16779 | 16 | 0x00, NULL, HFILL } }, |
16780 | | |
16781 | 16 | { &hf_zbee_zcl_touchlink_nwk_addr, |
16782 | 16 | { "Network Address", "zbee_zcl_general.touchlink.nwk_addr", FT_UINT16, BASE_HEX, NULL, |
16783 | 16 | 0x00, NULL, HFILL } }, |
16784 | | |
16785 | 16 | { &hf_zbee_zcl_touchlink_ext_addr, |
16786 | 16 | { "Extended Address", "zbee_zcl_general.touchlink.ext_addr", FT_EUI64, BASE_NONE, NULL, |
16787 | 16 | 0x00, NULL, HFILL } }, |
16788 | | |
16789 | 16 | { &hf_zbee_zcl_touchlink_panid, |
16790 | 16 | { "PAN ID", "zbee_zcl_general.touchlink.panid", FT_UINT16, BASE_HEX, NULL, |
16791 | 16 | 0x00, NULL, HFILL } }, |
16792 | | |
16793 | 16 | { &hf_zbee_zcl_touchlink_sub_devices, |
16794 | 16 | { "Sub-devices", "zbee_zcl_general.touchlink.sub_devices", FT_UINT8, BASE_DEC, NULL, |
16795 | 16 | 0x00, NULL, HFILL } }, |
16796 | | |
16797 | 16 | { &hf_zbee_zcl_touchlink_total_groups, |
16798 | 16 | { "Total Group Identifiers", "zbee_zcl_general.touchlink.total_groups", FT_UINT8, BASE_DEC, NULL, |
16799 | 16 | 0x00, NULL, HFILL } }, |
16800 | | |
16801 | 16 | { &hf_zbee_zcl_touchlink_total_endpoints, |
16802 | 16 | { "Total Endpoints", "zbee_zcl_general.touchlink.total_endpoints", FT_UINT8, BASE_DEC, NULL, |
16803 | 16 | 0x00, NULL, HFILL } }, |
16804 | | |
16805 | 16 | { &hf_zbee_zcl_touchlink_endpoint, |
16806 | 16 | { "Endpoint", "zbee_zcl_general.touchlink.endpoint", FT_UINT8, BASE_DEC, NULL, |
16807 | 16 | 0x00, NULL, HFILL } }, |
16808 | | |
16809 | 16 | { &hf_zbee_zcl_touchlink_profile_id, |
16810 | 16 | { "Profile ID", "zbee_zcl_general.touchlink.profile_id", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_aps_apid_names), |
16811 | 16 | 0x00, NULL, HFILL } }, |
16812 | | |
16813 | 16 | { &hf_zbee_zcl_touchlink_device_id, |
16814 | 16 | { "Device ID", "zbee_zcl_general.touchlink.device_id", FT_UINT16, BASE_HEX, NULL, |
16815 | 16 | 0x00, NULL, HFILL } }, |
16816 | | |
16817 | 16 | { &hf_zbee_zcl_touchlink_version, |
16818 | 16 | { "Version", "zbee_zcl_general.touchlink.version", FT_UINT8, BASE_HEX, NULL, |
16819 | 16 | 0x00, NULL, HFILL } }, |
16820 | | |
16821 | 16 | { &hf_zbee_zcl_touchlink_group_count, |
16822 | 16 | { "Group ID Count", "zbee_zcl_general.touchlink.group_count", FT_UINT8, BASE_DEC, NULL, |
16823 | 16 | 0x00, NULL, HFILL } }, |
16824 | | |
16825 | 16 | { &hf_zbee_zcl_touchlink_group_begin, |
16826 | 16 | { "Group ID Begin", "zbee_zcl_general.touchlink.group_begin", FT_UINT16, BASE_HEX, NULL, |
16827 | 16 | 0x00, NULL, HFILL } }, |
16828 | | |
16829 | 16 | { &hf_zbee_zcl_touchlink_group_end, |
16830 | 16 | { "Group ID End", "zbee_zcl_general.touchlink.group_end", FT_UINT16, BASE_HEX, NULL, |
16831 | 16 | 0x00, NULL, HFILL } }, |
16832 | | |
16833 | 16 | { &hf_zbee_zcl_touchlink_group_type, |
16834 | 16 | { "Group Type", "zbee_zcl_general.touchlink.group_type", FT_UINT8, BASE_HEX, NULL, |
16835 | 16 | 0x00, NULL, HFILL } }, |
16836 | | |
16837 | 16 | { &hf_zbee_zcl_touchlink_group_id, |
16838 | 16 | { "Group ID", "zbee_zcl_general.touchlink.group_id", FT_UINT16, BASE_HEX, NULL, |
16839 | 16 | 0x00, NULL, HFILL } }, |
16840 | | |
16841 | 16 | { &hf_zbee_zcl_touchlink_addr_range_begin, |
16842 | 16 | { "Free Address Range Begin", "zbee_zcl_general.touchlink.addr_range_begin", FT_UINT16, BASE_HEX, NULL, |
16843 | 16 | 0x00, NULL, HFILL } }, |
16844 | | |
16845 | 16 | { &hf_zbee_zcl_touchlink_addr_range_end, |
16846 | 16 | { "Free Address Range End", "zbee_zcl_general.touchlink.addr_range_end", FT_UINT16, BASE_HEX, NULL, |
16847 | 16 | 0x00, NULL, HFILL } }, |
16848 | | |
16849 | 16 | { &hf_zbee_zcl_touchlink_group_range_begin, |
16850 | 16 | { "Free Group ID Range Begin", "zbee_zcl_general.touchlink.group_range_begin", FT_UINT16, BASE_HEX, NULL, |
16851 | 16 | 0x00, NULL, HFILL } }, |
16852 | | |
16853 | 16 | { &hf_zbee_zcl_touchlink_group_range_end, |
16854 | 16 | { "Free Group ID Range End", "zbee_zcl_general.touchlink.group_range_end", FT_UINT16, BASE_HEX, NULL, |
16855 | 16 | 0x00, NULL, HFILL } }, |
16856 | | |
16857 | 16 | { &hf_zbee_zcl_touchlink_key_index, |
16858 | 16 | { "Key Index", "zbee_zcl_general.touchlink.key_index", FT_UINT8, BASE_DEC, VALS(zbee_zcl_touchlink_keyid_names), |
16859 | 16 | 0x00, NULL, HFILL } }, |
16860 | | |
16861 | 16 | { &hf_zbee_zcl_touchlink_key, |
16862 | 16 | { "Encrypted Network Key", "zbee_zcl_general.touchlink.key", FT_BYTES, BASE_NONE, NULL, |
16863 | 16 | 0x0, NULL, HFILL } }, |
16864 | | |
16865 | 16 | { &hf_zbee_zcl_touchlink_network_key, |
16866 | 16 | { "Decrypted Network Key", "zbee_zcl_general.touchlink.network_key", FT_BYTES, BASE_NONE, NULL, |
16867 | 16 | 0x0, NULL, HFILL } }, |
16868 | | |
16869 | 16 | { &hf_zbee_zcl_touchlink_init_eui64, |
16870 | 16 | { "Initiator Extended Address", "zbee_zcl_general.touchlink.init_eui", FT_EUI64, BASE_NONE, NULL, |
16871 | 16 | 0x00, NULL, HFILL } }, |
16872 | | |
16873 | 16 | { &hf_zbee_zcl_touchlink_init_addr, |
16874 | 16 | { "Initiator Network Address", "zbee_zcl_general.touchlink.init_addr", FT_UINT16, BASE_HEX, NULL, |
16875 | 16 | 0x00, NULL, HFILL } }, |
16876 | | |
16877 | 16 | { &hf_zbee_zcl_touchlink_status, |
16878 | 16 | { "Status", "zbee_zcl_general.touchlink.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_touchlink_status_names), |
16879 | 16 | 0x00, NULL, HFILL } }, |
16880 | 16 | }; |
16881 | | |
16882 | | /* ZCL Touchlink subtrees */ |
16883 | 16 | static int *ett[] = { |
16884 | 16 | &ett_zbee_zcl_touchlink, |
16885 | 16 | &ett_zbee_zcl_touchlink_zbee, |
16886 | 16 | &ett_zbee_zcl_touchlink_info, |
16887 | 16 | &ett_zbee_zcl_touchlink_keybits, |
16888 | 16 | &ett_zbee_zcl_touchlink_groups, |
16889 | 16 | &ett_zbee_zcl_touchlink_device_record, |
16890 | 16 | &ett_zbee_zcl_touchlink_device_records, |
16891 | 16 | &ett_zbee_zcl_touchlink_endpoint, |
16892 | 16 | &ett_zbee_zcl_touchlink_endpoints, |
16893 | 16 | }; |
16894 | | |
16895 | 16 | static ei_register_info ei[] = { |
16896 | 16 | { &ei_zbee_zcl_touchlink_no_key, { "zbee_zcl_general.touchlink.no_key.expert", PI_DECRYPTION, PI_WARN, "Cannot decrypt transport key", EXPFILL }}, |
16897 | 16 | }; |
16898 | | |
16899 | 16 | expert_module_t *expert_zbee_zcl; |
16900 | | |
16901 | | /* Register the ZigBee ZCL Touchlink cluster protocol name and description */ |
16902 | 16 | proto_zbee_zcl_touchlink = proto_register_protocol("ZigBee ZCL Touchlink", "ZCL Touchlink", ZBEE_PROTOABBREV_ZCL_TOUCHLINK); |
16903 | 16 | proto_register_field_array(proto_zbee_zcl_touchlink, hf, array_length(hf)); |
16904 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
16905 | 16 | expert_zbee_zcl = expert_register_protocol(proto_zbee_zcl_touchlink); |
16906 | 16 | expert_register_field_array(expert_zbee_zcl, ei, array_length(ei)); |
16907 | | |
16908 | 16 | zcl_touchlink_commissioning_map = g_hash_table_new(zcl_touchlink_comissioning_hash, zcl_touchlink_comissioning_equal); |
16909 | | |
16910 | | /* Register the ZigBee ZCL Touchlink Commissioning dissector. */ |
16911 | 16 | register_dissector(ZBEE_PROTOABBREV_ZCL_TOUCHLINK, dissect_zbee_zcl_touchlink, proto_zbee_zcl_touchlink); |
16912 | | |
16913 | 16 | register_init_routine(zbee_zcl_touchlink_init); |
16914 | 16 | } /*proto_register_zbee_zcl_touchlink*/ |
16915 | | |
16916 | | /** |
16917 | | *Hands off the ZCL Touchlink Commissioning dissector. |
16918 | | * |
16919 | | */ |
16920 | | void |
16921 | | proto_reg_handoff_zbee_zcl_touchlink(void) |
16922 | 16 | { |
16923 | 16 | zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_TOUCHLINK, |
16924 | 16 | proto_zbee_zcl_touchlink, |
16925 | 16 | ett_zbee_zcl_touchlink, |
16926 | 16 | ZBEE_ZCL_CID_ZLL, |
16927 | 16 | ZBEE_MFG_CODE_NONE, |
16928 | 16 | -1, -1, |
16929 | 16 | hf_zbee_zcl_touchlink_rx_cmd_id, hf_zbee_zcl_touchlink_tx_cmd_id, |
16930 | | NULL |
16931 | 16 | ); |
16932 | 16 | } /*proto_reg_handoff_zbee_zcl_touchlink*/ |
16933 | | |
16934 | | /* |
16935 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
16936 | | * |
16937 | | * Local variables: |
16938 | | * c-basic-offset: 4 |
16939 | | * tab-width: 8 |
16940 | | * indent-tabs-mode: nil |
16941 | | * End: |
16942 | | * |
16943 | | * vi: set shiftwidth=4 tabstop=8 expandtab: |
16944 | | * :indentSize=4:tabSize=8:noTabs=true: |
16945 | | */ |