40#ifndef NRF_802154_FRAME_H
41#define NRF_802154_FRAME_H
50#ifdef __STATIC_INLINE__
51#undef __STATIC_INLINE__
54#ifdef NRF_802154_FRAME_DECLARE_ONLY
55#define __STATIC_INLINE__
57#define __STATIC_INLINE__ __STATIC_INLINE
60#define NRF_802154_FRAME_INVALID_OFFSET 0xff
154 uint8_t panid_offset;
791 const uint8_t * p_ie_header);
804 const uint8_t * p_ie_iterator);
825 const uint8_t * p_ie_iterator);
848 const uint8_t * p_end_addr);
883 const uint8_t * p_ie_iterator);
905 const uint8_t * p_ie_iterator);
907#ifndef NRF_802154_FRAME_DECLARE_ONLY
1048 return &p_parser_data->
p_frame[offset];
1067 return &p_parser_data->
p_frame[offset];
1086 return &p_parser_data->
p_frame[offset];
1105 return &p_parser_data->
p_frame[offset];
1188 return &p_parser_data->
p_frame[offset];
1207 return &p_parser_data->
p_frame[offset];
1226 return &p_parser_data->
p_frame[offset];
1245 return &p_parser_data->
p_frame[offset];
1270 return p_parser_data->
p_frame[offset];
1289 return &p_parser_data->
p_frame[offset];
1308 return &p_parser_data->
p_frame[offset];
1333 return &p_parser_data->
p_frame[offset];
1352 return &p_parser_data->
p_frame[offset];
1368 return payload_end - payload_start;
1382 return mhr_end - mhr_start;
1401 return &p_parser_data->
p_frame[offset];
1420 return &p_parser_data->
p_frame[offset];
1430 const uint8_t * p_ie_header)
1436 const uint8_t * p_ie_iterator)
1447 const uint8_t * p_ie_iterator)
1459 const uint8_t * p_end_addr)
1465 || (p_ie_iterator >= p_end_addr);
1474 const uint8_t * p_ie_iterator)
1480 const uint8_t * p_ie_iterator)
#define FRAME_TYPE_OFFSET
Definition nrf_802154_const.h:70
#define FRAME_PENDING_OFFSET
Definition nrf_802154_const.h:67
#define IE_ID_OFFSET_1
Definition nrf_802154_const.h:227
#define DSN_SUPPRESS_OFFSET
Definition nrf_802154_const.h:62
#define SECURITY_LEVEL_MASK
Definition nrf_802154_const.h:133
#define FCS_SIZE
Definition nrf_802154_const.h:154
#define PHR_SIZE
Definition nrf_802154_const.h:166
#define SRC_ADDR_TYPE_SHORT
Definition nrf_802154_const.h:147
#define IE_VENDOR_THREAD_DATA_OFFSET
Definition nrf_802154_const.h:201
#define IE_HT1
Definition nrf_802154_const.h:222
#define FRAME_TYPE_MULTIPURPOSE
Definition nrf_802154_const.h:78
#define IE_LENGTH_OFFSET
Definition nrf_802154_const.h:225
#define ACK_REQUEST_OFFSET
Definition nrf_802154_const.h:49
#define SECURITY_ENABLED_BIT
Definition nrf_802154_const.h:132
#define FRAME_VERSION_OFFSET
Definition nrf_802154_const.h:80
#define IE_HT2
Definition nrf_802154_const.h:223
#define IE_DATA_OFFSET
Definition nrf_802154_const.h:228
#define IE_VENDOR_OUI_OFFSET
Definition nrf_802154_const.h:198
#define PSDU_OFFSET
Definition nrf_802154_const.h:129
#define FRAME_TYPE_COMMAND
Definition nrf_802154_const.h:74
#define IE_PRESENT_OFFSET
Definition nrf_802154_const.h:88
#define ASN_IN_NONCE_BIT
Definition nrf_802154_const.h:52
#define FRAME_TYPE_MASK
Definition nrf_802154_const.h:71
#define PHR_OFFSET
Definition nrf_802154_const.h:126
#define IE_VENDOR_THREAD_SUBTYPE_OFFSET
Definition nrf_802154_const.h:200
#define FRAME_PENDING_BIT
Definition nrf_802154_const.h:68
#define DSN_OFFSET
Definition nrf_802154_const.h:61
#define DSN_SUPPRESS_BIT
Definition nrf_802154_const.h:63
#define SRC_ADDR_TYPE_EXTENDED
Definition nrf_802154_const.h:143
#define DEST_ADDR_TYPE_EXTENDED
Definition nrf_802154_const.h:56
#define IE_ID_OFFSET_0
Definition nrf_802154_const.h:226
#define KEY_ID_MODE_BIT_OFFSET
Definition nrf_802154_const.h:97
#define SECURITY_ENABLED_OFFSET
Definition nrf_802154_const.h:131
#define PAN_ID_COMPR_OFFSET
Definition nrf_802154_const.h:121
#define ACK_REQUEST_BIT
Definition nrf_802154_const.h:50
#define FRAME_VERSION_MASK
Definition nrf_802154_const.h:81
#define KEY_ID_MODE_MASK
Definition nrf_802154_const.h:96
#define IE_PRESENT_BIT
Definition nrf_802154_const.h:89
#define PAN_ID_COMPR_MASK
Definition nrf_802154_const.h:122
#define DEST_ADDR_TYPE_OFFSET
Definition nrf_802154_const.h:54
#define FRAME_COUNTER_SUPPRESS_BIT
Definition nrf_802154_const.h:65
#define IE_LENGTH_MASK
Definition nrf_802154_const.h:224
#define SRC_ADDR_TYPE_MASK
Definition nrf_802154_const.h:145
#define SRC_ADDR_TYPE_OFFSET
Definition nrf_802154_const.h:146
#define DEST_ADDR_TYPE_MASK
Definition nrf_802154_const.h:55
__STATIC_INLINE uint8_t nrf_802154_frame_sec_ctrl_sec_lvl_get(const nrf_802154_frame_t *p_parser_data)
Gets the value of the Security Level field from the Security Control Field.
Definition nrf_802154_frame.h:1126
__STATIC_INLINE const uint8_t * nrf_802154_frame_src_panid_get(const nrf_802154_frame_t *p_parser_data)
Gets the address of the Source PAN ID field.
Definition nrf_802154_frame.h:1076
__STATIC_INLINE uint8_t nrf_802154_frame_mac_header_length_get(const nrf_802154_frame_t *p_parser_data)
Gets the length of the MAC header.
Definition nrf_802154_frame.h:1371
__STATIC_INLINE const uint8_t * nrf_802154_frame_dst_panid_get(const nrf_802154_frame_t *p_parser_data)
Gets the address of the Destination PAN field.
Definition nrf_802154_frame.h:1038
__STATIC_INLINE const uint8_t * nrf_802154_frame_key_id_get(const nrf_802154_frame_t *p_parser_data)
Gets the address of the Key ID field.
Definition nrf_802154_frame.h:1216
__STATIC_INLINE const uint8_t * nrf_802154_frame_psdu_get(const nrf_802154_frame_t *p_parser_data)
Gets the PSDU start address of the frame.
Definition nrf_802154_frame.h:927
__STATIC_INLINE uint8_t nrf_802154_frame_src_panid_offset_get(const nrf_802154_frame_t *p_parser_data)
Gets the offset of frame Source PAN ID.
Definition nrf_802154_frame.h:1070
__STATIC_INLINE bool nrf_802154_frame_dst_addr_is_extended(const nrf_802154_frame_t *p_parser_data)
Determines if the destination address is extended.
Definition nrf_802154_frame.h:951
__STATIC_INLINE const uint8_t * nrf_802154_frame_key_source_get(const nrf_802154_frame_t *p_parser_data)
Gets the address of the Key Source field.
Definition nrf_802154_frame.h:1235
__STATIC_INLINE const uint8_t * nrf_802154_frame_src_addr_get(const nrf_802154_frame_t *p_parser_data)
Gets the address of the Source Address field.
Definition nrf_802154_frame.h:1095
__STATIC_INLINE bool nrf_802154_frame_panid_compression_is_set(const nrf_802154_frame_t *p_parser_data)
Gets the value of the PAN ID compressions bit from the Frame Control Field.
Definition nrf_802154_frame.h:1002
__STATIC_INLINE uint8_t nrf_802154_frame_ie_header_offset_get(const nrf_802154_frame_t *p_parser_data)
Gets the offset of the IE header.
Definition nrf_802154_frame.h:1273
__STATIC_INLINE uint8_t nrf_802154_frame_mac_payload_length_get(const nrf_802154_frame_t *p_parser_data)
Gets the length of the MAC payload.
Definition nrf_802154_frame.h:1361
__STATIC_INLINE uint8_t nrf_802154_frame_ie_id_get(const uint8_t *p_ie_iterator)
Gets identifier of currently iterated IE.
Definition nrf_802154_frame.h:1453
__STATIC_INLINE uint8_t nrf_802154_frame_mic_size_get(const nrf_802154_frame_t *p_parser_data)
Gets the length of the MIC field.
Definition nrf_802154_frame.h:1355
__STATIC_INLINE bool nrf_802154_frame_ie_present_bit_is_set(const nrf_802154_frame_t *p_parser_data)
Gets the value of the IE present bit from the Frame Control Field.
Definition nrf_802154_frame.h:984
__STATIC_INLINE const uint8_t * nrf_802154_frame_mac_command_id_get(const nrf_802154_frame_t *p_parser_data)
Gets the address of the MAC Command ID field.
Definition nrf_802154_frame.h:1323
__STATIC_INLINE const uint8_t * nrf_802154_frame_ie_vendor_thread_data_addr_get(const uint8_t *p_ie_iterator)
Gets vendor-specific IE thread data address of currently iterated IE.
Definition nrf_802154_frame.h:1479
__STATIC_INLINE const uint8_t * nrf_802154_frame_ie_content_address_get(const uint8_t *p_ie_iterator)
Gets payload address of currently iterated IE.
Definition nrf_802154_frame.h:1435
__STATIC_INLINE const uint8_t * nrf_802154_frame_ie_header_get(const nrf_802154_frame_t *p_parser_data)
Gets the address of the IE header.
Definition nrf_802154_frame.h:1279
__STATIC_INLINE uint8_t nrf_802154_frame_counter_offset_get(const nrf_802154_frame_t *p_parser_data)
Gets the offset of the Frame Counter field.
Definition nrf_802154_frame.h:1191
__STATIC_INLINE uint8_t nrf_802154_frame_dst_addressing_end_offset_get(const nrf_802154_frame_t *p_parser_data)
Gets the end offset of the destination addressing section.
Definition nrf_802154_frame.h:1385
__STATIC_INLINE uint8_t nrf_802154_frame_ie_vendor_thread_subtype_get(const uint8_t *p_ie_iterator)
Gets subtype of Thread vendor-specific IE.
Definition nrf_802154_frame.h:1473
__STATIC_INLINE const uint8_t * nrf_802154_frame_dsn_get(const nrf_802154_frame_t *p_parser_data)
Gets the value of the DSN field.
Definition nrf_802154_frame.h:1021
__STATIC_INLINE bool nrf_802154_frame_sec_ctrl_fc_suppress_bit_is_set(const nrf_802154_frame_t *p_parser_data)
Gets the value of the Frame Counter Suppress bit from the Security Control Field.
Definition nrf_802154_frame.h:1139
__STATIC_INLINE const uint8_t * nrf_802154_frame_ie_iterator_next(const uint8_t *p_ie_iterator)
Gets next information element iterator.
Definition nrf_802154_frame.h:1446
__STATIC_INLINE const uint8_t * nrf_802154_frame_header_ie_iterator_begin(const uint8_t *p_ie_header)
Initializes the IE iterator with given IE header address.
Definition nrf_802154_frame.h:1429
__STATIC_INLINE bool nrf_802154_frame_sec_ctrl_asn_in_nonce_bit_is_set(const nrf_802154_frame_t *p_parser_data)
Gets the value of the ASN in Nonce bit from the Security Control Field.
Definition nrf_802154_frame.h:1165
__STATIC_INLINE bool nrf_802154_frame_security_enabled_bit_is_set(const nrf_802154_frame_t *p_parser_data)
Gets the value of the Security Enabled bit from the Frame Control Field.
Definition nrf_802154_frame.h:978
__STATIC_INLINE uint8_t nrf_802154_frame_type_get(const nrf_802154_frame_t *p_parser_data)
Gets the value of the frame type field from the Frame Control Field.
Definition nrf_802154_frame.h:996
nrf_802154_frame_parser_level_t
Definition nrf_802154_frame.h:63
@ PARSE_LEVEL_FULL
Parse level for fully parsed frame. All fields can be considered valid and complete.
Definition nrf_802154_frame.h:133
@ PARSE_LEVEL_NONE
Parse level at which no parsing has been performed on the frame.
Definition nrf_802154_frame.h:69
@ PARSE_LEVEL_ADDRESSING_END
Parse level at which the data under offsets determined by the FCF can be considered complete.
Definition nrf_802154_frame.h:102
@ PARSE_LEVEL_SEC_CTRL_OFFSETS
Parse level at which the offsets that can be determined based on Security Control Field can be consid...
Definition nrf_802154_frame.h:112
@ PARSE_LEVEL_MAX
Definition nrf_802154_frame.h:135
@ PARSE_LEVEL_AUX_SEC_HDR_END
Parse level at which the data under offsets determined by the Security Control Field can be considere...
Definition nrf_802154_frame.h:122
@ PARSE_LEVEL_DST_ADDRESSING_END
Parse level at which the destination address data can be considered complete.
Definition nrf_802154_frame.h:92
@ PARSE_LEVEL_FCF_OFFSETS
Parse level at which the offsets that can be determined based on the FCF can be considered valid.
Definition nrf_802154_frame.h:82
__STATIC_INLINE uint8_t nrf_802154_frame_sec_ctrl_key_id_mode_get(const nrf_802154_frame_t *p_parser_data)
Gets the value of the Key ID Mode field from the Security Control Field.
Definition nrf_802154_frame.h:1152
__STATIC_INLINE uint8_t nrf_802154_frame_length_get(const nrf_802154_frame_t *p_parser_data)
Gets the PSDU length of the frame.
Definition nrf_802154_frame.h:915
__STATIC_INLINE uint8_t nrf_802154_frame_dst_addr_type_get(const nrf_802154_frame_t *p_parser_data)
Gets the MAC frame destination address type from the Frame Control Field.
Definition nrf_802154_frame.h:945
__STATIC_INLINE uint8_t nrf_802154_frame_dst_addr_offset_get(const nrf_802154_frame_t *p_parser_data)
Gets the offset of frame Destination Address.
Definition nrf_802154_frame.h:1051
__STATIC_INLINE uint8_t nrf_802154_frame_version_get(const nrf_802154_frame_t *p_parser_data)
Gets the MAC frame version value from the Frame Control Field.
Definition nrf_802154_frame.h:933
__STATIC_INLINE bool nrf_802154_frame_ie_iterator_end(const uint8_t *p_ie_iterator, const uint8_t *p_end_addr)
Checks if the current IE is a terminator.
Definition nrf_802154_frame.h:1458
__STATIC_INLINE const uint8_t * nrf_802154_frame_sec_ctrl_get(const nrf_802154_frame_t *p_parser_data)
Gets the address of the Security Control Field.
Definition nrf_802154_frame.h:1178
__STATIC_INLINE uint8_t nrf_802154_frame_aux_sec_hdr_end_offset_get(const nrf_802154_frame_t *p_parser_data)
Gets the end offset of the security header section.
Definition nrf_802154_frame.h:1423
__STATIC_INLINE const uint8_t * nrf_802154_frame_counter_get(const nrf_802154_frame_t *p_parser_data)
Gets the address of the Frame Counter field.
Definition nrf_802154_frame.h:1197
#define NRF_802154_FRAME_INVALID_OFFSET
Definition nrf_802154_frame.h:60
__STATIC_INLINE uint8_t nrf_802154_frame_key_source_length_get(const nrf_802154_frame_t *p_parser_data)
Gets the length of the Key Source field.
Definition nrf_802154_frame.h:1248
__STATIC_INLINE const uint8_t * nrf_802154_frame_dst_addr_get(const nrf_802154_frame_t *p_parser_data)
Gets the address of the Destination Address field.
Definition nrf_802154_frame.h:1057
__STATIC_INLINE uint8_t nrf_802154_frame_sec_ctrl_offset_get(const nrf_802154_frame_t *p_parser_data)
Gets the offset of the Security Control Field.
Definition nrf_802154_frame.h:1120
__STATIC_INLINE bool nrf_802154_frame_ar_bit_is_set(const nrf_802154_frame_t *p_parser_data)
Gets the value of the AR bit from the Frame Control Field.
Definition nrf_802154_frame.h:1008
__STATIC_INLINE uint8_t nrf_802154_frame_src_addr_type_get(const nrf_802154_frame_t *p_parser_data)
Gets the MAC frame source address type from the Frame Control Field.
Definition nrf_802154_frame.h:958
__STATIC_INLINE uint8_t nrf_802154_frame_key_index_offset_get(const nrf_802154_frame_t *p_parser_data)
Gets the offset of the Key Index field.
Definition nrf_802154_frame.h:1254
__STATIC_INLINE bool nrf_802154_frame_src_addr_is_short(const nrf_802154_frame_t *p_parser_data)
Determines if the source address is short.
Definition nrf_802154_frame.h:971
__STATIC_INLINE uint8_t nrf_802154_frame_mac_command_id_offset_get(const nrf_802154_frame_t *p_parser_data)
Gets the offset of the MAC Command ID field.
Definition nrf_802154_frame.h:1311
__STATIC_INLINE const uint8_t * nrf_802154_frame_mfr_get(const nrf_802154_frame_t *p_parser_data)
Gets the address of the MFR field.
Definition nrf_802154_frame.h:1342
__STATIC_INLINE bool nrf_802154_frame_dsn_suppress_bit_is_set(const nrf_802154_frame_t *p_parser_data)
Gets the value of the DSN suppress bit from the Frame Control Field.
Definition nrf_802154_frame.h:939
__STATIC_INLINE uint32_t nrf_802154_frame_ie_vendor_oui_get(const uint8_t *p_ie_iterator)
Gets vendor-specific OUI (organizationally unique identifier) of currently iterated IE.
Definition nrf_802154_frame.h:1468
__STATIC_INLINE uint8_t nrf_802154_frame_key_source_offset_get(const nrf_802154_frame_t *p_parser_data)
Gets the offset of the Key Source field.
Definition nrf_802154_frame.h:1229
__STATIC_INLINE uint8_t nrf_802154_frame_dst_addr_size_get(const nrf_802154_frame_t *p_parser_data)
Gets the size of the destination address.
Definition nrf_802154_frame.h:1114
__STATIC_INLINE uint8_t nrf_802154_frame_mac_payload_offset_get(const nrf_802154_frame_t *p_parser_data)
Gets the offset of the MAC payload.
Definition nrf_802154_frame.h:1292
__STATIC_INLINE uint8_t nrf_802154_frame_addressing_end_offset_get(const nrf_802154_frame_t *p_parser_data)
Gets the end offset of the addressing section.
Definition nrf_802154_frame.h:1404
__STATIC_INLINE uint8_t nrf_802154_frame_src_addr_offset_get(const nrf_802154_frame_t *p_parser_data)
Gets the offset of frame Source Address.
Definition nrf_802154_frame.h:1089
__STATIC_INLINE uint8_t nrf_802154_frame_psdu_offset_get(const nrf_802154_frame_t *p_parser_data)
Gets the PSDU start offset of the frame.
Definition nrf_802154_frame.h:921
__STATIC_INLINE uint8_t nrf_802154_frame_dst_panid_offset_get(const nrf_802154_frame_t *p_parser_data)
Gets the offset of the Destination PAN ID field.
Definition nrf_802154_frame.h:1032
__STATIC_INLINE const uint8_t * nrf_802154_frame_dst_addressing_end_get(const nrf_802154_frame_t *p_parser_data)
Gets the end address of the destination addressing section.
Definition nrf_802154_frame.h:1391
__STATIC_INLINE uint8_t nrf_802154_frame_ie_length_get(const uint8_t *p_ie_iterator)
Gets length of currently iterated IE.
Definition nrf_802154_frame.h:1441
__STATIC_INLINE const uint8_t * nrf_802154_frame_mac_payload_get(const nrf_802154_frame_t *p_parser_data)
Gets the address of the MAC payload.
Definition nrf_802154_frame.h:1298
__STATIC_INLINE uint8_t nrf_802154_frame_mfr_offset_get(const nrf_802154_frame_t *p_parser_data)
Gets the offset of the MFR field.
Definition nrf_802154_frame.h:1336
__STATIC_INLINE bool nrf_802154_frame_src_addr_is_extended(const nrf_802154_frame_t *p_parser_data)
Determines if the source address is extended.
Definition nrf_802154_frame.h:964
__STATIC_INLINE const uint8_t * nrf_802154_frame_addressing_end_get(const nrf_802154_frame_t *p_parser_data)
Gets the end address of the addressing section.
Definition nrf_802154_frame.h:1410
__STATIC_INLINE uint8_t nrf_802154_frame_key_index_get(const nrf_802154_frame_t *p_parser_data)
Gets the address of the Key Index field.
Definition nrf_802154_frame.h:1260
__STATIC_INLINE nrf_802154_frame_parser_level_t nrf_802154_frame_parse_level_get(const nrf_802154_frame_t *p_parser_data)
Gets current parse level of the provided parser data.
Definition nrf_802154_frame.h:909
__STATIC_INLINE uint8_t nrf_802154_frame_src_addr_size_get(const nrf_802154_frame_t *p_parser_data)
Gets the size of the source address.
Definition nrf_802154_frame.h:1108
__STATIC_INLINE uint8_t nrf_802154_frame_key_id_offset_get(const nrf_802154_frame_t *p_parser_data)
Gets the offset of the Key ID field.
Definition nrf_802154_frame.h:1210
__STATIC_INLINE bool nrf_802154_frame_pending_bit_is_set(const nrf_802154_frame_t *p_parser_data)
Definition nrf_802154_frame.h:990
#define NULL
Definition osal_types.h:36
uint8_t valid_data_len
Number of valid bytes in the frame.
Definition nrf_802154_frame.h:142
uint8_t addr_offset
Destination address offset.
Definition nrf_802154_frame.h:149
uint8_t frame_counter_offset
Frame Counter field offset.
Definition nrf_802154_frame.h:161
uint8_t addressing_end_offset
Addressing end offset.
Definition nrf_802154_frame.h:180
uint8_t src_addr_size
Source address size;.
Definition nrf_802154_frame.h:178
nrf_802154_frame_parser_level_t parse_level
Current frame parse level.
Definition nrf_802154_frame.h:141
uint8_t sec_ctrl_offset
Security Control Field offset.
Definition nrf_802154_frame.h:160
uint8_t aux_sec_hdr_end_offset
Auxiliary Security Header offset.
Definition nrf_802154_frame.h:181
uint8_t mac_payload_offset
MAC payload offset.
Definition nrf_802154_frame.h:172
uint8_t key_id_offset
Key ID offset.
Definition nrf_802154_frame.h:162
struct nrf_802154_frame_t::@19 helper
uint8_t * p_frame
Pointer to a buffer containing the frame bytes.
Definition nrf_802154_frame.h:140
uint8_t dst_addr_size
Destination address size;.
Definition nrf_802154_frame.h:177
struct nrf_802154_frame_t::@17::@20 dst
uint8_t panid_offset
Destination PAN ID offset.
Definition nrf_802154_frame.h:148
uint8_t key_idx_offset
Key Index offset.
Definition nrf_802154_frame.h:164
uint8_t key_src_offset
Key Source offset.
Definition nrf_802154_frame.h:163
uint8_t key_src_size
Key Source size.
Definition nrf_802154_frame.h:182
uint8_t dst_addressing_end_offset
Destination addressing end offset.
Definition nrf_802154_frame.h:179
struct nrf_802154_frame_t::@17 mhr
uint8_t mic_size
Message Integrity Code size.
Definition nrf_802154_frame.h:183
struct nrf_802154_frame_t::@17::@22 aux_sec_hdr
struct nrf_802154_frame_t::@17::@21 src
struct nrf_802154_frame_t::@18 mac_payload
uint8_t header_ie_offset
Header IE offset.
Definition nrf_802154_frame.h:167
Definition nrf_802154_frame.h:139