|
| 1 | +#ifndef __INC_DOT11D_H |
| 2 | +#define __INC_DOT11D_H |
| 3 | + |
| 4 | +#ifdef ENABLE_DOT11D |
| 5 | +#include "ieee80211.h" |
| 6 | + |
| 7 | +//#define ENABLE_DOT11D |
| 8 | + |
| 9 | +//#define DOT11D_MAX_CHNL_NUM 83 |
| 10 | + |
| 11 | +typedef struct _CHNL_TXPOWER_TRIPLE { |
| 12 | + u8 FirstChnl; |
| 13 | + u8 NumChnls; |
| 14 | + u8 MaxTxPowerInDbm; |
| 15 | +}CHNL_TXPOWER_TRIPLE, *PCHNL_TXPOWER_TRIPLE; |
| 16 | + |
| 17 | +typedef enum _DOT11D_STATE { |
| 18 | + DOT11D_STATE_NONE = 0, |
| 19 | + DOT11D_STATE_LEARNED, |
| 20 | + DOT11D_STATE_DONE, |
| 21 | +}DOT11D_STATE; |
| 22 | + |
| 23 | +typedef struct _RT_DOT11D_INFO { |
| 24 | + //DECLARE_RT_OBJECT(RT_DOT11D_INFO); |
| 25 | + |
| 26 | + bool bEnabled; // dot11MultiDomainCapabilityEnabled |
| 27 | + |
| 28 | + u16 CountryIeLen; // > 0 if CountryIeBuf[] contains valid country information element. |
| 29 | + u8 CountryIeBuf[MAX_IE_LEN]; |
| 30 | + u8 CountryIeSrcAddr[6]; // Source AP of the country IE. |
| 31 | + u8 CountryIeWatchdog; |
| 32 | + |
| 33 | + u8 channel_map[MAX_CHANNEL_NUMBER+1]; //!!!Value 0: Invalid, 1: Valid (active scan), 2: Valid (passive scan) |
| 34 | + //u8 ChnlListLen; // #Bytes valid in ChnlList[]. |
| 35 | + //u8 ChnlList[DOT11D_MAX_CHNL_NUM]; |
| 36 | + u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER+1]; |
| 37 | + |
| 38 | + DOT11D_STATE State; |
| 39 | +}RT_DOT11D_INFO, *PRT_DOT11D_INFO; |
| 40 | +#define eqMacAddr(a,b) ( ((a)[0]==(b)[0] && (a)[1]==(b)[1] && (a)[2]==(b)[2] && (a)[3]==(b)[3] && (a)[4]==(b)[4] && (a)[5]==(b)[5]) ? 1:0 ) |
| 41 | +#define cpMacAddr(des,src) ((des)[0]=(src)[0],(des)[1]=(src)[1],(des)[2]=(src)[2],(des)[3]=(src)[3],(des)[4]=(src)[4],(des)[5]=(src)[5]) |
| 42 | +#define GET_DOT11D_INFO(__pIeeeDev) ((PRT_DOT11D_INFO)((__pIeeeDev)->pDot11dInfo)) |
| 43 | + |
| 44 | +#define IS_DOT11D_ENABLE(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->bEnabled |
| 45 | +#define IS_COUNTRY_IE_VALID(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0) |
| 46 | + |
| 47 | +#define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) eqMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) |
| 48 | +#define UPDATE_CIE_SRC(__pIeeeDev, __pTa) cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) |
| 49 | + |
| 50 | +#define IS_COUNTRY_IE_CHANGED(__pIeeeDev, __Ie) \ |
| 51 | + (((__Ie).Length == 0 || (__Ie).Length != GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen) ? \ |
| 52 | + FALSE : \ |
| 53 | + (!memcmp(GET_DOT11D_INFO(__pIeeeDev)->CountryIeBuf, (__Ie).Octet, (__Ie).Length))) |
| 54 | + |
| 55 | +#define CIE_WATCHDOG_TH 1 |
| 56 | +#define GET_CIE_WATCHDOG(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog |
| 57 | +#define RESET_CIE_WATCHDOG(__pIeeeDev) GET_CIE_WATCHDOG(__pIeeeDev) = 0 |
| 58 | +#define UPDATE_CIE_WATCHDOG(__pIeeeDev) ++GET_CIE_WATCHDOG(__pIeeeDev) |
| 59 | + |
| 60 | +#define IS_DOT11D_STATE_DONE(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE) |
| 61 | + |
| 62 | + |
| 63 | +void |
| 64 | +Dot11d_Init( |
| 65 | + struct ieee80211_device *dev |
| 66 | + ); |
| 67 | + |
| 68 | +void |
| 69 | +Dot11d_Reset( |
| 70 | + struct ieee80211_device *dev |
| 71 | + ); |
| 72 | + |
| 73 | +void |
| 74 | +Dot11d_UpdateCountryIe( |
| 75 | + struct ieee80211_device *dev, |
| 76 | + u8 * pTaddr, |
| 77 | + u16 CoutryIeLen, |
| 78 | + u8 * pCoutryIe |
| 79 | + ); |
| 80 | + |
| 81 | +u8 |
| 82 | +DOT11D_GetMaxTxPwrInDbm( |
| 83 | + struct ieee80211_device *dev, |
| 84 | + u8 Channel |
| 85 | + ); |
| 86 | + |
| 87 | +void |
| 88 | +DOT11D_ScanComplete( |
| 89 | + struct ieee80211_device * dev |
| 90 | + ); |
| 91 | + |
| 92 | +int IsLegalChannel( |
| 93 | + struct ieee80211_device * dev, |
| 94 | + u8 channel |
| 95 | +); |
| 96 | + |
| 97 | +int ToLegalChannel( |
| 98 | + struct ieee80211_device * dev, |
| 99 | + u8 channel |
| 100 | +); |
| 101 | +#endif //ENABLE_DOT11D |
| 102 | +#endif // #ifndef __INC_DOT11D_H |
0 commit comments