1 /* 2 * mlmeApi.h 3 * 4 * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * * Neither the name Texas Instruments nor the names of its 18 * contributors may be used to endorse or promote products derived 19 * from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 /** \file mlmeApi.h 35 * \brief MLME API 36 * 37 * \see mlmeSm.c 38 */ 39 40 /***************************************************************************/ 41 /* */ 42 /* MODULE: mlmeApi.h */ 43 /* PURPOSE: MLME API */ 44 /* */ 45 /***************************************************************************/ 46 #ifndef __MLME_API_H__ 47 #define __MLME_API_H__ 48 49 #include "tidef.h" 50 #include "paramOut.h" 51 #include "802_11Defs.h" 52 #include "TWDriver.h" 53 #include "DrvMainModules.h" 54 55 /* Constants */ 56 57 /* Enumerations */ 58 59 typedef enum 60 { 61 MLME_LEGACY_TYPE_PARAM = 0x01, 62 MLME_RE_ASSOC_PARAM = 0x02, 63 MLME_TNET_WAKE_ON_PARAM = 0x03, 64 MLME_CAPABILITY_PARAM = 0x04 65 66 } EMlmeParam; 67 68 69 typedef enum 70 { 71 AUTH_LEGACY_TYPE_PARAM = 0x01 72 73 } EAuthLegacyParam; 74 75 76 typedef enum 77 { 78 MSG_BROADCAST, 79 MSG_MULTICAST, 80 MSG_UNICAST 81 } mlmeMsgDestType_t; 82 83 /* Typedefs */ 84 85 /* Disassociation frame structure */ 86 typedef struct 87 { 88 TI_UINT16 reason; 89 } disAssoc_t; 90 91 92 /* (Re)Association response frame structure */ 93 #define ASSOC_RESP_FIXED_DATA_LEN 6 94 #define ASSOC_RESP_AID_MASK 0x3FFF /* The AID is only in 14 LS bits. */ 95 96 typedef struct 97 { 98 TI_UINT16 capabilities; 99 TI_UINT16 status; 100 TI_UINT16 aid; 101 dot11_RATES_t *pRates; 102 dot11_RATES_t *pExtRates; 103 TI_UINT8 useProtection; 104 TI_BOOL ciscoIEPresent; 105 EPreamble barkerPreambleMode; 106 TI_UINT8 NonErpPresent; 107 dot11_WME_PARAM_t *WMEParams; 108 dot11_RSN_t *pRsnIe; 109 TI_UINT8 rsnIeLen; 110 dot11_QOS_CAPABILITY_IE_t *QoSCapParameters; 111 Tdot11HtCapabilitiesUnparse *pHtCapabilities; 112 Tdot11HtInformationUnparse *pHtInformation; 113 TI_UINT8 *tspecVoiceParameters; /* dot11_WME_TSPEC_IE_t is unpacked so need to access as bytes. */ 114 TI_UINT8 *tspecSignalParameters; /* dot11_WME_TSPEC_IE_t is unpacked so need to access as bytes. */ 115 XCCv4IEs_t XCCIEs[MAX_NUM_OF_AC]; 116 } assocRsp_t; 117 118 119 /* Probe response frame structure */ 120 /* Please notice, the order of fields in the beacon must be identical to the order of 121 field in the probe response. This is because of the parsing that is done by the site manager. */ 122 typedef struct 123 { 124 char timestamp[TIME_STAMP_LEN]; 125 TI_UINT16 beaconInerval; 126 TI_UINT16 capabilities; 127 dot11_SSID_t *pSsid; 128 dot11_RATES_t *pRates; 129 dot11_COUNTRY_t *country; 130 dot11_POWER_CONSTRAINT_t *powerConstraint; 131 dot11_CHANNEL_SWITCH_t *channelSwitch; 132 dot11_QUIET_t *quiet; 133 dot11_TPC_REPORT_t *TPCReport; 134 135 #ifdef XCC_MODULE_INCLUDED 136 dot11_CELL_TP_t *cellTP; 137 #endif 138 139 dot11_WME_PARAM_t *WMEParams; 140 dot11_WSC_t *WSCParams; 141 dot11_RATES_t *pExtRates; 142 TI_UINT8 useProtection; 143 EPreamble barkerPreambleMode; 144 TI_UINT8 NonErpPresent; 145 dot11_FH_PARAMS_t *pFHParamsSet; 146 dot11_DS_PARAMS_t *pDSParamsSet; 147 dot11_CF_PARAMS_t *pCFParamsSet; 148 dot11_IBSS_PARAMS_t *pIBSSParamsSet; 149 dot11_RSN_t *pRsnIe; 150 TI_UINT8 rsnIeLen; 151 dot11_QOS_CAPABILITY_IE_t *QoSCapParameters; 152 Tdot11HtCapabilitiesUnparse *pHtCapabilities; 153 Tdot11HtInformationUnparse *pHtInformation; 154 dot11_TIM_t *pTIM; /* for beacons only */ 155 } beacon_probeRsp_t; 156 157 158 /* Authentication message frame structure */ 159 typedef struct 160 { 161 TI_UINT16 authAlgo; 162 TI_UINT16 seqNum; 163 TI_UINT16 status; 164 dot11_CHALLENGE_t *pChallenge; 165 } authMsg_t; 166 167 /* DeAuthentication message frame structure */ 168 typedef struct 169 { 170 TI_UINT16 reason; 171 } deAuth_t; 172 173 /* Action message frame structure */ 174 typedef struct 175 { 176 TI_UINT8 frameType; 177 TI_UINT8 category; 178 TI_UINT8 action; 179 } action_t; 180 181 182 typedef struct 183 { 184 dot11MgmtSubType_e subType; 185 186 union 187 { 188 beacon_probeRsp_t iePacket; 189 disAssoc_t disAssoc; 190 assocRsp_t assocRsp; 191 authMsg_t auth; 192 deAuth_t deAuth; 193 action_t action; 194 } content; 195 196 union 197 { 198 mlmeMsgDestType_t destType; 199 } extesion; 200 201 } mlmeFrameInfo_t; 202 203 typedef struct 204 { 205 dot11_SSID_t ssid; 206 TMacAddr bssid; 207 dot11_CHALLENGE_t challenge; 208 dot11_RATES_t rates; 209 dot11_RATES_t extRates; 210 dot11_FH_PARAMS_t fhParams; 211 dot11_CF_PARAMS_t cfParams; 212 dot11_DS_PARAMS_t dsParams; 213 dot11_IBSS_PARAMS_t ibssParams; 214 dot11_COUNTRY_t country; 215 dot11_WME_PARAM_t WMEParams; 216 dot11_WSC_t WSCParams; 217 dot11_POWER_CONSTRAINT_t powerConstraint; 218 dot11_CHANNEL_SWITCH_t channelSwitch; 219 dot11_QUIET_t quiet; 220 dot11_TPC_REPORT_t TPCReport; 221 #ifdef XCC_MODULE_INCLUDED 222 dot11_CELL_TP_t cellTP; 223 #endif 224 dot11_RSN_t rsnIe[3]; 225 dot11_TIM_t tim; 226 dot11_QOS_CAPABILITY_IE_t QosCapParams; 227 Tdot11HtCapabilitiesUnparse tHtCapabilities; 228 Tdot11HtInformationUnparse tHtInformation; 229 TI_UINT8 rxChannel; 230 TI_UINT8 band; 231 TI_BOOL myBssid; 232 TI_BOOL myDst; 233 TI_BOOL mySa; 234 235 TI_BOOL recvChannelSwitchAnnoncIE; 236 mlmeFrameInfo_t frame; 237 }mlmeIEParsingParams_t; 238 239 typedef void (*mlme_resultCB_t)( TI_HANDLE hObj, TMacAddr* bssid, mlmeFrameInfo_t* pFrameInfo, 240 TRxAttr* pRxAttr, TI_UINT8* frame, TI_UINT16 frameLength ); 241 242 /* External data definitions */ 243 244 /* External functions definitions */ 245 246 /* Function prototypes */ 247 248 /* MLME SM API */ 249 250 TI_HANDLE mlme_create(TI_HANDLE hOs); 251 252 TI_STATUS mlme_unload(TI_HANDLE hMlme); 253 254 void mlme_init (TStadHandlesList *pStadHandles); 255 256 void mlme_SetDefaults (TI_HANDLE hMlmeSm, TMlmeInitParams *pMlmeInitParams); 257 258 TI_STATUS mlme_setParam(TI_HANDLE hMlmeSm, 259 paramInfo_t *pParam); 260 261 TI_STATUS mlme_getParam(TI_HANDLE hMlmeSm, 262 paramInfo_t *pParam); 263 264 TI_STATUS mlme_start(TI_HANDLE hMlme); 265 266 TI_STATUS mlme_stop(TI_HANDLE hMlme, DisconnectType_e disConnType, mgmtStatus_e reason); 267 268 TI_STATUS mlme_reportAuthStatus(TI_HANDLE hMlme, TI_UINT16 status); 269 270 TI_STATUS mlme_reportAssocStatus(TI_HANDLE hMlme, TI_UINT16 status); 271 272 /* MLME parser API */ 273 274 TI_STATUS mlmeParser_recv(TI_HANDLE hMlme, void *pBuffer, TRxAttr* pRxAttr); 275 276 TI_STATUS mlmeParser_parseIEs(TI_HANDLE hMlme, 277 TI_UINT8 *pData, 278 TI_INT32 bodyDataLen, 279 mlmeIEParsingParams_t *params); 280 TI_BOOL mlmeParser_ParseIeBuffer (TI_HANDLE hMlme, TI_UINT8 *pIeBuffer, TI_UINT32 length, TI_UINT8 desiredIeId, TI_UINT8 **pDesiredIe, TI_UINT8 *pMatchBuffer, TI_UINT32 matchBufferLen); 281 282 #ifdef XCC_MODULE_INCLUDED 283 void mlmeParser_readXCCOui (TI_UINT8 *pData, 284 TI_UINT32 dataLen, 285 TI_UINT32 *pReadLen, 286 XCCv4IEs_t *XCCIEs); 287 #endif 288 289 mlmeIEParsingParams_t *mlmeParser_getParseIEsBuffer(TI_HANDLE *hMlme); 290 291 /* Association SM API */ 292 293 TI_HANDLE assoc_create(TI_HANDLE pOs); 294 295 TI_STATUS assoc_unload(TI_HANDLE pAssoc); 296 297 void assoc_init (TStadHandlesList *pStadHandles); 298 299 TI_STATUS assoc_SetDefaults (TI_HANDLE hAssoc, assocInitParams_t *pAssocInitParams); 300 301 TI_STATUS assoc_setParam(TI_HANDLE hCtrlData, paramInfo_t *pParam); 302 303 TI_STATUS assoc_getParam(TI_HANDLE hCtrlData, paramInfo_t *pParam); 304 305 /* Authentication SM API */ 306 307 TI_HANDLE auth_create(TI_HANDLE hOs); 308 309 TI_STATUS auth_unload(TI_HANDLE hAuth); 310 311 void auth_init (TStadHandlesList *pStadHandles); 312 313 TI_STATUS auth_SetDefaults (TI_HANDLE hAuth, authInitParams_t *pAuthInitParams); 314 315 TI_STATUS auth_setParam(TI_HANDLE hCtrlData, paramInfo_t *pParam); 316 317 TI_STATUS auth_getParam(TI_HANDLE hCtrlData, paramInfo_t *pParam); 318 319 #endif /* __MLME_API_H__*/ 320