Esempio n. 1
0
/** 
 * \fn     Function declaration 
 * \brief  Function brief description goes here 
 * 
 * Function detailed description goes here 
 * 
 * \note   Note is indicated here 
 * \param  Parameter name - parameter description
 * \param  … 
 * \return Return code is detailed here 
 * \sa     Reference to other relevant functions 
 */
void sme_ReportConnStatus (TI_HANDLE hSme, mgmtStatus_e eStatusType, TI_UINT32 uStatusCode)
{
    TSme                *pSme = (TSme*)hSme;

    TRACE2(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ReportConnStatus: statusType = %d, uStatusCode = %d\n", eStatusType, uStatusCode);

    /* Act according to status */
    switch (eStatusType)
    {
    /* connection was successful */
    case STATUS_SUCCESSFUL:
        pSme->bAuthSent = TI_TRUE;
        genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_SUCCESS, hSme);
        break;

    case STATUS_ASSOC_REJECT:
    case STATUS_SECURITY_FAILURE:
    case STATUS_AP_DEAUTHENTICATE:
    case STATUS_AP_DISASSOCIATE:
    case STATUS_ROAMING_TRIGGER:
    case STATUS_AUTH_REJECT:
        /* Indicate the authentication and/or association was sent to the AP */
        pSme->bAuthSent = TI_TRUE;

        /* keep the disassociation status and code, for sending event to user-mode */
        pSme->tDisAssoc.eMgmtStatus = eStatusType;
        pSme->tDisAssoc.uStatusCode = uStatusCode;

        /* try to find the next connection candidate */
        pSme->pCandidate = sme_Select (hSme);
        /* if the next connection candidate exists */
        if (NULL != pSme->pCandidate)
        {
            genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT, hSme);
        }
        else
        {
            genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme);
        }
        break;

        /* Note that in case of unspecified status we won't update the status. This is done since this function could be called twice */
        /* for example: apConn called this function and than SME called conn_stop and this function is called again                   */
        /* we use this status at SME, if != 0 means that assoc frame sent */
    case STATUS_UNSPECIFIED:
            pSme->bAuthSent = TI_TRUE;
        genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme);
        break;

    default:
        TRACE1(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ReportConnStatus: unknown statusType = %d\n", eStatusType);
        break;
    }
}
Esempio n. 2
0
/**
 * \fn     smeSm_PreConnect
 * \brief  Initiates the connection process
 *
 * Initiates the connection process - for automatic mode, start scan, for manual mode - triggers connection
 *
 * \param  hSme - handle to the SME object
 * \return None
 * \sa     smeSm_Connect, smeSm_ConnectSuccess
 */
void smeSm_PreConnect (TI_HANDLE hSme)
{
	TSme *pSme = (TSme *)hSme;
	paramInfo_t	*pParam;


	/* set the connection mode with which this connection attempt is starting */
	pSme->eLastConnectMode = pSme->eConnectMode;

	/* mark that no authentication/assocaition was yet sent */
	pSme->bAuthSent = TI_FALSE;

	/* try to find a connection candidate (manual mode have already performed scann */
	pSme->pCandidate = sme_Select (hSme);
	if (NULL != pSme->pCandidate) {
		/* candidate is available - attempt connection */
		sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT, hSme);
	}
	/* no candidate */
	else {
		if (CONNECT_MODE_AUTO == pSme->eConnectMode) {
			/* automatic mode - start scanning */
			if (TI_OK != sme_StartScan (hSme)) {
				pSme->bRadioOn = TI_FALSE;
				sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme);
			}

			/* update scan count counter */
			if (pSme->uScanCount < PERIODIC_SCAN_MAX_INTERVAL_NUM) {
				pSme->uScanCount++;
			}

		} else {	/* Manual mode */
			/* for IBSS or any, if no entries where found, add the self site */
			if (pSme->eBssType == BSS_INFRASTRUCTURE) {
				/* makr whether we need to stop the attempt connection in manual mode */
				pSme->bConnectRequired = TI_FALSE;

				/* manual mode and no connection candidate is available - connection failed */
				sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme);
			}

			else {	/* IBSS */
				TI_UINT8    uDesiredChannel;
				TI_BOOL     channelValidity;
				pSme->bConnectRequired = TI_FALSE;

				pParam = (paramInfo_t *)os_memoryAlloc(pSme->hOS, sizeof(paramInfo_t));
				if (!pParam) {
					return;
				}

				pParam->paramType = SITE_MGR_DESIRED_CHANNEL_PARAM;
				siteMgr_getParam(pSme->hSiteMgr, pParam);
				uDesiredChannel = pParam->content.siteMgrDesiredChannel;

				if (uDesiredChannel >= SITE_MGR_CHANNEL_A_MIN) {
					pParam->content.channelCapabilityReq.band = RADIO_BAND_5_0_GHZ;
				} else {
					pParam->content.channelCapabilityReq.band = RADIO_BAND_2_4_GHZ;
				}

				/*
				update the regulatory domain with the selected band
				*/
				/* Check if the selected channel is valid according to regDomain */
				pParam->paramType = REGULATORY_DOMAIN_GET_SCAN_CAPABILITIES;
				pParam->content.channelCapabilityReq.scanOption = ACTIVE_SCANNING;
				pParam->content.channelCapabilityReq.channelNum = uDesiredChannel;

				regulatoryDomain_getParam (pSme->hRegDomain, pParam);
				channelValidity = pParam->content.channelCapabilityRet.channelValidity;
				os_memoryFree(pSme->hOS, pParam, sizeof(paramInfo_t));
				if (!channelValidity) {

					sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme);

					return;
				}

				pSme->pCandidate = (TSiteEntry *)addSelfSite(pSme->hSiteMgr);

				if (pSme->pCandidate == NULL) {

					sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme);

					return;
				}

				/* a connection candidate is available, send a connect event */
				sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT, hSme);
			}
		}
	}
}
Esempio n. 3
0
/** 
 * \fn     sme_ScanResultCB
 * \brief  Callback function from scan concentrator for results and scan complete indications
 * 
 * Callback function from scan concentrator for results and scan complete indications
 * 
 * \param  hSme - handle to the SME object
 * \param  eStatus - the reason for calling the CB  
 * \param  pFrameInfo - frame information (if the CB is called due to received frame)
 * \param  uSPSStatus - SPS attened channels (if the CB is called to inidcate an SPS scan complete)
 * \return None
 */ 
void sme_ScanResultCB (TI_HANDLE hSme, EScanCncnResultStatus eStatus,
                       TScanFrameInfo* pFrameInfo, TI_UINT16 uSPSStatus)
{
    TSme                *pSme = (TSme*)hSme;
    paramInfo_t	        param;


    switch (eStatus)
    {
    /* a frame was received - update the scan result table */
    case SCAN_CRS_RECEIVED_FRAME:

        TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: received frame from BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]);

        /* 
         * in auto mode in order to find country IE only !!!
         * filter frames according to desired SSID, in case we are also trying to find 
         * country IE in passive scan, to avoid a table overflow (in manual mode, the SME table must be equal to the app
         * table, the app is responsible to decide which SSIDs to use for scan)
         */
        if (CONNECT_MODE_AUTO == pSme->eConnectMode)
        {
            if (SSID_TYPE_SPECIFIC == pSme->eSsidType)
            {
#ifndef XCC_MODULE_INCLUDED
                if ((pSme->tSsid.len == pFrameInfo->parsedIEs->content.iePacket.pSsid->hdr[ 1 ]) &&
                    (0 == os_memoryCompare (pSme->hOS, &(pSme->tSsid.str[ 0 ]),
                                            &(pFrameInfo->parsedIEs->content.iePacket.pSsid->serviceSetId[ 0 ]),
                                            pSme->tSsid.len)))
#endif
                {

                    if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo))
                    {
                        TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update specific enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]);
                    }
                }
            }
            else
            {

                if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo))
                {
                    TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x because table is full\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]);
                }
            }
        }
        else
        /* manual mode */
        {
            if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo))
            {
                TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update application scan enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]);
            }
        }
        break;

    /* scan was completed successfully */
    case SCAN_CRS_SCAN_COMPLETE_OK:
    /* an error occured, try selecting a site anyway */
    case SCAN_CRS_SCAN_ABORTED_FW_RESET:
    case SCAN_CRS_SCAN_ABORTED_HIGHER_PRIORITY:
    case SCAN_CRS_SCAN_FAILED:
    case SCAN_CRS_TSF_ERROR:
        TRACE1(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: received scan complete indication with status %d\n", eStatus);

        /* stablizie the scan result table - delete its contenst if no results were recived during last scan */
        scanResultTable_SetStableState (pSme->hScanResultTable);

        if (CONNECT_MODE_AUTO == pSme->eConnectMode)
        {
 
           /* try to select a site */
           pSme->pCandidate = sme_Select (hSme);

           /* if no matching site was found */
           if (NULL == pSme->pCandidate)
           {
               /* for IBSS or any, if no entries where found, add the self site */
               if (pSme->eBssType == BSS_INFRASTRUCTURE)
               {
                   TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: No candidate available, sending connect failure\n");

                   genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme);
                   break;
               }

               {
                   TI_UINT8     uDesiredChannel;

                   param.paramType = SITE_MGR_DESIRED_CHANNEL_PARAM;
                   siteMgr_getParam(pSme->hSiteMgr, &param);
                   uDesiredChannel = param.content.siteMgrDesiredChannel;

                   if (uDesiredChannel >= SITE_MGR_CHANNEL_A_MIN)
                   {
                       param.content.channelCapabilityReq.band = RADIO_BAND_5_0_GHZ;
                   } 
                   else 
                   {
                       param.content.channelCapabilityReq.band = RADIO_BAND_2_4_GHZ;
                   }

                   /*
                   update the regulatory domain with the selected band
                   */
                   /* Check if the selected channel is valid according to regDomain */
                   param.paramType = REGULATORY_DOMAIN_GET_SCAN_CAPABILITIES;
                   param.content.channelCapabilityReq.scanOption = ACTIVE_SCANNING;
                   param.content.channelCapabilityReq.channelNum = uDesiredChannel;

                   regulatoryDomain_getParam (pSme->hRegDomain,&param);
                   if (!param.content.channelCapabilityRet.channelValidity)
                   {
                       TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "IBSS SELECT FAILURE  - No channel !!!\n\n");

                       genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme);

                       break;
                   }

                   pSme->pCandidate = (TSiteEntry *)addSelfSite(pSme->hSiteMgr);

                   if (pSme->pCandidate == NULL)
                   {
                       TRACE0(pSme->hReport, REPORT_SEVERITY_ERROR , "IBSS SELECT FAILURE  - could not open self site !!!\n\n");

                       genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme);

                       break;
                   }

#ifdef REPORT_LOG    
                   TRACE6(pSme->hReport, REPORT_SEVERITY_CONSOLE,"%%%%%%%%%%%%%%	SELF SELECT SUCCESS, bssid: %X-%X-%X-%X-%X-%X	%%%%%%%%%%%%%%\n\n", pSme->pCandidate->bssid[0], pSme->pCandidate->bssid[1], pSme->pCandidate->bssid[2], pSme->pCandidate->bssid[3], pSme->pCandidate->bssid[4], pSme->pCandidate->bssid[5]);
                   WLAN_OS_REPORT (("%%%%%%%%%%%%%%	SELF SELECT SUCCESS, bssid: %02x.%02x.%02x.%02x.%02x.%02x %%%%%%%%%%%%%%\n\n", pSme->pCandidate->bssid[0], pSme->pCandidate->bssid[1], pSme->pCandidate->bssid[2], pSme->pCandidate->bssid[3], pSme->pCandidate->bssid[4], pSme->pCandidate->bssid[5]));
#endif
                }
           }

           /* a connection candidate is available, send a connect event */
           genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT, hSme);
        }
        break;        

    /*
     * scan was stopped according to SME request (should happen when moving to disconnecting from scanning), send a 
     * connect failure event to move out of disconnecting
     */
    case SCAN_CRS_SCAN_STOPPED:
        TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: received scan stopped indication\n");
        genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme);
        break;

    default:
        TRACE1(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: received unrecognized status %d\n", eStatus);
        break;
    }
}
Esempio n. 4
0
/** 
 * \fn     smeSm_PreConnect
 * \brief  Initiates the connection process
 * 
 * Initiates the connection process - for automatic mode, start scan, for manual mode - triggers connection
 * 
 * \param  hSme - handle to the SME object
 * \return None
 * \sa     smeSm_Connect, smeSm_ConnectSuccess
 */ 
void smeSm_PreConnect (TI_HANDLE hSme)
{
    TSme *pSme = (TSme *)hSme;
    paramInfo_t	*pParam;
//joetest
TRACE0(pSme->hReport, REPORT_SEVERITY_SM , "smeSm_PreConnect: !!!\n");
    /* set the connection mode with which this connection attempt is starting */
    pSme->eLastConnectMode = pSme->eConnectMode;
 
    /* mark that no authentication/assocaition was yet sent */
    pSme->bAuthSent = TI_FALSE;

    /* try to find a connection candidate (manual mode have already performed scann */
    pSme->pCandidate = sme_Select (hSme);
    if (NULL != pSme->pCandidate)
    {
        /* candidate is available - attempt connection */
        sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT, hSme);
    }
    /* no candidate */
    else
    {
        if (CONNECT_MODE_AUTO == pSme->eConnectMode)
        {
            /* automatic mode - start scanning */
            if (TI_OK != sme_StartScan (hSme))
            {
                TRACE0(pSme->hReport, REPORT_SEVERITY_ERROR , "smeSm_PreConnect: unable to start scan, stopping the SME\n");
                pSme->bRadioOn = TI_FALSE;
                sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme);
            }

            /* update scan count counter */
            if(pSme->uScanCount < PERIODIC_SCAN_MAX_INTERVAL_NUM)
            {
                pSme->uScanCount++;
            }

        }
        else		/* Manual mode */ 
        { 
			/* for IBSS or any, if no entries where found, add the self site */
			if (pSme->eBssType == BSS_INFRASTRUCTURE)
            {
                /* makr whether we need to stop the attempt connection in manual mode */
                pSme->bConnectRequired = TI_FALSE;
    
                TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "smeSm_PreConnect: No candidate available, sending connect failure\n");
                /* manual mode and no connection candidate is available - connection failed */
 //joetest
TRACE0(pSme->hReport, REPORT_SEVERITY_SM , "smeSm_PreConnect!!!\n");
			}

			else		/* IBSS */
			{
				TI_UINT8     uDesiredChannel;     
                TI_BOOL     channelValidity;
		        pSme->bConnectRequired = TI_FALSE;

                pParam = (paramInfo_t *)os_memoryAlloc(pSme->hOS, sizeof(paramInfo_t));
                if (!pParam)
                {
                    return;
                }

				pParam->paramType = SITE_MGR_DESIRED_CHANNEL_PARAM;
				siteMgr_getParam(pSme->hSiteMgr, pParam);
				uDesiredChannel = pParam->content.siteMgrDesiredChannel;

				if (uDesiredChannel >= SITE_MGR_CHANNEL_A_MIN)
				{
				   pParam->content.channelCapabilityReq.band = RADIO_BAND_5_0_GHZ;
				} 
				else 
				{
				   pParam->content.channelCapabilityReq.band = RADIO_BAND_2_4_GHZ;
				}

				/*
				update the regulatory domain with the selected band
				*/
				/* Check if the selected channel is valid according to regDomain */
				pParam->paramType = REGULATORY_DOMAIN_GET_SCAN_CAPABILITIES;
				pParam->content.channelCapabilityReq.scanOption = ACTIVE_SCANNING;
				pParam->content.channelCapabilityReq.channelNum = uDesiredChannel;

				regulatoryDomain_getParam (pSme->hRegDomain,pParam);
                channelValidity = pParam->content.channelCapabilityRet.channelValidity;
                os_memoryFree(pSme->hOS, pParam, sizeof(paramInfo_t));
				if (!channelValidity)
				{
				   TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "IBSS SELECT FAILURE  - No channel !!!\n\n");

				   sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme);

				   return;
				}

				pSme->pCandidate = (TSiteEntry *)addSelfSite(pSme->hSiteMgr);

				if (pSme->pCandidate == NULL)
				{
				   TRACE0(pSme->hReport, REPORT_SEVERITY_ERROR , "IBSS SELECT FAILURE  - could not open self site !!!\n\n");

				   sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme);

				   return;
				}

#ifdef REPORT_LOG    
				TRACE6(pSme->hReport, REPORT_SEVERITY_CONSOLE,"%%%%%%%%%%%%%%	SELF SELECT SUCCESS, bssid: %X-%X-%X-%X-%X-%X	%%%%%%%%%%%%%%\n\n", pSme->pCandidate->bssid[0], pSme->pCandidate->bssid[1], pSme->pCandidate->bssid[2], pSme->pCandidate->bssid[3], pSme->pCandidate->bssid[4], pSme->pCandidate->bssid[5]);
                WLAN_OS_REPORT (("%%%%%%%%%%%%%%	SELF SELECT SUCCESS, bssid: %02x.%02x.%02x.%02x.%02x.%02x %%%%%%%%%%%%%%\n\n", pSme->pCandidate->bssid[0], pSme->pCandidate->bssid[1], pSme->pCandidate->bssid[2], pSme->pCandidate->bssid[3], pSme->pCandidate->bssid[4], pSme->pCandidate->bssid[5]));
#endif
				/* a connection candidate is available, send a connect event */
				sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT, hSme);
			}
        }
    }
}