Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ieee802154.h
Go to the documentation of this file.
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  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Written by:
20  * Pavel Smolenskiy <[email protected]>
21  * Maxim Gorbachyov <[email protected]>
22  * Maxim Osipov <[email protected]>
23  * Dmitry Eremin-Solenikov <[email protected]>
24  * Alexander Smirnov <[email protected]>
25  */
26 
27 #ifndef NET_IEEE802154_H
28 #define NET_IEEE802154_H
29 
30 #define IEEE802154_MTU 127
31 
32 #define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */
33 #define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */
34 #define IEEE802154_FC_TYPE_ACK 0x2 /* Frame is acknowledgment */
35 #define IEEE802154_FC_TYPE_MAC_CMD 0x3 /* Frame is MAC command */
36 
37 #define IEEE802154_FC_TYPE_SHIFT 0
38 #define IEEE802154_FC_TYPE_MASK ((1 << 3) - 1)
39 #define IEEE802154_FC_TYPE(x) ((x & IEEE802154_FC_TYPE_MASK) >> IEEE802154_FC_TYPE_SHIFT)
40 #define IEEE802154_FC_SET_TYPE(v, x) do { \
41  v = (((v) & ~IEEE802154_FC_TYPE_MASK) | \
42  (((x) << IEEE802154_FC_TYPE_SHIFT) & IEEE802154_FC_TYPE_MASK)); \
43  } while (0)
44 
45 #define IEEE802154_FC_SECEN (1 << 3)
46 #define IEEE802154_FC_FRPEND (1 << 4)
47 #define IEEE802154_FC_ACK_REQ (1 << 5)
48 #define IEEE802154_FC_INTRA_PAN (1 << 6)
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_SAMODE(x) \
56  (((x) & IEEE802154_FC_SAMODE_MASK) >> IEEE802154_FC_SAMODE_SHIFT)
57 
58 #define IEEE802154_FC_DAMODE(x) \
59  (((x) & IEEE802154_FC_DAMODE_MASK) >> IEEE802154_FC_DAMODE_SHIFT)
60 
61 
62 /* MAC footer size */
63 #define IEEE802154_MFR_SIZE 2 /* 2 octets */
64 
65 /* MAC's Command Frames Identifiers */
66 #define IEEE802154_CMD_ASSOCIATION_REQ 0x01
67 #define IEEE802154_CMD_ASSOCIATION_RESP 0x02
68 #define IEEE802154_CMD_DISASSOCIATION_NOTIFY 0x03
69 #define IEEE802154_CMD_DATA_REQ 0x04
70 #define IEEE802154_CMD_PANID_CONFLICT_NOTIFY 0x05
71 #define IEEE802154_CMD_ORPHAN_NOTIFY 0x06
72 #define IEEE802154_CMD_BEACON_REQ 0x07
73 #define IEEE802154_CMD_COORD_REALIGN_NOTIFY 0x08
74 #define IEEE802154_CMD_GTS_REQ 0x09
75 
76 /*
77  * The return values of MAC operations
78  */
79 enum {
80  /*
81  * The requested operation was completed successfully.
82  * For a transmission request, this value indicates
83  * a successful transmission.
84  */
86 
87  /* The beacon was lost following a synchronization request. */
89  /*
90  * A transmission could not take place due to activity on the
91  * channel, i.e., the CSMA-CA mechanism has failed.
92  */
94  /* The GTS request has been denied by the PAN coordinator. */
96  /* The attempt to disable the transceiver has failed. */
98  /*
99  * The received frame induces a failed security check according to
100  * the security suite.
101  */
103  /*
104  * The frame resulting from secure processing has a length that is
105  * greater than aMACMaxFrameSize.
106  */
108  /*
109  * The requested GTS transmission failed because the specified GTS
110  * either did not have a transmit GTS direction or was not defined.
111  */
113  /*
114  * A request to purge an MSDU from the transaction queue was made using
115  * an MSDU handle that was not found in the transaction table.
116  */
118  /* A parameter in the primitive is out of the valid range.*/
120  /* No acknowledgment was received after aMaxFrameRetries. */
122  /* A scan operation failed to find any network beacons.*/
124  /* No response data were available following a request. */
126  /* The operation failed because a short address was not allocated. */
128  /*
129  * A receiver enable request was unsuccessful because it could not be
130  * completed within the CAP.
131  */
133  /*
134  * A PAN identifier conflict has been detected and communicated to the
135  * PAN coordinator.
136  */
138  /* A coordinator realignment command has been received. */
140  /* The transaction has expired and its information discarded. */
142  /* There is no capacity to store the transaction. */
144  /*
145  * The transceiver was in the transmitter enabled state when the
146  * receiver was requested to be enabled.
147  */
149  /* The appropriate key is not available in the ACL. */
151  /*
152  * A SET/GET request was issued with the identifier of a PIB attribute
153  * that is not supported.
154  */
156  /*
157  * A request to perform a scan operation failed because the MLME was
158  * in the process of performing a previously initiated scan operation.
159  */
161 };
162 
163 
164 #endif
165 
166