1/*
2 * scanMngr.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  scanMngr.h
35 *  \brief This file include private definitions for the scan manager module.
36 *
37 *  \see   scanMngr.c, scanMngrApi.h, scanMngrTypes.h
38 */
39
40
41#ifndef __SCAN_MNGR_H__
42#define __SCAN_MNGR_H__
43
44#include "scanMngrApi.h"
45
46/*
47 ***********************************************************************
48 *  Constant definitions.
49 ***********************************************************************
50 */
51
52/* SPS guard times */
53#ifdef TI_DBG
54#define SCAN_SPS_GUARD_FROM_CURRENT_TSF         300000 /* 300 msecs - to allow for some debug printouts */
55#else
56#define SCAN_SPS_GUARD_FROM_CURRENT_TSF         50000 /* 50 msecs */
57#endif /* TI_DBG */
58#define SCAN_SPS_GUARD_FROM_LAST_BSS            2000 /* 2 msecs */
59#define SCAN_SPS_DURATION_PART_IN_ADVANCE       4 /* 1/4 of scan duration in advance */
60#define SCAN_SPS_USE_DRIFT_COMPENSATION         1 /* if defined, use drift compensation algorithm */
61#define SCAN_SPS_NUM_OF_TSF_DELTA_ENTRIES       4 /* number of TSF delta ^ 2 entries */
62#define SCAN_SPS_FW_DTIM_LENGTH                 1000 /* time (in usec) for a DTIM event to complete in the FW */
63
64/* Quality calculation constants */
65#define RSSI_PREVIOUS_COEFFICIENT               9
66
67/* scan iteration number after which, if no new AP was found, pre-auth needs to be re-done */
68#define SCAN_MNGR_CONSEC_SCAN_ITER_FOR_PRE_AUTH 50
69
70#define MAX_DESC_LENGTH                         50 /* max characters for a description string */
71#define SCAN_MNGR_STAT_MAX_TRACK_FAILURE        10 /* max track filures for statistics histogram */
72
73#ifdef TI_DBG
74/*#define SCAN_MNGR_DBG 1
75#define SCAN_MNGR_SPS_DBG 1
76#define SCAN_MNGR_DTIM_DBG 1 */
77#endif
78
79 /*
80 ***********************************************************************
81 *  Enums.
82 ***********************************************************************
83 */
84
85 /** \enum scan_immedScanState_e
86 * \brief enumerates immediate scan internal status
87 */
88typedef enum
89{
90    SCAN_ISS_IDLE = 0,                  /**< immediate scan is not running */
91    SCAN_ISS_G_BAND,                    /**< immediate scan is running on G band */
92    SCAN_ISS_A_BAND,                    /**< immediate scan is running on A band */
93    SCAN_ISS_STOPPING,                  /**< stop was requested and is now pending */
94    SCAN_ISS_NUM_OF_STATES              /**< number of available immediate scan states states */
95} scan_immedScanState_e;
96
97/** \enum scan_contScanState_e
98 * \brief enumerates continuous scan internal status
99 */
100typedef enum
101{
102    SCAN_CSS_IDLE = 0,                  /**< continuous scan is not running */
103    SCAN_CSS_TRACKING_G_BAND,           /**< continuous scan is performing tracking scan on G */
104    SCAN_CSS_TRACKING_A_BAND,           /**< continuous scan is performing tracking scan on A */
105    SCAN_CSS_DISCOVERING,               /**< continuous scan is performing discovery scan */
106    SCAN_CSS_STOPPING,                  /**< continuous scan is waiting for scan complete notification */
107    SCAN_CSS_NUM_OF_STATES              /**< number of available continuous scan states */
108} scan_contScanState_e;
109
110/** \enum scan_discoveryPart_e
111 * \brief enumerates the different parts in the discovery process
112 */
113typedef enum
114{
115    SCAN_SDP_NEIGHBOR_G = 0,            /**< attempting to discover neighbor APs in G band */
116    SCAN_SDP_NEIGHBOR_A,                /**< attempting to discover neighbor APs in A band */
117    SCAN_SDP_CHANNEL_LIST_G,            /**< attempting to discover all APs in G band */
118    SCAN_SDP_CHANNEL_LIST_A,            /**< attempting to discover all APs in A band */
119    SCAN_SDP_NO_DISCOVERY,              /**< no discovery should be attempted */
120    SCAN_SDP_NUMBER_OF_DISCOVERY_PARTS  /**< number of discovery parts available */
121} scan_discoveryPart_e;
122
123/** \enum scan_neighborDiscoveryState_e
124 * \brief enumerates the different discovery states possible for a neighbor AP
125 */
126typedef enum
127{
128    SCAN_NDS_DISCOVERED = 0,            /**< Neighbor AP was discovered and is now being tracked */
129    SCAN_NDS_NOT_DISCOVERED,            /**< Neighbor AP was not yet discovered, and should be */
130    SCAN_NDS_CURRENT_AP,                /**<
131                                         * Neighbor AP is the AP STA is currently connected to,
132                                         * and shouldn't be discovered
133                                         */
134    SCAN_NDS_NUMBER_OF_NEIGHBOR_DISCOVERY_STATES
135                                        /**< number of available neighbor disocvery states */
136} scan_neighborDiscoveryState_e;
137
138/*
139 ***********************************************************************
140 *  Typedefs.
141 ***********************************************************************
142 */
143
144#define WAS_SPS_CHANNEL_ATTENDED( SPSStatus, i )    \
145    (0 != (SPSStatus & (1<<i)) ? TI_TRUE : TI_FALSE)
146
147/*
148 ***********************************************************************
149 *  Structure definitions.
150 ***********************************************************************
151 */
152
153/** \struct scan_neighborAPListDiscovery_t
154 * \brief This structure contains Neighbor AP list and their detection status
155 */
156typedef struct
157{
158    TI_UINT8                            numOfEntries;                                   /**< number of entries in the list */
159    neighborAP_t                    APListPtr[ MAX_NUM_OF_NEIGHBOR_APS ];           /**< neighbor APs list */
160    scan_neighborDiscoveryState_e   trackStatusList[ MAX_NUM_OF_NEIGHBOR_APS ];     /**< tracking status list */
161} scan_neighborAPListDiscovery_t;
162
163/** \struct scan_BSSEntry
164 * \brief This structure contains information relevant only for scan manager module on a BSS
165 */
166typedef struct
167{
168    TI_UINT8                    trackFailCount;                 /**< number of consecutive failed track attempts */
169    TI_UINT64                   localTSF;                       /**<
170                                                             * the TSF of the AP the station is connected to at the
171                                                             * reception of the last frame from this AP
172                                                             */
173#ifdef SCAN_SPS_USE_DRIFT_COMPENSATION
174    TI_INT64               prevTSFDelta;                                               /**< Previous TSF delta */
175    TI_INT32               deltaChangeArray[ SCAN_SPS_NUM_OF_TSF_DELTA_ENTRIES ];      /**<
176                                                                                     * Array holding deltas
177                                                                                     * between prev. TSF delta
178                                                                                     */
179    int                 deltaChangeArrayIndex;                                      /**<
180                                                                                     * index to where next entry
181                                                                                     * in the delta array should
182                                                                                     * be stored
183                                                                                     */
184#endif
185} scan_BSSEntry_t;
186
187/** \struct scan_BSSList
188 * \brief This structure contains the BSS tracking list.
189 */
190typedef struct
191{
192    TI_UINT8               numOfEntries;                                               /**< Number of entries in the list */
193    bssEntry_t          BSSList[ MAX_SIZE_OF_BSS_TRACK_LIST ];                      /**< BSS public information */
194    scan_BSSEntry_t     scanBSSList[ MAX_SIZE_OF_BSS_TRACK_LIST ];                  /**<
195                                                                                     * BSS scan manager private
196                                                                                     * information
197                                                                                     */
198} scan_BSSList_t;
199
200/** \struct scan_SPSHelper_t
201 * \brief This structure contains information used for building SPS scan command
202 */
203typedef struct
204{
205    TI_UINT64                          nextEventTSF;                                   /**<
206                                                                                     * local TSF value of AP next frame
207                                                                                     * transmission
208                                                                                     */
209    int                             trackListIndex;                                 /**< index to BSS info in the track list */
210    int                             nextAPIndex;                                    /**< index of next AP entry */
211} scan_SPSHelper_t;
212
213#ifdef TI_DBG
214/** \struct scan_mngrStat_t
215 * \brief holds all scan manager statistics
216 */
217typedef struct
218{
219    TI_UINT32      receivedFrames;                                     /**< Number of scan results received */
220    TI_UINT32      discardedFramesLowRSSI;                             /**<
221                                                                     * Number of frames discarded due
222                                                                     * to RSSI lower than threshold
223                                                                     */
224    TI_UINT32      discardedFramesOther;                               /**<
225                                                                     * Number of frames discarded due to
226                                                                     * other reasons (invalid band,
227                                                                     * list full)
228                                                                     */
229    TI_UINT32      SPSSavedByDTIMCheck;                                /**<
230                                                                     * Number of SPS scans that were moved
231                                                                     * due to the DTIM collision detection mechanism
232                                                                     */
233    TI_UINT32      APsRemovedDTIMOverlap;                              /**<
234                                                                     * Number of times APs were removed from
235                                                                     * tracking list because all their beacons
236                                                                     * collide with current AP DTIMs
237                                                                     */
238    TI_UINT32      APsRemovedInvalidChannel;                           /**<
239                                                                     * Number of times APs were removed from
240                                                                     * tracking list because their channel was
241                                                                     * not valid for tracking scan type
242                                                                     */
243    TI_UINT32      TrackingGByStatus[ SCAN_CRS_NUM_OF_RES_STATUS ];    /**<
244                                                                     * Number of track scans on G,
245                                                                     * according to completion status
246                                                                     */
247    TI_UINT32      TrackingAByStatus[ SCAN_CRS_NUM_OF_RES_STATUS ];    /**<
248                                                                     * Number of track scans on A,
249                                                                     * according to completion status
250                                                                     */
251    TI_UINT32      DiscoveryGByStatus[ SCAN_CRS_NUM_OF_RES_STATUS ];   /**<
252                                                                     * Number of discovery scans on G,
253                                                                     * according to completion status
254                                                                     */
255    TI_UINT32      DiscoveryAByStatus[ SCAN_CRS_NUM_OF_RES_STATUS ];   /**<
256                                                                     * Number of discovery scans on A,
257                                                                     * according to completion status
258                                                                     */
259    TI_UINT32      ImmediateGByStatus[ SCAN_CRS_NUM_OF_RES_STATUS ];   /**<
260                                                                     * Number of immediate scans on G,
261                                                                     * according to completion status
262                                                                     */
263    TI_UINT32      ImmediateAByStatus[ SCAN_CRS_NUM_OF_RES_STATUS ];   /**<
264                                                                     * Number of immediate scans on A,
265                                                                     * according to completion status
266                                                                     */
267    TI_UINT32      ConsecutiveTrackFailCountHistogram[ SCAN_MNGR_STAT_MAX_TRACK_FAILURE ];
268                                                                    /**<
269                                                                     * Number of consecutive track
270                                                                     * fail counts */
271    TI_UINT32      SPSChannelsNotAttended[ SCAN_MAX_NUM_OF_SPS_CHANNELS_PER_COMMAND ];
272                                                                    /**<
273                                                                     * Number of times SPS channels were
274                                                                     * not scanned by FW, according to
275                                                                     * their location in the scan command
276                                                                     */
277} scan_mngrStat_t;
278#endif
279
280/** \struct scanMngr_t
281 * \brief This structure contains the scan manager object data
282 */
283typedef struct
284{
285    TTsfDtim                        currTsfDtimMib;
286    /* handles to other modules */
287    TI_HANDLE                       hOS;                                            /**< handle to the OS object */
288    TI_HANDLE                       hReport;                                        /**< handle to the report object */
289    TI_HANDLE                       hRegulatoryDomain;                              /**<
290                                                                                     * handle to the regulatory domain
291                                                                                     * object
292                                                                                     */
293    TI_HANDLE                       hScanCncn;                                      /**<
294                                                                                     * handle to the scan concentrator
295                                                                                     * object
296                                                                                     */
297    TI_HANDLE                       hRoamingMngr;                                   /**<
298                                                                                     * handle to the roaming manager
299                                                                                     * object
300                                                                                     */
301    TI_HANDLE                       hSiteMngr;                                      /**<
302                                                                                     * handle to the site manager object*/
303    TI_HANDLE                       hTWD;
304
305    TI_HANDLE                       hTimer;                                         /* handle to the timer module */
306
307    TI_HANDLE                       hEvHandler;                                     /* handle to the eventHandler module */
308    TI_HANDLE                       hAPConnection;                                  /* handle to the AP connection module */
309    /* start / stop flag */
310    TI_BOOL                         bContinuousScanStarted;                         /**<
311                                                                                     * Indicates whether continuous scan
312                                                                                     * was started
313                                                                                     */
314    /* Timer */
315    TI_HANDLE                       hContinuousScanTimer;                           /**< continuous scan timer object */
316    TI_BOOL                         bTimerRunning;                                  /**<
317                                                                                     * indicates whether the timer was
318                                                                                     * started
319                                                                                     */
320
321    /* scan policy */
322    TScanPolicy                     scanPolicy;                                     /**< scan policy */
323    TI_BOOL                         bLowQuality;                                    /**<
324                                                                                     * Indicates whether to use the low
325                                                                                     * quality time or normal quality
326                                                                                     * timer for continuous scan.
327                                                                                     */
328
329    /* tracking and discovery information */
330    scan_contScanState_e            contScanState;                                  /**< current continuous scan state */
331    scan_immedScanState_e           immedScanState;                                 /**< current immediate scan state */
332    TI_BOOL                         bImmedNeighborAPsOnly;                          /**<
333                                                                                     * whether immediate scan is to search
334                                                                                     * for neighbor AP's only
335                                                                                     */
336    scan_neighborAPListDiscovery_t  neighborAPsDiscoveryList[ RADIO_BAND_NUM_OF_BANDS ];
337                                                                                    /**<
338                                                                                     * List of neighbor APs and their
339                                                                                     * discovery status
340                                                                                     */
341    TI_UINT8                        neighborAPsDiscoveryIndex[ RADIO_BAND_NUM_OF_BANDS ];
342                                                                                    /**<
343                                                                                     * Indexes for the neighbor APs
344                                                                                     * discovery lists
345                                                                                     */
346    TI_UINT8                        channelDiscoveryIndex[ RADIO_BAND_NUM_OF_BANDS ];  /**< Indexes for the channels lists */
347    scan_discoveryPart_e            currentDiscoveryPart;                           /**< current discovery part */
348    TI_BOOL                         bSynchronized;                                  /**<
349                                                                                     * TI_TRUE if SPS data is synchronized
350                                                                                     * (no TSF error event occurred)
351                                                                                     */
352    TI_UINT64                       currentTSF;                                     /**<
353                                                                                     * the local current TSF value
354                                                                                     */
355    TI_UINT32                       currentHostTimeStamp;                           /**<
356                                                                                     * The current local host time stamp
357                                                                                     * (at the time of the above TSF value)
358                                                                                     */
359    TI_UINT8                        lastLocalBcnDTIMCount;                          /**<
360                                                                                     * the DTIM count at the last
361                                                                                     * local beacon reception in the FW
362                                                                                     */
363    TI_UINT64                       lastLocalBcnTSF;                                /**<
364                                                                                     * The local TSF value at the last
365                                                                                     * local beacon reception
366                                                                                     */
367    TMacAddr                        currentBSS;                                     /**< MAC address of current BSS */
368    ERadioBand                      currentBSSBand;                                 /**< band of current BSS */
369    TI_UINT32                       currentBSSBeaconInterval;                       /**< Beacon interval of current BSS */
370    TI_UINT32                       currentBSSDtimPeriod;                           /**< DTIM period of current BSS */
371    TI_BOOL                         bNewBSSFound;                                   /**<
372                                                                                     * Indicates whether a new BSS was
373                                                                                     * found during the last discovery
374                                                                                     * stage
375                                                                                     */
376    TI_UINT16                       consecNotFound;                                 /**<
377                                                                                     * consecutive number of scan
378                                                                                     * cycles in which no new AP was found
379                                                                                     * (used to re-pre-auth current APs)
380                                                                                     */
381    TScanParams                     scanParams;                                     /**< temporary storage for scan command */
382    scan_BSSList_t                  BSSList;                                        /**< BSS list (also used for tracking) */
383
384    scanMngr_connStatus_e           connStatus;                                /* save the connection status during manual roaming */
385	TI_UINT8                        scanningOperationalMode;                   /* 0 - manual ,  1 - auto */
386    TScanParams                     manualScanParams;                          /* temporary storage for manual scan command */
387
388
389
390#ifdef TI_DBG
391    scan_mngrStat_t                 stats;                                          /**< statistics */
392    ERadioBand                      statsLastDiscoveryBand;                         /**<
393                                                                                     * For statistics: the band on which
394                                                                                     * discovery was last performed.
395                                                                                     */
396#endif
397
398} scanMngr_t;
399
400/*
401 ***********************************************************************
402 *  External data definitions.
403 ***********************************************************************
404 */
405
406/*
407 ***********************************************************************
408 *  External functions definitions
409 ***********************************************************************
410 */
411
412/**
413 * \\n
414 * \date 01-Mar-2005\n
415 * \brief Frees scan manager resources.\n
416 *
417 * Function Scope \e Private.\n
418 * \param hScanMngr - handle to the scan manager object.\n
419 */
420void scanMngrFreeMem (TI_HANDLE hScanMngr);
421
422/**
423 * \\n
424 * \date 01-Mar-2005\n
425 * \brief Starts a continuous scan operation.\n
426 *
427 * Function Scope \e Private.\n
428 * \param hScanMngr - handle to the scan manager object.\n
429 */
430void scanMngrPerformContinuousScan( TI_HANDLE hScanMngr );
431
432void scanMngrGetCurrentTsfDtimMibCB(TI_HANDLE hScanMngr, TI_STATUS status, TI_UINT8* CB_buf) ;
433void scanMngr_GetUpdatedTsfDtimMibForScan (TI_HANDLE hScanMngr, TI_BOOL bTwdInitOccured) ;
434
435/**
436 * \\n
437 * \date 01-Mar-2005\n
438 * \brief Perform aging on the BSS list.\n
439 *
440 * Function Scope \e Private.\n
441 * \param hScanMngr - handle to the scan manager object.\n
442 */
443void scanMngrPerformAging( TI_HANDLE hScanMngr );
444
445/**
446 * \\n
447 * \date 01-Mar-2005\n
448 * \brief Updates object data according to a received frame.\n
449 *
450 * Function Scope \e Private.\n
451 * \param hScanMngr - handle to the scan manager object.\n
452 * \param frameInfo - all frame related information.\n
453 */
454void scanMngrUpdateReceivedFrame( TI_HANDLE hScanMngr, TScanFrameInfo* frameInfo );
455
456/**
457 * \\n
458 * \date 17-Mar-2005\n
459 * \brief Cerate a new tracking entry and store the newly discovered AP info in it.\n
460 *
461 * Function Scope \e Private.\n
462 * \param hScanMngr - handle to the scan manager object.\n
463 * \param frameInfo - a pointer to the information received from this AP.\n
464 */
465void scanMngrInsertNewBSSToTrackingList( TI_HANDLE hScanMngr, TScanFrameInfo* frameInfo );
466
467/**
468 * \\n
469 * \date 17-Mar-2005\n
470 * \brief Updates tracked AP information.\n
471 *
472 * Function Scope \e Private.\n
473 * \param hScanMngr - handle to the scan manager object.\n
474 * \param BSSListIndex - index to the BSS list where the AP information is stored.\n
475 * \param frameInfo - a pointer to the information received from this AP.\n
476 */
477void scanMngrUpdateBSSInfo( TI_HANDLE hScanMngr, TI_UINT8 BSSListIndex, TScanFrameInfo* frameInfo );
478
479/**
480 * \\n
481 * \date 16-Mar-2005\n
482 * \brief Searched tracking list for an entry matching given BSSID.\n
483 *
484 * Function Scope \e Private.\n
485 * \param hScanMngr - handle to the scan manager object.\n
486 * \param bssId - the BSSID to search for.\n
487 * \return entry index if found, -1 if no entry matching the BSSID was found.\n
488 */
489TI_INT8 scanMngrGetTrackIndexByBssid( TI_HANDLE hScanMngr, TMacAddr* bssId );
490
491/**
492 * \\n
493 * \date 02-Mar-2005\n
494 * \brief Search current policy for band policy
495 *
496 * Function Scope \e Private.\n
497 * \param hScanMngr - handle to the scan manager object.\n
498 * \param band - the band to find policy for.\n
499 * \return the policy structure if found, NULL if no policy configured for this band.\n
500 */
501TScanBandPolicy* scanMngrGetPolicyByBand( TI_HANDLE hScanMngr, ERadioBand band );
502
503/**
504 * \\n
505 * \date 06-Mar-2005\n
506 * \brief Sets the next discovery part according to current discovery part, policies and neighbor APs availability .\n
507 *
508 * Function Scope \e Private.\n
509 * \param hScanMngr - handle to the scan manager object.\n
510 */
511void scanMngrSetNextDiscoveryPart( TI_HANDLE hScanMngr );
512
513/**
514 * \\n
515 * \date 06-Mar-2005\n
516 * \brief Checks whether discovery should be performed on the specified discovery part.\n
517 *
518 * Function Scope \e Private.\n
519 * \param hScanMngr - handle to the scan manager object.\n
520 * \param discoveryPart - the discovery part to check.\n
521 */
522TI_BOOL scanMngrIsDiscoveryValid( TI_HANDLE hScanMngr, scan_discoveryPart_e discoveryPart );
523
524/**
525 * \\n
526 * \date 07-Mar-2005\n
527 * \brief Check whether there are neighbor APs to track on the given band.\n
528 *
529 * Function Scope \e Private.\n
530 * \param hScanMngr - handle to the scan manager object.\n
531 * \param bandPolicy - The scan policy for the requested band.\n
532 * \param bNeighborAPsOnly - whether to scan for neighbor APs only or for all policy defined channels.\n
533 */
534TI_BOOL scanMngrNeighborAPsAvailableForDiscovery( TI_HANDLE hScanMngr, ERadioBand band );
535
536/**
537 * \\n
538 * \date 02-Mar-2005\n
539 * \brief Builds a scan command on the object workspace for immediate scan.\n
540 *
541 * Function Scope \e Private.\n
542 * \param hScanMngr - handle to the scan manager object.\n
543 * \param bandPolicy - The scan policy for the requested band.\n
544 * \param bNeighborAPsOnly - whether to scan for neighbor APs only or for all policy defined channels.\n
545 */
546void scanMngrBuildImmediateScanCommand( TI_HANDLE hScanMngr, TScanBandPolicy* bandPolicy, TI_BOOL bNeighborAPsOnly );
547
548/**
549 * \\n
550 * \date 03-Mar-2005\n
551 * \brief Builds a scan command on the object workspace for tracking.\n
552 *
553 * Function Scope \e Private.\n
554 * \param hScanMngr - handle to the scan manager object.\n
555 * \param bandPolicy - The scan policy for the band to track on.\n
556 * \param band - the band to scan.\n
557 */
558void scanMngrBuildTrackScanCommand( TI_HANDLE hScanMngr, TScanBandPolicy* bandPolicy, ERadioBand band );
559
560/**
561 * \\n
562 * \date 03-Mar-2005\n
563 * \brief Builds a scan command on the object workspace for discovery.\n
564 *
565 * Function Scope \e Private.\n
566 * \param hScanMngr - handle to the scan manager object.\n
567 */
568void scanMngrBuildDiscoveryScanCommand( TI_HANDLE hScanMngr );
569
570/**
571 * \\n
572 * \date 02-Mar-2005\n
573 * \brief Builds the scan command header on the object workspace.\n
574 *
575 * Function Scope \e Private.\n
576 * \param hScanMngr - handle to the scan manager object.\n
577 * \param scanMethod - The scan method (and parameters) to use.\n
578 * \param band - the band to scan.\n
579 */
580void scanMngrBuildScanCommandHeader( TI_HANDLE hScanMngr, TScanMethod* scanMethod, ERadioBand band );
581
582/**
583 * \\n
584 * \date 06-Mar-2005\n
585 * \brief Add neighbor APs to scan command on the object workspace for discovery scan.\n
586 *
587 * Function Scope \e Private.\n
588 * \param hScanMngr - handle to the scan manager object.\n
589 * \param bandPolicy - the scan policy for the band to use.\n
590 */
591void scanMngrAddNeighborAPsForDiscovery( TI_HANDLE hScanMngr, TScanBandPolicy* bandPolicy );
592
593/**
594 * \\n
595 * \date 06-Mar-2005\n
596 * \brief Add channel from policy channels list to scan command on the object workspace for discovery scan.\n
597 *
598 * Function Scope \e Private.\n
599 * \param hScanMngr - handle to the scan manager object.\n
600 * \param bandPolicy - the scan policy for the band to use.\n
601 */
602void scanMngrAddChannelListForDiscovery( TI_HANDLE hScanMngr, TScanBandPolicy* bandPolicy );
603
604/**
605 * \\n
606 * \date 02-Mar-2005\n
607 * \brief Add SPS channels to scan command on the object workspace.\n
608 *
609 * Function Scope \e Private.\n
610 * \param hScanMngr - handle to the scan manager object.\n
611 * \param scanMethod - The scan method (and parameters) to use.\n
612 * \param band - the band to scan.\n
613 */
614void scanMngrAddSPSChannels( TI_HANDLE hScanMngr, TScanMethod* scanMethod, ERadioBand band );
615
616/**
617 * \\n
618 * \date 07-Mar-2005\n
619 * \brief Calculates local TSF of the next event (beacon or GPR) of the given tracked AP.\n
620 *
621 * Function Scope \e Private.\n
622 * \param hScanMngr - handle to the scan manager object.\n
623 * \param BSSList - a pointer to the track list.\n
624 * \param entryIndex - the index of the AP for which calculation is requires in the tracking list.\n
625 * \param initialTSFValue - local TSF value AFTER which the next event is to found.\n
626 * \return The approximate current TSF
627 */
628TI_UINT64 scanMngrCalculateNextEventTSF( TI_HANDLE hScanMngr, scan_BSSList_t* BSSList, TI_UINT8 entryIndex, TI_UINT64 initialTSFValue );
629
630/**
631 * \\n
632 * \date 20-September-2005\n
633 * \brief Check whether a time range collides with current AP DTIM
634 *
635 * Function Scope \e Private.\n
636 * \param hScanMngr - handle to the scan manager object.\n
637 * \param rangeStart - the time range start TSF.\n
638 * \param eventEnd - the time range end TSF.\n
639 * \return Whether the event collides with a DTIM (TRUF if it does, TI_FALSE if it doesn't).\n
640 */
641TI_BOOL scanMngrDTIMInRange( TI_HANDLE hScanMngr, TI_UINT64 eventStart, TI_UINT64 eventEnd );
642
643/**
644 * \\n
645 * \date 03-Mar-2005\n
646 * \brief Add a normal channel entry to the object workspace scan command.\n
647 *
648 * Function Scope \e Private.\n
649 * \param hScanMngr - handle to the scan manager object.\n
650 * \param scanMethod - The scan method (and parameters) to use.\n
651 * \param channel - the channel index.\n
652 * \param BSSID - pointer to the BSSID to use (may be broadcast.\n
653 * \param txPowerDbm - Tx power to transmit probe requests.\n
654 */
655void scanMngrAddNormalChannel( TI_HANDLE hScanMngr, TScanMethod* scanMethod, TI_UINT8 channel,
656                               TMacAddr* BSSID, TI_UINT8 txPowerDbm );
657/**
658 * \\n
659 * \date 02-Mar-2005\n
660 * \brief Removes an entry from the BSS list (by replacing it with another entry, if any).\n
661 *
662 * Function Scope \e Private.\n
663 * \param hScanMngr - handle to the scan manager object.\n
664 * \param BSSEntryIndex - index of the entry to remove.\n
665 */
666void scanMngrRemoveBSSListEntry( TI_HANDLE hScanMngr, TI_UINT8 BSSEntryIndex );
667
668/**
669 * \\n
670 * \date 02-Mar-2005\n
671 * \brief Removes all BSS list entries that are neither neighbor APs not on a policy defined channel.\n
672 *
673 * Function Scope \e Private.\n
674 * \param hScanMngr - handle to the scan manager object.\n
675 * \param bCheckNeighborAPs - whether to verify that APs marked as neighbor APs are really neighbor APs.\n
676 * \param bCheckChannels - whether to verify that APs not marked as neighbor APs are on policy defined channel.\n
677 */
678void scanMngrUpdateBSSList( TI_HANDLE hScanMngr, TI_BOOL bCheckNeighborAPs, TI_BOOL bCheckChannels );
679
680/**
681 * \\n
682 * \date 02-Mar-2005\n
683 * \brief returns the index of a neighbor AP.\n
684 *
685 * Function Scope \e Private.\n
686 * \param hScanMngr - handle to the scan manager object.\n
687 * \param band - the band on which the AP resides.\n
688 * \param bssId - the AP's BSSID.\n
689 * \return the index into the neighbor AP list for the given address, -1 if AP is not in list.\n
690 */
691TI_INT8 scanMngrGetNeighborAPIndex( TI_HANDLE hScanMngr, ERadioBand band, TMacAddr* bssId );
692
693/**
694 * \\n
695 * \date 02-Mar-2005\n
696 * \brief Checks whether a channel is defined on a policy.\n
697 *
698 * Function Scope \e Private.\n
699 * \param hScanMngr - handle to the scan manager object.\n
700 * \param band - the band on which the channel is.\n
701 * \param channel - the channel number.\n
702 * \return TI_TRUE if channel is defined on policy, TI_FALSE otherwise.\n
703 */
704TI_BOOL scanMngrIsPolicyChannel( TI_HANDLE hScanMngr, ERadioBand band, TI_UINT8 channel );
705
706/**
707 * \\n
708 * \date 18-Apr-2005\n
709 * \brief Converts scan concentrator result status to scan manager result status, to be returned to roaming manager.\n
710 *
711 * Function Scope \e Private.\n
712 * \param result status - scan concentrator result status.\n
713 * \return appropriate scan manager status.\n
714 */
715scan_mngrResultStatus_e scanMngrConvertResultStatus( EScanCncnResultStatus resultStatus );
716
717/**
718 * \\n
719 * \date 09-Mar-2005\n
720 * \brief Print a neighbor AP list.\n
721 *
722 * Function Scope \e Private.\n
723 * \param hScanMngr - handle to the scan manager object.\n
724 * \param neighborAPList - the list of neighbor APs to print
725 */
726void scanMngrTracePrintNeighborAPsList( TI_HANDLE hScanMngr, neighborAPList_t *neighborAPList );
727
728/**
729 * \\n
730 * \date 09-Mar-2005\n
731 * \brief Print a neighbor AP.\n
732 *
733 * Function Scope \e Private.\n
734 * \param hScanMngr - handle to the scan manager object.\n
735 * \param neighborAP - the neighbor AP to print
736 */
737void scanMngrTracePrintNeighborAP( TI_HANDLE hScanMngr, neighborAP_t* neighborAP );
738
739/**
740 * \\n
741 * \date 09-Mar-2005\n
742 * \brief Print a band scan policy AP.\n
743 *
744 * Function Scope \e Private.\n
745 * \param bandPolicy - the band scan policy to print.\n
746 */
747void scanMngrTracePrintBandScanPolicy( TScanBandPolicy* bandPolicy );
748
749/**
750 * \\n
751 * \date 09-Mar-2005\n
752 * \brief Print a scan method
753 *
754 * Function Scope \e Private.\n
755 * \param scanMethod - the scan method to print.\n
756 */
757void scanMngrTracePrintScanMethod( TScanMethod* scanMethod );
758
759/**
760 * \\n
761 * \date 09-Mar-2005\n
762 * \brief print a normal scan method
763 *
764 * Function Scope \e Private.\n
765 * \param basicMethodParams - the basic method parameters to print.\n
766 */
767void scanMngrTracePrintNormalScanMethod( TScanBasicMethodParams* basicMethodParams );
768
769/**
770 * \\n
771 * \date 09-Mar-2005\n
772 * \brief print an AC triggered scan method
773 *
774 * Function Scope \e Private.\n
775 * \param triggeredMethodParams - the Tid-triggered method parameters to print.\n
776 */
777void scanMngrTracePrintTriggeredScanMethod( TScanTidTriggeredMethodParams* triggeredMethodParams );
778
779/**
780 * \\n
781 * \date 09-Mar-2005\n
782 * \brief print a SPS scan method
783 *
784 * Function Scope \e Private.\n
785 * \param SPSMethodParams - the SPS method parameters to print.\n
786 */
787void scanMngrTracePrintSPSScanMethod( TScanSPSMethodParams* SPSMethodParams );
788
789#ifdef TI_DBG
790/**
791 * \\n
792 * \date 31-Mar-2005\n
793 * \brief print debug information for every received frame.\n
794 *
795 * Function Scope \e Private.\n
796 * \param hScanMngr - handle to the scan manager object.\n
797 * \param frameInfo - holding all frame related information.\n
798 */
799void scanMngrDebugPrintReceivedFrame( TI_HANDLE hScanMngr, TScanFrameInfo *frameInfo );
800
801/**
802 * \\n
803 * \date 31-Mar-2005\n
804 * \brief print BSS list.\n
805 *
806 * Function Scope \e Private.\n
807 * \param hScanMngr - handle to the scan manager object.\n
808 */
809void scanMngrDebugPrintBSSList( TI_HANDLE hScanMngr );
810
811/**
812 * \\n
813 * \date 31-Mar-2005\n
814 * \brief print one entry in the BSS list.\n
815 *
816 * Function Scope \e Private.\n
817 * \param hScanMngr - handle to the scan manager object.\n
818 * \param entryIndex - the index of the entry to print.\n
819 */
820void scanMngrDebugPrintBSSEntry( TI_HANDLE hScanMngr, TI_UINT8 entryIndex );
821
822/**
823 * \\n
824 * \date 14-Apr-2005\n
825 * \brief print SPS helper list
826 *
827 * Function Scope \e Private.\n
828 * \param hScanMngr - handle to the scan manager object.\n
829 * \param spsHelperList - the list to print.\n
830 * \param arrayHead - the index of the first element in the list.\n
831 * \param arraySize - the size of the array.\n
832 */
833void scanMngrDebugPrintSPSHelperList( TI_HANDLE hScanMngr, scan_SPSHelper_t* spsHelperList, int arrayHead, int arraySize );
834
835/**
836 * \\n
837 * \date 26-May-2005\n
838 * \brief Print scan result histogram statistics.\n
839 *
840 * Function Scope \e Private.\n
841 * \param scanResultHistogram - Scan results histogram (by scan complete reason).\n
842 */
843void scanMngrStatsPrintScanResultHistogram( TI_UINT32 scanResultHistogram[] );
844
845/**
846 * \\n
847 * \date 26-May-2005\n
848 * \brief Print track fail count histogram statistics.\n
849 *
850 * Function Scope \e Private.\n
851 * \param trackFailHistogram - tracking failure histogram (by tracking retry).\n
852 */
853void scanMngrStatsPrintTrackFailHistogrsm( TI_UINT32 trackFailHistogram[] );
854
855/**
856 * \\n
857 * \date 26-May-2005\n
858 * \brief Print SPS attendant channel histogram statistics.\n
859 *
860 * Function Scope \e Private.\n
861 * \param SPSChannelsNotAttendedHistogram - SPS channels attendant histogram.\n
862 */
863void scanMngrStatsPrintSPSChannelsHistogram( TI_UINT32 SPSChannelsNotAttendedHistogram[] );
864
865/**
866 * \\n
867 * \date 25-July-2005\n
868 * \brief Print One neighbor AP entry.\n
869 *
870 * Function Scope \e Private.\n
871 * \param pNeighborAp - pointer to the neighbor AP data.\n
872 * \param discovery state - the discovery state of this neighbor AP.\n
873 */
874void scanMngrDebugPrintNeighborAP( neighborAP_t* pNeighborAp, scan_neighborDiscoveryState_e discoveryState );
875
876/**
877 * \\n
878 * \date 27-July-2005\n
879 * \brief Prints a scan command.\n
880 *
881 * Function Scope \e Private.\n
882 * \param pScanParams - a pointer to the scan parameters structure.\n
883 */
884void scanMngrDebugPrintScanCommand( TScanParams* pScanParams );
885
886/**
887 * \\n
888 * \date 27-July-2005\n
889 * \brief Prints scan command single normal channel.\n
890 *
891 * Function Scope \e Private.\n
892 * \param pNormalChannel - a pointer to the normal channel to print.\n
893 */
894void scanMngrDebugPrintNormalChannelParam( TScanNormalChannelEntry* pNormalChannel );
895
896/**
897 * \\n
898 * \date 27-July-2005\n
899 * \brief Prints scan command single SPS channel.\n
900 *
901 * Function Scope \e Private.\n
902 * \param pSPSChannel - a pointer to the SPS channel to print.\n
903 */
904void scanMngrDebugPrintSPSChannelParam( TScanSpsChannelEntry* pSPSChannel );
905
906
907#endif /* TI_DBG */
908
909#endif /* __SCAN_MNGR_H__ */
910