diff options
Diffstat (limited to 'include/linux/ieee80211.h')
-rw-r--r-- | include/linux/ieee80211.h | 181 |
1 files changed, 181 insertions, 0 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index c4e6ca1a630..b1bb817d142 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -527,6 +527,8 @@ struct ieee80211_tim_ie { | |||
527 | u8 virtual_map[0]; | 527 | u8 virtual_map[0]; |
528 | } __attribute__ ((packed)); | 528 | } __attribute__ ((packed)); |
529 | 529 | ||
530 | #define WLAN_SA_QUERY_TR_ID_LEN 16 | ||
531 | |||
530 | struct ieee80211_mgmt { | 532 | struct ieee80211_mgmt { |
531 | __le16 frame_control; | 533 | __le16 frame_control; |
532 | __le16 duration; | 534 | __le16 duration; |
@@ -646,6 +648,10 @@ struct ieee80211_mgmt { | |||
646 | u8 action_code; | 648 | u8 action_code; |
647 | u8 variable[0]; | 649 | u8 variable[0]; |
648 | } __attribute__((packed)) mesh_action; | 650 | } __attribute__((packed)) mesh_action; |
651 | struct { | ||
652 | u8 action; | ||
653 | u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN]; | ||
654 | } __attribute__ ((packed)) sa_query; | ||
649 | } u; | 655 | } u; |
650 | } __attribute__ ((packed)) action; | 656 | } __attribute__ ((packed)) action; |
651 | } u; | 657 | } u; |
@@ -655,6 +661,15 @@ struct ieee80211_mgmt { | |||
655 | #define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u) | 661 | #define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u) |
656 | 662 | ||
657 | 663 | ||
664 | /* Management MIC information element (IEEE 802.11w) */ | ||
665 | struct ieee80211_mmie { | ||
666 | u8 element_id; | ||
667 | u8 length; | ||
668 | __le16 key_id; | ||
669 | u8 sequence_number[6]; | ||
670 | u8 mic[8]; | ||
671 | } __attribute__ ((packed)); | ||
672 | |||
658 | /* Control frames */ | 673 | /* Control frames */ |
659 | struct ieee80211_rts { | 674 | struct ieee80211_rts { |
660 | __le16 frame_control; | 675 | __le16 frame_control; |
@@ -899,6 +914,9 @@ enum ieee80211_statuscode { | |||
899 | /* 802.11g */ | 914 | /* 802.11g */ |
900 | WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25, | 915 | WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25, |
901 | WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26, | 916 | WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26, |
917 | /* 802.11w */ | ||
918 | WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY = 30, | ||
919 | WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION = 31, | ||
902 | /* 802.11i */ | 920 | /* 802.11i */ |
903 | WLAN_STATUS_INVALID_IE = 40, | 921 | WLAN_STATUS_INVALID_IE = 40, |
904 | WLAN_STATUS_INVALID_GROUP_CIPHER = 41, | 922 | WLAN_STATUS_INVALID_GROUP_CIPHER = 41, |
@@ -1018,6 +1036,8 @@ enum ieee80211_eid { | |||
1018 | WLAN_EID_HT_INFORMATION = 61, | 1036 | WLAN_EID_HT_INFORMATION = 61, |
1019 | /* 802.11i */ | 1037 | /* 802.11i */ |
1020 | WLAN_EID_RSN = 48, | 1038 | WLAN_EID_RSN = 48, |
1039 | WLAN_EID_TIMEOUT_INTERVAL = 56, | ||
1040 | WLAN_EID_MMIE = 76 /* 802.11w */, | ||
1021 | WLAN_EID_WPA = 221, | 1041 | WLAN_EID_WPA = 221, |
1022 | WLAN_EID_GENERIC = 221, | 1042 | WLAN_EID_GENERIC = 221, |
1023 | WLAN_EID_VENDOR_SPECIFIC = 221, | 1043 | WLAN_EID_VENDOR_SPECIFIC = 221, |
@@ -1030,6 +1050,8 @@ enum ieee80211_category { | |||
1030 | WLAN_CATEGORY_QOS = 1, | 1050 | WLAN_CATEGORY_QOS = 1, |
1031 | WLAN_CATEGORY_DLS = 2, | 1051 | WLAN_CATEGORY_DLS = 2, |
1032 | WLAN_CATEGORY_BACK = 3, | 1052 | WLAN_CATEGORY_BACK = 3, |
1053 | WLAN_CATEGORY_PUBLIC = 4, | ||
1054 | WLAN_CATEGORY_SA_QUERY = 8, | ||
1033 | WLAN_CATEGORY_WMM = 17, | 1055 | WLAN_CATEGORY_WMM = 17, |
1034 | }; | 1056 | }; |
1035 | 1057 | ||
@@ -1104,6 +1126,12 @@ struct ieee80211_country_ie_triplet { | |||
1104 | }; | 1126 | }; |
1105 | } __attribute__ ((packed)); | 1127 | } __attribute__ ((packed)); |
1106 | 1128 | ||
1129 | enum ieee80211_timeout_interval_type { | ||
1130 | WLAN_TIMEOUT_REASSOC_DEADLINE = 1 /* 802.11r */, | ||
1131 | WLAN_TIMEOUT_KEY_LIFETIME = 2 /* 802.11r */, | ||
1132 | WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */, | ||
1133 | }; | ||
1134 | |||
1107 | /* BACK action code */ | 1135 | /* BACK action code */ |
1108 | enum ieee80211_back_actioncode { | 1136 | enum ieee80211_back_actioncode { |
1109 | WLAN_ACTION_ADDBA_REQ = 0, | 1137 | WLAN_ACTION_ADDBA_REQ = 0, |
@@ -1118,6 +1146,13 @@ enum ieee80211_back_parties { | |||
1118 | WLAN_BACK_TIMER = 2, | 1146 | WLAN_BACK_TIMER = 2, |
1119 | }; | 1147 | }; |
1120 | 1148 | ||
1149 | /* SA Query action */ | ||
1150 | enum ieee80211_sa_query_action { | ||
1151 | WLAN_ACTION_SA_QUERY_REQUEST = 0, | ||
1152 | WLAN_ACTION_SA_QUERY_RESPONSE = 1, | ||
1153 | }; | ||
1154 | |||
1155 | |||
1121 | /* A-MSDU 802.11n */ | 1156 | /* A-MSDU 802.11n */ |
1122 | #define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080 | 1157 | #define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080 |
1123 | 1158 | ||
@@ -1128,6 +1163,7 @@ enum ieee80211_back_parties { | |||
1128 | /* reserved: 0x000FAC03 */ | 1163 | /* reserved: 0x000FAC03 */ |
1129 | #define WLAN_CIPHER_SUITE_CCMP 0x000FAC04 | 1164 | #define WLAN_CIPHER_SUITE_CCMP 0x000FAC04 |
1130 | #define WLAN_CIPHER_SUITE_WEP104 0x000FAC05 | 1165 | #define WLAN_CIPHER_SUITE_WEP104 0x000FAC05 |
1166 | #define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06 | ||
1131 | 1167 | ||
1132 | #define WLAN_MAX_KEY_LEN 32 | 1168 | #define WLAN_MAX_KEY_LEN 32 |
1133 | 1169 | ||
@@ -1185,4 +1221,149 @@ static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) | |||
1185 | return hdr->addr1; | 1221 | return hdr->addr1; |
1186 | } | 1222 | } |
1187 | 1223 | ||
1224 | /** | ||
1225 | * ieee80211_is_robust_mgmt_frame - check if frame is a robust management frame | ||
1226 | * @hdr: the frame (buffer must include at least the first octet of payload) | ||
1227 | */ | ||
1228 | static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr) | ||
1229 | { | ||
1230 | if (ieee80211_is_disassoc(hdr->frame_control) || | ||
1231 | ieee80211_is_deauth(hdr->frame_control)) | ||
1232 | return true; | ||
1233 | |||
1234 | if (ieee80211_is_action(hdr->frame_control)) { | ||
1235 | u8 *category; | ||
1236 | |||
1237 | /* | ||
1238 | * Action frames, excluding Public Action frames, are Robust | ||
1239 | * Management Frames. However, if we are looking at a Protected | ||
1240 | * frame, skip the check since the data may be encrypted and | ||
1241 | * the frame has already been found to be a Robust Management | ||
1242 | * Frame (by the other end). | ||
1243 | */ | ||
1244 | if (ieee80211_has_protected(hdr->frame_control)) | ||
1245 | return true; | ||
1246 | category = ((u8 *) hdr) + 24; | ||
1247 | return *category != WLAN_CATEGORY_PUBLIC; | ||
1248 | } | ||
1249 | |||
1250 | return false; | ||
1251 | } | ||
1252 | |||
1253 | /** | ||
1254 | * ieee80211_fhss_chan_to_freq - get channel frequency | ||
1255 | * @channel: the FHSS channel | ||
1256 | * | ||
1257 | * Convert IEEE802.11 FHSS channel to frequency (MHz) | ||
1258 | * Ref IEEE 802.11-2007 section 14.6 | ||
1259 | */ | ||
1260 | static inline int ieee80211_fhss_chan_to_freq(int channel) | ||
1261 | { | ||
1262 | if ((channel > 1) && (channel < 96)) | ||
1263 | return channel + 2400; | ||
1264 | else | ||
1265 | return -1; | ||
1266 | } | ||
1267 | |||
1268 | /** | ||
1269 | * ieee80211_freq_to_fhss_chan - get channel | ||
1270 | * @freq: the channels frequency | ||
1271 | * | ||
1272 | * Convert frequency (MHz) to IEEE802.11 FHSS channel | ||
1273 | * Ref IEEE 802.11-2007 section 14.6 | ||
1274 | */ | ||
1275 | static inline int ieee80211_freq_to_fhss_chan(int freq) | ||
1276 | { | ||
1277 | if ((freq > 2401) && (freq < 2496)) | ||
1278 | return freq - 2400; | ||
1279 | else | ||
1280 | return -1; | ||
1281 | } | ||
1282 | |||
1283 | /** | ||
1284 | * ieee80211_dsss_chan_to_freq - get channel center frequency | ||
1285 | * @channel: the DSSS channel | ||
1286 | * | ||
1287 | * Convert IEEE802.11 DSSS channel to the center frequency (MHz). | ||
1288 | * Ref IEEE 802.11-2007 section 15.6 | ||
1289 | */ | ||
1290 | static inline int ieee80211_dsss_chan_to_freq(int channel) | ||
1291 | { | ||
1292 | if ((channel > 0) && (channel < 14)) | ||
1293 | return 2407 + (channel * 5); | ||
1294 | else if (channel == 14) | ||
1295 | return 2484; | ||
1296 | else | ||
1297 | return -1; | ||
1298 | } | ||
1299 | |||
1300 | /** | ||
1301 | * ieee80211_freq_to_dsss_chan - get channel | ||
1302 | * @freq: the frequency | ||
1303 | * | ||
1304 | * Convert frequency (MHz) to IEEE802.11 DSSS channel | ||
1305 | * Ref IEEE 802.11-2007 section 15.6 | ||
1306 | * | ||
1307 | * This routine selects the channel with the closest center frequency. | ||
1308 | */ | ||
1309 | static inline int ieee80211_freq_to_dsss_chan(int freq) | ||
1310 | { | ||
1311 | if ((freq >= 2410) && (freq < 2475)) | ||
1312 | return (freq - 2405) / 5; | ||
1313 | else if ((freq >= 2482) && (freq < 2487)) | ||
1314 | return 14; | ||
1315 | else | ||
1316 | return -1; | ||
1317 | } | ||
1318 | |||
1319 | /* Convert IEEE802.11 HR DSSS channel to frequency (MHz) and back | ||
1320 | * Ref IEEE 802.11-2007 section 18.4.6.2 | ||
1321 | * | ||
1322 | * The channels and frequencies are the same as those defined for DSSS | ||
1323 | */ | ||
1324 | #define ieee80211_hr_chan_to_freq(chan) ieee80211_dsss_chan_to_freq(chan) | ||
1325 | #define ieee80211_freq_to_hr_chan(freq) ieee80211_freq_to_dsss_chan(freq) | ||
1326 | |||
1327 | /* Convert IEEE802.11 ERP channel to frequency (MHz) and back | ||
1328 | * Ref IEEE 802.11-2007 section 19.4.2 | ||
1329 | */ | ||
1330 | #define ieee80211_erp_chan_to_freq(chan) ieee80211_hr_chan_to_freq(chan) | ||
1331 | #define ieee80211_freq_to_erp_chan(freq) ieee80211_freq_to_hr_chan(freq) | ||
1332 | |||
1333 | /** | ||
1334 | * ieee80211_ofdm_chan_to_freq - get channel center frequency | ||
1335 | * @s_freq: starting frequency == (dotChannelStartingFactor/2) MHz | ||
1336 | * @channel: the OFDM channel | ||
1337 | * | ||
1338 | * Convert IEEE802.11 OFDM channel to center frequency (MHz) | ||
1339 | * Ref IEEE 802.11-2007 section 17.3.8.3.2 | ||
1340 | */ | ||
1341 | static inline int ieee80211_ofdm_chan_to_freq(int s_freq, int channel) | ||
1342 | { | ||
1343 | if ((channel > 0) && (channel <= 200) && | ||
1344 | (s_freq >= 4000)) | ||
1345 | return s_freq + (channel * 5); | ||
1346 | else | ||
1347 | return -1; | ||
1348 | } | ||
1349 | |||
1350 | /** | ||
1351 | * ieee80211_freq_to_ofdm_channel - get channel | ||
1352 | * @s_freq: starting frequency == (dotChannelStartingFactor/2) MHz | ||
1353 | * @freq: the frequency | ||
1354 | * | ||
1355 | * Convert frequency (MHz) to IEEE802.11 OFDM channel | ||
1356 | * Ref IEEE 802.11-2007 section 17.3.8.3.2 | ||
1357 | * | ||
1358 | * This routine selects the channel with the closest center frequency. | ||
1359 | */ | ||
1360 | static inline int ieee80211_freq_to_ofdm_chan(int s_freq, int freq) | ||
1361 | { | ||
1362 | if ((freq > (s_freq + 2)) && (freq <= (s_freq + 1202)) && | ||
1363 | (s_freq >= 4000)) | ||
1364 | return (freq + 2 - s_freq) / 5; | ||
1365 | else | ||
1366 | return -1; | ||
1367 | } | ||
1368 | |||
1188 | #endif /* LINUX_IEEE80211_H */ | 1369 | #endif /* LINUX_IEEE80211_H */ |