[59fa7ab] | 1 | /*
|
---|
| 2 | * Copyright (c) 2015 Jan Kolarik
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
---|
| 6 | * modification, are permitted provided that the following conditions
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 9 | * - Redistributions of source code must retain the above copyright
|
---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | * documentation and/or other materials provided with the distribution.
|
---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
---|
| 15 | * derived from this software without specific prior written permission.
|
---|
| 16 | *
|
---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
| 29 | /**
|
---|
| 30 | * @addtogroup libieee80211
|
---|
| 31 | * @{
|
---|
| 32 | */
|
---|
| 33 |
|
---|
| 34 | /** @file ieee80211.h
|
---|
| 35 | *
|
---|
| 36 | * Internal IEEE 802.11 header that should not be included.
|
---|
| 37 | */
|
---|
| 38 |
|
---|
| 39 | #ifndef LIBNET_IEEE80211_PRIVATE_H
|
---|
| 40 | #define LIBNET_IEEE80211_PRIVATE_H
|
---|
| 41 |
|
---|
[1dcc0b9] | 42 | #include <fibril_synch.h>
|
---|
[59fa7ab] | 43 | #include <byteorder.h>
|
---|
| 44 | #include <ddf/driver.h>
|
---|
| 45 | #include <sys/types.h>
|
---|
| 46 |
|
---|
| 47 | #include <ieee80211/ieee80211.h>
|
---|
| 48 | #include "ieee80211.h"
|
---|
| 49 |
|
---|
[1dcc0b9] | 50 | /* Timeout in us for waiting to authentication/association response. */
|
---|
| 51 | #define AUTH_TIMEOUT 200000
|
---|
| 52 |
|
---|
| 53 | /* Timeout in us for waiting to finish 4-way handshake process. */
|
---|
[a931b7b] | 54 | #define HANDSHAKE_TIMEOUT 5000000
|
---|
[1dcc0b9] | 55 |
|
---|
[053fc2b] | 56 | /* Scanning period. */
|
---|
| 57 | #define SCAN_PERIOD_USEC 35000000
|
---|
| 58 |
|
---|
| 59 | /* Time to wait for beacons on channel. */
|
---|
| 60 | #define SCAN_CHANNEL_WAIT_USEC 200000
|
---|
[1dcc0b9] | 61 |
|
---|
| 62 | /* Max time to keep scan result. */
|
---|
| 63 | #define MAX_KEEP_SCAN_SPAN_SEC 120
|
---|
| 64 |
|
---|
| 65 | /* Security bit in capability info field. */
|
---|
| 66 | #define CAP_SECURITY 0x10
|
---|
| 67 |
|
---|
| 68 | /* Protocol type used in EAPOL frames. */
|
---|
| 69 | #define ETH_TYPE_PAE 0x888E
|
---|
| 70 |
|
---|
| 71 | /* WPA OUI used in vendor specific IE. */
|
---|
| 72 | #define WPA_OUI 0x0050F201
|
---|
| 73 |
|
---|
| 74 | /* GTK OUI used in vendor specific IE. */
|
---|
| 75 | #define GTK_OUI 0x000FAC01
|
---|
| 76 |
|
---|
| 77 | /* Max PTK key length. */
|
---|
| 78 | #define MAX_PTK_LENGTH 64
|
---|
| 79 |
|
---|
| 80 | /* Max GTK key length. */
|
---|
| 81 | #define MAX_GTK_LENGTH 64
|
---|
| 82 |
|
---|
| 83 | /* KEK offset inside PTK. */
|
---|
| 84 | #define KEK_OFFSET 16
|
---|
| 85 |
|
---|
| 86 | /* TK offset inside PTK. */
|
---|
| 87 | #define TK_OFFSET 32
|
---|
| 88 |
|
---|
| 89 | /*
|
---|
| 90 | * Length of data to be encrypted by PRF function:
|
---|
| 91 | * NONCE + SNONCE (2 * 32) + DEST_MAC + SOURCE_MAC (2 * ETH_ADDR)
|
---|
| 92 | */
|
---|
| 93 | #define PRF_CRYPT_DATA_LENGTH 2*32 + 2*ETH_ADDR
|
---|
| 94 |
|
---|
[a931b7b] | 95 | /* Special room in header reserved for encryption. */
|
---|
| 96 | typedef enum {
|
---|
| 97 | IEEE80211_TKIP_HEADER_LENGTH = 8,
|
---|
| 98 | IEEE80211_CCMP_HEADER_LENGTH = 8
|
---|
| 99 | } ieee80211_encrypt_header_reserve_length_t;
|
---|
| 100 |
|
---|
| 101 | /* Special room in footer reserved for encryption. */
|
---|
| 102 | typedef enum {
|
---|
| 103 | IEEE80211_TKIP_FOOTER_LENGTH = 4,
|
---|
| 104 | IEEE80211_CCMP_FOOTER_LENGTH = 8
|
---|
| 105 | } ieee80211_encrypt_footer_reserve_length_t;
|
---|
| 106 |
|
---|
[1dcc0b9] | 107 | /** IEEE 802.11 PTK key length. */
|
---|
| 108 | typedef enum {
|
---|
| 109 | IEEE80211_PTK_CCMP_LENGTH = 48,
|
---|
| 110 | IEEE80211_PTK_TKIP_LENGTH = 64
|
---|
| 111 | } ieee80211_ptk_length_t;
|
---|
| 112 |
|
---|
| 113 | /** IEEE 802.11 GTK key length. */
|
---|
| 114 | typedef enum {
|
---|
| 115 | IEEE80211_GTK_CCMP_LENGTH = 16,
|
---|
| 116 | IEEE80211_GTK_TKIP_LENGTH = 32
|
---|
| 117 | } ieee80211_gtk_length_t;
|
---|
| 118 |
|
---|
[59fa7ab] | 119 | /** IEEE 802.11 frame types. */
|
---|
| 120 | typedef enum {
|
---|
| 121 | IEEE80211_MGMT_FRAME = 0x0,
|
---|
| 122 | IEEE80211_CTRL_FRAME = 0x4,
|
---|
| 123 | IEEE80211_DATA_FRAME = 0x8,
|
---|
| 124 | IEEE80211_EXT_FRAME = 0xC
|
---|
| 125 | } ieee80211_frame_type_t;
|
---|
| 126 |
|
---|
[1dcc0b9] | 127 | /** IEEE 802.11 management frame subtypes. */
|
---|
[59fa7ab] | 128 | typedef enum {
|
---|
| 129 | IEEE80211_MGMT_ASSOC_REQ_FRAME = 0x00,
|
---|
| 130 | IEEE80211_MGMT_ASSOC_RESP_FRAME = 0x10,
|
---|
| 131 | IEEE80211_MGMT_REASSOC_REQ_FRAME = 0x20,
|
---|
| 132 | IEEE80211_MGMT_REASSOC_RESP_FRAME = 0x30,
|
---|
| 133 | IEEE80211_MGMT_PROBE_REQ_FRAME = 0x40,
|
---|
| 134 | IEEE80211_MGMT_PROBE_RESP_FRAME = 0x50,
|
---|
| 135 | IEEE80211_MGMT_BEACON_FRAME = 0x80,
|
---|
[1dcc0b9] | 136 | IEEE80211_MGMT_DISASSOC_FRAME = 0xA0,
|
---|
[59fa7ab] | 137 | IEEE80211_MGMT_AUTH_FRAME = 0xB0,
|
---|
| 138 | IEEE80211_MGMT_DEAUTH_FRAME = 0xC0,
|
---|
[1dcc0b9] | 139 | } ieee80211_frame_mgmt_subtype_t;
|
---|
| 140 |
|
---|
| 141 | /** IEEE 802.11 data frame subtypes. */
|
---|
| 142 | typedef enum {
|
---|
| 143 | IEEE80211_DATA_DATA_FRAME = 0x0000,
|
---|
| 144 | IEEE80211_DATA_QOS_FRAME = 0x0080
|
---|
| 145 | } ieee80211_frame_data_subtype_t;
|
---|
[59fa7ab] | 146 |
|
---|
| 147 | /** IEEE 802.11 frame control value masks. */
|
---|
| 148 | typedef enum {
|
---|
| 149 | IEEE80211_FRAME_CTRL_FRAME_TYPE = 0x000C,
|
---|
| 150 | IEEE80211_FRAME_CTRL_FRAME_SUBTYPE = 0x00F0,
|
---|
[1dcc0b9] | 151 | IEEE80211_FRAME_CTRL_PROTECTED = 0x4000
|
---|
| 152 | } ieee80211_frame_ctrl_mask_t;
|
---|
| 153 |
|
---|
| 154 | /** IEEE 802.11 frame control DS field values. */
|
---|
| 155 | typedef enum {
|
---|
| 156 | IEEE80211_FRAME_CTRL_TODS = 0x0100,
|
---|
| 157 | IEEE80211_FRAME_CTRL_FROMDS = 0x0200
|
---|
| 158 | } ieee80211_frame_ctrl_ds_t;
|
---|
| 159 |
|
---|
| 160 | /** IEEE 802.11 authentication cipher suites values. */
|
---|
| 161 | typedef enum {
|
---|
| 162 | IEEE80211_AUTH_CIPHER_TKIP = 0x02,
|
---|
| 163 | IEEE80211_AUTH_CIPHER_CCMP = 0x04
|
---|
| 164 | } ieee80211_auth_cipher_type_t;
|
---|
| 165 |
|
---|
| 166 | /** IEEE 802.11 AKM suites values. */
|
---|
| 167 | typedef enum {
|
---|
| 168 | IEEE80211_AUTH_AKM_8021X = 0x01,
|
---|
| 169 | IEEE80211_AUTH_AKM_PSK = 0x02
|
---|
| 170 | } ieee80211_auth_akm_type_t;
|
---|
| 171 |
|
---|
| 172 | typedef enum {
|
---|
| 173 | IEEE80211_EAPOL_START = 0x1,
|
---|
| 174 | IEEE80211_EAPOL_KEY = 0x3
|
---|
| 175 | } ieee80211_eapol_frame_type_t;
|
---|
| 176 |
|
---|
| 177 | typedef enum {
|
---|
| 178 | IEEE80211_EAPOL_KEY_KEYINFO_KEYTYPE = 0x0008,
|
---|
| 179 | IEEE80211_EAPOL_KEY_KEYINFO_INSTALL = 0x0040,
|
---|
| 180 | IEEE80211_EAPOL_KEY_KEYINFO_ACK = 0x0080,
|
---|
| 181 | IEEE80211_EAPOL_KEY_KEYINFO_MIC = 0x0100,
|
---|
| 182 | IEEE80211_EAPOL_KEY_KEYINFO_SECURE = 0x0200,
|
---|
| 183 | IEEE80211_EAPOL_KEY_KEYINFO_ENCDATA = 0x1000
|
---|
| 184 | } ieee80211_eapol_key_keyinfo_t;
|
---|
[59fa7ab] | 185 |
|
---|
| 186 | /** IEEE 802.11 information element types. */
|
---|
| 187 | typedef enum {
|
---|
| 188 | IEEE80211_SSID_IE = 0, /**< Target SSID. */
|
---|
| 189 | IEEE80211_RATES_IE = 1, /**< Supported data rates. */
|
---|
| 190 | IEEE80211_CHANNEL_IE = 3, /**< Current channel number. */
|
---|
[1dcc0b9] | 191 | IEEE80211_CHALLENGE_IE = 16, /**< Challenge text. */
|
---|
| 192 | IEEE80211_RSN_IE = 48, /**< RSN. */
|
---|
| 193 | IEEE80211_EXT_RATES_IE = 50, /**< Extended data rates. */
|
---|
| 194 | IEEE80211_VENDOR_IE = 221 /**< Vendor specific IE. */
|
---|
[59fa7ab] | 195 | } ieee80211_ie_type_t;
|
---|
| 196 |
|
---|
[1dcc0b9] | 197 | /** IEEE 802.11 authentication phases. */
|
---|
| 198 | typedef enum {
|
---|
| 199 | IEEE80211_AUTH_DISCONNECTED,
|
---|
| 200 | IEEE80211_AUTH_AUTHENTICATED,
|
---|
[053fc2b] | 201 | IEEE80211_AUTH_ASSOCIATED,
|
---|
| 202 | IEEE80211_AUTH_CONNECTED
|
---|
[1dcc0b9] | 203 | } ieee80211_auth_phase_t;
|
---|
| 204 |
|
---|
| 205 | /** Link with scan result info. */
|
---|
| 206 | typedef struct {
|
---|
| 207 | link_t link;
|
---|
| 208 | time_t last_beacon;
|
---|
| 209 | ieee80211_scan_result_t scan_result;
|
---|
[a931b7b] | 210 | uint8_t auth_ie[256];
|
---|
| 211 | size_t auth_ie_len;
|
---|
[1dcc0b9] | 212 | } ieee80211_scan_result_link_t;
|
---|
| 213 |
|
---|
| 214 | /** List of scan results info. */
|
---|
| 215 | typedef struct {
|
---|
| 216 | list_t list;
|
---|
[053fc2b] | 217 | fibril_mutex_t results_mutex;
|
---|
[1dcc0b9] | 218 | size_t size;
|
---|
| 219 | } ieee80211_scan_result_list_t;
|
---|
| 220 |
|
---|
| 221 | /** BSSID info. */
|
---|
| 222 | typedef struct {
|
---|
| 223 | uint16_t aid;
|
---|
[053fc2b] | 224 | char password[IEEE80211_MAX_PASSW_LEN];
|
---|
[1dcc0b9] | 225 | uint8_t ptk[MAX_PTK_LENGTH];
|
---|
| 226 | uint8_t gtk[MAX_GTK_LENGTH];
|
---|
| 227 | ieee80211_scan_result_link_t *res_link;
|
---|
| 228 | } ieee80211_bssid_info_t;
|
---|
| 229 |
|
---|
[59fa7ab] | 230 | /** IEEE 802.11 WiFi device structure. */
|
---|
| 231 | struct ieee80211_dev {
|
---|
| 232 | /** Backing DDF device. */
|
---|
| 233 | ddf_dev_t *ddf_dev;
|
---|
| 234 |
|
---|
| 235 | /** Pointer to implemented IEEE 802.11 device operations. */
|
---|
| 236 | ieee80211_ops_t *ops;
|
---|
| 237 |
|
---|
| 238 | /** Pointer to implemented IEEE 802.11 interface operations. */
|
---|
| 239 | ieee80211_iface_t *iface;
|
---|
| 240 |
|
---|
| 241 | /** Pointer to driver specific data. */
|
---|
| 242 | void *specific;
|
---|
| 243 |
|
---|
| 244 | /** Current operating frequency. */
|
---|
| 245 | uint16_t current_freq;
|
---|
| 246 |
|
---|
| 247 | /** Current operating mode. */
|
---|
| 248 | ieee80211_operating_mode_t current_op_mode;
|
---|
| 249 |
|
---|
[1dcc0b9] | 250 | /** Info about BSSID we are connected to. */
|
---|
| 251 | ieee80211_bssid_info_t bssid_info;
|
---|
| 252 |
|
---|
| 253 | /**
|
---|
| 254 | * Flag indicating that data traffic is encrypted by HW key
|
---|
| 255 | * that is set up in device.
|
---|
| 256 | */
|
---|
| 257 | bool using_hw_key;
|
---|
| 258 |
|
---|
[59fa7ab] | 259 | /** BSSIDs we listen to. */
|
---|
| 260 | nic_address_t bssid_mask;
|
---|
| 261 |
|
---|
| 262 | /** List of APs in neighborhood. */
|
---|
[1dcc0b9] | 263 | ieee80211_scan_result_list_t ap_list;
|
---|
| 264 |
|
---|
| 265 | /** Current sequence number used in data frames. */
|
---|
| 266 | uint16_t sequence_number;
|
---|
| 267 |
|
---|
| 268 | /** Current authentication phase. */
|
---|
| 269 | ieee80211_auth_phase_t current_auth_phase;
|
---|
| 270 |
|
---|
[053fc2b] | 271 | /** Flag indicating whether client wants connect to network. */
|
---|
| 272 | bool pending_conn_req;
|
---|
| 273 |
|
---|
| 274 | /** Scanning guard. */
|
---|
| 275 | fibril_mutex_t scan_mutex;
|
---|
| 276 |
|
---|
[1dcc0b9] | 277 | /** General purpose guard. */
|
---|
| 278 | fibril_mutex_t gen_mutex;
|
---|
| 279 |
|
---|
| 280 | /** General purpose condition variable. */
|
---|
| 281 | fibril_condvar_t gen_cond;
|
---|
| 282 |
|
---|
| 283 | /** Indicates whether device is fully initialized. */
|
---|
| 284 | bool ready;
|
---|
[59fa7ab] | 285 |
|
---|
| 286 | /** Indicates whether driver has already started. */
|
---|
| 287 | bool started;
|
---|
| 288 | };
|
---|
| 289 |
|
---|
[1dcc0b9] | 290 | /** IEEE 802.3 (ethernet) header. */
|
---|
| 291 | typedef struct {
|
---|
| 292 | uint8_t dest_addr[ETH_ADDR];
|
---|
| 293 | uint8_t src_addr[ETH_ADDR];
|
---|
| 294 | uint16_t proto; /**< Big Endian value! */
|
---|
| 295 | } __attribute__((packed)) __attribute__ ((aligned(2)))
|
---|
| 296 | eth_header_t;
|
---|
| 297 |
|
---|
[59fa7ab] | 298 | /** IEEE 802.11 management header structure. */
|
---|
| 299 | typedef struct {
|
---|
| 300 | uint16_t frame_ctrl; /**< Little Endian value! */
|
---|
| 301 | uint16_t duration_id; /**< Little Endian value! */
|
---|
| 302 | uint8_t dest_addr[ETH_ADDR];
|
---|
| 303 | uint8_t src_addr[ETH_ADDR];
|
---|
| 304 | uint8_t bssid[ETH_ADDR];
|
---|
| 305 | uint16_t seq_ctrl; /**< Little Endian value! */
|
---|
[1dcc0b9] | 306 | } __attribute__((packed)) __attribute__ ((aligned(2)))
|
---|
| 307 | ieee80211_mgmt_header_t;
|
---|
[59fa7ab] | 308 |
|
---|
| 309 | /** IEEE 802.11 data header structure. */
|
---|
| 310 | typedef struct {
|
---|
| 311 | uint16_t frame_ctrl; /**< Little Endian value! */
|
---|
| 312 | uint16_t duration_id; /**< Little Endian value! */
|
---|
| 313 | uint8_t address1[ETH_ADDR];
|
---|
| 314 | uint8_t address2[ETH_ADDR];
|
---|
| 315 | uint8_t address3[ETH_ADDR];
|
---|
| 316 | uint16_t seq_ctrl; /**< Little Endian value! */
|
---|
[1dcc0b9] | 317 | } __attribute__((packed)) __attribute__ ((aligned(2)))
|
---|
| 318 | ieee80211_data_header_t;
|
---|
[59fa7ab] | 319 |
|
---|
| 320 | /** IEEE 802.11 information element header. */
|
---|
| 321 | typedef struct {
|
---|
| 322 | uint8_t element_id;
|
---|
| 323 | uint8_t length;
|
---|
[1dcc0b9] | 324 | } __attribute__((packed)) __attribute__ ((aligned(2)))
|
---|
| 325 | ieee80211_ie_header_t;
|
---|
[59fa7ab] | 326 |
|
---|
| 327 | /** IEEE 802.11 authentication frame body. */
|
---|
| 328 | typedef struct {
|
---|
| 329 | uint16_t auth_alg; /**< Little Endian value! */
|
---|
| 330 | uint16_t auth_trans_no; /**< Little Endian value! */
|
---|
| 331 | uint16_t status; /**< Little Endian value! */
|
---|
[1dcc0b9] | 332 | } __attribute__((packed)) __attribute__ ((aligned(2)))
|
---|
| 333 | ieee80211_auth_body_t;
|
---|
| 334 |
|
---|
| 335 | /** IEEE 802.11 deauthentication frame body. */
|
---|
| 336 | typedef struct {
|
---|
| 337 | uint16_t reason; /**< Little Endian value! */
|
---|
| 338 | } __attribute__((packed)) __attribute__ ((aligned(2)))
|
---|
| 339 | ieee80211_deauth_body_t;
|
---|
| 340 |
|
---|
| 341 | /** IEEE 802.11 association request frame body. */
|
---|
| 342 | typedef struct {
|
---|
| 343 | uint16_t capability; /**< Little Endian value! */
|
---|
| 344 | uint16_t listen_interval; /**< Little Endian value! */
|
---|
| 345 | } __attribute__((packed)) __attribute__ ((aligned(2)))
|
---|
| 346 | ieee80211_assoc_req_body_t;
|
---|
| 347 |
|
---|
| 348 | /** IEEE 802.11 association response frame body. */
|
---|
| 349 | typedef struct {
|
---|
| 350 | uint16_t capability; /**< Little Endian value! */
|
---|
| 351 | uint16_t status; /**< Little Endian value! */
|
---|
| 352 | uint16_t aid; /**< Little Endian value! */
|
---|
| 353 | } __attribute__((packed)) __attribute__ ((aligned(2)))
|
---|
| 354 | ieee80211_assoc_resp_body_t;
|
---|
[59fa7ab] | 355 |
|
---|
| 356 | /** IEEE 802.11 beacon frame body start. */
|
---|
| 357 | typedef struct {
|
---|
| 358 | uint8_t timestamp[8];
|
---|
[1dcc0b9] | 359 | uint16_t beacon_interval; /**< Little Endian value! */
|
---|
| 360 | uint16_t capability; /**< Little Endian value! */
|
---|
| 361 | } __attribute__((packed)) __attribute__ ((aligned(2)))
|
---|
| 362 | ieee80211_beacon_start_t;
|
---|
| 363 |
|
---|
| 364 | /** IEEE 802.11i EAPOL-Key frame format. */
|
---|
| 365 | typedef struct {
|
---|
| 366 | uint8_t proto_version;
|
---|
| 367 | uint8_t packet_type;
|
---|
| 368 | uint16_t body_length; /**< Big Endian value! */
|
---|
| 369 | uint8_t descriptor_type;
|
---|
| 370 | uint16_t key_info; /**< Big Endian value! */
|
---|
| 371 | uint16_t key_length; /**< Big Endian value! */
|
---|
| 372 | uint8_t key_replay_counter[8];
|
---|
| 373 | uint8_t key_nonce[32];
|
---|
| 374 | uint8_t eapol_key_iv[16];
|
---|
| 375 | uint8_t key_rsc[8];
|
---|
| 376 | uint8_t reserved[8];
|
---|
| 377 | uint8_t key_mic[16];
|
---|
| 378 | uint16_t key_data_length; /**< Big Endian value! */
|
---|
| 379 | } __attribute__((packed)) ieee80211_eapol_key_frame_t;
|
---|
| 380 |
|
---|
| 381 | #define ieee80211_scan_result_list_foreach(results, iter) \
|
---|
| 382 | list_foreach((results).list, link, ieee80211_scan_result_link_t, (iter))
|
---|
| 383 |
|
---|
| 384 | static inline void ieee80211_scan_result_list_init(
|
---|
| 385 | ieee80211_scan_result_list_t *results)
|
---|
| 386 | {
|
---|
| 387 | list_initialize(&results->list);
|
---|
[053fc2b] | 388 | fibril_mutex_initialize(&results->results_mutex);
|
---|
[1dcc0b9] | 389 | }
|
---|
| 390 |
|
---|
| 391 | static inline void ieee80211_scan_result_list_remove(
|
---|
| 392 | ieee80211_scan_result_list_t *results,
|
---|
| 393 | ieee80211_scan_result_link_t *result)
|
---|
| 394 | {
|
---|
| 395 | list_remove(&result->link);
|
---|
| 396 | results->size--;
|
---|
| 397 | }
|
---|
| 398 |
|
---|
| 399 | static inline void ieee80211_scan_result_list_append(
|
---|
| 400 | ieee80211_scan_result_list_t *results,
|
---|
| 401 | ieee80211_scan_result_link_t *result)
|
---|
| 402 | {
|
---|
| 403 | list_append(&result->link, &results->list);
|
---|
| 404 | results->size++;
|
---|
| 405 | }
|
---|
[59fa7ab] | 406 |
|
---|
[053fc2b] | 407 | extern void ieee80211_set_connect_request(ieee80211_dev_t *ieee80211_dev);
|
---|
| 408 | extern bool ieee80211_pending_connect_request(ieee80211_dev_t *ieee80211_dev);
|
---|
| 409 | extern ieee80211_auth_phase_t ieee80211_get_auth_phase(ieee80211_dev_t
|
---|
| 410 | *ieee80211_dev);
|
---|
| 411 | extern void ieee80211_set_auth_phase(ieee80211_dev_t *ieee80211_dev,
|
---|
| 412 | ieee80211_auth_phase_t auth_phase);
|
---|
[1dcc0b9] | 413 | extern int ieee80211_probe_request(ieee80211_dev_t *ieee80211_dev,
|
---|
| 414 | char *ssid);
|
---|
| 415 | extern int ieee80211_authenticate(ieee80211_dev_t *ieee80211_dev);
|
---|
| 416 | extern int ieee80211_associate(ieee80211_dev_t *ieee80211_dev,
|
---|
| 417 | char *password);
|
---|
| 418 | extern int ieee80211_deauthenticate(ieee80211_dev_t *ieee80211_dev);
|
---|
[59fa7ab] | 419 |
|
---|
| 420 | #endif /* LIBN_IEEE80211_H */
|
---|
| 421 |
|
---|
| 422 | /** @}
|
---|
| 423 | */
|
---|