1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * nl802154.h
4  *
5  * Copyright (C) 2007, 2008, 2009 Siemens AG
6  */
7 
8 #ifndef NL802154_H
9 #define NL802154_H
10 
11 #include <net/netlink.h>
12 
13 #define IEEE802154_NL_NAME "802.15.4 MAC"
14 #define IEEE802154_MCAST_COORD_NAME "coordinator"
15 #define IEEE802154_MCAST_BEACON_NAME "beacon"
16 
17 enum {
18 	__IEEE802154_ATTR_INVALID,
19 
20 	IEEE802154_ATTR_DEV_NAME,
21 	IEEE802154_ATTR_DEV_INDEX,
22 
23 	IEEE802154_ATTR_STATUS,
24 
25 	IEEE802154_ATTR_SHORT_ADDR,
26 	IEEE802154_ATTR_HW_ADDR,
27 	IEEE802154_ATTR_PAN_ID,
28 
29 	IEEE802154_ATTR_CHANNEL,
30 
31 	IEEE802154_ATTR_COORD_SHORT_ADDR,
32 	IEEE802154_ATTR_COORD_HW_ADDR,
33 	IEEE802154_ATTR_COORD_PAN_ID,
34 
35 	IEEE802154_ATTR_SRC_SHORT_ADDR,
36 	IEEE802154_ATTR_SRC_HW_ADDR,
37 	IEEE802154_ATTR_SRC_PAN_ID,
38 
39 	IEEE802154_ATTR_DEST_SHORT_ADDR,
40 	IEEE802154_ATTR_DEST_HW_ADDR,
41 	IEEE802154_ATTR_DEST_PAN_ID,
42 
43 	IEEE802154_ATTR_CAPABILITY,
44 	IEEE802154_ATTR_REASON,
45 	IEEE802154_ATTR_SCAN_TYPE,
46 	IEEE802154_ATTR_CHANNELS,
47 	IEEE802154_ATTR_DURATION,
48 	IEEE802154_ATTR_ED_LIST,
49 	IEEE802154_ATTR_BCN_ORD,
50 	IEEE802154_ATTR_SF_ORD,
51 	IEEE802154_ATTR_PAN_COORD,
52 	IEEE802154_ATTR_BAT_EXT,
53 	IEEE802154_ATTR_COORD_REALIGN,
54 	IEEE802154_ATTR_SEC,
55 
56 	IEEE802154_ATTR_PAGE,
57 	IEEE802154_ATTR_CHANNEL_PAGE_LIST,
58 
59 	IEEE802154_ATTR_PHY_NAME,
60 	IEEE802154_ATTR_DEV_TYPE,
61 
62 	IEEE802154_ATTR_TXPOWER,
63 	IEEE802154_ATTR_LBT_ENABLED,
64 	IEEE802154_ATTR_CCA_MODE,
65 	IEEE802154_ATTR_CCA_ED_LEVEL,
66 	IEEE802154_ATTR_CSMA_RETRIES,
67 	IEEE802154_ATTR_CSMA_MIN_BE,
68 	IEEE802154_ATTR_CSMA_MAX_BE,
69 
70 	IEEE802154_ATTR_FRAME_RETRIES,
71 
72 	IEEE802154_ATTR_LLSEC_ENABLED,
73 	IEEE802154_ATTR_LLSEC_SECLEVEL,
74 	IEEE802154_ATTR_LLSEC_KEY_MODE,
75 	IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT,
76 	IEEE802154_ATTR_LLSEC_KEY_SOURCE_EXTENDED,
77 	IEEE802154_ATTR_LLSEC_KEY_ID,
78 	IEEE802154_ATTR_LLSEC_FRAME_COUNTER,
79 	IEEE802154_ATTR_LLSEC_KEY_BYTES,
80 	IEEE802154_ATTR_LLSEC_KEY_USAGE_FRAME_TYPES,
81 	IEEE802154_ATTR_LLSEC_KEY_USAGE_COMMANDS,
82 	IEEE802154_ATTR_LLSEC_FRAME_TYPE,
83 	IEEE802154_ATTR_LLSEC_CMD_FRAME_ID,
84 	IEEE802154_ATTR_LLSEC_SECLEVELS,
85 	IEEE802154_ATTR_LLSEC_DEV_OVERRIDE,
86 	IEEE802154_ATTR_LLSEC_DEV_KEY_MODE,
87 
88 	IEEE802154_ATTR_PAD,
89 
90 	__IEEE802154_ATTR_MAX,
91 };
92 
93 #define IEEE802154_ATTR_MAX (__IEEE802154_ATTR_MAX - 1)
94 
95 extern const struct nla_policy ieee802154_policy[];
96 
97 /* commands */
98 /* REQ should be responded with CONF
99  * and INDIC with RESP
100  */
101 enum {
102 	__IEEE802154_COMMAND_INVALID,
103 
104 	IEEE802154_ASSOCIATE_REQ,
105 	IEEE802154_ASSOCIATE_CONF,
106 	IEEE802154_DISASSOCIATE_REQ,
107 	IEEE802154_DISASSOCIATE_CONF,
108 	IEEE802154_GET_REQ,
109 	IEEE802154_GET_CONF,
110 	IEEE802154_RESET_REQ,
111 	IEEE802154_RESET_CONF,
112 	IEEE802154_SCAN_REQ,
113 	IEEE802154_SCAN_CONF,
114 	IEEE802154_SET_REQ,
115 	IEEE802154_SET_CONF,
116 	IEEE802154_START_REQ,
117 	IEEE802154_START_CONF,
118 	IEEE802154_SYNC_REQ,
119 	IEEE802154_POLL_REQ,
120 	IEEE802154_POLL_CONF,
121 
122 	IEEE802154_ASSOCIATE_INDIC,
123 	IEEE802154_ASSOCIATE_RESP,
124 	IEEE802154_DISASSOCIATE_INDIC,
125 	IEEE802154_BEACON_NOTIFY_INDIC,
126 	IEEE802154_ORPHAN_INDIC,
127 	IEEE802154_ORPHAN_RESP,
128 	IEEE802154_COMM_STATUS_INDIC,
129 	IEEE802154_SYNC_LOSS_INDIC,
130 
131 	IEEE802154_GTS_REQ, /* Not supported yet */
132 	IEEE802154_GTS_INDIC, /* Not supported yet */
133 	IEEE802154_GTS_CONF, /* Not supported yet */
134 	IEEE802154_RX_ENABLE_REQ, /* Not supported yet */
135 	IEEE802154_RX_ENABLE_CONF, /* Not supported yet */
136 
137 	IEEE802154_LIST_IFACE,
138 	IEEE802154_LIST_PHY,
139 	IEEE802154_ADD_IFACE,
140 	IEEE802154_DEL_IFACE,
141 
142 	IEEE802154_SET_MACPARAMS,
143 
144 	IEEE802154_LLSEC_GETPARAMS,
145 	IEEE802154_LLSEC_SETPARAMS,
146 	IEEE802154_LLSEC_LIST_KEY,
147 	IEEE802154_LLSEC_ADD_KEY,
148 	IEEE802154_LLSEC_DEL_KEY,
149 	IEEE802154_LLSEC_LIST_DEV,
150 	IEEE802154_LLSEC_ADD_DEV,
151 	IEEE802154_LLSEC_DEL_DEV,
152 	IEEE802154_LLSEC_LIST_DEVKEY,
153 	IEEE802154_LLSEC_ADD_DEVKEY,
154 	IEEE802154_LLSEC_DEL_DEVKEY,
155 	IEEE802154_LLSEC_LIST_SECLEVEL,
156 	IEEE802154_LLSEC_ADD_SECLEVEL,
157 	IEEE802154_LLSEC_DEL_SECLEVEL,
158 
159 	__IEEE802154_CMD_MAX,
160 };
161 
162 #define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1)
163 
164 enum {
165 	__IEEE802154_DEV_INVALID = -1,
166 
167 	IEEE802154_DEV_WPAN,
168 	IEEE802154_DEV_MONITOR,
169 
170 	__IEEE802154_DEV_MAX,
171 };
172 
173 #endif
174