aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ieee80211.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ieee80211.h')
-rw-r--r--include/linux/ieee80211.h198
1 files changed, 198 insertions, 0 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index c4e6ca1a6306..4b501b48ce86 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -18,6 +18,22 @@
18#include <linux/types.h> 18#include <linux/types.h>
19#include <asm/byteorder.h> 19#include <asm/byteorder.h>
20 20
21/*
22 * DS bit usage
23 *
24 * TA = transmitter address
25 * RA = receiver address
26 * DA = destination address
27 * SA = source address
28 *
29 * ToDS FromDS A1(RA) A2(TA) A3 A4 Use
30 * -----------------------------------------------------------------
31 * 0 0 DA SA BSSID - IBSS/DLS
32 * 0 1 DA BSSID SA - AP -> STA
33 * 1 0 BSSID SA DA - AP <- STA
34 * 1 1 RA TA DA SA unspecified (WDS)
35 */
36
21#define FCS_LEN 4 37#define FCS_LEN 4
22 38
23#define IEEE80211_FCTL_VERS 0x0003 39#define IEEE80211_FCTL_VERS 0x0003
@@ -527,6 +543,8 @@ struct ieee80211_tim_ie {
527 u8 virtual_map[0]; 543 u8 virtual_map[0];
528} __attribute__ ((packed)); 544} __attribute__ ((packed));
529 545
546#define WLAN_SA_QUERY_TR_ID_LEN 16
547
530struct ieee80211_mgmt { 548struct ieee80211_mgmt {
531 __le16 frame_control; 549 __le16 frame_control;
532 __le16 duration; 550 __le16 duration;
@@ -646,6 +664,10 @@ struct ieee80211_mgmt {
646 u8 action_code; 664 u8 action_code;
647 u8 variable[0]; 665 u8 variable[0];
648 } __attribute__((packed)) mesh_action; 666 } __attribute__((packed)) mesh_action;
667 struct {
668 u8 action;
669 u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
670 } __attribute__ ((packed)) sa_query;
649 } u; 671 } u;
650 } __attribute__ ((packed)) action; 672 } __attribute__ ((packed)) action;
651 } u; 673 } u;
@@ -655,6 +677,15 @@ struct ieee80211_mgmt {
655#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u) 677#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
656 678
657 679
680/* Management MIC information element (IEEE 802.11w) */
681struct ieee80211_mmie {
682 u8 element_id;
683 u8 length;
684 __le16 key_id;
685 u8 sequence_number[6];
686 u8 mic[8];
687} __attribute__ ((packed));
688
658/* Control frames */ 689/* Control frames */
659struct ieee80211_rts { 690struct ieee80211_rts {
660 __le16 frame_control; 691 __le16 frame_control;
@@ -836,6 +867,7 @@ struct ieee80211_ht_info {
836/* Authentication algorithms */ 867/* Authentication algorithms */
837#define WLAN_AUTH_OPEN 0 868#define WLAN_AUTH_OPEN 0
838#define WLAN_AUTH_SHARED_KEY 1 869#define WLAN_AUTH_SHARED_KEY 1
870#define WLAN_AUTH_FT 2
839#define WLAN_AUTH_LEAP 128 871#define WLAN_AUTH_LEAP 128
840 872
841#define WLAN_AUTH_CHALLENGE_LEN 128 873#define WLAN_AUTH_CHALLENGE_LEN 128
@@ -899,6 +931,9 @@ enum ieee80211_statuscode {
899 /* 802.11g */ 931 /* 802.11g */
900 WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25, 932 WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
901 WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26, 933 WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
934 /* 802.11w */
935 WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY = 30,
936 WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION = 31,
902 /* 802.11i */ 937 /* 802.11i */
903 WLAN_STATUS_INVALID_IE = 40, 938 WLAN_STATUS_INVALID_IE = 40,
904 WLAN_STATUS_INVALID_GROUP_CIPHER = 41, 939 WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
@@ -1018,6 +1053,8 @@ enum ieee80211_eid {
1018 WLAN_EID_HT_INFORMATION = 61, 1053 WLAN_EID_HT_INFORMATION = 61,
1019 /* 802.11i */ 1054 /* 802.11i */
1020 WLAN_EID_RSN = 48, 1055 WLAN_EID_RSN = 48,
1056 WLAN_EID_TIMEOUT_INTERVAL = 56,
1057 WLAN_EID_MMIE = 76 /* 802.11w */,
1021 WLAN_EID_WPA = 221, 1058 WLAN_EID_WPA = 221,
1022 WLAN_EID_GENERIC = 221, 1059 WLAN_EID_GENERIC = 221,
1023 WLAN_EID_VENDOR_SPECIFIC = 221, 1060 WLAN_EID_VENDOR_SPECIFIC = 221,
@@ -1030,6 +1067,8 @@ enum ieee80211_category {
1030 WLAN_CATEGORY_QOS = 1, 1067 WLAN_CATEGORY_QOS = 1,
1031 WLAN_CATEGORY_DLS = 2, 1068 WLAN_CATEGORY_DLS = 2,
1032 WLAN_CATEGORY_BACK = 3, 1069 WLAN_CATEGORY_BACK = 3,
1070 WLAN_CATEGORY_PUBLIC = 4,
1071 WLAN_CATEGORY_SA_QUERY = 8,
1033 WLAN_CATEGORY_WMM = 17, 1072 WLAN_CATEGORY_WMM = 17,
1034}; 1073};
1035 1074
@@ -1104,6 +1143,12 @@ struct ieee80211_country_ie_triplet {
1104 }; 1143 };
1105} __attribute__ ((packed)); 1144} __attribute__ ((packed));
1106 1145
1146enum ieee80211_timeout_interval_type {
1147 WLAN_TIMEOUT_REASSOC_DEADLINE = 1 /* 802.11r */,
1148 WLAN_TIMEOUT_KEY_LIFETIME = 2 /* 802.11r */,
1149 WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */,
1150};
1151
1107/* BACK action code */ 1152/* BACK action code */
1108enum ieee80211_back_actioncode { 1153enum ieee80211_back_actioncode {
1109 WLAN_ACTION_ADDBA_REQ = 0, 1154 WLAN_ACTION_ADDBA_REQ = 0,
@@ -1118,6 +1163,13 @@ enum ieee80211_back_parties {
1118 WLAN_BACK_TIMER = 2, 1163 WLAN_BACK_TIMER = 2,
1119}; 1164};
1120 1165
1166/* SA Query action */
1167enum ieee80211_sa_query_action {
1168 WLAN_ACTION_SA_QUERY_REQUEST = 0,
1169 WLAN_ACTION_SA_QUERY_RESPONSE = 1,
1170};
1171
1172
1121/* A-MSDU 802.11n */ 1173/* A-MSDU 802.11n */
1122#define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080 1174#define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080
1123 1175
@@ -1128,6 +1180,7 @@ enum ieee80211_back_parties {
1128/* reserved: 0x000FAC03 */ 1180/* reserved: 0x000FAC03 */
1129#define WLAN_CIPHER_SUITE_CCMP 0x000FAC04 1181#define WLAN_CIPHER_SUITE_CCMP 0x000FAC04
1130#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05 1182#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
1183#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06
1131 1184
1132#define WLAN_MAX_KEY_LEN 32 1185#define WLAN_MAX_KEY_LEN 32
1133 1186
@@ -1185,4 +1238,149 @@ static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
1185 return hdr->addr1; 1238 return hdr->addr1;
1186} 1239}
1187 1240
1241/**
1242 * ieee80211_is_robust_mgmt_frame - check if frame is a robust management frame
1243 * @hdr: the frame (buffer must include at least the first octet of payload)
1244 */
1245static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
1246{
1247 if (ieee80211_is_disassoc(hdr->frame_control) ||
1248 ieee80211_is_deauth(hdr->frame_control))
1249 return true;
1250
1251 if (ieee80211_is_action(hdr->frame_control)) {
1252 u8 *category;
1253
1254 /*
1255 * Action frames, excluding Public Action frames, are Robust
1256 * Management Frames. However, if we are looking at a Protected
1257 * frame, skip the check since the data may be encrypted and
1258 * the frame has already been found to be a Robust Management
1259 * Frame (by the other end).
1260 */
1261 if (ieee80211_has_protected(hdr->frame_control))
1262 return true;
1263 category = ((u8 *) hdr) + 24;
1264 return *category != WLAN_CATEGORY_PUBLIC;
1265 }
1266
1267 return false;
1268}
1269
1270/**
1271 * ieee80211_fhss_chan_to_freq - get channel frequency
1272 * @channel: the FHSS channel
1273 *
1274 * Convert IEEE802.11 FHSS channel to frequency (MHz)
1275 * Ref IEEE 802.11-2007 section 14.6
1276 */
1277static inline int ieee80211_fhss_chan_to_freq(int channel)
1278{
1279 if ((channel > 1) && (channel < 96))
1280 return channel + 2400;
1281 else
1282 return -1;
1283}
1284
1285/**
1286 * ieee80211_freq_to_fhss_chan - get channel
1287 * @freq: the channels frequency
1288 *
1289 * Convert frequency (MHz) to IEEE802.11 FHSS channel
1290 * Ref IEEE 802.11-2007 section 14.6
1291 */
1292static inline int ieee80211_freq_to_fhss_chan(int freq)
1293{
1294 if ((freq > 2401) && (freq < 2496))
1295 return freq - 2400;
1296 else
1297 return -1;
1298}
1299
1300/**
1301 * ieee80211_dsss_chan_to_freq - get channel center frequency
1302 * @channel: the DSSS channel
1303 *
1304 * Convert IEEE802.11 DSSS channel to the center frequency (MHz).
1305 * Ref IEEE 802.11-2007 section 15.6
1306 */
1307static inline int ieee80211_dsss_chan_to_freq(int channel)
1308{
1309 if ((channel > 0) && (channel < 14))
1310 return 2407 + (channel * 5);
1311 else if (channel == 14)
1312 return 2484;
1313 else
1314 return -1;
1315}
1316
1317/**
1318 * ieee80211_freq_to_dsss_chan - get channel
1319 * @freq: the frequency
1320 *
1321 * Convert frequency (MHz) to IEEE802.11 DSSS channel
1322 * Ref IEEE 802.11-2007 section 15.6
1323 *
1324 * This routine selects the channel with the closest center frequency.
1325 */
1326static inline int ieee80211_freq_to_dsss_chan(int freq)
1327{
1328 if ((freq >= 2410) && (freq < 2475))
1329 return (freq - 2405) / 5;
1330 else if ((freq >= 2482) && (freq < 2487))
1331 return 14;
1332 else
1333 return -1;
1334}
1335
1336/* Convert IEEE802.11 HR DSSS channel to frequency (MHz) and back
1337 * Ref IEEE 802.11-2007 section 18.4.6.2
1338 *
1339 * The channels and frequencies are the same as those defined for DSSS
1340 */
1341#define ieee80211_hr_chan_to_freq(chan) ieee80211_dsss_chan_to_freq(chan)
1342#define ieee80211_freq_to_hr_chan(freq) ieee80211_freq_to_dsss_chan(freq)
1343
1344/* Convert IEEE802.11 ERP channel to frequency (MHz) and back
1345 * Ref IEEE 802.11-2007 section 19.4.2
1346 */
1347#define ieee80211_erp_chan_to_freq(chan) ieee80211_hr_chan_to_freq(chan)
1348#define ieee80211_freq_to_erp_chan(freq) ieee80211_freq_to_hr_chan(freq)
1349
1350/**
1351 * ieee80211_ofdm_chan_to_freq - get channel center frequency
1352 * @s_freq: starting frequency == (dotChannelStartingFactor/2) MHz
1353 * @channel: the OFDM channel
1354 *
1355 * Convert IEEE802.11 OFDM channel to center frequency (MHz)
1356 * Ref IEEE 802.11-2007 section 17.3.8.3.2
1357 */
1358static inline int ieee80211_ofdm_chan_to_freq(int s_freq, int channel)
1359{
1360 if ((channel > 0) && (channel <= 200) &&
1361 (s_freq >= 4000))
1362 return s_freq + (channel * 5);
1363 else
1364 return -1;
1365}
1366
1367/**
1368 * ieee80211_freq_to_ofdm_channel - get channel
1369 * @s_freq: starting frequency == (dotChannelStartingFactor/2) MHz
1370 * @freq: the frequency
1371 *
1372 * Convert frequency (MHz) to IEEE802.11 OFDM channel
1373 * Ref IEEE 802.11-2007 section 17.3.8.3.2
1374 *
1375 * This routine selects the channel with the closest center frequency.
1376 */
1377static inline int ieee80211_freq_to_ofdm_chan(int s_freq, int freq)
1378{
1379 if ((freq > (s_freq + 2)) && (freq <= (s_freq + 1202)) &&
1380 (s_freq >= 4000))
1381 return (freq + 2 - s_freq) / 5;
1382 else
1383 return -1;
1384}
1385
1188#endif /* LINUX_IEEE80211_H */ 1386#endif /* LINUX_IEEE80211_H */