aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ieee802154.h
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-10-25 03:41:04 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-10-25 15:39:57 -0400
commit4ca24aca55fe1e2a61f3ffaac9015d9c45204729 (patch)
treee3b263954c1a572bd683763cab9bc37688bcc2c6 /include/linux/ieee802154.h
parent86d52cd96414f05c4053fb264a85309772c6ae26 (diff)
ieee802154: move ieee802154 header
This patch moves the ieee802154 header into include/linux instead include/net. Similar like wireless which have the ieee80211 header inside of include/linux. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Cc: Alan Ott <alan@signal11.us> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include/linux/ieee802154.h')
-rw-r--r--include/linux/ieee802154.h189
1 files changed, 189 insertions, 0 deletions
diff --git a/include/linux/ieee802154.h b/include/linux/ieee802154.h
new file mode 100644
index 000000000000..2dfab2db103a
--- /dev/null
+++ b/include/linux/ieee802154.h
@@ -0,0 +1,189 @@
1/*
2 * IEEE802.15.4-2003 specification
3 *
4 * Copyright (C) 2007, 2008 Siemens AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * Written by:
16 * Pavel Smolenskiy <pavel.smolenskiy@gmail.com>
17 * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
18 * Maxim Osipov <maxim.osipov@siemens.com>
19 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
20 * Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
21 */
22
23#ifndef LINUX_IEEE802154_H
24#define LINUX_IEEE802154_H
25
26#define IEEE802154_MTU 127
27
28#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */
29#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */
30#define IEEE802154_FC_TYPE_ACK 0x2 /* Frame is acknowledgment */
31#define IEEE802154_FC_TYPE_MAC_CMD 0x3 /* Frame is MAC command */
32
33#define IEEE802154_FC_TYPE_SHIFT 0
34#define IEEE802154_FC_TYPE_MASK ((1 << 3) - 1)
35#define IEEE802154_FC_TYPE(x) ((x & IEEE802154_FC_TYPE_MASK) >> IEEE802154_FC_TYPE_SHIFT)
36#define IEEE802154_FC_SET_TYPE(v, x) do { \
37 v = (((v) & ~IEEE802154_FC_TYPE_MASK) | \
38 (((x) << IEEE802154_FC_TYPE_SHIFT) & IEEE802154_FC_TYPE_MASK)); \
39 } while (0)
40
41#define IEEE802154_FC_SECEN_SHIFT 3
42#define IEEE802154_FC_SECEN (1 << IEEE802154_FC_SECEN_SHIFT)
43#define IEEE802154_FC_FRPEND_SHIFT 4
44#define IEEE802154_FC_FRPEND (1 << IEEE802154_FC_FRPEND_SHIFT)
45#define IEEE802154_FC_ACK_REQ_SHIFT 5
46#define IEEE802154_FC_ACK_REQ (1 << IEEE802154_FC_ACK_REQ_SHIFT)
47#define IEEE802154_FC_INTRA_PAN_SHIFT 6
48#define IEEE802154_FC_INTRA_PAN (1 << IEEE802154_FC_INTRA_PAN_SHIFT)
49
50#define IEEE802154_FC_SAMODE_SHIFT 14
51#define IEEE802154_FC_SAMODE_MASK (3 << IEEE802154_FC_SAMODE_SHIFT)
52#define IEEE802154_FC_DAMODE_SHIFT 10
53#define IEEE802154_FC_DAMODE_MASK (3 << IEEE802154_FC_DAMODE_SHIFT)
54
55#define IEEE802154_FC_VERSION_SHIFT 12
56#define IEEE802154_FC_VERSION_MASK (3 << IEEE802154_FC_VERSION_SHIFT)
57#define IEEE802154_FC_VERSION(x) ((x & IEEE802154_FC_VERSION_MASK) >> IEEE802154_FC_VERSION_SHIFT)
58
59#define IEEE802154_FC_SAMODE(x) \
60 (((x) & IEEE802154_FC_SAMODE_MASK) >> IEEE802154_FC_SAMODE_SHIFT)
61
62#define IEEE802154_FC_DAMODE(x) \
63 (((x) & IEEE802154_FC_DAMODE_MASK) >> IEEE802154_FC_DAMODE_SHIFT)
64
65#define IEEE802154_SCF_SECLEVEL_MASK 7
66#define IEEE802154_SCF_SECLEVEL_SHIFT 0
67#define IEEE802154_SCF_SECLEVEL(x) (x & IEEE802154_SCF_SECLEVEL_MASK)
68#define IEEE802154_SCF_KEY_ID_MODE_SHIFT 3
69#define IEEE802154_SCF_KEY_ID_MODE_MASK (3 << IEEE802154_SCF_KEY_ID_MODE_SHIFT)
70#define IEEE802154_SCF_KEY_ID_MODE(x) \
71 ((x & IEEE802154_SCF_KEY_ID_MODE_MASK) >> IEEE802154_SCF_KEY_ID_MODE_SHIFT)
72
73#define IEEE802154_SCF_KEY_IMPLICIT 0
74#define IEEE802154_SCF_KEY_INDEX 1
75#define IEEE802154_SCF_KEY_SHORT_INDEX 2
76#define IEEE802154_SCF_KEY_HW_INDEX 3
77
78#define IEEE802154_SCF_SECLEVEL_NONE 0
79#define IEEE802154_SCF_SECLEVEL_MIC32 1
80#define IEEE802154_SCF_SECLEVEL_MIC64 2
81#define IEEE802154_SCF_SECLEVEL_MIC128 3
82#define IEEE802154_SCF_SECLEVEL_ENC 4
83#define IEEE802154_SCF_SECLEVEL_ENC_MIC32 5
84#define IEEE802154_SCF_SECLEVEL_ENC_MIC64 6
85#define IEEE802154_SCF_SECLEVEL_ENC_MIC128 7
86
87/* MAC footer size */
88#define IEEE802154_MFR_SIZE 2 /* 2 octets */
89
90/* MAC's Command Frames Identifiers */
91#define IEEE802154_CMD_ASSOCIATION_REQ 0x01
92#define IEEE802154_CMD_ASSOCIATION_RESP 0x02
93#define IEEE802154_CMD_DISASSOCIATION_NOTIFY 0x03
94#define IEEE802154_CMD_DATA_REQ 0x04
95#define IEEE802154_CMD_PANID_CONFLICT_NOTIFY 0x05
96#define IEEE802154_CMD_ORPHAN_NOTIFY 0x06
97#define IEEE802154_CMD_BEACON_REQ 0x07
98#define IEEE802154_CMD_COORD_REALIGN_NOTIFY 0x08
99#define IEEE802154_CMD_GTS_REQ 0x09
100
101/*
102 * The return values of MAC operations
103 */
104enum {
105 /*
106 * The requested operation was completed successfully.
107 * For a transmission request, this value indicates
108 * a successful transmission.
109 */
110 IEEE802154_SUCCESS = 0x0,
111
112 /* The beacon was lost following a synchronization request. */
113 IEEE802154_BEACON_LOSS = 0xe0,
114 /*
115 * A transmission could not take place due to activity on the
116 * channel, i.e., the CSMA-CA mechanism has failed.
117 */
118 IEEE802154_CHNL_ACCESS_FAIL = 0xe1,
119 /* The GTS request has been denied by the PAN coordinator. */
120 IEEE802154_DENINED = 0xe2,
121 /* The attempt to disable the transceiver has failed. */
122 IEEE802154_DISABLE_TRX_FAIL = 0xe3,
123 /*
124 * The received frame induces a failed security check according to
125 * the security suite.
126 */
127 IEEE802154_FAILED_SECURITY_CHECK = 0xe4,
128 /*
129 * The frame resulting from secure processing has a length that is
130 * greater than aMACMaxFrameSize.
131 */
132 IEEE802154_FRAME_TOO_LONG = 0xe5,
133 /*
134 * The requested GTS transmission failed because the specified GTS
135 * either did not have a transmit GTS direction or was not defined.
136 */
137 IEEE802154_INVALID_GTS = 0xe6,
138 /*
139 * A request to purge an MSDU from the transaction queue was made using
140 * an MSDU handle that was not found in the transaction table.
141 */
142 IEEE802154_INVALID_HANDLE = 0xe7,
143 /* A parameter in the primitive is out of the valid range.*/
144 IEEE802154_INVALID_PARAMETER = 0xe8,
145 /* No acknowledgment was received after aMaxFrameRetries. */
146 IEEE802154_NO_ACK = 0xe9,
147 /* A scan operation failed to find any network beacons.*/
148 IEEE802154_NO_BEACON = 0xea,
149 /* No response data were available following a request. */
150 IEEE802154_NO_DATA = 0xeb,
151 /* The operation failed because a short address was not allocated. */
152 IEEE802154_NO_SHORT_ADDRESS = 0xec,
153 /*
154 * A receiver enable request was unsuccessful because it could not be
155 * completed within the CAP.
156 */
157 IEEE802154_OUT_OF_CAP = 0xed,
158 /*
159 * A PAN identifier conflict has been detected and communicated to the
160 * PAN coordinator.
161 */
162 IEEE802154_PANID_CONFLICT = 0xee,
163 /* A coordinator realignment command has been received. */
164 IEEE802154_REALIGMENT = 0xef,
165 /* The transaction has expired and its information discarded. */
166 IEEE802154_TRANSACTION_EXPIRED = 0xf0,
167 /* There is no capacity to store the transaction. */
168 IEEE802154_TRANSACTION_OVERFLOW = 0xf1,
169 /*
170 * The transceiver was in the transmitter enabled state when the
171 * receiver was requested to be enabled.
172 */
173 IEEE802154_TX_ACTIVE = 0xf2,
174 /* The appropriate key is not available in the ACL. */
175 IEEE802154_UNAVAILABLE_KEY = 0xf3,
176 /*
177 * A SET/GET request was issued with the identifier of a PIB attribute
178 * that is not supported.
179 */
180 IEEE802154_UNSUPPORTED_ATTR = 0xf4,
181 /*
182 * A request to perform a scan operation failed because the MLME was
183 * in the process of performing a previously initiated scan operation.
184 */
185 IEEE802154_SCAN_IN_PROGRESS = 0xfc,
186};
187
188
189#endif /* LINUX_IEEE802154_H */