| Wireshark 4.7.0 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 - Closures */
154#define ZBEE_ZCL_CID_SHADE_CONFIG 0x0100
155#define ZBEE_ZCL_CID_DOOR_LOCK 0X0101
156#define ZBEE_ZCL_CID_WINDOW_COVERING 0X0102
157
158/* ZCL Cluster IDs - HVAC */
159#define ZBEE_ZCL_CID_PUMP_CONFIG_CONTROL 0x0200
160#define ZBEE_ZCL_CID_THERMOSTAT 0x0201
161#define ZBEE_ZCL_CID_FAN_CONTROL 0x0202
162#define ZBEE_ZCL_CID_DEHUMIDIFICATION_CONTROL 0x0203
163#define ZBEE_ZCL_CID_THERMOSTAT_UI_CONFIG 0x0204
164
165/* ZCL Cluster IDs - Lighting */
166#define ZBEE_ZCL_CID_COLOR_CONTROL 0x0300
167#define ZBEE_ZCL_CID_BALLAST_CONFIG 0x0301
168
169/* ZCL Cluster IDs - Measurement and Sensing */
170#define ZBEE_ZCL_CID_ILLUMINANCE_MEASUREMENT 0x0400
171#define ZBEE_ZCL_CID_ILLUMINANCE_LEVEL_SENSING 0x0401
172#define ZBEE_ZCL_CID_TEMPERATURE_MEASUREMENT 0x0402
173#define ZBEE_ZCL_CID_PRESSURE_MEASUREMENT 0x0403
174#define ZBEE_ZCL_CID_FLOW_MEASUREMENT 0x0404
175#define ZBEE_ZCL_CID_REL_HUMIDITY_MEASUREMENT 0x0405
176#define ZBEE_ZCL_CID_OCCUPANCY_SENSING 0x0406
177#define ZBEE_ZCL_CID_ELECTRICAL_MEASUREMENT 0x0b04
178
179/* ZCL Cluster IDs - Security and Safety */
180#define ZBEE_ZCL_CID_IAS_ZONE 0x0500
181#define ZBEE_ZCL_CID_IAS_ACE 0x0501
182#define ZBEE_ZCL_CID_IAS_WD 0x0502
183
184/* ZCL Cluster IDs - Protocol Interfaces */
185#define ZBEE_ZCL_CID_GENERIC_TUNNEL 0x0600
186#define ZBEE_ZCL_CID_BACNET_PROTOCOL_TUNNEL 0x0601
187#define ZBEE_ZCL_CID_BACNET_ANALOG_INPUT_REG 0x0602
188#define ZBEE_ZCL_CID_BACNET_ANALOG_INPUT_EXT 0x0603
189#define ZBEE_ZCL_CID_BACNET_ANALOG_OUTPUT_REG 0x0604
190#define ZBEE_ZCL_CID_BACNET_ANALOG_OUTPUT_EXT 0x0605
191#define ZBEE_ZCL_CID_BACNET_ANALOG_VALUE_REG 0x0606
192#define ZBEE_ZCL_CID_BACNET_ANALOG_VALUE_EXT 0x0607
193#define ZBEE_ZCL_CID_BACNET_BINARY_INPUT_REG 0x0608
194#define ZBEE_ZCL_CID_BACNET_BINARY_INPUT_EXT 0x0609
195#define ZBEE_ZCL_CID_BACNET_BINARY_OUTPUT_REG 0x060a
196#define ZBEE_ZCL_CID_BACNET_BINARY_OUTPUT_EXT 0x060b
197#define ZBEE_ZCL_CID_BACNET_BINARY_VALUE_REG 0x060c
198#define ZBEE_ZCL_CID_BACNET_BINARY_VALUE_EXT 0x060d
199#define ZBEE_ZCL_CID_BACNET_MULTISTATE_INPUT_REG 0x060e
200#define ZBEE_ZCL_CID_BACNET_MULTISTATE_INPUT_EXT 0x060f
201#define ZBEE_ZCL_CID_BACNET_MULTISTATE_OUTPUT_REG 0x0610
202#define ZBEE_ZCL_CID_BACNET_MULTISTATE_OUTPUT_EXT 0x0611
203#define ZBEE_ZCL_CID_BACNET_MULTISTATE_VALUE_REG 0x0612
204#define ZBEE_ZCL_CID_BACNET_MULTISTATE_VALUE_EXT 0x0613
205
206/* ZCL Cluster IDs - Smart Energy */
207#define ZBEE_ZCL_CID_KEEP_ALIVE 0x0025
208#define ZBEE_ZCL_CID_PRICE 0x0700
209#define ZBEE_ZCL_CID_DEMAND_RESPONSE_LOAD_CONTROL 0x0701
210#define ZBEE_ZCL_CID_SIMPLE_METERING 0x0702
211#define ZBEE_ZCL_CID_MESSAGE 0x0703
212#define ZBEE_ZCL_CID_TUNNELING 0x0704
213#define ZBEE_ZCL_CID_PRE_PAYMENT 0x0705
214#define ZBEE_ZCL_CID_ENERGY_MANAGEMENT 0x0706
215#define ZBEE_ZCL_CID_CALENDAR 0x0707
216#define ZBEE_ZCL_CID_DEVICE_MANAGEMENT 0x0708
217#define ZBEE_ZCL_CID_EVENTS 0x0709
218#define ZBEE_ZCL_CID_MDU_PAIRING 0x070A
219#define ZBEE_ZCL_CID_SUB_GHZ 0x070B
220#define ZBEE_ZCL_CID_DAILY_SCHEDULE 0x070D
221
222/* ZCL Cluster IDs - Key Establishment */
223#define ZBEE_ZCL_CID_KE 0x0800
224
225/* ZCL Cluster IDs - Home Automation */
226#define ZBEE_ZCL_CID_APPLIANCE_IDENTIFICATION 0x0b00
227#define ZBEE_ZCL_CID_METER_IDENTIFICATION 0x0b01
228#define ZBEE_ZCL_CID_APPLIANCE_EVENTS_AND_ALERT 0x0b02
229#define ZBEE_ZCL_CID_APPLIANCE_STATISTICS 0x0b03
230#define ZBEE_ZCL_CID_DIAGNOSTICS 0x0b05
231
232#define ZBEE_ZCL_CID_ZLL 0x1000
233
234#define ZBEE_ZCL_CID_MANUFACTURER_SPECIFIC_MIN 0xFC00
235#define ZBEE_ZCL_CID_MANUFACTURER_SPECIFIC_MAX 0xFFFF
236
237/* ZCL Test Profile #2 Clusters */
238#define ZBEE_APS_T2_CID_TCP 0x0001
239#define ZBEE_APS_T2_CID_RESPC 0x0002
240#define ZBEE_APS_T2_CID_RETPC 0x0003
241#define ZBEE_APS_T2_CID_PCR 0x0004
242#define ZBEE_APS_T2_CID_BTREQ 0x001c
243#define ZBEE_APS_T2_CID_BTGREQ 0x001d
244#define ZBEE_APS_T2_CID_BTRES 0x0054
245#define ZBEE_APS_T2_CID_BTRES_S_SBT 0x00
246#define ZBEE_APS_T2_CID_BTRES_S_TFOFA 0x01
247#define ZBEE_APS_T2_CID_BTGRES 0x0055
248#define ZBEE_APS_T2_CID_RDREQ 0x1000
249#define ZBEE_APS_T2_CID_RDRES 0x1001
250#define ZBEE_APS_T2_CID_FREQ 0xa0a8
251#define ZBEE_APS_T2_CID_FRES 0xe000
252#define ZBEE_APS_T2_CID_FNDR 0xe001
253#define ZBEE_APS_T2_CID_BR 0xf000
254#define ZBEE_APS_T2_CID_BTADR 0xf001
255#define ZBEE_APS_T2_CID_BTARXOWIDR 0xf00a
256#define ZBEE_APS_T2_CID_BTARACR 0xf00e
257
258
259#define ZBEE_APP_STATUS_SUCCESS 0x00 /*A request has been executed successfully.*/
260#define ZBEE_APP_STATUS_ASDU_TOO_LONG 0xa0 /*A transmit request failed since the ASDU is too large and fragmentation is not supported.*/
261#define ZBEE_APP_STATUS_DEFRAG_DEFERRED 0xa1 /*A received fragmented frame could not be defragmented at the current time.*/
262#define ZBEE_APP_STATUS_DEFRAG_UNSUPPORTED 0xa2 /*A received fragmented frame could not be defragmented since the device does not support fragmentation.*/
263#define ZBEE_APP_STATUS_ILLEGAL_REQUEST 0xa3 /*A parameter value was out of range.*/
264#define ZBEE_APP_STATUS_INVALID_BINDING 0xa4 /*An APSME-UNBIND.request failed due to the requested binding link not existing in the binding table.*/
265#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.*/
266#define ZBEE_APP_STATUS_INVALID_PARAMETER 0xa6 /*A parameter value was invalid or out of range.*/
267#define ZBEE_APP_STATUS_NO_ACK 0xa7 /*An APSDE-DATA.request requesting acknowledged trans-mission failed due to no acknowledgement being received.*/
268#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.*/
269#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*/
270#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.*/
271#define ZBEE_APP_STATUS_SECURED_LINK_KEY 0xab /*An ASDU was received that was secured using a link key.*/
272#define ZBEE_APP_STATUS_SECURED_NWK_KEY 0xac /*An ASDU was received that was secured using a network key.*/
273#define ZBEE_APP_STATUS_SECURITY_FAIL 0xad /*An APSDE-DATA.request requesting security has resulted in an error during the corresponding security processing.*/
274#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.*/
275#define ZBEE_APP_STATUS_UNSECURED 0xaf /*An ASDU was received without any security.*/
276#define ZBEE_APP_STATUS_UNSUPPORTED_ATTRIBUTE 0xb0 /*An APSME-GET.request or APSME-SET.request has been issued with an unknown attribute identifier.*/
277
278#define ZBEE_APS_NODE_PROTO_DATA 0
279
280/* Structure to contain the APS frame information */
281 typedef struct{
282 bool indirect_mode; /* ZigBee 2004 and Earlier */
283 uint8_t type;
284 uint8_t delivery;
285 bool ack_format; /* ZigBee 2007 and Later */
286 bool security;
287 bool ack_req;
288 bool ext_header; /* ZigBee 2007 and Later */
289
290 uint8_t dst;
291 uint16_t group; /* ZigBee 2006 and Later */
292 uint16_t profile;
293 uint8_t src;
294 uint8_t counter;
295
296 /* Fragmentation Fields. */
297 uint8_t fragmentation; /* ZigBee 2007 and Later */
298 uint8_t block_number; /* ZigBee 2007 and Later */
299
300 /* Some helpers for the upper layers. */
301 bool profile_present;
302 bool dst_present;
303 bool src_present;
304} zbee_aps_packet;
305
306/* Structure to contain APS node information */
307 struct zbee_aps_node_info
308{
309 uint32_t extended_counter;
312};
313
314/* Structure to contain APS node information for a packet */
315 struct zbee_aps_node_packet_info
316{
317 uint32_t extended_counter;
320};
321
322/* ZigBee Smart Energy version used for preferences */
323extern int gPREF_zbee_se_protocol_version;
324
325enum {
326 ZBEE_SE_VERSION_1_1B,
327 ZBEE_SE_VERSION_1_2,
328 ZBEE_SE_VERSION_1_2A,
329 ZBEE_SE_VERSION_1_2B,
330 ZBEE_SE_VERSION_1_4
331};
332
333/**************************************
334 * Value Strings
335 **************************************
336 */
337
338extern const range_string zbee_aps_cid_names[];
339extern const range_string zbee_aps_apid_names[];
340
341#endif /* PACKET_ZBEE_APS_H*/
342
343/*
344 * Editor modelines - https://www.wireshark.org/tools/modelines.html
345 *
346 * Local variables:
347 * c-basic-offset: 4
348 * tab-width: 8
349 * indent-tabs-mode: nil
350 * End:
351 *
352 * vi: set shiftwidth=4 tabstop=8 expandtab:
353 * :indentSize=4:tabSize=8:noTabs=true:
354 */
_range_string
Definition value_string.h:570
ext_header
Definition packet-gtp.c:3195
profile
Definition packet-epl.h:22
zbee_aps_node_info
Definition packet-zbee-aps.h:308
zbee_aps_node_packet_info
Definition packet-zbee-aps.h:316
zbee_aps_packet
Definition packet-zbee-aps.h:281