1 /* 2 * AssocSM.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 35 /** \file AssocSM.h 36 * \brief 802.11 Association SM 37 * 38 * \see assocSM.c 39 */ 40 41 42 /***************************************************************************/ 43 /* */ 44 /* MODULE: AssocSM.h */ 45 /* PURPOSE: 802.11 Association SM */ 46 /* */ 47 /***************************************************************************/ 48 49 #ifndef _ASSOC_SM_H 50 #define _ASSOC_SM_H 51 52 #include "fsm.h" 53 #include "mlmeApi.h" 54 55 /* Constants */ 56 57 #define MAX_ASSOC_MSG_LENGTH (512 + RSN_MAX_GENERIC_IE_LENGTH) 58 59 #define ASSOC_SM_CAP_ESS_MODE 0x0001 60 #define ASSOC_SM_CAP_IBSS_MODE 0x0002 61 #define ASSOC_SM_CAP_CF_POLLABLE 0x0004 62 #define ASSOC_SM_CAP_CF_POLL_REQ 0x0008 63 #define ASSOC_SM_CAP_PIVACY 0x0010 64 #define ASSOC_SM_CAP_SHORT_PREAMBLE 0x0020 65 #define ASSOC_SM_CAP_PBCC 0x0040 66 #define ASSOC_SM_CAP_CH_AGILITY 0x0080 67 68 /* Enumerations */ 69 70 /* state machine states */ 71 typedef enum 72 { 73 ASSOC_SM_STATE_IDLE = 0, 74 ASSOC_SM_STATE_WAIT = 1, 75 ASSOC_SM_STATE_ASSOC = 2 76 } assoc_smStates_t; 77 78 /* State machine inputs */ 79 typedef enum 80 { 81 ASSOC_SM_EVENT_START = 0, 82 ASSOC_SM_EVENT_STOP = 1, 83 ASSOC_SM_EVENT_SUCCESS = 2, 84 ASSOC_SM_EVENT_FAIL = 3, 85 ASSOC_SM_EVENT_TIMEOUT = 4, 86 ASSOC_SM_EVENT_MAX_RETRY = 5 87 } assoc_smEvents_t; 88 89 90 91 /* Typedefs */ 92 93 typedef struct 94 { 95 fsm_stateMachine_t *pAssocSm; 96 TI_UINT32 timeout; 97 TI_UINT8 currentState; 98 TI_UINT32 maxCount; 99 TI_UINT8 retryCount; 100 TI_UINT32 assocRejectCount; 101 TI_UINT32 assocTimeoutCount; 102 char *pChalange; 103 TI_UINT8 assocRespBuffer[MAX_ASSOC_MSG_LENGTH]; 104 TI_UINT32 assocRespLen; 105 TI_UINT8 assocReqBuffer[MAX_ASSOC_MSG_LENGTH]; 106 TI_UINT32 assocReqLen; 107 TI_BOOL reAssocResp; 108 109 TI_BOOL reAssoc; 110 TI_BOOL disAssoc; /* When set dissasociation frame will be sent. */ 111 112 TI_HANDLE hMlme; 113 TI_HANDLE hSiteMgr; 114 TI_HANDLE hCtrlData; 115 TI_HANDLE hTWD; 116 TI_HANDLE hRsn; 117 TI_HANDLE hReport; 118 TI_HANDLE hOs; 119 TI_HANDLE hRegulatoryDomain; 120 TI_HANDLE hXCCMngr; 121 TI_HANDLE hQosMngr; 122 TI_HANDLE hMeasurementMgr; 123 TI_HANDLE hApConn; 124 TI_HANDLE hTimer; 125 TI_HANDLE hStaCap; 126 TI_HANDLE hSme; 127 128 TI_HANDLE hAssocSmTimer; 129 } assoc_t; 130 131 /* Structures */ 132 133 /* External data definitions */ 134 135 /* External functions definitions */ 136 137 /* Function prototypes */ 138 139 TI_STATUS assoc_start(TI_HANDLE hAssoc); 140 141 TI_STATUS reassoc_start(TI_HANDLE hAssoc); 142 143 TI_STATUS assoc_stop(TI_HANDLE hAssoc); 144 145 TI_STATUS assoc_recv(TI_HANDLE hAssoc, mlmeFrameInfo_t *pFrame); 146 147 TI_STATUS assoc_setDisAssocFlag(TI_HANDLE hAssoc, TI_BOOL disAsoccFlag); 148 149 TI_STATUS assoc_smCapBuild(assoc_t *pCtx, TI_UINT16 *cap); 150 151 152 /* local functions */ 153 154 TI_STATUS assoc_saveAssocRespMessage(assoc_t *pAssocSm, TI_UINT8 *pAssocBuffer, TI_UINT32 length); 155 156 157 #endif 158 159