/************************************************************************ * conn_create * ************************************************************************ DESCRIPTION: Connection module creation function, called by the config mgr in creation phase performs the following: - Allocate the connection handle - Create the connection timer - Create the connection state machine INPUT: hOs - Handle to OS OUTPUT: RETURN: Handle to the connection module on success, NULL otherwise ************************************************************************/ TI_HANDLE conn_create(TI_HANDLE hOs) { conn_t *pConn; fsm_stateMachine_t *pFsm; TI_STATUS status; pConn = os_memoryAlloc(hOs, sizeof(conn_t)); if (pConn == NULL) { return NULL; } os_memoryZero (pConn->hOs, pConn, sizeof(conn_t)); /* Creating connection Ibss SM */ status = fsm_Create(hOs, &pFsm, CONN_IBSS_NUM_STATES, CONN_IBSS_NUM_EVENTS); if (status != TI_OK) { release_module(pConn); return NULL; } pConn->ibss_pFsm = pFsm; /* Creating connection Infra SM */ status = fsm_Create(hOs, &pFsm, CONN_INFRA_NUM_STATES, CONN_INFRA_NUM_EVENTS); if (status != TI_OK) { release_module(pConn); return NULL; } pConn->infra_pFsm = pFsm; pConn->hOs = hOs; return(pConn); }
/** * \\n * \date 08-November-2005\n * \brief Creates the measurement SRV object * * Function Scope \e Public.\n * \param hOS - handle to the OS object.\n * \return a handle to the measurement SRV object, NULL if an error occurred.\n */ TI_HANDLE MacServices_measurementSRV_create( TI_HANDLE hOS ) { measurementSRV_t* pMeasurementSRV; /* allocate the measurement SRV object */ pMeasurementSRV = os_memoryAlloc( hOS, sizeof(measurementSRV_t)); if ( NULL == pMeasurementSRV ) { WLAN_OS_REPORT( ("ERROR: Failed to create measurement SRV object.")); return NULL; } /* nullify the object */ os_memoryZero( hOS, pMeasurementSRV, sizeof(measurementSRV_t)); /* store OS handle */ pMeasurementSRV->hOS = hOS; /* allocate the SM */ if ( TI_OK != fsm_Create( hOS, &(pMeasurementSRV->SM), MSR_SRV_NUM_OF_STATES, MSR_SRV_NUM_OF_EVENTS )) { pMeasurementSRV->SM = NULL; WLAN_OS_REPORT(("Failed to create measurement SRV state machine.\n")); MacServices_measurementSRV_destroy( pMeasurementSRV ); return NULL; } return (TI_HANDLE)pMeasurementSRV; }
/** * * assoc_create - allocate memory for association SM * * \b Description: * * Allocate memory for association SM. \n * Allocates memory for Association context. \n * Allocates memory for association SM matrix. \n * * \b ARGS: * * I - hOs - OS context \n * * \b RETURNS: * * TI_OK if successful, TI_NOK otherwise. * * \sa rsn_mainSecSmKeysOnlyStop() */ TI_HANDLE assoc_create(TI_HANDLE hOs) { assoc_t *pHandle; TI_STATUS status; /* allocate association context memory */ pHandle = (assoc_t*)os_memoryAlloc(hOs, sizeof(assoc_t)); if (pHandle == NULL) { return NULL; } os_memoryZero(hOs, pHandle, sizeof(assoc_t)); pHandle->hOs = hOs; /* allocate memory for association state machine */ status = fsm_Create(hOs, &pHandle->pAssocSm, ASSOC_SM_NUM_STATES, ASSOC_SM_NUM_EVENTS); if (status != TI_OK) { os_memoryFree(hOs, pHandle, sizeof(assoc_t)); return NULL; } return pHandle; }
/** * * Function - externalSec_create. * * \b Description: * * Called by mainSecSM (mainSec_create). * Registers the function 'rsn_UnicastKeyRecv()' at the distributor to receive KEY frames upon receiving a KEY_RECV event. * * \b ARGS: * * * \b RETURNS: * * TI_STATUS - 0 on success, any other value on failure. * */ struct externalSec_t *externalSec_create(TI_HANDLE hOs) { struct externalSec_t *pHandle; TI_STATUS status; /* allocate association context memory */ pHandle = (struct externalSec_t *)os_memoryAlloc(hOs, sizeof(struct externalSec_t)); if (pHandle == NULL) { return NULL; } os_memoryZero(hOs, pHandle, sizeof(struct externalSec_t)); /* allocate memory for association state machine */ status = fsm_Create(hOs, &pHandle->pExternalSecSm, EXTERNAL_SEC_NUM_STATES, EXTERNAL_SEC_NUM_EVENTS); if (status != TI_OK) { os_memoryFree(hOs, pHandle, sizeof(struct externalSec_t)); return NULL; } return pHandle; }
/** * Creates the Measurement Manager moodule. * * @param hOs A handle to the OS object. * * @date 16-Dec-2005 */ TI_HANDLE measurementMgr_create(TI_HANDLE hOs) { measurementMgr_t * pMeasurementMgr = NULL; TI_STATUS status; /* allocating the MeasurementMgr object */ pMeasurementMgr = os_memoryAlloc(hOs, sizeof(measurementMgr_t)); if (pMeasurementMgr == NULL) return NULL; os_memoryZero(hOs, pMeasurementMgr, sizeof(measurementMgr_t)); pMeasurementMgr->hOs = hOs; /* creating the Measurement SM */ status = fsm_Create(pMeasurementMgr->hOs, &(pMeasurementMgr->pMeasurementMgrSm), MEASUREMENTMGR_NUM_STATES , MEASUREMENTMGR_NUM_EVENTS); if(status != TI_OK) { measurementMgr_releaseModule(pMeasurementMgr); return NULL; } /* creating the sub modules of measurement module */ /* creating Request Handler sub module */ if( (pMeasurementMgr->hRequestH = requestHandler_create(hOs)) == NULL) { measurementMgr_releaseModule(pMeasurementMgr); return NULL; } return(pMeasurementMgr); }
/** * * mlme_Create - allocate memory for MLME SM * * \b Description: * * Allocate memory for MLME SM. \n * Allocates memory for MLME context. \n * Allocates memory for MLME timer. \n * Allocates memory for MLME SM matrix. \n * * \b ARGS: * * I - pOs - OS context \n * * \b RETURNS: * * TI_OK if successful, TI_NOK otherwise. * * \sa rsn_mainSecSmKeysOnlyStop() */ TI_HANDLE mlme_create(TI_HANDLE hOs) { mlme_t *pHandle; TI_STATUS status; /* allocate MLME context memory */ pHandle = (mlme_t*)os_memoryAlloc(hOs, sizeof(mlme_t)); if (pHandle == NULL) { return NULL; } /* zero all MLME context */ os_memoryZero(hOs, pHandle, sizeof(mlme_t)); pHandle->hOs = hOs; /* allocate memory for MLME state machine */ status = fsm_Create(hOs, &pHandle->pMlmeSm, MLME_SM_NUM_STATES, MLME_SM_NUM_EVENTS); if (status != TI_OK) { os_memoryFree(hOs, pHandle, sizeof(mlme_t)); return NULL; } return pHandle; }
broadcastKey_t* broadcastKey_create(TI_HANDLE hOs) { TI_STATUS status; broadcastKey_t *pBroadcastKey; /* allocate key parser context memory */ pBroadcastKey = (broadcastKey_t*)os_memoryAlloc(hOs, sizeof(broadcastKey_t)); if (pBroadcastKey == NULL) { return NULL; } os_memoryZero(hOs, pBroadcastKey, sizeof(broadcastKey_t)); /* allocate memory for association state machine */ status = fsm_Create(hOs, &pBroadcastKey->pBcastKeySm, BCAST_KEY_MAX_NUM_STATES, BCAST_KEY_MAX_NUM_EVENTS); if (status != TI_OK) { os_memoryFree(hOs, pBroadcastKey, sizeof(broadcastKey_t)); return NULL; } pBroadcastKey->pKeyDerive = keyDerive_create(hOs); if (pBroadcastKey->pKeyDerive == NULL) { fsm_Unload(hOs, pBroadcastKey->pBcastKeySm); os_memoryFree(hOs, pBroadcastKey, sizeof(broadcastKey_t)); return NULL; } pBroadcastKey->hOs = hOs; return pBroadcastKey; }
/** * * \b Description: * * This procedure is called by the config manager when the driver is created. * It creates the SwitchChannel object. * * \b ARGS: * * I - hOs - OS context \n * * \b RETURNS: * * Handle to the SwitchChannel object. * * \sa */ TI_HANDLE switchChannel_create(TI_HANDLE hOs) { switchChannel_t *pSwitchChannel = NULL; TI_UINT32 initVec = 0; TI_STATUS status; /* allocating the SwitchChannel object */ pSwitchChannel = os_memoryAlloc(hOs,sizeof(switchChannel_t)); if (pSwitchChannel == NULL) return NULL; initVec |= (1 << SC_INIT_BIT); os_memoryZero(hOs, pSwitchChannel, sizeof(switchChannel_t)); pSwitchChannel->hOs = hOs; status = fsm_Create(hOs, &pSwitchChannel->pSwitchChannelSm, SC_NUM_STATES, SC_NUM_EVENTS); if (status != TI_OK) { release_module(pSwitchChannel, initVec); WLAN_OS_REPORT(("FATAL ERROR: switchChannel_create(): Error Creating pSwitchChannelSm - Aborting\n")); return NULL; } initVec |= (1 << SC_SM_INIT_BIT); return(pSwitchChannel); }
/** * \author Yuval Adler\n * \date 16-Oct-2004\n * \brief Creates the scan SRV object * * Function Scope \e Public.\n * \param hOS - handle to the OS object.\n * \return a handle to the scan SRV object, NULL if an error occurred.\n */ TI_HANDLE MacServices_scanSRV_create( TI_HANDLE hOS ) { /* allocate the scan SRV object */ scanSRV_t *pScanSRV = os_memoryAlloc( hOS, sizeof(scanSRV_t) ); if ( NULL == pScanSRV ) { WLAN_OS_REPORT( ("ERROR: Failed to create scan SRV module") ); return NULL; } /* allocate the state machine */ if ( OK != fsm_Create( hOS, &(pScanSRV->SM), SCAN_SRV_NUM_OF_STATES, SCAN_SRV_NUM_OF_EVENTS ) ) { WLAN_OS_REPORT( ("ERROR: Failed to allocate scan SRV state machine") ); os_memoryFree( hOS, pScanSRV, sizeof(scanSRV_t) ); return NULL; } /* create the timer */ pScanSRV->timer = os_timerCreate( hOS, MacServices_scanSRV_scanTimerExpired, pScanSRV ); if ( NULL == pScanSRV->timer ) { WLAN_OS_REPORT( ("ERROR: Failed to create timer for scan SRV module") ); fsm_Unload( hOS, pScanSRV->SM ); os_memoryFree( hOS, pScanSRV, sizeof(scanSRV_t) ); return NULL; } /* store the OS handle */ pScanSRV->hOS = hOS; return pScanSRV; }
/** * * mainKeys_create * * \b Description: * * Allocate memory for the main security context, and create all the rest of the needed contexts. * * \b ARGS: * * I - hOs - OS handle for OS operations. * * \b RETURNS: * * pointer to main security context. If failed, returns NULL. * * \sa */ mainKeys_t* mainKeys_create(TI_HANDLE hOs) { mainKeys_t *pHandle; TI_STATUS status; /* allocate association context memory */ pHandle = (mainKeys_t*)os_memoryAlloc(hOs, sizeof(mainKeys_t)); if (pHandle == NULL) { return NULL; } os_memoryZero(hOs, pHandle, sizeof(mainKeys_t)); /* allocate memory for association state machine */ status = fsm_Create(hOs, &pHandle->pMainKeysSm, MAIN_KEYS_NUM_STATES, MAIN_KEYS_NUM_EVENTS); if (status != TI_OK) { os_memoryFree(hOs, pHandle, sizeof(mainKeys_t)); return NULL; } pHandle->pKeyParser = keyParser_create(hOs); if (pHandle->pKeyParser == NULL) { fsm_Unload(hOs, pHandle->pMainKeysSm); os_memoryFree(hOs, pHandle, sizeof(mainKeys_t)); return NULL; } pHandle->pBcastSm = broadcastKey_create(hOs); if (pHandle->pBcastSm == NULL) { keyParser_unload(pHandle->pKeyParser); fsm_Unload(hOs, pHandle->pMainKeysSm); os_memoryFree(hOs, pHandle, sizeof(mainKeys_t)); return NULL; } pHandle->pUcastSm = unicastKey_create(hOs); if (pHandle->pBcastSm == NULL) { broadcastKey_unload(pHandle->pBcastSm); keyParser_unload(pHandle->pKeyParser); fsm_Unload(hOs, pHandle->pMainKeysSm); os_memoryFree(hOs, pHandle, sizeof(mainKeys_t)); return NULL; } pHandle->hOs = hOs; /* At first Timeout we will send MediaSpecific Event */ /* At any other Timeout we will send the Timeout Event */ pHandle->mainKeysTimeoutCounter = TI_FALSE; return pHandle; }
/** * * mainSec_create * * \b Description: * * Allocate memory for the main security context, and create all the rest of the needed contexts. * * \b ARGS: * * I - hOs - OS handle for OS operations. * * \b RETURNS: * * pointer to main security context. If failed, returns NULL. * * \sa */ mainSec_t* mainSec_create(TI_HANDLE hOs) { mainSec_t *pHandle; TI_STATUS status; /* allocate association context memory */ pHandle = (mainSec_t*)os_memoryAlloc(hOs, sizeof(mainSec_t)); if (pHandle == NULL) { return NULL; } os_memoryZero(hOs, pHandle, sizeof(mainSec_t)); /* allocate memory for association state machine */ status = fsm_Create(hOs, &pHandle->pMainSecSm, MAIN_SEC_MAX_NUM_STATES, MAIN_SEC_MAX_NUM_EVENTS); if (status != TI_OK) { os_memoryFree(hOs, pHandle, sizeof(mainSec_t)); return NULL; } pHandle->pMainKeys = mainKeys_create(hOs); if (pHandle->pMainKeys == NULL) { fsm_Unload(hOs, pHandle->pMainSecSm); os_memoryFree(hOs, pHandle, sizeof(mainSec_t)); return NULL; } pHandle->pKeyParser = pHandle->pMainKeys->pKeyParser; pHandle->hOs = hOs; /* created only for external security mode */ pHandle->pExternalSec = externalSec_create(hOs); if (pHandle->pExternalSec == NULL) { fsm_Unload(hOs, pHandle->pMainSecSm); mainKeys_unload(pHandle->pMainKeys); os_memoryFree(hOs, pHandle, sizeof(mainSec_t)); return NULL; } return pHandle; }