1/*
2 * siteHash.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 siteHash.h
35 *  \brief Hash & site table internal header file
36 *
37 *  \see siteHash.c
38 */
39
40/***************************************************************************/
41/*                                                                          */
42/*    MODULE:   siteHash.h                                                  */
43/*    PURPOSE:  Hash & site table internal header file                      */
44/*                                                                          */
45/***************************************************************************/
46#ifndef __SITE_MGR_H__
47#define __SITE_MGR_H__
48
49#include "tidef.h"
50#include "paramOut.h"
51#include "802_11Defs.h"
52#include "DataCtrl_Api.h"
53#include "scanResultTable.h"
54
55#define MIN_TX_SESSION_COUNT    1
56#define MAX_TX_SESSION_COUNT    7
57
58/* A site entry contains all the site attribute received in beacon and probes
59    and data used to manage the site table and hash table */
60typedef TSiteEntry siteEntry_t;
61
62typedef struct
63{
64    TI_UINT8           numOfSites;
65    TI_UINT8           maxNumOfSites;
66    siteEntry_t        siteTable[MAX_SITES_BG_BAND];
67}siteTablesParams_t;
68
69/* This struct is seperated from the above struct (siteTablesParams_t) for memory optimizations */
70typedef struct
71{
72    TI_UINT8           numOfSites;
73    TI_UINT8           maxNumOfSites;
74    siteEntry_t        siteTable[MAX_SITES_A_BAND];
75}siteTablesParamsBandA_t;
76
77/* Ths following structure is used to manage the sites */
78typedef struct
79{
80    siteTablesParamsBandA_t   dot11A_sitesTables;
81    siteTablesParams_t        dot11BG_sitesTables;
82    siteTablesParams_t        *pCurrentSiteTable;
83    siteEntry_t               *pPrimarySite;
84    siteEntry_t               *pPrevPrimarySite;
85} sitesMgmtParams_t;
86
87
88/* Site manager handle */
89typedef struct
90{
91    siteMgrInitParams_t *pDesiredParams;
92    sitesMgmtParams_t   *pSitesMgmtParams;
93
94    TI_HANDLE           hConn;
95    TI_HANDLE           hSmeSm;
96    TI_HANDLE           hCtrlData;
97    TI_HANDLE           hRxData;
98    TI_HANDLE           hTxCtrl;
99    TI_HANDLE           hRsn;
100    TI_HANDLE           hAuth;
101    TI_HANDLE           hAssoc;
102    TI_HANDLE           hRegulatoryDomain;
103    TI_HANDLE           hMeasurementMgr;
104    TI_HANDLE           hTWD;
105    TI_HANDLE           hMlmeSm;
106    TI_HANDLE           hReport;
107    TI_HANDLE           hOs;
108    TI_HANDLE           hXCCMngr;
109    TI_HANDLE           hApConn;
110    TI_HANDLE           hCurrBss;
111    TI_HANDLE           hQosMngr;
112    TI_HANDLE           hPowerMgr;
113    TI_HANDLE           hEvHandler;
114    TI_HANDLE           hScr;
115    TI_HANDLE           hStaCap;
116
117    TI_UINT32           beaconSentCount;
118    TI_UINT32           rxPacketsCount;
119    TI_UINT32           txPacketsCount;
120    TI_UINT16           txSessionCount;     /* Current Tx-Session index as configured to FW in last Join command. */
121
122    EModulationType     chosenModulation;
123    EModulationType     currentDataModulation;
124    EDot11Mode          siteMgrOperationalMode;
125    ERadioBand          radioBand;
126    ERadioBand          prevRadioBand;
127
128    TMacAddr            ibssBssid;
129    TI_BOOL             bPostponedDisconnectInProgress;
130    TI_BOOL             isAgingEnable;
131
132    /* TX Power Adjust */
133    TI_UINT32           siteMgrTxPowerCheckTime;
134    TI_BOOL             siteMgrTxPowerEnabled;
135
136    TBeaconFilterInitParams    beaconFilterParams; /*contains the desired state*/
137
138
139    /*HW Request from Power Ctrl */
140    TI_UINT32           DriverTestId;
141
142    /* Wifi Simple Config */
143    TIWLN_SIMPLE_CONFIG_MODE  siteMgrWSCCurrMode; /* indicates the current WiFi Simple Config mode */
144    char                siteMgrWSCProbeReqParams[DOT11_WSC_PROBE_REQ_MAX_LENGTH]; /* Contains the params to be used in the ProbeReq - WSC IE */
145
146    TI_UINT8            includeWSCinProbeReq;
147} siteMgr_t;
148
149
150
151siteEntry_t *findAndInsertSiteEntry(siteMgr_t       *pSiteMgr,
152                                    TMacAddr    *bssid,
153                                    ERadioBand     band);
154
155siteEntry_t *findSiteEntry(siteMgr_t        *pSiteMgr,
156                           TMacAddr     *bssid);
157
158void removeSiteEntry(siteMgr_t *pSiteMgr, siteTablesParams_t *pCurrSiteTblParams,
159                     siteEntry_t  *hashPtr);
160
161TI_STATUS removeEldestSite(siteMgr_t *pSiteMgr);
162
163TI_STATUS buildProbeReqTemplate(siteMgr_t *pSiteMgr, TSetTemplate *pTemplate, TSsid *pSsid, ERadioBand radioBand);
164
165TI_STATUS buildProbeRspTemplate(siteMgr_t *pSiteMgr, TSetTemplate *pTemplate);
166
167TI_STATUS buildNullTemplate(siteMgr_t *pSiteMgr, TSetTemplate *pTemplate);
168
169TI_STATUS buildDisconnTemplate(siteMgr_t *pSiteMgr, TSetTemplate *pTemplate);
170
171TI_STATUS buildPsPollTemplate(siteMgr_t *pSiteMgr, TSetTemplate *pTemplate);
172
173TI_STATUS buildQosNullDataTemplate(siteMgr_t *pSiteMgr, TSetTemplate *pTemplate, TI_UINT8 userPriority);
174
175void setDefaultProbeReqTemplate (TI_HANDLE	hSiteMgr);
176
177#endif /* __SITE_MGR_H__ */
178