Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lypinator 0:bb348c97df44 1 /*---------------------------------------------------------------------------
lypinator 0:bb348c97df44 2 * Copyright (c) 2016, u-blox Malmö, All Rights Reserved
lypinator 0:bb348c97df44 3 * SPDX-License-Identifier: LicenseRef-PBL
lypinator 0:bb348c97df44 4 *
lypinator 0:bb348c97df44 5 * This file and the related binary are licensed under the
lypinator 0:bb348c97df44 6 * Permissive Binary License, Version 1.0 (the "License");
lypinator 0:bb348c97df44 7 * you may not use these files except in compliance with the License.
lypinator 0:bb348c97df44 8 *
lypinator 0:bb348c97df44 9 * You may obtain a copy of the License here:
lypinator 0:bb348c97df44 10 * LICENSE-permissive-binary-license-1.0.txt and at
lypinator 0:bb348c97df44 11 * https://www.mbed.com/licenses/PBL-1.0
lypinator 0:bb348c97df44 12 *
lypinator 0:bb348c97df44 13 * See the License for the specific language governing permissions and
lypinator 0:bb348c97df44 14 * limitations under the License.
lypinator 0:bb348c97df44 15 *
lypinator 0:bb348c97df44 16 * Component : WLAN
lypinator 0:bb348c97df44 17 * File : cb_wlan.h
lypinator 0:bb348c97df44 18 *
lypinator 0:bb348c97df44 19 * Description : Main WLAN component, ties together WM, SUPPLICANT and
lypinator 0:bb348c97df44 20 * TARGET to one streamlined API.
lypinator 0:bb348c97df44 21 *-------------------------------------------------------------------------*/
lypinator 0:bb348c97df44 22
lypinator 0:bb348c97df44 23 /**
lypinator 0:bb348c97df44 24 * @file cb_wlan.h The main WLAN component interface.
lypinator 0:bb348c97df44 25 * All functions declared extern needs to be provided by another/upper layer.
lypinator 0:bb348c97df44 26 * @ingroup wlan
lypinator 0:bb348c97df44 27 */
lypinator 0:bb348c97df44 28
lypinator 0:bb348c97df44 29 #ifndef _CB_WLAN_H_
lypinator 0:bb348c97df44 30 #define _CB_WLAN_H_
lypinator 0:bb348c97df44 31
lypinator 0:bb348c97df44 32 #include "cb_types.h"
lypinator 0:bb348c97df44 33 #include "cb_wlan_types.h"
lypinator 0:bb348c97df44 34 #include "cb_cert_utils.h"
lypinator 0:bb348c97df44 35 #include "cb_status.h"
lypinator 0:bb348c97df44 36
lypinator 0:bb348c97df44 37 #ifdef __cplusplus
lypinator 0:bb348c97df44 38 extern "C" {
lypinator 0:bb348c97df44 39 #endif
lypinator 0:bb348c97df44 40
lypinator 0:bb348c97df44 41
lypinator 0:bb348c97df44 42 /*===========================================================================
lypinator 0:bb348c97df44 43 * DEFINES
lypinator 0:bb348c97df44 44 *=========================================================================*/
lypinator 0:bb348c97df44 45
lypinator 0:bb348c97df44 46 /**
lypinator 0:bb348c97df44 47 * Max username length in @ref cbWLAN_EnterpriseConnectParameters
lypinator 0:bb348c97df44 48 *
lypinator 0:bb348c97df44 49 * @ingroup wlan
lypinator 0:bb348c97df44 50 */
lypinator 0:bb348c97df44 51 #define cbWLAN_MAX_USERNAME_LENGTH 32
lypinator 0:bb348c97df44 52
lypinator 0:bb348c97df44 53 /**
lypinator 0:bb348c97df44 54 * Max password length in @ref cbWLAN_Util_PSKFromPWD and @ref cbWLAN_EnterpriseConnectParameters
lypinator 0:bb348c97df44 55 *
lypinator 0:bb348c97df44 56 * @ingroup wlan
lypinator 0:bb348c97df44 57 */
lypinator 0:bb348c97df44 58 #define cbWLAN_MAX_PASSPHRASE_LENGTH 64
lypinator 0:bb348c97df44 59
lypinator 0:bb348c97df44 60 /**
lypinator 0:bb348c97df44 61 * PSK length in @ref cbWLAN_WPAPSKConnectParameters
lypinator 0:bb348c97df44 62 *
lypinator 0:bb348c97df44 63 * @ingroup wlan
lypinator 0:bb348c97df44 64 */
lypinator 0:bb348c97df44 65 #define cbWLAN_PSK_LENGTH 32
lypinator 0:bb348c97df44 66
lypinator 0:bb348c97df44 67
lypinator 0:bb348c97df44 68 /**
lypinator 0:bb348c97df44 69 * Max domain name length in @ref cbWLAN_EnterpriseConnectParameters
lypinator 0:bb348c97df44 70 *
lypinator 0:bb348c97df44 71 * @ingroup wlan
lypinator 0:bb348c97df44 72 */
lypinator 0:bb348c97df44 73 #define cbWLAN_MAX_DOMAIN_LENGTH 64
lypinator 0:bb348c97df44 74
lypinator 0:bb348c97df44 75 /**
lypinator 0:bb348c97df44 76 * Size of the misc buffer in @ref cbWM_ChangeBSS and @ref cbWM_StartFT.
lypinator 0:bb348c97df44 77 *
lypinator 0:bb348c97df44 78 * @ingroup types
lypinator 0:bb348c97df44 79 */
lypinator 0:bb348c97df44 80 #define MISC_BUFFER_SIZE 255
lypinator 0:bb348c97df44 81
lypinator 0:bb348c97df44 82 #define cbWLAN_FTIE_SIZE 255
lypinator 0:bb348c97df44 83 #define cbWLAN_RSNIE_SIZE 44
lypinator 0:bb348c97df44 84 #define cbWLAN_MDIE_SIZE 5
lypinator 0:bb348c97df44 85
lypinator 0:bb348c97df44 86 /*===========================================================================
lypinator 0:bb348c97df44 87 * TYPES
lypinator 0:bb348c97df44 88 *=========================================================================*/
lypinator 0:bb348c97df44 89
lypinator 0:bb348c97df44 90 /**
lypinator 0:bb348c97df44 91 * Start parameters passed to WLAN driver.
lypinator 0:bb348c97df44 92 *
lypinator 0:bb348c97df44 93 * @ingroup wlan
lypinator 0:bb348c97df44 94 */
lypinator 0:bb348c97df44 95 typedef struct cbWLAN_StartParameters {
lypinator 0:bb348c97df44 96 cbWLAN_MACAddress mac; /**< MAC of WLAN interface, set to all zeros if hardware programmed address should be used. */
lypinator 0:bb348c97df44 97 cbWM_ModuleType deviceType; /**< Specify current device type. */
lypinator 0:bb348c97df44 98 union {
lypinator 0:bb348c97df44 99 struct {
lypinator 0:bb348c97df44 100 cbWM_TxPowerSettings txPowerSettings; /**< Transmission power settings. */
lypinator 0:bb348c97df44 101 cb_uint8 numberOfAntennas; /**< Number of antennas use for wifi (MIMO supports 2x2). */
lypinator 0:bb348c97df44 102 cb_uint8 primaryAntenna; /**< Primary antenna selection. */
lypinator 0:bb348c97df44 103 } ODIN_W26X;
lypinator 0:bb348c97df44 104 } deviceSpecific;
lypinator 0:bb348c97df44 105 } cbWLAN_StartParameters;
lypinator 0:bb348c97df44 106
lypinator 0:bb348c97df44 107 /**
lypinator 0:bb348c97df44 108 * Common connect parameters.
lypinator 0:bb348c97df44 109 *
lypinator 0:bb348c97df44 110 * @ingroup wlan
lypinator 0:bb348c97df44 111 */
lypinator 0:bb348c97df44 112 typedef struct cbWLAN_CommonConnectParameters {
lypinator 0:bb348c97df44 113 cbWLAN_MACAddress bssid; /**< BSSID to connect to, set to all zero for any BSSID. */
lypinator 0:bb348c97df44 114 cbWLAN_Ssid ssid; /**< SSID to connect to. */
lypinator 0:bb348c97df44 115 } cbWLAN_CommonConnectParameters;
lypinator 0:bb348c97df44 116
lypinator 0:bb348c97df44 117
lypinator 0:bb348c97df44 118 /**
lypinator 0:bb348c97df44 119 * WEP specific connect parameters.
lypinator 0:bb348c97df44 120 *
lypinator 0:bb348c97df44 121 * @ingroup wlan
lypinator 0:bb348c97df44 122 */
lypinator 0:bb348c97df44 123 typedef struct cbWLAN_WEPConnectParameters {
lypinator 0:bb348c97df44 124 cbWLAN_WEPKey keys[4]; /**< WEP keys. */
lypinator 0:bb348c97df44 125 cb_uint32 txKey; /**< Active WEP transmission key index (0-3). */
lypinator 0:bb348c97df44 126 } cbWLAN_WEPConnectParameters;
lypinator 0:bb348c97df44 127
lypinator 0:bb348c97df44 128 /**
lypinator 0:bb348c97df44 129 * WPA PSK parameters.
lypinator 0:bb348c97df44 130 *
lypinator 0:bb348c97df44 131 * @ingroup wlan
lypinator 0:bb348c97df44 132 */
lypinator 0:bb348c97df44 133 typedef struct cbWLAN_WPAPSK {
lypinator 0:bb348c97df44 134 cb_uint8 key[cbWLAN_PSK_LENGTH]; /**< WPA pre-shared key in binary form. */
lypinator 0:bb348c97df44 135 } cbWLAN_WPAPSK;
lypinator 0:bb348c97df44 136
lypinator 0:bb348c97df44 137 /**
lypinator 0:bb348c97df44 138 * WPA PSK specific connect parameters.
lypinator 0:bb348c97df44 139 *
lypinator 0:bb348c97df44 140 * @ingroup wlan
lypinator 0:bb348c97df44 141 */
lypinator 0:bb348c97df44 142 typedef struct cbWLAN_WPAPSKConnectParameters {
lypinator 0:bb348c97df44 143 cbWLAN_WPAPSK psk; /**< WPA pre-shared key*/
lypinator 0:bb348c97df44 144 } cbWLAN_WPAPSKConnectParameters;
lypinator 0:bb348c97df44 145
lypinator 0:bb348c97df44 146 #if defined(CB_FEATURE_802DOT11R)
lypinator 0:bb348c97df44 147 /**
lypinator 0:bb348c97df44 148 * Associate information elements with FT elements.
lypinator 0:bb348c97df44 149 *
lypinator 0:bb348c97df44 150 * @ingroup wlan
lypinator 0:bb348c97df44 151 */
lypinator 0:bb348c97df44 152 typedef struct cbWLAN_AssociateInformationElements{
lypinator 0:bb348c97df44 153 cb_uint8 wpaIe[cbWLAN_RSNIE_SIZE];
lypinator 0:bb348c97df44 154 cb_uint32 wpaIeLen;
lypinator 0:bb348c97df44 155 cb_uint8 mdIe[cbWLAN_MDIE_SIZE];
lypinator 0:bb348c97df44 156 cb_uint32 mdIeLen;
lypinator 0:bb348c97df44 157 cb_uint8 ftIe[cbWLAN_FTIE_SIZE];
lypinator 0:bb348c97df44 158 cb_uint32 ftIeLen;
lypinator 0:bb348c97df44 159 } cbWLAN_AssociateInformationElements;
lypinator 0:bb348c97df44 160 #endif
lypinator 0:bb348c97df44 161
lypinator 0:bb348c97df44 162 #if defined(CB_FEATURE_802DOT11W)
lypinator 0:bb348c97df44 163 /**
lypinator 0:bb348c97df44 164 * 80211w PMF specific connect parameters.
lypinator 0:bb348c97df44 165 *
lypinator 0:bb348c97df44 166 * @ingroup wlan
lypinator 0:bb348c97df44 167 */
lypinator 0:bb348c97df44 168 typedef struct cbWLAN_PMFApParameters {
lypinator 0:bb348c97df44 169 cbWLAN_PMF pmf; /**< MFPR, MFPC RSN capabilties*/
lypinator 0:bb348c97df44 170 cb_uint8 comeBackTime; /**< 1 - 10 sec */
lypinator 0:bb348c97df44 171 cb_uint16 saQueryTimeOut; /**< 100 - 500 msec */
lypinator 0:bb348c97df44 172 } cbWLAN_PMFApParameters;
lypinator 0:bb348c97df44 173 #endif
lypinator 0:bb348c97df44 174
lypinator 0:bb348c97df44 175 /**
lypinator 0:bb348c97df44 176 * WPA Enterprise specific connect parameters.
lypinator 0:bb348c97df44 177 *
lypinator 0:bb348c97df44 178 * @ingroup wlan
lypinator 0:bb348c97df44 179 */
lypinator 0:bb348c97df44 180 typedef struct cbWLAN_EnterpriseConnectParameters {
lypinator 0:bb348c97df44 181 cbWLAN_EnterpriseMode authMode; /**< Enterprise authentication mode. */
lypinator 0:bb348c97df44 182 cb_uint8 username[cbWLAN_MAX_USERNAME_LENGTH]; /**< Username string. */
lypinator 0:bb348c97df44 183 cb_uint8 passphrase[cbWLAN_MAX_PASSPHRASE_LENGTH]; /**< Passphrase string. */
lypinator 0:bb348c97df44 184 cb_uint8 domain[cbWLAN_MAX_DOMAIN_LENGTH]; /**< Domain string. */
lypinator 0:bb348c97df44 185 cbCERT_Stream *clientCertificate; /**< Stream handle to provide SSL certificate for authentication. */
lypinator 0:bb348c97df44 186 cbCERT_Stream *clientPrivateKey; /**< Stream handle to provide SSL private key for authentication. */
lypinator 0:bb348c97df44 187 cbCERT_Stream *CACertificate; /**< Stream handle to provide CA certificate for server certificate validation,
lypinator 0:bb348c97df44 188 Can be NULL if server certificate shouldn't be validated. */
lypinator 0:bb348c97df44 189 } cbWLAN_EnterpriseConnectParameters;
lypinator 0:bb348c97df44 190
lypinator 0:bb348c97df44 191 /**
lypinator 0:bb348c97df44 192 * Common access point parameters.
lypinator 0:bb348c97df44 193 *
lypinator 0:bb348c97df44 194 * @ingroup wlan
lypinator 0:bb348c97df44 195 */
lypinator 0:bb348c97df44 196 typedef struct cbWLAN_CommonApParameters {
lypinator 0:bb348c97df44 197 cbWLAN_Ssid ssid; /**< SSID to connect to. */
lypinator 0:bb348c97df44 198 cbWLAN_Channel channel; /**< Active channel. */
lypinator 0:bb348c97df44 199 cbWLAN_RateMask basicRates; /**< Basic rates. */
lypinator 0:bb348c97df44 200 cbWLAN_RateMask allowedRates; /**< BSS allowed rates. */
lypinator 0:bb348c97df44 201 cb_uint8 dtimInterval; /**< Dtim Interval. */
lypinator 0:bb348c97df44 202 } cbWLAN_CommonApParameters;
lypinator 0:bb348c97df44 203
lypinator 0:bb348c97df44 204
lypinator 0:bb348c97df44 205 /**
lypinator 0:bb348c97df44 206 * WPA PSK specific AP parameters.
lypinator 0:bb348c97df44 207 *
lypinator 0:bb348c97df44 208 * @ingroup wlan
lypinator 0:bb348c97df44 209 */
lypinator 0:bb348c97df44 210 typedef struct cbWLAN_WPAPSKApParameters {
lypinator 0:bb348c97df44 211 cbWLAN_CipherSuite rsnCiphers; /**< Bit field indicating which ciphers that shall be displayed in RSN information elements. If 0 no RSN information elements is added to beacons and probe responses. */
lypinator 0:bb348c97df44 212 cbWLAN_CipherSuite wpaCiphers; /**< Bit field indicating which ciphers that shall be displayed in WPA information elements. If 0 no WPA information elements is added to beacons and probe responses. */
lypinator 0:bb348c97df44 213 cbWLAN_WPAPSK psk; /**< WPA pre-shared key*/
lypinator 0:bb348c97df44 214 #if defined(CB_FEATURE_802DOT11W)
lypinator 0:bb348c97df44 215 cbWLAN_PMFApParameters pmfParameters;
lypinator 0:bb348c97df44 216 #endif
lypinator 0:bb348c97df44 217 cb_uint32 gtkRekeyInterval; /**< Group rekey interval in seconds */
lypinator 0:bb348c97df44 218 } cbWLAN_WPAPSKApParameters;
lypinator 0:bb348c97df44 219
lypinator 0:bb348c97df44 220 /**
lypinator 0:bb348c97df44 221 * Scan parameters
lypinator 0:bb348c97df44 222 *
lypinator 0:bb348c97df44 223 * @ingroup wlan
lypinator 0:bb348c97df44 224 */
lypinator 0:bb348c97df44 225 typedef struct cbWLAN_ScanParameters {
lypinator 0:bb348c97df44 226 cbWLAN_Ssid ssid; /**< SSID to scan for, set to zero length for broadcast scan. */
lypinator 0:bb348c97df44 227 cbWLAN_Channel channel;
lypinator 0:bb348c97df44 228 } cbWLAN_ScanParameters;
lypinator 0:bb348c97df44 229
lypinator 0:bb348c97df44 230 /**
lypinator 0:bb348c97df44 231 * Scan result information reported from WLAN component. Contains info for
lypinator 0:bb348c97df44 232 * one specific BSS.
lypinator 0:bb348c97df44 233 *
lypinator 0:bb348c97df44 234 * @ingroup wlan
lypinator 0:bb348c97df44 235 */
lypinator 0:bb348c97df44 236 typedef struct cbWLAN_ScanIndicationInfo {
lypinator 0:bb348c97df44 237 cbWLAN_MACAddress bssid; /**< BSS BSSID */
lypinator 0:bb348c97df44 238 cbWLAN_Ssid ssid; /**< BSS SSID */
lypinator 0:bb348c97df44 239 cbWLAN_Channel channel; /**< BSS channel */
lypinator 0:bb348c97df44 240 cbWLAN_OperationalMode operationalMode; /**< BSS type */
lypinator 0:bb348c97df44 241 cb_int32 rssi; /**< RSSI for scan result packet. */
lypinator 0:bb348c97df44 242
lypinator 0:bb348c97df44 243 cbWLAN_AuthenticationSuite authenticationSuites; /**< Supported authentication suites */
lypinator 0:bb348c97df44 244 cbWLAN_CipherSuite unicastCiphers; /**< Supported unicast cipher suites */
lypinator 0:bb348c97df44 245 cbWLAN_CipherSuite groupCipher; /**< Supported group cipher suites */
lypinator 0:bb348c97df44 246 #if defined(CB_FEATURE_802DOT11R)
lypinator 0:bb348c97df44 247 cbWLAN_MDInformation mobilityDomainId; /**< Mobility Domain Id and Ft capability policy>*/
lypinator 0:bb348c97df44 248 #endif
lypinator 0:bb348c97df44 249 cbWLAN_RateMask basicRateSet; /**< Basic rate set, i.e. required rates. */
lypinator 0:bb348c97df44 250 cbWLAN_RateMask supportedRateSet; /**< Supported rate set, super set of basic rate set. */
lypinator 0:bb348c97df44 251 cb_uint32 beaconPeriod; /**< Beacon period in ms. */
lypinator 0:bb348c97df44 252 cb_uint32 DTIMPeriod; /**< DTIM period in beacon intervals */
lypinator 0:bb348c97df44 253 cb_uint8 countryCode[2]; /**< Two letter country code */
lypinator 0:bb348c97df44 254 cb_uint32 flags; /**< QoS, short preamble, DFS, privacy */
lypinator 0:bb348c97df44 255 cb_uint16 RSNCapabilities; /**< Protected management frames capabilities*/
lypinator 0:bb348c97df44 256 } cbWLAN_ScanIndicationInfo;
lypinator 0:bb348c97df44 257
lypinator 0:bb348c97df44 258 /**
lypinator 0:bb348c97df44 259 * Status indications indicated by @ref cbWLAN_statusIndication.
lypinator 0:bb348c97df44 260 *
lypinator 0:bb348c97df44 261 * @ingroup wlan
lypinator 0:bb348c97df44 262 */
lypinator 0:bb348c97df44 263 typedef enum {
lypinator 0:bb348c97df44 264 cbWLAN_STATUS_STOPPED,
lypinator 0:bb348c97df44 265 cbWLAN_STATUS_STARTED,
lypinator 0:bb348c97df44 266 cbWLAN_STATUS_ERROR,
lypinator 0:bb348c97df44 267 cbWLAN_STATUS_DISCONNECTED,
lypinator 0:bb348c97df44 268 cbWLAN_STATUS_CONNECTING,
lypinator 0:bb348c97df44 269 cbWLAN_STATUS_CONNECTED,
lypinator 0:bb348c97df44 270 cbWLAN_STATUS_CONNECTION_FAILURE,
lypinator 0:bb348c97df44 271 cbWLAN_STATUS_AP_UP,
lypinator 0:bb348c97df44 272 cbWLAN_STATUS_AP_DOWN,
lypinator 0:bb348c97df44 273 cbWLAN_STATUS_AP_STA_ADDED,
lypinator 0:bb348c97df44 274 cbWLAN_STATUS_AP_STA_REMOVED,
lypinator 0:bb348c97df44 275 cbWLAN_STATUS_80211r_REASSOCIATING,
lypinator 0:bb348c97df44 276 cbWLAN_STATUS_80211r_REASSOCIATED,
lypinator 0:bb348c97df44 277 } cbWLAN_StatusIndicationInfo;
lypinator 0:bb348c97df44 278
lypinator 0:bb348c97df44 279 /**
lypinator 0:bb348c97df44 280 * Disconnection reasons for @ref cbWLAN_STATUS_DISCONNECTED.
lypinator 0:bb348c97df44 281 *
lypinator 0:bb348c97df44 282 * @ingroup wlan
lypinator 0:bb348c97df44 283 */
lypinator 0:bb348c97df44 284 typedef enum {
lypinator 0:bb348c97df44 285 cbWLAN_STATUS_DISCONNECTED_UNKNOWN,
lypinator 0:bb348c97df44 286 cbWLAN_STATUS_DISCONNECTED_NO_BSSID_FOUND,
lypinator 0:bb348c97df44 287 cbWLAN_STATUS_DISCONNECTED_AUTH_TIMEOUT,
lypinator 0:bb348c97df44 288 cbWLAN_STATUS_DISCONNECTED_MIC_FAILURE,
lypinator 0:bb348c97df44 289 cbWLAN_STATUS_DISCONNECTED_ROAMING,
lypinator 0:bb348c97df44 290 } cbWLAN_StatusDisconnectedInfo;
lypinator 0:bb348c97df44 291
lypinator 0:bb348c97df44 292 /**
lypinator 0:bb348c97df44 293 * IOCTL parameters @ref cbWLAN_ioctl
lypinator 0:bb348c97df44 294 *
lypinator 0:bb348c97df44 295 * @ingroup wlan
lypinator 0:bb348c97df44 296 */
lypinator 0:bb348c97df44 297 typedef enum {
lypinator 0:bb348c97df44 298 cbWLAN_IOCTL_FIRST
lypinator 0:bb348c97df44 299 } cbWLAN_Ioctl;
lypinator 0:bb348c97df44 300
lypinator 0:bb348c97df44 301
lypinator 0:bb348c97df44 302 /**
lypinator 0:bb348c97df44 303 * Start parameters indicated from WLAN driver for status indication
lypinator 0:bb348c97df44 304 * @ref cbWLAN_STATUS_STARTED.
lypinator 0:bb348c97df44 305 *
lypinator 0:bb348c97df44 306 * @ingroup wlan
lypinator 0:bb348c97df44 307 */
lypinator 0:bb348c97df44 308 typedef struct cbWLAN_StatusStartedInfo {
lypinator 0:bb348c97df44 309 cbWLAN_MACAddress macAddress; /**< MAC address of WLAN driver. */
lypinator 0:bb348c97df44 310 } cbWLAN_StatusStartedInfo;
lypinator 0:bb348c97df44 311
lypinator 0:bb348c97df44 312 /**
lypinator 0:bb348c97df44 313 * Connected parameters indicated from WLAN driver for status indication
lypinator 0:bb348c97df44 314 * @ref cbWLAN_STATUS_CONNECTED.
lypinator 0:bb348c97df44 315 *
lypinator 0:bb348c97df44 316 * @ingroup wlan
lypinator 0:bb348c97df44 317 */
lypinator 0:bb348c97df44 318 typedef struct cbWLAN_StatusConnectedInfo {
lypinator 0:bb348c97df44 319 cbWLAN_MACAddress bssid; /**< BSSID of the BSS connected to. */
lypinator 0:bb348c97df44 320 cbWLAN_Channel channel; /**< Operating channels of the BSS connected to. */
lypinator 0:bb348c97df44 321 cb_uint16 mobilityDomainId;
lypinator 0:bb348c97df44 322 } cbWLAN_StatusConnectedInfo;
lypinator 0:bb348c97df44 323
lypinator 0:bb348c97df44 324 /**
lypinator 0:bb348c97df44 325 * Received Ethernet data packet information and properties.
lypinator 0:bb348c97df44 326 *
lypinator 0:bb348c97df44 327 * @ingroup wlan
lypinator 0:bb348c97df44 328 */
lypinator 0:bb348c97df44 329 typedef struct cbWLAN_PacketIndicationInfo {
lypinator 0:bb348c97df44 330 void *rxData; /**< Pointer to the port specific data type. */
lypinator 0:bb348c97df44 331 cb_uint32 size; /**< Length of the data payload in the port specific packet data type. */
lypinator 0:bb348c97df44 332 cb_boolean isChecksumVerified; /**< True if the TCP/UDP checksum is verified and correct. */
lypinator 0:bb348c97df44 333 } cbWLAN_PacketIndicationInfo;
lypinator 0:bb348c97df44 334
lypinator 0:bb348c97df44 335 /**
lypinator 0:bb348c97df44 336 * Status updates from WLAN component.
lypinator 0:bb348c97df44 337 * @note The callback must not make any call back to WLAN.
lypinator 0:bb348c97df44 338 *
lypinator 0:bb348c97df44 339 * @param callbackContext Context pointer provided in @ref cbWLAN_registerStatusCallback.
lypinator 0:bb348c97df44 340 * @param status Status indication type.
lypinator 0:bb348c97df44 341 * @param data Additional status indication data, depends on indication type.
lypinator 0:bb348c97df44 342 *
lypinator 0:bb348c97df44 343 * @sa cbWLAN_registerStatusCallback
lypinator 0:bb348c97df44 344 */
lypinator 0:bb348c97df44 345 typedef void (*cbWLAN_statusIndication)(void *callbackContext, cbWLAN_StatusIndicationInfo status, void *data);
lypinator 0:bb348c97df44 346
lypinator 0:bb348c97df44 347
lypinator 0:bb348c97df44 348 /**
lypinator 0:bb348c97df44 349 * Indication of received Ethernet data packet.
lypinator 0:bb348c97df44 350 *
lypinator 0:bb348c97df44 351 * @param callbackContext Context pointer provided in @ref cbWLAN_registerPacketIndicationCallback.
lypinator 0:bb348c97df44 352 * @param packetInfo Pointer to struct containing packet information and data pointers.
lypinator 0:bb348c97df44 353 */
lypinator 0:bb348c97df44 354 typedef void (*cbWLAN_packetIndication)(void *callbackContext, cbWLAN_PacketIndicationInfo *packetInfo);
lypinator 0:bb348c97df44 355
lypinator 0:bb348c97df44 356 /**
lypinator 0:bb348c97df44 357 * Scan result indication from WLAN component.
lypinator 0:bb348c97df44 358 *
lypinator 0:bb348c97df44 359 * @param callbackContext Context pointer provided in @ref cbWLAN_scan.
lypinator 0:bb348c97df44 360 * @param bssDescriptor Pointer to struct containing scan result information.
lypinator 0:bb348c97df44 361 * @param isLastResult @ref TRUE if scan scan is finished.
lypinator 0:bb348c97df44 362 */
lypinator 0:bb348c97df44 363 typedef void (*cbWLAN_scanIndication)(void *callbackContext, cbWLAN_ScanIndicationInfo *bssDescriptor, cb_boolean isLastResult);
lypinator 0:bb348c97df44 364
lypinator 0:bb348c97df44 365 /*===========================================================================
lypinator 0:bb348c97df44 366 * WLAN API
lypinator 0:bb348c97df44 367 *=========================================================================*/
lypinator 0:bb348c97df44 368
lypinator 0:bb348c97df44 369 /**
lypinator 0:bb348c97df44 370 * Initialize WLAN component.
lypinator 0:bb348c97df44 371 *
lypinator 0:bb348c97df44 372 * @return @ref cbSTATUS_OK if successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 373 */
lypinator 0:bb348c97df44 374 cbRTSL_Status cbWLAN_init();
lypinator 0:bb348c97df44 375
lypinator 0:bb348c97df44 376
lypinator 0:bb348c97df44 377 /**
lypinator 0:bb348c97df44 378 * Stop WLAN component.
lypinator 0:bb348c97df44 379 * Stop and destroy WLAN driver instance.
lypinator 0:bb348c97df44 380 *
lypinator 0:bb348c97df44 381 * @return @ref cbSTATUS_OK if successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 382 */
lypinator 0:bb348c97df44 383 cbRTSL_Status cbWLAN_stop(void);
lypinator 0:bb348c97df44 384
lypinator 0:bb348c97df44 385 /**
lypinator 0:bb348c97df44 386 * Connect to access point in open mode (no encryption).
lypinator 0:bb348c97df44 387 * Connection progress is reported as @ref cbWLAN_statusIndication callbacks.
lypinator 0:bb348c97df44 388 *
lypinator 0:bb348c97df44 389 * @param commonParams Connection parameters.
lypinator 0:bb348c97df44 390 * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 391 */
lypinator 0:bb348c97df44 392 cbRTSL_Status cbWLAN_connectOpen(cbWLAN_CommonConnectParameters *commonParams);
lypinator 0:bb348c97df44 393
lypinator 0:bb348c97df44 394 /**
lypinator 0:bb348c97df44 395 * Connect to access point in open mode with WEP encryption.
lypinator 0:bb348c97df44 396 * Connection progress is reported as @ref cbWLAN_statusIndication callbacks.
lypinator 0:bb348c97df44 397 *
lypinator 0:bb348c97df44 398 * @param commonParams Connection parameters.
lypinator 0:bb348c97df44 399 * @param wepParams WEP specific connection parameters.
lypinator 0:bb348c97df44 400 * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 401 */
lypinator 0:bb348c97df44 402 cbRTSL_Status cbWLAN_connectWEP(cbWLAN_CommonConnectParameters *commonParams, cbWLAN_WEPConnectParameters *wepParams);
lypinator 0:bb348c97df44 403
lypinator 0:bb348c97df44 404 /**
lypinator 0:bb348c97df44 405 * Connect to access point with WPA PSK authentication.
lypinator 0:bb348c97df44 406 * Connection progress is reported as @ref cbWLAN_statusIndication callbacks.
lypinator 0:bb348c97df44 407 *
lypinator 0:bb348c97df44 408 * @param commonParams Connection parameters.
lypinator 0:bb348c97df44 409 * @param wpaParams WPA PSK specific connection parameters.
lypinator 0:bb348c97df44 410 * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 411 */
lypinator 0:bb348c97df44 412 cbRTSL_Status cbWLAN_connectWPAPSK(cbWLAN_CommonConnectParameters *commonParams, cbWLAN_WPAPSKConnectParameters *wpaParams);
lypinator 0:bb348c97df44 413
lypinator 0:bb348c97df44 414 /**
lypinator 0:bb348c97df44 415 * Connect to access point with WPA Enterprise authentication.
lypinator 0:bb348c97df44 416 * Connection progress is reported as @ref cbWLAN_statusIndication callbacks.
lypinator 0:bb348c97df44 417 *
lypinator 0:bb348c97df44 418 * @param commonParams Connection parameters.
lypinator 0:bb348c97df44 419 * @param enterpriseParams WPA Enterprise specific connection parameters.
lypinator 0:bb348c97df44 420 * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 421 */
lypinator 0:bb348c97df44 422 cbRTSL_Status cbWLAN_connectEnterprise(cbWLAN_CommonConnectParameters *commonParams, cbWLAN_EnterpriseConnectParameters *enterpriseParams);
lypinator 0:bb348c97df44 423
lypinator 0:bb348c97df44 424 /**
lypinator 0:bb348c97df44 425 * Disconnect from access point or stop ongoing connection attempt.
lypinator 0:bb348c97df44 426 * Disconnection progress is reported as @ref cbWLAN_statusIndication callback.
lypinator 0:bb348c97df44 427 *
lypinator 0:bb348c97df44 428 * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 429 */
lypinator 0:bb348c97df44 430 cbRTSL_Status cbWLAN_disconnect(void);
lypinator 0:bb348c97df44 431
lypinator 0:bb348c97df44 432 /**
lypinator 0:bb348c97df44 433 * Initiate BSS scan.
lypinator 0:bb348c97df44 434 * If specific channel is set in scan parameters, only that channel is
lypinator 0:bb348c97df44 435 * scanned. If SSID is specified, a directed probe request against that SSID
lypinator 0:bb348c97df44 436 * will be used. Scan results are reported in @ref cbWLAN_scanIndication
lypinator 0:bb348c97df44 437 * callbacks.
lypinator 0:bb348c97df44 438 * @note Depending on channel using DFS or not, passive scans may be used
lypinator 0:bb348c97df44 439 * instead of active probe requests.
lypinator 0:bb348c97df44 440 *
lypinator 0:bb348c97df44 441 * @param params Scan parameters
lypinator 0:bb348c97df44 442 * @param scanIndication Callback function for scan results.
lypinator 0:bb348c97df44 443 * @param callbackContext Context pointer, will be sent back in callback.
lypinator 0:bb348c97df44 444 * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 445 */
lypinator 0:bb348c97df44 446 cbRTSL_Status cbWLAN_scan(cbWLAN_ScanParameters *params, cbWLAN_scanIndication scanIndication, void *callbackContext);
lypinator 0:bb348c97df44 447
lypinator 0:bb348c97df44 448
lypinator 0:bb348c97df44 449 /**
lypinator 0:bb348c97df44 450 * Retrieve an RSSI value for station mode.
lypinator 0:bb348c97df44 451 *
lypinator 0:bb348c97df44 452 * @note Depending on connection state and data transfer interval
lypinator 0:bb348c97df44 453 * the value may be incorrect.
lypinator 0:bb348c97df44 454 *
lypinator 0:bb348c97df44 455 * @return RSSI value in dBm
lypinator 0:bb348c97df44 456 */
lypinator 0:bb348c97df44 457 cb_int16 cbWLAN_STA_getRSSI();
lypinator 0:bb348c97df44 458
lypinator 0:bb348c97df44 459 /**
lypinator 0:bb348c97df44 460 * Start access point in open mode (no encryption).
lypinator 0:bb348c97df44 461 * Connection progress is reported as @ref cbWLAN_statusIndication callbacks.
lypinator 0:bb348c97df44 462 *
lypinator 0:bb348c97df44 463 * @param commonParams Common Accesspoint parameters.
lypinator 0:bb348c97df44 464 * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 465 */
lypinator 0:bb348c97df44 466 cbRTSL_Status cbWLAN_apStartOpen(cbWLAN_CommonApParameters *commonParams);
lypinator 0:bb348c97df44 467
lypinator 0:bb348c97df44 468 /**
lypinator 0:bb348c97df44 469 * Start access point with WPA PSK authentication.
lypinator 0:bb348c97df44 470 * Connection progress is reported as @ref cbWLAN_statusIndication callbacks.
lypinator 0:bb348c97df44 471 *
lypinator 0:bb348c97df44 472 * @param commonParams Common Accesspoint parameters.
lypinator 0:bb348c97df44 473 * @param wpaParams WPA PSK specific parameters.
lypinator 0:bb348c97df44 474 * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 475 */
lypinator 0:bb348c97df44 476 cbRTSL_Status cbWLAN_apStartWPAPSK(cbWLAN_CommonApParameters *commonParams, cbWLAN_WPAPSKApParameters *wpaParams);
lypinator 0:bb348c97df44 477
lypinator 0:bb348c97df44 478 /**
lypinator 0:bb348c97df44 479 * Stop access point.
lypinator 0:bb348c97df44 480 *
lypinator 0:bb348c97df44 481 * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 482 */
lypinator 0:bb348c97df44 483 cbRTSL_Status cbWLAN_apStop(void);
lypinator 0:bb348c97df44 484
lypinator 0:bb348c97df44 485 /**
lypinator 0:bb348c97df44 486 * Send an Ethernet data packet.
lypinator 0:bb348c97df44 487 * @note Data send when not in connected state is just dropped.
lypinator 0:bb348c97df44 488 *
lypinator 0:bb348c97df44 489 * @param txData Pointer to the port specific Ethernet data type containing transmit data
lypinator 0:bb348c97df44 490 */
lypinator 0:bb348c97df44 491 void cbWLAN_sendPacket(void *txData);
lypinator 0:bb348c97df44 492
lypinator 0:bb348c97df44 493 /**
lypinator 0:bb348c97df44 494 * Register a status indication callback.
lypinator 0:bb348c97df44 495 * @note There may be multiple clients connected.
lypinator 0:bb348c97df44 496 *
lypinator 0:bb348c97df44 497 * @param statusIndication Callback function.
lypinator 0:bb348c97df44 498 * @param callbackContext Context pointer, will be sent back in callback.
lypinator 0:bb348c97df44 499 * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 500 */
lypinator 0:bb348c97df44 501 cbRTSL_Status cbWLAN_registerStatusCallback(cbWLAN_statusIndication statusIndication, void *callbackContext);
lypinator 0:bb348c97df44 502
lypinator 0:bb348c97df44 503
lypinator 0:bb348c97df44 504 /**
lypinator 0:bb348c97df44 505 * Register a status indication callback.
lypinator 0:bb348c97df44 506 *
lypinator 0:bb348c97df44 507 * @param packetIndication Callback function.
lypinator 0:bb348c97df44 508 * @param callbackContext Context pointer, will be sent back in callback.
lypinator 0:bb348c97df44 509 * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 510 */
lypinator 0:bb348c97df44 511 cbRTSL_Status cbWLAN_registerPacketIndicationCallback(cbWLAN_packetIndication packetIndication, void *callbackContext);
lypinator 0:bb348c97df44 512
lypinator 0:bb348c97df44 513 /**
lypinator 0:bb348c97df44 514 * Deregister the specified status indication callback.
lypinator 0:bb348c97df44 515 *
lypinator 0:bb348c97df44 516 * @param statusIndication Callback function.
lypinator 0:bb348c97df44 517 * @param callbackContext Context pointer, will be sent back in callback.
lypinator 0:bb348c97df44 518 * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 519 */
lypinator 0:bb348c97df44 520 cbRTSL_Status cbWLAN_deregisterStatusCallback(cbWLAN_statusIndication statusIndication, void *callbackContext);
lypinator 0:bb348c97df44 521
lypinator 0:bb348c97df44 522
lypinator 0:bb348c97df44 523 cbRTSL_Status cbWLAN_Util_PSKFromPWD(cb_char passphrase[cbWLAN_MAX_PASSPHRASE_LENGTH], cbWLAN_Ssid ssid, cb_uint8 psk[cbWLAN_PSK_LENGTH]);
lypinator 0:bb348c97df44 524
lypinator 0:bb348c97df44 525 /**
lypinator 0:bb348c97df44 526 * Set the channel list to be used for connection and scanning.
lypinator 0:bb348c97df44 527 * The list will be filtered according to the allowed channel list
lypinator 0:bb348c97df44 528 * set. The list can include both 2.4GHz and 5GHz channels.
lypinator 0:bb348c97df44 529 * If channel list parameter is NULL the default channel list is
lypinator 0:bb348c97df44 530 * restored.
lypinator 0:bb348c97df44 531 *
lypinator 0:bb348c97df44 532 * @param channelList Pointer to channel list for the driver to use.
lypinator 0:bb348c97df44 533 *
lypinator 0:bb348c97df44 534 * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 535 */
lypinator 0:bb348c97df44 536 cbRTSL_Status cbWLAN_setChannelList(const cbWLAN_ChannelList *channelList);
lypinator 0:bb348c97df44 537
lypinator 0:bb348c97df44 538 /**
lypinator 0:bb348c97df44 539 * Returns the wanted channel list.
lypinator 0:bb348c97df44 540 *
lypinator 0:bb348c97df44 541 * @param channelList Pointer to channel list
lypinator 0:bb348c97df44 542 *
lypinator 0:bb348c97df44 543 * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 544 */
lypinator 0:bb348c97df44 545 cbRTSL_Status cbWLAN_getChannelList(cbWLAN_ChannelList *channelList);
lypinator 0:bb348c97df44 546
lypinator 0:bb348c97df44 547 /**
lypinator 0:bb348c97df44 548 * Returns the channel list currently used. This channel list
lypinator 0:bb348c97df44 549 * depend on the channel list specified by the user and the
lypinator 0:bb348c97df44 550 * current regulatory domain.
lypinator 0:bb348c97df44 551 *
lypinator 0:bb348c97df44 552 * @param channelList Pointer to channel list
lypinator 0:bb348c97df44 553 *
lypinator 0:bb348c97df44 554 * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 555 */
lypinator 0:bb348c97df44 556 cbRTSL_Status cbWLAN_getActiveChannelList(cbWLAN_ChannelList *channelList);
lypinator 0:bb348c97df44 557
lypinator 0:bb348c97df44 558 /**
lypinator 0:bb348c97df44 559 * WLAN control settings. Both in and out parameters are supported.
lypinator 0:bb348c97df44 560 * If an ioctl request is not supported cbSTATUS_ERROR is returned and
lypinator 0:bb348c97df44 561 * the value parameter shall be ignored.
lypinator 0:bb348c97df44 562 *
lypinator 0:bb348c97df44 563 * @param ioctl Parameter that shall be set. @ref cbWLAN_Ioctl lists all supported parameters.
lypinator 0:bb348c97df44 564 * @param value Value. @ref cbWLAN_Ioctl lists the type for all supported parameters.
lypinator 0:bb348c97df44 565 *
lypinator 0:bb348c97df44 566 * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 567 */
lypinator 0:bb348c97df44 568 cbRTSL_Status cbWLAN_ioctl(cbWLAN_Ioctl ioctl, void* value);
lypinator 0:bb348c97df44 569
lypinator 0:bb348c97df44 570 cbRTSL_Status cbWLAN_getVersion(cbWM_Version* version);
lypinator 0:bb348c97df44 571
lypinator 0:bb348c97df44 572 #if defined(CB_FEATURE_802DOT11R)
lypinator 0:bb348c97df44 573
lypinator 0:bb348c97df44 574 /**
lypinator 0:bb348c97df44 575 * Called for changing the BSS
lypinator 0:bb348c97df44 576 *
lypinator 0:bb348c97df44 577 * @param params Parameter containing the BSS parameters.
lypinator 0:bb348c97df44 578 *
lypinator 0:bb348c97df44 579 * @return @ref cbSTATUS_OK if call successful, otherwise cbSTATUS_ERROR.
lypinator 0:bb348c97df44 580 */
lypinator 0:bb348c97df44 581 cbRTSL_Status cbWLAN_changeBSS(cbWLAN_BSSChangeParameters params);
lypinator 0:bb348c97df44 582 #endif
lypinator 0:bb348c97df44 583 #ifdef __cplusplus
lypinator 0:bb348c97df44 584 }
lypinator 0:bb348c97df44 585 #endif
lypinator 0:bb348c97df44 586
lypinator 0:bb348c97df44 587 #endif /* _CB_WLAN_H_ */
lypinator 0:bb348c97df44 588