1 /** \file mlmeSm.h
2 *  \brief 802.11 MLME SM
3 *
4 *  \see mlmeSm.c
5 */
6
7/****************************************************************************
8**+-----------------------------------------------------------------------+**
9**|                                                                       |**
10**| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved.      |**
11**| All rights reserved.                                                  |**
12**|                                                                       |**
13**| Redistribution and use in source and binary forms, with or without    |**
14**| modification, are permitted provided that the following conditions    |**
15**| are met:                                                              |**
16**|                                                                       |**
17**|  * Redistributions of source code must retain the above copyright     |**
18**|    notice, this list of conditions and the following disclaimer.      |**
19**|  * Redistributions in binary form must reproduce the above copyright  |**
20**|    notice, this list of conditions and the following disclaimer in    |**
21**|    the documentation and/or other materials provided with the         |**
22**|    distribution.                                                      |**
23**|  * Neither the name Texas Instruments nor the names of its            |**
24**|    contributors may be used to endorse or promote products derived    |**
25**|    from this software without specific prior written permission.      |**
26**|                                                                       |**
27**| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |**
28**| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |**
29**| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
30**| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |**
31**| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
32**| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |**
33**| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
34**| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
35**| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |**
36**| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
37**| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |**
38**|                                                                       |**
39**+-----------------------------------------------------------------------+**
40****************************************************************************/
41
42/***************************************************************************/
43/*																		   */
44/*		MODULE:	mlmeSm.h												   */
45/*    PURPOSE:	802.11 MLME SM									   */
46/*																	 	   */
47/***************************************************************************/
48
49#ifndef _MLME_SM_H
50#define _MLME_SM_H
51
52#include "fsm.h"
53#include "mlmeApi.h"
54
55/* Constants */
56
57/* changed to fit double buffer size - S.G */
58/*#define MAX_MANAGEMENT_FRAME_BODY_LEN	2312*/
59#define MAX_MANAGEMENT_FRAME_BODY_LEN	1476
60
61/* Enumerations */
62
63/* state machine states */
64typedef enum
65{
66	MLME_SM_STATE_IDLE			= 0,
67	MLME_SM_STATE_AUTH_WAIT    	= 1,
68	MLME_SM_STATE_ASSOC_WAIT   	= 2,
69	MLME_SM_STATE_ASSOC	    	= 3,
70	MLME_SM_NUM_STATES
71} mlme_smStates_t;
72
73/* State machine inputs */
74typedef enum
75{
76	MLME_SM_EVENT_START				= 0,
77	MLME_SM_EVENT_STOP				= 1,
78	MLME_SM_EVENT_AUTH_SUCCESS    	= 2,
79    MLME_SM_EVENT_AUTH_FAIL			= 3,
80	MLME_SM_EVENT_ASSOC_SUCCESS    	= 4,
81    MLME_SM_EVENT_ASSOC_FAIL		= 5,
82	MLME_SM_NUM_EVENTS
83} mlme_smEvents_t;
84
85
86
87/* Typedefs */
88
89typedef struct
90{
91	mgmtStatus_e mgmtStatus;
92	UINT16		 uStatusCode;
93} mlmeData_t;
94
95
96typedef struct
97{
98	fsm_stateMachine_t	*pMlmeSm;
99	UINT8				currentState;
100	mlmeData_t          mlmeData;
101	legacyAuthType_e	legacyAuthType;
102	BOOL				reAssoc;
103	disConnType_e 		disConnType;
104	mgmtStatus_e 		disConnReason;
105
106    /* beacons and probe response registration information */
107    mlme_resultCB_t     resultCBFunc;
108    TI_HANDLE           resultCBObj;
109
110    /* temporary frame info */
111    mlmeIEParsingParams_t tempFrameInfo;
112
113    /* debug info - start */
114    UINT32              debug_lastProbeRspTSFTime;
115    UINT32              debug_lastDtimBcnTSFTime;
116    UINT32              debug_lastBeaconTSFTime;
117    BOOL                debug_isFunctionFirstTime;
118    UINT32              totalMissingBeaconsCounter;
119    UINT32              totalRcvdBeaconsCounter;
120    UINT32              maxMissingBeaconSequence;
121    UINT32              BeaconsCounterPS;
122    /* debug info - end */
123
124    TI_HANDLE			hAuth;
125	TI_HANDLE			hAssoc;
126	TI_HANDLE			hSiteMgr;
127	TI_HANDLE			hCtrlData;
128	TI_HANDLE			hConn;
129	TI_HANDLE			hTxData;
130	TI_HANDLE			hHalCtrl;
131	TI_HANDLE			hMemMgr;
132	TI_HANDLE			hMeasurementMgr;
133	TI_HANDLE			hSwitchChannel;
134	TI_HANDLE			hRegulatoryDomain;
135	TI_HANDLE			hReport;
136	TI_HANDLE			hOs;
137	TI_HANDLE			hCurrBss;
138	TI_HANDLE			hApConn;
139	TI_HANDLE           hScanCncn;
140	TI_HANDLE			hQosMngr;
141    TI_HANDLE           hConfigMgr;
142} mlme_t;
143
144/* Structures */
145
146/* External data definitions */
147
148/* External functions definitions */
149
150/* Function prototypes */
151
152void mlme_smTimeout(TI_HANDLE hMlme);
153
154/* local functions */
155
156TI_STATUS mlme_smEvent(UINT8 *currentState, UINT8 event, TI_HANDLE hMlme);
157
158/* state machine functions */
159TI_STATUS mlme_smStartIdle(mlme_t *pMlme);
160TI_STATUS mlme_smAuthSuccessAuthWait(mlme_t *pMlme);
161TI_STATUS mlme_smAuthFailAuthWait(mlme_t *pMlme);
162TI_STATUS mlme_smStopAssocWait(mlme_t *pMlme);
163TI_STATUS mlme_smAssocSuccessAssocWait(mlme_t *pMlme);
164TI_STATUS mlme_smAssocFailAssocWait(mlme_t *pMlme);
165TI_STATUS mlme_smStopAssoc(mlme_t *pMlme);
166TI_STATUS mlme_smActionUnexpected(mlme_t *pMlme);
167TI_STATUS mlme_smNOP(mlme_t *pMlme);
168
169TI_STATUS mlme_smReportStatus(mlme_t *pMlme);
170void mlme_beaconReceivedPrint(TI_HANDLE hMlme);
171
172#endif
173
174