nrfxlib API 2.8.99
Loading...
Searching...
No Matches
nrf_802154_frame_parser.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018, Nordic Semiconductor ASA
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright notice, this
11 * list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
18 * contributors may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 *
33 */
34
40#ifndef NRF_802154_FRAME_PARSER_H
41#define NRF_802154_FRAME_PARSER_H
42
43#include "nrf_802154_const.h"
45#include <stdbool.h>
46#include <stdint.h>
47#include <stddef.h>
48
49#define NRF_802154_FRAME_PARSER_INVALID_OFFSET 0xff
50
126
127typedef struct
128{
129 const uint8_t * p_frame;
132
133 struct
134 {
135 struct
136 {
137 uint8_t panid_offset;
138 uint8_t addr_offset;
139 } dst;
140
141 struct
142 {
143 uint8_t panid_offset;
144 uint8_t addr_offset;
145 } src;
146
147 struct
148 {
154 } aux_sec_hdr;
155
157 } mhr;
158
159 struct
160 {
162 } mac_payload;
163
164 struct
165 {
171 uint8_t key_src_size;
172 uint8_t mic_size;
173 } helper;
175
192bool nrf_802154_frame_parser_data_init(const uint8_t * p_frame,
193 uint8_t valid_data_len,
194 nrf_802154_frame_parser_level_t requested_parse_level,
195 nrf_802154_frame_parser_data_t * p_parser_data);
196
213 uint8_t valid_data_len,
214 nrf_802154_frame_parser_level_t requested_parse_level);
215
224 const nrf_802154_frame_parser_data_t * p_parser_data)
225{
226 return p_parser_data->parse_level;
227}
228
239 const nrf_802154_frame_parser_data_t * p_parser_data)
240{
241 return p_parser_data->p_frame[PHR_OFFSET];
242}
243
252 const nrf_802154_frame_parser_data_t * p_parser_data)
253{
254 return PSDU_OFFSET;
255}
256
264static inline const uint8_t * nrf_802154_frame_parser_psdu_get(
265 const nrf_802154_frame_parser_data_t * p_parser_data)
266{
267 return &p_parser_data->p_frame[PSDU_OFFSET];
268}
269
278 const nrf_802154_frame_parser_data_t * p_parser_data)
279{
280 return p_parser_data->p_frame[FRAME_VERSION_OFFSET] & FRAME_VERSION_MASK;
281}
282
292 const nrf_802154_frame_parser_data_t * p_parser_data)
293{
294 return (p_parser_data->p_frame[DSN_SUPPRESS_OFFSET] & DSN_SUPPRESS_BIT) ? true : false;
295}
296
305 const nrf_802154_frame_parser_data_t * p_parser_data)
306{
307 return p_parser_data->p_frame[DEST_ADDR_TYPE_OFFSET] & DEST_ADDR_TYPE_MASK;
308}
309
319 const nrf_802154_frame_parser_data_t * p_parser_data)
320{
321 return (p_parser_data->p_frame[DEST_ADDR_TYPE_OFFSET] & DEST_ADDR_TYPE_MASK) ==
323}
324
333 const nrf_802154_frame_parser_data_t * p_parser_data)
334{
335 return p_parser_data->p_frame[SRC_ADDR_TYPE_OFFSET] & SRC_ADDR_TYPE_MASK;
336}
337
347 const nrf_802154_frame_parser_data_t * p_parser_data)
348{
349 return (p_parser_data->p_frame[SRC_ADDR_TYPE_OFFSET] & SRC_ADDR_TYPE_MASK) ==
351}
352
362 const nrf_802154_frame_parser_data_t * p_parser_data)
363{
364 return (p_parser_data->p_frame[SRC_ADDR_TYPE_OFFSET] & SRC_ADDR_TYPE_MASK) ==
366}
367
377 const nrf_802154_frame_parser_data_t * p_parser_data)
378{
379 return (p_parser_data->p_frame[SECURITY_ENABLED_OFFSET] & SECURITY_ENABLED_BIT) ? true : false;
380}
381
391 const nrf_802154_frame_parser_data_t * p_parser_data)
392{
393 return (p_parser_data->p_frame[IE_PRESENT_OFFSET] & IE_PRESENT_BIT) ? true : false;
394}
395
404 const nrf_802154_frame_parser_data_t * p_parser_data)
405{
406 return p_parser_data->p_frame[FRAME_TYPE_OFFSET] & FRAME_TYPE_MASK;
407}
408
418 const nrf_802154_frame_parser_data_t * p_parser_data)
419{
420 return (p_parser_data->p_frame[PAN_ID_COMPR_OFFSET] & PAN_ID_COMPR_MASK) ? true : false;
421}
422
432 const nrf_802154_frame_parser_data_t * p_parser_data)
433{
435 {
436 return false;
437 }
438 else
439 {
440 return (p_parser_data->p_frame[ACK_REQUEST_OFFSET] & ACK_REQUEST_BIT) ? true : false;
441 }
442}
443
451static inline const uint8_t * nrf_802154_frame_parser_dsn_get(
452 const nrf_802154_frame_parser_data_t * p_parser_data)
453{
455 {
456 return NULL;
457 }
458
459 return &p_parser_data->p_frame[DSN_OFFSET];
460}
461
470 const nrf_802154_frame_parser_data_t * p_parser_data)
471{
472 return p_parser_data->mhr.dst.panid_offset;
473}
474
482static inline const uint8_t * nrf_802154_frame_parser_dst_panid_get(
483 const nrf_802154_frame_parser_data_t * p_parser_data)
484{
485 uint8_t offset = nrf_802154_frame_parser_dst_panid_offset_get(p_parser_data);
486
488 {
489 return NULL;
490 }
491
492 return &p_parser_data->p_frame[offset];
493}
494
503 const nrf_802154_frame_parser_data_t * p_parser_data)
504{
505 return p_parser_data->mhr.dst.addr_offset;
506}
507
515static inline const uint8_t * nrf_802154_frame_parser_dst_addr_get(
516 const nrf_802154_frame_parser_data_t * p_parser_data)
517{
518 uint8_t offset = nrf_802154_frame_parser_dst_addr_offset_get(p_parser_data);
519
521 {
522 return NULL;
523 }
524
525 return &p_parser_data->p_frame[offset];
526}
527
536 const nrf_802154_frame_parser_data_t * p_parser_data)
537{
538 return p_parser_data->mhr.src.panid_offset;
539}
540
548static inline const uint8_t * nrf_802154_frame_parser_src_panid_get(
549 const nrf_802154_frame_parser_data_t * p_parser_data)
550{
551 uint8_t offset = nrf_802154_frame_parser_src_panid_offset_get(p_parser_data);
552
554 {
555 return NULL;
556 }
557
558 return &p_parser_data->p_frame[offset];
559}
560
569 const nrf_802154_frame_parser_data_t * p_parser_data)
570{
571 return p_parser_data->mhr.src.addr_offset;
572}
573
581static inline const uint8_t * nrf_802154_frame_parser_src_addr_get(
582 const nrf_802154_frame_parser_data_t * p_parser_data)
583{
584 uint8_t offset = nrf_802154_frame_parser_src_addr_offset_get(p_parser_data);
585
587 {
588 return NULL;
589 }
590
591 return &p_parser_data->p_frame[offset];
592}
593
602 const nrf_802154_frame_parser_data_t * p_parser_data)
603{
604 return p_parser_data->helper.src_addr_size;
605}
606
615 const nrf_802154_frame_parser_data_t * p_parser_data)
616{
617 return p_parser_data->helper.dst_addr_size;
618}
619
628 const nrf_802154_frame_parser_data_t * p_parser_data)
629{
630 return p_parser_data->mhr.aux_sec_hdr.sec_ctrl_offset;
631}
632
641 const nrf_802154_frame_parser_data_t * p_parser_data)
642{
643 uint8_t offset = nrf_802154_frame_parser_sec_ctrl_offset_get(p_parser_data);
644
646 {
647 return 0;
648 }
649
650 return p_parser_data->p_frame[offset] & SECURITY_LEVEL_MASK;
651}
652
662 const nrf_802154_frame_parser_data_t * p_parser_data)
663{
664 uint8_t offset = nrf_802154_frame_parser_sec_ctrl_offset_get(p_parser_data);
665
667 {
668 return false;
669 }
670
671 return p_parser_data->p_frame[offset] & FRAME_COUNTER_SUPPRESS_BIT;
672}
673
682 const nrf_802154_frame_parser_data_t * p_parser_data)
683{
684 uint8_t offset = nrf_802154_frame_parser_sec_ctrl_offset_get(p_parser_data);
685
687 {
688 return 0;
689 }
690
691 return (p_parser_data->p_frame[offset] & KEY_ID_MODE_MASK) >> KEY_ID_MODE_BIT_OFFSET;
692}
693
703 const nrf_802154_frame_parser_data_t * p_parser_data)
704{
705 uint8_t offset = nrf_802154_frame_parser_sec_ctrl_offset_get(p_parser_data);
706
708 {
709 return false;
710 }
711
712 return p_parser_data->p_frame[offset] & ASN_IN_NONCE_BIT;
713}
714
722static inline const uint8_t * nrf_802154_frame_parser_sec_ctrl_get(
723 const nrf_802154_frame_parser_data_t * p_parser_data)
724{
725 uint8_t offset = nrf_802154_frame_parser_sec_ctrl_offset_get(p_parser_data);
726
728 {
729 return NULL;
730 }
731
732 return &p_parser_data->p_frame[offset];
733}
734
743 const nrf_802154_frame_parser_data_t * p_parser_data)
744{
745 return p_parser_data->mhr.aux_sec_hdr.frame_counter_offset;
746}
747
755static inline const uint8_t * nrf_802154_frame_parser_frame_counter_get(
756 const nrf_802154_frame_parser_data_t * p_parser_data)
757{
758 uint8_t offset = nrf_802154_frame_parser_frame_counter_offset_get(p_parser_data);
759
761 {
762 return NULL;
763 }
764
765 return &p_parser_data->p_frame[offset];
766}
767
776 const nrf_802154_frame_parser_data_t * p_parser_data)
777{
778 return p_parser_data->mhr.aux_sec_hdr.key_id_offset;
779}
780
788static inline const uint8_t * nrf_802154_frame_parser_key_id_get(
789 const nrf_802154_frame_parser_data_t * p_parser_data)
790{
791 uint8_t offset = nrf_802154_frame_parser_key_id_offset_get(p_parser_data);
792
794 {
795 return NULL;
796 }
797
798 return &p_parser_data->p_frame[offset];
799}
800
809 const nrf_802154_frame_parser_data_t * p_parser_data)
810{
811 return p_parser_data->mhr.aux_sec_hdr.key_src_offset;
812}
813
821static inline const uint8_t * nrf_802154_frame_parser_key_source_get(
822 const nrf_802154_frame_parser_data_t * p_parser_data)
823{
824 uint8_t offset = nrf_802154_frame_parser_key_source_offset_get(p_parser_data);
825
827 {
828 return NULL;
829 }
830
831 return &p_parser_data->p_frame[offset];
832}
833
842 const nrf_802154_frame_parser_data_t * p_parser_data)
843{
844 return p_parser_data->helper.key_src_size;
845}
846
855 const nrf_802154_frame_parser_data_t * p_parser_data)
856{
857 return p_parser_data->mhr.aux_sec_hdr.key_idx_offset;
858}
859
868 const nrf_802154_frame_parser_data_t * p_parser_data)
869{
870 uint8_t offset = nrf_802154_frame_parser_key_index_offset_get(p_parser_data);
871
873 {
874 return 0;
875 }
876
877 return p_parser_data->p_frame[offset];
878}
879
888 const nrf_802154_frame_parser_data_t * p_parser_data)
889{
890 return p_parser_data->mhr.header_ie_offset;
891}
892
900static inline const uint8_t * nrf_802154_frame_parser_ie_header_get(
901 const nrf_802154_frame_parser_data_t * p_parser_data)
902{
903 uint8_t offset = nrf_802154_frame_parser_ie_header_offset_get(p_parser_data);
904
906 {
907 return NULL;
908 }
909
910 return &p_parser_data->p_frame[offset];
911}
912
921 const nrf_802154_frame_parser_data_t * p_parser_data)
922{
923 return p_parser_data->mac_payload.mac_payload_offset;
924}
925
933static inline const uint8_t * nrf_802154_frame_parser_mac_payload_get(
934 const nrf_802154_frame_parser_data_t * p_parser_data)
935{
936 uint8_t offset = nrf_802154_frame_parser_mac_payload_offset_get(p_parser_data);
937
939 {
940 return NULL;
941 }
942
943 return &p_parser_data->p_frame[offset];
944}
945
954 const nrf_802154_frame_parser_data_t * p_parser_data)
955{
957 {
959 }
960
961 // MAC command frames containing Payload Information Elements are not supported.
963}
964
972static inline const uint8_t * nrf_802154_frame_parser_mac_command_id_get(
973 const nrf_802154_frame_parser_data_t * p_parser_data)
974{
975 uint8_t offset = nrf_802154_frame_parser_mac_command_id_offset_get(p_parser_data);
976
978 {
979 return NULL;
980 }
981
982 return &p_parser_data->p_frame[offset];
983}
984
993 const nrf_802154_frame_parser_data_t * p_parser_data)
994{
996}
997
1005static inline const uint8_t * nrf_802154_frame_parser_mfr_get(
1006 const nrf_802154_frame_parser_data_t * p_parser_data)
1007{
1008 uint8_t offset = nrf_802154_frame_parser_mfr_offset_get(p_parser_data);
1009
1011 {
1012 return NULL;
1013 }
1014
1015 return &p_parser_data->p_frame[offset];
1016}
1017
1026 const nrf_802154_frame_parser_data_t * p_parser_data)
1027{
1028 uint8_t payload_start = nrf_802154_frame_parser_mac_payload_offset_get(p_parser_data);
1029 uint8_t payload_end = nrf_802154_frame_parser_mfr_offset_get(p_parser_data);
1030
1031 return payload_end - payload_start;
1032}
1033
1042 const nrf_802154_frame_parser_data_t * p_parser_data)
1043{
1044 uint8_t mhr_start = nrf_802154_frame_parser_psdu_offset_get(p_parser_data);
1045 uint8_t mhr_end = nrf_802154_frame_parser_mac_payload_offset_get(p_parser_data);
1046
1048 {
1049 mhr_end = nrf_802154_frame_parser_mfr_offset_get(p_parser_data);
1050 }
1051
1052 return mhr_end - mhr_start;
1053}
1054
1063 const nrf_802154_frame_parser_data_t * p_parser_data)
1064{
1065 return p_parser_data->helper.mic_size;
1066}
1067
1076 const nrf_802154_frame_parser_data_t * p_parser_data)
1077{
1078 return p_parser_data->helper.dst_addressing_end_offset;
1079}
1080
1089 const nrf_802154_frame_parser_data_t * p_parser_data)
1090{
1091 uint8_t offset = nrf_802154_frame_parser_dst_addressing_end_offset_get(p_parser_data);
1092
1094 {
1095 return NULL;
1096 }
1097
1098 return &p_parser_data->p_frame[offset];
1099}
1100
1109 const nrf_802154_frame_parser_data_t * p_parser_data)
1110{
1111 return p_parser_data->helper.addressing_end_offset;
1112}
1113
1122 const nrf_802154_frame_parser_data_t * p_parser_data)
1123{
1124 uint8_t offset = nrf_802154_frame_parser_addressing_end_offset_get(p_parser_data);
1125
1127 {
1128 return NULL;
1129 }
1130
1131 return &p_parser_data->p_frame[offset];
1132}
1133
1142 const nrf_802154_frame_parser_data_t * p_parser_data)
1143{
1144 return p_parser_data->helper.aux_sec_hdr_end_offset;
1145}
1146
1156 const uint8_t * p_ie_header)
1157{
1158 return p_ie_header;
1159}
1160
1172 const uint8_t * p_ie_iterator)
1173{
1174 return p_ie_iterator + IE_DATA_OFFSET;
1175}
1176
1185static inline uint8_t nrf_802154_frame_parser_ie_length_get(const uint8_t * p_ie_iterator)
1186{
1187 return p_ie_iterator[IE_LENGTH_OFFSET] & IE_LENGTH_MASK;
1188}
1189
1198static inline const uint8_t * nrf_802154_frame_parser_ie_iterator_next(
1199 const uint8_t * p_ie_iterator)
1200{
1203}
1204
1213static inline uint8_t nrf_802154_frame_parser_ie_id_get(const uint8_t * p_ie_iterator)
1214{
1215 return (p_ie_iterator[IE_ID_OFFSET_0] >> 7) | (p_ie_iterator[IE_ID_OFFSET_1] << 1);
1216}
1217
1228static inline bool nrf_802154_frame_parser_ie_iterator_end(const uint8_t * p_ie_iterator,
1229 const uint8_t * p_end_addr)
1230{
1231 uint8_t ie_id = nrf_802154_frame_parser_ie_id_get(p_ie_iterator);
1232
1233 return ((nrf_802154_frame_parser_ie_length_get(p_ie_iterator) == 0) &&
1234 ((ie_id == IE_HT1) || (ie_id == IE_HT2)))
1235 || (p_ie_iterator >= p_end_addr);
1236}
1237
1252static inline uint32_t nrf_802154_frame_parser_ie_vendor_oui_get(const uint8_t * p_ie_iterator)
1253{
1254 return little_24_to_host((uint8_t *)&p_ie_iterator[IE_DATA_OFFSET + IE_VENDOR_OUI_OFFSET]);
1255}
1256
1274 const uint8_t * p_ie_iterator)
1275{
1276 return p_ie_iterator[IE_DATA_OFFSET + IE_VENDOR_THREAD_SUBTYPE_OFFSET];
1277}
1278
1299 const uint8_t * p_ie_iterator)
1300{
1303}
1304
1305#endif // NRF_802154_FRAME_PARSER_H
#define FRAME_TYPE_OFFSET
Byte containing the frame type bits (+1 for the frame length byte).
Definition nrf_802154_const.h:70
#define IE_ID_OFFSET_1
Offset of the octed containing the second part of the IE identifier.
Definition nrf_802154_const.h:227
#define DSN_SUPPRESS_OFFSET
Byte containing the DSN suppression field.
Definition nrf_802154_const.h:62
#define SECURITY_LEVEL_MASK
Mask of bits containing the Security level field.
Definition nrf_802154_const.h:133
#define FCS_SIZE
Size of the FCS field.
Definition nrf_802154_const.h:154
#define PHR_SIZE
Size of the PHR field.
Definition nrf_802154_const.h:166
#define SRC_ADDR_TYPE_SHORT
Bits containing the short source address type.
Definition nrf_802154_const.h:147
#define IE_VENDOR_THREAD_DATA_OFFSET
Thread Vendor-specific IE DATA offset.
Definition nrf_802154_const.h:201
#define IE_HT1
Information Element Header Termination type 1.
Definition nrf_802154_const.h:222
#define FRAME_TYPE_MULTIPURPOSE
Bits containing the Multipurpose frame type.
Definition nrf_802154_const.h:78
#define IE_LENGTH_OFFSET
Information element length offset.
Definition nrf_802154_const.h:225
#define ACK_REQUEST_OFFSET
Byte containing the ACK request bit (+1 for the frame length byte).
Definition nrf_802154_const.h:49
#define SECURITY_ENABLED_BIT
Bits containing the Security Enabled field.
Definition nrf_802154_const.h:132
#define FRAME_VERSION_OFFSET
Byte containing the frame version bits (+1 for the frame length byte).
Definition nrf_802154_const.h:80
#define IE_HT2
Information Element Header Termination type 2.
Definition nrf_802154_const.h:223
#define IE_DATA_OFFSET
Information element data offset.
Definition nrf_802154_const.h:228
#define IE_VENDOR_OUI_OFFSET
Vendor-specific IE OUI offset.
Definition nrf_802154_const.h:198
#define PSDU_OFFSET
Offset of the PHY payload.
Definition nrf_802154_const.h:129
#define FRAME_TYPE_COMMAND
Bits containing the Command frame type.
Definition nrf_802154_const.h:74
#define IE_PRESENT_OFFSET
Byte containing the IE Present bit.
Definition nrf_802154_const.h:88
#define ASN_IN_NONCE_BIT
Bit containing the ASN in Nonce field.
Definition nrf_802154_const.h:52
#define FRAME_TYPE_MASK
Mask of bits containing the frame type.
Definition nrf_802154_const.h:71
#define PHR_OFFSET
Offset of the PHY header in a frame.
Definition nrf_802154_const.h:126
#define IE_VENDOR_THREAD_SUBTYPE_OFFSET
Thread Vendor-specific IE subtype offset.
Definition nrf_802154_const.h:200
#define DSN_OFFSET
Byte containing the DSN value (+1 for the frame length byte).
Definition nrf_802154_const.h:61
#define DSN_SUPPRESS_BIT
Bits containing the DSN suppression field.
Definition nrf_802154_const.h:63
#define SRC_ADDR_TYPE_EXTENDED
Bits containing the extended source address type.
Definition nrf_802154_const.h:143
#define DEST_ADDR_TYPE_EXTENDED
Bits containing the extended destination address type.
Definition nrf_802154_const.h:56
#define IE_ID_OFFSET_0
Offset of the octet containing the first part of the IE identifier.
Definition nrf_802154_const.h:226
#define KEY_ID_MODE_BIT_OFFSET
Number of bits the Key Identifier Mode is offset in the Security Control field.
Definition nrf_802154_const.h:97
#define SECURITY_ENABLED_OFFSET
Byte containing the Security Enabled bit.
Definition nrf_802154_const.h:131
#define PAN_ID_COMPR_OFFSET
Byte containing the PAN ID compression bit (+1 for the frame length byte).
Definition nrf_802154_const.h:121
#define ACK_REQUEST_BIT
ACK request bit.
Definition nrf_802154_const.h:50
#define FRAME_VERSION_MASK
Mask of bits containing the frame version.
Definition nrf_802154_const.h:81
#define KEY_ID_MODE_MASK
Mask of bits containing Key Identifier Mode in the Security Control field.
Definition nrf_802154_const.h:96
#define IE_PRESENT_BIT
Bits containing the IE Present field.
Definition nrf_802154_const.h:89
#define PAN_ID_COMPR_MASK
PAN ID compression bit.
Definition nrf_802154_const.h:122
#define DEST_ADDR_TYPE_OFFSET
Byte containing the destination address type (+1 for the frame length byte).
Definition nrf_802154_const.h:54
#define FRAME_COUNTER_SUPPRESS_BIT
Bit containing the Frame Counter Suppression field.
Definition nrf_802154_const.h:65
#define IE_LENGTH_MASK
Information element length mask.
Definition nrf_802154_const.h:224
#define SRC_ADDR_TYPE_MASK
Mask of bits containing the source address type.
Definition nrf_802154_const.h:145
#define SRC_ADDR_TYPE_OFFSET
Byte containing the source address type (+1 for the frame length byte).
Definition nrf_802154_const.h:146
#define DEST_ADDR_TYPE_MASK
Mask of bits containing the destination address type.
Definition nrf_802154_const.h:55
static bool nrf_802154_frame_parser_src_addr_is_extended(const nrf_802154_frame_parser_data_t *p_parser_data)
Determines if the source address is extended.
Definition nrf_802154_frame_parser.h:346
static uint8_t nrf_802154_frame_parser_dst_addr_size_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the size of the destination address.
Definition nrf_802154_frame_parser.h:614
static uint8_t nrf_802154_frame_parser_ie_vendor_thread_subtype_get(const uint8_t *p_ie_iterator)
Gets subtype of Thread vendor-specific IE.
Definition nrf_802154_frame_parser.h:1273
bool nrf_802154_frame_parser_valid_data_extend(nrf_802154_frame_parser_data_t *p_parser_data, uint8_t valid_data_len, nrf_802154_frame_parser_level_t requested_parse_level)
Extends the valid data and parses the frame.
static uint8_t nrf_802154_frame_parser_src_panid_offset_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the offset of frame Source PAN ID.
Definition nrf_802154_frame_parser.h:535
static uint8_t nrf_802154_frame_parser_aux_sec_hdr_end_offset_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the end offset of the security header section.
Definition nrf_802154_frame_parser.h:1141
static uint8_t nrf_802154_frame_parser_key_index_offset_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the offset of the Key Index field.
Definition nrf_802154_frame_parser.h:854
static uint8_t nrf_802154_frame_parser_psdu_offset_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the PSDU start offset of the frame.
Definition nrf_802154_frame_parser.h:251
static uint8_t nrf_802154_frame_parser_frame_counter_offset_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the offset of the Frame Counter field.
Definition nrf_802154_frame_parser.h:742
static uint8_t nrf_802154_frame_parser_frame_version_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the MAC frame version value from the Frame Control Field.
Definition nrf_802154_frame_parser.h:277
#define NRF_802154_FRAME_PARSER_INVALID_OFFSET
Module that contains frame parsing utilities for the 802.15.4 radio driver.
Definition nrf_802154_frame_parser.h:49
static uint8_t nrf_802154_frame_parser_dst_addr_offset_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the offset of frame Destination Address.
Definition nrf_802154_frame_parser.h:502
static uint8_t nrf_802154_frame_parser_frame_length_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the PSDU length of the frame.
Definition nrf_802154_frame_parser.h:238
static const uint8_t * nrf_802154_frame_parser_frame_counter_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the address of the Frame Counter field.
Definition nrf_802154_frame_parser.h:755
static bool nrf_802154_frame_parser_dst_addr_is_extended(const nrf_802154_frame_parser_data_t *p_parser_data)
Determines if the destination address is extended.
Definition nrf_802154_frame_parser.h:318
static uint8_t nrf_802154_frame_parser_addressing_end_offset_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the end offset of the addressing section.
Definition nrf_802154_frame_parser.h:1108
static nrf_802154_frame_parser_level_t nrf_802154_frame_parser_parse_level_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets current parse level of the provided parser data.
Definition nrf_802154_frame_parser.h:223
static uint8_t nrf_802154_frame_parser_frame_type_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the value of the frame type field from the Frame Control Field.
Definition nrf_802154_frame_parser.h:403
static const uint8_t * nrf_802154_frame_parser_sec_ctrl_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the address of the Security Control Field.
Definition nrf_802154_frame_parser.h:722
static uint8_t nrf_802154_frame_parser_dst_addr_type_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the MAC frame destination address type from the Frame Control Field.
Definition nrf_802154_frame_parser.h:304
static const uint8_t * nrf_802154_frame_parser_psdu_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the PSDU start address of the frame.
Definition nrf_802154_frame_parser.h:264
static const uint8_t * nrf_802154_frame_parser_dst_addr_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the address of the Destination Address field.
Definition nrf_802154_frame_parser.h:515
static uint8_t nrf_802154_frame_parser_mac_payload_offset_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the offset of the MAC payload.
Definition nrf_802154_frame_parser.h:920
static const uint8_t * nrf_802154_frame_parser_src_panid_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the address of the Source PAN ID field.
Definition nrf_802154_frame_parser.h:548
static const uint8_t * nrf_802154_frame_parser_mfr_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the address of the MFR field.
Definition nrf_802154_frame_parser.h:1005
static uint8_t nrf_802154_frame_parser_mfr_offset_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the offset of the MFR field.
Definition nrf_802154_frame_parser.h:992
static bool nrf_802154_frame_parser_dsn_suppress_bit_is_set(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the value of the DSN suppress bit from the Frame Control Field.
Definition nrf_802154_frame_parser.h:291
static uint8_t nrf_802154_frame_parser_ie_id_get(const uint8_t *p_ie_iterator)
Gets identifier of currently iterated IE.
Definition nrf_802154_frame_parser.h:1213
static uint8_t nrf_802154_frame_parser_src_addr_offset_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the offset of frame Source Address.
Definition nrf_802154_frame_parser.h:568
static bool nrf_802154_frame_parser_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_parser.h:1228
static uint8_t nrf_802154_frame_parser_key_source_offset_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the offset of the Key Source field.
Definition nrf_802154_frame_parser.h:808
static const uint8_t * nrf_802154_frame_parser_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_parser.h:1298
static const uint8_t * nrf_802154_frame_parser_ie_content_address_get(const uint8_t *p_ie_iterator)
Gets payload address of currently iterated IE.
Definition nrf_802154_frame_parser.h:1171
static uint8_t nrf_802154_frame_parser_mac_payload_length_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the length of the MAC payload.
Definition nrf_802154_frame_parser.h:1025
static const uint8_t * nrf_802154_frame_parser_key_id_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the address of the Key ID field.
Definition nrf_802154_frame_parser.h:788
static bool nrf_802154_frame_parser_ie_present_bit_is_set(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the value of the IE present bit from the Frame Control Field.
Definition nrf_802154_frame_parser.h:390
static const uint8_t * nrf_802154_frame_parser_addressing_end_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the end address of the addressing section.
Definition nrf_802154_frame_parser.h:1121
static bool nrf_802154_frame_parser_sec_ctrl_asn_in_nonce_bit_is_set(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the value of the ASN in Nonce bit from the Security Control Field.
Definition nrf_802154_frame_parser.h:702
static const uint8_t * nrf_802154_frame_parser_key_source_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the address of the Key Source field.
Definition nrf_802154_frame_parser.h:821
static uint8_t nrf_802154_frame_parser_dst_addressing_end_offset_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the end offset of the destination addressing section.
Definition nrf_802154_frame_parser.h:1075
static uint8_t nrf_802154_frame_parser_sec_ctrl_offset_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the offset of the Security Control Field.
Definition nrf_802154_frame_parser.h:627
nrf_802154_frame_parser_level_t
Definition nrf_802154_frame_parser.h:52
@ PARSE_LEVEL_FULL
Parse level for fully parsed frame. All fields can be considered valid and complete.
Definition nrf_802154_frame_parser.h:122
@ PARSE_LEVEL_NONE
Parse level at which no parsing has been performed on the frame.
Definition nrf_802154_frame_parser.h:58
@ PARSE_LEVEL_ADDRESSING_END
Parse level at which the data under offsets determined by the FCF can be considered complete.
Definition nrf_802154_frame_parser.h:91
@ 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_parser.h:101
@ PARSE_LEVEL_MAX
Definition nrf_802154_frame_parser.h:124
@ 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_parser.h:111
@ PARSE_LEVEL_DST_ADDRESSING_END
Parse level at which the destination address data can be considered complete.
Definition nrf_802154_frame_parser.h:81
@ 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_parser.h:71
static const uint8_t * nrf_802154_frame_parser_mac_command_id_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the address of the MAC Command ID field.
Definition nrf_802154_frame_parser.h:972
static uint8_t nrf_802154_frame_parser_mic_size_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the length of the MIC field.
Definition nrf_802154_frame_parser.h:1062
static const uint8_t * nrf_802154_frame_parser_dst_addressing_end_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the end address of the destination addressing section.
Definition nrf_802154_frame_parser.h:1088
static const uint8_t * nrf_802154_frame_parser_ie_header_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the address of the IE header.
Definition nrf_802154_frame_parser.h:900
static const uint8_t * nrf_802154_frame_parser_mac_payload_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the address of the MAC payload.
Definition nrf_802154_frame_parser.h:933
static uint8_t nrf_802154_frame_parser_ie_header_offset_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the offset of the IE header.
Definition nrf_802154_frame_parser.h:887
static uint8_t nrf_802154_frame_parser_mac_header_length_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the length of the MAC header.
Definition nrf_802154_frame_parser.h:1041
static uint8_t nrf_802154_frame_parser_src_addr_type_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the MAC frame source address type from the Frame Control Field.
Definition nrf_802154_frame_parser.h:332
static const uint8_t * nrf_802154_frame_parser_header_ie_iterator_begin(const uint8_t *p_ie_header)
Initializes the IE iterator with given IE header address.
Definition nrf_802154_frame_parser.h:1155
static uint8_t nrf_802154_frame_parser_src_addr_size_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the size of the source address.
Definition nrf_802154_frame_parser.h:601
static uint32_t nrf_802154_frame_parser_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_parser.h:1252
static const uint8_t * nrf_802154_frame_parser_ie_iterator_next(const uint8_t *p_ie_iterator)
Gets next information element iterator.
Definition nrf_802154_frame_parser.h:1198
static const uint8_t * nrf_802154_frame_parser_dst_panid_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the address of the Destination PAN field.
Definition nrf_802154_frame_parser.h:482
static bool nrf_802154_frame_parser_sec_ctrl_fc_suppress_bit_is_set(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the value of the Frame Counter Suppress bit from the Security Control Field.
Definition nrf_802154_frame_parser.h:661
static bool nrf_802154_frame_parser_panid_compression_is_set(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the value of the PAN ID compressions bit from the Frame Control Field.
Definition nrf_802154_frame_parser.h:417
static uint8_t nrf_802154_frame_parser_sec_ctrl_key_id_mode_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the value of the Key ID Mode field from the Security Control Field.
Definition nrf_802154_frame_parser.h:681
static uint8_t nrf_802154_frame_parser_mac_command_id_offset_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the offset of the MAC Command ID field.
Definition nrf_802154_frame_parser.h:953
static const uint8_t * nrf_802154_frame_parser_dsn_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the value of the DSN field.
Definition nrf_802154_frame_parser.h:451
static uint8_t nrf_802154_frame_parser_ie_length_get(const uint8_t *p_ie_iterator)
Gets length of currently iterated IE.
Definition nrf_802154_frame_parser.h:1185
static const uint8_t * nrf_802154_frame_parser_src_addr_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the address of the Source Address field.
Definition nrf_802154_frame_parser.h:581
static uint8_t nrf_802154_frame_parser_dst_panid_offset_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the offset of the Destination PAN ID field.
Definition nrf_802154_frame_parser.h:469
bool nrf_802154_frame_parser_data_init(const uint8_t *p_frame, uint8_t valid_data_len, nrf_802154_frame_parser_level_t requested_parse_level, nrf_802154_frame_parser_data_t *p_parser_data)
Initializes the frame parse data and parses the frame.
static uint8_t nrf_802154_frame_parser_key_id_offset_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the offset of the Key ID field.
Definition nrf_802154_frame_parser.h:775
static uint8_t nrf_802154_frame_parser_key_source_length_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the length of the Key Source field.
Definition nrf_802154_frame_parser.h:841
static bool nrf_802154_frame_parser_ar_bit_is_set(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the value of the AR bit from the Frame Control Field.
Definition nrf_802154_frame_parser.h:431
static bool nrf_802154_frame_parser_security_enabled_bit_is_set(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the value of the Security Enabled bit from the Frame Control Field.
Definition nrf_802154_frame_parser.h:376
static bool nrf_802154_frame_parser_src_addr_is_short(const nrf_802154_frame_parser_data_t *p_parser_data)
Determines if the source address is short.
Definition nrf_802154_frame_parser.h:361
static uint8_t nrf_802154_frame_parser_sec_ctrl_sec_lvl_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the value of the Security Level field from the Security Control Field.
Definition nrf_802154_frame_parser.h:640
static uint8_t nrf_802154_frame_parser_key_index_get(const nrf_802154_frame_parser_data_t *p_parser_data)
Gets the address of the Key Index field.
Definition nrf_802154_frame_parser.h:867
#define NULL
Definition osal_types.h:36
uint8_t key_src_offset
Key Source offset.
Definition nrf_802154_frame_parser.h:152
uint8_t dst_addressing_end_offset
Destination addressing end offset.
Definition nrf_802154_frame_parser.h:168
uint8_t aux_sec_hdr_end_offset
Auxiliary Security Header offset.
Definition nrf_802154_frame_parser.h:170
uint8_t panid_offset
Destination PAN ID offset.
Definition nrf_802154_frame_parser.h:137
uint8_t dst_addr_size
Destination address size;.
Definition nrf_802154_frame_parser.h:166
uint8_t addr_offset
Destination address offset.
Definition nrf_802154_frame_parser.h:138
uint8_t mac_payload_offset
MAC payload offset.
Definition nrf_802154_frame_parser.h:161
uint8_t header_ie_offset
Header IE offset.
Definition nrf_802154_frame_parser.h:156
uint8_t sec_ctrl_offset
Security Control Field offset.
Definition nrf_802154_frame_parser.h:149
struct nrf_802154_frame_parser_data_t::@17::@21 src
uint8_t mic_size
Message Integrity Code size.
Definition nrf_802154_frame_parser.h:172
uint8_t addressing_end_offset
Addressing end offset.
Definition nrf_802154_frame_parser.h:169
nrf_802154_frame_parser_level_t parse_level
Current frame parse level.
Definition nrf_802154_frame_parser.h:130
struct nrf_802154_frame_parser_data_t::@17 mhr
uint8_t frame_counter_offset
Frame Counter field offset.
Definition nrf_802154_frame_parser.h:150
uint8_t key_src_size
Key Source size.
Definition nrf_802154_frame_parser.h:171
uint8_t key_idx_offset
Key Index offset.
Definition nrf_802154_frame_parser.h:153
uint8_t src_addr_size
Source address size;.
Definition nrf_802154_frame_parser.h:167
struct nrf_802154_frame_parser_data_t::@18 mac_payload
const uint8_t * p_frame
Pointer to a frame associated with parser data.
Definition nrf_802154_frame_parser.h:129
struct nrf_802154_frame_parser_data_t::@17::@20 dst
struct nrf_802154_frame_parser_data_t::@19 helper
struct nrf_802154_frame_parser_data_t::@17::@22 aux_sec_hdr
uint8_t valid_data_len
Number of valid bytes in the frame.
Definition nrf_802154_frame_parser.h:131
uint8_t key_id_offset
Key ID offset.
Definition nrf_802154_frame_parser.h:151
Definition nrf_802154_frame_parser.h:128