| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
packet-zbee-aps.h
1/* packet-zbee-aps.h
2 * Dissector routines for the ZigBee Application Support Sub-layer (APS)
3 * By Owen Kirby <osk@exegin.com>
4 * Copyright 2009 Exegin Technologies Limited
5 *
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 */
12
13#ifndef PACKET_ZBEE_APS_H
14#define PACKET_ZBEE_APS_H
15
16/* ZigBee APS */
17#define ZBEE_APS_FCF_FRAME_TYPE 0x03
18#define ZBEE_APS_FCF_DELIVERY_MODE 0x0c
19#define ZBEE_APS_FCF_INDIRECT_MODE 0x10 /* ZigBee 2004 and earlier. */
20#define ZBEE_APS_FCF_ACK_FORMAT 0x10 /* ZigBee 2007 and later. */
21#define ZBEE_APS_FCF_SECURITY 0x20
22#define ZBEE_APS_FCF_ACK_REQ 0x40
23#define ZBEE_APS_FCF_EXT_HEADER 0x80
24
25#define ZBEE_APS_FCF_DATA 0x00
26#define ZBEE_APS_FCF_CMD 0x01
27#define ZBEE_APS_FCF_ACK 0x02
28#define ZBEE_APS_FCF_INTERPAN 0x03
29
30#define ZBEE_APS_FCF_UNICAST 0x00
31#define ZBEE_APS_FCF_INDIRECT 0x01
32#define ZBEE_APS_FCF_BCAST 0x02
33#define ZBEE_APS_FCF_GROUP 0x03 /* ZigBee 2006 and later. */
34
35#define ZBEE_APS_EXT_FCF_FRAGMENT 0x03
36#define ZBEE_APS_EXT_FCF_FRAGMENT_NONE 0x00
37#define ZBEE_APS_EXT_FCF_FRAGMENT_FIRST 0x01
38#define ZBEE_APS_EXT_FCF_FRAGMENT_MIDDLE 0x02
39
40#define ZBEE_APS_CMD_SKKE1 0x01
41#define ZBEE_APS_CMD_SKKE2 0x02
42#define ZBEE_APS_CMD_SKKE3 0x03
43#define ZBEE_APS_CMD_SKKE4 0x04
44#define ZBEE_APS_CMD_TRANSPORT_KEY 0x05
45#define ZBEE_APS_CMD_UPDATE_DEVICE 0x06
46#define ZBEE_APS_CMD_REMOVE_DEVICE 0x07
47#define ZBEE_APS_CMD_REQUEST_KEY 0x08
48#define ZBEE_APS_CMD_SWITCH_KEY 0x09
49#define ZBEE_APS_CMD_EA_INIT_CHLNG 0x0a
50#define ZBEE_APS_CMD_EA_RESP_CHLNG 0x0b
51#define ZBEE_APS_CMD_EA_INIT_MAC_DATA 0x0c
52#define ZBEE_APS_CMD_EA_RESP_MAC_DATA 0x0d
53#define ZBEE_APS_CMD_TUNNEL 0x0e
54#define ZBEE_APS_CMD_VERIFY_KEY 0x0f
55#define ZBEE_APS_CMD_CONFIRM_KEY 0x10
56#define ZBEE_APS_CMD_RELAY_MSG_DOWNSTREAM 0x11
57#define ZBEE_APS_CMD_RELAY_MSG_UPSTREAM 0x12
58
59#define ZBEE_APS_CMD_KEY_TC_MASTER 0x00
60#define ZBEE_APS_CMD_KEY_STANDARD_NWK 0x01
61#define ZBEE_APS_CMD_KEY_APP_MASTER 0x02
62#define ZBEE_APS_CMD_KEY_APP_LINK 0x03
63#define ZBEE_APS_CMD_KEY_TC_LINK 0x04
64#define ZBEE_APS_CMD_KEY_HIGH_SEC_NWK 0x05
65#define ZBEE_APS_CMD_KEY_EPHEMERAL_GLOBAL_AUTH 0xB0
66#define ZBEE_APS_CMD_KEY_EPHEMERAL_UNIQUE_AUTH 0xB1
67#define ZBEE_APS_CMD_KEY_BASIC_AUTH 0xB2
68#define ZBEE_APS_CMD_KEY_ADMIN_AUTH 0xB3
69
70#define ZBEE_APS_CMD_SKKE_DATA_LENGTH 16
71#define ZBEE_APS_CMD_KEY_LENGTH 16
72
73#define ZBEE_APS_CMD_REQ_NWK_KEY 0x01
74#define ZBEE_APS_CMD_REQ_APP_KEY 0x02
75
76#define ZBEE_APS_CMD_UPDATE_STANDARD_SEC_REJOIN 0x00
77#define ZBEE_APS_CMD_UPDATE_STANDARD_UNSEC_JOIN 0x01
78#define ZBEE_APS_CMD_UPDATE_LEAVE 0x02
79#define ZBEE_APS_CMD_UPDATE_STANDARD_UNSEC_REJOIN 0x03
80#define ZBEE_APS_CMD_UPDATE_HIGH_SEC_REJOIN 0x04
81#define ZBEE_APS_CMD_UPDATE_HIGH_UNSEC_JOIN 0x05
82#define ZBEE_APS_CMD_UPDATE_HIGH_UNSEC_REJOIN 0x07
83
84#define ZBEE_APS_CMD_EA_KEY_NWK 0x00
85#define ZBEE_APS_CMD_EA_KEY_LINK 0x01
86#define ZBEE_APS_CMD_EA_CHALLENGE_LENGTH 16
87#define ZBEE_APS_CMD_EA_MAC_LENGTH 16
88#define ZBEE_APS_CMD_EA_DATA_LENGTH 4
89
90/* Fields for ZigBee 2004 and earlier. */
91#define ZBEE_APP_TYPE 0xF0
92#define ZBEE_APP_COUNT 0x0F
93
94#define ZBEE_APP_TYPE_KVP 0x01
95#define ZBEE_APP_TYPE_MSG 0x02
96
97#define ZBEE_APP_KVP_CMD 0x0F
98#define ZBEE_APP_KVP_TYPE 0xF0
99
100#define ZBEE_APP_KVP_SET 0x01
101#define ZBEE_APP_KVP_EVENT 0x02
102#define ZBEE_APP_KVP_GET_ACK 0x04
103#define ZBEE_APP_KVP_SET_ACK 0x05
104#define ZBEE_APP_KVP_EVENT_ACK 0x06
105#define ZBEE_APP_KVP_GET_RESP 0x08
106#define ZBEE_APP_KVP_SET_RESP 0x09
107#define ZBEE_APP_KVP_EVENT_RESP 0x0A
108
109#define ZBEE_APP_KVP_NO_DATA 0x00
110#define ZBEE_APP_KVP_UINT8 0x01
111#define ZBEE_APP_KVP_INT8 0x02
112#define ZBEE_APP_KVP_UINT16 0x03
113#define ZBEE_APP_KVP_INT16 0x04
114#define ZBEE_APP_KVP_FLOAT16 0x0B
115#define ZBEE_APP_KVP_ABS_TIME 0x0C
116#define ZBEE_APP_KVP_REL_TIME 0x0D
117#define ZBEE_APP_KVP_CHAR_STRING 0x0E
118#define ZBEE_APP_KVP_OCT_STRING 0x0F
119
120#define ZBEE_APP_KVP_OVERHEAD 4
121
122/* ZCL Cluster IDs - General */
123#define ZBEE_ZCL_CID_BASIC 0x0000
124#define ZBEE_ZCL_CID_POWER_CONFIG 0x0001
125#define ZBEE_ZCL_CID_DEVICE_TEMP_CONFIG 0x0002
126#define ZBEE_ZCL_CID_IDENTIFY 0x0003
127#define ZBEE_ZCL_CID_GROUPS 0x0004
128#define ZBEE_ZCL_CID_SCENES 0x0005
129#define ZBEE_ZCL_CID_ON_OFF 0x0006
130#define ZBEE_ZCL_CID_ON_OFF_SWITCH_CONFIG 0x0007
131#define ZBEE_ZCL_CID_LEVEL_CONTROL 0x0008
132#define ZBEE_ZCL_CID_ALARMS 0x0009
133#define ZBEE_ZCL_CID_TIME 0x000a
134#define ZBEE_ZCL_CID_RSSI_LOCATION 0x000b
135#define ZBEE_ZCL_CID_ANALOG_INPUT_BASIC 0x000c
136#define ZBEE_ZCL_CID_ANALOG_OUTPUT_BASIC 0x000d
137#define ZBEE_ZCL_CID_ANALOG_VALUE_BASIC 0x000e
138#define ZBEE_ZCL_CID_BINARY_INPUT_BASIC 0x000f
139#define ZBEE_ZCL_CID_BINARY_OUTPUT_BASIC 0x0010
140#define ZBEE_ZCL_CID_BINARY_VALUE_BASIC 0x0011
141#define ZBEE_ZCL_CID_MULTISTATE_INPUT_BASIC 0x0012
142#define ZBEE_ZCL_CID_MULTISTATE_OUTPUT_BASIC 0x0013
143#define ZBEE_ZCL_CID_MULTISTATE_VALUE_BASIC 0x0014
144#define ZBEE_ZCL_CID_COMMISSIONING 0x0015
145#define ZBEE_ZCL_CID_PARTITION 0x0016
146#define ZBEE_ZCL_CID_OTA_UPGRADE 0x0019
147#define ZBEE_ZCL_CID_POLL_CONTROL 0x0020
148#define ZBEE_ZCL_CID_GP 0x0021
149/* */
150#define ZBEE_ZCL_CID_POWER_PROFILE 0x001a
151#define ZBEE_ZCL_CID_APPLIANCE_CONTROL 0x001b
152
153/* ZCL Cluster IDs - Zigbee Direct (ZBD) Configuration Cluster */
154#define ZBEE_ZCL_ZBD_CONFIGURATION 0x003d
155
156/* ZCL Cluster IDs - Closures */
157#define ZBEE_ZCL_CID_SHADE_CONFIG 0x0100
158#define ZBEE_ZCL_CID_DOOR_LOCK 0X0101
159#define ZBEE_ZCL_CID_WINDOW_COVERING 0X0102
160
161/* ZCL Cluster IDs - HVAC */
162#define ZBEE_ZCL_CID_PUMP_CONFIG_CONTROL 0x0200
163#define ZBEE_ZCL_CID_THERMOSTAT 0x0201
164#define ZBEE_ZCL_CID_FAN_CONTROL 0x0202
165#define ZBEE_ZCL_CID_DEHUMIDIFICATION_CONTROL 0x0203
166#define ZBEE_ZCL_CID_THERMOSTAT_UI_CONFIG 0x0204
167
168/* ZCL Cluster IDs - Lighting */
169#define ZBEE_ZCL_CID_COLOR_CONTROL 0x0300
170#define ZBEE_ZCL_CID_BALLAST_CONFIG 0x0301
171
172/* ZCL Cluster IDs - Measurement and Sensing */
173#define ZBEE_ZCL_CID_ILLUMINANCE_MEASUREMENT 0x0400
174#define ZBEE_ZCL_CID_ILLUMINANCE_LEVEL_SENSING 0x0401
175#define ZBEE_ZCL_CID_TEMPERATURE_MEASUREMENT 0x0402
176#define ZBEE_ZCL_CID_PRESSURE_MEASUREMENT 0x0403
177#define ZBEE_ZCL_CID_FLOW_MEASUREMENT 0x0404
178#define ZBEE_ZCL_CID_REL_HUMIDITY_MEASUREMENT 0x0405
179#define ZBEE_ZCL_CID_OCCUPANCY_SENSING 0x0406
180#define ZBEE_ZCL_CID_ELECTRICAL_MEASUREMENT 0x0b04
181
182/* ZCL Cluster IDs - Security and Safety */
183#define ZBEE_ZCL_CID_IAS_ZONE 0x0500
184#define ZBEE_ZCL_CID_IAS_ACE 0x0501
185#define ZBEE_ZCL_CID_IAS_WD 0x0502
186
187/* ZCL Cluster IDs - Protocol Interfaces */
188#define ZBEE_ZCL_CID_GENERIC_TUNNEL 0x0600
189#define ZBEE_ZCL_CID_BACNET_PROTOCOL_TUNNEL 0x0601
190#define ZBEE_ZCL_CID_BACNET_ANALOG_INPUT_REG 0x0602
191#define ZBEE_ZCL_CID_BACNET_ANALOG_INPUT_EXT 0x0603
192#define ZBEE_ZCL_CID_BACNET_ANALOG_OUTPUT_REG 0x0604
193#define ZBEE_ZCL_CID_BACNET_ANALOG_OUTPUT_EXT 0x0605
194#define ZBEE_ZCL_CID_BACNET_ANALOG_VALUE_REG 0x0606
195#define ZBEE_ZCL_CID_BACNET_ANALOG_VALUE_EXT 0x0607
196#define ZBEE_ZCL_CID_BACNET_BINARY_INPUT_REG 0x0608
197#define ZBEE_ZCL_CID_BACNET_BINARY_INPUT_EXT 0x0609
198#define ZBEE_ZCL_CID_BACNET_BINARY_OUTPUT_REG 0x060a
199#define ZBEE_ZCL_CID_BACNET_BINARY_OUTPUT_EXT 0x060b
200#define ZBEE_ZCL_CID_BACNET_BINARY_VALUE_REG 0x060c
201#define ZBEE_ZCL_CID_BACNET_BINARY_VALUE_EXT 0x060d
202#define ZBEE_ZCL_CID_BACNET_MULTISTATE_INPUT_REG 0x060e
203#define ZBEE_ZCL_CID_BACNET_MULTISTATE_INPUT_EXT 0x060f
204#define ZBEE_ZCL_CID_BACNET_MULTISTATE_OUTPUT_REG 0x0610
205#define ZBEE_ZCL_CID_BACNET_MULTISTATE_OUTPUT_EXT 0x0611
206#define ZBEE_ZCL_CID_BACNET_MULTISTATE_VALUE_REG 0x0612
207#define ZBEE_ZCL_CID_BACNET_MULTISTATE_VALUE_EXT 0x0613
208
209/* ZCL Cluster IDs - Smart Energy */
210#define ZBEE_ZCL_CID_KEEP_ALIVE 0x0025
211#define ZBEE_ZCL_CID_PRICE 0x0700
212#define ZBEE_ZCL_CID_DEMAND_RESPONSE_LOAD_CONTROL 0x0701
213#define ZBEE_ZCL_CID_SIMPLE_METERING 0x0702
214#define ZBEE_ZCL_CID_MESSAGE 0x0703
215#define ZBEE_ZCL_CID_TUNNELING 0x0704
216#define ZBEE_ZCL_CID_PRE_PAYMENT 0x0705
217#define ZBEE_ZCL_CID_ENERGY_MANAGEMENT 0x0706
218#define ZBEE_ZCL_CID_CALENDAR 0x0707
219#define ZBEE_ZCL_CID_DEVICE_MANAGEMENT 0x0708
220#define ZBEE_ZCL_CID_EVENTS 0x0709
221#define ZBEE_ZCL_CID_MDU_PAIRING 0x070A
222#define ZBEE_ZCL_CID_SUB_GHZ 0x070B
223#define ZBEE_ZCL_CID_DAILY_SCHEDULE 0x070D
224
225/* ZCL Cluster IDs - Key Establishment */
226#define ZBEE_ZCL_CID_KE 0x0800
227
228/* ZCL Cluster IDs - Home Automation */
229#define ZBEE_ZCL_CID_APPLIANCE_IDENTIFICATION 0x0b00
230#define ZBEE_ZCL_CID_METER_IDENTIFICATION 0x0b01
231#define ZBEE_ZCL_CID_APPLIANCE_EVENTS_AND_ALERT 0x0b02
232#define ZBEE_ZCL_CID_APPLIANCE_STATISTICS 0x0b03
233#define ZBEE_ZCL_CID_DIAGNOSTICS 0x0b05
234
235#define ZBEE_ZCL_CID_ZLL 0x1000
236
237#define ZBEE_ZCL_CID_MANUFACTURER_SPECIFIC_MIN 0xFC00
238#define ZBEE_ZCL_CID_MANUFACTURER_SPECIFIC_MAX 0xFFFF
239
240/* ZCL Test Profile #2 Clusters */
241#define ZBEE_APS_T2_CID_TCP 0x0001
242#define ZBEE_APS_T2_CID_RESPC 0x0002
243#define ZBEE_APS_T2_CID_RETPC 0x0003
244#define ZBEE_APS_T2_CID_PCR 0x0004
245#define ZBEE_APS_T2_CID_BTREQ 0x001c
246#define ZBEE_APS_T2_CID_BTGREQ 0x001d
247#define ZBEE_APS_T2_CID_BTRES 0x0054
248#define ZBEE_APS_T2_CID_BTRES_S_SBT 0x00
249#define ZBEE_APS_T2_CID_BTRES_S_TFOFA 0x01
250#define ZBEE_APS_T2_CID_BTGRES 0x0055
251#define ZBEE_APS_T2_CID_RDREQ 0x1000
252#define ZBEE_APS_T2_CID_RDRES 0x1001
253#define ZBEE_APS_T2_CID_FREQ 0xa0a8
254#define ZBEE_APS_T2_CID_FRES 0xe000
255#define ZBEE_APS_T2_CID_FNDR 0xe001
256#define ZBEE_APS_T2_CID_BR 0xf000
257#define ZBEE_APS_T2_CID_BTADR 0xf001
258#define ZBEE_APS_T2_CID_BTARXOWIDR 0xf00a
259#define ZBEE_APS_T2_CID_BTARACR 0xf00e
260
261
262#define ZBEE_APP_STATUS_SUCCESS 0x00 /*A request has been executed successfully.*/
263#define ZBEE_APP_STATUS_ASDU_TOO_LONG 0xa0 /*A transmit request failed since the ASDU is too large and fragmentation is not supported.*/
264#define ZBEE_APP_STATUS_DEFRAG_DEFERRED 0xa1 /*A received fragmented frame could not be defragmented at the current time.*/
265#define ZBEE_APP_STATUS_DEFRAG_UNSUPPORTED 0xa2 /*A received fragmented frame could not be defragmented since the device does not support fragmentation.*/
266#define ZBEE_APP_STATUS_ILLEGAL_REQUEST 0xa3 /*A parameter value was out of range.*/
267#define ZBEE_APP_STATUS_INVALID_BINDING 0xa4 /*An APSME-UNBIND.request failed due to the requested binding link not existing in the binding table.*/
268#define ZBEE_APP_STATUS_INVALID_GROUP 0xa5 /*An APSME-REMOVE-GROUP.request has been issued with a group identifier that does not appear in the group table.*/
269#define ZBEE_APP_STATUS_INVALID_PARAMETER 0xa6 /*A parameter value was invalid or out of range.*/
270#define ZBEE_APP_STATUS_NO_ACK 0xa7 /*An APSDE-DATA.request requesting acknowledged trans-mission failed due to no acknowledgement being received.*/
271#define ZBEE_APP_STATUS_NO_BOUND_DEVICE 0xa8 /*An APSDE-DATA.request with a destination addressing mode set to 0x00 failed due to there being no devices bound to this device.*/
272#define ZBEE_APP_STATUS_NO_SHORT_ADDRESS 0xa9 /*An APSDE-DATA.request with a destination addressing mode set to 0x03 failed due to no corresponding short address found*/
273#define ZBEE_APP_STATUS_NOT_SUPPORTED 0xaa /*An APSDE-DATA.request with a destination addressing mode set to 0x00 failed due to a binding table not being supported on the device.*/
274#define ZBEE_APP_STATUS_SECURED_LINK_KEY 0xab /*An ASDU was received that was secured using a link key.*/
275#define ZBEE_APP_STATUS_SECURED_NWK_KEY 0xac /*An ASDU was received that was secured using a network key.*/
276#define ZBEE_APP_STATUS_SECURITY_FAIL 0xad /*An APSDE-DATA.request requesting security has resulted in an error during the corresponding security processing.*/
277#define ZBEE_APP_STATUS_TABLE_FULL 0xae /*An APSME-BIND.request or APSME.ADD-GROUP.request issued when the binding or group tables, respectively, were full.*/
278#define ZBEE_APP_STATUS_UNSECURED 0xaf /*An ASDU was received without any security.*/
279#define ZBEE_APP_STATUS_UNSUPPORTED_ATTRIBUTE 0xb0 /*An APSME-GET.request or APSME-SET.request has been issued with an unknown attribute identifier.*/
280
281#define ZBEE_APS_NODE_PROTO_DATA 0
282
283/* Structure to contain the APS frame information */
284 typedef struct{
285 bool indirect_mode; /* ZigBee 2004 and Earlier */
286 uint8_t type;
287 uint8_t delivery;
288 bool ack_format; /* ZigBee 2007 and Later */
289 bool security;
290 bool ack_req;
291 bool ext_header; /* ZigBee 2007 and Later */
292
293 uint8_t dst;
294 uint16_t group; /* ZigBee 2006 and Later */
295 uint16_t profile;
296 uint8_t src;
297 uint8_t counter;
298
299 /* Fragmentation Fields. */
300 uint8_t fragmentation; /* ZigBee 2007 and Later */
301 uint8_t block_number; /* ZigBee 2007 and Later */
302
303 /* Some helpers for the upper layers. */
304 bool profile_present;
305 bool dst_present;
306 bool src_present;
307} zbee_aps_packet;
308
309/* Structure to contain APS node information */
310 struct zbee_aps_node_info
311{
312 uint32_t extended_counter;
315};
316
317/* Structure to contain APS node information for a packet */
318 struct zbee_aps_node_packet_info
319{
320 uint32_t extended_counter;
323};
324
325/* ZigBee Smart Energy version used for preferences */
326 extern int gPREF_zbee_se_protocol_version;
327
328 enum {
329 ZBEE_SE_VERSION_1_1B,
330 ZBEE_SE_VERSION_1_2,
331 ZBEE_SE_VERSION_1_2A,
332 ZBEE_SE_VERSION_1_2B,
333 ZBEE_SE_VERSION_1_4
334};
335
336/**************************************
337 * Value Strings
338 **************************************
339 */
340
341 extern const range_string zbee_aps_cid_names[];
342 extern const range_string zbee_aps_apid_names[];
343
344#endif /* PACKET_ZBEE_APS_H*/
345
346/*
347 * Editor modelines - https://www.wireshark.org/tools/modelines.html
348 *
349 * Local variables:
350 * c-basic-offset: 4
351 * tab-width: 8
352 * indent-tabs-mode: nil
353 * End:
354 *
355 * vi: set shiftwidth=4 tabstop=8 expandtab:
356 * :indentSize=4:tabSize=8:noTabs=true:
357 */
zbee_aps_node_info
Definition packet-zbee-aps.h:311
zbee_aps_node_packet_info
Definition packet-zbee-aps.h:319
zbee_aps_packet
Definition packet-zbee-aps.h:284
range_string
struct _range_string range_string
Maps an inclusive numeric range to a string value, used for table-driven range-to-string lookups.