1 /* 2 * Copyright 2023, Cypress Semiconductor Corporation (an Infineon company) 3 * SPDX-License-Identifier: Apache-2.0 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /** @file whd_types.h 19 * Defines common data types used with WHD 20 * 21 */ 22 23 #ifndef INCLUDED_WHD_TYPES_H_ 24 #define INCLUDED_WHD_TYPES_H_ 25 26 #include <stdint.h> 27 #include "cybsp.h" 28 #include "cy_result.h" 29 30 #ifndef WHD_USE_CUSTOM_HAL_IMPL 31 #include "cyhal_hw_types.h" 32 #include "cyhal_gpio.h" 33 #if (CYBSP_WIFI_INTERFACE_TYPE == CYBSP_SDIO_INTERFACE) 34 #include "cyhal_sdio.h" 35 #elif (CYBSP_WIFI_INTERFACE_TYPE == CYBSP_SPI_INTERFACE) 36 #include "cyhal_spi.h" 37 #elif (CYBSP_WIFI_INTERFACE_TYPE == CYBSP_M2M_INTERFACE) 38 #include "cyhal_m2m.h" 39 #endif 40 #endif /* ifndef WHD_USE_CUSTOM_HAL_IMPL */ 41 42 #ifdef __cplusplus 43 extern "C" 44 { 45 #endif 46 47 /****************************************************** 48 * Macros 49 ******************************************************/ 50 #define SSID_NAME_SIZE (32) /**< SSID Length */ 51 52 #define WEP_ENABLED 0x0001 /**< Flag to enable WEP Security */ 53 #define TKIP_ENABLED 0x0002 /**< Flag to enable TKIP Encryption */ 54 #define AES_ENABLED 0x0004 /**< Flag to enable AES Encryption */ 55 #define SHARED_ENABLED 0x00008000 /**< Flag to enable Shared key Security */ 56 #define WPA_SECURITY 0x00200000 /**< Flag to enable WPA Security */ 57 #define WPA2_SECURITY 0x00400000 /**< Flag to enable WPA2 Security */ 58 #define WPA2_SHA256_SECURITY 0x00800000 /**< Flag to enable WPA2 SHA256 Security */ 59 #define WPA3_SECURITY 0x01000000 /**< Flag to enable WPA3 PSK Security */ 60 #define SECURITY_MASK (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED) /**< Flag to Security mask */ 61 62 #define ENTERPRISE_ENABLED 0x02000000 /**< Flag to enable Enterprise Security */ 63 #define WPS_ENABLED 0x10000000 /**< Flag to enable WPS Security */ 64 #define IBSS_ENABLED 0x20000000 /**< Flag to enable IBSS mode */ 65 #define FBT_ENABLED 0x40000000 /**< Flag to enable FBT */ 66 67 #define PM1_POWERSAVE_MODE (1) /**< Powersave mode on specified interface without regard for throughput reduction */ 68 #define PM2_POWERSAVE_MODE (2) /**< Powersave mode on specified interface with High throughput */ 69 #define NO_POWERSAVE_MODE (0) /**< No Powersave mode */ 70 71 #define PMKID_LEN (16) /**< PMKID LENGTH */ 72 73 #define WHD_OOB_CONFIG_VERSION (2) /**< Indicate the version for whd_oob_config structure */ 74 75 /** 76 * Suppress unused parameter warning 77 */ 78 #ifndef UNUSED_PARAMETER 79 #define UNUSED_PARAMETER(x) ( (void)(x) ) 80 #endif 81 82 /** 83 * Suppress unused variable warning 84 */ 85 #ifndef UNUSED_VARIABLE 86 #define UNUSED_VARIABLE(x) ( (void)(x) ) 87 #endif 88 89 /** 90 * Suppress unused variable warning occurring due to an assert which is disabled in release mode 91 */ 92 #ifndef REFERENCE_DEBUG_ONLY_VARIABLE 93 #define REFERENCE_DEBUG_ONLY_VARIABLE(x) ( (void)(x) ) 94 #endif 95 96 /****************************************************** 97 *@cond Type Definitions 98 ******************************************************/ 99 typedef void *whd_buffer_t; 100 typedef struct wl_bss_info_struct whd_bss_info_t; 101 typedef struct edcf_acparam whd_edcf_ac_param_t; 102 typedef struct wl_af_params whd_af_params_t; 103 typedef struct whd_arp_stats_s whd_arp_stats_t; 104 typedef struct wl_pkt_filter_stats whd_pkt_filter_stats_t; 105 typedef struct whd_tko_retry whd_tko_retry_t; 106 typedef struct whd_tko_connect whd_tko_connect_t; 107 typedef struct whd_tko_status whd_tko_status_t; 108 109 #ifndef WHD_USE_CUSTOM_HAL_IMPL 110 #define WHD_NC_PIN_VALUE CYHAL_NC_PIN_VALUE 111 typedef cyhal_gpio_t whd_gpio_t; 112 typedef cyhal_gpio_drive_mode_t whd_gpio_drive_mode_t; 113 #if (CYBSP_WIFI_INTERFACE_TYPE == CYBSP_SDIO_INTERFACE) 114 typedef cyhal_sdio_t whd_sdio_t; 115 #elif (CYBSP_WIFI_INTERFACE_TYPE == CYBSP_SPI_INTERFACE) 116 typedef cyhal_spi_t whd_spi_t; 117 #elif (CYBSP_WIFI_INTERFACE_TYPE == CYBSP_M2M_INTERFACE) 118 typedef cyhal_m2m_t whd_m2m_t; 119 #endif 120 #else 121 #define WHD_NC_PIN_VALUE NULL 122 typedef void* whd_gpio_t; 123 typedef uint8_t whd_gpio_drive_mode_t; 124 typedef void* whd_sdio_t; 125 typedef void* whd_spi_t; 126 typedef void* whd_m2m_t; 127 #endif /* ifndef WHD_USE_CUSTOM_HAL_IMPL */ 128 129 130 /** @endcond */ 131 /****************************************************** 132 * Constants 133 ******************************************************/ 134 135 #define WIFI_IE_OUI_LENGTH (3) /**< OUI length for Information Element */ 136 #define VNDR_IE_MAX_LEN 255 /**< vendor IE max length, without ID and len */ 137 138 /* Below constants are used to allocate the buffer pool by the application */ 139 140 #define BDC_HEADER_WITH_PAD 6 /**< BDC Header with padding 4 + 2 */ 141 142 /** From bdc header, Ethernet data starts after an offset of (bdc_header->data_offset<<2). 143 * It is variable, but usually 4. 144 */ 145 #define BDC_HEADER_OFFSET_TO_DATA 4 146 147 #define SDPCM_HEADER (8 + 4) /**< SDPCM SW header + Frame tag */ 148 149 #if (CYBSP_WIFI_INTERFACE_TYPE == CYBSP_SDIO_INTERFACE) 150 #define MAX_BUS_HEADER_SIZE 4 /**< Max bus header size for all bus types (sdio) */ 151 #elif (CYBSP_WIFI_INTERFACE_TYPE == CYBSP_SPI_INTERFACE) 152 #define MAX_BUS_HEADER_SIZE 4 /**< Max bus header size for all bus types (spi) */ 153 #elif (CYBSP_WIFI_INTERFACE_TYPE == CYBSP_M2M_INTERFACE) 154 #define MAX_BUS_HEADER_SIZE 8 /**< Max bus header size for all bus types (m2m) */ 155 #else 156 #error "CYBSP_WIFI_INTERFACE_TYPE is not defined" 157 #endif 158 159 #define BUFFER_OVERHEAD 4 /**< Buffer overhead, sizeof(void *) */ 160 161 /** 162 * The maximum space in bytes required for headers in front of the Ethernet header. 163 * 6 + (8 + 4) + 4 + 4 + 4 = 30 bytes 164 */ 165 #define WHD_LINK_HEADER (BDC_HEADER_WITH_PAD + BDC_HEADER_OFFSET_TO_DATA + \ 166 SDPCM_HEADER + MAX_BUS_HEADER_SIZE + BUFFER_OVERHEAD) 167 168 /** 169 * The size of an Ethernet header 170 */ 171 #define WHD_ETHERNET_SIZE (14) 172 173 /** 174 * The size in bytes of the Link layer header i.e. the whd specific headers and the Ethernet header 175 */ 176 #define WHD_PHYSICAL_HEADER (WHD_LINK_HEADER + WHD_ETHERNET_SIZE) 177 178 /** 179 * The maximum size in bytes of the data part of an Ethernet frame 180 */ 181 #ifndef WHD_PAYLOAD_MTU 182 #define WHD_PAYLOAD_MTU (1500) 183 #endif 184 185 /** 186 * The maximum size in bytes of a packet used within whd. 187 * Pool should be atleast of this size. 188 * Usually buffer pools needs implementation specific headers like pbuf header etc, that should be 189 * taken into account along with this during buffer pool creation. Also buffer pools needs alignment with 190 * cache size of the platform for better performance 191 */ 192 #define WHD_LINK_MTU (WHD_PAYLOAD_MTU + WHD_PHYSICAL_HEADER) 193 194 /** @cond */ 195 #ifdef __x86_64__ 196 typedef uint64_t whd_thread_arg_t; 197 #else 198 typedef uint32_t whd_thread_arg_t; 199 #endif 200 /** @endcond */ 201 /****************************************************** 202 * Structures and Enumerations 203 ******************************************************/ 204 /** 205 * Enumeration of Dot11 Reason Codes 206 */ 207 typedef enum 208 { 209 WHD_DOT11_RC_RESERVED = 0, /**< Reserved */ 210 WHD_DOT11_RC_UNSPECIFIED = 1 /**< Unspecified */ 211 } whd_dot11_reason_code_t; 212 213 /** 214 * Boolean values 215 */ 216 typedef enum 217 { 218 WHD_FALSE = 0, /**< Boolean True */ 219 WHD_TRUE = 1 /**< Boolean False */ 220 } whd_bool_t; 221 222 223 /** 224 * Transfer direction for the WHD platform bus interface 225 */ 226 typedef enum 227 { 228 /* If updating this enum, the bus_direction_mapping variable will also need to be updated */ 229 BUS_READ, /**< Specifies bus type and read direction */ 230 BUS_WRITE /**< Specifies bus type and write direction */ 231 } whd_bus_transfer_direction_t; 232 233 /** 234 * Enumeration of Wi-Fi security modes 235 */ 236 typedef enum 237 { 238 WHD_SECURITY_OPEN = 0, /**< Open security */ 239 WHD_SECURITY_WEP_PSK = WEP_ENABLED, /**< WEP PSK Security with open authentication */ 240 WHD_SECURITY_WEP_SHARED = (WEP_ENABLED | SHARED_ENABLED), /**< WEP PSK Security with shared authentication */ 241 WHD_SECURITY_WPA_TKIP_PSK = (WPA_SECURITY | TKIP_ENABLED), /**< WPA PSK Security with TKIP */ 242 WHD_SECURITY_WPA_AES_PSK = (WPA_SECURITY | AES_ENABLED), /**< WPA PSK Security with AES */ 243 WHD_SECURITY_WPA_MIXED_PSK = (WPA_SECURITY | AES_ENABLED | TKIP_ENABLED), /**< WPA PSK Security with AES & TKIP */ 244 WHD_SECURITY_WPA2_AES_PSK = (WPA2_SECURITY | AES_ENABLED), /**< WPA2 PSK Security with AES */ 245 WHD_SECURITY_WPA2_AES_PSK_SHA256 = (WPA2_SECURITY | WPA2_SHA256_SECURITY | AES_ENABLED), /**< WPA2 PSK SHA256 Security with AES */ 246 WHD_SECURITY_WPA2_TKIP_PSK = (WPA2_SECURITY | TKIP_ENABLED), /**< WPA2 PSK Security with TKIP */ 247 WHD_SECURITY_WPA2_MIXED_PSK = (WPA2_SECURITY | AES_ENABLED | TKIP_ENABLED), /**< WPA2 PSK Security with AES & TKIP */ 248 WHD_SECURITY_WPA2_FBT_PSK = (WPA2_SECURITY | AES_ENABLED | FBT_ENABLED), /**< WPA2 FBT PSK Security with AES & TKIP */ 249 WHD_SECURITY_WPA3_SAE = (WPA3_SECURITY | AES_ENABLED), /**< WPA3 Security with AES */ 250 WHD_SECURITY_WPA2_WPA_AES_PSK = (WPA2_SECURITY | WPA_SECURITY | AES_ENABLED), /**< WPA2 WPA PSK Security with AES */ 251 WHD_SECURITY_WPA2_WPA_MIXED_PSK = (WPA2_SECURITY | WPA_SECURITY | AES_ENABLED | TKIP_ENABLED), /**< WPA2 WPA PSK Security with AES & TKIP */ 252 253 WHD_SECURITY_WPA3_WPA2_PSK = (WPA3_SECURITY | WPA2_SECURITY | AES_ENABLED), /**< WPA3 WPA2 PSK Security with AES */ 254 255 WHD_SECURITY_WPA_TKIP_ENT = (ENTERPRISE_ENABLED | WPA_SECURITY | TKIP_ENABLED), /**< WPA Enterprise Security with TKIP */ 256 WHD_SECURITY_WPA_AES_ENT = (ENTERPRISE_ENABLED | WPA_SECURITY | AES_ENABLED), /**< WPA Enterprise Security with AES */ 257 WHD_SECURITY_WPA_MIXED_ENT = (ENTERPRISE_ENABLED | WPA_SECURITY | AES_ENABLED | TKIP_ENABLED), /**< WPA Enterprise Security with AES & TKIP */ 258 WHD_SECURITY_WPA2_TKIP_ENT = (ENTERPRISE_ENABLED | WPA2_SECURITY | TKIP_ENABLED), /**< WPA2 Enterprise Security with TKIP */ 259 WHD_SECURITY_WPA2_AES_ENT = (ENTERPRISE_ENABLED | WPA2_SECURITY | AES_ENABLED), /**< WPA2 Enterprise Security with AES */ 260 WHD_SECURITY_WPA2_MIXED_ENT = (ENTERPRISE_ENABLED | WPA2_SECURITY | AES_ENABLED | TKIP_ENABLED), /**< WPA2 Enterprise Security with AES & TKIP */ 261 WHD_SECURITY_WPA2_FBT_ENT = (ENTERPRISE_ENABLED | WPA2_SECURITY | AES_ENABLED | FBT_ENABLED), /**< WPA2 Enterprise Security with AES & FBT */ 262 263 WHD_SECURITY_IBSS_OPEN = (IBSS_ENABLED), /**< Open security on IBSS ad-hoc network */ 264 WHD_SECURITY_WPS_SECURE = AES_ENABLED, /**< WPS with AES security */ 265 266 WHD_SECURITY_UNKNOWN = -1, /**< May be returned by scan function if security is unknown. Do not pass this to the join function! */ 267 268 WHD_SECURITY_FORCE_32_BIT = 0x7fffffff /**< Exists only to force whd_security_t type to 32 bits */ 269 } whd_security_t; 270 271 /** 272 * Enumeration of methods of scanning 273 */ 274 typedef enum 275 { 276 WHD_SCAN_TYPE_ACTIVE = 0x00, /**< Actively scan a network by sending 802.11 probe(s) */ 277 WHD_SCAN_TYPE_PASSIVE = 0x01, /**< Passively scan a network by listening for beacons from APs */ 278 WHD_SCAN_TYPE_PNO = 0x02, /**< Use preferred network offload to detect an AP */ 279 WHD_SCAN_TYPE_PROHIBITED_CHANNELS = 0x04, /**< Permit (passively) scanning a channel that isn't valid for the current country */ 280 WHD_SCAN_TYPE_NO_BSSID_FILTER = 0x08 /**< Return a scan record for each beacon or probe response RX'ed */ 281 } whd_scan_type_t; 282 283 /** 284 * Enumeration of network types 285 */ 286 typedef enum 287 { 288 WHD_BSS_TYPE_INFRASTRUCTURE = 0, /**< Denotes infrastructure network */ 289 WHD_BSS_TYPE_ADHOC = 1, /**< Denotes an 802.11 ad-hoc IBSS network */ 290 WHD_BSS_TYPE_ANY = 2, /**< Denotes either infrastructure or ad-hoc network */ 291 WHD_BSS_TYPE_MESH = 3, /**< Denotes 802.11 mesh network */ 292 293 WHD_BSS_TYPE_UNKNOWN = -1 /**< May be returned by scan function if BSS type is unknown. Do not pass this to the Join function */ 294 } whd_bss_type_t; 295 296 /** 297 * Enumeration of 802.11 radio bands 298 */ 299 typedef enum 300 { 301 WHD_802_11_BAND_5GHZ = 0, /**< Denotes 5GHz radio band */ 302 WHD_802_11_BAND_2_4GHZ = 1 /**< Denotes 2.4GHz radio band */ 303 } whd_802_11_band_t; 304 305 /** 306 * Enumeration of custom IE(Information Element) management actions 307 */ 308 typedef enum 309 { 310 WHD_ADD_CUSTOM_IE, /**< Add a custom IE(Information Element) */ 311 WHD_REMOVE_CUSTOM_IE /**< Remove a custom IE(Information Element) */ 312 } whd_custom_ie_action_t; 313 314 315 /** 316 * Enumeration of listen interval time unit types 317 */ 318 typedef enum 319 { 320 WHD_LISTEN_INTERVAL_TIME_UNIT_BEACON, /**< Time units specified in beacon periods */ 321 WHD_LISTEN_INTERVAL_TIME_UNIT_DTIM /**< Time units specified in DTIM periods */ 322 } whd_listen_interval_time_unit_t; 323 324 /** 325 * Structure for storing scan status 326 */ 327 typedef enum 328 { 329 WHD_SCAN_INCOMPLETE, /**< Denotes that scan is not finished */ 330 WHD_SCAN_COMPLETED_SUCCESSFULLY, /**< Successful completion of scan */ 331 WHD_SCAN_ABORTED, /**< Scan is aborted */ 332 } whd_scan_status_t; 333 334 /** 335 * Structure for storing status of auth event 336 */ 337 typedef enum 338 { 339 WHD_AUTH_EXT_REQ, /**< Request authentication received */ 340 WHD_AUTH_EXT_FRAME_RX, /**< Authentication frame received */ 341 } whd_auth_status_t; 342 343 /** 344 * Structure for storing radio band list information 345 */ 346 typedef struct 347 { 348 int32_t number_of_bands; /**< Number of bands supported, currently 1 or 2 */ 349 int32_t current_band; /**< Current band type: WLC_BAND_2G or WLC_BAND_5G */ 350 int32_t other_band; /**< If value of number_of_bands parameter is 2, then this member specifies the 2nd band */ 351 } whd_band_list_t; 352 353 /** 354 * Enumeration of scan result flags 355 */ 356 typedef enum 357 { 358 WHD_SCAN_RESULT_FLAG_RSSI_OFF_CHANNEL = 0x01, /**< RSSI came from an off channel DSSS (1 or 1 Mb) Rx */ 359 WHD_SCAN_RESULT_FLAG_BEACON = 0x02, /**< Beacon (vs probe response) */ 360 WHD_SCAN_RESULT_FLAG_SAE_H2E = 0x04, /**< BSS is H2E(Hash-to-Element) */ 361 } whd_scan_result_flag_t; 362 363 /** 364 * Protected Management Frame Capability 365 */ 366 enum 367 { 368 WL_MFP_NONE = 0, /**< Disables the client support for MFP. */ 369 WL_MFP_CAPABLE, /**< Allows both MFP-capable and clients that do not support MFP to join the network. */ 370 WL_MFP_REQUIRED /**< Clients are allowed to associate only if MFP is negotiated. */ 371 }; 372 373 374 /** 375 * Enumeration of ioctl get 376 */ 377 typedef enum 378 { 379 WHD_IOCTL_GET_RATE = 12, 380 WHD_IOCTL_GET_COUNTRY = 83, 381 WHD_IOCTL_GET_CLK = 160, 382 WHD_IOCTL_GET_WSEC = 133, 383 WHD_IOCTL_GET_AUTH = 21, 384 WHD_IOCTL_GET_WPA_AUTH = 164, 385 WHD_IOCTL_GET_PM = 85, 386 WHD_IOCTL_GET_BSSID = 23, 387 WHD_IOCTL_GET_ASSOCLIST = 159, 388 WHD_IOCTL_GET_BSS_INFO = 136, 389 WHD_IOCTL_GET_CHANNEL = 29 390 391 } whd_usr_ioctl_get_list_t; 392 393 /** 394 * Enumeration of ioctl set 395 */ 396 typedef enum 397 { 398 WHD_IOCTL_SET_CHANNEL = 30, 399 WHD_IOCTL_SET_WSEC_PMK = 268, 400 WHD_IOCTL_SET_KEY = 45, 401 WHD_IOCTL_SET_WPA_AUTH = 165, 402 WHD_IOCTL_SCB_DEAUTHENTICATE_FOR_REASON = 201, 403 WHD_IOCTL_SET_PM = 86, 404 WHD_IOCTL_SET_SSID = 26, 405 WHD_IOCTL_SET_BCNPRD = 76, 406 WHD_IOCTL_SET_DTIMPRD = 78, 407 WHD_IOCTL_SET_WSEC = 134, 408 WHD_IOCTL_SET_INFRA = 20, 409 WHD_IOCTL_SET_AUTH = 22 410 411 } whd_usr_ioctl_set_list_t; 412 413 /** 414 * IOVAR set list 415 */ 416 typedef enum 417 { 418 WHD_IOVAR_SET_MFP = 0, 419 WHD_IOVAR_SET_MPC, 420 WHD_IOVAR_SET_AMPDU_BA_WINDOW_SIZE, 421 WHD_IOVAR_SET_AMPDU_MPDU, 422 WHD_IOVAR_SET_LISTEN_INTERVAL_BEACON, 423 WHD_IOVAR_SET_LISTEN_INTERVAL_DTIM, 424 WHD_IOVAR_SET_LISTEN_INTERVAL_ASSOC, 425 } whd_usr_iovar_set_list_t; 426 427 /** 428 * IOVAR get list 429 */ 430 typedef enum 431 { 432 WHD_IOVAR_GET_MFP = 0, 433 WHD_IOVAR_GET_MPC, 434 WHD_IOVAR_GET_AMPDU_BA_WINDOW_SIZE, 435 WHD_IOVAR_GET_AMPDU_MPDU, 436 WHD_IOVAR_GET_LISTEN_INTERVAL, /**< Get Listen Interval value */ 437 WHD_IOVAR_GET_MAC_ADDRESS, /**< Get mac address */ 438 } whd_usr_iovar_get_list_t; 439 440 /** 441 * Enumeration of bus type 442 */ 443 typedef enum 444 { 445 WHD_BUS_SDIO = 0, 446 WHD_BUS_SPI, 447 WHD_BUS_M2M, 448 WHD_BUS_NO_DEFINE = 0xff, 449 } whd_bus_type_t; 450 451 /** 452 * Expand fw capabilities list to enumeration 453 */ 454 typedef enum 455 { 456 WHD_FWCAP_SAE = 0, /**< Internal SAE */ 457 WHD_FWCAP_SAE_EXT = 1, /**< External SAE */ 458 } whd_fwcap_id_t; 459 460 /****************************************************** 461 * Type Definitions 462 ******************************************************/ 463 /** @cond */ 464 typedef struct whd_event_msg whd_event_header_t; 465 /** @endcond */ 466 467 /** 468 * Structure for storing a MAC address (Wi-Fi Media Access Control address). 469 */ 470 typedef struct 471 { 472 uint8_t octet[6]; /**< Unique 6-byte MAC address */ 473 } whd_mac_t; 474 475 /** 476 * Structure for storing the supported channels. 477 */ 478 typedef struct 479 { 480 uint32_t count; 481 uint32_t element[1]; 482 } whd_list_t; 483 484 /** 485 * Structure for storing a Service Set Identifier (i.e. Name of Access Point) 486 */ 487 typedef struct 488 { 489 uint8_t length; /**< SSID length */ 490 uint8_t value[SSID_NAME_SIZE]; /**< SSID name (AP name) */ 491 } whd_ssid_t; 492 493 /**< 494 The received packet formats are different when EXT_STA is enabled. In case 495 of EXT_STA the received packets are in 802.11 format, where as in other 496 case the received packets have Ethernet II format 497 498 1. 802.11 frames 499 ---------------------------------------------------------------------------- 500 | FC (2) | DID (2) |A1 (6) |A2 (6)|A3 (6) |SID (2) |SNAP (6) |type (2) |data (46 - 1500) | 501 ---------------------------------------------------------------------------- 502 503 2. Ethernet II frames 504 ------------------------------------------------- 505 | DA (6) | SA (6) | type (2) | data (46 - 1500) | 506 ------------------------------------------------- 507 */ 508 509 510 /** 511 * Macro for creating country codes according to endianness 512 * @cond !ADDTHIS 513 */ 514 #ifdef IL_BIGENDIAN 515 #define MK_CNTRY(a, b, \ 516 rev) ( ( (unsigned char)(b) ) + ( ( (unsigned char)(a) ) << 8 ) + \ 517 ( ( (unsigned short)(rev) ) << 16 ) ) 518 #else /* ifdef IL_BIGENDIAN */ 519 #define MK_CNTRY(a, b, \ 520 rev) ( ( (unsigned char)(a) ) + ( ( (unsigned char)(b) ) << 8 ) + \ 521 ( ( (unsigned short)(rev) ) << 16 ) ) 522 #endif /* ifdef IL_BIGENDIAN */ 523 /** @endcond */ 524 525 /** 526 * Enumerated list of country codes 527 */ 528 typedef enum 529 { 530 WHD_COUNTRY_AFGHANISTAN = MK_CNTRY('A', 'F', 0), /**< AF Afghanistan */ 531 WHD_COUNTRY_ALBANIA = MK_CNTRY('A', 'L', 0), /**< AL Albania */ 532 WHD_COUNTRY_ALGERIA = MK_CNTRY('D', 'Z', 0), /**< DZ Algeria */ 533 WHD_COUNTRY_AMERICAN_SAMOA = MK_CNTRY('A', 'S', 0), /**< AS American_Samoa */ 534 WHD_COUNTRY_ANGOLA = MK_CNTRY('A', 'O', 0), /**< AO Angola */ 535 WHD_COUNTRY_ANGUILLA = MK_CNTRY('A', 'I', 0), /**< AI Anguilla */ 536 WHD_COUNTRY_ANTIGUA_AND_BARBUDA = MK_CNTRY('A', 'G', 0), /**< AG Antigua_and_Barbuda */ 537 WHD_COUNTRY_ARGENTINA = MK_CNTRY('A', 'R', 0), /**< AR Argentina */ 538 WHD_COUNTRY_ARMENIA = MK_CNTRY('A', 'M', 0), /**< AM Armenia */ 539 WHD_COUNTRY_ARUBA = MK_CNTRY('A', 'W', 0), /**< AW Aruba */ 540 WHD_COUNTRY_AUSTRALIA = MK_CNTRY('A', 'U', 0), /**< AU Australia */ 541 WHD_COUNTRY_AUSTRIA = MK_CNTRY('A', 'T', 0), /**< AT Austria */ 542 WHD_COUNTRY_AZERBAIJAN = MK_CNTRY('A', 'Z', 0), /**< AZ Azerbaijan */ 543 WHD_COUNTRY_BAHAMAS = MK_CNTRY('B', 'S', 0), /**< BS Bahamas */ 544 WHD_COUNTRY_BAHRAIN = MK_CNTRY('B', 'H', 0), /**< BH Bahrain */ 545 WHD_COUNTRY_BAKER_ISLAND = MK_CNTRY('0', 'B', 0), /**< 0B Baker_Island */ 546 WHD_COUNTRY_BANGLADESH = MK_CNTRY('B', 'D', 0), /**< BD Bangladesh */ 547 WHD_COUNTRY_BARBADOS = MK_CNTRY('B', 'B', 0), /**< BB Barbados */ 548 WHD_COUNTRY_BELARUS = MK_CNTRY('B', 'Y', 0), /**< BY Belarus */ 549 WHD_COUNTRY_BELGIUM = MK_CNTRY('B', 'E', 0), /**< BE Belgium */ 550 WHD_COUNTRY_BELIZE = MK_CNTRY('B', 'Z', 0), /**< BZ Belize */ 551 WHD_COUNTRY_BENIN = MK_CNTRY('B', 'J', 0), /**< BJ Benin */ 552 WHD_COUNTRY_BERMUDA = MK_CNTRY('B', 'M', 0), /**< BM Bermuda */ 553 WHD_COUNTRY_BHUTAN = MK_CNTRY('B', 'T', 0), /**< BT Bhutan */ 554 WHD_COUNTRY_BOLIVIA = MK_CNTRY('B', 'O', 0), /**< BO Bolivia */ 555 WHD_COUNTRY_BOSNIA_AND_HERZEGOVINA = MK_CNTRY('B', 'A', 0), /**< BA Bosnia_and_Herzegovina */ 556 WHD_COUNTRY_BOTSWANA = MK_CNTRY('B', 'W', 0), /**< BW Botswana */ 557 WHD_COUNTRY_BRAZIL = MK_CNTRY('B', 'R', 0), /**< BR Brazil */ 558 WHD_COUNTRY_BRITISH_INDIAN_OCEAN_TERRITORY = MK_CNTRY('I', 'O', 0), /**< IO British_Indian_Ocean_Territory */ 559 WHD_COUNTRY_BRUNEI_DARUSSALAM = MK_CNTRY('B', 'N', 0), /**< BN Brunei_Darussalam */ 560 WHD_COUNTRY_BULGARIA = MK_CNTRY('B', 'G', 0), /**< BG Bulgaria */ 561 WHD_COUNTRY_BURKINA_FASO = MK_CNTRY('B', 'F', 0), /**< BF Burkina_Faso */ 562 WHD_COUNTRY_BURUNDI = MK_CNTRY('B', 'I', 0), /**< BI Burundi */ 563 WHD_COUNTRY_CAMBODIA = MK_CNTRY('K', 'H', 0), /**< KH Cambodia */ 564 WHD_COUNTRY_CAMEROON = MK_CNTRY('C', 'M', 0), /**< CM Cameroon */ 565 WHD_COUNTRY_CANADA = MK_CNTRY('C', 'A', 0), /**< CA Canada */ 566 WHD_COUNTRY_CANADA_REV950 = MK_CNTRY('C', 'A', 950), /**< CA Canada Revision 950 */ 567 WHD_COUNTRY_CAPE_VERDE = MK_CNTRY('C', 'V', 0), /**< CV Cape_Verde */ 568 WHD_COUNTRY_CAYMAN_ISLANDS = MK_CNTRY('K', 'Y', 0), /**< KY Cayman_Islands */ 569 WHD_COUNTRY_CENTRAL_AFRICAN_REPUBLIC = MK_CNTRY('C', 'F', 0), /**< CF Central_African_Republic */ 570 WHD_COUNTRY_CHAD = MK_CNTRY('T', 'D', 0), /**< TD Chad */ 571 WHD_COUNTRY_CHILE = MK_CNTRY('C', 'L', 0), /**< CL Chile */ 572 WHD_COUNTRY_CHINA = MK_CNTRY('C', 'N', 0), /**< CN China */ 573 WHD_COUNTRY_CHRISTMAS_ISLAND = MK_CNTRY('C', 'X', 0), /**< CX Christmas_Island */ 574 WHD_COUNTRY_COLOMBIA = MK_CNTRY('C', 'O', 0), /**< CO Colombia */ 575 WHD_COUNTRY_COMOROS = MK_CNTRY('K', 'M', 0), /**< KM Comoros */ 576 WHD_COUNTRY_CONGO = MK_CNTRY('C', 'G', 0), /**< CG Congo */ 577 WHD_COUNTRY_CONGO_THE_DEMOCRATIC_REPUBLIC_OF_THE = MK_CNTRY('C', 'D', 0), /**< CD Congo,_The_Democratic_Republic_Of_The */ 578 WHD_COUNTRY_COSTA_RICA = MK_CNTRY('C', 'R', 0), /**< CR Costa_Rica */ 579 WHD_COUNTRY_COTE_DIVOIRE = MK_CNTRY('C', 'I', 0), /**< CI Cote_D'ivoire */ 580 WHD_COUNTRY_CROATIA = MK_CNTRY('H', 'R', 0), /**< HR Croatia */ 581 WHD_COUNTRY_CUBA = MK_CNTRY('C', 'U', 0), /**< CU Cuba */ 582 WHD_COUNTRY_CYPRUS = MK_CNTRY('C', 'Y', 0), /**< CY Cyprus */ 583 WHD_COUNTRY_CZECH_REPUBLIC = MK_CNTRY('C', 'Z', 0), /**< CZ Czech_Republic */ 584 WHD_COUNTRY_DENMARK = MK_CNTRY('D', 'K', 0), /**< DK Denmark */ 585 WHD_COUNTRY_DJIBOUTI = MK_CNTRY('D', 'J', 0), /**< DJ Djibouti */ 586 WHD_COUNTRY_DOMINICA = MK_CNTRY('D', 'M', 0), /**< DM Dominica */ 587 WHD_COUNTRY_DOMINICAN_REPUBLIC = MK_CNTRY('D', 'O', 0), /**< DO Dominican_Republic */ 588 WHD_COUNTRY_DOWN_UNDER = MK_CNTRY('A', 'U', 0), /**< AU G'Day mate! */ 589 WHD_COUNTRY_ECUADOR = MK_CNTRY('E', 'C', 0), /**< EC Ecuador */ 590 WHD_COUNTRY_EGYPT = MK_CNTRY('E', 'G', 0), /**< EG Egypt */ 591 WHD_COUNTRY_EL_SALVADOR = MK_CNTRY('S', 'V', 0), /**< SV El_Salvador */ 592 WHD_COUNTRY_EQUATORIAL_GUINEA = MK_CNTRY('G', 'Q', 0), /**< GQ Equatorial_Guinea */ 593 WHD_COUNTRY_ERITREA = MK_CNTRY('E', 'R', 0), /**< ER Eritrea */ 594 WHD_COUNTRY_ESTONIA = MK_CNTRY('E', 'E', 0), /**< EE Estonia */ 595 WHD_COUNTRY_ETHIOPIA = MK_CNTRY('E', 'T', 0), /**< ET Ethiopia */ 596 WHD_COUNTRY_FALKLAND_ISLANDS_MALVINAS = MK_CNTRY('F', 'K', 0), /**< FK Falkland_Islands_(Malvinas) */ 597 WHD_COUNTRY_FAROE_ISLANDS = MK_CNTRY('F', 'O', 0), /**< FO Faroe_Islands */ 598 WHD_COUNTRY_FIJI = MK_CNTRY('F', 'J', 0), /**< FJ Fiji */ 599 WHD_COUNTRY_FINLAND = MK_CNTRY('F', 'I', 0), /**< FI Finland */ 600 WHD_COUNTRY_FRANCE = MK_CNTRY('F', 'R', 0), /**< FR France */ 601 WHD_COUNTRY_FRENCH_GUINA = MK_CNTRY('G', 'F', 0), /**< GF French_Guina */ 602 WHD_COUNTRY_FRENCH_POLYNESIA = MK_CNTRY('P', 'F', 0), /**< PF French_Polynesia */ 603 WHD_COUNTRY_FRENCH_SOUTHERN_TERRITORIES = MK_CNTRY('T', 'F', 0), /**< TF French_Southern_Territories */ 604 WHD_COUNTRY_GABON = MK_CNTRY('G', 'A', 0), /**< GA Gabon */ 605 WHD_COUNTRY_GAMBIA = MK_CNTRY('G', 'M', 0), /**< GM Gambia */ 606 WHD_COUNTRY_GEORGIA = MK_CNTRY('G', 'E', 0), /**< GE Georgia */ 607 WHD_COUNTRY_GERMANY = MK_CNTRY('D', 'E', 0), /**< DE Germany */ 608 WHD_COUNTRY_EUROPEAN_WIDE_REV895 = MK_CNTRY('E', '0', 895), /**< E0 European_Wide Revision 895 */ 609 WHD_COUNTRY_GHANA = MK_CNTRY('G', 'H', 0), /**< GH Ghana */ 610 WHD_COUNTRY_GIBRALTAR = MK_CNTRY('G', 'I', 0), /**< GI Gibraltar */ 611 WHD_COUNTRY_GREECE = MK_CNTRY('G', 'R', 0), /**< GR Greece */ 612 WHD_COUNTRY_GRENADA = MK_CNTRY('G', 'D', 0), /**< GD Grenada */ 613 WHD_COUNTRY_GUADELOUPE = MK_CNTRY('G', 'P', 0), /**< GP Guadeloupe */ 614 WHD_COUNTRY_GUAM = MK_CNTRY('G', 'U', 0), /**< GU Guam */ 615 WHD_COUNTRY_GUATEMALA = MK_CNTRY('G', 'T', 0), /**< GT Guatemala */ 616 WHD_COUNTRY_GUERNSEY = MK_CNTRY('G', 'G', 0), /**< GG Guernsey */ 617 WHD_COUNTRY_GUINEA = MK_CNTRY('G', 'N', 0), /**< GN Guinea */ 618 WHD_COUNTRY_GUINEA_BISSAU = MK_CNTRY('G', 'W', 0), /**< GW Guinea-bissau */ 619 WHD_COUNTRY_GUYANA = MK_CNTRY('G', 'Y', 0), /**< GY Guyana */ 620 WHD_COUNTRY_HAITI = MK_CNTRY('H', 'T', 0), /**< HT Haiti */ 621 WHD_COUNTRY_HOLY_SEE_VATICAN_CITY_STATE = MK_CNTRY('V', 'A', 0), /**< VA Holy_See_(Vatican_City_State) */ 622 WHD_COUNTRY_HONDURAS = MK_CNTRY('H', 'N', 0), /**< HN Honduras */ 623 WHD_COUNTRY_HONG_KONG = MK_CNTRY('H', 'K', 0), /**< HK Hong_Kong */ 624 WHD_COUNTRY_HUNGARY = MK_CNTRY('H', 'U', 0), /**< HU Hungary */ 625 WHD_COUNTRY_ICELAND = MK_CNTRY('I', 'S', 0), /**< IS Iceland */ 626 WHD_COUNTRY_INDIA = MK_CNTRY('I', 'N', 0), /**< IN India */ 627 WHD_COUNTRY_INDONESIA = MK_CNTRY('I', 'D', 0), /**< ID Indonesia */ 628 WHD_COUNTRY_IRAN_ISLAMIC_REPUBLIC_OF = MK_CNTRY('I', 'R', 0), /**< IR Iran,_Islamic_Republic_Of */ 629 WHD_COUNTRY_IRAQ = MK_CNTRY('I', 'Q', 0), /**< IQ Iraq */ 630 WHD_COUNTRY_IRELAND = MK_CNTRY('I', 'E', 0), /**< IE Ireland */ 631 WHD_COUNTRY_ISRAEL = MK_CNTRY('I', 'L', 0), /**< IL Israel */ 632 WHD_COUNTRY_ITALY = MK_CNTRY('I', 'T', 0), /**< IT Italy */ 633 WHD_COUNTRY_JAMAICA = MK_CNTRY('J', 'M', 0), /**< JM Jamaica */ 634 WHD_COUNTRY_JAPAN = MK_CNTRY('J', 'P', 0), /**< JP Japan */ 635 WHD_COUNTRY_JERSEY = MK_CNTRY('J', 'E', 0), /**< JE Jersey */ 636 WHD_COUNTRY_JORDAN = MK_CNTRY('J', 'O', 0), /**< JO Jordan */ 637 WHD_COUNTRY_KAZAKHSTAN = MK_CNTRY('K', 'Z', 0), /**< KZ Kazakhstan */ 638 WHD_COUNTRY_KENYA = MK_CNTRY('K', 'E', 0), /**< KE Kenya */ 639 WHD_COUNTRY_KIRIBATI = MK_CNTRY('K', 'I', 0), /**< KI Kiribati */ 640 WHD_COUNTRY_KOREA_REPUBLIC_OF = MK_CNTRY('K', 'R', 1), /**< KR Korea,_Republic_Of */ 641 WHD_COUNTRY_KOSOVO = MK_CNTRY('0', 'A', 0), /**< 0A Kosovo */ 642 WHD_COUNTRY_KUWAIT = MK_CNTRY('K', 'W', 0), /**< KW Kuwait */ 643 WHD_COUNTRY_KYRGYZSTAN = MK_CNTRY('K', 'G', 0), /**< KG Kyrgyzstan */ 644 WHD_COUNTRY_LAO_PEOPLES_DEMOCRATIC_REPUBIC = MK_CNTRY('L', 'A', 0), /**< LA Lao_People's_Democratic_Repubic */ 645 WHD_COUNTRY_LATVIA = MK_CNTRY('L', 'V', 0), /**< LV Latvia */ 646 WHD_COUNTRY_LEBANON = MK_CNTRY('L', 'B', 0), /**< LB Lebanon */ 647 WHD_COUNTRY_LESOTHO = MK_CNTRY('L', 'S', 0), /**< LS Lesotho */ 648 WHD_COUNTRY_LIBERIA = MK_CNTRY('L', 'R', 0), /**< LR Liberia */ 649 WHD_COUNTRY_LIBYAN_ARAB_JAMAHIRIYA = MK_CNTRY('L', 'Y', 0), /**< LY Libyan_Arab_Jamahiriya */ 650 WHD_COUNTRY_LIECHTENSTEIN = MK_CNTRY('L', 'I', 0), /**< LI Liechtenstein */ 651 WHD_COUNTRY_LITHUANIA = MK_CNTRY('L', 'T', 0), /**< LT Lithuania */ 652 WHD_COUNTRY_LUXEMBOURG = MK_CNTRY('L', 'U', 0), /**< LU Luxembourg */ 653 WHD_COUNTRY_MACAO = MK_CNTRY('M', 'O', 0), /**< MO Macao */ 654 WHD_COUNTRY_MACEDONIA_FORMER_YUGOSLAV_REPUBLIC_OF = MK_CNTRY('M', 'K', 0), /**< MK Macedonia,_Former_Yugoslav_Republic_Of */ 655 WHD_COUNTRY_MADAGASCAR = MK_CNTRY('M', 'G', 0), /**< MG Madagascar */ 656 WHD_COUNTRY_MALAWI = MK_CNTRY('M', 'W', 0), /**< MW Malawi */ 657 WHD_COUNTRY_MALAYSIA = MK_CNTRY('M', 'Y', 0), /**< MY Malaysia */ 658 WHD_COUNTRY_MALDIVES = MK_CNTRY('M', 'V', 0), /**< MV Maldives */ 659 WHD_COUNTRY_MALI = MK_CNTRY('M', 'L', 0), /**< ML Mali */ 660 WHD_COUNTRY_MALTA = MK_CNTRY('M', 'T', 0), /**< MT Malta */ 661 WHD_COUNTRY_MAN_ISLE_OF = MK_CNTRY('I', 'M', 0), /**< IM Man,_Isle_Of */ 662 WHD_COUNTRY_MARTINIQUE = MK_CNTRY('M', 'Q', 0), /**< MQ Martinique */ 663 WHD_COUNTRY_MAURITANIA = MK_CNTRY('M', 'R', 0), /**< MR Mauritania */ 664 WHD_COUNTRY_MAURITIUS = MK_CNTRY('M', 'U', 0), /**< MU Mauritius */ 665 WHD_COUNTRY_MAYOTTE = MK_CNTRY('Y', 'T', 0), /**< YT Mayotte */ 666 WHD_COUNTRY_MEXICO = MK_CNTRY('M', 'X', 0), /**< MX Mexico */ 667 WHD_COUNTRY_MICRONESIA_FEDERATED_STATES_OF = MK_CNTRY('F', 'M', 0), /**< FM Micronesia,_Federated_States_Of */ 668 WHD_COUNTRY_MOLDOVA_REPUBLIC_OF = MK_CNTRY('M', 'D', 0), /**< MD Moldova,_Republic_Of */ 669 WHD_COUNTRY_MONACO = MK_CNTRY('M', 'C', 0), /**< MC Monaco */ 670 WHD_COUNTRY_MONGOLIA = MK_CNTRY('M', 'N', 0), /**< MN Mongolia */ 671 WHD_COUNTRY_MONTENEGRO = MK_CNTRY('M', 'E', 0), /**< ME Montenegro */ 672 WHD_COUNTRY_MONTSERRAT = MK_CNTRY('M', 'S', 0), /**< MS Montserrat */ 673 WHD_COUNTRY_MOROCCO = MK_CNTRY('M', 'A', 0), /**< MA Morocco */ 674 WHD_COUNTRY_MOZAMBIQUE = MK_CNTRY('M', 'Z', 0), /**< MZ Mozambique */ 675 WHD_COUNTRY_MYANMAR = MK_CNTRY('M', 'M', 0), /**< MM Myanmar */ 676 WHD_COUNTRY_NAMIBIA = MK_CNTRY('N', 'A', 0), /**< NA Namibia */ 677 WHD_COUNTRY_NAURU = MK_CNTRY('N', 'R', 0), /**< NR Nauru */ 678 WHD_COUNTRY_NEPAL = MK_CNTRY('N', 'P', 0), /**< NP Nepal */ 679 WHD_COUNTRY_NETHERLANDS = MK_CNTRY('N', 'L', 0), /**< NL Netherlands */ 680 WHD_COUNTRY_NETHERLANDS_ANTILLES = MK_CNTRY('A', 'N', 0), /**< AN Netherlands_Antilles */ 681 WHD_COUNTRY_NEW_CALEDONIA = MK_CNTRY('N', 'C', 0), /**< NC New_Caledonia */ 682 WHD_COUNTRY_NEW_ZEALAND = MK_CNTRY('N', 'Z', 0), /**< NZ New_Zealand */ 683 WHD_COUNTRY_NICARAGUA = MK_CNTRY('N', 'I', 0), /**< NI Nicaragua */ 684 WHD_COUNTRY_NIGER = MK_CNTRY('N', 'E', 0), /**< NE Niger */ 685 WHD_COUNTRY_NIGERIA = MK_CNTRY('N', 'G', 0), /**< NG Nigeria */ 686 WHD_COUNTRY_NORFOLK_ISLAND = MK_CNTRY('N', 'F', 0), /**< NF Norfolk_Island */ 687 WHD_COUNTRY_NORTHERN_MARIANA_ISLANDS = MK_CNTRY('M', 'P', 0), /**< MP Northern_Mariana_Islands */ 688 WHD_COUNTRY_NORWAY = MK_CNTRY('N', 'O', 0), /**< NO Norway */ 689 WHD_COUNTRY_OMAN = MK_CNTRY('O', 'M', 0), /**< OM Oman */ 690 WHD_COUNTRY_PAKISTAN = MK_CNTRY('P', 'K', 0), /**< PK Pakistan */ 691 WHD_COUNTRY_PALAU = MK_CNTRY('P', 'W', 0), /**< PW Palau */ 692 WHD_COUNTRY_PANAMA = MK_CNTRY('P', 'A', 0), /**< PA Panama */ 693 WHD_COUNTRY_PAPUA_NEW_GUINEA = MK_CNTRY('P', 'G', 0), /**< PG Papua_New_Guinea */ 694 WHD_COUNTRY_PARAGUAY = MK_CNTRY('P', 'Y', 0), /**< PY Paraguay */ 695 WHD_COUNTRY_PERU = MK_CNTRY('P', 'E', 0), /**< PE Peru */ 696 WHD_COUNTRY_PHILIPPINES = MK_CNTRY('P', 'H', 0), /**< PH Philippines */ 697 WHD_COUNTRY_POLAND = MK_CNTRY('P', 'L', 0), /**< PL Poland */ 698 WHD_COUNTRY_PORTUGAL = MK_CNTRY('P', 'T', 0), /**< PT Portugal */ 699 WHD_COUNTRY_PUETO_RICO = MK_CNTRY('P', 'R', 0), /**< PR Pueto_Rico */ 700 WHD_COUNTRY_QATAR = MK_CNTRY('Q', 'A', 0), /**< QA Qatar */ 701 WHD_COUNTRY_REUNION = MK_CNTRY('R', 'E', 0), /**< RE Reunion */ 702 WHD_COUNTRY_ROMANIA = MK_CNTRY('R', 'O', 0), /**< RO Romania */ 703 WHD_COUNTRY_RUSSIAN_FEDERATION = MK_CNTRY('R', 'U', 0), /**< RU Russian_Federation */ 704 WHD_COUNTRY_RWANDA = MK_CNTRY('R', 'W', 0), /**< RW Rwanda */ 705 WHD_COUNTRY_SAINT_KITTS_AND_NEVIS = MK_CNTRY('K', 'N', 0), /**< KN Saint_Kitts_and_Nevis */ 706 WHD_COUNTRY_SAINT_LUCIA = MK_CNTRY('L', 'C', 0), /**< LC Saint_Lucia */ 707 WHD_COUNTRY_SAINT_PIERRE_AND_MIQUELON = MK_CNTRY('P', 'M', 0), /**< PM Saint_Pierre_and_Miquelon */ 708 WHD_COUNTRY_SAINT_VINCENT_AND_THE_GRENADINES = MK_CNTRY('V', 'C', 0), /**< VC Saint_Vincent_and_The_Grenadines */ 709 WHD_COUNTRY_SAMOA = MK_CNTRY('W', 'S', 0), /**< WS Samoa */ 710 WHD_COUNTRY_SANIT_MARTIN_SINT_MARTEEN = MK_CNTRY('M', 'F', 0), /**< MF Sanit_Martin_/_Sint_Marteen */ 711 WHD_COUNTRY_SAO_TOME_AND_PRINCIPE = MK_CNTRY('S', 'T', 0), /**< ST Sao_Tome_and_Principe */ 712 WHD_COUNTRY_SAUDI_ARABIA = MK_CNTRY('S', 'A', 0), /**< SA Saudi_Arabia */ 713 WHD_COUNTRY_SENEGAL = MK_CNTRY('S', 'N', 0), /**< SN Senegal */ 714 WHD_COUNTRY_SERBIA = MK_CNTRY('R', 'S', 0), /**< RS Serbia */ 715 WHD_COUNTRY_SEYCHELLES = MK_CNTRY('S', 'C', 0), /**< SC Seychelles */ 716 WHD_COUNTRY_SIERRA_LEONE = MK_CNTRY('S', 'L', 0), /**< SL Sierra_Leone */ 717 WHD_COUNTRY_SINGAPORE = MK_CNTRY('S', 'G', 0), /**< SG Singapore */ 718 WHD_COUNTRY_SLOVAKIA = MK_CNTRY('S', 'K', 0), /**< SK Slovakia */ 719 WHD_COUNTRY_SLOVENIA = MK_CNTRY('S', 'I', 0), /**< SI Slovenia */ 720 WHD_COUNTRY_SOLOMON_ISLANDS = MK_CNTRY('S', 'B', 0), /**< SB Solomon_Islands */ 721 WHD_COUNTRY_SOMALIA = MK_CNTRY('S', 'O', 0), /**< SO Somalia */ 722 WHD_COUNTRY_SOUTH_AFRICA = MK_CNTRY('Z', 'A', 0), /**< ZA South_Africa */ 723 WHD_COUNTRY_SPAIN = MK_CNTRY('E', 'S', 0), /**< ES Spain */ 724 WHD_COUNTRY_SRI_LANKA = MK_CNTRY('L', 'K', 0), /**< LK Sri_Lanka */ 725 WHD_COUNTRY_SURINAME = MK_CNTRY('S', 'R', 0), /**< SR Suriname */ 726 WHD_COUNTRY_SWAZILAND = MK_CNTRY('S', 'Z', 0), /**< SZ Swaziland */ 727 WHD_COUNTRY_SWEDEN = MK_CNTRY('S', 'E', 0), /**< SE Sweden */ 728 WHD_COUNTRY_SWITZERLAND = MK_CNTRY('C', 'H', 0), /**< CH Switzerland */ 729 WHD_COUNTRY_SYRIAN_ARAB_REPUBLIC = MK_CNTRY('S', 'Y', 0), /**< SY Syrian_Arab_Republic */ 730 WHD_COUNTRY_TAIWAN_PROVINCE_OF_CHINA = MK_CNTRY('T', 'W', 0), /**< TW Taiwan,_Province_Of_China */ 731 WHD_COUNTRY_TAJIKISTAN = MK_CNTRY('T', 'J', 0), /**< TJ Tajikistan */ 732 WHD_COUNTRY_TANZANIA_UNITED_REPUBLIC_OF = MK_CNTRY('T', 'Z', 0), /**< TZ Tanzania,_United_Republic_Of */ 733 WHD_COUNTRY_THAILAND = MK_CNTRY('T', 'H', 0), /**< TH Thailand */ 734 WHD_COUNTRY_TOGO = MK_CNTRY('T', 'G', 0), /**< TG Togo */ 735 WHD_COUNTRY_TONGA = MK_CNTRY('T', 'O', 0), /**< TO Tonga */ 736 WHD_COUNTRY_TRINIDAD_AND_TOBAGO = MK_CNTRY('T', 'T', 0), /**< TT Trinidad_and_Tobago */ 737 WHD_COUNTRY_TUNISIA = MK_CNTRY('T', 'N', 0), /**< TN Tunisia */ 738 WHD_COUNTRY_TURKEY = MK_CNTRY('T', 'R', 0), /**< TR Turkey */ 739 WHD_COUNTRY_TURKMENISTAN = MK_CNTRY('T', 'M', 0), /**< TM Turkmenistan */ 740 WHD_COUNTRY_TURKS_AND_CAICOS_ISLANDS = MK_CNTRY('T', 'C', 0), /**< TC Turks_and_Caicos_Islands */ 741 WHD_COUNTRY_TUVALU = MK_CNTRY('T', 'V', 0), /**< TV Tuvalu */ 742 WHD_COUNTRY_UGANDA = MK_CNTRY('U', 'G', 0), /**< UG Uganda */ 743 WHD_COUNTRY_UKRAINE = MK_CNTRY('U', 'A', 0), /**< UA Ukraine */ 744 WHD_COUNTRY_UNITED_ARAB_EMIRATES = MK_CNTRY('A', 'E', 0), /**< AE United_Arab_Emirates */ 745 WHD_COUNTRY_UNITED_KINGDOM = MK_CNTRY('G', 'B', 0), /**< GB United_Kingdom */ 746 WHD_COUNTRY_UNITED_STATES = MK_CNTRY('U', 'S', 0), /**< US United_States */ 747 WHD_COUNTRY_UNITED_STATES_REV4 = MK_CNTRY('U', 'S', 4), /**< US United_States Revision 4 */ 748 WHD_COUNTRY_UNITED_STATES_REV931 = MK_CNTRY('Q', '1', 931), /**< Q1 United_States Revision 931 */ 749 WHD_COUNTRY_UNITED_STATES_NO_DFS = MK_CNTRY('Q', '2', 0), /**< Q2 United_States_(No_DFS) */ 750 WHD_COUNTRY_UNITED_STATES_MINOR_OUTLYING_ISLANDS = MK_CNTRY('U', 'M', 0), /**< UM United_States_Minor_Outlying_Islands */ 751 WHD_COUNTRY_URUGUAY = MK_CNTRY('U', 'Y', 0), /**< UY Uruguay */ 752 WHD_COUNTRY_UZBEKISTAN = MK_CNTRY('U', 'Z', 0), /**< UZ Uzbekistan */ 753 WHD_COUNTRY_VANUATU = MK_CNTRY('V', 'U', 0), /**< VU Vanuatu */ 754 WHD_COUNTRY_VENEZUELA = MK_CNTRY('V', 'E', 0), /**< VE Venezuela */ 755 WHD_COUNTRY_VIET_NAM = MK_CNTRY('V', 'N', 0), /**< VN Viet_Nam */ 756 WHD_COUNTRY_VIRGIN_ISLANDS_BRITISH = MK_CNTRY('V', 'G', 0), /**< VG Virgin_Islands,_British */ 757 WHD_COUNTRY_VIRGIN_ISLANDS_US = MK_CNTRY('V', 'I', 0), /**< VI Virgin_Islands,_U.S. */ 758 WHD_COUNTRY_WALLIS_AND_FUTUNA = MK_CNTRY('W', 'F', 0), /**< WF Wallis_and_Futuna */ 759 WHD_COUNTRY_WEST_BANK = MK_CNTRY('0', 'C', 0), /**< 0C West_Bank */ 760 WHD_COUNTRY_WESTERN_SAHARA = MK_CNTRY('E', 'H', 0), /**< EH Western_Sahara */ 761 WHD_COUNTRY_WORLD_WIDE_XV_REV983 = MK_CNTRY('X', 'V', 983), /**< Worldwide Locale Revision 983 */ 762 WHD_COUNTRY_WORLD_WIDE_XX = MK_CNTRY('X', 'X', 0), /**< Worldwide Locale (passive Ch12-14) */ 763 WHD_COUNTRY_WORLD_WIDE_XX_REV17 = MK_CNTRY('X', 'X', 17), /**< Worldwide Locale (passive Ch12-14) Revision 17 */ 764 WHD_COUNTRY_YEMEN = MK_CNTRY('Y', 'E', 0), /**< YE Yemen */ 765 WHD_COUNTRY_ZAMBIA = MK_CNTRY('Z', 'M', 0), /**< ZM Zambia */ 766 WHD_COUNTRY_ZIMBABWE = MK_CNTRY('Z', 'W', 0), /**< ZW Zimbabwe */ 767 } whd_country_code_t; 768 769 /** 770 * Structure for storing extended scan parameters 771 */ 772 typedef struct 773 { 774 int32_t number_of_probes_per_channel; /**< Number of probes to send on each channel */ 775 int32_t scan_active_dwell_time_per_channel_ms; /**< Period of time to wait on each channel when active scanning */ 776 int32_t scan_passive_dwell_time_per_channel_ms; /**< Period of time to wait on each channel when passive scanning */ 777 int32_t scan_home_channel_dwell_time_between_channels_ms; /**< Period of time to wait on the home channel when scanning. Only relevant if associated. */ 778 } whd_scan_extended_params_t; 779 780 /** 781 * Structure for storing scan results 782 */ 783 #pragma pack(1) 784 typedef struct whd_scan_result 785 { 786 whd_ssid_t SSID; /**< Service Set Identification (i.e. Name of Access Point) */ 787 whd_mac_t BSSID; /**< Basic Service Set Identification (i.e. MAC address of Access Point) */ 788 int16_t signal_strength; /**< Receive Signal Strength Indication in dBm. <-90=Very poor, >-30=Excellent */ 789 uint32_t max_data_rate; /**< Maximum data rate in kilobits/s */ 790 whd_bss_type_t bss_type; /**< Network type */ 791 whd_security_t security; /**< Security type */ 792 uint8_t channel; /**< Radio channel that the AP beacon was received on */ 793 whd_802_11_band_t band; /**< Radio band */ 794 uint8_t ccode[2]; /**< Two letter ISO country code from AP */ 795 uint8_t flags; /**< flags */ 796 struct whd_scan_result *next; /**< Pointer to the next scan result */ 797 uint8_t *ie_ptr; /**< Pointer to received Beacon/Probe Response IE(Information Element) */ 798 uint32_t ie_len; /**< Length of IE(Information Element) */ 799 } whd_scan_result_t; 800 #pragma pack() 801 802 /** 803 * Structure to store scan result parameters for each AP 804 */ 805 typedef struct whd_simple_scan_result 806 { 807 whd_ssid_t SSID; /**< Service Set Identification (i.e. Name of Access Point) */ 808 whd_mac_t BSSID; /**< Basic Service Set Identification (i.e. MAC address of Access Point) */ 809 int16_t signal_strength; /**< Receive Signal Strength Indication in dBm. <-90=Very poor, >-30=Excellent */ 810 whd_security_t security; /**< Security type */ 811 uint8_t channel; /**< Radio channel that the AP beacon was received on */ 812 } whd_sync_scan_result_t; 813 814 typedef uint16_t wl_chanspec_t; /**< Channel specified in uint16_t */ 815 #define MCSSET_LEN 16 /**< Maximum allowed mcs rate */ 816 817 /** BSS(Basic Service Set) information structure 818 * 819 * Applications MUST CHECK ie_offset field and length field to access IEs(Information Elements) and 820 * next bss_info structure in a vector (in whd_sync_scan_result_t) 821 */ 822 typedef struct wl_bss_info_struct 823 { 824 uint32_t version; /**< version field */ 825 uint32_t length; /**< byte length of data in this record, starting at version and including IEs */ 826 whd_mac_t BSSID; /**< Unique 6-byte MAC address */ 827 uint16_t beacon_period; /**< Interval between two consecutive beacon frames. Units are Kusec */ 828 uint16_t capability; /**< Capability information */ 829 uint8_t SSID_len; /**< SSID length */ 830 uint8_t SSID[32]; /**< Array to store SSID */ 831 uint8_t reserved1[1]; /**< Reserved(padding) */ 832 struct 833 { 834 uint32_t count; /**< Count of rates in this set */ 835 uint8_t rates[16]; /**< rates in 500kbps units, higher bit set if basic */ 836 } rateset; /**< supported rates */ 837 wl_chanspec_t chanspec; /**< Channel specification for basic service set */ 838 uint16_t atim_window; /**< Announcement traffic indication message window size. Units are Kusec */ 839 uint8_t dtim_period; /**< Delivery traffic indication message period */ 840 uint8_t reserved2[1]; /**< Reserved(padding) */ 841 int16_t RSSI; /**< receive signal strength (in dBm) */ 842 int8_t phy_noise; /**< noise (in dBm) */ 843 844 uint8_t n_cap; /**< BSS is 802.11N Capable */ 845 uint8_t reserved3[2]; /**< Reserved(padding) */ 846 uint32_t nbss_cap; /**< 802.11N BSS Capabilities (based on HT_CAP_*) */ 847 uint8_t ctl_ch; /**< 802.11N BSS control channel number */ 848 uint8_t reserved4[3]; /**< Reserved(padding) */ 849 uint32_t reserved32[1]; /**< Reserved for expansion of BSS properties */ 850 uint8_t flags; /**< flags */ 851 uint8_t vht_cap; /**< BSS is vht capable */ 852 uint8_t reserved5[2]; /**< Reserved(padding) */ 853 uint8_t basic_mcs[MCSSET_LEN]; /**< 802.11N BSS required MCS set */ 854 855 uint16_t ie_offset; /**< offset at which IEs start, from beginning */ 856 uint32_t ie_length; /**< byte length of Information Elements */ 857 int16_t SNR; /**< Average SNR(signal to noise ratio) during frame reception */ 858 /* Add new fields here */ 859 /* variable length Information Elements */ 860 } wl_bss_info_t; 861 862 /** Structure for storing 802.11 powersave listen interval values \n 863 * See @ref whd_wifi_get_listen_interval for more information 864 */ 865 typedef struct 866 { 867 uint8_t beacon; /**< Listen interval in beacon periods */ 868 uint8_t dtim; /**< Listen interval in DTIM periods */ 869 uint16_t assoc; /**< Listen interval as sent to APs */ 870 } whd_listen_interval_t; 871 872 /** 873 * WHD result is specified as uint32_t value 874 */ 875 typedef uint32_t whd_result_t; 876 877 /* whd_result_t error code format 878 * |31-18 (14 bit) for module id|17-16 (2 bit) for result type|15-0 for whd error code| 879 */ 880 #define WHD_RESULT_TYPE 0 /**< WHD Result type */ 881 #define WHD_RESULT_CREATE(x) CY_RSLT_CREATE(WHD_RESULT_TYPE, CY_RSLT_MODULE_DRIVERS_WHD_BASE, (x) ) /**< Create a result value from the specified type, module, and result code */ 882 883 #define WHD_SUCCESS CY_RSLT_SUCCESS /**< Success */ 884 #define WHD_PENDING WHD_RESULT_CREATE(1) /**< Pending */ 885 #define WHD_TIMEOUT WHD_RESULT_CREATE(2) /**< Timeout */ 886 #define WHD_BADARG WHD_RESULT_CREATE(5) /**< Bad Arguments */ 887 #define WHD_UNFINISHED WHD_RESULT_CREATE(10) /**< Operation not finished yet WHD_RESULT_CREATE(maybe aborted) */ 888 889 #define WHD_PARTIAL_RESULTS WHD_RESULT_CREATE(1003) /**< Partial results */ 890 #define WHD_INVALID_KEY WHD_RESULT_CREATE(1004) /**< Invalid key */ 891 #define WHD_DOES_NOT_EXIST WHD_RESULT_CREATE(1005) /**< Does not exist */ 892 #define WHD_NOT_AUTHENTICATED WHD_RESULT_CREATE(1006) /**< Not authenticated */ 893 #define WHD_NOT_KEYED WHD_RESULT_CREATE(1007) /**< Not keyed */ 894 #define WHD_IOCTL_FAIL WHD_RESULT_CREATE(1008) /**< IOCTL fail */ 895 #define WHD_BUFFER_UNAVAILABLE_TEMPORARY WHD_RESULT_CREATE(1009) /**< Buffer unavailable temporarily */ 896 #define WHD_BUFFER_UNAVAILABLE_PERMANENT WHD_RESULT_CREATE(1010) /**< Buffer unavailable permanently */ 897 #define WHD_CONNECTION_LOST WHD_RESULT_CREATE(1012) /**< Connection lost */ 898 #define WHD_OUT_OF_EVENT_HANDLER_SPACE WHD_RESULT_CREATE(1013) /**< Cannot add extra event handler */ 899 #define WHD_SEMAPHORE_ERROR WHD_RESULT_CREATE(1014) /**< Error manipulating a semaphore */ 900 #define WHD_FLOW_CONTROLLED WHD_RESULT_CREATE(1015) /**< Packet retrieval cancelled due to flow control */ 901 #define WHD_NO_CREDITS WHD_RESULT_CREATE(1016) /**< Packet retrieval cancelled due to lack of bus credits */ 902 #define WHD_NO_PACKET_TO_SEND WHD_RESULT_CREATE(1017) /**< Packet retrieval cancelled due to no pending packets */ 903 #define WHD_CORE_CLOCK_NOT_ENABLED WHD_RESULT_CREATE(1018) /**< Core disabled due to no clock */ 904 #define WHD_CORE_IN_RESET WHD_RESULT_CREATE(1019) /**< Core disabled - in reset */ 905 #define WHD_UNSUPPORTED WHD_RESULT_CREATE(1020) /**< Unsupported function */ 906 #define WHD_BUS_WRITE_REGISTER_ERROR WHD_RESULT_CREATE(1021) /**< Error writing to WLAN register */ 907 #define WHD_SDIO_BUS_UP_FAIL WHD_RESULT_CREATE(1022) /**< SDIO bus failed to come up */ 908 #define WHD_JOIN_IN_PROGRESS WHD_RESULT_CREATE(1023) /**< Join not finished yet */ 909 #define WHD_NETWORK_NOT_FOUND WHD_RESULT_CREATE(1024) /**< Specified network was not found */ 910 #define WHD_INVALID_JOIN_STATUS WHD_RESULT_CREATE(1025) /**< Join status error */ 911 #define WHD_UNKNOWN_INTERFACE WHD_RESULT_CREATE(1026) /**< Unknown interface specified */ 912 #define WHD_SDIO_RX_FAIL WHD_RESULT_CREATE(1027) /**< Error during SDIO receive */ 913 #define WHD_HWTAG_MISMATCH WHD_RESULT_CREATE(1028) /**< Hardware tag header corrupt */ 914 #define WHD_RX_BUFFER_ALLOC_FAIL WHD_RESULT_CREATE(1029) /**< Failed to allocate a buffer to receive into */ 915 #define WHD_BUS_READ_REGISTER_ERROR WHD_RESULT_CREATE(1030) /**< Error reading a bus hardware register */ 916 #define WHD_THREAD_CREATE_FAILED WHD_RESULT_CREATE(1031) /**< Failed to create a new thread */ 917 #define WHD_QUEUE_ERROR WHD_RESULT_CREATE(1032) /**< Error manipulating a queue */ 918 #define WHD_BUFFER_POINTER_MOVE_ERROR WHD_RESULT_CREATE(1033) /**< Error moving the current pointer of a packet buffer */ 919 #define WHD_BUFFER_SIZE_SET_ERROR WHD_RESULT_CREATE(1034) /**< Error setting size of packet buffer */ 920 #define WHD_THREAD_STACK_NULL WHD_RESULT_CREATE(1035) /**< Null stack pointer passed when non null was reqired */ 921 #define WHD_THREAD_DELETE_FAIL WHD_RESULT_CREATE(1036) /**< Error deleting a thread */ 922 #define WHD_SLEEP_ERROR WHD_RESULT_CREATE(1037) /**< Error sleeping a thread */ 923 #define WHD_BUFFER_ALLOC_FAIL WHD_RESULT_CREATE(1038) /**< Failed to allocate a packet buffer */ 924 #define WHD_NO_PACKET_TO_RECEIVE WHD_RESULT_CREATE(1039) /**< No Packets waiting to be received */ 925 #define WHD_INTERFACE_NOT_UP WHD_RESULT_CREATE(1040) /**< Requested interface is not active */ 926 #define WHD_DELAY_TOO_LONG WHD_RESULT_CREATE(1041) /**< Requested delay is too long */ 927 #define WHD_INVALID_DUTY_CYCLE WHD_RESULT_CREATE(1042) /**< Duty cycle is outside limit 0 to 100 */ 928 #define WHD_PMK_WRONG_LENGTH WHD_RESULT_CREATE(1043) /**< Returned pmk was the wrong length */ 929 #define WHD_UNKNOWN_SECURITY_TYPE WHD_RESULT_CREATE(1044) /**< AP security type was unknown */ 930 #define WHD_WEP_NOT_ALLOWED WHD_RESULT_CREATE(1045) /**< AP not allowed to use WEP - it is not secure - use Open instead */ 931 #define WHD_WPA_KEYLEN_BAD WHD_RESULT_CREATE(1046) /**< WPA / WPA2 key length must be between 8 & 64 bytes */ 932 #define WHD_FILTER_NOT_FOUND WHD_RESULT_CREATE(1047) /**< Specified filter id not found */ 933 #define WHD_SPI_ID_READ_FAIL WHD_RESULT_CREATE(1048) /**< Failed to read 0xfeedbead SPI id from chip */ 934 #define WHD_SPI_SIZE_MISMATCH WHD_RESULT_CREATE(1049) /**< Mismatch in sizes between SPI header and SDPCM header */ 935 #define WHD_ADDRESS_ALREADY_REGISTERED WHD_RESULT_CREATE(1050) /**< Attempt to register a multicast address twice */ 936 #define WHD_SDIO_RETRIES_EXCEEDED WHD_RESULT_CREATE(1051) /**< SDIO transfer failed too many times. */ 937 #define WHD_NULL_PTR_ARG WHD_RESULT_CREATE(1052) /**< Null Pointer argument passed to function. */ 938 #define WHD_THREAD_FINISH_FAIL WHD_RESULT_CREATE(1053) /**< Error deleting a thread */ 939 #define WHD_WAIT_ABORTED WHD_RESULT_CREATE(1054) /**< Semaphore/mutex wait has been aborted */ 940 #define WHD_SET_BLOCK_ACK_WINDOW_FAIL WHD_RESULT_CREATE(1055) /**< Failed to set block ack window */ 941 #define WHD_DELAY_TOO_SHORT WHD_RESULT_CREATE(1056) /**< Requested delay is too short */ 942 #define WHD_INVALID_INTERFACE WHD_RESULT_CREATE(1057) /**< Invalid interface provided */ 943 #define WHD_WEP_KEYLEN_BAD WHD_RESULT_CREATE(1058) /**< WEP / WEP_SHARED key length must be 5 or 13 bytes */ 944 #define WHD_HANDLER_ALREADY_REGISTERED WHD_RESULT_CREATE(1059) /**< EAPOL handler already registered */ 945 #define WHD_AP_ALREADY_UP WHD_RESULT_CREATE(1060) /**< Soft AP or P2P group owner already up */ 946 #define WHD_EAPOL_KEY_PACKET_M1_TIMEOUT WHD_RESULT_CREATE(1061) /**< Timeout occurred while waiting for EAPOL packet M1 from AP */ 947 #define WHD_EAPOL_KEY_PACKET_M3_TIMEOUT WHD_RESULT_CREATE(1062) /**< Timeout occurred while waiting for EAPOL packet M3 from APwhich may indicate incorrect WPA2/WPA passphrase */ 948 #define WHD_EAPOL_KEY_PACKET_G1_TIMEOUT WHD_RESULT_CREATE(1063) /**< Timeout occurred while waiting for EAPOL packet G1 from AP */ 949 #define WHD_EAPOL_KEY_FAILURE WHD_RESULT_CREATE(1064) /**< Unknown failure occurred during the EAPOL key handshake */ 950 #define WHD_MALLOC_FAILURE WHD_RESULT_CREATE(1065) /**< Memory allocation failure */ 951 #define WHD_ACCESS_POINT_NOT_FOUND WHD_RESULT_CREATE(1066) /**< Access point not found */ 952 #define WHD_RTOS_ERROR WHD_RESULT_CREATE(1067) /**< RTOS operation failed */ 953 #define WHD_CLM_BLOB_DLOAD_ERROR WHD_RESULT_CREATE(1068) /**< CLM blob download failed */ 954 #define WHD_HAL_ERROR WHD_RESULT_CREATE(1069) /**< WHD HAL Error */ 955 #define WHD_RTOS_STATIC_MEM_LIMIT WHD_RESULT_CREATE(1070) /**< Exceeding the RTOS static objects memory */ 956 #define WHD_NO_REGISTER_FUNCTION_POINTER WHD_RESULT_CREATE(1071) /**< No register function pointer */ 957 958 #define WLAN_ENUM_OFFSET 2000 /**< WLAN enum offset for WHD_WLAN error processing */ 959 960 #define WHD_WLAN_ERROR WHD_RESULT_CREATE(2001) /**< Generic Error */ 961 #define WHD_WLAN_BADARG WHD_RESULT_CREATE(2002) /**< Bad Argument */ 962 #define WHD_WLAN_BADOPTION WHD_RESULT_CREATE(2003) /**< Bad option */ 963 #define WHD_WLAN_NOTUP WHD_RESULT_CREATE(2004) /**< Not up */ 964 #define WHD_WLAN_NOTDOWN WHD_RESULT_CREATE(2005) /**< Not down */ 965 #define WHD_WLAN_NOTAP WHD_RESULT_CREATE(2006) /**< Not AP */ 966 #define WHD_WLAN_NOTSTA WHD_RESULT_CREATE(2007) /**< Not STA */ 967 #define WHD_WLAN_BADKEYIDX WHD_RESULT_CREATE(2008) /**< BAD Key Index */ 968 #define WHD_WLAN_RADIOOFF WHD_RESULT_CREATE(2009) /**< Radio Off */ 969 #define WHD_WLAN_NOTBANDLOCKED WHD_RESULT_CREATE(2010) /**< Not band locked */ 970 #define WHD_WLAN_NOCLK WHD_RESULT_CREATE(2011) /**< No Clock */ 971 #define WHD_WLAN_BADRATESET WHD_RESULT_CREATE(2012) /**< BAD Rate valueset */ 972 #define WHD_WLAN_BADBAND WHD_RESULT_CREATE(2013) /**< BAD Band */ 973 #define WHD_WLAN_BUFTOOSHORT WHD_RESULT_CREATE(2014) /**< Buffer too short */ 974 #define WHD_WLAN_BUFTOOLONG WHD_RESULT_CREATE(2015) /**< Buffer too long */ 975 #define WHD_WLAN_BUSY WHD_RESULT_CREATE(2016) /**< Busy */ 976 #define WHD_WLAN_NOTASSOCIATED WHD_RESULT_CREATE(2017) /**< Not Associated */ 977 #define WHD_WLAN_BADSSIDLEN WHD_RESULT_CREATE(2018) /**< Bad SSID len */ 978 #define WHD_WLAN_OUTOFRANGECHAN WHD_RESULT_CREATE(2019) /**< Out of Range Channel */ 979 #define WHD_WLAN_BADCHAN WHD_RESULT_CREATE(2020) /**< Bad Channel */ 980 #define WHD_WLAN_BADADDR WHD_RESULT_CREATE(2021) /**< Bad Address */ 981 #define WHD_WLAN_NORESOURCE WHD_RESULT_CREATE(2022) /**< Not Enough Resources */ 982 #define WHD_WLAN_UNSUPPORTED WHD_RESULT_CREATE(2023) /**< Unsupported */ 983 #define WHD_WLAN_BADLEN WHD_RESULT_CREATE(2024) /**< Bad length */ 984 #define WHD_WLAN_NOTREADY WHD_RESULT_CREATE(2025) /**< Not Ready */ 985 #define WHD_WLAN_EPERM WHD_RESULT_CREATE(2026) /**< Not Permitted */ 986 #define WHD_WLAN_NOMEM WHD_RESULT_CREATE(2027) /**< No Memory */ 987 #define WHD_WLAN_ASSOCIATED WHD_RESULT_CREATE(2028) /**< Associated */ 988 #define WHD_WLAN_RANGE WHD_RESULT_CREATE(2029) /**< Not In Range */ 989 #define WHD_WLAN_NOTFOUND WHD_RESULT_CREATE(2030) /**< Not Found */ 990 #define WHD_WLAN_WME_NOT_ENABLED WHD_RESULT_CREATE(2031) /**< WME Not Enabled */ 991 #define WHD_WLAN_TSPEC_NOTFOUND WHD_RESULT_CREATE(2032) /**< TSPEC Not Found */ 992 #define WHD_WLAN_ACM_NOTSUPPORTED WHD_RESULT_CREATE(2033) /**< ACM Not Supported */ 993 #define WHD_WLAN_NOT_WME_ASSOCIATION WHD_RESULT_CREATE(2034) /**< Not WME Association */ 994 #define WHD_WLAN_SDIO_ERROR WHD_RESULT_CREATE(2035) /**< SDIO Bus Error */ 995 #define WHD_WLAN_WLAN_DOWN WHD_RESULT_CREATE(2036) /**< WLAN Not Accessible */ 996 #define WHD_WLAN_BAD_VERSION WHD_RESULT_CREATE(2037) /**< Incorrect version */ 997 #define WHD_WLAN_TXFAIL WHD_RESULT_CREATE(2038) /**< TX failure */ 998 #define WHD_WLAN_RXFAIL WHD_RESULT_CREATE(2039) /**< RX failure */ 999 #define WHD_WLAN_NODEVICE WHD_RESULT_CREATE(2040) /**< Device not present */ 1000 #define WHD_WLAN_UNFINISHED WHD_RESULT_CREATE(2041) /**< To be finished */ 1001 #define WHD_WLAN_NONRESIDENT WHD_RESULT_CREATE(2042) /**< access to nonresident overlay */ 1002 #define WHD_WLAN_DISABLED WHD_RESULT_CREATE(2043) /**< Disabled in this build */ 1003 #define WHD_WLAN_NOFUNCTION WHD_RESULT_CREATE(2044) /**< Function pointer not provided */ 1004 #define WHD_WLAN_INVALID WHD_RESULT_CREATE(2045) /**< Not valid */ 1005 #define WHD_WLAN_NOBAND WHD_RESULT_CREATE(2046) /**< No Band */ 1006 1007 /** 1008 * type definition for whd_buffer_t 1009 */ 1010 typedef whd_buffer_t whd_buffer_queue_ptr_t; 1011 1012 #pragma pack(1) 1013 1014 /** 1015 * Structure for storing AP information 1016 */ 1017 typedef struct whd_ap_info 1018 { 1019 whd_ssid_t SSID; /**< Service Set Identification (i.e. Name of Access Point) */ 1020 whd_mac_t BSSID; /**< Basic Service Set Identification (i.e. MAC address of Access Point) */ 1021 int16_t signal_strength; /**< Receive Signal Strength Indication in dBm. <-90=Very poor, >-30=Excellent */ 1022 uint32_t max_data_rate; /**< Maximum data rate in kilobits/s */ 1023 whd_bss_type_t bss_type; /**< Network type */ 1024 whd_security_t security; /**< Security type */ 1025 uint8_t channel; /**< Radio channel that the AP beacon was received on */ 1026 whd_802_11_band_t band; /**< Radio band */ 1027 struct whd_ap_info *next; /**< Pointer to the next scan result */ 1028 } whd_ap_info_t; 1029 1030 /** 1031 * Structure describing a list of associated softAP clients 1032 */ 1033 typedef struct 1034 { 1035 uint32_t count; /**< Number of MAC addresses in the list */ 1036 whd_mac_t mac_list[1]; /**< Variable length array of MAC addresses */ 1037 } whd_maclist_t; 1038 1039 #pragma pack() 1040 1041 /** 1042 * Structure describing a list of PMKID 1043 */ 1044 typedef struct _pmkid 1045 { 1046 whd_mac_t BSSID; 1047 uint8_t PMKID[PMKID_LEN]; 1048 } pmkid_t; 1049 1050 typedef struct _pmkid_list 1051 { 1052 uint32_t npmkid; 1053 pmkid_t pmkid[1]; 1054 } pmkid_list_t; 1055 1056 /** 1057 * Structure used by both dongle and host 1058 * dongle asks host to start auth(SAE), host updates auth status to dongle. 1059 */ 1060 typedef struct whd_auth_req_status 1061 { 1062 uint16_t flags; 1063 whd_mac_t peer_mac; /* peer mac address */ 1064 uint32_t ssid_len; 1065 uint8_t ssid[SSID_NAME_SIZE]; 1066 uint8_t pmkid[PMKID_LEN]; 1067 } whd_auth_req_status_t; 1068 1069 /** 1070 * Time value in milliseconds 1071 */ 1072 typedef uint32_t whd_time_t; 1073 1074 /** 1075 * Structure for storing a WEP key 1076 */ 1077 typedef struct 1078 { 1079 uint8_t index; /**< WEP key index [0/1/2/3] */ 1080 uint8_t length; /**< WEP key length. Either 5 bytes (40-bits) or 13-bytes (104-bits) */ 1081 uint8_t data[32]; /**< WEP key as values NOT characters */ 1082 } whd_wep_key_t; 1083 1084 /** 1085 * Structure for management frame(auth) params 1086 */ 1087 typedef struct whd_auth_params 1088 { 1089 uint32_t version; 1090 uint32_t dwell_time; 1091 uint16_t len; /* Len includes Len(MAC Headers) + Len(Contents) */ 1092 uint16_t fc; 1093 uint16_t channel; 1094 whd_mac_t da; 1095 whd_mac_t bssid; 1096 uint32_t packetId; 1097 uint8_t data[1]; /* It contains MAC Headers + Contexts*/ 1098 } whd_auth_params_t; 1099 1100 /** 1101 * Structure for he_omi params 1102 */ 1103 typedef struct 1104 { 1105 uint8_t rx_nss; 1106 uint8_t chnl_wdth; 1107 uint8_t ul_mu_dis; 1108 uint8_t tx_nsts; 1109 uint8_t er_su_dis; 1110 uint8_t dl_mu_resound; 1111 uint8_t ul_mu_data_dis; 1112 uint8_t reserved; 1113 } whd_he_omi_params_t; 1114 1115 /** 1116 * Structure for itwt_setup params 1117 */ 1118 typedef struct 1119 { 1120 uint8_t setup_cmd; 1121 uint8_t trigger; 1122 uint8_t flow_type; /* Un-Announced or Announced */ 1123 uint8_t flow_id; /* 0xFF means any */ 1124 uint8_t wake_duration; /* Minimum TWT wake duration in units of 256 usec */ 1125 uint8_t exponent; /* Used to compute TWT wake interval */ 1126 uint16_t mantissa; /* Used to compute TWT wake interval */ 1127 uint32_t wake_time_h; /* target wake time - BSS TSF (us) */ 1128 uint32_t wake_time_l; 1129 } whd_itwt_setup_params_t; 1130 1131 /** 1132 * Structure for btwt_join params 1133 */ 1134 typedef struct 1135 { 1136 uint8_t setup_cmd; 1137 uint8_t trigger; 1138 uint8_t flow_type; /* Un-Announced or Announced */ 1139 uint8_t bid; /* bTWT ID */ 1140 uint8_t wake_duration; /* Minimum TWT wake duration in units of 256 usec */ 1141 uint8_t exponent; /* Used to compute TWT wake interval */ 1142 uint16_t mantissa; /* Used to compute TWT wake interval */ 1143 uint32_t wake_time_h; /* target wake time - BSS TSF (us) */ 1144 uint32_t wake_time_l; 1145 } whd_btwt_join_params_t; 1146 1147 /** 1148 * Structure for twt_teardown params 1149 */ 1150 typedef struct 1151 { 1152 uint8_t negotiation_type; 1153 uint8_t flow_id; 1154 uint8_t bcast_twt_id; 1155 uint8_t teardown_all_twt; 1156 } whd_twt_teardown_params_t; 1157 1158 /** 1159 * Structure for btwt_config params 1160 */ 1161 typedef struct 1162 { 1163 uint8_t setup_cmd; 1164 uint8_t trigger; 1165 uint8_t flow_type; /* Un-Announced or Announced */ 1166 uint8_t bid; /* bTWT ID */ 1167 uint8_t wake_duration; /* Minimum TWT wake duration in units of 256 usec */ 1168 uint8_t exponent; /* Used to compute TWT wake interval */ 1169 uint16_t mantissa; /* Used to compute TWT wake interval */ 1170 } whd_btwt_config_params_t; 1171 1172 /** 1173 * Structure for twt_information params 1174 */ 1175 typedef struct 1176 { 1177 uint8_t flow_id; 1178 uint8_t suspend; /* 1: suspend, 0: resume */ 1179 uint8_t resume_time; /* 0 ~ 4095 seconds */ 1180 uint8_t reserved; 1181 } whd_twt_information_params_t; 1182 1183 /** 1184 * Structure for Out-of-band interrupt config parameters which can be set by application during whd power up 1185 */ 1186 typedef struct whd_oob_config 1187 { 1188 whd_gpio_t host_oob_pin; /**< Host-side GPIO pin selection */ 1189 uint8_t dev_gpio_sel; /**< WiFi device-side GPIO pin selection (must be zero) */ 1190 whd_bool_t is_falling_edge; /**< Interrupt trigger (polarity) */ 1191 uint8_t intr_priority; /**< OOB interrupt priority */ 1192 whd_gpio_drive_mode_t drive_mode; /**< Host-side GPIO pin drive mode */ 1193 whd_bool_t init_drive_state; /**< Host-side GPIO pin initial drive state */ 1194 } whd_oob_config_t; 1195 1196 /** 1197 * Structure for SDIO config parameters which can be set by application during whd power up 1198 */ 1199 typedef struct whd_sdio_config 1200 { 1201 /* Bus config */ 1202 whd_bool_t sdio_1bit_mode; /**< Default is false, means SDIO operates under 4 bit mode */ 1203 whd_bool_t high_speed_sdio_clock; /**< Default is false, means SDIO operates in normal clock rate */ 1204 whd_oob_config_t oob_config; /**< Out-of-band interrupt configuration (required when bus can sleep) */ 1205 } whd_sdio_config_t; 1206 1207 /** 1208 * Structure for SPI config parameters which can be set by application during whd power up 1209 */ 1210 typedef struct whd_spi_config 1211 { 1212 /* Bus config */ 1213 whd_bool_t is_spi_normal_mode; /**< Default is false */ 1214 whd_oob_config_t oob_config; /**< Out-of-band interrupt configuration */ 1215 } whd_spi_config_t; 1216 1217 /** 1218 * Structure for M2M config parameters which can be set by application during whd power up 1219 */ 1220 typedef struct whd_m2m_config 1221 { 1222 /* Bus config */ 1223 whd_bool_t is_normal_mode; /**< Default is false */ 1224 } whd_m2m_config_t; 1225 1226 1227 /** 1228 * Enumeration of applicable packet mask bits for custom Information Elements (IEs) 1229 */ 1230 typedef enum 1231 { 1232 VENDOR_IE_BEACON = 0x1, /**< Denotes beacon packet */ 1233 VENDOR_IE_PROBE_RESPONSE = 0x2, /**< Denotes probe response packet */ 1234 VENDOR_IE_ASSOC_RESPONSE = 0x4, /**< Denotes association response packet */ 1235 VENDOR_IE_AUTH_RESPONSE = 0x8, /**< Denotes authentication response packet */ 1236 VENDOR_IE_PROBE_REQUEST = 0x10, /**< Denotes probe request packet */ 1237 VENDOR_IE_ASSOC_REQUEST = 0x20, /**< Denotes association request packet */ 1238 VENDOR_IE_CUSTOM = 0x100, /**< Denotes a custom IE(Information Element) identifier */ 1239 VENDOR_IE_UNKNOWN = ~(VENDOR_IE_BEACON | VENDOR_IE_PROBE_RESPONSE | VENDOR_IE_ASSOC_RESPONSE | \ 1240 VENDOR_IE_AUTH_RESPONSE | VENDOR_IE_PROBE_REQUEST | VENDOR_IE_ASSOC_REQUEST | \ 1241 VENDOR_IE_CUSTOM) 1242 } whd_ie_packet_flag_t; 1243 1244 /** 1245 * Structure for LE Scan parameters 1246 */ 1247 typedef struct whd_btc_lescan_params 1248 { 1249 uint16_t priority; /**< LE scan priority */ 1250 uint16_t duty_cycle; /**< LE scan duty cycle */ 1251 uint16_t max_win; /**< LE Max Scan window */ 1252 uint16_t int_grant; /**< LE Small Interval Grant */ 1253 uint16_t scan_int; /**< LE scan interval */ 1254 uint16_t scan_win; /**< LE scan Window */ 1255 } whd_btc_lescan_params_t; 1256 1257 /** 1258 * Structure for coex config parameters which can be set by application 1259 */ 1260 typedef struct whd_coex_config 1261 { 1262 whd_btc_lescan_params_t le_scan_params; /**< LE Scan Parameters */ 1263 } whd_coex_config_t; 1264 1265 #define PORT_FILTER_LEN 26 /**< Port filter len */ 1266 #define PACKET_FILTER_LIST_BUFFER_MAX_LEN 1000 /**< Packet filter buffer max len */ 1267 /** 1268 * Enumeration of packet filter rules 1269 */ 1270 typedef enum 1271 { 1272 WHD_PACKET_FILTER_RULE_POSITIVE_MATCHING = 0, /**< Specifies that a filter should match a given pattern */ 1273 WHD_PACKET_FILTER_RULE_NEGATIVE_MATCHING = 1 /**< Specifies that a filter should NOT match a given pattern */ 1274 } whd_packet_filter_rule_t; 1275 1276 /** 1277 * Structure describing a packet filter list item 1278 */ 1279 typedef struct 1280 { 1281 uint32_t id; /**< Unique identifier for a packet filter item */ 1282 whd_packet_filter_rule_t rule; /**< Filter matches are either POSITIVE or NEGATIVE matching */ 1283 uint16_t offset; /**< Offset in bytes to start filtering (referenced to the start of the ethernet packet) */ 1284 uint16_t mask_size; /**< Size of the mask in bytes */ 1285 uint8_t *mask; /**< Pattern mask bytes to be ANDed with the pattern eg. "\xff00" (must be in network byte order) */ 1286 uint8_t *pattern; /**< Pattern bytes used to filter eg. "\x0800" (must be in network byte order) */ 1287 whd_bool_t enabled_status; /**< When returned from wwd_wifi_get_packet_filters, indicates if the filter is enabled */ 1288 } whd_packet_filter_t; 1289 1290 #define TKO_DATA_OFFSET offsetof(wl_tko_t, data) /**< TKO data offset */ 1291 1292 #ifdef __cplusplus 1293 } /* extern "C" */ 1294 #endif 1295 #endif /* ifndef INCLUDED_WHD_TYPES_H_ */ 1296 1297