Zephyr Project API  3.4.0
A Scalable Open Source RTOS
ieee802154.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Intel Corporation.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12#ifndef ZEPHYR_INCLUDE_NET_IEEE802154_H_
13#define ZEPHYR_INCLUDE_NET_IEEE802154_H_
14
15#include <limits.h>
16#include <zephyr/net/net_l2.h>
17#include <zephyr/net/net_mgmt.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
31/* References are to the IEEE 802.15.4-2020 standard */
32#define IEEE802154_MAX_PHY_PACKET_SIZE 127 /* see section 11.3, aMaxPhyPacketSize */
33#define IEEE802154_FCS_LENGTH 2 /* see section 7.2.1.1 */
34#define IEEE802154_MTU (IEEE802154_MAX_PHY_PACKET_SIZE - IEEE802154_FCS_LENGTH)
35/* TODO: Support flexible MTU and FCS lengths for IEEE 802.15.4-2015ff */
36
37#define IEEE802154_SHORT_ADDR_LENGTH 2
38#define IEEE802154_EXT_ADDR_LENGTH 8
39#define IEEE802154_MAX_ADDR_LENGTH IEEE802154_EXT_ADDR_LENGTH
40
41#define IEEE802154_NO_CHANNEL USHRT_MAX
42
43/* See IEEE 802.15.4-2020, sections 6.1 and 7.3.5 */
44#define IEEE802154_BROADCAST_ADDRESS 0xffff
45#define IEEE802154_NO_SHORT_ADDRESS_ASSIGNED 0xfffe
46
47/* See IEEE 802.15.4-2020, section 6.1 */
48#define IEEE802154_BROADCAST_PAN_ID 0xffff
49
50/* See IEEE 802.15.4-2020, section 7.3.5 */
51#define IEEE802154_SHORT_ADDRESS_NOT_ASSOCIATED IEEE802154_BROADCAST_ADDRESS
52
61 uint8_t _unused : 3;
62};
63
64/* This not meant to be used by any code but 802.15.4 L2 stack */
66 uint16_t pan_id; /* in CPU byte order */
67 uint16_t channel; /* in CPU byte order */
68 /* short address:
69 * 0 == not associated,
70 * 0xfffe == associated but no short address assigned
71 * see section 7.4.2
72 */
73 uint16_t short_addr; /* in CPU byte order */
75 struct net_linkaddr_storage linkaddr; /* in big endian */
76#ifdef CONFIG_NET_L2_IEEE802154_SECURITY
77 struct ieee802154_security_ctx sec_ctx;
78#endif
79#ifdef CONFIG_NET_L2_IEEE802154_MGMT
80 struct ieee802154_req_params *scan_ctx; /* guarded by scan_ctx_lock */
81 struct k_sem scan_ctx_lock;
82
83 uint8_t coord_ext_addr[IEEE802154_MAX_ADDR_LENGTH]; /* in little endian */
84 uint16_t coord_short_addr; /* in CPU byte order */
85#endif
88
90
91 uint8_t _unused : 6;
92
93 uint8_t ack_received : 1; /* guarded by ack_lock */
94 uint8_t ack_requested : 1; /* guarded by ack_lock */
95 uint8_t ack_seq; /* guarded by ack_lock */
96 struct k_sem ack_lock;
97
98 struct k_sem ctx_lock; /* guards all mutable context attributes unless
99 * otherwise mentioned on attribute level
100 */
101};
102
103#define IEEE802154_L2_CTX_TYPE struct ieee802154_context
104
105#ifdef __cplusplus
106}
107#endif
108
113#endif /* ZEPHYR_INCLUDE_NET_IEEE802154_H_ */
Crypto Cipher structure definitions.
#define IEEE802154_MAX_ADDR_LENGTH
Definition: ieee802154.h:39
net_l2_flags
Definition: net_l2.h:34
Public API for network L2 interface.
Network Management API public header.
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
__INT16_TYPE__ int16_t
Definition: stdint.h:73
Definition: cipher.h:110
Definition: ieee802154.h:65
uint8_t ack_seq
Definition: ieee802154.h:95
uint8_t ack_received
Definition: ieee802154.h:93
uint8_t ext_addr[8]
Definition: ieee802154.h:74
struct k_sem ctx_lock
Definition: ieee802154.h:98
uint8_t ack_requested
Definition: ieee802154.h:94
uint8_t sequence
Definition: ieee802154.h:89
struct k_sem ack_lock
Definition: ieee802154.h:96
uint16_t short_addr
Definition: ieee802154.h:73
struct net_linkaddr_storage linkaddr
Definition: ieee802154.h:75
int16_t tx_power
Definition: ieee802154.h:86
enum net_l2_flags flags
Definition: ieee802154.h:87
uint16_t channel
Definition: ieee802154.h:67
uint16_t pan_id
Definition: ieee802154.h:66
Scanning parameters.
Definition: ieee802154_mgmt.h:225
Definition: ieee802154.h:53
uint8_t key_len
Definition: ieee802154.h:58
uint8_t key[16]
Definition: ieee802154.h:57
uint8_t level
Definition: ieee802154.h:59
struct cipher_ctx dec
Definition: ieee802154.h:56
struct cipher_ctx enc
Definition: ieee802154.h:55
uint32_t frame_counter
Definition: ieee802154.h:54
uint8_t key_mode
Definition: ieee802154.h:60
Hardware link address structure.
Definition: net_linkaddr.h:88