Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-zbee-zcl-sas.c
blob51d5636caa9162b5a1aa49bb7f2fa999f3fb0663
1 /* packet-zbee-zcl-sas.c
2 * Dissector routines for the ZigBee ZCL Security and Safety Interfaces clusters
3 * By Aditya Jain <aditya.jain@samsung.com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
11 * https://zigbeealliance.org/wp-content/uploads/2021/10/07-5123-08-Zigbee-Cluster-Library.pdf
14 /* Include Files */
15 #include "config.h"
17 #include <epan/packet.h>
18 #include <epan/to_str.h>
20 #include "packet-zbee.h"
21 #include "packet-zbee-aps.h"
22 #include "packet-zbee-zcl.h"
25 /* ########################################################################## */
26 /* #### (0x0501) IAS ACE CLUSTER ############################################ */
27 /* ########################################################################## */
29 /*************************/
30 /* Defines */
31 /*************************/
32 #define ZBEE_ZCL_IAS_ACE_NUM_ETT 7
34 /* Attributes - none */
36 /* Server Commands Received */
37 #define ZBEE_ZCL_CMD_ID_IAS_ACE_ARM 0x00 /* Arm */
38 #define ZBEE_ZCL_CMD_ID_IAS_ACE_BYPASS 0x01 /* Bypass */
39 #define ZBEE_ZCL_CMD_ID_IAS_ACE_EMERGENCY 0x02 /* Emergency */
40 #define ZBEE_ZCL_CMD_ID_IAS_ACE_FIRE 0x03 /* Fire */
41 #define ZBEE_ZCL_CMD_ID_IAS_ACE_PANIC 0x04 /* Panic */
42 #define ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_ID_MAP 0x05 /* Get Zone ID Map */
43 #define ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_INFO 0x06 /* Get Zone Information */
44 #define ZBEE_ZCL_CMD_ID_IAS_ACE_GET_PANEL_STATUS 0x07 /* Get Panel Status */
45 #define ZBEE_ZCL_CMD_ID_IAS_ACE_GET_BYPASSED_ZONE_LIST 0x08 /* Get Bypassed Zone List */
46 #define ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_STATUS 0x09 /* Get Zone Status */
48 /* Server Commands Generated */
49 #define ZBEE_ZCL_CMD_ID_IAS_ACE_ARM_RES 0x00 /* Arm Response */
50 #define ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_ID_MAP_RES 0x01 /* Get Zone ID Map Response */
51 #define ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_INFO_RES 0x02 /* Get Zone Information Response */
52 #define ZBEE_ZCL_CMD_ID_IAS_ACE_ZONE_STATUS_CHANGED 0x03 /* Zone Status Changed */
53 #define ZBEE_ZCL_CMD_ID_IAS_ACE_PANEL_STATUS_CHANGED 0x04 /* Panel Status Changed */
54 #define ZBEE_ZCL_CMD_ID_IAS_ACE_GET_PANEL_STATUS_RES 0x05 /* Get Panel Status Response */
55 #define ZBEE_ZCL_CMD_ID_IAS_ACE_SET_BYPASSED_ZONE_LIST 0x06 /* Set Bypassed Zone List */
56 #define ZBEE_ZCL_CMD_ID_IAS_ACE_BYPASS_RES 0x07 /* Bypass Response */
57 #define ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_STATUS_RES 0x08 /* Get Zone Status Response */
60 /*************************/
61 /* Function Declarations */
62 /*************************/
64 void proto_register_zbee_zcl_ias_ace(void);
65 void proto_reg_handoff_zbee_zcl_ias_ace(void);
67 /* Command Dissector Helpers */
68 static void dissect_zcl_ias_ace_arm (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
69 static void dissect_zcl_ias_ace_bypass (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
70 static void dissect_zcl_ias_ace_get_zone_info (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
71 static void dissect_zcl_ias_ace_get_zone_status (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
72 static void dissect_zcl_ias_ace_arm_res (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
73 static void dissect_zcl_ias_ace_get_zone_id_map_res (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
74 static void dissect_zcl_ias_ace_get_zone_info_res (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
75 static void dissect_zcl_ias_ace_zone_status_changed (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
76 static void dissect_zcl_ias_ace_panel_status_changed (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
77 static void dissect_zcl_ias_ace_get_panel_status_res (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
78 static void dissect_zcl_ias_ace_set_bypassed_zone_list (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
79 static void dissect_zcl_ias_ace_bypassed_res (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
80 static void dissect_zcl_ias_ace_get_zone_status_res (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
82 /* Private functions prototype */
84 /*************************/
85 /* Global Variables */
86 /*************************/
87 /* Initialize the protocol and registered fields */
88 static int proto_zbee_zcl_ias_ace;
90 static int hf_zbee_zcl_ias_ace_arm_mode;
91 static int hf_zbee_zcl_ias_ace_no_of_zones;
92 static int hf_zbee_zcl_ias_ace_zone_id;
93 static int hf_zbee_zcl_ias_ace_zone_id_list;
94 static int hf_zbee_zcl_ias_ace_arm_notif;
95 static int hf_zbee_zcl_ias_ace_zone_id_map_section;
96 static int hf_zbee_zcl_ias_ace_zone_type;
97 static int hf_zbee_zcl_ias_ace_ieee_add;
98 static int hf_zbee_zcl_ias_ace_srv_rx_cmd_id;
99 static int hf_zbee_zcl_ias_ace_srv_tx_cmd_id;
100 static int hf_zbee_zcl_ias_ace_starting_zone_id;
101 static int hf_zbee_zcl_ias_ace_max_number_of_zone_ids;
102 static int hf_zbee_zcl_ias_ace_zone_status_mask_flag;
103 static int hf_zbee_zcl_ias_ace_zone_status_mask;
104 static int hf_zbee_zcl_ias_ace_zone_status;
105 static int hf_zbee_zcl_ias_ace_zone_audible_notif;
106 static int hf_zbee_zcl_ias_ace_zone_label;
107 static int hf_zbee_zcl_ias_ace_panel_status;
108 static int hf_zbee_zcl_ias_ace_seconds_remaining;
109 static int hf_zbee_zcl_ias_ace_alarm_status;
110 static int hf_zbee_zcl_ias_ace_number_of_zones;
111 static int hf_zbee_zcl_ias_ace_zone_status_complete;
113 /* Initialize the subtree pointers */
114 static int ett_zbee_zcl_ias_ace;
115 static int ett_zbee_zcl_ias_ace_zone_id;
116 static int ett_zbee_zcl_ias_ace_zone_id_map_sec;
117 static int ett_zbee_zcl_ias_ace_zone_id_map_sec_elem;
118 static int ett_zbee_zcl_ias_ace_bypassed_zone_list;
119 static int ett_zbee_zcl_ias_ace_bypassed_resp_list;
120 static int ett_zbee_zcl_ias_ace_get_zone_status_resp_list;
122 /* Server Commands Received */
123 static const value_string zbee_zcl_ias_ace_srv_rx_cmd_names[] = {
124 { ZBEE_ZCL_CMD_ID_IAS_ACE_ARM, "Arm" },
125 { ZBEE_ZCL_CMD_ID_IAS_ACE_BYPASS, "Bypass" },
126 { ZBEE_ZCL_CMD_ID_IAS_ACE_EMERGENCY, "Emergency" },
127 { ZBEE_ZCL_CMD_ID_IAS_ACE_FIRE, "Fire" },
128 { ZBEE_ZCL_CMD_ID_IAS_ACE_PANIC, "Panic" },
129 { ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_ID_MAP, "Get Zone ID Map" },
130 { ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_INFO, "Get Zone Information" },
131 { ZBEE_ZCL_CMD_ID_IAS_ACE_GET_PANEL_STATUS, "Get Panel Status" },
132 { ZBEE_ZCL_CMD_ID_IAS_ACE_GET_BYPASSED_ZONE_LIST, "Get Bypassed Zone List" },
133 { ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_STATUS, "Get Zone Status" },
134 { 0, NULL }
137 /* Server Commands Generated */
138 static const value_string zbee_zcl_ias_ace_srv_tx_cmd_names[] = {
139 { ZBEE_ZCL_CMD_ID_IAS_ACE_ARM_RES, "Arm Response" },
140 { ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_ID_MAP_RES, "Get Zone ID Map Response" },
141 { ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_INFO_RES, "Get Zone Information Response" },
142 { ZBEE_ZCL_CMD_ID_IAS_ACE_ZONE_STATUS_CHANGED, "Zone Status Changed" },
143 { ZBEE_ZCL_CMD_ID_IAS_ACE_PANEL_STATUS_CHANGED, "Panel Status Changed" },
144 { ZBEE_ZCL_CMD_ID_IAS_ACE_GET_PANEL_STATUS_RES, "Get Panel Status Response" },
145 { ZBEE_ZCL_CMD_ID_IAS_ACE_SET_BYPASSED_ZONE_LIST, "Set Bypassed Zone List" },
146 { ZBEE_ZCL_CMD_ID_IAS_ACE_BYPASS_RES, "Bypass Response" },
147 { ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_STATUS_RES, "Get Zone Status Response" },
148 { 0, NULL }
151 /* Arm Mode Values */
152 static const value_string arm_mode_values[] = {
153 { 0x00, "Disarm" },
154 { 0x01, "Arm Day/Home Zones Only" },
155 { 0x02, "Arm Night/Sleep Zones Only" },
156 { 0x03, "Arm All Zones" },
157 { 0, NULL }
160 /* Arm Notification Values */
161 static const value_string arm_notif_values[] = {
162 { 0x00, "All Zones Disarmed" },
163 { 0x01, "Only Day/Home Zones Armed" },
164 { 0x02, "Only Night/Sleep Zones Armed" },
165 { 0x03, "All Zones Armed" },
166 { 0, NULL }
169 /* Audible Notification Values */
170 static const value_string audible_notif_values[] = {
171 { 0x00, "Mute" },
172 { 0x01, "Default sound" },
173 { 0, NULL }
176 /* Panel Status Values */
177 static const value_string panel_status_values[] = {
178 { 0x00, "Panel disarmed" },
179 { 0x01, "Armed stay" },
180 { 0x02, "Armed night" },
181 { 0x03, "Armed away" },
182 { 0x04, "Exit delay" },
183 { 0x05, "Entry delay" },
184 { 0x06, "Not ready to arm" },
185 { 0x07, "In alarm" },
186 { 0x08, "Arming Stay" },
187 { 0x09, "Arming Night" },
188 { 0x0a, "Arming Away" },
189 { 0, NULL }
192 /* Panel Status Values */
193 static const value_string alarm_status_values[] = {
194 { 0x00, "No alarm" },
195 { 0x01, "Burglar" },
196 { 0x02, "Fire" },
197 { 0x03, "Emergency" },
198 { 0x04, "Police Panic" },
199 { 0x05, "Fire Panic" },
200 { 0x06, "Emergency Panic" },
201 { 0, NULL }
204 /*************************/
205 /* Function Bodies */
206 /*************************/
209 *ZigBee ZCL IAS ACE cluster dissector for wireshark.
211 *@param tvb pointer to buffer containing raw packet.
212 *@param pinfo pointer to packet information fields
213 *@param tree pointer to data tree Wireshark uses to display packet.
215 static int
216 dissect_zbee_zcl_ias_ace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
218 proto_tree *payload_tree;
219 zbee_zcl_packet *zcl;
220 unsigned offset = 0;
221 uint8_t cmd_id;
222 int rem_len;
224 /* Reject the packet if data is NULL */
225 if (data == NULL)
226 return 0;
227 zcl = (zbee_zcl_packet *)data;
228 cmd_id = zcl->cmd_id;
230 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
231 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
232 /* Append the command name to the info column. */
233 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
234 val_to_str_const(cmd_id, zbee_zcl_ias_ace_srv_rx_cmd_names, "Unknown Command"),
235 zcl->tran_seqno);
237 /* Add the command ID. */
238 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
240 /* Check if this command has a payload, then add the payload tree */
241 rem_len = tvb_reported_length_remaining(tvb, ++offset);
242 if (rem_len > 0) {
243 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_ias_ace, NULL, "Payload");
245 /* Call the appropriate command dissector */
246 switch (cmd_id) {
247 case ZBEE_ZCL_CMD_ID_IAS_ACE_ARM:
248 dissect_zcl_ias_ace_arm(tvb, payload_tree, &offset);
249 break;
250 case ZBEE_ZCL_CMD_ID_IAS_ACE_BYPASS:
251 dissect_zcl_ias_ace_bypass(tvb, payload_tree, &offset);
252 break;
253 case ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_INFO:
254 dissect_zcl_ias_ace_get_zone_info(tvb, payload_tree, &offset);
255 break;
256 case ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_STATUS:
257 dissect_zcl_ias_ace_get_zone_status(tvb, payload_tree, &offset);
258 break;
259 case ZBEE_ZCL_CMD_ID_IAS_ACE_EMERGENCY:
260 case ZBEE_ZCL_CMD_ID_IAS_ACE_FIRE:
261 case ZBEE_ZCL_CMD_ID_IAS_ACE_PANIC:
262 case ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_ID_MAP:
263 case ZBEE_ZCL_CMD_ID_IAS_ACE_GET_BYPASSED_ZONE_LIST:
264 case ZBEE_ZCL_CMD_ID_IAS_ACE_GET_PANEL_STATUS:
265 /* No Payload */
266 default:
267 break;
271 else { /* ZBEE_ZCL_FCF_TO_CLIENT */
272 /* Append the command name to the info column. */
273 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
274 val_to_str_const(cmd_id, zbee_zcl_ias_ace_srv_tx_cmd_names, "Unknown Command"),
275 zcl->tran_seqno);
277 /* Add the command ID. */
278 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_srv_tx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
280 /* Check if this command has a payload, then add the payload tree */
281 rem_len = tvb_reported_length_remaining(tvb, ++offset);
282 if (rem_len > 0) {
283 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_ias_ace, NULL, "Payload");
285 /* Call the appropriate command dissector */
286 switch (cmd_id) {
287 case ZBEE_ZCL_CMD_ID_IAS_ACE_ARM_RES:
288 dissect_zcl_ias_ace_arm_res(tvb, payload_tree, &offset);
289 break;
291 case ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_ID_MAP_RES:
292 dissect_zcl_ias_ace_get_zone_id_map_res(tvb, payload_tree, &offset);
293 break;
295 case ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_INFO_RES:
296 dissect_zcl_ias_ace_get_zone_info_res(tvb, payload_tree, &offset);
297 break;
299 case ZBEE_ZCL_CMD_ID_IAS_ACE_ZONE_STATUS_CHANGED:
300 dissect_zcl_ias_ace_zone_status_changed(tvb, payload_tree, &offset);
301 break;
303 case ZBEE_ZCL_CMD_ID_IAS_ACE_PANEL_STATUS_CHANGED:
304 dissect_zcl_ias_ace_panel_status_changed(tvb, payload_tree, &offset);
305 break;
307 case ZBEE_ZCL_CMD_ID_IAS_ACE_GET_PANEL_STATUS_RES:
308 dissect_zcl_ias_ace_get_panel_status_res(tvb, payload_tree, &offset);
309 break;
311 case ZBEE_ZCL_CMD_ID_IAS_ACE_SET_BYPASSED_ZONE_LIST:
312 dissect_zcl_ias_ace_set_bypassed_zone_list(tvb, payload_tree, &offset);
313 break;
315 case ZBEE_ZCL_CMD_ID_IAS_ACE_BYPASS_RES:
316 dissect_zcl_ias_ace_bypassed_res(tvb, payload_tree, &offset);
317 break;
319 case ZBEE_ZCL_CMD_ID_IAS_ACE_GET_ZONE_STATUS_RES:
320 dissect_zcl_ias_ace_get_zone_status_res(tvb, payload_tree, &offset);
321 break;
323 default:
324 break;
329 return tvb_captured_length(tvb);
330 } /*dissect_zbee_zcl_ias_ace*/
334 *This function decodes the Arm payload.
336 *@param tvb the tv buffer of the current data_type
337 *@param tree the tree to append this item to
338 *@param offset offset of data in tvb
340 static void
341 dissect_zcl_ias_ace_arm(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
343 /* Retrieve "Arm Mode" field */
344 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_arm_mode, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
345 *offset += 1;
347 } /*dissect_zcl_ias_ace_arm*/
351 *This function decodes the Bypass payload.
353 *@param tvb the tv buffer of the current data_type
354 *@param tree the tree to append this item to
355 *@param offset offset of data in tvb
357 static void
358 dissect_zcl_ias_ace_bypass(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
360 proto_item *zone_id_list = NULL;
361 proto_tree *sub_tree = NULL;
362 uint8_t num, i;
364 /* Retrieve "Number of Zones" field */
365 num = tvb_get_uint8(tvb, *offset);
366 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_no_of_zones, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
367 *offset += 1;
369 /* Retrieve "Zone ID" fields */
370 zone_id_list = proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_zone_id_list, tvb, *offset, num, ENC_NA);
371 sub_tree = proto_item_add_subtree(zone_id_list, ett_zbee_zcl_ias_ace_zone_id);
373 for(i = 0; i < num; i++){
374 proto_tree_add_item(sub_tree, hf_zbee_zcl_ias_ace_zone_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
375 *offset += 1;
377 } /*dissect_zcl_ias_ace_bypass*/
381 *This function decodes the Get Zone Information payload.
383 *@param tvb the tv buffer of the current data_type
384 *@param tree the tree to append this item to
385 *@param offset offset of data in tvb
387 static void
388 dissect_zcl_ias_ace_get_zone_info(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
390 /* Retrieve "Zone ID" field */
391 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_zone_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
392 *offset += 1;
394 } /*dissect_zcl_ias_ace_get_zone_info*/
398 *This function decodes the Get Zone Status payload.
400 *@param tvb the tv buffer of the current data_type
401 *@param tree the tree to append this item to
402 *@param offset offset of data in tvb
404 static void
405 dissect_zcl_ias_ace_get_zone_status(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
407 /* Retrieve "Starting Zone ID" field */
408 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_starting_zone_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
409 *offset += 1;
411 /* Retrieve "Max Number of Zone IDs" field */
412 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_max_number_of_zone_ids, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
413 *offset += 1;
415 /* Retrieve "Zone Status Mask Flag" field */
416 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_zone_status_mask_flag, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
417 *offset += 1;
419 /* Retrieve "Zone Status Mask" field */
420 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_zone_status_mask, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
421 *offset += 2;
423 } /*dissect_zcl_ias_ace_get_zone_status*/
427 *This function decodes the Zone Status Changed payload.
429 *@param tvb the tv buffer of the current data_type
430 *@param tree the tree to append this item to
431 *@param offset offset of data in tvb
433 static void
434 dissect_zcl_ias_ace_zone_status_changed(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
436 int length;
438 /* Retrieve "Zone ID" field */
439 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_zone_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
440 *offset += 1;
442 /* Retrieve "Zone Status" field */
443 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_zone_status, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
444 *offset += 2;
446 /* Retrieve "Audible Notification" field */
447 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_zone_audible_notif, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
448 *offset += 1;
450 /* Rate Label */
451 proto_tree_add_item_ret_length(tree, hf_zbee_zcl_ias_ace_zone_label, tvb, *offset, 1, ENC_NA | ENC_ZIGBEE, &length);
452 *offset += length;
454 } /*dissect_zcl_ias_ace_zone_status_changed*/
458 *This function decodes the Panel Status Changed payload.
460 *@param tvb the tv buffer of the current data_type
461 *@param tree the tree to append this item to
462 *@param offset offset of data in tvb
464 static void
465 dissect_zcl_ias_ace_panel_status_changed(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
467 /* Retrieve "Panel Status" field */
468 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_panel_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
469 *offset += 1;
471 /* Retrieve "Seconds Remaining" field */
472 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_seconds_remaining, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
473 *offset += 1;
475 /* Retrieve "Audible Notification" field */
476 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_zone_audible_notif, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
477 *offset += 1;
479 /* Retrieve "Alarm Status" field */
480 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_alarm_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
481 *offset += 1;
483 } /*dissect_zcl_ias_ace_panel_status_changed*/
487 *This function decodes the Get Panel Status Response payload.
489 *@param tvb the tv buffer of the current data_type
490 *@param tree the tree to append this item to
491 *@param offset offset of data in tvb
493 static void
494 dissect_zcl_ias_ace_get_panel_status_res(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
496 /* Retrieve "Panel Status" field */
497 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_panel_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
498 *offset += 1;
500 /* Retrieve "Seconds Remaining" field */
501 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_seconds_remaining, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
502 *offset += 1;
504 /* Retrieve "Audible Notification" field */
505 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_zone_audible_notif, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
506 *offset += 1;
508 /* Retrieve "Alarm Status" field */
509 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_alarm_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
510 *offset += 1;
512 } /*dissect_zcl_ias_ace_get_panel_status_res*/
516 *This function decodes the Set Bypassed Zone List payload.
518 *@param tvb the tv buffer of the current data_type
519 *@param tree the tree to append this item to
520 *@param offset offset of data in tvb
522 static void
523 dissect_zcl_ias_ace_set_bypassed_zone_list(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
525 size_t length = tvb_get_uint8(tvb, *offset);
527 /* Retrieve "Number of Zones" field */
528 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_number_of_zones, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
529 *offset += 1;
531 if (length > 0) {
532 proto_tree *subtree;
533 subtree = proto_item_add_subtree(tree, ett_zbee_zcl_ias_ace_bypassed_zone_list);
535 for (size_t i = 0; i < length; i++) {
536 /* Retrieve "Zone ID n" field */
537 proto_tree_add_item(subtree, hf_zbee_zcl_ias_ace_zone_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
538 *offset += 1;
541 } /*dissect_zcl_ias_ace_set_bypassed_zone_list*/
545 *This function decodes the Set Bypassed Zone List payload.
547 *@param tvb the tv buffer of the current data_type
548 *@param tree the tree to append this item to
549 *@param offset offset of data in tvb
551 static void
552 dissect_zcl_ias_ace_bypassed_res(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
554 size_t length = tvb_get_uint8(tvb, *offset);
556 /* Retrieve "Number of Zones" field */
557 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_number_of_zones, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
558 *offset += 1;
560 if (length > 0) {
561 proto_tree *subtree;
562 subtree = proto_item_add_subtree(tree, ett_zbee_zcl_ias_ace_bypassed_resp_list);
564 for (size_t i = 0; i < length; i++) {
565 /* Retrieve "Bypass Result for Zone ID n" field */
566 proto_tree_add_item(subtree, hf_zbee_zcl_ias_ace_zone_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
567 *offset += 1;
570 } /*dissect_zcl_ias_ace_bypassed_res */
575 *This function decodes the Set Bypassed Zone List payload.
577 *@param tvb the tv buffer of the current data_type
578 *@param tree the tree to append this item to
579 *@param offset offset of data in tvb
581 static void
582 dissect_zcl_ias_ace_get_zone_status_res(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
584 size_t length = 0;
586 /* Retrieve "Zone Status Complete" field */
587 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_zone_status_complete, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
588 *offset += 1;
590 length = tvb_get_uint8(tvb, *offset);
592 /* Retrieve "Number of Zones" field */
593 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_number_of_zones, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
594 *offset += 1;
596 if (length > 0) {
597 proto_tree *subtree;
598 subtree = proto_item_add_subtree(tree, ett_zbee_zcl_ias_ace_get_zone_status_resp_list);
600 for (size_t i = 0; i < length; i++) {
601 /* Retrieve "Bypass Result for Zone ID n" field */
602 proto_tree_add_item(subtree, hf_zbee_zcl_ias_ace_zone_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
603 *offset += 1;
606 } /*dissect_zcl_ias_ace_get_zone_status_res */
609 *This function decodes the Arm Response payload.
611 *@param tvb the tv buffer of the current data_type
612 *@param tree the tree to append this item to
613 *@param offset offset of data in tvb
615 static void
616 dissect_zcl_ias_ace_arm_res(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
618 /* Retrieve "Arm Notification" field */
619 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_arm_notif, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
620 *offset += 1;
622 } /*dissect_zcl_ias_ace_arm_res*/
626 *This function decodes the Bypass payload.
628 *@param tvb the tv buffer of the current data_type
629 *@param tree the tree to append this item to
630 *@param offset offset of data in tvb
632 static void
633 dissect_zcl_ias_ace_get_zone_id_map_res(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
635 uint8_t i;
637 /* Retrieve "Zone ID" fields */
638 for(i = 0; i < 16; i++){
639 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_zone_id_map_section, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
640 *offset += 2;
642 } /*dissect_zcl_ias_ace_get_zone_id_map_res*/
646 *This function decodes the Get Zone Information Response payload.
648 *@param tvb the tv buffer of the current data_type
649 *@param tree the tree to append this item to
650 *@param offset offset of data in tvb
652 static void
653 dissect_zcl_ias_ace_get_zone_info_res(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
655 /* Retrieve "Zone ID" field */
656 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_zone_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
657 *offset += 1;
659 /* Retrieve "Zone Type" field */
660 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_zone_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
661 *offset += 2;
663 /* Retrieve "IEEE Address" field */
664 proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_ieee_add, tvb, *offset, 8, ENC_NA);
665 *offset += 8;
667 } /*dissect_zcl_ias_ace_get_zone_info_res*/
671 *ZigBee ZCL IAS ACE cluster protocol registration routine.
674 void
675 proto_register_zbee_zcl_ias_ace(void)
677 /* Setup list of header fields */
678 static hf_register_info hf[] = {
680 { &hf_zbee_zcl_ias_ace_arm_mode,
681 { "Arm Mode", "zbee_zcl_sas.ias_ace.arm_mode", FT_UINT8, BASE_DEC, VALS(arm_mode_values),
682 0x0, NULL, HFILL } },
684 { &hf_zbee_zcl_ias_ace_no_of_zones,
685 { "Number of Zones", "zbee_zcl_sas.ias_ace.no_of_zones", FT_UINT8, BASE_DEC, NULL,
686 0x0, NULL, HFILL } },
688 { &hf_zbee_zcl_ias_ace_zone_id,
689 { "Zone ID", "zbee_zcl_sas.ias_ace.zone_id", FT_UINT8, BASE_HEX, NULL,
690 0x0, NULL, HFILL } },
692 { &hf_zbee_zcl_ias_ace_zone_id_list,
693 { "Zone ID List", "zbee_zcl_sas.ias_ace.zone_id_list", FT_NONE, BASE_NONE, NULL,
694 0x0, NULL, HFILL } },
696 { &hf_zbee_zcl_ias_ace_arm_notif,
697 { "Arm Notifications", "zbee_zcl_sas.ias_ace.arm_notif", FT_UINT8, BASE_DEC, VALS(arm_notif_values),
698 0x0, NULL, HFILL } },
700 { &hf_zbee_zcl_ias_ace_zone_id_map_section,
701 { "Zone ID Map Section", "zbee_zcl_sas.ias_ace.zone_id_map_section", FT_UINT16, BASE_HEX, NULL,
702 0x0, NULL, HFILL } },
704 { &hf_zbee_zcl_ias_ace_zone_type,
705 { "Zone Type", "zbee_zcl_sas.ias_ace.zone_type", FT_UINT16, BASE_HEX, NULL,
706 0x0, NULL, HFILL } },
708 { &hf_zbee_zcl_ias_ace_ieee_add,
709 { "IEEE Address", "zbee_zcl_sas.ias_ace.ieee_add", FT_BYTES, BASE_NONE, NULL,
710 0x0, NULL, HFILL } },
712 { &hf_zbee_zcl_ias_ace_srv_rx_cmd_id,
713 { "Command", "zbee_zcl_sas.ias_ace.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ias_ace_srv_rx_cmd_names),
714 0x0, NULL, HFILL } },
716 { &hf_zbee_zcl_ias_ace_srv_tx_cmd_id,
717 { "Command", "zbee_zcl_sas.ias_ace.cmd.srv_tx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ias_ace_srv_tx_cmd_names),
718 0x0, NULL, HFILL } },
720 { &hf_zbee_zcl_ias_ace_starting_zone_id,
721 { "Starting Zone ID", "zbee_zcl_sas.ias_ace.cmd.starting_zone_id", FT_UINT8, BASE_HEX, NULL,
722 0x0, NULL, HFILL } },
724 { &hf_zbee_zcl_ias_ace_max_number_of_zone_ids,
725 { "Max Number Of Zone IDs", "zbee_zcl_sas.ias_ace.cmd.max_number_of_zone_ids", FT_UINT8, BASE_DEC, NULL,
726 0x0, NULL, HFILL } },
728 { &hf_zbee_zcl_ias_ace_zone_status_mask_flag,
729 { "Zone Status Mask Flag", "zbee_zcl_sas.ias_ace.cmd.zone_status_mask_flag", FT_BOOLEAN, BASE_NONE, NULL,
730 0x0, NULL, HFILL } },
732 { &hf_zbee_zcl_ias_ace_zone_status_mask,
733 { "Zone Status Mask", "zbee_zcl_sas.ias_ace.cmd.zone_status_mask", FT_UINT16, BASE_HEX, NULL,
734 0x0, NULL, HFILL } },
736 { &hf_zbee_zcl_ias_ace_zone_status,
737 { "Zone Status", "zbee_zcl_sas.ias_ace.cmd.zone_status", FT_UINT16, BASE_HEX, NULL,
738 0x0, NULL, HFILL } },
740 { &hf_zbee_zcl_ias_ace_zone_audible_notif,
741 { "Audible Notification", "zbee_zcl_sas.ias_ace.cmd.zone_audible_notif", FT_UINT16, BASE_HEX, VALS(audible_notif_values),
742 0x0, NULL, HFILL } },
744 { &hf_zbee_zcl_ias_ace_zone_label,
745 { "Zone Label", "zbee_zcl_sas.ias_ace.cmd.zone_label", FT_UINT_STRING, BASE_NONE, NULL,
746 0x0, NULL, HFILL } },
748 { &hf_zbee_zcl_ias_ace_panel_status,
749 { "Panel Status", "zbee_zcl_sas.ias_ace.cmd.panel_status", FT_UINT8, BASE_HEX, VALS(panel_status_values),
750 0x0, NULL, HFILL } },
752 { &hf_zbee_zcl_ias_ace_seconds_remaining,
753 { "Seconds Remaining", "zbee_zcl_sas.ias_ace.cmd.seconds_remaining", FT_UINT8, BASE_DEC, NULL,
754 0x0, NULL, HFILL } },
756 { &hf_zbee_zcl_ias_ace_alarm_status,
757 { "Alarm Status", "zbee_zcl_sas.ias_ace.cmd.alarm_status", FT_UINT8, BASE_HEX, VALS(alarm_status_values),
758 0x0, NULL, HFILL } },
760 { &hf_zbee_zcl_ias_ace_number_of_zones,
761 { "Number of Zones", "zbee_zcl_sas.ias_ace.cmd.number_of_zones", FT_UINT8, BASE_DEC, NULL,
762 0x0, NULL, HFILL } },
764 { &hf_zbee_zcl_ias_ace_zone_status_complete,
765 { "Zone Status Complete", "zbee_zcl_sas.ias_ace.cmd.zone_status_complete", FT_BOOLEAN, BASE_NONE, NULL,
766 0x0, NULL, HFILL } },
769 /* ZCL IAS ACE subtrees */
770 static int *ett[ZBEE_ZCL_IAS_ACE_NUM_ETT];
771 ett[0] = &ett_zbee_zcl_ias_ace;
772 ett[1] = &ett_zbee_zcl_ias_ace_zone_id;
773 ett[2] = &ett_zbee_zcl_ias_ace_zone_id_map_sec;
774 ett[3] = &ett_zbee_zcl_ias_ace_zone_id_map_sec_elem;
775 ett[4] = &ett_zbee_zcl_ias_ace_bypassed_zone_list;
776 ett[5] = &ett_zbee_zcl_ias_ace_bypassed_resp_list;
777 ett[6] = &ett_zbee_zcl_ias_ace_get_zone_status_resp_list;
779 /* Register the ZigBee ZCL IAS ACE cluster protocol name and description */
780 proto_zbee_zcl_ias_ace = proto_register_protocol("ZigBee ZCL IAS ACE", "ZCL IAS ACE", ZBEE_PROTOABBREV_ZCL_IAS_ACE);
781 proto_register_field_array(proto_zbee_zcl_ias_ace, hf, array_length(hf));
782 proto_register_subtree_array(ett, array_length(ett));
784 /* Register the ZigBee ZCL IAS ACE dissector. */
785 register_dissector(ZBEE_PROTOABBREV_ZCL_IAS_ACE, dissect_zbee_zcl_ias_ace, proto_zbee_zcl_ias_ace);
787 } /*proto_register_zbee_zcl_ias_ace*/
791 *Hands off the ZCL IAS ACE dissector.
794 void
795 proto_reg_handoff_zbee_zcl_ias_ace(void)
797 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_IAS_ACE,
798 proto_zbee_zcl_ias_ace,
799 ett_zbee_zcl_ias_ace,
800 ZBEE_ZCL_CID_IAS_ACE,
801 ZBEE_MFG_CODE_NONE,
802 -1, -1,
803 hf_zbee_zcl_ias_ace_srv_rx_cmd_id,
804 hf_zbee_zcl_ias_ace_srv_tx_cmd_id,
805 NULL
807 } /*proto_reg_handoff_zbee_zcl_ias_ace*/
810 /* ########################################################################## */
811 /* #### (0x0502) IAS WD CLUSTER ############################################# */
812 /* ########################################################################## */
814 /*************************/
815 /* Defines */
816 /*************************/
817 #define ZBEE_ZCL_IAS_WD_NUM_ETT 1
818 #define ZBEE_ZCL_IAS_WD_WARNING_MODE_MASK 0xF0
819 #define ZBEE_ZCL_IAS_WD_STROBE_2BIT_MASK 0x0C
820 #define ZBEE_ZCL_IAS_WD_SWQUAWK_MODE_MASK 0xF0
821 #define ZBEE_ZCL_IAS_WD_STROBE_1BIT_MASK 0x08
822 #define ZBEE_ZCL_IAS_WD_SWQUAWK_LEVEL_MASK 0x03
824 /* Attributes */
825 #define ZBEE_ZCL_ATTR_ID_IAS_WD_MAX_DURATION 0x0000 /* Max Duration */
827 /* Server Commands Received */
828 #define ZBEE_ZCL_CMD_ID_IAS_WD_START_WARNING 0x00 /* Start Warning */
829 #define ZBEE_ZCL_CMD_ID_IAS_WD_SQUAWK 0x01 /* Squawk */
831 /*************************/
832 /* Function Declarations */
833 /*************************/
835 void proto_register_zbee_zcl_ias_wd(void);
836 void proto_reg_handoff_zbee_zcl_ias_wd(void);
838 /* Command Dissector Helpers */
839 static void dissect_zcl_ias_wd_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
840 static void dissect_zcl_ias_wd_start_warning (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
841 static void dissect_zcl_ias_wd_squawk (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
843 /* Private functions prototype */
845 /*************************/
846 /* Global Variables */
847 /*************************/
848 /* Initialize the protocol and registered fields */
849 static int proto_zbee_zcl_ias_wd;
851 static int hf_zbee_zcl_ias_wd_attr_id;
852 static int hf_zbee_zcl_ias_wd_warning_mode;
853 static int hf_zbee_zcl_ias_wd_strobe_2bit;
854 static int hf_zbee_zcl_ias_wd_squawk_mode;
855 static int hf_zbee_zcl_ias_wd_strobe_1bit;
856 static int hf_zbee_zcl_ias_wd_warning_duration;
857 static int hf_zbee_zcl_ias_wd_squawk_level;
858 static int hf_zbee_zcl_ias_wd_srv_rx_cmd_id;
860 /* Initialize the subtree pointers */
861 static int ett_zbee_zcl_ias_wd;
863 /* Attributes */
864 static const value_string zbee_zcl_ias_wd_attr_names[] = {
865 { ZBEE_ZCL_ATTR_ID_IAS_WD_MAX_DURATION, "Maximum Duration" },
866 { 0, NULL }
869 /* Server Commands Received */
870 static const value_string zbee_zcl_ias_wd_srv_rx_cmd_names[] = {
871 { ZBEE_ZCL_CMD_ID_IAS_WD_START_WARNING, "Start Warning" },
872 { ZBEE_ZCL_CMD_ID_IAS_WD_SQUAWK, "Squawk" },
873 { 0, NULL }
876 /* Warning Mode Values */
877 static const value_string warning_mode_values[] = {
878 { 0, "Stop (no warning)" },
879 { 1, "Burglar" },
880 { 2, "Fire" },
881 { 3, "Emergency" },
882 { 4, "Police Panic" },
883 { 5, "Fire Panic" },
884 { 6, "Emergency Panic" },
885 { 0, NULL }
888 /* Strobe 2-bit Values */
889 static const value_string strobe_2bit_values[] = {
890 { 0, "No Strobe" },
891 { 1, "Use strobe in parallel to warning" },
892 { 0, NULL }
895 /* Strobe 1-bit Values */
896 static const value_string strobe_1bit_values[] = {
897 { 0, "No Strobe" },
898 { 1, "Use strobe blink in parallel to squawk" },
899 { 0, NULL }
902 /* Squawk Mode Values */
903 static const value_string squawk_mode_values[] = {
904 { 0, "Notification sound for 'System is armed'" },
905 { 1, "Notification sound for 'System is disarmed'" },
906 { 0, NULL }
909 /* Squawk Level Values */
910 static const value_string squawk_level_values[] = {
911 { 0, "Low level sound" },
912 { 1, "Medium level sound" },
913 { 2, "High level sound" },
914 { 3, "Very high level sound" },
915 { 0, NULL }
918 /*************************/
919 /* Function Bodies */
920 /*************************/
923 *ZigBee ZCL IAS WD cluster dissector for wireshark.
925 *@param tvb pointer to buffer containing raw packet.
926 *@param pinfo pointer to packet information fields
927 *@param tree pointer to data tree Wireshark uses to display packet.
929 static int
930 dissect_zbee_zcl_ias_wd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
932 proto_tree *payload_tree;
933 zbee_zcl_packet *zcl;
934 unsigned offset = 0;
935 uint8_t cmd_id;
936 int rem_len;
938 /* Reject the packet if data is NULL */
939 if (data == NULL)
940 return 0;
941 zcl = (zbee_zcl_packet *)data;
942 cmd_id = zcl->cmd_id;
944 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
945 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
946 /* Append the command name to the info column. */
947 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
948 val_to_str_const(cmd_id, zbee_zcl_ias_wd_srv_rx_cmd_names, "Unknown Command"),
949 zcl->tran_seqno);
951 /* Add the command ID. */
952 proto_tree_add_item(tree, hf_zbee_zcl_ias_wd_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
954 /* Check if this command has a payload, then add the payload tree */
955 rem_len = tvb_reported_length_remaining(tvb, ++offset);
956 if (rem_len > 0) {
957 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_ias_wd, NULL, "Payload");
959 /* Call the appropriate command dissector */
960 switch (cmd_id) {
962 case ZBEE_ZCL_CMD_ID_IAS_WD_START_WARNING:
963 dissect_zcl_ias_wd_start_warning(tvb, payload_tree, &offset);
964 break;
966 case ZBEE_ZCL_CMD_ID_IAS_WD_SQUAWK:
967 dissect_zcl_ias_wd_squawk(tvb, payload_tree, &offset);
968 break;
970 default:
971 break;
976 return tvb_captured_length(tvb);
977 } /*dissect_zbee_zcl_ias_wd*/
981 *This function decodes the Start Warning payload.
983 *@param tvb the tv buffer of the current data_type
984 *@param tree the tree to append this item to
985 *@param offset offset of data in tvb
987 static void
988 dissect_zcl_ias_wd_start_warning(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
990 /* Retrieve "Warning Mode" field */
991 proto_tree_add_item(tree, hf_zbee_zcl_ias_wd_warning_mode, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
993 /* Retrieve "Strobe" field */
994 proto_tree_add_item(tree, hf_zbee_zcl_ias_wd_strobe_2bit, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
995 *offset += 1;
997 /* Retrieve "Warning Duration" field */
998 proto_tree_add_item(tree, hf_zbee_zcl_ias_wd_warning_duration, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
999 *offset += 2;
1001 } /*dissect_zcl_ias_wd_start_warning*/
1005 *This function decodes the Squawk payload.
1007 *@param tvb the tv buffer of the current data_type
1008 *@param tree the tree to append this item to
1009 *@param offset offset of data in tvb
1011 static void
1012 dissect_zcl_ias_wd_squawk(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1014 /* Retrieve "Squawk Mode" field */
1015 proto_tree_add_item(tree, hf_zbee_zcl_ias_wd_squawk_mode, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1017 /* Retrieve "Strobe" field */
1018 proto_tree_add_item(tree, hf_zbee_zcl_ias_wd_strobe_1bit, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1020 /* Retrieve "Squawk Level" field */
1021 proto_tree_add_item(tree, hf_zbee_zcl_ias_wd_squawk_level, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1022 *offset += 1;
1024 } /*dissect_zcl_ias_wd_squawk*/
1028 *This function is called by ZCL foundation dissector in order to decode
1030 *@param tree pointer to data tree Wireshark uses to display packet.
1031 *@param tvb pointer to buffer containing raw packet.
1032 *@param offset pointer to buffer offset
1033 *@param attr_id attribute identifier
1034 *@param data_type attribute data type
1035 *@param client_attr ZCL client
1037 void
1038 dissect_zcl_ias_wd_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
1040 /* Dissect attribute data type and data */
1041 switch (attr_id) {
1042 case ZBEE_ZCL_ATTR_ID_IAS_WD_MAX_DURATION:
1043 default:
1044 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
1045 break;
1048 } /*dissect_zcl_ias_wd_attr_data*/
1052 *ZigBee ZCL IAS WD cluster protocol registration routine.
1055 void
1056 proto_register_zbee_zcl_ias_wd(void)
1058 /* Setup list of header fields */
1059 static hf_register_info hf[] = {
1061 { &hf_zbee_zcl_ias_wd_attr_id,
1062 { "Attribute", "zbee_zcl_sas.ias_wd.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_ias_wd_attr_names),
1063 0x0, NULL, HFILL } },
1065 { &hf_zbee_zcl_ias_wd_warning_mode,
1066 { "Warning Mode", "zbee_zcl_sas.ias_wd.warning_mode", FT_UINT8, BASE_DEC, VALS(warning_mode_values),
1067 ZBEE_ZCL_IAS_WD_WARNING_MODE_MASK, NULL, HFILL } },
1069 { &hf_zbee_zcl_ias_wd_strobe_2bit,
1070 { "Strobe", "zbee_zcl_sas.ias_wd.strobe", FT_UINT8, BASE_DEC, VALS(strobe_2bit_values),
1071 ZBEE_ZCL_IAS_WD_STROBE_2BIT_MASK, NULL, HFILL } },
1073 { &hf_zbee_zcl_ias_wd_squawk_mode,
1074 { "Squawk Mode", "zbee_zcl_sas.ias_wd.squawk_mode", FT_UINT8, BASE_DEC, VALS(squawk_mode_values),
1075 ZBEE_ZCL_IAS_WD_SWQUAWK_MODE_MASK, NULL, HFILL } },
1077 { &hf_zbee_zcl_ias_wd_strobe_1bit,
1078 { "Strobe", "zbee_zcl_sas.ias_wd.strobe", FT_UINT8, BASE_DEC, VALS(strobe_1bit_values),
1079 ZBEE_ZCL_IAS_WD_STROBE_1BIT_MASK, NULL, HFILL } },
1081 { &hf_zbee_zcl_ias_wd_warning_duration,
1082 { "Warning Duration", "zbee_zcl_sas.ias_wd.warning_duration", FT_UINT16, BASE_HEX, NULL,
1083 0x0, NULL, HFILL } },
1085 { &hf_zbee_zcl_ias_wd_squawk_level,
1086 { "Squawk Level", "zbee_zcl_sas.ias_wd.squawk_level", FT_UINT8, BASE_DEC, VALS(squawk_level_values),
1087 ZBEE_ZCL_IAS_WD_SWQUAWK_LEVEL_MASK, NULL, HFILL } },
1089 { &hf_zbee_zcl_ias_wd_srv_rx_cmd_id,
1090 { "Command", "zbee_zcl_sas.ias_wd.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ias_wd_srv_rx_cmd_names),
1091 0x0, NULL, HFILL } }
1094 /* ZCL IAS WD subtrees */
1095 static int *ett[ZBEE_ZCL_IAS_WD_NUM_ETT];
1096 ett[0] = &ett_zbee_zcl_ias_wd;
1098 /* Register the ZigBee ZCL IAS WD cluster protocol name and description */
1099 proto_zbee_zcl_ias_wd = proto_register_protocol("ZigBee ZCL IAS WD", "ZCL IAS WD", ZBEE_PROTOABBREV_ZCL_IAS_WD);
1100 proto_register_field_array(proto_zbee_zcl_ias_wd, hf, array_length(hf));
1101 proto_register_subtree_array(ett, array_length(ett));
1103 /* Register the ZigBee ZCL IAS WD dissector. */
1104 register_dissector(ZBEE_PROTOABBREV_ZCL_IAS_WD, dissect_zbee_zcl_ias_wd, proto_zbee_zcl_ias_wd);
1106 } /*proto_register_zbee_zcl_ias_wd*/
1110 *Hands off the ZCL IAS WD dissector.
1113 void
1114 proto_reg_handoff_zbee_zcl_ias_wd(void)
1116 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_IAS_WD,
1117 proto_zbee_zcl_ias_wd,
1118 ett_zbee_zcl_ias_wd,
1119 ZBEE_ZCL_CID_IAS_WD,
1120 ZBEE_MFG_CODE_NONE,
1121 hf_zbee_zcl_ias_wd_attr_id,
1122 hf_zbee_zcl_ias_wd_attr_id,
1123 hf_zbee_zcl_ias_wd_srv_rx_cmd_id,
1125 (zbee_zcl_fn_attr_data)dissect_zcl_ias_wd_attr_data
1127 } /*proto_reg_handoff_zbee_zcl_ias_wd*/
1130 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1132 * Local variables:
1133 * c-basic-offset: 4
1134 * tab-width: 8
1135 * indent-tabs-mode: nil
1136 * End:
1138 * vi: set shiftwidth=4 tabstop=8 expandtab:
1139 * :indentSize=4:tabSize=8:noTabs=true: