Bug Summary

File:builds/wireshark/wireshark/epan/dissectors/packet-zbee-nwk-gp.c
Warning:line 1175, column 13
Value stored to 'offset' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name packet-zbee-nwk-gp.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -fno-delete-null-pointer-checks -mframe-pointer=all -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -ffloat16-excess-precision=fast -fbfloat16-excess-precision=fast -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/builds/wireshark/wireshark/build -fcoverage-compilation-dir=/builds/wireshark/wireshark/build -resource-dir /usr/lib/llvm-22/lib/clang/22 -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /builds/wireshark/wireshark/epan/dissectors -isystem /builds/wireshark/wireshark/build/epan/dissectors -isystem /usr/include/mit-krb5 -isystem /usr/include/libxml2 -isystem /builds/wireshark/wireshark/epan -D CARES_NO_DEPRECATED -D G_DISABLE_DEPRECATED -D G_DISABLE_SINGLE_INCLUDES -D WS_BUILD_DLL -D WS_DEBUG -D WS_DEBUG_UTF_8 -I /builds/wireshark/wireshark/build -I /builds/wireshark/wireshark -I /builds/wireshark/wireshark/include -D _GLIBCXX_ASSERTIONS -internal-isystem /usr/lib/llvm-22/lib/clang/22/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fmacro-prefix-map=/builds/wireshark/wireshark/= -fmacro-prefix-map=/builds/wireshark/wireshark/build/= -fmacro-prefix-map=../= -Wno-format-nonliteral -std=gnu17 -ferror-limit 19 -fvisibility=hidden -fwrapv -fwrapv-pointer -fstrict-flex-arrays=3 -stack-protector 2 -fstack-clash-protection -fcf-protection=full -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fexceptions -fcolor-diagnostics -analyzer-output=html -faddrsig -fdwarf2-cfi-asm -o /builds/wireshark/wireshark/sbout/2026-09-14-100414-3660-1 -x c /builds/wireshark/wireshark/epan/dissectors/packet-zbee-nwk-gp.c
1/* packet-zbee-nwk-gp.c
2 * Dissector routines for the ZigBee Green Power profile (GP)
3 * Copyright 2013 DSR Corporation, http://dsr-wireless.com/
4 *
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
8 *
9 * Used Owen Kirby's packet-zbee-aps module as a template. Based
10 * on ZigBee Cluster Library Specification document 075123r02ZB
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 */
14
15/* Include files. */
16#include "config.h"
17
18#include <epan/packet.h>
19#include <epan/exceptions.h>
20#include <epan/expert.h>
21#include <epan/prefs.h>
22#include <epan/uat.h>
23#include <wsutil/bits_ctz.h>
24#include <wsutil/pint.h>
25#include "packet-zbee.h"
26#include "packet-zbee-nwk.h"
27#include "packet-zbee-security.h"
28#include "packet-zbee-aps.h"
29#include "packet-zbee-zcl.h"
30
31void proto_register_zbee_nwk_gp(void);
32void proto_reg_handoff_zbee_nwk_gp(void);
33
34/**************************/
35/* Defines. */
36/**************************/
37
38/* ZigBee NWK GP FCF frame types. */
39#define ZBEE_NWK_GP_FCF_DATA0x00 0x00
40#define ZBEE_NWK_GP_FCF_MAINTENANCE0x01 0x01
41
42/* ZigBee NWK GP FCF fields. */
43#define ZBEE_NWK_GP_FCF_AUTO_COMMISSIONING0x40 0x40
44#define ZBEE_NWK_GP_FCF_CONTROL_EXTENSION0x80 0x80
45#define ZBEE_NWK_GP_FCF_FRAME_TYPE0x03 0x03
46#define ZBEE_NWK_GP_FCF_VERSION0x3C 0x3C
47
48/* Extended NWK Frame Control field. */
49#define ZBEE_NWK_GP_FCF_EXT_APP_ID0x07 0x07 /* 0 - 2 b. */
50#define ZBEE_NWK_GP_FCF_EXT_SECURITY_LEVEL0x18 0x18 /* 3 - 4 b. */
51#define ZBEE_NWK_GP_FCF_EXT_SECURITY_KEY0x20 0x20 /* 5 b. */
52#define ZBEE_NWK_GP_FCF_EXT_RX_AFTER_TX0x40 0x40 /* 6 b. */
53#define ZBEE_NWK_GP_FCF_EXT_DIRECTION0x80 0x80 /* 7 b. */
54
55/* Definitions for application IDs. */
56#define ZBEE_NWK_GP_APP_ID_DEFAULT0x00 0x00
57#define ZBEE_NWK_GP_APP_ID_LPED0x01 0x01
58#define ZBEE_NWK_GP_APP_ID_ZGP0x02 0x02
59
60/* Definitions for GP directions. */
61#define ZBEE_NWK_GP_FC_EXT_DIRECTION_DEFAULT0x00 0x00
62#define ZBEE_NWK_GP_FC_EXT_DIRECTION_FROM_ZGPD0x00 0x00
63#define ZBEE_NWK_GP_FC_EXT_DIRECTION_FROM_ZGPP0x01 0x01
64
65/* Definitions for ZGPD Source IDs. */
66#define ZBEE_NWK_GP_ZGPD_SRCID_ALL0xFFFFFFFF 0xFFFFFFFF
67#define ZBEE_NWK_GP_ZGPD_SRCID_UNKNOWN0x00000000 0x00000000
68
69/* Security level values. */
70#define ZBEE_NWK_GP_SECURITY_LEVEL_NO0x00 0x00
71#define ZBEE_NWK_GP_SECURITY_LEVEL_1LSB0x01 0x01
72#define ZBEE_NWK_GP_SECURITY_LEVEL_FULL0x02 0x02
73#define ZBEE_NWK_GP_SECURITY_LEVEL_FULLENCR0x03 0x03
74
75/* GP Security key types. */
76#define ZBEE_NWK_GP_SECURITY_KEY_TYPE_NO_KEY0x00 0x00
77#define ZBEE_NWK_GP_SECURITY_KEY_TYPE_ZB_NWK_KEY0x01 0x01
78#define ZBEE_NWK_GP_SECURITY_KEY_TYPE_GPD_GROUP_KEY0x02 0x02
79#define ZBEE_NWK_GP_SECURITY_KEY_TYPE_NWK_KEY_DERIVED_GPD_KEY_GROUP_KEY0x03 0x03
80#define ZBEE_NWK_GP_SECURITY_KEY_TYPE_PRECONFIGURED_INDIVIDUAL_GPD_KEY0x04 0x04
81#define ZBEE_NWK_GP_SECURITY_KEY_TYPE_DERIVED_INDIVIDUAL_GPD_KEY0x07 0x07
82
83typedef struct {
84 /* FCF Data. */
85 uint8_t frame_type;
86 bool_Bool nwk_frame_control_extension;
87
88 /* Ext FCF Data. */
89 uint8_t application_id;
90 uint8_t security_level;
91 uint8_t direction;
92
93 /* Src ID. */
94 uint32_t source_id;
95
96 /* GPD Endpoint */
97 uint8_t endpoint;
98
99 /* Security Frame Counter. */
100 uint32_t security_frame_counter;
101
102 /* MIC. */
103 uint8_t mic_size;
104 uint32_t mic;
105
106 /* Application Payload. */
107 uint8_t payload_len;
108
109 /* Source IEEE address from parent */
110 uint64_t ieee_packet_src64;
111} zbee_nwk_green_power_packet;
112
113/* Definitions for GP Commissioning command opt field (bitmask). */
114#define ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_MAC_SEQ0x01 0x01
115#define ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_RX_ON_CAP0x02 0x02
116#define ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_APPLICATION_INFO0x04 0x04
117#define ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_PAN_ID_REQ0x10 0x10
118#define ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_GP_SEC_KEY_REQ0x20 0x20
119#define ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_FIXED_LOCATION0x40 0x40
120#define ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_EXT_OPTIONS0x80 0x80
121
122/* Definitions for GP Commissioning command ext_opt field (bitmask). */
123#define ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_SEC_LEVEL_CAP0x03 0x03
124#define ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_KEY_TYPE0x1C 0x1C
125#define ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_GPD_KEY_PRESENT0x20 0x20
126#define ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_GPD_KEY_ENCR0x40 0x40
127#define ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_OUT_COUNTER0x80 0x80
128
129/* Definitions for GP Commissioning command application information field (bitmask). */
130#define ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_MIP0x01 0x01
131#define ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_MMIP0x02 0x02
132#define ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_GCLP0x04 0x04
133#define ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_CRP0x08 0x08
134#define ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_SIP0x10 0x10
135#define ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_ADCF0x20 0x20
136#define ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_RES0xC0 0xC0
137
138/* Definitions for GP Commissioning command switch information field. */
139#define ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_INFO_LEN0x02 0x02
140#define ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_CONF_NUM_CONTACTS0x0F 0x0F
141#define ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_CONF_SWITCH_TYPE0x30 0x30
142#define ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_CONF_RES0xC0 0xC0
143
144/* Definitions for GP Commissioning command Number of server ClusterIDs (bitmask) */
145#define ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_SRV0x0F 0x0F
146#define ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_CLI0xF0 0xF0
147
148/* Definitions for GP Decommissioning command opt field (bitmask). */
149#define ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_PAN_ID_PRESENT0x01 0x01
150#define ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_KEY_PRESENT0x02 0x02
151#define ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_KEY_ENCR0x04 0x04
152#define ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_LEVEL0x18 0x18
153#define ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_KEY_TYPE0xE0 0xE0
154
155/* Definition for GP read attributes command opt field (bitmask). */
156#define ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MULTI_RECORD0x01 0x01
157#define ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MAN_FIELD_PRESENT0x02 0x02
158
159#define ZBEE_NWK_GP_CMD_ZCL_TUNNEL_OPT_FRAME_TYPE0x03 0x03
160#define ZBEE_NWK_GP_CMD_ZCL_TUNNEL_OPT_MAN_FIELD_PRESENT0x04 0x04
161#define ZBEE_NWK_GP_CMD_ZCL_TUNNEL_OPT_DIRECTION0x08 0x08
162
163/* Definition for GP Application Description command opt fields bitmasks */
164#define ZBEE_NWK_GP_CMD_APP_DESC_REPORT_DESC_OPT_TIMEOUT_PRESENT0x01 0x01
165#define ZBEE_NWK_GP_CMD_APP_DESC_DATA_PT_DESC_OPT_ATTR_NUM0x07 0x07
166#define ZBEE_NWK_GP_CMD_APP_DESC_DATA_PT_DESC_OPT_SERVER0x08 0x08
167#define ZBEE_NWK_GP_CMD_APP_DESC_DATA_PT_DESC_OPT_MANU_ID_PRESENT0x10 0x10
168#define ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_LEN_REMAIN0x0F 0x0F
169#define ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_REPORTED0x10 0x10
170#define ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_VAL_PRESENT0x20 0x20
171
172/* Definitions for GP Channel Request command. */
173#define ZBEE_NWK_GP_CMD_CHANNEL_REQUEST_1ST0x0F 0x0F
174#define ZBEE_NWK_GP_CMD_CHANNEL_REQUEST_2ND0xF0 0xF0
175
176/* GP Channel Configuration command. */
177#define ZBEE_NWK_GP_CMD_CHANNEL_CONFIGURATION_OPERATION_CH0x0F 0x0F
178
179/* GP GENERIC IDS. */
180#define GPD_DEVICE_ID_GENERIC_GP_SIMPLE_GENERIC_1STATE_SWITCH0x00 0x00
181#define GPD_DEVICE_ID_GENERIC_GP_SIMPLE_GENERIC_2STATE_SWITCH0x01 0x01
182#define GPD_DEVICE_ID_GENERIC_GP_ON_OFF_SWITCH0x02 0x02
183#define GPD_DEVICE_ID_GENERIC_GP_LEVEL_CONTROL_SWITCH0x03 0x03
184#define GPD_DEVICE_ID_GENERIC_GP_SIMPLE_SENSOR0x04 0x04
185#define GPD_DEVICE_ID_GENERIC_GP_ADVANCED_GENERIC_1STATE_SWITCH0x05 0x05
186#define GPD_DEVICE_ID_GENERIC_GP_ADVANCED_GENERIC_2STATE_SWITCH0x06 0x06
187
188/* GP LIGHTING IDS. */
189#define GPD_DEVICE_ID_LIGHTING_GP_COLOR_DIMMER_SWITCH0x10 0x10
190#define GPD_DEVICE_ID_LIGHTING_GP_LIGHT_SENSOR0x11 0x11
191#define GPD_DEVICE_ID_LIGHTING_GP_OCCUPANCY_SENSOR0x12 0x12
192
193/* GP CLOSURES IDS. */
194#define GPD_DEVICE_ID_CLOSURES_GP_DOOR_LOCK_CONTROLLER0x20 0x20
195
196/* HVAC IDS. */
197#define GPD_DEVICE_ID_HVAC_GP_TEMPERATURE_SENSOR0x30 0x30
198#define GPD_DEVICE_ID_HVAC_GP_PRESSURE_SENSOR0x31 0x31
199#define GPD_DEVICE_ID_HVAC_GP_FLOW_SENSOR0x32 0x32
200#define GPD_DEVICE_ID_HVAC_GP_INDOOR_ENVIRONMENT_SENSOR0x33 0x33
201
202/* Manufacturer specific device. */
203#define GPD_DEVICE_ID_MANUFACTURER_SPECIFIC0xFE 0xFE
204
205/* GPD manufacturers. */
206#define ZBEE_NWK_GP_MANUF_ID_GREENPEAK0x10D0 0x10D0
207
208/* GPD devices by GreenPeak. */
209#define ZBEE_NWK_GP_MANUF_GREENPEAK_IZDS0x0000 0x0000
210#define ZBEE_NWK_GP_MANUF_GREENPEAK_IZDWS0x0001 0x0001
211#define ZBEE_NWK_GP_MANUF_GREENPEAK_IZLS0x0002 0x0002
212#define ZBEE_NWK_GP_MANUF_GREENPEAK_IZRHS0x0003 0x0003
213
214/*********************/
215/* Global variables. */
216/*********************/
217
218/* GP proto handle. */
219static int proto_zbee_nwk_gp;
220
221/* GP NWK FC. */
222static int hf_zbee_nwk_gp_auto_commissioning;
223static int hf_zbee_nwk_gp_fc_ext;
224static int hf_zbee_nwk_gp_fcf;
225static int hf_zbee_nwk_gp_frame_type;
226static int hf_zbee_nwk_gp_proto_version;
227
228/* GP NWK FC extension. */
229static int hf_zbee_nwk_gp_fc_ext_field;
230static int hf_zbee_nwk_gp_fc_ext_app_id;
231static int hf_zbee_nwk_gp_fc_ext_direction;
232static int hf_zbee_nwk_gp_fc_ext_rx_after_tx;
233static int hf_zbee_nwk_gp_fc_ext_sec_key;
234static int hf_zbee_nwk_gp_fc_ext_sec_level;
235
236/* ZGPD Src ID. */
237static int hf_zbee_nwk_gp_zgpd_src_id;
238
239/* ZGPD Endpoint */
240static int hf_zbee_nwk_gp_zgpd_endpoint;
241
242/* Security frame counter. */
243static int hf_zbee_nwk_gp_security_frame_counter;
244
245/* Security MIC. */
246static int hf_zbee_nwk_gp_security_mic_2b;
247static int hf_zbee_nwk_gp_security_mic_4b;
248
249/* Payload subframe. */
250static int hf_zbee_nwk_gp_command_id;
251
252/* Commissioning. */
253static int hf_zbee_nwk_gp_cmd_comm_device_id;
254static int hf_zbee_nwk_gp_cmd_comm_ext_opt;
255static int hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_encr;
256static int hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_present;
257static int hf_zbee_nwk_gp_cmd_comm_ext_opt_key_type;
258static int hf_zbee_nwk_gp_cmd_comm_ext_opt_outgoing_counter;
259static int hf_zbee_nwk_gp_cmd_comm_ext_opt_sec_level_cap;
260static int hf_zbee_nwk_gp_cmd_comm_security_key;
261static int hf_zbee_nwk_gp_cmd_comm_gpd_sec_key_mic;
262static int hf_zbee_nwk_gp_cmd_comm_opt_ext_opt;
263static int hf_zbee_nwk_gp_cmd_comm_opt;
264static int hf_zbee_nwk_gp_cmd_comm_opt_fixed_location;
265static int hf_zbee_nwk_gp_cmd_comm_opt_mac_sec_num_cap;
266static int hf_zbee_nwk_gp_cmd_comm_opt_appli_info_present;
267static int hf_zbee_nwk_gp_cmd_comm_opt_panid_req;
268static int hf_zbee_nwk_gp_cmd_comm_opt_rx_on_cap;
269static int hf_zbee_nwk_gp_cmd_comm_opt_sec_key_req;
270static int hf_zbee_nwk_gp_cmd_comm_outgoing_counter;
271static int hf_zbee_nwk_gp_cmd_comm_manufacturer_greenpeak_dev_id;
272static int hf_zbee_nwk_gp_cmd_comm_manufacturer_dev_id;
273static int hf_zbee_nwk_gp_cmd_comm_manufacturer_id;
274static int hf_zbee_nwk_gp_cmd_comm_appli_info;
275static int hf_zbee_nwk_gp_cmd_comm_appli_info_crp;
276static int hf_zbee_nwk_gp_cmd_comm_appli_info_gclp;
277static int hf_zbee_nwk_gp_cmd_comm_appli_info_mip;
278static int hf_zbee_nwk_gp_cmd_comm_appli_info_mmip;
279static int hf_zbee_nwk_gp_cmd_comm_appli_info_sip;
280static int hf_zbee_nwk_gp_cmd_comm_appli_info_adcf;
281static int hf_zbee_nwk_gp_cmd_comm_appli_info_res;
282static int hf_zbee_nwk_gp_cmd_comm_gpd_cmd_num;
283static int hf_zbee_nwk_gp_cmd_comm_gpd_cmd_id_list;
284static int hf_zbee_nwk_gp_cmd_comm_length_of_clid_list;
285static int hf_zbee_nwk_gp_cmd_comm_length_of_clid_list_server;
286static int hf_zbee_nwk_gp_cmd_comm_length_of_clid_list_client;
287static int hf_zbee_nwk_cmd_comm_clid_list_server;
288static int hf_zbee_nwk_cmd_comm_clid_list_client;
289static int hf_zbee_nwk_cmd_comm_cluster_id;
290static int hf_zbee_nwk_gp_cmd_comm_switch_info;
291static int hf_zbee_nwk_gp_cmd_comm_switch_info_length;
292static int hf_zbee_nwk_gp_cmd_comm_switch_info_generic_switch_config;
293static int hf_zbee_nwk_gp_cmd_comm_switch_info_num_contacts;
294static int hf_zbee_nwk_gp_cmd_comm_switch_info_switch_type;
295static int hf_zbee_nwk_gp_cmd_comm_switch_info_reserved;
296static int hf_zbee_nwk_gp_cmd_comm_switch_info_current_contact_status;
297
298/* Commissioning reply. */
299static int hf_zbee_nwk_gp_cmd_comm_rep_opt;
300static int hf_zbee_nwk_gp_cmd_comm_rep_opt_key_encr;
301static int hf_zbee_nwk_gp_cmd_comm_rep_opt_panid_present;
302static int hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_key_present;
303static int hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_level;
304static int hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_type;
305static int hf_zbee_nwk_gp_cmd_comm_rep_pan_id;
306static int hf_zbee_nwk_gp_cmd_comm_rep_frame_counter;
307
308/* Read attribute and read attribute response. */
309static int hf_zbee_nwk_gp_cmd_read_att_opt_multi_rec;
310static int hf_zbee_nwk_gp_cmd_read_att_opt_man_field_present;
311static int hf_zbee_nwk_gp_cmd_read_att_opt;
312static int hf_zbee_nwk_gp_cmd_read_att_record_len;
313
314/* ZCL Tunnel */
315static int hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_frame_type;
316static int hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_man_field_present;
317static int hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_direction;
318static int hf_zbee_nwk_gp_cmd_zcl_tunnel_opt;
319static int hf_zbee_nwk_gp_cmd_zcl_tunnel_command_id;
320static int hf_zbee_nwk_gp_cmd_zcl_tunnel_payload_len;
321
322/* Compact Attribute Reporting */
323static int hf_zbee_nwk_gp_cmd_compact_attr_report_report_id;
324static int hf_zbee_nwk_gp_cmd_compact_attr_report_data_points;
325
326/* Application Description */
327static int hf_zbee_nwk_gp_cmd_app_desc_total_report;
328static int hf_zbee_nwk_gp_cmd_app_desc_num_report;
329static int hf_zbee_nwk_gp_cmd_app_desc_report_desc_id;
330static int hf_zbee_nwk_gp_cmd_app_desc_report_desc_opt;
331static int hf_zbee_nwk_gp_cmd_app_desc_report_desc_opt_timeout_present;
332static int hf_zbee_nwk_gp_cmd_app_desc_report_desc_timeout;
333static int hf_zbee_nwk_gp_cmd_app_desc_report_desc_len_remain;
334static int hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt;
335static int hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_num_recs;
336static int hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_server;
337static int hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_manu_id_present;
338static int hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_cluster_id;
339static int hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_manu_id;
340static int hf_zbee_nwk_gp_cmd_app_desc_attr_rec_id;
341static int hf_zbee_nwk_gp_cmd_app_desc_attr_rec_data_type;
342static int hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt;
343static int hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_len_remain;
344static int hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_reported;
345static int hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_val_present;
346static int hf_zbee_nwk_gp_cmd_app_desc_attr_rec_offset;
347static int hf_zbee_nwk_gp_cmd_app_desc_attr_rec_val;
348
349/* Common to commands returning data */
350static int hf_zbee_nwk_gp_zcl_attr_status;
351static int hf_zbee_nwk_gp_zcl_attr_data_type;
352static int hf_zbee_nwk_gp_zcl_attr_cluster_id;
353
354/* Common to all manufacturer specific commands */
355static int hf_zbee_zcl_gp_cmd_ms_manufacturer_code;
356
357/* Channel request. */
358static int hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour;
359static int hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_1st;
360static int hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_2nd;
361
362/* Channel Configuration command. */
363static int hf_zbee_nwk_gp_cmd_operational_channel;
364static int hf_zbee_nwk_gp_cmd_channel_configuration;
365
366/* Move Color command. */
367static int hf_zbee_nwk_gp_cmd_move_color_ratex;
368static int hf_zbee_nwk_gp_cmd_move_color_ratey;
369
370/* Move Up/Down command. */
371static int hf_zbee_nwk_gp_cmd_move_up_down_rate;
372
373/* Step Color command. */
374static int hf_zbee_nwk_gp_cmd_step_color_stepx;
375static int hf_zbee_nwk_gp_cmd_step_color_stepy;
376static int hf_zbee_nwk_gp_cmd_step_color_transition_time;
377
378/* Step Up/Down command. */
379static int hf_zbee_nwk_gp_cmd_step_up_down_step_size;
380static int hf_zbee_nwk_gp_cmd_step_up_down_transition_time;
381
382static expert_field ei_zbee_nwk_gp_no_payload;
383static expert_field ei_zbee_nwk_gp_inval_residual_data;
384static expert_field ei_zbee_nwk_gp_com_rep_no_out_cnt;
385
386/* Proto tree elements. */
387static int ett_zbee_nwk;
388static int ett_zbee_nwk_cmd;
389static int ett_zbee_nwk_cmd_cinfo;
390static int ett_zbee_nwk_cmd_appli_info;
391static int ett_zbee_nwk_cmd_options;
392static int ett_zbee_nwk_fcf;
393static int ett_zbee_nwk_fcf_ext;
394static int ett_zbee_nwk_clu_rec;
395static int ett_zbee_nwk_att_rec;
396static int ett_zbee_nwk_cmd_app_desc_report_desc;
397static int ett_zbee_nwk_cmd_app_desc_data_pt_desc;
398static int ett_zbee_nwk_cmd_app_desc_data_pt_options;
399static int ett_zbee_nwk_cmd_app_desc_att_rec;
400static int ett_zbee_nwk_cmd_comm_gpd_cmd_id_list;
401static int ett_zbee_nwk_cmd_comm_length_of_clid_list;
402static int ett_zbee_nwk_cmd_comm_clid_list_server;
403static int ett_zbee_nwk_cmd_comm_clid_list_client;
404static int ett_zbee_nwk_cmd_comm_switch_info;
405static int ett_zbee_nwk_cmd_comm_switch_info_generic_switch_config;
406
407/* Common. */
408static GSList *zbee_gp_keyring;
409static unsigned num_uat_key_records;
410
411typedef struct {
412 char *string;
413 uint8_t byte_order;
414 char *label;
415 uint8_t key[ZBEE_SEC_CONST_KEYSIZE16];
416} uat_key_record_t;
417
418static const uint8_t empty_key[ZBEE_SEC_CONST_KEYSIZE16] = {
419 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
420 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
421};
422static uat_key_record_t *gp_uat_key_records;
423static uat_t *zbee_gp_sec_key_table_uat;
424
425/* UAT. */
426UAT_CSTRING_CB_DEF(gp_uat_key_records, string, uat_key_record_t)static void gp_uat_key_records_string_set_cb(void* rec, const
char* buf, unsigned len, const void* u1 __attribute__((unused
)), const void* u2 __attribute__((unused))) { char* new_buf =
g_strndup(buf,len); (__builtin_object_size (((((uat_key_record_t
*)rec)->string)), 0) != ((size_t) - 1)) ? g_free_sized (((
(uat_key_record_t*)rec)->string), __builtin_object_size ((
(((uat_key_record_t*)rec)->string)), 0)) : (g_free) ((((uat_key_record_t
*)rec)->string)); (((uat_key_record_t*)rec)->string) = new_buf
; } static void gp_uat_key_records_string_tostr_cb(void* rec,
char** out_ptr, unsigned* out_len, const void* u1 __attribute__
((unused)), const void* u2 __attribute__((unused))) { if (((uat_key_record_t
*)rec)->string ) { *out_ptr = g_strdup_inline ((((uat_key_record_t
*)rec)->string)); *out_len = (unsigned)strlen((((uat_key_record_t
*)rec)->string)); } else { *out_ptr = g_strdup_inline ("")
; *out_len = 0; } }
427UAT_VS_DEF(gp_uat_key_records, byte_order, uat_key_record_t, uint8_t, 0, "Normal")static void gp_uat_key_records_byte_order_set_cb(void* rec, const
char* buf, unsigned len, const void* vs, const void* u2 __attribute__
((unused))) { unsigned i; char* str = g_strndup(buf,len); const
char* cstr; ((uat_key_record_t*)rec)->byte_order = 0; for
(i=0; ( cstr = ((const value_string*)vs)[i].strptr ) ;i++) { if
((strcmp ((const char *) (cstr), (const char *) (str)) == 0)
) { ((uat_key_record_t*)rec)->byte_order = (uint8_t)((const
value_string*)vs)[i].value; (__builtin_object_size ((str), 0
) != ((size_t) - 1)) ? g_free_sized (str, __builtin_object_size
((str), 0)) : (g_free) (str); return; } } (__builtin_object_size
((str), 0) != ((size_t) - 1)) ? g_free_sized (str, __builtin_object_size
((str), 0)) : (g_free) (str); } static void gp_uat_key_records_byte_order_tostr_cb
(void* rec, char** out_ptr, unsigned* out_len, const void* vs
, const void* u2 __attribute__((unused))) { unsigned i; for(i
=0;((const value_string*)vs)[i].strptr;i++) { if ( ((const value_string
*)vs)[i].value == ((uat_key_record_t*)rec)->byte_order ) {
*out_ptr = g_strdup_inline (((const value_string*)vs)[i].strptr
); *out_len = (unsigned)strlen(*out_ptr); return; } } *out_ptr
= g_strdup_inline ("Normal"); *out_len = (unsigned)strlen("Normal"
); }
428UAT_CSTRING_CB_DEF(gp_uat_key_records, label, uat_key_record_t)static void gp_uat_key_records_label_set_cb(void* rec, const char
* buf, unsigned len, const void* u1 __attribute__((unused)), const
void* u2 __attribute__((unused))) { char* new_buf = g_strndup
(buf,len); (__builtin_object_size (((((uat_key_record_t*)rec)
->label)), 0) != ((size_t) - 1)) ? g_free_sized ((((uat_key_record_t
*)rec)->label), __builtin_object_size (((((uat_key_record_t
*)rec)->label)), 0)) : (g_free) ((((uat_key_record_t*)rec)
->label)); (((uat_key_record_t*)rec)->label) = new_buf;
} static void gp_uat_key_records_label_tostr_cb(void* rec, char
** out_ptr, unsigned* out_len, const void* u1 __attribute__((
unused)), const void* u2 __attribute__((unused))) { if (((uat_key_record_t
*)rec)->label ) { *out_ptr = g_strdup_inline ((((uat_key_record_t
*)rec)->label)); *out_len = (unsigned)strlen((((uat_key_record_t
*)rec)->label)); } else { *out_ptr = g_strdup_inline ("");
*out_len = 0; } }
429
430/****************/
431/* Field names. */
432/****************/
433
434/* Byte order. */
435static const value_string byte_order_vals[] = {
436 { 0, "Normal"},
437 { 1, "Reverse"},
438
439 { 0, NULL((void*)0) }
440};
441
442/* Application ID names. */
443static const value_string zbee_nwk_gp_app_id_names[] = {
444 { ZBEE_NWK_GP_APP_ID_LPED0x01, "LPED" },
445 { ZBEE_NWK_GP_APP_ID_ZGP0x02, "ZGP" },
446
447 { 0, NULL((void*)0) }
448};
449
450/* Green Power commands. */
451
452/* Abbreviations:
453 * GPDF commands sent:
454 * From GPD w/o payload: "F "
455 * From GPD w payload: "FP"
456 * To GPD: "T "
457 */
458
459#define zbee_nwk_gp_cmd_names_VALUE_STRING_LIST(XXX)XXX( ZB_GP_CMD_ID_IDENTIFY , 0x00, "Identify" ) XXX( ZB_GP_CMD_ID_RECALL_SCENE0
, 0x10, "Recall Scene 0" ) XXX( ZB_GP_CMD_ID_RECALL_SCENE1 ,
0x11, "Recall Scene 1" ) XXX( ZB_GP_CMD_ID_RECALL_SCENE2 , 0x12
, "Recall Scene 2" ) XXX( ZB_GP_CMD_ID_RECALL_SCENE3 , 0x13, "Recall Scene 3"
) XXX( ZB_GP_CMD_ID_RECALL_SCENE4 , 0x14, "Recall Scene 4" )
XXX( ZB_GP_CMD_ID_RECALL_SCENE5 , 0x15, "Recall Scene 5" ) XXX
( ZB_GP_CMD_ID_RECALL_SCENE6 , 0x16, "Recall Scene 6" ) XXX( ZB_GP_CMD_ID_RECALL_SCENE7
, 0x17, "Recall Scene 7" ) XXX( ZB_GP_CMD_ID_STORE_SCENE0 , 0x18
, "Store Scene 0" ) XXX( ZB_GP_CMD_ID_STORE_SCENE1 , 0x19, "Store Scene 1"
) XXX( ZB_GP_CMD_ID_STORE_SCENE2 , 0x1A, "Store Scene 2" ) XXX
( ZB_GP_CMD_ID_STORE_SCENE3 , 0x1B, "Store Scene 3" ) XXX( ZB_GP_CMD_ID_STORE_SCENE4
, 0x1C, "Store Scene 4" ) XXX( ZB_GP_CMD_ID_STORE_SCENE5 , 0x1D
, "Store Scene 5" ) XXX( ZB_GP_CMD_ID_STORE_SCENE6 , 0x1E, "Store Scene 6"
) XXX( ZB_GP_CMD_ID_STORE_SCENE7 , 0x1F, "Store Scene 7" ) XXX
( ZB_GP_CMD_ID_OFF , 0x20, "Off" ) XXX( ZB_GP_CMD_ID_ON , 0x21
, "On" ) XXX( ZB_GP_CMD_ID_TOGGLE , 0x22, "Toggle" ) XXX( ZB_GP_CMD_ID_RELEASE
, 0x23, "Release" ) XXX( ZB_GP_CMD_ID_MOVE_UP , 0x30, "Move Up"
) XXX( ZB_GP_CMD_ID_MOVE_DOWN , 0x31, "Move Down" ) XXX( ZB_GP_CMD_ID_STEP_UP
, 0x32, "Step Up" ) XXX( ZB_GP_CMD_ID_STEP_DOWN , 0x33, "Step Down"
) XXX( ZB_GP_CMD_ID_LEVEL_CONTROL_STOP , 0x34, "Level Control/Stop"
) XXX( ZB_GP_CMD_ID_MOVE_UP_WITH_ON_OFF , 0x35, "Move Up (with On/Off)"
) XXX( ZB_GP_CMD_ID_MOVE_DOWN_WITH_ON_OFF , 0x36, "Move Down (with On/Off)"
) XXX( ZB_GP_CMD_ID_STEP_UP_WITH_ON_OFF , 0x37, "Step Up (with On/Off)"
) XXX( ZB_GP_CMD_ID_STEP_DOWN_WITH_ON_OFF , 0x38, "Step Down (with On/Off)"
) XXX( ZB_GP_CMD_ID_MOVE_HUE_STOP , 0x40, "Move Hue Stop" ) XXX
( ZB_GP_CMD_ID_MOVE_HUE_UP , 0x41, "Move Hue Up" ) XXX( ZB_GP_CMD_ID_MOVE_HUE_DOWN
, 0x42, "Move Hue Down" ) XXX( ZB_GP_CMD_ID_STEP_HUE_UP , 0x43
, "Step Hue Up" ) XXX( ZB_GP_CMD_ID_STEP_HUW_DOWN , 0x44, "Step Hue Down"
) XXX( ZB_GP_CMD_ID_MOVE_SATURATION_STOP , 0x45, "Move Saturation Stop"
) XXX( ZB_GP_CMD_ID_MOVE_SATURATION_UP , 0x46, "Move Saturation Up"
) XXX( ZB_GP_CMD_ID_MOVE_SATURATION_DOWN , 0x47, "Move Saturation Down"
) XXX( ZB_GP_CMD_ID_STEP_SATURATION_UP , 0x48, "Step Saturation Up"
) XXX( ZB_GP_CMD_ID_STEP_SATURATION_DOWN , 0x49, "Step Saturation Down"
) XXX( ZB_GP_CMD_ID_MOVE_COLOR , 0x4A, "Move Color" ) XXX( ZB_GP_CMD_ID_STEP_COLOR
, 0x4B, "Step Color" ) XXX( ZB_GP_CMD_ID_LOCK_DOOR , 0x50, "Lock Door"
) XXX( ZB_GP_CMD_ID_UNLOCK_DOOR , 0x51, "Unlock Door" ) XXX(
ZB_GP_CMD_ID_PRESS11 , 0x60, "Press 1 of 1" ) XXX( ZB_GP_CMD_ID_RELEASE11
, 0x61, "Release 1 of 1" ) XXX( ZB_GP_CMD_ID_PRESS12 , 0x62,
"Press 1 of 2" ) XXX( ZB_GP_CMD_ID_RELEASE12 , 0x63, "Release 1 of 2"
) XXX( ZB_GP_CMD_ID_PRESS22 , 0x64, "Press 2 of 2" ) XXX( ZB_GP_CMD_ID_RELEASE22
, 0x65, "Release 2 of 2" ) XXX( ZB_GP_CMD_ID_SHORT_PRESS11 ,
0x66, "Short press 1 of 1" ) XXX( ZB_GP_CMD_ID_SHORT_PRESS12
, 0x67, "Short press 1 of 2" ) XXX( ZB_GP_CMD_ID_SHORT_PRESS22
, 0x68, "Short press 2 of 2" ) XXX( ZB_GP_CMD_ID_ATTRIBUTE_REPORTING
, 0xA0, "Attribute reporting" ) XXX( ZB_GP_CMD_ID_MANUFACTURE_SPECIFIC_ATTR_REPORTING
, 0xA1, "Manufacturer-specific attribute reporting" ) XXX( ZB_GP_CMD_ID_MULTI_CLUSTER_REPORTING
, 0xA2, "Multi-cluster reporting" ) XXX( ZB_GP_CMD_ID_MANUFACTURER_SPECIFIC_MCLUSTER_REPORTING
, 0xA3, "Manufacturer-specific multi-cluster reporting" ) XXX
( ZB_GP_CMD_ID_REQUEST_ATTRIBUTES , 0xA4, "Request Attributes"
) XXX( ZB_GP_CMD_ID_READ_ATTRIBUTES_RESPONSE , 0xA5, "Read Attributes Response"
) XXX( ZB_GP_CMD_ID_ZCL_TUNNELING , 0xA6, "ZCL Tunneling" ) XXX
( ZB_GP_CMD_ID_COMPACT_ATTR_REPORT , 0xA8, "Compact Attribute Reporting"
) XXX( ZB_GP_CMD_ID_ANY_SENSOR_COMMAND_A0_A3 , 0xAF, "Any GPD sensor command (0xA0 - 0xA3)"
) XXX( ZB_GP_CMD_ID_COMMISSIONING , 0xE0, "Commissioning" ) XXX
( ZB_GP_CMD_ID_DECOMMISSIONING , 0xE1, "Decommissioning" ) XXX
( ZB_GP_CMD_ID_SUCCESS , 0xE2, "Success" ) XXX( ZB_GP_CMD_ID_CHANNEL_REQUEST
, 0xE3, "Channel Request" ) XXX( ZB_GP_CMD_ID_APPLICATION_DESC
, 0xE4, "Application Description" ) XXX( ZB_GP_CMD_ID_COMMISSIONING_REPLY
, 0xF0, "Commissioning Reply" ) XXX( ZB_GP_CMD_ID_WRITE_ATTRIBUTES
, 0xF1, "Write Attributes" ) XXX( ZB_GP_CMD_ID_READ_ATTRIBUTES
, 0xF2, "Read Attributes" ) XXX( ZB_GP_CMD_ID_CHANNEL_CONFIGURATION
, 0xF3, "Channel Configuration" )
\
460 XXX( /*F */ ZB_GP_CMD_ID_IDENTIFY , 0x00, "Identify" ) \
461 XXX( /*F */ ZB_GP_CMD_ID_RECALL_SCENE0 , 0x10, "Recall Scene 0" ) \
462 XXX( /*F */ ZB_GP_CMD_ID_RECALL_SCENE1 , 0x11, "Recall Scene 1" ) \
463 XXX( /*F */ ZB_GP_CMD_ID_RECALL_SCENE2 , 0x12, "Recall Scene 2" ) \
464 XXX( /*F */ ZB_GP_CMD_ID_RECALL_SCENE3 , 0x13, "Recall Scene 3" ) \
465 XXX( /*F */ ZB_GP_CMD_ID_RECALL_SCENE4 , 0x14, "Recall Scene 4" ) \
466 XXX( /*F */ ZB_GP_CMD_ID_RECALL_SCENE5 , 0x15, "Recall Scene 5" ) \
467 XXX( /*F */ ZB_GP_CMD_ID_RECALL_SCENE6 , 0x16, "Recall Scene 6" ) \
468 XXX( /*F */ ZB_GP_CMD_ID_RECALL_SCENE7 , 0x17, "Recall Scene 7" ) \
469 XXX( /*F */ ZB_GP_CMD_ID_STORE_SCENE0 , 0x18, "Store Scene 0" ) \
470 XXX( /*F */ ZB_GP_CMD_ID_STORE_SCENE1 , 0x19, "Store Scene 1" ) \
471 XXX( /*F */ ZB_GP_CMD_ID_STORE_SCENE2 , 0x1A, "Store Scene 2" ) \
472 XXX( /*F */ ZB_GP_CMD_ID_STORE_SCENE3 , 0x1B, "Store Scene 3" ) \
473 XXX( /*F */ ZB_GP_CMD_ID_STORE_SCENE4 , 0x1C, "Store Scene 4" ) \
474 XXX( /*F */ ZB_GP_CMD_ID_STORE_SCENE5 , 0x1D, "Store Scene 5" ) \
475 XXX( /*F */ ZB_GP_CMD_ID_STORE_SCENE6 , 0x1E, "Store Scene 6" ) \
476 XXX( /*F */ ZB_GP_CMD_ID_STORE_SCENE7 , 0x1F, "Store Scene 7" ) \
477 XXX( /*F */ ZB_GP_CMD_ID_OFF , 0x20, "Off" ) \
478 XXX( /*F */ ZB_GP_CMD_ID_ON , 0x21, "On" ) \
479 XXX( /*F */ ZB_GP_CMD_ID_TOGGLE , 0x22, "Toggle" ) \
480 XXX( /*F */ ZB_GP_CMD_ID_RELEASE , 0x23, "Release" ) \
481 XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_UP , 0x30, "Move Up" ) \
482 XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_DOWN , 0x31, "Move Down" ) \
483 XXX( /*FP*/ ZB_GP_CMD_ID_STEP_UP , 0x32, "Step Up" ) \
484 XXX( /*FP*/ ZB_GP_CMD_ID_STEP_DOWN , 0x33, "Step Down" ) \
485 XXX( /*F */ ZB_GP_CMD_ID_LEVEL_CONTROL_STOP , 0x34, "Level Control/Stop" ) \
486 XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_UP_WITH_ON_OFF , 0x35, "Move Up (with On/Off)" ) \
487 XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_DOWN_WITH_ON_OFF , 0x36, "Move Down (with On/Off)" ) \
488 XXX( /*FP*/ ZB_GP_CMD_ID_STEP_UP_WITH_ON_OFF , 0x37, "Step Up (with On/Off)" ) \
489 XXX( /*FP*/ ZB_GP_CMD_ID_STEP_DOWN_WITH_ON_OFF , 0x38, "Step Down (with On/Off)" ) \
490 XXX( /*F */ ZB_GP_CMD_ID_MOVE_HUE_STOP , 0x40, "Move Hue Stop" ) \
491 XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_HUE_UP , 0x41, "Move Hue Up" ) \
492 XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_HUE_DOWN , 0x42, "Move Hue Down" ) \
493 XXX( /*FP*/ ZB_GP_CMD_ID_STEP_HUE_UP , 0x43, "Step Hue Up" ) \
494 XXX( /*FP*/ ZB_GP_CMD_ID_STEP_HUW_DOWN , 0x44, "Step Hue Down" ) \
495 XXX( /*F */ ZB_GP_CMD_ID_MOVE_SATURATION_STOP , 0x45, "Move Saturation Stop" ) \
496 XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_SATURATION_UP , 0x46, "Move Saturation Up" ) \
497 XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_SATURATION_DOWN , 0x47, "Move Saturation Down" ) \
498 XXX( /*FP*/ ZB_GP_CMD_ID_STEP_SATURATION_UP , 0x48, "Step Saturation Up" ) \
499 XXX( /*FP*/ ZB_GP_CMD_ID_STEP_SATURATION_DOWN , 0x49, "Step Saturation Down" ) \
500 XXX( /*FP*/ ZB_GP_CMD_ID_MOVE_COLOR , 0x4A, "Move Color" ) \
501 XXX( /*FP*/ ZB_GP_CMD_ID_STEP_COLOR , 0x4B, "Step Color" ) \
502 XXX( /*F */ ZB_GP_CMD_ID_LOCK_DOOR , 0x50, "Lock Door" ) \
503 XXX( /*F */ ZB_GP_CMD_ID_UNLOCK_DOOR , 0x51, "Unlock Door" ) \
504 XXX( /*F */ ZB_GP_CMD_ID_PRESS11 , 0x60, "Press 1 of 1" ) \
505 XXX( /*F */ ZB_GP_CMD_ID_RELEASE11 , 0x61, "Release 1 of 1" ) \
506 XXX( /*F */ ZB_GP_CMD_ID_PRESS12 , 0x62, "Press 1 of 2" ) \
507 XXX( /*F */ ZB_GP_CMD_ID_RELEASE12 , 0x63, "Release 1 of 2" ) \
508 XXX( /*F */ ZB_GP_CMD_ID_PRESS22 , 0x64, "Press 2 of 2" ) \
509 XXX( /*F */ ZB_GP_CMD_ID_RELEASE22 , 0x65, "Release 2 of 2" ) \
510 XXX( /*F */ ZB_GP_CMD_ID_SHORT_PRESS11 , 0x66, "Short press 1 of 1" ) \
511 XXX( /*F */ ZB_GP_CMD_ID_SHORT_PRESS12 , 0x67, "Short press 1 of 2" ) \
512 XXX( /*F */ ZB_GP_CMD_ID_SHORT_PRESS22 , 0x68, "Short press 2 of 2" ) \
513 XXX( /*FP*/ ZB_GP_CMD_ID_ATTRIBUTE_REPORTING , 0xA0, "Attribute reporting" ) \
514 XXX( /*FP*/ ZB_GP_CMD_ID_MANUFACTURE_SPECIFIC_ATTR_REPORTING , 0xA1, "Manufacturer-specific attribute reporting" ) \
515 XXX( /*FP*/ ZB_GP_CMD_ID_MULTI_CLUSTER_REPORTING , 0xA2, "Multi-cluster reporting" ) \
516 XXX( /*FP*/ ZB_GP_CMD_ID_MANUFACTURER_SPECIFIC_MCLUSTER_REPORTING , 0xA3, "Manufacturer-specific multi-cluster reporting" ) \
517 XXX( /*FP*/ ZB_GP_CMD_ID_REQUEST_ATTRIBUTES , 0xA4, "Request Attributes" ) \
518 XXX( /*FP*/ ZB_GP_CMD_ID_READ_ATTRIBUTES_RESPONSE , 0xA5, "Read Attributes Response" ) \
519 XXX( /*FP*/ ZB_GP_CMD_ID_ZCL_TUNNELING , 0xA6, "ZCL Tunneling" ) \
520 XXX( /*FP*/ ZB_GP_CMD_ID_COMPACT_ATTR_REPORT , 0xA8, "Compact Attribute Reporting" ) \
521 XXX( /*FP*/ ZB_GP_CMD_ID_ANY_SENSOR_COMMAND_A0_A3 , 0xAF, "Any GPD sensor command (0xA0 - 0xA3)" ) \
522 XXX( /*FP*/ ZB_GP_CMD_ID_COMMISSIONING , 0xE0, "Commissioning" ) \
523 XXX( /*F */ ZB_GP_CMD_ID_DECOMMISSIONING , 0xE1, "Decommissioning" ) \
524 XXX( /*F */ ZB_GP_CMD_ID_SUCCESS , 0xE2, "Success" ) \
525 XXX( /*FP*/ ZB_GP_CMD_ID_CHANNEL_REQUEST , 0xE3, "Channel Request" ) \
526 XXX( /*FP*/ ZB_GP_CMD_ID_APPLICATION_DESC , 0xE4, "Application Description" ) \
527 XXX( /*T */ ZB_GP_CMD_ID_COMMISSIONING_REPLY , 0xF0, "Commissioning Reply" ) \
528 XXX( /*T */ ZB_GP_CMD_ID_WRITE_ATTRIBUTES , 0xF1, "Write Attributes" ) \
529 XXX( /*T */ ZB_GP_CMD_ID_READ_ATTRIBUTES , 0xF2, "Read Attributes" ) \
530 XXX( /*T */ ZB_GP_CMD_ID_CHANNEL_CONFIGURATION , 0xF3, "Channel Configuration" )
531
532VALUE_STRING_ENUM(zbee_nwk_gp_cmd_names)enum { ZB_GP_CMD_ID_IDENTIFY = 0x00, ZB_GP_CMD_ID_RECALL_SCENE0
= 0x10, ZB_GP_CMD_ID_RECALL_SCENE1 = 0x11, ZB_GP_CMD_ID_RECALL_SCENE2
= 0x12, ZB_GP_CMD_ID_RECALL_SCENE3 = 0x13, ZB_GP_CMD_ID_RECALL_SCENE4
= 0x14, ZB_GP_CMD_ID_RECALL_SCENE5 = 0x15, ZB_GP_CMD_ID_RECALL_SCENE6
= 0x16, ZB_GP_CMD_ID_RECALL_SCENE7 = 0x17, ZB_GP_CMD_ID_STORE_SCENE0
= 0x18, ZB_GP_CMD_ID_STORE_SCENE1 = 0x19, ZB_GP_CMD_ID_STORE_SCENE2
= 0x1A, ZB_GP_CMD_ID_STORE_SCENE3 = 0x1B, ZB_GP_CMD_ID_STORE_SCENE4
= 0x1C, ZB_GP_CMD_ID_STORE_SCENE5 = 0x1D, ZB_GP_CMD_ID_STORE_SCENE6
= 0x1E, ZB_GP_CMD_ID_STORE_SCENE7 = 0x1F, ZB_GP_CMD_ID_OFF =
0x20, ZB_GP_CMD_ID_ON = 0x21, ZB_GP_CMD_ID_TOGGLE = 0x22, ZB_GP_CMD_ID_RELEASE
= 0x23, ZB_GP_CMD_ID_MOVE_UP = 0x30, ZB_GP_CMD_ID_MOVE_DOWN =
0x31, ZB_GP_CMD_ID_STEP_UP = 0x32, ZB_GP_CMD_ID_STEP_DOWN = 0x33
, ZB_GP_CMD_ID_LEVEL_CONTROL_STOP = 0x34, ZB_GP_CMD_ID_MOVE_UP_WITH_ON_OFF
= 0x35, ZB_GP_CMD_ID_MOVE_DOWN_WITH_ON_OFF = 0x36, ZB_GP_CMD_ID_STEP_UP_WITH_ON_OFF
= 0x37, ZB_GP_CMD_ID_STEP_DOWN_WITH_ON_OFF = 0x38, ZB_GP_CMD_ID_MOVE_HUE_STOP
= 0x40, ZB_GP_CMD_ID_MOVE_HUE_UP = 0x41, ZB_GP_CMD_ID_MOVE_HUE_DOWN
= 0x42, ZB_GP_CMD_ID_STEP_HUE_UP = 0x43, ZB_GP_CMD_ID_STEP_HUW_DOWN
= 0x44, ZB_GP_CMD_ID_MOVE_SATURATION_STOP = 0x45, ZB_GP_CMD_ID_MOVE_SATURATION_UP
= 0x46, ZB_GP_CMD_ID_MOVE_SATURATION_DOWN = 0x47, ZB_GP_CMD_ID_STEP_SATURATION_UP
= 0x48, ZB_GP_CMD_ID_STEP_SATURATION_DOWN = 0x49, ZB_GP_CMD_ID_MOVE_COLOR
= 0x4A, ZB_GP_CMD_ID_STEP_COLOR = 0x4B, ZB_GP_CMD_ID_LOCK_DOOR
= 0x50, ZB_GP_CMD_ID_UNLOCK_DOOR = 0x51, ZB_GP_CMD_ID_PRESS11
= 0x60, ZB_GP_CMD_ID_RELEASE11 = 0x61, ZB_GP_CMD_ID_PRESS12 =
0x62, ZB_GP_CMD_ID_RELEASE12 = 0x63, ZB_GP_CMD_ID_PRESS22 = 0x64
, ZB_GP_CMD_ID_RELEASE22 = 0x65, ZB_GP_CMD_ID_SHORT_PRESS11 =
0x66, ZB_GP_CMD_ID_SHORT_PRESS12 = 0x67, ZB_GP_CMD_ID_SHORT_PRESS22
= 0x68, ZB_GP_CMD_ID_ATTRIBUTE_REPORTING = 0xA0, ZB_GP_CMD_ID_MANUFACTURE_SPECIFIC_ATTR_REPORTING
= 0xA1, ZB_GP_CMD_ID_MULTI_CLUSTER_REPORTING = 0xA2, ZB_GP_CMD_ID_MANUFACTURER_SPECIFIC_MCLUSTER_REPORTING
= 0xA3, ZB_GP_CMD_ID_REQUEST_ATTRIBUTES = 0xA4, ZB_GP_CMD_ID_READ_ATTRIBUTES_RESPONSE
= 0xA5, ZB_GP_CMD_ID_ZCL_TUNNELING = 0xA6, ZB_GP_CMD_ID_COMPACT_ATTR_REPORT
= 0xA8, ZB_GP_CMD_ID_ANY_SENSOR_COMMAND_A0_A3 = 0xAF, ZB_GP_CMD_ID_COMMISSIONING
= 0xE0, ZB_GP_CMD_ID_DECOMMISSIONING = 0xE1, ZB_GP_CMD_ID_SUCCESS
= 0xE2, ZB_GP_CMD_ID_CHANNEL_REQUEST = 0xE3, ZB_GP_CMD_ID_APPLICATION_DESC
= 0xE4, ZB_GP_CMD_ID_COMMISSIONING_REPLY = 0xF0, ZB_GP_CMD_ID_WRITE_ATTRIBUTES
= 0xF1, ZB_GP_CMD_ID_READ_ATTRIBUTES = 0xF2, ZB_GP_CMD_ID_CHANNEL_CONFIGURATION
= 0xF3, _zbee_nwk_gp_cmd_names_ENUM_DUMMY = 0 }
;
533
534VALUE_STRING_ARRAY(zbee_nwk_gp_cmd_names)static const value_string zbee_nwk_gp_cmd_names[] = { { 0x00,
"Identify" }, { 0x10, "Recall Scene 0" }, { 0x11, "Recall Scene 1"
}, { 0x12, "Recall Scene 2" }, { 0x13, "Recall Scene 3" }, {
0x14, "Recall Scene 4" }, { 0x15, "Recall Scene 5" }, { 0x16
, "Recall Scene 6" }, { 0x17, "Recall Scene 7" }, { 0x18, "Store Scene 0"
}, { 0x19, "Store Scene 1" }, { 0x1A, "Store Scene 2" }, { 0x1B
, "Store Scene 3" }, { 0x1C, "Store Scene 4" }, { 0x1D, "Store Scene 5"
}, { 0x1E, "Store Scene 6" }, { 0x1F, "Store Scene 7" }, { 0x20
, "Off" }, { 0x21, "On" }, { 0x22, "Toggle" }, { 0x23, "Release"
}, { 0x30, "Move Up" }, { 0x31, "Move Down" }, { 0x32, "Step Up"
}, { 0x33, "Step Down" }, { 0x34, "Level Control/Stop" }, { 0x35
, "Move Up (with On/Off)" }, { 0x36, "Move Down (with On/Off)"
}, { 0x37, "Step Up (with On/Off)" }, { 0x38, "Step Down (with On/Off)"
}, { 0x40, "Move Hue Stop" }, { 0x41, "Move Hue Up" }, { 0x42
, "Move Hue Down" }, { 0x43, "Step Hue Up" }, { 0x44, "Step Hue Down"
}, { 0x45, "Move Saturation Stop" }, { 0x46, "Move Saturation Up"
}, { 0x47, "Move Saturation Down" }, { 0x48, "Step Saturation Up"
}, { 0x49, "Step Saturation Down" }, { 0x4A, "Move Color" },
{ 0x4B, "Step Color" }, { 0x50, "Lock Door" }, { 0x51, "Unlock Door"
}, { 0x60, "Press 1 of 1" }, { 0x61, "Release 1 of 1" }, { 0x62
, "Press 1 of 2" }, { 0x63, "Release 1 of 2" }, { 0x64, "Press 2 of 2"
}, { 0x65, "Release 2 of 2" }, { 0x66, "Short press 1 of 1" }
, { 0x67, "Short press 1 of 2" }, { 0x68, "Short press 2 of 2"
}, { 0xA0, "Attribute reporting" }, { 0xA1, "Manufacturer-specific attribute reporting"
}, { 0xA2, "Multi-cluster reporting" }, { 0xA3, "Manufacturer-specific multi-cluster reporting"
}, { 0xA4, "Request Attributes" }, { 0xA5, "Read Attributes Response"
}, { 0xA6, "ZCL Tunneling" }, { 0xA8, "Compact Attribute Reporting"
}, { 0xAF, "Any GPD sensor command (0xA0 - 0xA3)" }, { 0xE0,
"Commissioning" }, { 0xE1, "Decommissioning" }, { 0xE2, "Success"
}, { 0xE3, "Channel Request" }, { 0xE4, "Application Description"
}, { 0xF0, "Commissioning Reply" }, { 0xF1, "Write Attributes"
}, { 0xF2, "Read Attributes" }, { 0xF3, "Channel Configuration"
}, { 0, ((void*)0) } }
;
535value_string_ext zbee_nwk_gp_cmd_names_ext = VALUE_STRING_EXT_INIT(zbee_nwk_gp_cmd_names){ _try_val_to_str_ext_init, 0, (sizeof (zbee_nwk_gp_cmd_names
) / sizeof ((zbee_nwk_gp_cmd_names)[0]))-1, zbee_nwk_gp_cmd_names
, "zbee_nwk_gp_cmd_names", ((void*)0) }
;
536
537
538/* Green Power devices. */
539const value_string zbee_nwk_gp_device_ids_names[] = {
540
541 /* GP GENERIC */
542 { GPD_DEVICE_ID_GENERIC_GP_SIMPLE_GENERIC_1STATE_SWITCH0x00, "Generic: GP Simple Generic 1-state Switch" },
543 { GPD_DEVICE_ID_GENERIC_GP_SIMPLE_GENERIC_2STATE_SWITCH0x01, "Generic: GP Simple Generic 2-state Switch" },
544 { GPD_DEVICE_ID_GENERIC_GP_ON_OFF_SWITCH0x02, "Generic: GP On/Off Switch" },
545 { GPD_DEVICE_ID_GENERIC_GP_LEVEL_CONTROL_SWITCH0x03, "Generic: GP Level Control Switch" },
546 { GPD_DEVICE_ID_GENERIC_GP_SIMPLE_SENSOR0x04, "Generic: GP Simple Sensor" },
547 { GPD_DEVICE_ID_GENERIC_GP_ADVANCED_GENERIC_1STATE_SWITCH0x05, "Generic: GP Advanced Generic 1-state Switch" },
548 { GPD_DEVICE_ID_GENERIC_GP_ADVANCED_GENERIC_2STATE_SWITCH0x06, "Generic: GP Advanced Generic 2-state Switch" },
549
550 /* GP LIGHTING */
551 { GPD_DEVICE_ID_LIGHTING_GP_COLOR_DIMMER_SWITCH0x10, "Lighting: GP Color Dimmer Switch" },
552 { GPD_DEVICE_ID_LIGHTING_GP_LIGHT_SENSOR0x11, "Lighting: GP Light Sensor" },
553 { GPD_DEVICE_ID_LIGHTING_GP_OCCUPANCY_SENSOR0x12, "Lighting: GP Occupancy Sensor" },
554
555 /* GP CLOSURES */
556 { GPD_DEVICE_ID_CLOSURES_GP_DOOR_LOCK_CONTROLLER0x20, "Closures: GP Door Lock Controller" },
557
558 /* HVAC */
559 { GPD_DEVICE_ID_HVAC_GP_TEMPERATURE_SENSOR0x30, "HVAC: GP Temperature Sensor" },
560 { GPD_DEVICE_ID_HVAC_GP_PRESSURE_SENSOR0x31, "HVAC: GP Pressure Sensor" },
561 { GPD_DEVICE_ID_HVAC_GP_FLOW_SENSOR0x32, "HVAC: GP Flow Sensor" },
562 { GPD_DEVICE_ID_HVAC_GP_INDOOR_ENVIRONMENT_SENSOR0x33, "HVAC: GP Indoor Environment Sensor" },
563
564 /* CUSTOM */
565 { GPD_DEVICE_ID_MANUFACTURER_SPECIFIC0xFE, "Manufacturer Specific" },
566
567 { 0, NULL((void*)0) }
568};
569static value_string_ext zbee_nwk_gp_device_ids_names_ext = VALUE_STRING_EXT_INIT(zbee_nwk_gp_device_ids_names){ _try_val_to_str_ext_init, 0, (sizeof (zbee_nwk_gp_device_ids_names
) / sizeof ((zbee_nwk_gp_device_ids_names)[0]))-1, zbee_nwk_gp_device_ids_names
, "zbee_nwk_gp_device_ids_names", ((void*)0) }
;
570
571/* GP directions. */
572static const value_string zbee_nwk_gp_directions[] = {
573 { ZBEE_NWK_GP_FC_EXT_DIRECTION_FROM_ZGPD0x00, "From ZGPD" },
574 { ZBEE_NWK_GP_FC_EXT_DIRECTION_FROM_ZGPP0x01, "From ZGPP" },
575
576 { 0, NULL((void*)0) }
577};
578
579/* Frame types for Green Power profile. */
580static const value_string zbee_nwk_gp_frame_types[] = {
581 { ZBEE_NWK_GP_FCF_DATA0x00, "Data" },
582 { ZBEE_NWK_GP_FCF_MAINTENANCE0x01, "Maintenance" },
583
584 { 0, NULL((void*)0) }
585};
586
587/* GreenPeak Green Power devices. */
588static const value_string zbee_nwk_gp_manufacturer_greenpeak_dev_names[] = {
589 { ZBEE_NWK_GP_MANUF_GREENPEAK_IZDS0x0000, "IAS Zone Door Sensor" },
590 { ZBEE_NWK_GP_MANUF_GREENPEAK_IZDWS0x0001, "IAS Zone Door/Window Sensor" },
591 { ZBEE_NWK_GP_MANUF_GREENPEAK_IZLS0x0002, "IAS Zone Leakage Sensor" },
592 { ZBEE_NWK_GP_MANUF_GREENPEAK_IZRHS0x0003, "IAS Zone Relative Humidity Sensor" },
593
594 { 0, NULL((void*)0) }
595};
596
597/* GP Generic switch type names. */
598static const value_string zbee_nwk_gp_switch_type_names[] = {
599 { 0x00, "Unknown: exact configuration apart from number of contacts unknown" },
600 { 0x01, "Button switch" },
601 { 0x02, "Rocker switch" },
602 { 0x03, "Reserved" },
603
604 { 0, NULL((void*)0) }
605};
606
607/* GP Src ID names. */
608static const value_string zbee_nwk_gp_src_id_names[] = {
609 { ZBEE_NWK_GP_ZGPD_SRCID_ALL0xFFFFFFFF, "All" },
610 { ZBEE_NWK_GP_ZGPD_SRCID_UNKNOWN0x00000000, "Unspecified" },
611
612 { 0, NULL((void*)0) }
613};
614
615/* GP security key type names. */
616static const value_string zbee_nwk_gp_src_sec_keys_type_names[] = {
617 { ZBEE_NWK_GP_SECURITY_KEY_TYPE_NO_KEY0x00, "No key" },
618 { ZBEE_NWK_GP_SECURITY_KEY_TYPE_ZB_NWK_KEY0x01, "ZigBee NWK key" },
619 { ZBEE_NWK_GP_SECURITY_KEY_TYPE_GPD_GROUP_KEY0x02, "GPD group key" },
620 { ZBEE_NWK_GP_SECURITY_KEY_TYPE_NWK_KEY_DERIVED_GPD_KEY_GROUP_KEY0x03, "NWK key derived GPD group key" },
621 { ZBEE_NWK_GP_SECURITY_KEY_TYPE_PRECONFIGURED_INDIVIDUAL_GPD_KEY0x04, "Individual, out of the box GPD key" },
622 { ZBEE_NWK_GP_SECURITY_KEY_TYPE_DERIVED_INDIVIDUAL_GPD_KEY0x07, "Derived individual GPD key" },
623
624 { 0, NULL((void*)0) }
625};
626
627/* GP security levels. */
628static const value_string zbee_nwk_gp_src_sec_levels_names[] = {
629 { ZBEE_NWK_GP_SECURITY_LEVEL_NO0x00, "No security" },
630 { ZBEE_NWK_GP_SECURITY_LEVEL_1LSB0x01, "1 LSB of frame counter and short MIC only" },
631 { ZBEE_NWK_GP_SECURITY_LEVEL_FULL0x02, "Full frame counter and full MIC only" },
632 { ZBEE_NWK_GP_SECURITY_LEVEL_FULLENCR0x03, "Encryption with full frame counter and full MIC" },
633
634 { 0, NULL((void*)0) }
635};
636
637/*************************/
638/* Function definitions. */
639/*************************/
640
641/* UAT record copy callback. */
642static void *
643uat_key_record_copy_cb(void *n, const void *o, size_t siz _U___attribute__((unused)))
644{
645 uat_key_record_t *new_key = (uat_key_record_t *)n;
646 const uat_key_record_t *old_key = (const uat_key_record_t *)o;
647
648 new_key->string = g_strdup(old_key->string)g_strdup_inline (old_key->string);
649 new_key->label = g_strdup(old_key->label)g_strdup_inline (old_key->label);
650
651 return new_key;
652}
653
654/* UAT record free callback. */
655static void
656uat_key_record_free_cb(void *r)
657{
658 uat_key_record_t *key = (uat_key_record_t *)r;
659 g_free(key->string)(__builtin_object_size ((key->string), 0) != ((size_t) - 1
)) ? g_free_sized (key->string, __builtin_object_size ((key
->string), 0)) : (g_free) (key->string)
;
660 g_free(key->label)(__builtin_object_size ((key->label), 0) != ((size_t) - 1)
) ? g_free_sized (key->label, __builtin_object_size ((key->
label), 0)) : (g_free) (key->label)
;
661}
662
663/**
664 *Parses a key string from left to right into a buffer with increasing (normal byte order) or decreasing (reverse
665 *
666 *@param key_str pointer to the string
667 *@param key_buf destination buffer in memory
668 *@param byte_order byte order
669*/
670static bool_Bool
671zbee_gp_security_parse_key(const char *key_str, uint8_t *key_buf, bool_Bool byte_order)
672{
673 bool_Bool string_mode = false0;
674 char temp;
675 int i, j;
676
677 memset(key_buf, 0, ZBEE_SEC_CONST_KEYSIZE16);
678 if (key_str == NULL((void*)0)) {
679 return false0;
680 }
681 if ((temp = *key_str++) == '"') {
682 string_mode = true1;
683 temp = *key_str++;
684 }
685 j = byte_order ? ZBEE_SEC_CONST_KEYSIZE16 - 1 : 0;
686 for (i = ZBEE_SEC_CONST_KEYSIZE16 - 1; i >= 0; i--) {
687 if (string_mode) {
688 if (g_ascii_isprint(temp)((g_ascii_table[(guchar) (temp)] & G_ASCII_PRINT) != 0)) {
689 key_buf[j] = temp;
690 temp = *key_str++;
691 } else {
692 return false0;
693 }
694 } else {
695 if ((temp == ':') || (temp == '-') || (temp == ' ')) {
696 temp = *(key_str++);
697 }
698 if (g_ascii_isxdigit(temp)((g_ascii_table[(guchar) (temp)] & G_ASCII_XDIGIT) != 0)) {
699 key_buf[j] = g_ascii_xdigit_value(temp) << 4;
700 } else {
701 return false0;
702 }
703 temp = *(key_str++);
704 if (g_ascii_isxdigit(temp)((g_ascii_table[(guchar) (temp)] & G_ASCII_XDIGIT) != 0)) {
705 key_buf[j] |= g_ascii_xdigit_value(temp);
706 } else {
707 return false0;
708 }
709 temp = *(key_str++);
710 }
711 if (byte_order) {
712 j--;
713 } else {
714 j++;
715 }
716 }
717 return true1;
718}
719
720/* UAT record update callback. */
721static bool_Bool
722uat_key_record_update_cb(void *r, char **err)
723{
724 uat_key_record_t *rec = (uat_key_record_t *)r;
725
726 if (rec->string == NULL((void*)0)) {
727 *err = g_strdup("Key can't be blank.")g_strdup_inline ("Key can't be blank.");
728 return false0;
729 } else {
730 g_strstrip(rec->string)g_strchomp (g_strchug (rec->string));
731 if (rec->string[0] != 0) {
732 *err = NULL((void*)0);
733 if (!zbee_gp_security_parse_key(rec->string, rec->key, rec->byte_order)) {
734 *err = ws_strdup_printf("Expecting %d hexadecimal bytes or a %d character double-quoted string",wmem_strdup_printf(((void*)0), "Expecting %d hexadecimal bytes or a %d character double-quoted string"
, 16, 16)
735 ZBEE_SEC_CONST_KEYSIZE, ZBEE_SEC_CONST_KEYSIZE)wmem_strdup_printf(((void*)0), "Expecting %d hexadecimal bytes or a %d character double-quoted string"
, 16, 16)
;
736 return false0;
737 }
738 } else {
739 *err = g_strdup("Key can't be blank.")g_strdup_inline ("Key can't be blank.");
740 return false0;
741 }
742 }
743 return true1;
744}
745
746static void uat_key_record_post_update_cb(void) {
747 unsigned i;
748
749 for (i = 0; i < num_uat_key_records; i++) {
750 if (memcmp(gp_uat_key_records[i].key, empty_key, ZBEE_SEC_CONST_KEYSIZE16) == 0) {
751 /* key was not loaded from string yet */
752 zbee_gp_security_parse_key(gp_uat_key_records[i].string, gp_uat_key_records[i].key,
753 gp_uat_key_records[i].byte_order);
754 }
755 }
756}
757
758/**
759 *Fills in ZigBee GP security nonce from the provided packet structure.
760 *
761 *@param packet ZigBee NWK packet.
762 *@param nonce nonce buffer.
763*/
764static void
765zbee_gp_make_nonce(zbee_nwk_green_power_packet *packet, uint8_t *nonce)
766{
767 memset(nonce, 0, ZBEE_SEC_CONST_NONCE_LEN(16 -2 -1));
768
769 /* Source address */
770 if (packet->application_id == ZBEE_NWK_GP_APP_ID_DEFAULT0x00)
771 {
772 if (packet->direction == ZBEE_NWK_GP_FC_EXT_DIRECTION_FROM_ZGPD0x00) {
773 phtoleu32(nonce, packet->source_id);
774 }
775 phtoleu32(nonce+4, packet->source_id);
776 }
777 else if (packet->application_id == ZBEE_NWK_GP_APP_ID_ZGP0x02)
778 {
779 phtoleu64(nonce, packet->ieee_packet_src64);
780 }
781
782 /* Frame counter */
783 phtoleu32(nonce+8, packet->security_frame_counter);
784
785 /* Security control */
786 if ((packet->application_id == ZBEE_NWK_GP_APP_ID_ZGP0x02) &&
787 (packet->direction != ZBEE_NWK_GP_FC_EXT_DIRECTION_FROM_ZGPD0x00)) {
788 nonce[12] = (char)0xc5; /* Security level = 0b101, Key Identifier = 0x00,
789 Extended nonce = 0b0, Reserved = 0b00 */
790 } else {
791 nonce[12] = (char)0x05; /* Security level = 0b101, Key Identifier = 0x00,
792 Extended nonce = 0b0, Reserved = 0b11 */
793 }
794}
795
796/**
797 *Creates a nonce and decrypts secured ZigBee GP payload.
798 *
799 *@param packet ZigBee NWK packet.
800 *@param enc_buffer encoded payload buffer.
801 *@param offset payload offset.
802 *@param dec_buffer decoded payload buffer.
803 *@param payload_len payload length.
804 *@param mic_len MIC length.
805 *@param key key.
806*/
807static bool_Bool
808zbee_gp_decrypt_payload(zbee_nwk_green_power_packet *packet, const uint8_t *enc_buffer, const unsigned offset, uint8_t
809 *dec_buffer, unsigned payload_len, unsigned mic_len, uint8_t *key)
810{
811 uint8_t *key_buffer = key;
812 uint8_t nonce[ZBEE_SEC_CONST_NONCE_LEN(16 -2 -1)];
813
814 zbee_gp_make_nonce(packet, nonce);
815 if (zbee_sec_ccm_decrypt(key_buffer, nonce, enc_buffer, enc_buffer + offset, dec_buffer, offset, payload_len,
816 mic_len)) {
817 return true1;
818 }
819
820 return false0;
821}
822
823/**
824 *Dissector for ZigBee Green Power commissioning.
825 *
826 *@param tvb pointer to buffer containing raw packet.
827 *@param pinfo pointer to packet information fields.
828 *@param tree pointer to data tree Wireshark uses to display packet.
829 *@param packet packet data.
830 *@param offset current payload offset.
831 *@return payload processed offset.
832*/
833static unsigned
834dissect_zbee_nwk_gp_cmd_commissioning(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
835 zbee_nwk_green_power_packet *packet, unsigned offset)
836{
837 uint8_t comm_options;
838 uint8_t comm_ext_options = 0;
839 uint8_t appli_info_options = 0;
840 uint16_t manufacturer_id = 0;
841
842 uint8_t i;
843 uint8_t gpd_cmd_num = 0;
844 proto_item *gpd_cmd_list;
845 proto_tree *gpd_cmd_list_tree;
846
847 uint8_t length_of_clid_list_bm;
848 uint8_t server_clid_num;
849 uint8_t client_clid_num;
850 proto_item *server_clid_list, *client_clid_list;
851 proto_tree *server_clid_list_tree, *client_clid_list_tree;
852 uint8_t switch_info_length;
853 proto_item *switch_info;
854 proto_tree *switch_info_tree;
855
856 void *enc_buffer;
857 uint8_t *enc_buffer_withA;
858 uint8_t *dec_buffer;
859 bool_Bool gp_decrypted;
860 GSList *GSList_i;
861 tvbuff_t *payload_tvb;
862
863 static int * const options[] = {
864 &hf_zbee_nwk_gp_cmd_comm_opt_mac_sec_num_cap,
865 &hf_zbee_nwk_gp_cmd_comm_opt_rx_on_cap,
866 &hf_zbee_nwk_gp_cmd_comm_opt_appli_info_present,
867 &hf_zbee_nwk_gp_cmd_comm_opt_panid_req,
868 &hf_zbee_nwk_gp_cmd_comm_opt_sec_key_req,
869 &hf_zbee_nwk_gp_cmd_comm_opt_fixed_location,
870 &hf_zbee_nwk_gp_cmd_comm_opt_ext_opt,
871 NULL((void*)0)
872 };
873 static int * const ext_options[] = {
874 &hf_zbee_nwk_gp_cmd_comm_ext_opt_sec_level_cap,
875 &hf_zbee_nwk_gp_cmd_comm_ext_opt_key_type,
876 &hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_present,
877 &hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_encr,
878 &hf_zbee_nwk_gp_cmd_comm_ext_opt_outgoing_counter,
879 NULL((void*)0)
880 };
881 static int * const appli_info[] = {
882 &hf_zbee_nwk_gp_cmd_comm_appli_info_mip,
883 &hf_zbee_nwk_gp_cmd_comm_appli_info_mmip,
884 &hf_zbee_nwk_gp_cmd_comm_appli_info_gclp,
885 &hf_zbee_nwk_gp_cmd_comm_appli_info_crp,
886 &hf_zbee_nwk_gp_cmd_comm_appli_info_sip,
887 &hf_zbee_nwk_gp_cmd_comm_appli_info_adcf,
888 &hf_zbee_nwk_gp_cmd_comm_appli_info_res,
889 NULL((void*)0)
890 };
891 static int * const length_of_clid_list[] = {
892 &hf_zbee_nwk_gp_cmd_comm_length_of_clid_list_server,
893 &hf_zbee_nwk_gp_cmd_comm_length_of_clid_list_client,
894 NULL((void*)0)
895 };
896 static int * const generic_switch_config[] = {
897 &hf_zbee_nwk_gp_cmd_comm_switch_info_num_contacts,
898 &hf_zbee_nwk_gp_cmd_comm_switch_info_switch_type,
899 &hf_zbee_nwk_gp_cmd_comm_switch_info_reserved,
900 NULL((void*)0)
901 };
902
903 /* Get Device ID and display it. */
904 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_device_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
905 offset += 1;
906 /* Get Options Field, build subtree and display the results. */
907 comm_options = tvb_get_uint8(tvb, offset);
908 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_comm_opt, ett_zbee_nwk_cmd_options, options, ENC_NA0x00000000);
909 offset += 1;
910
911 if (comm_options & ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_EXT_OPTIONS0x80) {
912 /* Get extended Options Field, build subtree and display the results. */
913 comm_ext_options = tvb_get_uint8(tvb, offset);
914 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_comm_ext_opt, ett_zbee_nwk_cmd_options, ext_options, ENC_NA0x00000000);
915 offset += 1;
916 if (comm_ext_options & ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_GPD_KEY_PRESENT0x20) {
917 /* Get security key and display it. */
918 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_security_key, tvb, offset, ZBEE_SEC_CONST_KEYSIZE16, ENC_NA0x00000000);
919 offset += ZBEE_SEC_CONST_KEYSIZE16;
920
921 /* Key is encrypted */
922 if (comm_ext_options & ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_GPD_KEY_ENCR0x40) {
923 /* Get Security MIC and display it. */
924 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_gpd_sec_key_mic, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000);
925 offset += 4;
926
927 if (packet != NULL((void*)0))
928 {
929 /* Decrypt the security key */
930 dec_buffer = (uint8_t *)wmem_alloc(pinfo->pool, ZBEE_SEC_CONST_KEYSIZE16);
931 enc_buffer_withA = (uint8_t *)wmem_alloc(pinfo->pool, 4 + ZBEE_SEC_CONST_KEYSIZE16 + 4); /* CCM* a (this is SrcID) + encKey + MIC */
932 enc_buffer = tvb_memdup(pinfo->pool, tvb, offset - ZBEE_SEC_CONST_KEYSIZE16 - 4, ZBEE_SEC_CONST_KEYSIZE16 + 4);
933 phtoleu32(enc_buffer_withA, packet->source_id);
934 memcpy(enc_buffer_withA+4, enc_buffer, ZBEE_SEC_CONST_KEYSIZE16 + 4);
935 gp_decrypted = false0;
936
937 for (GSList_i = zbee_gp_keyring; GSList_i && !gp_decrypted; GSList_i = g_slist_next(GSList_i)((GSList_i) ? (((GSList *)(GSList_i))->next) : ((void*)0))) {
938 packet->security_frame_counter = packet->source_id; /* for Nonce creation*/
939 gp_decrypted = zbee_gp_decrypt_payload(packet, enc_buffer_withA, 4
940 , dec_buffer, ZBEE_SEC_CONST_KEYSIZE16, 4, ((key_record_t *)(GSList_i->data))->key);
941 }
942
943 if (gp_decrypted) {
944 key_record_t key_record;
945
946 key_record.frame_num = 0;
947 key_record.label = NULL((void*)0);
948 memcpy(key_record.key, dec_buffer, ZBEE_SEC_CONST_KEYSIZE16);
949 zbee_gp_keyring = g_slist_prepend(zbee_gp_keyring, g_memdup2(&key_record, sizeof(key_record_t)));
950
951 payload_tvb = tvb_new_child_real_data(tvb, dec_buffer, ZBEE_SEC_CONST_KEYSIZE16, ZBEE_SEC_CONST_KEYSIZE16);
952 add_new_data_source(pinfo, payload_tvb, "Decrypted security key");
953 }
954 }
955 }
956 else
957 {
958 key_record_t key_record;
959 void *key;
960
961 key_record.frame_num = 0;
962 key_record.label = NULL((void*)0);
963 key = tvb_memdup(pinfo->pool, tvb, offset - ZBEE_SEC_CONST_KEYSIZE16, ZBEE_SEC_CONST_KEYSIZE16);
964 memcpy(key_record.key, key, ZBEE_SEC_CONST_KEYSIZE16);
965 zbee_gp_keyring = g_slist_prepend(zbee_gp_keyring, g_memdup2(&key_record, sizeof(key_record_t)));
966 }
967 }
968
969 if (comm_ext_options & ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_OUT_COUNTER0x80) {
970 /* Get GPD Outgoing Frame Counter and display it. */
971 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_outgoing_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000);
972 offset += 4;
973 }
974 }
975 /* Display manufacturer specific data. */
976 if (comm_options & ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_APPLICATION_INFO0x04) {
977 /* Display application information. */
978 appli_info_options = tvb_get_uint8(tvb, offset);
979 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_comm_appli_info, ett_zbee_nwk_cmd_appli_info, appli_info, ENC_NA0x00000000);
980 offset += 1;
981 if (appli_info_options & ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_MIP0x01) {
982 /* Get Manufacturer ID. */
983 proto_tree_add_item_ret_uint16(tree, hf_zbee_nwk_gp_cmd_comm_manufacturer_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &manufacturer_id);
984 offset += 2;
985 }
986 if (appli_info_options & ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_MMIP0x02) {
987 /* Get Manufacturer Device ID. */
988 switch (manufacturer_id) {
989 case ZBEE_NWK_GP_MANUF_ID_GREENPEAK0x10D0:
990 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_manufacturer_greenpeak_dev_id, tvb, offset, 2,
991 ENC_LITTLE_ENDIAN0x80000000);
992 offset += 2;
993 break;
994 default:
995 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_manufacturer_dev_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
996 offset += 2;
997 break;
998 }
999 }
1000 if (appli_info_options & ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_GCLP0x04) {
1001 /* Get and display number of GPD commands */
1002 proto_tree_add_item_ret_uint8(tree, hf_zbee_nwk_gp_cmd_comm_gpd_cmd_num, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000, &gpd_cmd_num);
1003 offset += 1;
1004 /* Display GPD command list */
1005 if (gpd_cmd_num > 0) {
1006 gpd_cmd_list = proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_gpd_cmd_id_list,
1007 tvb, offset, gpd_cmd_num, ENC_NA0x00000000);
1008 gpd_cmd_list_tree = proto_item_add_subtree(gpd_cmd_list, ett_zbee_nwk_cmd_comm_gpd_cmd_id_list);
1009 for (i = 0; i < gpd_cmd_num; i++, offset++) {
1010 /* Display command id */
1011 proto_tree_add_item(gpd_cmd_list_tree, hf_zbee_nwk_gp_command_id,
1012 tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1013 }
1014 }
1015 }
1016 if (appli_info_options & ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_CRP0x08) {
1017 /* Get and display Cluster List */
1018 length_of_clid_list_bm = tvb_get_uint8(tvb, offset);
1019 server_clid_num = (length_of_clid_list_bm & ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_SRV0x0F) >>
1020 ws_ctz(ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_SRV0x0F);
1021 client_clid_num = (length_of_clid_list_bm & ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_CLI0xF0 ) >>
1022 ws_ctz(ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_CLI0xF0);
1023
1024 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_comm_length_of_clid_list,
1025 ett_zbee_nwk_cmd_comm_length_of_clid_list, length_of_clid_list, ENC_NA0x00000000);
1026 offset += 1;
1027
1028 if (server_clid_num > 0) {
1029 /* Display server cluster list */
1030 server_clid_list = proto_tree_add_item(tree, hf_zbee_nwk_cmd_comm_clid_list_server,
1031 tvb, offset, 2*server_clid_num, ENC_NA0x00000000);
1032 server_clid_list_tree = proto_item_add_subtree(server_clid_list, ett_zbee_nwk_cmd_comm_clid_list_server);
1033 /* Retrieve server clusters */
1034 for (i = 0; i < server_clid_num; i++, offset += 2) {
1035 proto_tree_add_item(server_clid_list_tree, hf_zbee_nwk_cmd_comm_cluster_id,
1036 tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1037 }
1038 }
1039 if (client_clid_num > 0) {
1040 /* Display client cluster list */
1041 client_clid_list = proto_tree_add_item(tree, hf_zbee_nwk_cmd_comm_clid_list_client,
1042 tvb, offset, 2*client_clid_num, ENC_NA0x00000000);
1043 client_clid_list_tree = proto_item_add_subtree(client_clid_list, ett_zbee_nwk_cmd_comm_clid_list_client);
1044 /* Retrieve client clusters */
1045 for (i = 0; i < client_clid_num; i++, offset += 2) {
1046 proto_tree_add_item(client_clid_list_tree, hf_zbee_nwk_cmd_comm_cluster_id,
1047 tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1048 }
1049 }
1050 }
1051 if (appli_info_options & ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_SIP0x10) {
1052 /* Get and display Switch Information. */
1053 switch_info_length = tvb_get_uint8(tvb, offset);
1054 switch_info = proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_switch_info,
1055 tvb, offset, 1 + switch_info_length, ENC_NA0x00000000);
1056 switch_info_tree = proto_item_add_subtree(switch_info, ett_zbee_nwk_cmd_comm_switch_info);
1057 proto_tree_add_item(switch_info_tree, hf_zbee_nwk_gp_cmd_comm_switch_info_length,
1058 tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1059 offset += 1;
1060
1061 if (switch_info_length >= 1) {
1062 proto_tree_add_bitmask(switch_info_tree, tvb, offset,
1063 hf_zbee_nwk_gp_cmd_comm_switch_info_generic_switch_config,
1064 ett_zbee_nwk_cmd_comm_switch_info_generic_switch_config, generic_switch_config, ENC_NA0x00000000);
1065 offset += 1;
1066 }
1067
1068 if (switch_info_length >= ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_INFO_LEN0x02) {
1069 proto_tree_add_item(switch_info_tree,
1070 hf_zbee_nwk_gp_cmd_comm_switch_info_current_contact_status,
1071 tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1072 offset += 1;
1073 }
1074
1075 /* Guard against future spec revisions that may increase Switch info length beyond the currently defined value of 0x02. */
1076 if (switch_info_length > ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_INFO_LEN0x02) {
1077 offset += switch_info_length - ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_INFO_LEN0x02;
1078 }
1079 }
1080 }
1081 return offset;
1082} /* dissect_zbee_nwk_gp_cmd_commissioning */
1083
1084/**
1085 *Dissector for ZigBee Green Power channel request.
1086 *
1087 *@param tvb pointer to buffer containing raw packet.
1088 *@param pinfo pointer to packet information fields.
1089 *@param tree pointer to data tree Wireshark uses to display packet.
1090 *@param packet packet data.
1091 *@param offset current payload offset.
1092 *@return payload processed offset.
1093*/
1094static unsigned
1095dissect_zbee_nwk_gp_cmd_channel_request(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree,
1096 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset)
1097{
1098 static int * const channels[] = {
1099 &hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_1st,
1100 &hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_2nd,
1101 NULL((void*)0)
1102 };
1103
1104 /* Get Command Options Field, build subtree and display the results. */
1105 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour, ett_zbee_nwk_cmd_options, channels, ENC_NA0x00000000);
1106 offset += 1;
1107 return offset;
1108} /* dissect_zbee_nwk_gp_cmd_channel_request */
1109
1110/**
1111 * Dissector for ZigBee Green Power Application Description Attribute Records.
1112 *
1113 *@param tvb pointer to buffer containing raw packet.
1114 *@param pinfo pointer to packet information fields.
1115 *@param tree pointer to data tree Wireshark uses to display packet.
1116 *@param packet packet data.
1117 *@param offset current payload offset.
1118 *@param num_attr_recs number of attribute records to parse.
1119 *@return payload processed offset.
1120 */
1121static unsigned
1122dissect_zbee_nwk_gp_report_desc_attr_rec(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree,
1123 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset, unsigned num_attr_recs)
1124{
1125 uint8_t attr_rec_opt, len_remain;
1126 proto_tree *subtree = NULL((void*)0);
1127 unsigned i, end;
1128
1129 static int * const options[] = {
1130 &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_len_remain,
1131 &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_reported,
1132 &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_val_present,
1133 NULL((void*)0)
1134 };
1135
1136 for (i = 0; i < num_attr_recs; i++) {
1137 subtree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_zbee_nwk_cmd_app_desc_att_rec,
1138 NULL((void*)0), "Attribute Record %u", i);
1139
1140 /* Attribute ID */
1141 proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_attr_rec_id, tvb, offset,
1142 2, ENC_LITTLE_ENDIAN0x80000000);
1143 offset += 2;
1144
1145 /* Attribute Data Type */
1146 proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_attr_rec_data_type, tvb,
1147 offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1148 offset++;
1149
1150 /* Attribute Options */
1151 attr_rec_opt = tvb_get_uint8(tvb, offset);
1152 proto_tree_add_bitmask(subtree, tvb, offset, hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt,
1153 ett_zbee_nwk_cmd_options, options, ENC_NA0x00000000);
1154
1155 /* Extract remaining attribute record length (add 1 since stored value is decremented by 1) */
1156 len_remain = (attr_rec_opt & ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_LEN_REMAIN0x0F) + 1;
1157 offset++;
1158
1159 /* Determine the offset at the end of the packet so we can calculate the attribute value length later */
1160 end = offset + len_remain;
1161
1162 /* Attribute Offset within Report */
1163 if (attr_rec_opt & ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_REPORTED0x10) {
1164 proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_attr_rec_offset,
1165 tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1166 offset++;
1167 }
1168
1169 /* Optional Attribute Value */
1170 if (attr_rec_opt & ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_VAL_PRESENT0x20) {
1171 unsigned val_len = end - offset;
1172
1173 proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_attr_rec_val,
1174 tvb, offset, val_len, ENC_NA0x00000000);
1175 offset += val_len;
Value stored to 'offset' is never read
1176 }
1177 offset = end;
1178 }
1179
1180 return offset;
1181} /* dissect_zbee_nwk_gp_report_desc_attr_rec */
1182
1183/**
1184 * Dissector for ZigBee Green Power Application Description Data Point Descriptors.
1185 *
1186 *@param tvb pointer to buffer containing raw packet.
1187 *@param pinfo pointer to packet information fields.
1188 *@param tree pointer to data tree Wireshark uses to display packet.
1189 *@param packet packet data.
1190 *@param offset current payload offset.
1191 *@param len_remain remaining length of report descriptor containing data point descriptors
1192 *@return payload processed offset.
1193 */
1194static unsigned
1195dissect_zbee_nwk_gp_report_desc_data_pt_desc(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree,
1196 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset, uint8_t len_remain)
1197{
1198 uint8_t data_pt_opt, raw_recs;
1199 proto_item *ti, *opt_item;
1200 proto_tree *subtree, *mask_tree;
1201 unsigned i = 0;
1202 unsigned end = offset + len_remain;
1203 static int * const options[] = {
1204 /* We are manually adding the 'number of attribute records' field */
1205 &hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_server,
1206 &hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_manu_id_present,
1207 NULL((void*)0)
1208 };
1209
1210 while (offset < end)
1211 {
1212 unsigned start_offset = offset;
1213
1214 /* Create the container for this descriptor */
1215 subtree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_zbee_nwk_cmd_app_desc_data_pt_desc,
1216 &ti, "Data Point Descriptor %u", i++);
1217
1218 data_pt_opt = tvb_get_uint8(tvb, offset);
1219 raw_recs = data_pt_opt & ZBEE_NWK_GP_CMD_APP_DESC_DATA_PT_DESC_OPT_ATTR_NUM0x07;
1220
1221 /** Options */
1222 opt_item = proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt,
1223 tvb, offset, 1, ENC_NA0x00000000);
1224
1225 mask_tree = proto_item_add_subtree(opt_item, ett_zbee_nwk_cmd_app_desc_data_pt_options);
1226
1227 proto_tree_add_uint_format_value(mask_tree, hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_num_recs,
1228 tvb, offset, 1, raw_recs, "%u", raw_recs + 1);
1229
1230 proto_tree_add_bitmask_list(mask_tree, tvb, offset, 1, options, ENC_NA0x00000000);
1231
1232 offset++;
1233
1234 /* Cluster ID */
1235 proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_cluster_id,
1236 tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1237 offset += 2;
1238
1239 /* Optional Manufacturer ID */
1240 if (data_pt_opt & ZBEE_NWK_GP_CMD_APP_DESC_DATA_PT_DESC_OPT_MANU_ID_PRESENT0x10) {
1241 proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_manu_id,
1242 tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1243 offset += 2;
1244 }
1245
1246 /* Logic for the next function call remains the same */
1247 offset = dissect_zbee_nwk_gp_report_desc_attr_rec(tvb, pinfo, subtree, packet, offset, raw_recs + 1);
1248
1249 if (ti) {
1250 proto_item_set_len(ti, offset - start_offset);
1251 }
1252 }
1253
1254 return offset;
1255} /* dissect_zbee_nwk_gp_report_desc_data_pt_desc */
1256
1257/**
1258 * Dissector for ZigBee Green Power Application Description Report Descriptors.
1259 *
1260 *@param tvb pointer to buffer containing raw packet.
1261 *@param pinfo pointer to packet information fields.
1262 *@param tree pointer to data tree Wireshark uses to display packet.
1263 *@param packet packet data.
1264 *@param offset current payload offset.
1265 *@param num_reports number of report descriptors to parse.
1266 *@return payload processed offset.
1267 */
1268static unsigned
1269dissect_zbee_nwk_gp_report_desc(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree,
1270 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset, unsigned num_reports)
1271{
1272 uint8_t report_opt, len_remain;
1273 proto_tree *subtree = NULL((void*)0);
1274 unsigned i;
1275
1276 static int * const options[] = {
1277 &hf_zbee_nwk_gp_cmd_app_desc_report_desc_opt_timeout_present,
1278 NULL((void*)0)
1279 };
1280
1281 for (i = 0; i < num_reports; i++) {
1282 subtree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_zbee_nwk_cmd_app_desc_report_desc,
1283 NULL((void*)0), "Report Descriptor %u", i);
1284
1285 /* Report Identifier */
1286 proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_report_desc_id, tvb,
1287 offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1288 offset++;
1289
1290 /* Report Options */
1291 report_opt = tvb_get_uint8(tvb, offset);
1292 proto_tree_add_bitmask(subtree, tvb, offset, hf_zbee_nwk_gp_cmd_app_desc_report_desc_opt,
1293 ett_zbee_nwk_cmd_options, options, ENC_NA0x00000000);
1294 offset++;
1295
1296 /* Optional Timeout Period */
1297 if (report_opt & ZBEE_NWK_GP_CMD_APP_DESC_REPORT_DESC_OPT_TIMEOUT_PRESENT0x01) {
1298 proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_report_desc_timeout,
1299 tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1300 offset += 2;
1301 }
1302
1303 /* Remaining Length */
1304 len_remain = tvb_get_uint8(tvb, offset);
1305 proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_app_desc_report_desc_len_remain,
1306 tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1307 offset++;
1308
1309 /* Dissect the data point descriptors */
1310 offset = dissect_zbee_nwk_gp_report_desc_data_pt_desc(tvb, pinfo, subtree, packet, offset, len_remain);
1311 }
1312
1313 return offset;
1314} /* dissect_zbee_nwk_gp_report_desc */
1315
1316
1317/**
1318 * Dissector for ZigBee Green Power Application Description.
1319 *
1320 *@param tvb pointer to buffer containing raw packet.
1321 *@param pinfo pointer to packet information fields.
1322 *@param tree pointer to data tree Wireshark uses to display packet.
1323 *@param packet packet data.
1324 *@param offset current payload offset.
1325 *@return payload processed offset.
1326*/
1327static unsigned
1328dissect_zbee_nwk_gp_cmd_application_desc(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree,
1329 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset)
1330{
1331 uint8_t num_reports;
1332
1333 /* Total number of reports */
1334 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_app_desc_total_report, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1335 offset++;
1336
1337 /* Number of reports */
1338 proto_tree_add_item_ret_uint8(tree, hf_zbee_nwk_gp_cmd_app_desc_num_report, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000, &num_reports);
1339 offset++;
1340
1341 /* Dissect the report descriptors */
1342 offset = dissect_zbee_nwk_gp_report_desc(tvb, pinfo, tree, packet, offset, num_reports);
1343
1344 return offset;
1345} /* dissect_zbee_nwk_gp_cmd_application_desc */
1346
1347/**
1348 *Dissector for ZigBee Green Power channel configuration.
1349 *
1350 *@param tvb pointer to buffer containing raw packet.
1351 *@param pinfo pointer to packet information fields.
1352 *@param tree pointer to data tree Wireshark uses to display packet.
1353 *@param packet packet data.
1354 *@param offset current payload offset.
1355 *@return payload processed offset.
1356*/
1357static unsigned
1358dissect_zbee_nwk_gp_cmd_channel_configuration(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree,
1359 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset)
1360{
1361 static int * const channels[] = {
1362 &hf_zbee_nwk_gp_cmd_channel_configuration,
1363 NULL((void*)0)
1364 };
1365
1366 /* Get Command Options Field, build subtree and display the results. */
1367 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_operational_channel, ett_zbee_nwk_cmd_options, channels, ENC_NA0x00000000);
1368
1369 offset += 1;
1370 return offset;
1371} /* dissect_zbee_nwk_gp_cmd_channel_configuration */
1372
1373/**
1374 *Dissector for ZigBee Green Power commands attrib reporting.
1375 *
1376 *@param tvb pointer to buffer containing raw packet.
1377 *@param pinfo pointer to packet information fields.
1378 *@param tree pointer to data tree Wireshark uses to display packet.
1379 *@param packet packet data.
1380 *@param offset current payload offset.
1381 *@param mfr_code manufacturer code.
1382 *@return payload processed offset.
1383*/
1384static unsigned
1385dissect_zbee_nwk_gp_cmd_attr_reporting(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree,
1386 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset, uint16_t mfr_code)
1387{
1388 uint16_t cluster_id;
1389 proto_tree *field_tree;
1390
1391 /* Get cluster ID and add it into the tree. */
1392 proto_tree_add_item_ret_uint16(tree, hf_zbee_nwk_gp_zcl_attr_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &cluster_id);
1393
1394 offset += 2;
1395 /* Create subtree and parse ZCL Write Attribute Payload. */
1396 field_tree = proto_tree_add_subtree_format(tree, tvb, offset, 2, ett_zbee_nwk_cmd_options, NULL((void*)0),
1397 "Attribute reporting command for cluster: 0x%04X", cluster_id);
1398
1399 dissect_zcl_report_attr(tvb, pinfo, field_tree, &offset, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT0x01);
1400
1401 return offset;
1402} /* dissect_zbee_nwk_gp_cmd_attr_reporting */
1403
1404
1405/**
1406 * Dissector for ZigBee Green Power manufacturer specific attribute reporting.
1407 *
1408 *@param tvb pointer to buffer containing raw packet.
1409 *@param pinfo pointer to packet information fields.
1410 *@param tree pointer to data tree Wireshark uses to display packet.
1411 *@param packet packet data.
1412 *@param offset current payload offset.
1413 *@return payload processed offset.
1414 */
1415static unsigned
1416dissect_zbee_nwk_gp_cmd_MS_attr_reporting(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree,
1417 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset)
1418{
1419 uint16_t mfr_code;
1420
1421 /*dissect manufacturer ID*/
1422 proto_tree_add_item_ret_uint16(tree, hf_zbee_zcl_gp_cmd_ms_manufacturer_code, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &mfr_code);
1423 offset += 2;
1424
1425 offset = dissect_zbee_nwk_gp_cmd_attr_reporting(tvb, pinfo, tree, packet, offset, mfr_code);
1426
1427 return offset;
1428}/*dissect_zbee_nwk_gp_cmd_MS_attr_reporting*/
1429
1430
1431
1432
1433/**
1434 *Dissector for ZigBee Green Power commissioning reply.
1435 *
1436 *@param tvb pointer to buffer containing raw packet.
1437 *@param pinfo pointer to packet information fields.
1438 *@param tree pointer to data tree Wireshark uses to display packet.
1439 *@param packet packet data.
1440 *@param offset current payload offset.
1441 *@return payload processed offset.
1442*/
1443static unsigned
1444dissect_zbee_nwk_gp_cmd_commissioning_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1445 zbee_nwk_green_power_packet *packet, unsigned offset)
1446{
1447 uint8_t cr_options;
1448 uint8_t cr_sec_level;
1449
1450 void *enc_buffer;
1451 uint8_t *enc_buffer_withA;
1452 uint8_t *dec_buffer;
1453 bool_Bool gp_decrypted;
1454 GSList *GSList_i;
1455 tvbuff_t *payload_tvb;
1456
1457 static int * const options[] = {
1458 &hf_zbee_nwk_gp_cmd_comm_rep_opt_panid_present,
1459 &hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_key_present,
1460 &hf_zbee_nwk_gp_cmd_comm_rep_opt_key_encr,
1461 &hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_level,
1462 &hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_type,
1463 NULL((void*)0)
1464 };
1465
1466 /* Get Options Field, build subtree and display the results. */
1467 cr_options = tvb_get_uint8(tvb, offset);
1468 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_comm_rep_opt, ett_zbee_nwk_cmd_options, options, ENC_NA0x00000000);
1469 offset += 1;
1470
1471 /* Parse and display security Pan ID value. */
1472 if (cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_PAN_ID_PRESENT0x01) {
1473 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_rep_pan_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1474 offset += 2;
1475 }
1476
1477 cr_sec_level = (cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_LEVEL0x18) >>
1478 ws_ctz(ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_LEVEL0x18);
1479
1480 /* Parse and display security key. */
1481 if (cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_KEY_PRESENT0x02) {
1482 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_security_key, tvb, offset, ZBEE_SEC_CONST_KEYSIZE16, ENC_NA0x00000000);
1483 offset += ZBEE_SEC_CONST_KEYSIZE16;
1484
1485 /* Key is present clear, add to the key ring */
1486 if (!(cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_KEY_ENCR0x04)) {
1487 key_record_t key_record;
1488 void *key;
1489
1490 key_record.frame_num = 0;
1491 key_record.label = NULL((void*)0);
1492 key = tvb_memdup(pinfo->pool, tvb, offset - ZBEE_SEC_CONST_KEYSIZE16, ZBEE_SEC_CONST_KEYSIZE16);
1493 memcpy(key_record.key, key, ZBEE_SEC_CONST_KEYSIZE16);
1494 zbee_gp_keyring = g_slist_prepend(zbee_gp_keyring, g_memdup2(&key_record, sizeof(key_record_t)));
1495 }
1496 }
1497 /* Parse and display security MIC. */
1498 if ((cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_KEY_ENCR0x04) &&
1499 (cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_KEY_PRESENT0x02)) {
1500 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_gpd_sec_key_mic, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000);
1501 offset += 4;
1502 }
1503
1504 /* Parse and display Frame Counter and decrypt key */
1505 if ((cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_KEY_ENCR0x04) &&
1506 (cr_options & ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_KEY_PRESENT0x02) &&
1507 ((cr_sec_level == ZBEE_NWK_GP_SECURITY_LEVEL_FULL0x02) ||
1508 (cr_sec_level == ZBEE_NWK_GP_SECURITY_LEVEL_FULLENCR0x03))) {
1509 if (offset + 4 <= tvb_captured_length(tvb)){
1510 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_comm_rep_frame_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000);
1511 offset += 4;
1512
1513 if (packet != NULL((void*)0))
1514 {
1515 /* decrypt the security key*/
1516 dec_buffer = (uint8_t *)wmem_alloc(pinfo->pool, ZBEE_SEC_CONST_KEYSIZE16);
1517 enc_buffer_withA = (uint8_t *)wmem_alloc(pinfo->pool, 4 + ZBEE_SEC_CONST_KEYSIZE16 + 4); /* CCM* a (this is SrcID) + encKey + MIC */
1518 enc_buffer = tvb_memdup(pinfo->pool, tvb, offset - ZBEE_SEC_CONST_KEYSIZE16 - 4 - 4, ZBEE_SEC_CONST_KEYSIZE16 + 4);
1519 phtoleu32(enc_buffer_withA, packet->source_id); /* enc_buffer_withA = CCM* a (srcID) | enc_buffer */
1520 memcpy(enc_buffer_withA+4, enc_buffer, ZBEE_SEC_CONST_KEYSIZE16 + 4);
1521 gp_decrypted = false0;
1522
1523 for (GSList_i = zbee_gp_keyring; GSList_i && !gp_decrypted; GSList_i = g_slist_next(GSList_i)((GSList_i) ? (((GSList *)(GSList_i))->next) : ((void*)0))) {
1524 packet->security_frame_counter = tvb_get_uint32(tvb, offset - 4, ENC_LITTLE_ENDIAN0x80000000); /*for Nonce creation */
1525 gp_decrypted = zbee_gp_decrypt_payload(packet, enc_buffer_withA, 4
1526 , dec_buffer, ZBEE_SEC_CONST_KEYSIZE16, 4, ((key_record_t *)(GSList_i->data))->key);
1527 }
1528
1529 if (gp_decrypted) {
1530 key_record_t key_record;
1531
1532 key_record.frame_num = 0;
1533 key_record.label = NULL((void*)0);
1534 memcpy(key_record.key, dec_buffer, ZBEE_SEC_CONST_KEYSIZE16);
1535 zbee_gp_keyring = g_slist_prepend(zbee_gp_keyring, g_memdup2(&key_record, sizeof(key_record_t)));
1536
1537 payload_tvb = tvb_new_child_real_data(tvb, dec_buffer, ZBEE_SEC_CONST_KEYSIZE16, ZBEE_SEC_CONST_KEYSIZE16);
1538 add_new_data_source(pinfo, payload_tvb, "Decrypted security key");
1539 }
1540 }
1541 }
1542 else{
1543 /* This field is new in 2016 specification, older implementation may exist without it */
1544 proto_tree_add_expert_remaining(tree, pinfo, &ei_zbee_nwk_gp_com_rep_no_out_cnt, tvb, 0);
1545 }
1546 }
1547 return offset;
1548} /* dissect_zbee_nwk_gp_cmd_commissioning_reply */
1549
1550/**
1551 * Dissector for ZigBee Green Power read attributes and request attributes commands.
1552 *
1553 *@param tvb pointer to buffer containing raw packet.
1554 *@param pinfo pointer to packet information fields.
1555 *@param tree pointer to data tree Wireshark uses to display packet.
1556 *@param packet packet data.
1557 *@param offset current payload offset.
1558 *@return payload processed offset.
1559 */
1560static unsigned
1561dissect_zbee_nwk_gp_cmd_read_attributes(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree,
1562 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset)
1563{
1564 uint8_t cr_options = 0;
1565 proto_tree *subtree = NULL((void*)0);
1566 uint16_t cluster_id;
1567 uint16_t mfr_code = ZBEE_MFG_CODE_NONE0x0000;
1568 uint8_t record_list_len;
1569 unsigned tvb_len;
1570 uint8_t i;
1571
1572 static int * const options[] = {
1573 &hf_zbee_nwk_gp_cmd_read_att_opt_multi_rec,
1574 &hf_zbee_nwk_gp_cmd_read_att_opt_man_field_present,
1575 NULL((void*)0)
1576 };
1577
1578 /* Get Options Field, build subtree and display the results. */
1579 cr_options = tvb_get_uint8(tvb, offset);
1580 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_read_att_opt, ett_zbee_nwk_cmd_options, options, ENC_NA0x00000000);
1581
1582 offset += 1;
1583 /* Parse and display manufacturer ID value. */
1584 if (cr_options & ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MAN_FIELD_PRESENT0x02) {
1585 proto_tree_add_item_ret_uint16(tree, hf_zbee_zcl_gp_cmd_ms_manufacturer_code, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &mfr_code);
1586 offset += 2;
1587 }
1588
1589 tvb_len = tvb_captured_length(tvb);
1590 while (offset < tvb_len)
1591 {
1592 /* Create subtree and parse attributes list. */
1593 subtree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_zbee_nwk_clu_rec, NULL((void*)0), "Cluster Record Request");
1594
1595 /* Get cluster ID and add it into the subtree. */
1596 proto_tree_add_item_ret_uint16(subtree, hf_zbee_nwk_gp_zcl_attr_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &cluster_id);
1597 offset += 2;
1598 /* Get length of record list (number of attributes * 2). */
1599 proto_tree_add_item_ret_uint8(subtree, hf_zbee_nwk_gp_cmd_read_att_record_len, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000, &record_list_len);
1600 offset += 1;
1601
1602 for(i=0 ; i<record_list_len ; i+=2)
1603 {
1604 /* Dissect the attribute identifier */
1605 dissect_zcl_attr_id(tvb, subtree, &offset, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT0x01);
1606 }
1607 }
1608 return offset;
1609} /* dissect_zbee_nwk_gp_cmd_read_attributes */
1610/**
1611 * Dissector for ZigBee Green Power write attributes commands.
1612 *
1613 *@param tvb pointer to buffer containing raw packet.
1614 *@param pinfo pointer to packet information fields.
1615 *@param tree pointer to data tree Wireshark uses to display packet.
1616 *@param packet packet data.
1617 *@param offset current payload offset.
1618 *@return payload processed offset.
1619 */
1620static unsigned
1621dissect_zbee_nwk_gp_cmd_write_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1622 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset)
1623{
1624 uint8_t cr_options = 0;
1625 proto_tree *subtree = NULL((void*)0);
1626 proto_tree *att_tree = NULL((void*)0);
1627 uint16_t mfr_code = ZBEE_MFG_CODE_NONE0x0000;
1628 uint16_t cluster_id;
1629 uint8_t record_list_len;
1630 unsigned tvb_len;
1631 uint16_t attr_id;
1632 unsigned end_byte;
1633 //uint8_t i;
1634
1635 static int * const options[] = {
1636 &hf_zbee_nwk_gp_cmd_read_att_opt_multi_rec,
1637 &hf_zbee_nwk_gp_cmd_read_att_opt_man_field_present,
1638 NULL((void*)0)
1639 };
1640
1641 /* Get Options Field, build subtree and display the results. */
1642 cr_options = tvb_get_uint8(tvb, offset);
1643 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_read_att_opt, ett_zbee_nwk_cmd_options, options, ENC_NA0x00000000);
1644
1645 offset += 1;
1646 /* Parse and display manufacturer ID value. */
1647 if (cr_options & ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MAN_FIELD_PRESENT0x02) {
1648 proto_tree_add_item_ret_uint16(tree, hf_zbee_zcl_gp_cmd_ms_manufacturer_code, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &mfr_code);
1649 offset += 2;
1650 }
1651
1652 tvb_len = tvb_captured_length(tvb);
1653 while (offset < tvb_len)
1654 {
1655 /* Create subtree and parse attributes list. */
1656 subtree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_zbee_nwk_clu_rec, NULL((void*)0), "Write Cluster Record");
1657
1658 /* Get cluster ID and add it into the subtree. */
1659 proto_tree_add_item_ret_uint16(subtree, hf_zbee_nwk_gp_zcl_attr_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &cluster_id);
1660 offset += 2;
1661 /* Get length of record list. */
1662 record_list_len = tvb_get_uint8(tvb, offset);
1663 proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_read_att_record_len, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1664 offset += 1;
1665
1666 end_byte = offset + record_list_len;
1667 while ( offset < end_byte)
1668 {
1669 /* Create subtree for attribute status field */
1670 att_tree = proto_tree_add_subtree_format(subtree, tvb, offset, 0, ett_zbee_nwk_att_rec, NULL((void*)0), "Write Attribute record");
1671
1672 /* Dissect the attribute identifier */
1673 attr_id = tvb_get_letohs(tvb, offset);
1674 dissect_zcl_attr_id(tvb, att_tree, &offset, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT0x01);
1675
1676 /* Dissect the attribute data type and data */
1677 dissect_zcl_attr_data_type_val(tvb, pinfo, att_tree, &offset, attr_id, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT0x01);
1678 }
1679 }
1680 return offset;
1681} /* dissect_zbee_nwk_gp_cmd_write_attributes */
1682
1683
1684/**
1685 * Dissector for ZigBee Green Power read attribute response command.
1686 *
1687 *@param tvb pointer to buffer containing raw packet.
1688 *@param pinfo pointer to packet information fields.
1689 *@param tree pointer to data tree Wireshark uses to display packet.
1690 *@param packet packet data.
1691 *@param offset current payload offset.
1692 *@return payload processed offset.
1693 */
1694static unsigned
1695dissect_zbee_nwk_gp_cmd_read_attributes_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1696 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset)
1697{
1698 uint8_t cr_options;
1699 proto_tree *subtree = NULL((void*)0);
1700 proto_tree *att_tree = NULL((void*)0);
1701 uint16_t cluster_id;
1702 uint16_t attr_id;
1703 uint16_t mfr_code = ZBEE_MFG_CODE_NONE0x0000;
1704 uint8_t record_list_len;
1705 unsigned tvb_len;
1706 unsigned end_byte;
1707
1708 static int * const options[] = {
1709 &hf_zbee_nwk_gp_cmd_read_att_opt_multi_rec,
1710 &hf_zbee_nwk_gp_cmd_read_att_opt_man_field_present,
1711 NULL((void*)0)
1712 };
1713
1714 /* Get Options Field, build subtree and display the results. */
1715 cr_options = tvb_get_uint8(tvb, offset);
1716 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_read_att_opt, ett_zbee_nwk_cmd_options, options, ENC_NA0x00000000);
1717 offset += 1;
1718
1719 /* Parse and display manufacturer ID value. */
1720 if (cr_options & ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MAN_FIELD_PRESENT0x02) {
1721 proto_tree_add_item_ret_uint16(tree, hf_zbee_zcl_gp_cmd_ms_manufacturer_code, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &mfr_code);
1722 offset += 2;
1723 }
1724
1725 tvb_len = tvb_captured_length(tvb);
1726 while (offset < tvb_len)
1727 {
1728 /* Create subtree and parse attributes list. */
1729 subtree = proto_tree_add_subtree_format(tree, tvb, offset,0, ett_zbee_nwk_clu_rec, NULL((void*)0), "Cluster record");
1730
1731 /* Get cluster ID and add it into the subtree. */
1732 proto_tree_add_item_ret_uint16(subtree, hf_zbee_nwk_gp_zcl_attr_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &cluster_id);
1733 offset += 2;
1734 /* Get length of record list in bytes. */
1735 record_list_len = tvb_get_uint8(tvb, offset);
1736 proto_tree_add_item(subtree, hf_zbee_nwk_gp_cmd_read_att_record_len, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1737 offset += 1;
1738
1739 end_byte = offset + record_list_len;
1740 while ( offset < end_byte)
1741 {
1742 /* Create subtree for attribute status field */
1743 /* TODO ett_ could be an array to permit not to unroll all always */
1744 att_tree = proto_tree_add_subtree_format(subtree, tvb, offset, 0, ett_zbee_nwk_att_rec, NULL((void*)0), "Read Attribute record");
1745
1746 /* Dissect the attribute identifier */
1747 attr_id = tvb_get_letohs(tvb, offset);
1748 dissect_zcl_attr_id(tvb, att_tree, &offset, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT0x01);
1749
1750 /* Dissect the status and optionally the data type and value */
1751 if (dissect_zcl_attr_uint8(tvb, att_tree, &offset, &hf_zbee_nwk_gp_zcl_attr_status)
1752 == ZBEE_ZCL_STAT_SUCCESS0x00)
1753 {
1754 /* Dissect the attribute data type and data */
1755 dissect_zcl_attr_data_type_val(tvb, pinfo, att_tree, &offset, attr_id, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT0x01);
1756 }
1757 else
1758 {
1759 /* Data type field is always present (not like in ZCL read attribute response command) */
1760 dissect_zcl_attr_data(tvb, pinfo, att_tree, &offset,
1761 dissect_zcl_attr_uint8(tvb, att_tree, &offset, &hf_zbee_nwk_gp_zcl_attr_data_type), ZBEE_ZCL_FCF_TO_CLIENT0x01 );
1762 }
1763 }
1764 }
1765 return offset;
1766} /* dissect_zbee_nwk_gp_cmd_read_attributes_response */
1767
1768/**
1769 * Dissector for ZigBee Green Power ZCL tunneling command.
1770 *
1771 *@param tvb pointer to buffer containing raw packet.
1772 *@param pinfo pointer to packet information fields.
1773 *@param tree pointer to data tree Wireshark uses to display packet.
1774 *@param packet packet data.
1775 *@param offset current payload offset.
1776 *@return payload processed offset.
1777 */
1778static unsigned
1779dissect_zbee_nwk_gp_cmd_zcl_tunneling(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree,
1780 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset)
1781{
1782 uint8_t tun_options;
1783
1784 static int * const options[] = {
1785 &hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_frame_type,
1786 &hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_man_field_present,
1787 &hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_direction,
1788 NULL((void*)0)
1789 };
1790
1791 /* Get Options Field, build subtree and display the results. */
1792 tun_options = tvb_get_uint8(tvb, offset);
1793 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_nwk_gp_cmd_zcl_tunnel_opt, ett_zbee_nwk_cmd_options, options, ENC_NA0x00000000);
1794 offset += 1;
1795
1796 /* Parse and display manufacturer ID value. */
1797 if (tun_options & ZBEE_NWK_GP_CMD_ZCL_TUNNEL_OPT_MAN_FIELD_PRESENT0x04) {
1798 proto_tree_add_item(tree, hf_zbee_zcl_gp_cmd_ms_manufacturer_code, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1799 offset += 2;
1800 }
1801
1802 proto_tree_add_item(tree, hf_zbee_nwk_gp_zcl_attr_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1803 offset += 2;
1804
1805 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_zcl_tunnel_command_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1806 offset += 1;
1807
1808 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_zcl_tunnel_payload_len, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1809 offset += 1;
1810
1811 /* We're not parsing the ZCL payload, as it's non-trivial and will require a lot of refactoring of the
1812 * ZCL data parsers to make work. For now, let it just show up as raw data. */
1813
1814 return offset;
1815} /* dissect_zbee_nwk_gp_cmd_zcl_tunneling */
1816
1817/**
1818 * Dissector for ZigBee Green Power Compact Attribute Reporting command.
1819 *
1820 *@param tvb pointer to buffer containing raw packet.
1821 *@param pinfo pointer to packet information fields.
1822 *@param tree pointer to data tree Wireshark uses to display packet.
1823 *@param packet packet data.
1824 *@param offset current payload offset.
1825 *@return payload processed offset.
1826 */
1827static unsigned
1828dissect_zbee_nwk_gp_cmd_compact_attr_report(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree,
1829 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset)
1830{
1831 int len_remaining;
1832
1833 /* Report Identifier */
1834 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_compact_attr_report_report_id, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1835 offset++;
1836
1837 /* Data points */
1838 len_remaining = tvb_reported_length_remaining(tvb, offset);
1839 if (len_remaining > 0) {
1840 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_compact_attr_report_data_points,
1841 tvb, offset, len_remaining, ENC_NA0x00000000);
1842 offset += len_remaining;
1843 }
1844
1845 return offset;
1846} /* dissect_zbee_nwk_gp_cmd_compact_attr_report */
1847
1848/**
1849 *Dissector for ZigBee Green Power multi-cluster reporting command.
1850 *
1851 *@param tvb pointer to buffer containing raw packet.
1852 *@param pinfo pointer to packet information fields.
1853 *@param tree pointer to data tree Wireshark uses to display packet.
1854 *@param packet packet data.
1855 *@param offset current payload offset.
1856 *@param mfr_code manufacturer code.
1857 *@return payload processed offset.
1858 */
1859static unsigned
1860dissect_zbee_nwk_gp_cmd_multi_cluster_reporting(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree,
1861 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset, uint16_t mfr_code)
1862{
1863 proto_tree *subtree = NULL((void*)0);
1864 uint16_t cluster_id;
1865 uint16_t attr_id;
1866 unsigned tvb_len;
1867
1868 tvb_len = tvb_captured_length(tvb);
1869 while (offset < tvb_len)
1870 {
1871 /* Create subtree and parse attributes list. */
1872 subtree = proto_tree_add_subtree_format(tree, tvb, offset, 0, ett_zbee_nwk_clu_rec, NULL((void*)0), "Cluster record"); //TODO for cluster %% blabla
1873
1874 /* Get cluster ID and add it into the subtree. */
1875 proto_tree_add_item_ret_uint16(subtree, hf_zbee_nwk_gp_zcl_attr_cluster_id, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &cluster_id);
1876 offset += 2;
1877
1878 /* Dissect the attribute identifier */
1879 attr_id = tvb_get_letohs(tvb, offset);
1880 dissect_zcl_attr_id(tvb, subtree, &offset, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT0x01);
1881
1882 /* Dissect the attribute data type and data */
1883 dissect_zcl_attr_data_type_val(tvb, pinfo, subtree, &offset, attr_id, cluster_id, mfr_code, ZBEE_ZCL_FCF_TO_CLIENT0x01);
1884 // TODO how to dissect when data type is different from expected one for this attribute ? this shouldn't happen
1885 }
1886 return offset;
1887} /* dissect_zbee_nwk_gp_cmd_multi_cluster_reporting */
1888
1889
1890/**
1891 *Dissector for ZigBee Green Power commands manufacturer specific attrib reporting.
1892 *
1893 *@param tvb pointer to buffer containing raw packet.
1894 *@param pinfo pointer to packet information fields.
1895 *@param tree pointer to data tree Wireshark uses to display packet.
1896 *@param packet packet data.
1897 *@param offset current payload offset.
1898 *@return payload processed offset.
1899 */
1900static unsigned
1901dissect_zbee_nwk_gp_cmd_MS_multi_cluster_reporting(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree,
1902 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset)
1903{
1904 uint16_t mfr_code;
1905
1906 /*dissect manufacturer ID*/
1907 proto_tree_add_item_ret_uint16(tree, hf_zbee_zcl_gp_cmd_ms_manufacturer_code, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000, &mfr_code);
1908 offset += 2;
1909
1910 offset = dissect_zbee_nwk_gp_cmd_multi_cluster_reporting(tvb, pinfo, tree, packet, offset, mfr_code);
1911
1912 return offset;
1913}/*dissect_zbee_nwk_gp_cmd_MS_multi_cluster_reporting*/
1914
1915/**
1916 *Dissector for ZigBee Green Power Move Color.
1917 *
1918 *@param tvb pointer to buffer containing raw packet.
1919 *@param pinfo pointer to packet information fields.
1920 *@param tree pointer to data tree Wireshark uses to display packet.
1921 *@param packet packet data.
1922 *@param offset current payload offset.
1923 *@return payload processed offset.
1924*/
1925static unsigned
1926dissect_zbee_nwk_gp_cmd_move_color(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree,
1927 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset)
1928{
1929 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_move_color_ratex, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1930 offset += 2;
1931 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_move_color_ratey, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1932 offset += 2;
1933 return offset;
1934} /* dissect_zbee_nwk_gp_cmd_move_color */
1935
1936/**
1937 *Dissector for ZigBee Green Power Move Up/Down.
1938 *
1939 *@param tvb pointer to buffer containing raw packet.
1940 *@param pinfo pointer to packet information fields.
1941 *@param tree pointer to data tree Wireshark uses to display packet.
1942 *@param packet packet data.
1943 *@param offset current payload offset.
1944 *@return payload processed offset.
1945*/
1946static unsigned
1947dissect_zbee_nwk_gp_cmd_move_up_down(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree,
1948 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset)
1949{
1950 /* Optional rate field. */
1951 if (tvb_reported_length(tvb) - offset >= 1) {
1952 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_move_up_down_rate, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1953 offset += 1;
1954 }
1955 return offset;
1956} /* dissect_zbee_nwk_gp_cmd_move_up_down */
1957
1958/**
1959 *Dissector for ZigBee Green Power Step Color.
1960 *
1961 *@param tvb pointer to buffer containing raw packet.
1962 *@param pinfo pointer to packet information fields.
1963 *@param tree pointer to data tree Wireshark uses to display packet.
1964 *@param packet packet data.
1965 *@param offset current payload offset.
1966 *@return payload processed offset.
1967*/
1968static unsigned
1969dissect_zbee_nwk_gp_cmd_step_color(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree,
1970 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset)
1971{
1972 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_step_color_stepx, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1973 offset += 2;
1974 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_step_color_stepy, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1975 offset += 2;
1976 /* Optional time field. */
1977 if (tvb_reported_length(tvb) - offset >= 2) {
1978 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_step_color_transition_time, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1979 offset += 2;
1980 }
1981 return offset;
1982} /* dissect_zbee_nwk_gp_cmd_step_color */
1983
1984/**
1985 *Dissector for ZigBee Green Power Step Up/Down.
1986 *
1987 *@param tvb pointer to buffer containing raw packet.
1988 *@param pinfo pointer to packet information fields.
1989 *@param tree pointer to data tree Wireshark uses to display packet.
1990 *@param packet packet data.
1991 *@param offset current payload offset.
1992 *@return payload processed offset.
1993*/
1994static unsigned
1995dissect_zbee_nwk_gp_cmd_step_up_down(tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), proto_tree *tree,
1996 zbee_nwk_green_power_packet *packet _U___attribute__((unused)), unsigned offset)
1997{
1998 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_step_up_down_step_size, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
1999 offset += 1;
2000 /* Optional time field. */
2001 if (tvb_reported_length(tvb) - offset >= 2) {
2002 proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_step_up_down_transition_time, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
2003 offset += 2;
2004 }
2005 return offset;
2006} /* dissect_zbee_nwk_gp_cmd_step_up_down */
2007
2008/**
2009 *Dissector for ZigBee Green Power commands.
2010 *
2011 *@param tvb pointer to buffer containing raw packet.
2012 *@param pinfo pointer to packet information fields.
2013 *@param tree pointer to data tree Wireshark uses to display packet.
2014 *@param data raw packet private data.
2015 *@return payload processed offset
2016*/
2017static int
2018dissect_zbee_nwk_gp_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
2019{
2020 unsigned offset = 0;
2021 uint8_t cmd_id = tvb_get_uint8(tvb, offset);
2022 proto_item *cmd_root;
2023 proto_tree *cmd_tree;
2024 zbee_nwk_green_power_packet *packet = (zbee_nwk_green_power_packet *)data;
2025
2026 /* Create a subtree for the command. */
2027 cmd_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_zbee_nwk_cmd, &cmd_root,
2028 "Command Frame: %s", val_to_str_ext_const(cmd_id,
2029 &zbee_nwk_gp_cmd_names_ext,
2030 "Unknown Command Frame"));
2031 /* Add the command ID. */
2032 proto_tree_add_uint(cmd_tree, hf_zbee_nwk_gp_command_id, tvb, offset, 1, cmd_id);
2033
2034 offset += 1;
2035 /* Add the command name to the info column. */
2036 col_set_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(cmd_id, &zbee_nwk_gp_cmd_names_ext, "Unknown command"));
2037 /* Handle the command for one of the following devices:
2038 * - Door Lock Controller (IDs: 0x50 - 0x51);
2039 * - GP Flow Sensor (IDs: 0xE0, 0xA0 - 0xA3);
2040 * - GP Temperature Sensor (IDs: 0xE0, 0xA0 - 0xA3); */
2041 switch(cmd_id) {
2042 /* Payloadless GPDF commands sent by GPD. */
2043 case ZB_GP_CMD_ID_IDENTIFY:
2044 case ZB_GP_CMD_ID_RECALL_SCENE0:
2045 case ZB_GP_CMD_ID_RECALL_SCENE1:
2046 case ZB_GP_CMD_ID_RECALL_SCENE2:
2047 case ZB_GP_CMD_ID_RECALL_SCENE3:
2048 case ZB_GP_CMD_ID_RECALL_SCENE4:
2049 case ZB_GP_CMD_ID_RECALL_SCENE5:
2050 case ZB_GP_CMD_ID_RECALL_SCENE6:
2051 case ZB_GP_CMD_ID_RECALL_SCENE7:
2052 case ZB_GP_CMD_ID_STORE_SCENE0:
2053 case ZB_GP_CMD_ID_STORE_SCENE1:
2054 case ZB_GP_CMD_ID_STORE_SCENE2:
2055 case ZB_GP_CMD_ID_STORE_SCENE3:
2056 case ZB_GP_CMD_ID_STORE_SCENE4:
2057 case ZB_GP_CMD_ID_STORE_SCENE5:
2058 case ZB_GP_CMD_ID_STORE_SCENE6:
2059 case ZB_GP_CMD_ID_STORE_SCENE7:
2060 case ZB_GP_CMD_ID_OFF:
2061 case ZB_GP_CMD_ID_ON:
2062 case ZB_GP_CMD_ID_TOGGLE:
2063 case ZB_GP_CMD_ID_RELEASE:
2064 case ZB_GP_CMD_ID_LEVEL_CONTROL_STOP:
2065 case ZB_GP_CMD_ID_MOVE_HUE_STOP:
2066 case ZB_GP_CMD_ID_MOVE_SATURATION_STOP:
2067 case ZB_GP_CMD_ID_LOCK_DOOR:
2068 case ZB_GP_CMD_ID_UNLOCK_DOOR:
2069 case ZB_GP_CMD_ID_PRESS11:
2070 case ZB_GP_CMD_ID_RELEASE11:
2071 case ZB_GP_CMD_ID_PRESS12:
2072 case ZB_GP_CMD_ID_RELEASE12:
2073 case ZB_GP_CMD_ID_PRESS22:
2074 case ZB_GP_CMD_ID_RELEASE22:
2075 case ZB_GP_CMD_ID_SHORT_PRESS11:
2076 case ZB_GP_CMD_ID_SHORT_PRESS12:
2077 case ZB_GP_CMD_ID_SHORT_PRESS22:
2078 case ZB_GP_CMD_ID_DECOMMISSIONING:
2079 case ZB_GP_CMD_ID_SUCCESS:
2080 break;
2081 /* GPDF commands with payload sent by GPD. */
2082 case ZB_GP_CMD_ID_MOVE_UP:
2083 case ZB_GP_CMD_ID_MOVE_DOWN:
2084 case ZB_GP_CMD_ID_MOVE_UP_WITH_ON_OFF:
2085 case ZB_GP_CMD_ID_MOVE_DOWN_WITH_ON_OFF:
2086 case ZB_GP_CMD_ID_MOVE_HUE_UP:
2087 case ZB_GP_CMD_ID_MOVE_HUE_DOWN:
2088 case ZB_GP_CMD_ID_MOVE_SATURATION_UP:
2089 case ZB_GP_CMD_ID_MOVE_SATURATION_DOWN:
2090 offset = dissect_zbee_nwk_gp_cmd_move_up_down(tvb, pinfo, cmd_tree, packet, offset);
2091 break;
2092 case ZB_GP_CMD_ID_STEP_UP:
2093 case ZB_GP_CMD_ID_STEP_DOWN:
2094 case ZB_GP_CMD_ID_STEP_UP_WITH_ON_OFF:
2095 case ZB_GP_CMD_ID_STEP_DOWN_WITH_ON_OFF:
2096 case ZB_GP_CMD_ID_STEP_HUE_UP:
2097 case ZB_GP_CMD_ID_STEP_HUW_DOWN:
2098 case ZB_GP_CMD_ID_STEP_SATURATION_UP:
2099 case ZB_GP_CMD_ID_STEP_SATURATION_DOWN:
2100 offset = dissect_zbee_nwk_gp_cmd_step_up_down(tvb, pinfo, cmd_tree, packet, offset);
2101 break;
2102 case ZB_GP_CMD_ID_MOVE_COLOR:
2103 offset = dissect_zbee_nwk_gp_cmd_move_color(tvb, pinfo, cmd_tree, packet, offset);
2104 break;
2105 case ZB_GP_CMD_ID_STEP_COLOR:
2106 offset = dissect_zbee_nwk_gp_cmd_step_color(tvb, pinfo, cmd_tree, packet, offset);
2107 break;
2108 case ZB_GP_CMD_ID_ATTRIBUTE_REPORTING:
2109 offset = dissect_zbee_nwk_gp_cmd_attr_reporting(tvb, pinfo, cmd_tree, packet, offset, ZBEE_MFG_CODE_NONE0x0000);
2110 break;
2111 case ZB_GP_CMD_ID_MANUFACTURE_SPECIFIC_ATTR_REPORTING:
2112 offset = dissect_zbee_nwk_gp_cmd_MS_attr_reporting(tvb, pinfo, cmd_tree, packet, offset);
2113 break;
2114 case ZB_GP_CMD_ID_MULTI_CLUSTER_REPORTING:
2115 offset = dissect_zbee_nwk_gp_cmd_multi_cluster_reporting(tvb, pinfo, cmd_tree, packet, offset, ZBEE_MFG_CODE_NONE0x0000);
2116 break;
2117 case ZB_GP_CMD_ID_MANUFACTURER_SPECIFIC_MCLUSTER_REPORTING:
2118 offset = dissect_zbee_nwk_gp_cmd_MS_multi_cluster_reporting(tvb, pinfo, cmd_tree, packet, offset);
2119 break;
2120 case ZB_GP_CMD_ID_READ_ATTRIBUTES_RESPONSE:
2121 offset = dissect_zbee_nwk_gp_cmd_read_attributes_response(tvb, pinfo, cmd_tree, packet, offset);
2122 break;
2123 case ZB_GP_CMD_ID_ZCL_TUNNELING:
2124 offset = dissect_zbee_nwk_gp_cmd_zcl_tunneling(tvb, pinfo, cmd_tree, packet, offset);
2125 break;
2126 case ZB_GP_CMD_ID_COMPACT_ATTR_REPORT:
2127 offset = dissect_zbee_nwk_gp_cmd_compact_attr_report(tvb, pinfo, cmd_tree, packet, offset);
2128 break;
2129 case ZB_GP_CMD_ID_ANY_SENSOR_COMMAND_A0_A3:
2130 /* TODO: implement it. */
2131 break;
2132 case ZB_GP_CMD_ID_COMMISSIONING:
2133 offset = dissect_zbee_nwk_gp_cmd_commissioning(tvb, pinfo, cmd_tree, packet, offset);
2134 break;
2135 case ZB_GP_CMD_ID_CHANNEL_REQUEST:
2136 offset = dissect_zbee_nwk_gp_cmd_channel_request(tvb, pinfo, cmd_tree, packet, offset);
2137 break;
2138 case ZB_GP_CMD_ID_APPLICATION_DESC:
2139 offset = dissect_zbee_nwk_gp_cmd_application_desc(tvb, pinfo, cmd_tree, packet, offset);
2140 break;
2141 case ZB_GP_CMD_ID_REQUEST_ATTRIBUTES:
2142 /* GPDF commands sent to GPD. */
2143 case ZB_GP_CMD_ID_READ_ATTRIBUTES:
2144 offset = dissect_zbee_nwk_gp_cmd_read_attributes(tvb, pinfo, cmd_tree, packet, offset);
2145 break;
2146 case ZB_GP_CMD_ID_COMMISSIONING_REPLY:
2147 offset = dissect_zbee_nwk_gp_cmd_commissioning_reply(tvb, pinfo, cmd_tree, packet, offset);
2148 break;
2149 case ZB_GP_CMD_ID_WRITE_ATTRIBUTES:
2150 offset = dissect_zbee_nwk_gp_cmd_write_attributes(tvb, pinfo, cmd_tree, packet, offset);
2151 break;
2152 case ZB_GP_CMD_ID_CHANNEL_CONFIGURATION:
2153 offset = dissect_zbee_nwk_gp_cmd_channel_configuration(tvb, pinfo, cmd_tree, packet, offset);
2154 break;
2155 }
2156 if (offset < tvb_reported_length(tvb)) {
2157 /* There are leftover bytes! */
2158 proto_tree *root;
2159 tvbuff_t *leftover_tvb = tvb_new_subset_remaining(tvb, offset);
2160
2161 /* Correct the length of the command tree. */
2162 root = proto_tree_get_root(tree);
2163 proto_item_set_len(cmd_root, offset);
2164
2165 /* Dump the tail. */
2166 call_data_dissector(leftover_tvb, pinfo, root);
2167 }
2168 return offset;
2169} /* dissect_zbee_nwk_gp_cmd */
2170
2171/**
2172 *ZigBee NWK packet dissection routine for Green Power profile.
2173 *
2174 *@param tvb pointer to buffer containing raw packet.
2175 *@param pinfo pointer to packet information fields.
2176 *@param tree pointer to data tree Wireshark uses to display packet.
2177 *@param data raw packet private data.
2178*/
2179static int
2180dissect_zbee_nwk_gp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
2181{
2182 ieee802154_packet *ieee_packet = (ieee802154_packet *)data;
2183 bool_Bool gp_decrypted;
2184 GSList *GSList_i;
2185 unsigned offset = 0;
2186 uint8_t *dec_buffer;
2187 uint8_t *enc_buffer;
2188 uint8_t fcf;
2189 proto_tree *nwk_tree;
2190 proto_item *proto_root;
2191 proto_item *ti = NULL((void*)0);
2192 tvbuff_t *payload_tvb;
2193 zbee_nwk_green_power_packet packet;
2194 static int * const fields[] = {
2195 &hf_zbee_nwk_gp_frame_type,
2196 &hf_zbee_nwk_gp_proto_version,
2197 &hf_zbee_nwk_gp_auto_commissioning,
2198 &hf_zbee_nwk_gp_fc_ext,
2199 NULL((void*)0)
2200 };
2201 static int * const ext_fields[] = {
2202 &hf_zbee_nwk_gp_fc_ext_app_id,
2203 &hf_zbee_nwk_gp_fc_ext_sec_level,
2204 &hf_zbee_nwk_gp_fc_ext_sec_key,
2205 &hf_zbee_nwk_gp_fc_ext_rx_after_tx,
2206 &hf_zbee_nwk_gp_fc_ext_direction,
2207 NULL((void*)0)
2208 };
2209
2210 if (data == NULL((void*)0))
2211 return 0;
2212
2213 memset(&packet, 0, sizeof(packet));
2214 packet.ieee_packet_src64 = ieee_packet->src64;
2215 /* Add ourself to the protocol column, clear the info column and create the protocol tree. */
2216 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ZigBee Green Power");
2217 col_clear(pinfo->cinfo, COL_INFO);
2218
2219 proto_root = proto_tree_add_protocol_format(tree, proto_zbee_nwk_gp, tvb, offset, tvb_captured_length(tvb),
2220 "ZGP stub NWK header");
2221 nwk_tree = proto_item_add_subtree(proto_root, ett_zbee_nwk);
2222
2223 enc_buffer = (uint8_t *)tvb_memdup(pinfo->pool, tvb, 0, tvb_captured_length(tvb));
2224 /* Get and parse the FCF. */
2225 fcf = tvb_get_uint8(tvb, offset);
2226 packet.frame_type = zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_FRAME_TYPE0x03);
2227 packet.nwk_frame_control_extension = zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_CONTROL_EXTENSION0x80);
2228
2229 /* Display the FCF. */
2230 ti = proto_tree_add_bitmask(nwk_tree, tvb, offset, hf_zbee_nwk_gp_fcf, ett_zbee_nwk_fcf, fields, ENC_NA0x00000000);
2231 proto_item_append_text(ti, " %s", val_to_str_const(packet.frame_type, zbee_nwk_gp_frame_types, "Unknown Frame Type"));
2232 offset += 1;
2233
2234 /* Add the frame type to the info column and protocol root. */
2235 proto_item_append_text(proto_root, " %s", val_to_str_const(packet.frame_type, zbee_nwk_gp_frame_types, "Unknown type"));
2236 col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(packet.frame_type, zbee_nwk_gp_frame_types, "Reserved frame type"));
2237
2238 if (packet.nwk_frame_control_extension) {
2239 /* Display ext FCF. */
2240 fcf = tvb_get_uint8(tvb, offset);
2241 packet.application_id = zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_EXT_APP_ID0x07);
2242 packet.security_level = zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_EXT_SECURITY_LEVEL0x18);
2243 packet.direction = zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_EXT_DIRECTION0x80);
2244
2245 /* Create a subtree for the extended FCF. */
2246 proto_tree_add_bitmask(nwk_tree, tvb, offset, hf_zbee_nwk_gp_fc_ext_field, ett_zbee_nwk_fcf_ext, ext_fields, ENC_NA0x00000000);
2247 offset += 1;
2248 }
2249 if ((packet.frame_type == ZBEE_NWK_GP_FCF_DATA0x00 && !packet.nwk_frame_control_extension) || (packet.frame_type ==
2250 ZBEE_NWK_GP_FCF_DATA0x00 && packet.nwk_frame_control_extension && packet.application_id ==
2251 ZBEE_NWK_GP_APP_ID_DEFAULT0x00) || (packet.frame_type == ZBEE_NWK_GP_FCF_MAINTENANCE0x01 &&
2252 packet.nwk_frame_control_extension && packet.application_id == ZBEE_NWK_GP_APP_ID_DEFAULT0x00 && tvb_get_uint8(tvb,
2253 offset) != ZB_GP_CMD_ID_CHANNEL_CONFIGURATION)) {
2254 /* Display GPD Src ID. */
2255 packet.source_id = tvb_get_letohl(tvb, offset);
2256 proto_tree_add_item(nwk_tree, hf_zbee_nwk_gp_zgpd_src_id, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000);
2257 proto_item_append_text(proto_root, ", GPD Src ID: 0x%08x", packet.source_id);
2258
2259 col_append_fstr(pinfo->cinfo, COL_INFO, ", GPD Src ID: 0x%08x", packet.source_id);
2260
2261 col_clear(pinfo->cinfo, COL_DEF_SRC);
2262 col_append_fstr(pinfo->cinfo, COL_DEF_SRC, "0x%08x", packet.source_id);
2263
2264 offset += 4;
2265 }
2266 if (packet.application_id == ZBEE_NWK_GP_APP_ID_ZGP0x02) {
2267 /* Display GPD endpoint */
2268 packet.endpoint = tvb_get_uint8(tvb, offset);
2269 proto_tree_add_item(nwk_tree, hf_zbee_nwk_gp_zgpd_endpoint, tvb, offset, 1, ENC_LITTLE_ENDIAN0x80000000);
2270 proto_item_append_text(proto_root, ", Endpoint: %d", packet.endpoint);
2271
2272 col_append_fstr(pinfo->cinfo, COL_INFO, ", Endpoint: %d", packet.endpoint);
2273 offset += 1;
2274 }
2275 /* Display Security Frame Counter. */
2276 packet.mic_size = 0;
2277 if (packet.nwk_frame_control_extension) {
2278 if (packet.application_id == ZBEE_NWK_GP_APP_ID_DEFAULT0x00 || packet.application_id == ZBEE_NWK_GP_APP_ID_ZGP0x02
2279 || packet.application_id == ZBEE_NWK_GP_APP_ID_LPED0x01) {
2280 if (packet.security_level == ZBEE_NWK_GP_SECURITY_LEVEL_1LSB0x01
2281 && packet.application_id != ZBEE_NWK_GP_APP_ID_LPED0x01) {
2282 packet.mic_size = 2;
2283 } else if (packet.security_level == ZBEE_NWK_GP_SECURITY_LEVEL_FULL0x02 || packet.security_level ==
2284 ZBEE_NWK_GP_SECURITY_LEVEL_FULLENCR0x03) {
2285 /* Get Security Frame Counter and display it. */
2286 packet.mic_size = 4;
2287 packet.security_frame_counter = tvb_get_letohl(tvb, offset);
2288 proto_tree_add_item(nwk_tree, hf_zbee_nwk_gp_security_frame_counter, tvb, offset, 4,
2289 ENC_LITTLE_ENDIAN0x80000000);
2290 offset += 4;
2291 }
2292 }
2293 }
2294 /* Parse application payload. */
2295 /* This is a uint8_t, but tvb_reported_length might be larger; e.g.,
2296 * SCOP over TCP, presumably with errors. It's bogus either way; perhaps
2297 * we should warn.
2298 */
2299 packet.payload_len = tvb_reported_length(tvb) - offset - packet.mic_size;
2300 /* Ensure that the payload exists. */
2301 if (packet.payload_len <= 0) {
2302 proto_tree_add_expert_remaining(nwk_tree, pinfo, &ei_zbee_nwk_gp_no_payload, tvb, 0);
2303 return offset;
2304 }
2305 /* OK, payload exists. Parse MIC field if needed. */
2306 if (packet.mic_size == 2) {
2307 packet.mic = tvb_get_letohs(tvb, offset + packet.payload_len);
2308 } else if (packet.mic_size == 4) {
2309 packet.mic = tvb_get_letohl(tvb, offset + packet.payload_len);
2310 }
2311 /* Save packet private data. */
2312 data = (void *)&packet;
2313 payload_tvb = tvb_new_subset_length(tvb, offset, packet.payload_len);
2314 if (packet.security_level != ZBEE_NWK_GP_SECURITY_LEVEL_FULLENCR0x03) {
2315 dissect_zbee_nwk_gp_cmd(payload_tvb, pinfo, nwk_tree, data);
2316 }
2317 offset += packet.payload_len;
2318 /* Display MIC field. */
2319 if (packet.mic_size) {
2320 proto_tree_add_uint(nwk_tree, packet.mic_size == 4 ? hf_zbee_nwk_gp_security_mic_4b :
2321 hf_zbee_nwk_gp_security_mic_2b, tvb, offset, packet.mic_size, packet.mic);
2322 offset += packet.mic_size;
2323 }
2324 if ((offset < tvb_captured_length(tvb)) && (packet.security_level != ZBEE_NWK_GP_SECURITY_LEVEL_FULLENCR0x03)) {
2325 proto_tree_add_expert_remaining(nwk_tree, pinfo, &ei_zbee_nwk_gp_inval_residual_data, tvb, offset);
2326 return offset;
2327 }
2328 if (packet.security_level == ZBEE_NWK_GP_SECURITY_LEVEL_FULLENCR0x03) {
2329 gp_decrypted = false0;
2330
2331 if (tvb_captured_length(tvb) >= tvb_reported_length(tvb)) {
2332 dec_buffer = (uint8_t *)wmem_alloc(pinfo->pool, packet.payload_len);
2333 for (GSList_i = zbee_gp_keyring; GSList_i && !gp_decrypted; GSList_i = g_slist_next(GSList_i)((GSList_i) ? (((GSList *)(GSList_i))->next) : ((void*)0))) {
2334 gp_decrypted = zbee_gp_decrypt_payload(&packet, enc_buffer, offset - packet.payload_len -
2335 packet.mic_size, dec_buffer, packet.payload_len, packet.mic_size,
2336 ((key_record_t *)(GSList_i->data))->key);
2337 }
2338 }
2339
2340 if (gp_decrypted) {
2341 payload_tvb = tvb_new_child_real_data(tvb, dec_buffer, packet.payload_len, packet.payload_len);
2342 add_new_data_source(pinfo, payload_tvb, "Decrypted GP Payload");
2343 dissect_zbee_nwk_gp_cmd(payload_tvb, pinfo, nwk_tree, data);
2344 } else {
2345 payload_tvb = tvb_new_subset_length(tvb, offset - packet.payload_len - packet.mic_size, packet.payload_len);
2346 call_data_dissector(payload_tvb, pinfo, tree);
2347 }
2348 }
2349 return tvb_captured_length(tvb);
2350} /* dissect_zbee_nwk_gp */
2351
2352/**
2353 *Heuristic interpreter for the ZigBee Green Power dissectors.
2354 *
2355 *@param tvb pointer to buffer containing raw packet.
2356 *@param pinfo pointer to packet information fields.
2357 *@param tree pointer to data tree Wireshark uses to display packet.
2358 *@param data raw packet private data.
2359*/
2360static bool_Bool
2361dissect_zbee_nwk_heur_gp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
2362{
2363 ieee802154_packet *packet = (ieee802154_packet *)data;
2364 uint8_t fcf;
2365
2366 /* We must have the IEEE 802.15.4 headers. */
2367 if (packet == NULL((void*)0)) return false0;
2368
2369 /* If the frame type and version are not sane, then it's probably not ZGP. */
2370 fcf = tvb_get_uint8(tvb, 0);
2371 if (zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_VERSION0x3C) != ZBEE_VERSION_GREEN_POWER3) return false0;
2372 if (!try_val_to_str(zbee_get_bit_field(fcf, ZBEE_NWK_FCF_FRAME_TYPE0x0003), zbee_nwk_gp_frame_types)) return false0;
2373
2374 /* ZigBee greenpower frames are either sent to broadcast or the extended address. */
2375 if (packet->dst_addr_mode == IEEE802154_FCF_ADDR_SHORT0x2 && packet->dst16 == IEEE802154_BCAST_ADDR0xFFFF) {
2376 dissect_zbee_nwk_gp(tvb, pinfo, tree, data);
2377 return true1;
2378 }
2379 /* 64-bit destination addressing mode support. */
2380 if (packet->dst_addr_mode == IEEE802154_FCF_ADDR_EXT0x3) {
2381 dissect_zbee_nwk_gp(tvb, pinfo, tree, data);
2382 return true1;
2383 }
2384
2385 return false0;
2386} /* dissect_zbee_nwk_heur_gp */
2387
2388/**
2389 *Init routine for the ZigBee GP profile security.
2390 *
2391*/
2392static void
2393gp_init_zbee_security(void)
2394{
2395 unsigned i;
2396 key_record_t key_record;
2397
2398 for (i = 0; gp_uat_key_records && (i < num_uat_key_records); i++) {
2399 key_record.frame_num = 0;
2400 key_record.label = g_strdup(gp_uat_key_records[i].label)g_strdup_inline (gp_uat_key_records[i].label);
2401 memcpy(key_record.key, gp_uat_key_records[i].key, ZBEE_SEC_CONST_KEYSIZE16);
2402 zbee_gp_keyring = g_slist_prepend(zbee_gp_keyring, g_memdup2(&key_record, sizeof(key_record_t)));
2403 }
2404}
2405
2406static void zbee_free_key_record(void *ptr)
2407{
2408 key_record_t *k;
2409
2410 k = (key_record_t *)ptr;
2411 if (!k)
2412 return;
2413
2414 g_free(k->label)(__builtin_object_size ((k->label), 0) != ((size_t) - 1)) ?
g_free_sized (k->label, __builtin_object_size ((k->label
), 0)) : (g_free) (k->label)
;
2415 g_free(k)(__builtin_object_size ((k), 0) != ((size_t) - 1)) ? g_free_sized
(k, __builtin_object_size ((k), 0)) : (g_free) (k)
;
2416}
2417
2418static void
2419gp_cleanup_zbee_security(void)
2420{
2421 if (!zbee_gp_keyring)
2422 return;
2423
2424 g_slist_free_full(zbee_gp_keyring, zbee_free_key_record);
2425 zbee_gp_keyring = NULL((void*)0);
2426}
2427
2428/**
2429 *ZigBee NWK GP protocol registration routine.
2430 *
2431*/
2432void
2433proto_register_zbee_nwk_gp(void)
2434{
2435 module_t *gp_zbee_prefs;
2436 expert_module_t* expert_zbee_nwk_gp;
2437
2438 static hf_register_info hf[] = {
2439 { &hf_zbee_nwk_gp_auto_commissioning,
2440 { "Auto Commissioning", "zbee_nwk_gp.auto_commissioning", FT_BOOLEAN, 8, NULL((void*)0),
2441 ZBEE_NWK_GP_FCF_AUTO_COMMISSIONING0x40, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2442
2443 { &hf_zbee_nwk_gp_fc_ext,
2444 { "NWK Frame Extension", "zbee_nwk_gp.fc_extension", FT_BOOLEAN, 8, NULL((void*)0), ZBEE_NWK_GP_FCF_CONTROL_EXTENSION0x80,
2445 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2446
2447 { &hf_zbee_nwk_gp_fcf,
2448 { "Frame Control Field", "zbee_nwk_gp.fcf", FT_UINT8, BASE_HEX, NULL((void*)0),
2449 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2450
2451 { &hf_zbee_nwk_gp_frame_type,
2452 { "Frame Type", "zbee_nwk_gp.frame_type", FT_UINT8, BASE_HEX, VALS(zbee_nwk_gp_frame_types)((0 ? (const struct _value_string*)0 : ((zbee_nwk_gp_frame_types
))))
,
2453 ZBEE_NWK_GP_FCF_FRAME_TYPE0x03, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2454
2455 { &hf_zbee_nwk_gp_proto_version,
2456 { "Protocol Version", "zbee_nwk_gp.proto_version", FT_UINT8, BASE_DEC, NULL((void*)0), ZBEE_NWK_GP_FCF_VERSION0x3C, NULL((void*)0),
2457 HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2458
2459 { &hf_zbee_nwk_gp_fc_ext_field,
2460 { "Extended NWK Frame Control Field", "zbee_nwk_gp.fc_ext", FT_UINT8, BASE_HEX, NULL((void*)0),
2461 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2462
2463 { &hf_zbee_nwk_gp_fc_ext_app_id,
2464 { "Application ID", "zbee_nwk_gp.fc_ext_app_id", FT_UINT8, BASE_HEX, VALS(zbee_nwk_gp_app_id_names)((0 ? (const struct _value_string*)0 : ((zbee_nwk_gp_app_id_names
))))
,
2465 ZBEE_NWK_GP_FCF_EXT_APP_ID0x07, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2466
2467 { &hf_zbee_nwk_gp_fc_ext_direction,
2468 { "Direction", "zbee_nwk_gp.fc_ext_direction", FT_UINT8, BASE_HEX, VALS(zbee_nwk_gp_directions)((0 ? (const struct _value_string*)0 : ((zbee_nwk_gp_directions
))))
,
2469 ZBEE_NWK_GP_FCF_EXT_DIRECTION0x80, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2470
2471 { &hf_zbee_nwk_gp_fc_ext_rx_after_tx,
2472 { "Rx After Tx", "zbee_nwk_gp.fc_ext_rxaftertx", FT_BOOLEAN, 8, NULL((void*)0), ZBEE_NWK_GP_FCF_EXT_RX_AFTER_TX0x40, NULL((void*)0),
2473 HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2474
2475 { &hf_zbee_nwk_gp_fc_ext_sec_key,
2476 { "Security Key", "zbee_nwk_gp.fc_ext_security_key", FT_BOOLEAN, 8, NULL((void*)0), ZBEE_NWK_GP_FCF_EXT_SECURITY_KEY0x20,
2477 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2478
2479 { &hf_zbee_nwk_gp_fc_ext_sec_level,
2480 { "Security Level", "zbee_nwk_gp.fc_ext_security_level", FT_UINT8, BASE_HEX,
2481 VALS(zbee_nwk_gp_src_sec_levels_names)((0 ? (const struct _value_string*)0 : ((zbee_nwk_gp_src_sec_levels_names
))))
, ZBEE_NWK_GP_FCF_EXT_SECURITY_LEVEL0x18, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2482
2483 { &hf_zbee_nwk_gp_zgpd_src_id,
2484 { "Src ID", "zbee_nwk_gp.source_id", FT_UINT32, BASE_HEX, VALS(zbee_nwk_gp_src_id_names)((0 ? (const struct _value_string*)0 : ((zbee_nwk_gp_src_id_names
))))
, 0x0, NULL((void*)0),
2485 HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2486
2487 { &hf_zbee_nwk_gp_zgpd_endpoint,
2488 { "Endpoint", "zbee_nwk_gp.endpoint", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2489
2490 { &hf_zbee_nwk_gp_security_frame_counter,
2491 { "Security Frame Counter", "zbee_nwk_gp.security_frame_counter", FT_UINT32, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0),
2492 HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2493
2494 { &hf_zbee_nwk_gp_security_mic_2b,
2495 { "Security MIC", "zbee_nwk_gp.security_mic2", FT_UINT16, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2496
2497 { &hf_zbee_nwk_gp_security_mic_4b,
2498 { "Security MIC", "zbee_nwk_gp.security_mic4", FT_UINT32, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2499
2500 { &hf_zbee_nwk_gp_command_id,
2501 { "ZGPD Command ID", "zbee_nwk_gp.command_id", FT_UINT8, BASE_HEX | BASE_EXT_STRING0x00000200, &zbee_nwk_gp_cmd_names_ext, 0x0, NULL((void*)0),
2502 HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2503
2504 { &hf_zbee_nwk_gp_cmd_comm_device_id,
2505 { "ZGPD Device ID", "zbee_nwk_gp.cmd.comm.dev_id", FT_UINT8, BASE_HEX | BASE_EXT_STRING0x00000200, &zbee_nwk_gp_device_ids_names_ext,
2506 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2507
2508 { &hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_encr,
2509 { "GPD Key Encryption", "zbee_nwk_gp.cmd.comm.ext_opt.gpd_key_encr", FT_BOOLEAN, 8, NULL((void*)0),
2510 ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_GPD_KEY_ENCR0x40, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2511
2512 { &hf_zbee_nwk_gp_cmd_comm_ext_opt_gpd_key_present,
2513 { "GPD Key Present", "zbee_nwk_gp.cmd.comm.ext_opt.gpd_key_present", FT_BOOLEAN, 8, NULL((void*)0),
2514 ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_GPD_KEY_PRESENT0x20, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2515
2516 { &hf_zbee_nwk_gp_cmd_comm_ext_opt_key_type,
2517 { "Key Type", "zbee_nwk_gp.cmd.comm.ext_opt.key_type", FT_UINT8, BASE_HEX,
2518 VALS(zbee_nwk_gp_src_sec_keys_type_names)((0 ? (const struct _value_string*)0 : ((zbee_nwk_gp_src_sec_keys_type_names
))))
, ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_KEY_TYPE0x1C, NULL((void*)0),
2519 HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2520
2521 { &hf_zbee_nwk_gp_cmd_comm_outgoing_counter,
2522 { "GPD Outgoing Counter", "zbee_nwk_gp.cmd.comm.out_counter", FT_UINT32, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0),
2523 HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2524
2525 { &hf_zbee_nwk_gp_cmd_comm_ext_opt_sec_level_cap,
2526 { "Security Level Capabilities", "zbee_nwk_gp.cmd.comm.ext_opt.seclevel_cap", FT_UINT8, BASE_HEX, NULL((void*)0),
2527 ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_SEC_LEVEL_CAP0x03, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2528
2529 { &hf_zbee_nwk_gp_cmd_comm_security_key,
2530 { "Security Key", "zbee_nwk_gp.cmd.comm.security_key", FT_BYTES, BASE_NONE, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2531
2532 { &hf_zbee_nwk_gp_cmd_comm_gpd_sec_key_mic,
2533 { "GPD Key MIC", "zbee_nwk_gp.cmd.comm.gpd_key_mic", FT_UINT32, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2534
2535 { &hf_zbee_nwk_gp_cmd_comm_opt_ext_opt,
2536 { "Extended Option Field", "zbee_nwk_gp.cmd.comm.opt.ext_opt_field", FT_BOOLEAN, 8, NULL((void*)0),
2537 ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_EXT_OPTIONS0x80, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2538
2539 { &hf_zbee_nwk_gp_cmd_comm_opt,
2540 { "Options Field", "zbee_nwk_gp.cmd.comm.opt", FT_UINT8, BASE_HEX, NULL((void*)0),
2541 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2542
2543 { &hf_zbee_nwk_gp_cmd_comm_opt_fixed_location,
2544 { "Fixed Location", "zbee_nwk_gp.cmd.comm.opt.fixed_location", FT_BOOLEAN, 8, NULL((void*)0),
2545 ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_FIXED_LOCATION0x40, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2546
2547 { &hf_zbee_nwk_gp_cmd_comm_opt_mac_sec_num_cap,
2548 { "MAC Sequence number capability", "zbee_nwk_gp.cmd.comm.opt.mac_seq_num_cap", FT_BOOLEAN, 8, NULL((void*)0),
2549 ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_MAC_SEQ0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2550
2551 { &hf_zbee_nwk_gp_cmd_comm_opt_appli_info_present,
2552 { "Application information present", "zbee_nwk_gp.cmd.comm.opt.appli_info_present", FT_BOOLEAN, 8, NULL((void*)0),
2553 ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_APPLICATION_INFO0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2554
2555 { &hf_zbee_nwk_gp_cmd_comm_opt_panid_req,
2556 { "PANId request", "zbee_nwk_gp.cmd.comm.opt.panid_req", FT_BOOLEAN, 8, NULL((void*)0),
2557 ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_PAN_ID_REQ0x10, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2558
2559 { &hf_zbee_nwk_gp_cmd_comm_opt_rx_on_cap,
2560 { "RxOnCapability", "zbee_nwk_gp.cmd.comm.opt.rxon_cap", FT_BOOLEAN, 8, NULL((void*)0),
2561 ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_RX_ON_CAP0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2562
2563 { &hf_zbee_nwk_gp_cmd_comm_opt_sec_key_req,
2564 { "GP Security Key Request", "zbee_nwk_gp.cmd.comm.opt.seq_key_req", FT_BOOLEAN, 8, NULL((void*)0),
2565 ZBEE_NWK_GP_CMD_COMMISSIONING_OPT_GP_SEC_KEY_REQ0x20, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2566
2567 { &hf_zbee_nwk_gp_cmd_comm_ext_opt,
2568 { "Extended Options Field", "zbee_nwk_gp.cmd.comm.ext_opt", FT_UINT8, BASE_HEX, NULL((void*)0),
2569 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2570
2571 { &hf_zbee_nwk_gp_cmd_comm_ext_opt_outgoing_counter,
2572 { "GPD Outgoing present", "zbee_nwk_gp.cmd.comm.ext_opt.outgoing_counter", FT_BOOLEAN, 8, NULL((void*)0),
2573 ZBEE_NWK_GP_CMD_COMMISSIONING_EXT_OPT_OUT_COUNTER0x80, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2574
2575 { &hf_zbee_nwk_gp_cmd_comm_manufacturer_greenpeak_dev_id,
2576 { "Manufacturer Model ID", "zbee_nwk_gp.cmd.comm.manufacturer_model_id", FT_UINT16, BASE_HEX,
2577 VALS(zbee_nwk_gp_manufacturer_greenpeak_dev_names)((0 ? (const struct _value_string*)0 : ((zbee_nwk_gp_manufacturer_greenpeak_dev_names
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2578
2579 { &hf_zbee_nwk_gp_cmd_comm_manufacturer_dev_id,
2580 { "Manufacturer Model ID", "zbee_nwk_gp.cmd.comm.manufacturer_model_id", FT_UINT16, BASE_HEX,
2581 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2582
2583 { &hf_zbee_nwk_gp_cmd_comm_manufacturer_id,
2584 { "Manufacturer ID", "zbee_nwk_gp.cmd.comm.manufacturer_id", FT_UINT16, BASE_HEX,
2585 VALS(zbee_mfr_code_names)((0 ? (const struct _value_string*)0 : ((zbee_mfr_code_names)
)))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2586
2587 { &hf_zbee_nwk_gp_cmd_comm_appli_info_crp,
2588 { "Cluster reports present", "zbee_nwk_gp.cmd.comm.appli_info.crp", FT_BOOLEAN, 8, NULL((void*)0),
2589 ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_CRP0x08 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2590
2591 { &hf_zbee_nwk_gp_cmd_comm_appli_info_gclp,
2592 { "GP commands list present", "zbee_nwk_gp.cmd.comm.appli_info.gclp", FT_BOOLEAN, 8, NULL((void*)0),
2593 ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_GCLP0x04 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2594
2595 { &hf_zbee_nwk_gp_cmd_comm_appli_info,
2596 { "Application information Field", "zbee_nwk_gp.cmd.comm.appli_info", FT_UINT8, BASE_HEX, NULL((void*)0),
2597 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2598
2599 { &hf_zbee_nwk_gp_cmd_comm_appli_info_mip,
2600 { "Manufacturer ID present", "zbee_nwk_gp.cmd.comm.appli_info.mip", FT_BOOLEAN, 8, NULL((void*)0),
2601 ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_MIP0x01 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2602
2603 { &hf_zbee_nwk_gp_cmd_comm_appli_info_mmip,
2604 { "Manufacturer Model ID present", "zbee_nwk_gp.cmd.comm.appli_info.mmip", FT_BOOLEAN, 8, NULL((void*)0),
2605 ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_MMIP0x02 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2606
2607 { &hf_zbee_nwk_gp_cmd_comm_appli_info_sip,
2608 { "Switch information present", "zbee_nwk_gp.cmd.comm.appli_info.sip", FT_BOOLEAN, 8, NULL((void*)0),
2609 ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_SIP0x10 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2610
2611 { &hf_zbee_nwk_gp_cmd_comm_appli_info_adcf,
2612 { "GPD Application Description command follows", "zbee_nwk_gp.cmd.comm.appli_info.adcf", FT_BOOLEAN, 8, NULL((void*)0),
2613 ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_ADCF0x20 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2614
2615 { &hf_zbee_nwk_gp_cmd_comm_appli_info_res,
2616 { "Reserved", "zbee_nwk_gp.cmd.comm.appli_info.reserved", FT_UINT8, BASE_HEX, NULL((void*)0),
2617 ZBEE_NWK_GP_CMD_COMMISSIONING_APPLI_INFO_RES0xC0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2618
2619 { &hf_zbee_nwk_gp_cmd_comm_gpd_cmd_num,
2620 { "Number of GPD commands", "zbee_nwk_gp.cmd.comm.gpd_cmd_num", FT_UINT8, BASE_DEC, NULL((void*)0),
2621 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2622
2623 { &hf_zbee_nwk_gp_cmd_comm_gpd_cmd_id_list,
2624 { "GPD CommandID list", "zbee_nwk_gp.cmd.comm.gpd_cmd_id_list", FT_NONE, BASE_NONE, NULL((void*)0),
2625 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2626
2627 { &hf_zbee_nwk_gp_cmd_comm_length_of_clid_list,
2628 { "Length of ClusterID list", "zbee_nwk_gp.cmd.comm.length_of_clid_list", FT_UINT8, BASE_HEX, NULL((void*)0),
2629 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2630
2631 { &hf_zbee_nwk_gp_cmd_comm_length_of_clid_list_server,
2632 { "Number of server ClusterIDs", "zbee_nwk_gp.cmd.comm.length_of_clid_list_srv", FT_UINT8, BASE_DEC, NULL((void*)0),
2633 ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_SRV0x0F, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2634
2635 { &hf_zbee_nwk_gp_cmd_comm_length_of_clid_list_client,
2636 { "Number of client ClusterIDs", "zbee_nwk_gp.cmd.comm.length_of_clid_list_cli", FT_UINT8, BASE_DEC, NULL((void*)0),
2637 ZBEE_NWK_GP_CMD_COMMISSIONING_CLID_LIST_LEN_CLI0xF0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2638
2639 { &hf_zbee_nwk_cmd_comm_clid_list_server,
2640 { "Cluster ID List Server", "zbee_nwk_gp.cmd.comm.clid_list_server", FT_NONE, BASE_NONE, NULL((void*)0),
2641 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2642
2643 { &hf_zbee_nwk_cmd_comm_clid_list_client,
2644 { "ClusterID List Client", "zbee_nwk_gp.cmd.comm.clid_list_client", FT_NONE, BASE_NONE, NULL((void*)0),
2645 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2646
2647 { &hf_zbee_nwk_cmd_comm_cluster_id,
2648 { "Cluster ID", "zbee_nwk_gp.cmd.comm.cluster_id", FT_UINT16, BASE_HEX | BASE_RANGE_STRING0x00000100, RVALS(zbee_aps_cid_names)((0 ? (const struct _range_string*)0 : ((zbee_aps_cid_names))
))
,
2649 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2650
2651 { &hf_zbee_nwk_gp_cmd_comm_switch_info,
2652 { "Switch information", "zbee_nwk_gp.cmd.comm.switch_info", FT_NONE, BASE_NONE, NULL((void*)0),
2653 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2654
2655 { &hf_zbee_nwk_gp_cmd_comm_switch_info_length,
2656 { "Switch info length", "zbee_nwk_gp.cmd.comm.switch_info.length", FT_UINT8, BASE_DEC, NULL((void*)0),
2657 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2658
2659 { &hf_zbee_nwk_gp_cmd_comm_switch_info_generic_switch_config,
2660 { "Generic switch configuration", "zbee_nwk_gp.cmd.comm.switch_info.generic_switch_config", FT_UINT8, BASE_HEX, NULL((void*)0),
2661 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2662
2663 { &hf_zbee_nwk_gp_cmd_comm_switch_info_num_contacts,
2664 { "Number of contacts", "zbee_nwk_gp.cmd.comm.switch_info.num_contacts", FT_UINT8, BASE_DEC, NULL((void*)0),
2665 ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_CONF_NUM_CONTACTS0x0F , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2666
2667 { &hf_zbee_nwk_gp_cmd_comm_switch_info_switch_type,
2668 { "Switch type", "zbee_nwk_gp.cmd.comm.switch_info.switch_type", FT_UINT8, BASE_HEX, VALS(zbee_nwk_gp_switch_type_names)((0 ? (const struct _value_string*)0 : ((zbee_nwk_gp_switch_type_names
))))
,
2669 ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_CONF_SWITCH_TYPE0x30 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2670
2671 { &hf_zbee_nwk_gp_cmd_comm_switch_info_reserved,
2672 { "Reserved", "zbee_nwk_gp.cmd.comm.switch_info.reserved", FT_UINT8, BASE_HEX, NULL((void*)0),
2673 ZBEE_NWK_GP_CMD_COMMISSIONING_SWITCH_CONF_RES0xC0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2674
2675 { &hf_zbee_nwk_gp_cmd_comm_switch_info_current_contact_status,
2676 { "Current contact status", "zbee_nwk_gp.cmd.comm.switch_info.current_contact_status", FT_UINT8, BASE_HEX, NULL((void*)0),
2677 0x0 , NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2678
2679 { &hf_zbee_nwk_gp_cmd_comm_rep_opt_key_encr,
2680 { "GPD Key Encryption", "zbee_nwk_gp.cmd.comm_reply.opt.sec_key_encr", FT_BOOLEAN, 8, NULL((void*)0),
2681 ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_KEY_ENCR0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2682
2683 { &hf_zbee_nwk_gp_cmd_comm_rep_opt,
2684 { "Options Field", "zbee_nwk_gp.cmd.comm_reply.opt", FT_UINT8, BASE_HEX, NULL((void*)0),
2685 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2686
2687 { &hf_zbee_nwk_gp_cmd_comm_rep_opt_panid_present,
2688 { "PANID Present", "zbee_nwk_gp.cmd.comm_reply.opt.pan_id_present", FT_BOOLEAN, 8, NULL((void*)0),
2689 ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_PAN_ID_PRESENT0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2690
2691 { &hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_key_present,
2692 { "GPD Security Key Present", "zbee_nwk_gp.cmd.comm_reply.opt.sec_key_present", FT_BOOLEAN, 8, NULL((void*)0),
2693 ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_KEY_PRESENT0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2694
2695 { &hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_level,
2696 { "Security Level", "zbee_nwk_gp.cmd.comm_reply.opt.sec_level", FT_UINT8, BASE_HEX, NULL((void*)0),
2697 ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_SEC_LEVEL0x18, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2698
2699 { &hf_zbee_nwk_gp_cmd_comm_rep_opt_sec_type,
2700 { "Key Type", "zbee_nwk_gp.cmd.comm_reply.opt.key_type", FT_UINT8, BASE_HEX, NULL((void*)0),
2701 ZBEE_NWK_GP_CMD_COMMISSIONING_REP_OPT_KEY_TYPE0xE0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2702
2703 { &hf_zbee_nwk_gp_cmd_comm_rep_pan_id,
2704 { "PAN ID", "zbee_nwk_gp.cmd.comm_reply.pan_id", FT_UINT16, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2705
2706 { &hf_zbee_nwk_gp_cmd_comm_rep_frame_counter,
2707 { "Frame Counter", "zbee_nwk_gp.cmd.comm_reply.frame_counter", FT_UINT32, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2708
2709 { &hf_zbee_nwk_gp_cmd_read_att_opt_multi_rec,
2710 { "Multi-record", "zbee_nwk_gp.cmd.read_att.opt.multi_record", FT_BOOLEAN, 8, NULL((void*)0),
2711 ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MULTI_RECORD0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2712
2713 { &hf_zbee_nwk_gp_cmd_read_att_opt_man_field_present,
2714 { "Manufacturer field present", "zbee_nwk_gp.cmd.read_att.opt.man_field_present", FT_BOOLEAN, 8, NULL((void*)0),
2715 ZBEE_NWK_GP_CMD_READ_ATTRIBUTE_OPT_MAN_FIELD_PRESENT0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2716
2717 { &hf_zbee_nwk_gp_cmd_read_att_opt,
2718 { "Option field", "zbee_nwk_gp.cmd.read_att.opt", FT_UINT8, BASE_HEX, NULL((void*)0),
2719 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2720
2721 { &hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_frame_type,
2722 { "Frame type", "zbee_nwk_gp.cmd.zcl_tunnel.opt.frame_type", FT_UINT8, BASE_HEX, NULL((void*)0),
2723 ZBEE_NWK_GP_CMD_ZCL_TUNNEL_OPT_FRAME_TYPE0x03, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2724
2725 { &hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_man_field_present,
2726 { "Manufacturer field present", "zbee_nwk_gp.cmd.zcl_tunnel.opt.man_field_present", FT_BOOLEAN, 8, NULL((void*)0),
2727 ZBEE_NWK_GP_CMD_ZCL_TUNNEL_OPT_MAN_FIELD_PRESENT0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2728
2729 { &hf_zbee_nwk_gp_cmd_zcl_tunnel_opt_direction,
2730 { "Direction", "zbee_nwk_gp.cmd.zcl_tunnel.opt.direction", FT_UINT8, BASE_HEX, NULL((void*)0),
2731 ZBEE_NWK_GP_CMD_ZCL_TUNNEL_OPT_DIRECTION0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2732
2733 { &hf_zbee_nwk_gp_cmd_zcl_tunnel_opt,
2734 { "Option field", "zbee_nwk_gp.cmd.zcl_tunnel.opt", FT_UINT8, BASE_HEX, NULL((void*)0),
2735 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2736
2737 { &hf_zbee_nwk_gp_cmd_zcl_tunnel_command_id,
2738 { "Zigbee Command ID", "zbee_nwk_gp.cmd.zcl_tunnel.command_id", FT_UINT8, BASE_HEX, NULL((void*)0), 0x0,
2739 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2740
2741 { &hf_zbee_nwk_gp_cmd_zcl_tunnel_payload_len,
2742 { "Length of Payload", "zbee_nwk_gp.cmd.zcl_tunnel.payload_len", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
2743 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2744
2745 { &hf_zbee_nwk_gp_cmd_compact_attr_report_report_id,
2746 { "Report Identifier", "zbee_nwk_gp.cmd.compact_attr_report.report_id", FT_UINT8, BASE_HEX, NULL((void*)0),
2747 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2748
2749 { &hf_zbee_nwk_gp_cmd_compact_attr_report_data_points,
2750 { "Data Points", "zbee_nwk_gp.cmd.compact_attr_report.data_points", FT_BYTES, BASE_NONE, NULL((void*)0),
2751 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2752
2753 { &hf_zbee_nwk_gp_cmd_app_desc_total_report,
2754 { "Total Number of Reports", "zbee_nwk_gp.app_desc.total_report", FT_UINT8, BASE_DEC, NULL((void*)0),
2755 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2756
2757 { &hf_zbee_nwk_gp_cmd_app_desc_num_report,
2758 { "Number of Reports", "zbee_nwk_gp.app_desc.num_report", FT_UINT8, BASE_DEC, NULL((void*)0),
2759 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2760
2761 { &hf_zbee_nwk_gp_cmd_app_desc_report_desc_id,
2762 { "Report Identifier", "zbee_nwk_gp.app_desc.report_desc.id", FT_UINT8, BASE_HEX, NULL((void*)0),
2763 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2764
2765 { &hf_zbee_nwk_gp_cmd_app_desc_report_desc_opt,
2766 { "Report Options", "zbee_nwk_gp.app_desc.report_desc.opt", FT_UINT8, BASE_HEX, NULL((void*)0),
2767 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2768
2769 { &hf_zbee_nwk_gp_cmd_app_desc_report_desc_opt_timeout_present,
2770 { "Timeout Present", "zbee_nwk_gp.app_desc.report_desc.opt.timeout_present", FT_BOOLEAN, 8, NULL((void*)0),
2771 ZBEE_NWK_GP_CMD_APP_DESC_REPORT_DESC_OPT_TIMEOUT_PRESENT0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2772
2773 { &hf_zbee_nwk_gp_cmd_app_desc_report_desc_timeout,
2774 { "Timeout Period", "zbee_nwk_gp.app_desc.report_desc.timeout", FT_UINT16, BASE_DEC, NULL((void*)0),
2775 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2776
2777 { &hf_zbee_nwk_gp_cmd_app_desc_report_desc_len_remain,
2778 { "Remaining Length", "zbee_nwk_gp.app_desc.report_desc.len_remain", FT_UINT8, BASE_DEC, NULL((void*)0),
2779 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2780
2781 { &hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt,
2782 { "Data Point Options", "zbee_nwk_gp.app_desc.data_pt_desc.opt", FT_UINT8, BASE_HEX, NULL((void*)0),
2783 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2784
2785 { &hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_num_recs,
2786 { "Number of Attribute Records", "zbee_nwk_gp.app_desc.data_pt_desc.opt.num_recs", FT_UINT8, BASE_DEC, NULL((void*)0),
2787 ZBEE_NWK_GP_CMD_APP_DESC_DATA_PT_DESC_OPT_ATTR_NUM0x07, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2788
2789 { &hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_server,
2790 { "Server", "zbee_nwk_gp.app_desc.data_pt_desc.opt.server", FT_BOOLEAN, 8, NULL((void*)0),
2791 ZBEE_NWK_GP_CMD_APP_DESC_DATA_PT_DESC_OPT_SERVER0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2792
2793 { &hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_opt_manu_id_present,
2794 { "Manufacturer ID Present", "zbee_nwk_gp.app_desc.data_pt_desc.opt.manu_id_present", FT_BOOLEAN, 8, NULL((void*)0),
2795 ZBEE_NWK_GP_CMD_APP_DESC_DATA_PT_DESC_OPT_MANU_ID_PRESENT0x10, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2796
2797 { &hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_cluster_id,
2798 { "Cluster ID", "zbee_nwk_gp.app_desc.data_pt_desc.cluster_id", FT_UINT16, BASE_HEX | BASE_RANGE_STRING0x00000100, RVALS(zbee_aps_cid_names)((0 ? (const struct _range_string*)0 : ((zbee_aps_cid_names))
))
,
2799 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2800
2801 { &hf_zbee_nwk_gp_cmd_app_desc_data_pt_desc_manu_id,
2802 { "Manufacturer ID", "zbee_nwk_gp.app_desc.data_pt_desc.manu_id", FT_UINT16, BASE_HEX, VALS(zbee_mfr_code_names)((0 ? (const struct _value_string*)0 : ((zbee_mfr_code_names)
)))
,
2803 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2804
2805 { &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_id,
2806 { "Attribute ID", "zbee_nwk_gp.app_desc.attr_rec.id", FT_UINT16, BASE_HEX, NULL((void*)0),
2807 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2808
2809 { &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_data_type,
2810 { "Attribute Data Type", "zbee_nwk_gp.app_desc.attr_rec.data_type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_short_data_type_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_short_data_type_names
))))
,
2811 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2812
2813 { &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt,
2814 { "Attribute Options", "zbee_nwk_gp.app_desc.attr_rec.opt", FT_UINT8, BASE_HEX, NULL((void*)0),
2815 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2816
2817 { &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_len_remain,
2818 { "Remaining Attribute Record Length", "zbee_nwk_gp.app_desc.attr_rec.opt.len_remain", FT_UINT8, BASE_DEC, NULL((void*)0),
2819 ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_LEN_REMAIN0x0F, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2820
2821 { &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_reported,
2822 { "Reported", "zbee_nwk_gp.app_desc.attr_rec.opt.reported", FT_BOOLEAN, 8, NULL((void*)0),
2823 ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_REPORTED0x10, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2824
2825 { &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_opt_val_present,
2826 { "Attribute Value Present", "zbee_nwk_gp.app_desc.attr_rec.opt.val_present", FT_BOOLEAN, 8, NULL((void*)0),
2827 ZBEE_NWK_GP_CMD_APP_DESC_ATTR_REC_OPT_VAL_PRESENT0x20, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2828
2829 { &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_offset,
2830 { "Attribute Offset within Report", "zbee_nwk_gp.app_desc.attr_rec.offset", FT_UINT8, BASE_DEC, NULL((void*)0),
2831 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2832
2833 { &hf_zbee_nwk_gp_cmd_app_desc_attr_rec_val,
2834 { "Attribute Value", "zbee_nwk_gp.app_desc.attr_rec.val", FT_BYTES, BASE_NONE, NULL((void*)0),
2835 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2836
2837 { &hf_zbee_zcl_gp_cmd_ms_manufacturer_code,
2838 { "Manufacturer Code", "zbee_nwk_gp.cmd.manufacturer_code", FT_UINT16, BASE_HEX, VALS(zbee_mfr_code_names)((0 ? (const struct _value_string*)0 : ((zbee_mfr_code_names)
)))
,
2839 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2840
2841 { &hf_zbee_nwk_gp_cmd_read_att_record_len,
2842 { "Length of Record List", "zbee_nwk_gp.cmd.read_att.record_len", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
2843 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2844
2845 { &hf_zbee_nwk_gp_zcl_attr_status,
2846 { "Status", "zbee_nwk_gp.zcl.attr.status", FT_UINT8, BASE_HEX, VALS(zbee_zcl_status_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_status_names
))))
,
2847 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2848
2849 { &hf_zbee_nwk_gp_zcl_attr_data_type,
2850 { "Data Type", "zbee_nwk_gp.zcl.attr.datatype", FT_UINT8, BASE_HEX, VALS(zbee_zcl_short_data_type_names)((0 ? (const struct _value_string*)0 : ((zbee_zcl_short_data_type_names
))))
,
2851 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
2852
2853 { &hf_zbee_nwk_gp_zcl_attr_cluster_id,
2854 { "ZigBee Cluster ID", "zbee_nwk_gp.zcl.attr.cluster_id", FT_UINT16, BASE_HEX | BASE_RANGE_STRING0x00000100, RVALS(zbee_aps_cid_names)((0 ? (const struct _range_string*)0 : ((zbee_aps_cid_names))
))
,
2855 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2856
2857 { &hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour,
2858 { "Channel Toggling Behaviour", "zbee_nwk_gp.cmd.ch_req", FT_UINT8, BASE_HEX, NULL((void*)0),
2859 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2860
2861 { &hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_1st,
2862 { "Rx channel in the next attempt", "zbee_nwk_gp.cmd.ch_req.1st", FT_UINT8, BASE_HEX, NULL((void*)0),
2863 ZBEE_NWK_GP_CMD_CHANNEL_REQUEST_1ST0x0F, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2864
2865 { &hf_zbee_nwk_gp_cmd_channel_request_toggling_behaviour_2nd,
2866 { "Rx channel in the second next attempt", "zbee_nwk_gp.ch_req.2nd", FT_UINT8, BASE_HEX, NULL((void*)0),
2867 ZBEE_NWK_GP_CMD_CHANNEL_REQUEST_2ND0xF0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2868
2869 { &hf_zbee_nwk_gp_cmd_operational_channel,
2870 { "Operational Channel", "zbee_nwk_gp.cmd.configuration_ch", FT_UINT8, BASE_HEX, NULL((void*)0),
2871 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2872
2873 { &hf_zbee_nwk_gp_cmd_channel_configuration,
2874 { "Operation channel", "zbee_nwk_gp.cmd.configuration_ch.operation_ch", FT_UINT8, BASE_HEX, NULL((void*)0),
2875 ZBEE_NWK_GP_CMD_CHANNEL_CONFIGURATION_OPERATION_CH0x0F, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2876
2877 { &hf_zbee_nwk_gp_cmd_move_color_ratex,
2878 { "RateX", "zbee_nwk_gp.cmd.move_color.ratex", FT_UINT16, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2879
2880 { &hf_zbee_nwk_gp_cmd_move_color_ratey,
2881 { "RateY", "zbee_nwk_gp.cmd.move_color.ratey", FT_UINT16, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2882
2883 { &hf_zbee_nwk_gp_cmd_move_up_down_rate,
2884 { "Rate", "zbee_nwk_gp.cmd.move_up_down.rate", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2885
2886 { &hf_zbee_nwk_gp_cmd_step_color_stepx,
2887 { "StepX", "zbee_nwk_gp.cmd.step_color.stepx", FT_UINT16, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2888
2889 { &hf_zbee_nwk_gp_cmd_step_color_stepy,
2890 { "StepY", "zbee_nwk_gp.cmd.step_color.stepy", FT_UINT16, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2891
2892 { &hf_zbee_nwk_gp_cmd_step_color_transition_time,
2893 { "Transition Time", "zbee_nwk_gp.cmd.step_color.transition_time", FT_UINT16, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0),
2894 HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2895
2896 { &hf_zbee_nwk_gp_cmd_step_up_down_step_size,
2897 { "Step Size", "zbee_nwk_gp.cmd.step_up_down.step_size", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2898
2899 { &hf_zbee_nwk_gp_cmd_step_up_down_transition_time,
2900 { "Transition Time", "zbee_nwk_gp.cmd.step_up_down.transition_time", FT_UINT16, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0),
2901 HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}
2902 };
2903
2904 static ei_register_info ei[] = {
2905 { &ei_zbee_nwk_gp_no_payload,
2906 { "zbee_nwk_gp.no_payload", PI_MALFORMED0x07000000, PI_ERROR0x00800000,
2907 "Payload is missing", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE
, BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE
, -1, ((void*)0)}}
}},
2908 { &ei_zbee_nwk_gp_inval_residual_data,
2909 { "zbee_nwk_gp.inval_residual_data", PI_MALFORMED0x07000000, PI_ERROR0x00800000,
2910 "Invalid residual data", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE
, BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE
, -1, ((void*)0)}}
}},
2911 { &ei_zbee_nwk_gp_com_rep_no_out_cnt,
2912 { "zbee_nwk_gp.com_rep_no_out_cnt", PI_DEBUG0x08000000, PI_WARN0x00600000,
2913 "Missing outgoing frame counter", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE
, BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE
, -1, ((void*)0)}}
}}
2914 };
2915
2916 static int *ett[] = {
2917 &ett_zbee_nwk,
2918 &ett_zbee_nwk_cmd,
2919 &ett_zbee_nwk_cmd_cinfo,
2920 &ett_zbee_nwk_cmd_appli_info,
2921 &ett_zbee_nwk_cmd_options,
2922 &ett_zbee_nwk_fcf,
2923 &ett_zbee_nwk_fcf_ext,
2924 &ett_zbee_nwk_clu_rec,
2925 &ett_zbee_nwk_att_rec,
2926 &ett_zbee_nwk_cmd_app_desc_report_desc,
2927 &ett_zbee_nwk_cmd_app_desc_data_pt_desc,
2928 &ett_zbee_nwk_cmd_app_desc_data_pt_options,
2929 &ett_zbee_nwk_cmd_app_desc_att_rec,
2930 &ett_zbee_nwk_cmd_comm_gpd_cmd_id_list,
2931 &ett_zbee_nwk_cmd_comm_length_of_clid_list,
2932 &ett_zbee_nwk_cmd_comm_clid_list_server,
2933 &ett_zbee_nwk_cmd_comm_clid_list_client,
2934 &ett_zbee_nwk_cmd_comm_switch_info,
2935 &ett_zbee_nwk_cmd_comm_switch_info_generic_switch_config
2936 };
2937
2938 static uat_field_t key_uat_fields[] = {
2939 UAT_FLD_CSTRING(gp_uat_key_records, string, "Key", "A 16-byte key."){"string", "Key", PT_TXTMOD_STRING,{uat_fld_chk_str,gp_uat_key_records_string_set_cb
,gp_uat_key_records_string_tostr_cb},{0,0,0},0,"A 16-byte key."
,((void*)0)}
,
2940 UAT_FLD_VS(gp_uat_key_records, byte_order, "Byte Order", byte_order_vals, "Byte order of a key."){"byte_order", "Byte Order", PT_TXTMOD_ENUM,{uat_fld_chk_enum
,gp_uat_key_records_byte_order_set_cb,gp_uat_key_records_byte_order_tostr_cb
},{&(byte_order_vals),&(byte_order_vals),&(byte_order_vals
)},&(byte_order_vals),"Byte order of a key.",((void*)0)}
,
2941 UAT_FLD_LSTRING(gp_uat_key_records, label, "Label", "User label for a key."){"label", "Label", PT_TXTMOD_STRING,{0,gp_uat_key_records_label_set_cb
,gp_uat_key_records_label_tostr_cb},{0,0,0},0,"User label for a key."
,((void*)0)}
,
2942 UAT_END_FIELDS{((void*)0),((void*)0),PT_TXTMOD_NONE,{0,0,0},{0,0,0},0,0,((void
*)0)}
2943 };
2944
2945 proto_zbee_nwk_gp = proto_register_protocol("ZigBee Green Power Profile", "ZigBee Green Power",
2946 ZBEE_PROTOABBREV_NWK_GP"zbee_nwk_gp");
2947
2948 gp_zbee_prefs = prefs_register_protocol(proto_zbee_nwk_gp, NULL((void*)0));
2949
2950 zbee_gp_sec_key_table_uat = uat_new("ZigBee GP Security Keys", sizeof(uat_key_record_t), "zigbee_gp_keys", true1,
2951 &gp_uat_key_records, &num_uat_key_records, UAT_AFFECTS_DISSECTION0x00000001, NULL((void*)0), uat_key_record_copy_cb,
2952 uat_key_record_update_cb, uat_key_record_free_cb, uat_key_record_post_update_cb, NULL((void*)0), key_uat_fields);
2953
2954 prefs_register_uat_preference(gp_zbee_prefs, "gp_key_table", "Pre-configured GP Security Keys",
2955 "Pre-configured GP Security Keys.", zbee_gp_sec_key_table_uat);
2956
2957 register_init_routine(gp_init_zbee_security);
2958 register_cleanup_routine(gp_cleanup_zbee_security);
2959
2960 /* Register the Wireshark protocol. */
2961 proto_register_field_array(proto_zbee_nwk_gp, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
2962 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
2963
2964 expert_zbee_nwk_gp = expert_register_protocol(proto_zbee_nwk_gp);
2965 expert_register_field_array(expert_zbee_nwk_gp, ei, array_length(ei)(sizeof (ei) / sizeof (ei)[0]));
2966
2967 /* Register the dissectors. */
2968 register_dissector(ZBEE_PROTOABBREV_NWK_GP"zbee_nwk_gp", dissect_zbee_nwk_gp, proto_zbee_nwk_gp);
2969 register_dissector(ZBEE_PROTOABBREV_NWK_GP_CMD"zbee_nwk_gp_cmd", dissect_zbee_nwk_gp_cmd, proto_zbee_nwk_gp);
2970} /* proto_register_zbee_nwk_gp */
2971
2972/**
2973 *Registers the ZigBee dissector with Wireshark.
2974 *
2975*/
2976void
2977proto_reg_handoff_zbee_nwk_gp(void)
2978{
2979 /* Register our dissector with IEEE 802.15.4. */
2980 dissector_add_for_decode_as(IEEE802154_PROTOABBREV_WPAN_PANID"wpan.panid", find_dissector(ZBEE_PROTOABBREV_NWK_GP"zbee_nwk_gp"));
2981 heur_dissector_add(IEEE802154_PROTOABBREV_WPAN"wpan", dissect_zbee_nwk_heur_gp, "ZigBee Green Power over IEEE 802.15.4", "zbee_nwk_gp_wlan", proto_zbee_nwk_gp, HEURISTIC_ENABLE);
2982} /* proto_reg_handoff_zbee */
2983
2984/*
2985 * Editor modelines
2986 *
2987 * Local Variables:
2988 * c-basic-offset: 4
2989 * tab-width: 8
2990 * indent-tabs-mode: nil
2991 * End:
2992 *
2993 * ex: set shiftwidth=4 tabstop=8 expandtab:
2994 * :indentSize=4:tabSize=8:noTabs=true:
2995 */