2 * \brief Admission control API implimentation
6 /****************************************************************************
7 **+-----------------------------------------------------------------------+**
9 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |**
10 **| All rights reserved. |**
12 **| Redistribution and use in source and binary forms, with or without |**
13 **| modification, are permitted provided that the following conditions |**
16 **| * Redistributions of source code must retain the above copyright |**
17 **| notice, this list of conditions and the following disclaimer. |**
18 **| * Redistributions in binary form must reproduce the above copyright |**
19 **| notice, this list of conditions and the following disclaimer in |**
20 **| the documentation and/or other materials provided with the |**
22 **| * Neither the name Texas Instruments nor the names of its |**
23 **| contributors may be used to endorse or promote products derived |**
24 **| from this software without specific prior written permission. |**
26 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |**
27 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |**
28 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
29 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |**
30 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
31 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |**
32 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
33 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
34 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |**
35 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
36 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |**
38 **+-----------------------------------------------------------------------+**
39 ****************************************************************************/
41 /****************************************************************************
43 * MODULE: Admission Control *
44 * PURPOSE: Admission Control Module API *
46 ****************************************************************************/
57 #include "DataCtrl_Api.h"
64 #ifdef EXC_MODULE_INCLUDED
65 #include "admCtrlWpa.h"
66 #include "admCtrlExc.h"
78 /* External data definitions */
80 /* Local functions definitions */
82 /* Global variables */
84 /* Function prototypes */
85 TI_STATUS admCtrlWep_getInfoElement(admCtrl_t *pAdmCtrl, UINT8 *pIe, UINT8 *pLength);
87 TI_STATUS admCtrlWep_setSite(admCtrl_t *pAdmCtrl, rsnData_t *pRsnData, UINT8 *pAssocIe, UINT8 *pAssocIeLen);
89 TI_STATUS admCtrlWep_evalSite(admCtrl_t *pAdmCtrl, rsnData_t *pRsnData, bssType_e bssType, UINT32 *pEvaluation);
94 * admCtrlWep_config - Configure EXC admission control.
98 * Configure EXC admission control.
102 * I - pAdmCtrl - context \n
106 * OK on success, NOK on failure.
110 TI_STATUS admCtrlWep_config(admCtrl_t *pAdmCtrl)
113 rsn_paeConfig_t paeConfig;
116 /* set admission control parameters */
117 pAdmCtrl->externalAuthMode = (externalAuthMode_e)pAdmCtrl->authSuite;
118 if ((pAdmCtrl->unicastSuite != RSN_CIPHER_WEP) &&
119 (pAdmCtrl->unicastSuite != RSN_CIPHER_CKIP))
121 pAdmCtrl->unicastSuite = RSN_CIPHER_WEP;
124 if ((pAdmCtrl->broadcastSuite != RSN_CIPHER_WEP) &&
125 (pAdmCtrl->broadcastSuite != RSN_CIPHER_CKIP))
127 pAdmCtrl->broadcastSuite = RSN_CIPHER_WEP;
130 /* set callback functions (API) */
131 pAdmCtrl->getInfoElement = admCtrlWep_getInfoElement;
132 pAdmCtrl->setSite = admCtrlWep_setSite;
133 pAdmCtrl->evalSite = admCtrlWep_evalSite;
134 pAdmCtrl->getPreAuthStatus = admCtrl_nullGetPreAuthStatus;
135 pAdmCtrl->startPreAuth = admCtrl_nullStartPreAuth;
136 pAdmCtrl->get802_1x_AkmExists = admCtrl_nullGet802_1x_AkmExists;
140 pAdmCtrl->keyMngSuite = RSN_KEY_MNG_802_1X;
142 /* set PAE parametrs */
143 paeConfig.authProtocol = pAdmCtrl->externalAuthMode;
144 paeConfig.unicastSuite = pAdmCtrl->unicastSuite;
145 paeConfig.broadcastSuite = pAdmCtrl->broadcastSuite;
146 paeConfig.keyExchangeProtocol = pAdmCtrl->keyMngSuite;
147 /* set default PAE configuration */
148 status = pAdmCtrl->pRsn->setPaeConfig(pAdmCtrl->pRsn, &paeConfig);
156 * admCtrlWep_getInfoElement - Build the current information element.
160 * Build the current information element.
164 * I - pAdmCtrl - context \n
165 * I - pIe - IE buffer \n
166 * I - pLength - length of IE \n
170 * OK on success, NOK on failure.
174 TI_STATUS admCtrlWep_getInfoElement(admCtrl_t *pAdmCtrl, UINT8 *pIe, UINT8 *pLength)
177 if ((pAdmCtrl==NULL) || (pLength==NULL))
187 * admCtrlWep_setSite - Set current primary site parameters for registration.
191 * Set current primary site parameters for registration.
195 * I - pAdmCtrl - context \n
196 * I - pRsnData - site's RSN data \n
197 * O - pAssocIe - result IE of evaluation \n
198 * O - pAssocIeLen - length of result IE of evaluation \n
202 * OK on site is aproved, NOK on site is rejected.
206 TI_STATUS admCtrlWep_setSite(admCtrl_t *pAdmCtrl, rsnData_t *pRsnData, UINT8 *pAssocIe, UINT8 *pAssocIeLen)
210 whalParamInfo_t whalParam;
211 authSuite_e authSuite;
213 #ifdef EXC_MODULE_INCLUDED
214 if (parseIeBuffer(pAdmCtrl->hOs, pRsnData->pIe, pRsnData->ieLen, EXC_EXT_1_IE_ID, NULL, NULL, 0))
216 pAdmCtrl->excSupport = TRUE;
217 return (admCtrlExc_setSite(pAdmCtrl, pRsnData, pAssocIe, pAssocIeLen));
222 pAdmCtrl->excSupport = FALSE;
223 pAdmCtrl->unicastSuite = RSN_CIPHER_WEP;
224 pAdmCtrl->broadcastSuite = RSN_CIPHER_WEP;
226 admCtrlWep_config(pAdmCtrl);
228 authSuite = pAdmCtrl->authSuite;
230 /* Config the default keys */
231 if ((authSuite == RSN_AUTH_SHARED_KEY) || (authSuite == RSN_AUTH_AUTO_SWITCH))
232 { /* Configure Security status in HAL */
233 whalParam.paramType = HAL_CTRL_RSN_SECURITY_MODE_PARAM;
234 whalParam.content.rsnEncryptionStatus = (halCtrl_CipherSuite_e)RSN_CIPHER_WEP;
235 status = whalCtrl_SetParam(pAdmCtrl->pRsn->hWhalCtrl, &whalParam);
236 /* Configure the keys in HAL */
237 rsn_setDefaultKeys(pAdmCtrl->pRsn);
241 /* Now we configure the MLME module with the 802.11 legacy authentication suite,
242 THe MLME will configure later the authentication module */
243 param.paramType = MLME_LEGACY_TYPE_PARAM;
244 #ifdef EXC_MODULE_INCLUDED
245 if (pAdmCtrl->networkEapMode!=OS_EXC_NETWORK_EAP_OFF)
247 param.content.mlmeLegacyAuthType = AUTH_LEGACY_RESERVED1;
255 param.content.mlmeLegacyAuthType = AUTH_LEGACY_OPEN_SYSTEM;
258 case RSN_AUTH_SHARED_KEY:
259 param.content.mlmeLegacyAuthType = AUTH_LEGACY_SHARED_KEY;
262 case RSN_AUTH_AUTO_SWITCH:
263 param.content.mlmeLegacyAuthType = AUTH_LEGACY_AUTO_SWITCH;
264 WLAN_REPORT_INFORMATION(pAdmCtrl->hReport , RSN_MODULE_LOG,
265 ("WEP admCtrl mlme_setParam, RSN_AUTH_AUTO_SWITCH\n"));
273 status = mlme_setParam(pAdmCtrl->hMlme, ¶m);
279 param.paramType = RX_DATA_EAPOL_DESTINATION_PARAM;
280 param.content.rxDataEapolDestination = OS_ABS_LAYER;
281 status = rxData_setParam(pAdmCtrl->hRx, ¶m);
287 /* Configure Security status in HAL */
288 whalParam.paramType = HAL_CTRL_RSN_SECURITY_MODE_PARAM;
289 whalParam.content.rsnEncryptionStatus = (halCtrl_CipherSuite_e)RSN_CIPHER_WEP;
290 status = whalCtrl_SetParam(pAdmCtrl->pRsn->hWhalCtrl, &whalParam);
298 * admCtrlWep_evalSite - Evaluate site for registration.
302 * evaluate site RSN capabilities against the station's cap.
303 * If the BSS type is infrastructure, the station matches the site only if it's WEP status is same as the site
304 * In IBSS, it does not matter
308 * I - pAdmCtrl - Context \n
309 * I - pRsnData - site's RSN data \n
310 * O - pEvaluation - Result of evaluation \n
318 TI_STATUS admCtrlWep_evalSite(admCtrl_t *pAdmCtrl, rsnData_t *pRsnData, bssType_e bssType, UINT32 *pEvaluation)
327 pAdmCtrl->setSiteFirst = FALSE;
329 #ifdef EXC_MODULE_INCLUDED
330 if (admCtrlExc_evalSite(pAdmCtrl, pRsnData, bssType, pEvaluation, &pAdmCtrl->excSupport) != OK)
335 pAdmCtrl->excSupport = FALSE;
336 #endif /*EXC_MODULE_INCLUDED*/
337 if (!pAdmCtrl->excSupport)
342 /* Check privacy bit if not in mixed mode */
343 if (!pAdmCtrl->mixedMode)
344 { /* There's no mixed mode, so make sure that the privacy Bit matches the privacy mode*/
345 if (!pRsnData->privacy)