13#ifndef PACKET_IEEE802154_H
14#define PACKET_IEEE802154_H
17#define IEEE802154_PROTOABBREV_WPAN "wpan"
18#define IEEE802154_PROTOABBREV_WPAN_BEACON "wpan.beacon"
20#define IEEE802154_PROTOABBREV_WPAN_PANID "wpan.panid"
23#define IEEE802154_HEADER_IE_DTABLE "wpan.header_ie"
24#define IEEE802154_PAYLOAD_IE_DTABLE "wpan.payload_ie"
25#define IEEE802154_MLME_IE_DTABLE "wpan.mlme_ie"
26#define IEEE802154_CMD_VENDOR_DTABLE "wpan.cmd.vendor"
29#define IEEE802154_MAX_FRAME_LEN 127
30#define IEEE802154_FCS_LEN 2
33#define IEEE802154_CC24XX_METADATA 0
34#define IEEE802154_FCS_16_BIT 1
35#define IEEE802154_FCS_32_BIT 2
38#define IEEE802154_CMD_ASSOC_REQ 0x01
39#define IEEE802154_CMD_ASSOC_RSP 0x02
40#define IEEE802154_CMD_DISASSOC_NOTIFY 0x03
41#define IEEE802154_CMD_DATA_RQ 0x04
42#define IEEE802154_CMD_PANID_CONFLICT 0x05
43#define IEEE802154_CMD_ORPHAN_NOTIFY 0x06
44#define IEEE802154_CMD_BEACON_REQ 0x07
45#define IEEE802154_CMD_COORD_REALIGN 0x08
46#define IEEE802154_CMD_GTS_REQ 0x09
47#define IEEE802154_CMD_TRLE_MGMT_REQ 0x0a
48#define IEEE802154_CMD_TRLE_MGMT_RSP 0x0b
50#define IEEE802154_CMD_DSME_ASSOC_REQ 0x13
51#define IEEE802154_CMD_DSME_ASSOC_RSP 0x14
52#define IEEE802154_CMD_DSME_GTS_REQ 0x15
53#define IEEE802154_CMD_DSME_GTS_RSP 0x16
54#define IEEE802154_CMD_DSME_GTS_NOTIFY 0x17
55#define IEEE802154_CMD_DSME_INFO_REQ 0x18
56#define IEEE802154_CMD_DSME_INFO_RSP 0x19
57#define IEEE802154_CMD_DSME_BEACON_ALLOC_NOTIFY 0x1a
58#define IEEE802154_CMD_DSME_BEACON_COLL_NOTIFY 0x1b
59#define IEEE802154_CMD_DSME_LINK_REPORT 0x1c
61#define IEEE802154_CMD_RIT_DATA_REQ 0x20
62#define IEEE802154_CMD_DBS_REQ 0x21
63#define IEEE802154_CMD_DBS_RSP 0x22
64#define IEEE802154_CMD_RIT_DATA_RSP 0x23
65#define IEEE802154_CMD_VENDOR_SPECIFIC 0x24
69#define IEEE802154_CMD_ASRSP_AS_SUCCESS 0x00
70#define IEEE802154_CMD_ASRSP_PAN_FULL 0x01
71#define IEEE802154_CMD_ASRSP_PAN_DENIED 0x02
75#define IEEE802154_CMD_CINFO_ALT_PAN_COORD 0x01
76#define IEEE802154_CMD_CINFO_DEVICE_TYPE 0x02
77#define IEEE802154_CMD_CINFO_POWER_SRC 0x04
78#define IEEE802154_CMD_CINFO_IDLE_RX 0x08
79#define IEEE802154_CMD_CINFO_SEC_CAPABLE 0x40
80#define IEEE802154_CMD_CINFO_ALLOC_ADDR 0x80
82#define IEEE802154_CMD_GTS_REQ_LEN 0x0F
83#define IEEE802154_CMD_GTS_REQ_DIR 0x10
84#define IEEE802154_CMD_GTS_REQ_TYPE 0x20
87#define IEEE802154_BEACON_ORDER_MASK 0x000F
88#define IEEE802154_SUPERFRAME_ORDER_MASK 0x00F0
89#define IEEE802154_SUPERFRAME_CAP_MASK 0x0F00
90#define IEEE802154_BATT_EXTENSION_MASK 0x1000
91#define IEEE802154_SUPERFRAME_COORD_MASK 0x4000
92#define IEEE802154_ASSOC_PERMIT_MASK 0x8000
93#define IEEE802154_SUPERFRAME_ORDER_SHIFT 4
94#define IEEE802154_SUPERFRAME_CAP_SHIFT 8
96#define IEEE802154_GTS_COUNT_MASK 0x07
97#define IEEE802154_GTS_PERMIT_MASK 0x80
98#define IEEE802154_GTS_DIRECTION_SLOT(i) (0x01<<(i))
99#define IEEE802154_GTS_MAX_SLOTS 7
100#define IEEE802154_GTS_DIRECTION_SLOT1 0x01
101#define IEEE802154_GTS_DIRECTION_SLOT2 0x02
102#define IEEE802154_GTS_DIRECTION_SLOT3 0x04
103#define IEEE802154_GTS_DIRECTION_SLOT4 0x08
104#define IEEE802154_GTS_DIRECTION_SLOT5 0x10
105#define IEEE802154_GTS_DIRECTION_SLOT6 0x20
106#define IEEE802154_GTS_DIRECTION_SLOT7 0x40
107#define IEEE802154_GTS_SLOT_MASK 0x0F
108#define IEEE802154_GTS_LENGTH_MASK 0xF0
109#define IEEE802154_GTS_LENGTH_SHIFT 4
111#define IEEE802154_PENDADDR_SHORT_MASK 0x07
112#define IEEE802154_PENDADDR_LONG_MASK 0x70
113#define IEEE802154_PENDADDR_LONG_SHIFT 4
115#define IEEE802154_SUPERFRAME_DURATION (IEEE802154_BASE_SLOT_DURATION * IEEE802154_SUPERFRAME_SLOTS)
116#define IEEE802154_BASE_SLOT_DURATION 60
117#define IEEE802154_SUPERFRAME_SLOTS 16
120#define IEEE802154_FCF_TYPE_MASK 0x0007
121#define IEEE802154_FCF_SEC_EN 0x0008
122#define IEEE802154_FCF_FRAME_PND 0x0010
123#define IEEE802154_FCF_ACK_REQ 0x0020
124#define IEEE802154_FCF_PAN_ID_COMPRESSION 0x0040
125#define IEEE802154_FCF_SEQNO_SUPPRESSION 0x0100
126#define IEEE802154_FCF_IE_PRESENT 0x0200
127#define IEEE802154_FCF_DADDR_MASK 0x0C00
128#define IEEE802154_FCF_VERSION 0x3000
129#define IEEE802154_FCF_SADDR_MASK 0xC000
132#define IEEE802154_MPF_FCF_TYPE_MASK 0x0007
133#define IEEE802154_MPF_FCF_LONG_FC 0x0008
134#define IEEE802154_MPF_FCF_DADDR_MASK 0x0030
135#define IEEE802154_MPF_FCF_SADDR_MASK 0x00C0
136#define IEEE802154_MPF_FCF_PAN_ID_PRESENT 0x0100
137#define IEEE802154_MPF_FCF_SEC_EN 0x0200
138#define IEEE802154_MPF_FCF_SEQNO_SUPPRESSION 0x0400
139#define IEEE802154_MPF_FCF_FRAME_PND 0x0800
140#define IEEE802154_MPF_FCF_VERSION 0x3000
141#define IEEE802154_MPF_FCF_ACK_REQ 0x4000
142#define IEEE802154_MPF_FCF_IE_PRESENT 0x8000
145#define IEEE802154_FCF_BEACON 0x0
146#define IEEE802154_FCF_DATA 0x1
147#define IEEE802154_FCF_ACK 0x2
148#define IEEE802154_FCF_CMD 0x3
149#define IEEE802154_FCF_RESERVED 0x4
150#define IEEE802154_FCF_MULTIPURPOSE 0x5
151#define IEEE802154_FCF_FRAGMENT 0x6
152#define IEEE802154_FCF_EXTENDED 0x7
155#define IEEE802154_VERSION_2003 0x0
156#define IEEE802154_VERSION_2006 0x1
157#define IEEE802154_VERSION_2015 0x2
158#define IEEE802154_VERSION_RESERVED 0x3
161#define IEEE802154_FCF_ADDR_NONE 0x0
162#define IEEE802154_FCF_ADDR_RESERVED 0x1
163#define IEEE802154_FCF_ADDR_SHORT 0x2
164#define IEEE802154_FCF_ADDR_EXT 0x3
167#define IEEE802154_HEADER_IE_TYPE_MASK 0x8000
168#define IEEE802154_HEADER_IE_ID_MASK 0x7F80
169#define IEEE802154_HEADER_IE_LENGTH_MASK 0x007F
172#define IEEE802154_PAYLOAD_IE_TYPE_MASK 0x8000
173#define IEEE802154_PAYLOAD_IE_ID_MASK 0x7800
174#define IEEE802154_PAYLOAD_IE_LENGTH_MASK 0x07FF
177#define IEEE802154_PSIE_TYPE_MASK 0x8000
178#define IEEE802154_PSIE_ID_MASK_SHORT 0x7F00
179#define IEEE802154_PSIE_LENGTH_MASK_SHORT 0x00FF
180#define IEEE802154_PSIE_ID_MASK_LONG 0x7800
181#define IEEE802154_PSIE_LENGTH_MASK_LONG 0x07FF
184#define IEEE802154_MLME_PSIE_EB_FLT_PJOIN 0x01
185#define IEEE802154_MLME_PSIE_EB_FLT_LQI 0x02
186#define IEEE802154_MLME_PSIE_EB_FLT_PERCENT 0x04
187#define IEEE802154_MLME_PSIE_EB_FLT_ATTR_LEN 0x18
192#define IEEE802154_CC24xx_CRC_OK 0x8000
193#define IEEE802154_CC24xx_CORRELATION 0x7F00
194#define IEEE802154_CC24xx_RSSI 0x00FF
197#define IEEE802154_NO_ADDR16 0xFFFE
198#define IEEE802154_BCAST_ADDR 0xFFFF
199#define IEEE802154_BCAST_PAN 0xFFFF
202#define IEEE802154_PHY_LENGTH_MASK 0x7F
205#define IEEE802154_AUX_SEC_LEVEL_MASK 0x07
206#define IEEE802154_AUX_KEY_ID_MODE_MASK 0x18
207#define IEEE802154_AUX_KEY_ID_MODE_SHIFT 3
208#define IEEE802154_AUX_FRAME_COUNTER_SUPPRESSION_MASK 0x20
209#define IEEE802154_AUX_ASN_IN_NONCE_MASK 0x40
211#define IEEE802154_AUX_CTRL_RESERVED_MASK 0x80
214#define IEEE802154_THR_WELL_KNOWN_KEY_INDEX 0xff
215#define IEEE802154_THR_WELL_KNOWN_KEY_SRC 0xffffffff
216#define IEEE802154_THR_WELL_KNOWN_EXT_ADDR 0x3506feb823d48712ULL
219#define IEEE802154E_LE_WUF_LEN 12
222 SECURITY_LEVEL_NONE = 0x00,
223 SECURITY_LEVEL_MIC_32 = 0x01,
224 SECURITY_LEVEL_MIC_64 = 0x02,
225 SECURITY_LEVEL_MIC_128 = 0x03,
226 SECURITY_LEVEL_ENC = 0x04,
227 SECURITY_LEVEL_ENC_MIC_32 = 0x05,
228 SECURITY_LEVEL_ENC_MIC_64 = 0x06,
229 SECURITY_LEVEL_ENC_MIC_128 = 0x07
230} ieee802154_security_level;
233 KEY_ID_MODE_IMPLICIT = 0x00,
234 KEY_ID_MODE_KEY_INDEX = 0x01,
235 KEY_ID_MODE_KEY_EXPLICIT_4 = 0x02,
236 KEY_ID_MODE_KEY_EXPLICIT_8 = 0x03
237} ieee802154_key_id_mode;
240 KEY_HASH_NONE = 0x00,
242 KEY_HASH_THREAD = 0x02
243} ieee802154_key_hash;
246#define IEEE802154_HEADER_IE_VENDOR_SPECIFIC 0x00
248#define IEEE802154_HEADER_IE_CSL 0x1a
249#define IEEE802154_HEADER_IE_RIT 0x1b
250#define IEEE802154_HEADER_IE_DSME_PAN 0x1c
251#define IEEE802154_HEADER_IE_RENDEZVOUS 0x1d
252#define IEEE802154_HEADER_IE_TIME_CORR 0x1e
254#define IEEE802154_HEADER_IE_EXT_DSME_PAN 0x21
255#define IEEE802154_HEADER_IE_FSCD 0x22
256#define IEEE802154_HEADER_IE_SMPL_SUPER_FRM 0x23
257#define IEEE802154_HEADER_IE_SMPL_GTS 0x24
258#define IEEE802154_HEADER_IE_LECIM 0x25
259#define IEEE802154_HEADER_IE_TRLE 0x26
260#define IEEE802154_HEADER_IE_RCC_CAP 0x27
261#define IEEE802154_HEADER_IE_RCCN 0x28
262#define IEEE802154_HEADER_IE_GLOBAL_TIME 0x29
263#define IEEE802154_HEADER_IE_WISUN 0x2a
264#define IEEE802154_HEADER_IE_DA_IE 0x2b
266#define IEEE802154_HEADER_IE_HT1 0x7e
267#define IEEE802154_HEADER_IE_HT2 0x7f
270#define IEEE802154_HEADER_IE_THREAD 0x9b
275#define IEEE802154_PAYLOAD_IE_ESDU 0x0
276#define IEEE802154_PAYLOAD_IE_MLME 0x1
277#define IEEE802154_PAYLOAD_IE_VENDOR 0x2
278#define IEEE802154_PAYLOAD_IE_MPX 0x3
279#define IEEE802154_PAYLOAD_IE_WISUN 0x4
280#define IEEE802154_PAYLOAD_IE_IETF 0x5
282#define IEEE802154_PAYLOAD_IE_TERMINATION 0xf
288#define IEEE802154_MLME_SUBIE_CHANNEL_HOPPING 0x9
291#define IEEE802154_MLME_SUBIE_TSCH_SYNCH 0x1A
292#define IEEE802154_MLME_SUBIE_TSCH_SLOTFR_LINK 0x1B
293#define IEEE802154_MLME_SUBIE_TSCH_TIMESLOT 0x1C
294#define IEEE802154_MLME_SUBIE_HOPPING_TIMING 0x1D
295#define IEEE802154_MLME_SUBIE_ENHANCED_BEACON_FILTER 0x1E
296#define IEEE802154_MLME_SUBIE_MAC_METRICS 0x1F
297#define IEEE802154_MLME_SUBIE_ALL_MAC_METRICS 0x20
298#define IEEE802154_MLME_SUBIE_COEXISTENCE_SPEC 0x21
299#define IEEE802154_MLME_SUBIE_SUN_DEVICE_CAPABILITIES 0x22
300#define IEEE802154_MLME_SUBIE_SUN_FSK_GEN_PHY 0x23
301#define IEEE802154_MLME_SUBIE_MODE_SWITCH_PARAMETER 0x24
302#define IEEE802154_MLME_SUBIE_PHY_PARAMETER_CHANGE 0x25
303#define IEEE802154_MLME_SUBIE_O_QPSK_PHY_MODE 0x26
304#define IEEE802154_MLME_SUBIE_PCA_ALLOCATION 0x27
305#define IEEE802154_MLME_SUBIE_DSSS_OPER_MODE 0x28
306#define IEEE802154_MLME_SUBIE_FSK_OPER_MODE 0x29
307#define IEEE802154_MLME_SUBIE_TVWS_PHY_OPE_MODE 0x2B
308#define IEEE802154_MLME_SUBIE_TVWS_DEVICE_CAPAB 0x2C
309#define IEEE802154_MLME_SUBIE_TVWS_DEVICE_CATEG 0x2D
310#define IEEE802154_MLME_SUBIE_TVWS_DEVICE_IDENTIF 0x2E
311#define IEEE802154_MLME_SUBIE_TVWS_DEVICE_LOCATION 0x2F
312#define IEEE802154_MLME_SUBIE_TVWS_CH_INFOR_QUERY 0x30
313#define IEEE802154_MLME_SUBIE_TVWS_CH_INFOR_SOURCE 0x31
314#define IEEE802154_MLME_SUBIE_CTM 0x32
315#define IEEE802154_MLME_SUBIE_TIMESTAMP 0x33
316#define IEEE802154_MLME_SUBIE_TIMESTAMP_DIFF 0x34
317#define IEEE802154_MLME_SUBIE_TMCP_SPECIFICATION 0x35
318#define IEEE802154_MLME_SUBIE_RCC_PHY_OPER_MODE 0x36
322#define IEEE802154_IETF_SUBIE_6TOP_DRAFT 0xC9
323#define IEEE802154_IETF_SUBIE_6TOP 0x01
326#define IEEE802154_CIPHER_SIZE 16
329#define IEEE80215_CID 0xBA55ECULL
332#define IEEE802154_MIC_LENGTH(_level_) ((0x2 << ((_level_) & 0x3)) & ~0x3)
334#define IEEE802154_IS_ENCRYPTED(_level_) ((_level_) & 0x4)
337#define IETF_6TOP_VERSION 0x0F
338#define IETF_6TOP_TYPE 0x30
339#define IETF_6TOP_FLAGS_RESERVED 0xC0
340#define IETF_6TOP_SEQNUM 0xFF
343#define IETF_6TOP_CMD_ADD 0x01
344#define IETF_6TOP_CMD_DELETE 0x02
345#define IETF_6TOP_CMD_RELOCATE 0x03
346#define IETF_6TOP_CMD_COUNT 0x04
347#define IETF_6TOP_CMD_LIST 0x05
348#define IETF_6TOP_CMD_SIGNAL 0x06
349#define IETF_6TOP_CMD_CLEAR 0x07
350#define IETF_6TOP_RC_SUCCESS 0x00
351#define IETF_6TOP_RC_EOL 0x01
352#define IETF_6TOP_RC_ERR 0x02
353#define IETF_6TOP_RC_RESET 0x03
354#define IETF_6TOP_RC_ERR_VERSION 0x04
355#define IETF_6TOP_RC_ERR_SFID 0x05
356#define IETF_6TOP_RC_ERR_SEQNUM 0x06
357#define IETF_6TOP_RC_ERR_CELLLIST 0x07
358#define IETF_6TOP_RC_ERR_BUSY 0x08
359#define IETF_6TOP_RC_ERR_LOCKED 0x09
362#define IETF_6TOP_TYPE_REQUEST 0x00
363#define IETF_6TOP_TYPE_RESPONSE 0x01
364#define IETF_6TOP_TYPE_CONFIRMATION 0x02
365#define IETF_6TOP_TYPE_RESERVED 0x03
368#define IETF_6TOP_CELL_OPTION_TX 0x01
369#define IETF_6TOP_CELL_OPTION_RX 0x02
370#define IETF_6TOP_CELL_OPTION_SHARED 0x04
371#define IETF_6TOP_CELL_OPTION_RESERVED 0xF8
374#define IEEE802159_MPX_TRANSFER_TYPE_MASK 0x07
375#define IEEE802159_MPX_TRANSACTION_ID_MASK 0xf8
376#define IEEE802159_MPX_TRANSACTION_ID_SHIFT 0x03
378#define IEEE802159_MPX_FULL_FRAME 0
379#define IEEE802159_MPX_FULL_FRAME_NO_MUXID 1
380#define IEEE802159_MPX_NON_LAST_FRAGMENT 2
381#define IEEE802159_MPX_LAST_FRAGMENT 4
382#define IEEE802159_MPX_ABORT 6
384#define IEEE802159_MPX_MULTIPLEX_ID_KMP 1
385#define IEEE802159_MPX_MULTIPLEX_ID_WISUN 2
387#define IEEE802159_MPX_KMP_ID_IEEE8021X 1
388#define IEEE802159_MPX_KMP_ID_HIP 2
389#define IEEE802159_MPX_KMP_ID_IKEV2 3
390#define IEEE802159_MPX_KMP_ID_PANA 4
391#define IEEE802159_MPX_KMP_ID_DRAGONFLY 5
392#define IEEE802159_MPX_KMP_ID_IEEE80211_4WH 6
393#define IEEE802159_MPX_KMP_ID_IEEE80211_GKH 7
394#define IEEE802159_MPX_KMP_ID_ETSI_TS_102_887_2 8
395#define IEEE802159_MPX_KMP_ID_VENDOR_SPECIFIC 255
397#define IEEE802159_MPX_WISUN_SUBID_MHDS 0
398#define IEEE802159_MPX_WISUN_SUBID_6LOWPAN 1
399#define IEEE802159_MPX_WISUN_SUBID_SECURITY 2
406 int32_t dst_addr_mode;
407 int32_t src_addr_mode;
408 bool security_enable;
411 bool pan_id_compression;
412 bool seqno_suppression;
416 bool long_frame_control;
421 bool payload_ie_present;
423 bool dst_pan_present;
424 bool src_pan_present;
433 ieee802154_security_level security_level;
434 ieee802154_key_id_mode key_id_mode;
435 bool frame_counter_suppression;
436 uint32_t frame_counter;
437 uint8_t key_sequence_counter;
448 GHashTable *short_table;
453 GHashTable *long_table;
454 GHashTable *short_table;
477#define IEEE802154_USER_MAPPING 0
488 DECRYPT_PACKET_SUCCEEDED,
489 DECRYPT_NOT_ENCRYPTED,
490 DECRYPT_FRAME_COUNTER_SUPPRESSION_UNSUPPORTED,
491 DECRYPT_PACKET_TOO_SMALL,
492 DECRYPT_PACKET_NO_EXT_SRC_ADDR,
493 DECRYPT_PACKET_NO_KEY,
494 DECRYPT_PACKET_DECRYPT_FAILED,
495 DECRYPT_PACKET_MIC_CHECK_FAILED
496} ieee802154_decrypt_status;
502 ieee802154_key_hash hash_type;
503 uint8_t key[IEEE802154_CIPHER_SIZE];
504 uint8_t mle_key[IEEE802154_CIPHER_SIZE];
512void ccm_init_block(uint8_t *block,
bool adata,
int M, uint64_t addr, uint32_t frame_counter, uint8_t level,
int ctr_val,
const uint8_t *generic_nonce);
513bool ccm_ctr_encrypt(
const uint8_t *key,
const uint8_t *iv, uint8_t *mic, uint8_t *data,
int length);
514bool ccm_cbc_mac(
const uint8_t *key,
const uint8_t *iv,
const uint8_t *a,
int a_len,
const uint8_t *m,
int m_len, uint8_t *mic);
521#define IEEE802154_DISSECT_HEADER_OPTION_NO_AUX_SEC_HDR (1 << 1)
575 unsigned char* rx_mic;
576 unsigned* rx_mic_length;
579 ieee802154_decrypt_status* status;
594extern void register_ieee802154_mac_key_hash_handler(
unsigned hash_identifier, ieee802154_set_key_func key_func);
598 const char *,
unsigned);
599extern unsigned ieee802154_short_addr_hash(
const void *);
600extern unsigned ieee802154_long_addr_hash(
const void *key);
601extern gboolean ieee802154_short_addr_equal(
const void *,
const void *);
602extern gboolean ieee802154_long_addr_equal(
const void *a,
const void *b);
604extern bool ieee802154_short_addr_invalidate(uint16_t, uint16_t,
unsigned);
605extern bool ieee802154_long_addr_invalidate(uint64_t,
unsigned);
612extern unsigned ieee802154_fcs_len;
Definition packet_info.h:43
Mapping between a 32-bit integer value and its string representation.
Definition value_string.h:33
Definition packet-ieee802154.h:570
Definition packet-ieee802154.h:479
Definition packet-ieee802154.h:499
Definition packet-ieee802154.h:464
Definition packet-ieee802154.h:469
Definition packet-ieee802154.h:452
Definition packet-ieee802154.h:402
Definition packet-ieee802154.h:458
Definition tvbuff-int.h:35