Wireshark 4.5.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 <[email protected]>
4 * Copyright 2009 Exegin Technologies Limited
5 *
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <[email protected]>
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
66#define ZBEE_APS_CMD_SKKE_DATA_LENGTH 16
67#define ZBEE_APS_CMD_KEY_LENGTH 16
68
69#define ZBEE_APS_CMD_REQ_NWK_KEY 0x01
70#define ZBEE_APS_CMD_REQ_APP_KEY 0x02
71
72#define ZBEE_APS_CMD_UPDATE_STANDARD_SEC_REJOIN 0x00
73#define ZBEE_APS_CMD_UPDATE_STANDARD_UNSEC_JOIN 0x01
74#define ZBEE_APS_CMD_UPDATE_LEAVE 0x02
75#define ZBEE_APS_CMD_UPDATE_STANDARD_UNSEC_REJOIN 0x03
76#define ZBEE_APS_CMD_UPDATE_HIGH_SEC_REJOIN 0x04
77#define ZBEE_APS_CMD_UPDATE_HIGH_UNSEC_JOIN 0x05
78#define ZBEE_APS_CMD_UPDATE_HIGH_UNSEC_REJOIN 0x07
79
80#define ZBEE_APS_CMD_EA_KEY_NWK 0x00
81#define ZBEE_APS_CMD_EA_KEY_LINK 0x01
82#define ZBEE_APS_CMD_EA_CHALLENGE_LENGTH 16
83#define ZBEE_APS_CMD_EA_MAC_LENGTH 16
84#define ZBEE_APS_CMD_EA_DATA_LENGTH 4
85
86/* Fields for ZigBee 2004 and earlier. */
87#define ZBEE_APP_TYPE 0xF0
88#define ZBEE_APP_COUNT 0x0F
89
90#define ZBEE_APP_TYPE_KVP 0x01
91#define ZBEE_APP_TYPE_MSG 0x02
92
93#define ZBEE_APP_KVP_CMD 0x0F
94#define ZBEE_APP_KVP_TYPE 0xF0
95
96#define ZBEE_APP_KVP_SET 0x01
97#define ZBEE_APP_KVP_EVENT 0x02
98#define ZBEE_APP_KVP_GET_ACK 0x04
99#define ZBEE_APP_KVP_SET_ACK 0x05
100#define ZBEE_APP_KVP_EVENT_ACK 0x06
101#define ZBEE_APP_KVP_GET_RESP 0x08
102#define ZBEE_APP_KVP_SET_RESP 0x09
103#define ZBEE_APP_KVP_EVENT_RESP 0x0A
104
105#define ZBEE_APP_KVP_NO_DATA 0x00
106#define ZBEE_APP_KVP_UINT8 0x01
107#define ZBEE_APP_KVP_INT8 0x02
108#define ZBEE_APP_KVP_UINT16 0x03
109#define ZBEE_APP_KVP_INT16 0x04
110#define ZBEE_APP_KVP_FLOAT16 0x0B
111#define ZBEE_APP_KVP_ABS_TIME 0x0C
112#define ZBEE_APP_KVP_REL_TIME 0x0D
113#define ZBEE_APP_KVP_CHAR_STRING 0x0E
114#define ZBEE_APP_KVP_OCT_STRING 0x0F
115
116#define ZBEE_APP_KVP_OVERHEAD 4
117
118/* ZCL Cluster IDs - General */
119#define ZBEE_ZCL_CID_BASIC 0x0000
120#define ZBEE_ZCL_CID_POWER_CONFIG 0x0001
121#define ZBEE_ZCL_CID_DEVICE_TEMP_CONFIG 0x0002
122#define ZBEE_ZCL_CID_IDENTIFY 0x0003
123#define ZBEE_ZCL_CID_GROUPS 0x0004
124#define ZBEE_ZCL_CID_SCENES 0x0005
125#define ZBEE_ZCL_CID_ON_OFF 0x0006
126#define ZBEE_ZCL_CID_ON_OFF_SWITCH_CONFIG 0x0007
127#define ZBEE_ZCL_CID_LEVEL_CONTROL 0x0008
128#define ZBEE_ZCL_CID_ALARMS 0x0009
129#define ZBEE_ZCL_CID_TIME 0x000a
130#define ZBEE_ZCL_CID_RSSI_LOCATION 0x000b
131#define ZBEE_ZCL_CID_ANALOG_INPUT_BASIC 0x000c
132#define ZBEE_ZCL_CID_ANALOG_OUTPUT_BASIC 0x000d
133#define ZBEE_ZCL_CID_ANALOG_VALUE_BASIC 0x000e
134#define ZBEE_ZCL_CID_BINARY_INPUT_BASIC 0x000f
135#define ZBEE_ZCL_CID_BINARY_OUTPUT_BASIC 0x0010
136#define ZBEE_ZCL_CID_BINARY_VALUE_BASIC 0x0011
137#define ZBEE_ZCL_CID_MULTISTATE_INPUT_BASIC 0x0012
138#define ZBEE_ZCL_CID_MULTISTATE_OUTPUT_BASIC 0x0013
139#define ZBEE_ZCL_CID_MULTISTATE_VALUE_BASIC 0x0014
140#define ZBEE_ZCL_CID_COMMISSIONING 0x0015
141#define ZBEE_ZCL_CID_PARTITION 0x0016
142#define ZBEE_ZCL_CID_OTA_UPGRADE 0x0019
143#define ZBEE_ZCL_CID_POLL_CONTROL 0x0020
144#define ZBEE_ZCL_CID_GP 0x0021
145/* */
146#define ZBEE_ZCL_CID_POWER_PROFILE 0x001a
147#define ZBEE_ZCL_CID_APPLIANCE_CONTROL 0x001b
148
149/* ZCL Cluster IDs - Closures */
150#define ZBEE_ZCL_CID_SHADE_CONFIG 0x0100
151#define ZBEE_ZCL_CID_DOOR_LOCK 0X0101
152#define ZBEE_ZCL_CID_WINDOW_COVERING 0X0102
153
154/* ZCL Cluster IDs - HVAC */
155#define ZBEE_ZCL_CID_PUMP_CONFIG_CONTROL 0x0200
156#define ZBEE_ZCL_CID_THERMOSTAT 0x0201
157#define ZBEE_ZCL_CID_FAN_CONTROL 0x0202
158#define ZBEE_ZCL_CID_DEHUMIDIFICATION_CONTROL 0x0203
159#define ZBEE_ZCL_CID_THERMOSTAT_UI_CONFIG 0x0204
160
161/* ZCL Cluster IDs - Lighting */
162#define ZBEE_ZCL_CID_COLOR_CONTROL 0x0300
163#define ZBEE_ZCL_CID_BALLAST_CONFIG 0x0301
164
165/* ZCL Cluster IDs - Measurement and Sensing */
166#define ZBEE_ZCL_CID_ILLUMINANCE_MEASUREMENT 0x0400
167#define ZBEE_ZCL_CID_ILLUMINANCE_LEVEL_SENSING 0x0401
168#define ZBEE_ZCL_CID_TEMPERATURE_MEASUREMENT 0x0402
169#define ZBEE_ZCL_CID_PRESSURE_MEASUREMENT 0x0403
170#define ZBEE_ZCL_CID_FLOW_MEASUREMENT 0x0404
171#define ZBEE_ZCL_CID_REL_HUMIDITY_MEASUREMENT 0x0405
172#define ZBEE_ZCL_CID_OCCUPANCY_SENSING 0x0406
173#define ZBEE_ZCL_CID_ELECTRICAL_MEASUREMENT 0x0b04
174
175/* ZCL Cluster IDs - Security and Safety */
176#define ZBEE_ZCL_CID_IAS_ZONE 0x0500
177#define ZBEE_ZCL_CID_IAS_ACE 0x0501
178#define ZBEE_ZCL_CID_IAS_WD 0x0502
179
180/* ZCL Cluster IDs - Protocol Interfaces */
181#define ZBEE_ZCL_CID_GENERIC_TUNNEL 0x0600
182#define ZBEE_ZCL_CID_BACNET_PROTOCOL_TUNNEL 0x0601
183#define ZBEE_ZCL_CID_BACNET_ANALOG_INPUT_REG 0x0602
184#define ZBEE_ZCL_CID_BACNET_ANALOG_INPUT_EXT 0x0603
185#define ZBEE_ZCL_CID_BACNET_ANALOG_OUTPUT_REG 0x0604
186#define ZBEE_ZCL_CID_BACNET_ANALOG_OUTPUT_EXT 0x0605
187#define ZBEE_ZCL_CID_BACNET_ANALOG_VALUE_REG 0x0606
188#define ZBEE_ZCL_CID_BACNET_ANALOG_VALUE_EXT 0x0607
189#define ZBEE_ZCL_CID_BACNET_BINARY_INPUT_REG 0x0608
190#define ZBEE_ZCL_CID_BACNET_BINARY_INPUT_EXT 0x0609
191#define ZBEE_ZCL_CID_BACNET_BINARY_OUTPUT_REG 0x060a
192#define ZBEE_ZCL_CID_BACNET_BINARY_OUTPUT_EXT 0x060b
193#define ZBEE_ZCL_CID_BACNET_BINARY_VALUE_REG 0x060c
194#define ZBEE_ZCL_CID_BACNET_BINARY_VALUE_EXT 0x060d
195#define ZBEE_ZCL_CID_BACNET_MULTISTATE_INPUT_REG 0x060e
196#define ZBEE_ZCL_CID_BACNET_MULTISTATE_INPUT_EXT 0x060f
197#define ZBEE_ZCL_CID_BACNET_MULTISTATE_OUTPUT_REG 0x0610
198#define ZBEE_ZCL_CID_BACNET_MULTISTATE_OUTPUT_EXT 0x0611
199#define ZBEE_ZCL_CID_BACNET_MULTISTATE_VALUE_REG 0x0612
200#define ZBEE_ZCL_CID_BACNET_MULTISTATE_VALUE_EXT 0x0613
201
202/* ZCL Cluster IDs - Smart Energy */
203#define ZBEE_ZCL_CID_KEEP_ALIVE 0x0025
204#define ZBEE_ZCL_CID_PRICE 0x0700
205#define ZBEE_ZCL_CID_DEMAND_RESPONSE_LOAD_CONTROL 0x0701
206#define ZBEE_ZCL_CID_SIMPLE_METERING 0x0702
207#define ZBEE_ZCL_CID_MESSAGE 0x0703
208#define ZBEE_ZCL_CID_TUNNELING 0x0704
209#define ZBEE_ZCL_CID_PRE_PAYMENT 0x0705
210#define ZBEE_ZCL_CID_ENERGY_MANAGEMENT 0x0706
211#define ZBEE_ZCL_CID_CALENDAR 0x0707
212#define ZBEE_ZCL_CID_DEVICE_MANAGEMENT 0x0708
213#define ZBEE_ZCL_CID_EVENTS 0x0709
214#define ZBEE_ZCL_CID_MDU_PAIRING 0x070A
215#define ZBEE_ZCL_CID_SUB_GHZ 0x070B
216#define ZBEE_ZCL_CID_DAILY_SCHEDULE 0x070D
217
218/* ZCL Cluster IDs - Key Establishment */
219#define ZBEE_ZCL_CID_KE 0x0800
220
221/* ZCL Cluster IDs - Home Automation */
222#define ZBEE_ZCL_CID_APPLIANCE_IDENTIFICATION 0x0b00
223#define ZBEE_ZCL_CID_METER_IDENTIFICATION 0x0b01
224#define ZBEE_ZCL_CID_APPLIANCE_EVENTS_AND_ALERT 0x0b02
225#define ZBEE_ZCL_CID_APPLIANCE_STATISTICS 0x0b03
226
227#define ZBEE_ZCL_CID_ZLL 0x1000
228
229#define ZBEE_ZCL_CID_MANUFACTURER_SPECIFIC_MIN 0xFC00
230#define ZBEE_ZCL_CID_MANUFACTURER_SPECIFIC_MAX 0xFFFF
231
232/* ZCL Test Profile #2 Clusters */
233#define ZBEE_APS_T2_CID_TCP 0x0001
234#define ZBEE_APS_T2_CID_RESPC 0x0002
235#define ZBEE_APS_T2_CID_RETPC 0x0003
236#define ZBEE_APS_T2_CID_PCR 0x0004
237#define ZBEE_APS_T2_CID_BTREQ 0x001c
238#define ZBEE_APS_T2_CID_BTGREQ 0x001d
239#define ZBEE_APS_T2_CID_BTRES 0x0054
240#define ZBEE_APS_T2_CID_BTRES_S_SBT 0x00
241#define ZBEE_APS_T2_CID_BTRES_S_TFOFA 0x01
242#define ZBEE_APS_T2_CID_BTGRES 0x0055
243#define ZBEE_APS_T2_CID_RDREQ 0x1000
244#define ZBEE_APS_T2_CID_RDRES 0x1001
245#define ZBEE_APS_T2_CID_FREQ 0xa0a8
246#define ZBEE_APS_T2_CID_FRES 0xe000
247#define ZBEE_APS_T2_CID_FNDR 0xe001
248#define ZBEE_APS_T2_CID_BR 0xf000
249#define ZBEE_APS_T2_CID_BTADR 0xf001
250#define ZBEE_APS_T2_CID_BTARXOWIDR 0xf00a
251#define ZBEE_APS_T2_CID_BTARACR 0xf00e
252
253
254#define ZBEE_APP_STATUS_SUCCESS 0x00 /*A request has been executed successfully.*/
255#define ZBEE_APP_STATUS_ASDU_TOO_LONG 0xa0 /*A transmit request failed since the ASDU is too large and fragmentation is not supported.*/
256#define ZBEE_APP_STATUS_DEFRAG_DEFERRED 0xa1 /*A received fragmented frame could not be defragmented at the current time.*/
257#define ZBEE_APP_STATUS_DEFRAG_UNSUPPORTED 0xa2 /*A received fragmented frame could not be defragmented since the device does not support fragmentation.*/
258#define ZBEE_APP_STATUS_ILLEGAL_REQUEST 0xa3 /*A parameter value was out of range.*/
259#define ZBEE_APP_STATUS_INVALID_BINDING 0xa4 /*An APSME-UNBIND.request failed due to the requested binding link not existing in the binding table.*/
260#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.*/
261#define ZBEE_APP_STATUS_INVALID_PARAMETER 0xa6 /*A parameter value was invalid or out of range.*/
262#define ZBEE_APP_STATUS_NO_ACK 0xa7 /*An APSDE-DATA.request requesting acknowledged trans-mission failed due to no acknowledgement being received.*/
263#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.*/
264#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*/
265#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.*/
266#define ZBEE_APP_STATUS_SECURED_LINK_KEY 0xab /*An ASDU was received that was secured using a link key.*/
267#define ZBEE_APP_STATUS_SECURED_NWK_KEY 0xac /*An ASDU was received that was secured using a network key.*/
268#define ZBEE_APP_STATUS_SECURITY_FAIL 0xad /*An APSDE-DATA.request requesting security has resulted in an error during the corresponding security processing.*/
269#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.*/
270#define ZBEE_APP_STATUS_UNSECURED 0xaf /*An ASDU was received without any security.*/
271#define ZBEE_APP_STATUS_UNSUPPORTED_ATTRIBUTE 0xb0 /*An APSME-GET.request or APSME-SET.request has been issued with an unknown attribute identifier.*/
272
273#define ZBEE_APS_NODE_PROTO_DATA 0
274
275/* Structure to contain the APS frame information */
276typedef struct{
277 bool indirect_mode; /* ZigBee 2004 and Earlier */
278 uint8_t type;
279 uint8_t delivery;
280 bool ack_format; /* ZigBee 2007 and Later */
281 bool security;
282 bool ack_req;
283 bool ext_header; /* ZigBee 2007 and Later */
284
285 uint8_t dst;
286 uint16_t group; /* ZigBee 2006 and Later */
287 uint16_t profile;
288 uint8_t src;
289 uint8_t counter;
290
291 /* Fragmentation Fields. */
292 uint8_t fragmentation; /* ZigBee 2007 and Later */
293 uint8_t block_number; /* ZigBee 2007 and Later */
294
295 /* Some helpers for the upper layers. */
296 bool profile_present;
297 bool dst_present;
298 bool src_present;
300
301/* Structure to contain APS node information */
303{
304 uint32_t extended_counter;
307};
308
309/* Structure to contain APS node information for a packet */
311{
312 uint32_t extended_counter;
315};
316
317/* ZigBee Smart Energy version used for preferences */
318extern int gPREF_zbee_se_protocol_version;
319
320enum {
321 ZBEE_SE_VERSION_1_1B,
322 ZBEE_SE_VERSION_1_2,
323 ZBEE_SE_VERSION_1_2A,
324 ZBEE_SE_VERSION_1_2B,
325 ZBEE_SE_VERSION_1_4
326};
327
328/**************************************
329 * Value Strings
330 **************************************
331 */
332
333extern const range_string zbee_aps_cid_names[];
334extern const range_string zbee_aps_apid_names[];
335
336#endif /* PACKET_ZBEE_APS_H*/
337
338/*
339 * Editor modelines - https://www.wireshark.org/tools/modelines.html
340 *
341 * Local variables:
342 * c-basic-offset: 4
343 * tab-width: 8
344 * indent-tabs-mode: nil
345 * End:
346 *
347 * vi: set shiftwidth=4 tabstop=8 expandtab:
348 * :indentSize=4:tabSize=8:noTabs=true:
349 */
Definition value_string.h:292
Definition packet-gtp.c:3078
Definition packet-epl.h:22
Definition packet-zbee-aps.h:303
Definition packet-zbee-aps.h:311
Definition packet-zbee-aps.h:276