1/*
2 * mlmeSm.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 /** \file mlmeSm.h
35 *  \brief 802.11 MLME SM
36 *
37 *  \see mlmeSm.c
38 */
39
40
41/***************************************************************************/
42/*                                                                         */
43/*      MODULE: mlmeSm.h                                                   */
44/*    PURPOSE:  802.11 MLME SM                                     */
45/*                                                                         */
46/***************************************************************************/
47
48#ifndef _MLME_SM_H
49#define _MLME_SM_H
50
51#include "fsm.h"
52#include "mlmeApi.h"
53
54/* Constants */
55
56/* changed to fit double buffer size - S.G */
57/*#define MAX_MANAGEMENT_FRAME_BODY_LEN 2312*/
58#define MAX_MANAGEMENT_FRAME_BODY_LEN   1476
59
60/* Enumerations */
61
62/* state machine states */
63typedef enum
64{
65    MLME_SM_STATE_IDLE          = 0,
66    MLME_SM_STATE_AUTH_WAIT     = 1,
67    MLME_SM_STATE_ASSOC_WAIT    = 2,
68    MLME_SM_STATE_ASSOC         = 3,
69    MLME_SM_NUM_STATES
70} mlme_smStates_t;
71
72/* State machine inputs */
73typedef enum
74{
75    MLME_SM_EVENT_START             = 0,
76    MLME_SM_EVENT_STOP              = 1,
77    MLME_SM_EVENT_AUTH_SUCCESS      = 2,
78    MLME_SM_EVENT_AUTH_FAIL         = 3,
79    MLME_SM_EVENT_ASSOC_SUCCESS     = 4,
80    MLME_SM_EVENT_ASSOC_FAIL        = 5,
81    MLME_SM_NUM_EVENTS
82} mlme_smEvents_t;
83
84
85
86/* Typedefs */
87
88typedef struct
89{
90    mgmtStatus_e mgmtStatus;
91    TI_UINT16        uStatusCode;
92} mlmeData_t;
93
94
95typedef struct
96{
97    fsm_stateMachine_t  *pMlmeSm;
98    TI_UINT8            currentState;
99    mlmeData_t          mlmeData;
100    legacyAuthType_e    legacyAuthType;
101    TI_BOOL             reAssoc;
102    DisconnectType_e    disConnType;
103    mgmtStatus_e        disConnReason;
104    TI_BOOL             bParseBeaconWSC;
105
106    /* temporary frame info */
107    mlmeIEParsingParams_t tempFrameInfo;
108
109    /* debug info - start */
110    TI_UINT32           debug_lastProbeRspTSFTime;
111    TI_UINT32           debug_lastDtimBcnTSFTime;
112    TI_UINT32           debug_lastBeaconTSFTime;
113    TI_BOOL             debug_isFunctionFirstTime;
114    TI_UINT32           totalMissingBeaconsCounter;
115    TI_UINT32           totalRcvdBeaconsCounter;
116    TI_UINT32           maxMissingBeaconSequence;
117    TI_UINT32           BeaconsCounterPS;
118    /* debug info - end */
119
120    TI_HANDLE           hAuth;
121    TI_HANDLE           hAssoc;
122    TI_HANDLE           hSiteMgr;
123    TI_HANDLE           hCtrlData;
124    TI_HANDLE           hConn;
125    TI_HANDLE           hTxMgmtQ;
126    TI_HANDLE           hMeasurementMgr;
127    TI_HANDLE           hSwitchChannel;
128    TI_HANDLE           hRegulatoryDomain;
129    TI_HANDLE           hReport;
130    TI_HANDLE           hOs;
131    TI_HANDLE           hCurrBss;
132    TI_HANDLE           hApConn;
133    TI_HANDLE           hScanCncn;
134    TI_HANDLE           hQosMngr;
135    TI_HANDLE           hTWD;
136    TI_HANDLE           hTxCtrl;
137} mlme_t;
138
139/* Structures */
140
141/* External data definitions */
142
143/* External functions definitions */
144
145/* Function prototypes */
146
147void mlme_smTimeout(TI_HANDLE hMlme);
148
149/* local functions */
150
151TI_STATUS mlme_smEvent(TI_UINT8 *currentState, TI_UINT8 event, TI_HANDLE hMlme);
152
153/* state machine functions */
154TI_STATUS mlme_smStartIdle(mlme_t *pMlme);
155TI_STATUS mlme_smAuthSuccessAuthWait(mlme_t *pMlme);
156TI_STATUS mlme_smAuthFailAuthWait(mlme_t *pMlme);
157TI_STATUS mlme_smStopAssocWait(mlme_t *pMlme);
158TI_STATUS mlme_smAssocSuccessAssocWait(mlme_t *pMlme);
159TI_STATUS mlme_smAssocFailAssocWait(mlme_t *pMlme);
160TI_STATUS mlme_smStopAssoc(mlme_t *pMlme);
161TI_STATUS mlme_smActionUnexpected(mlme_t *pMlme);
162TI_STATUS mlme_smNOP(mlme_t *pMlme);
163
164TI_STATUS mlme_smReportStatus(mlme_t *pMlme);
165
166#endif
167
168