Exemple #1
0
/*
 * Manage Join State.
 */
CWStateTransition CWWTPEnterJoin() {

    CWTimerID waitJoinTimer;
    int seqNum;
    CWProtocolJoinResponseValues values;

    CWLog("\n");
    CWLog("######### Join State #########");

    /* reset Join state */
    CWNetworkCloseSocket(gWTPSocket);
    CWSecurityDestroySession(gWTPSession);
    CWSecurityDestroyContext(gWTPSecurityContext);
    gWTPSecurityContext = NULL;
    gWTPSession = NULL;

    /* Initialize gACInfoPtr */
    gACInfoPtr->ACIPv4ListInfo.ACIPv4ListCount=0;
    gACInfoPtr->ACIPv4ListInfo.ACIPv4List=NULL;
    gACInfoPtr->ACIPv6ListInfo.ACIPv6ListCount=0;
    gACInfoPtr->ACIPv6ListInfo.ACIPv6List=NULL;

    if ((waitJoinTimer = timer_add(gCWWaitJoin, 0, CWWTPWaitJoinExpired, NULL)) == -1) {
        return CW_ENTER_DISCOVERY;
    }

    if(gWTPForceACAddress != NULL) {
        CW_CREATE_OBJECT_ERR(gACInfoPtr,
                             CWACInfoValues,
                             return CWErrorRaise(CW_ERROR_OUT_OF_MEMORY, NULL););
Exemple #2
0
// Manage Join State
CWStateTransition CWWTPEnterJoin() {
	CWTimerID waitJoinTimer;
	int seqNum;
	CWProtocolJoinResponseValues values;
	
	CWWTPDebugLog("######### Join State #########");
	// reset Join state
	CWNetworkCloseSocket(gWTPSocket);
#ifndef CW_NO_DTLS//csc
	if(gDtlsSecurity == 1)
	{
		CWSecurityDestroySession(gWTPSession);
		CWSecurityDestroyContext(gWTPSecurityContext);
		gWTPSecurityContext = NULL;
		gWTPSession = NULL;
	}
#endif
	//Initialize gACInfoPtr
	gACInfoPtr->ACIPv4ListInfo.ACIPv4ListCount=0;
	gACInfoPtr->ACIPv4ListInfo.ACIPv4List=NULL;	
	gACInfoPtr->ACIPv6ListInfo.ACIPv6ListCount=0;
	gACInfoPtr->ACIPv6ListInfo.ACIPv6List=NULL;

	/*
	 * MAURO: allo scadere del waitJoinTimer viene invocata, in modo 
	 * asincrono, CWWTPWaitJoinExpired(0) 	
	 */

	if ((waitJoinTimer = timer_add(gCWWaitJoin, 0, CWWTPWaitJoinExpired, NULL)) == -1) {
		return CW_ENTER_DISCOVERY;
	}

	/*
	 * MAURO: gWTPForceACAddress contine l'"indirizzo" dell'AC con cui fare
	 * il JOIN nel caso che sia specificato nel file di configuarazione.
	 * Se questa var globale e' settata da WTP.c viene invocata direttamente
	 * CWWTPEnterJoin per saltare il DISCOVERY.
	 */
	if(gWTPForceACAddress != NULL) {
		CW_CREATE_OBJECT_ERR(gACInfoPtr, CWACInfoValues, return CWErrorRaise(CW_ERROR_OUT_OF_MEMORY, NULL););	
/*
 * Manage Join State.
 */
CWStateTransition CWWTPEnterJoin()
{

	CWTimerID waitJoinTimer;
	int seqNum;
	CWProtocolJoinResponseValues values;
	CWStateTransition state = CW_ENTER_DISCOVERY;
	CWDebugLog("Checking if hostapd is connected...");
	if (gRADIO_MAC[0] == 0xAA){
	CWDebugLog("Waiting for hostapd to connect...");
       	while(gRADIO_MAC[0] == 0xAA) sleep(1);
	}
	else {
	CWDebugLog("Hostapd is connected...");
	}

	CWDebugLog("\n");
	CWDebugLog("######### Join State #########");

	/* reset Join state */
	CWNetworkCloseSocket(gWTPSocket);
#ifndef CW_NO_DTLS
	CWSecurityDestroySession(gWTPSession);
	CWSecurityDestroyContext(gWTPSecurityContext);
#endif
	gWTPSecurityContext = NULL;
	gWTPSession = NULL;

	/* Initialize gACInfoPtr */
	gACInfoPtr = malloc(sizeof(CWACInfoValues));
	gACInfoPtr->ACIPv4ListInfo.ACIPv4ListCount = 0;
	gACInfoPtr->ACIPv4ListInfo.ACIPv4List = NULL;
	gACInfoPtr->ACIPv6ListInfo.ACIPv6ListCount = 0;
	gACInfoPtr->ACIPv6ListInfo.ACIPv6List = NULL;
        CWDebugLog("State is %d", state);

        if (gWTPForceACAddress != NULL) {
                CW_CREATE_OBJECT_ERR(gACInfoPtr, CWACInfoValues, return CWErrorRaise(CW_ERROR_OUT_OF_MEMORY, NULL);
                    );