staging: hv: make HYPERV_UTILS depend on NLS to prevent a build error
[linux-2.6/next.git] / drivers / staging / rtl8192e / dot11d.h
blob106ebcfa7d7dd07e6233f35e3808c45493d8e3b2
1 #ifndef INC_DOT11D_H
2 #define INC_DOT11D_H
4 #ifdef ENABLE_DOT11D
5 #include "ieee80211.h"
7 typedef struct _CHNL_TXPOWER_TRIPLE {
8 u8 FirstChnl;
9 u8 NumChnls;
10 u8 MaxTxPowerInDbm;
11 } CHNL_TXPOWER_TRIPLE, *PCHNL_TXPOWER_TRIPLE;
13 typedef enum _DOT11D_STATE {
14 DOT11D_STATE_NONE = 0,
15 DOT11D_STATE_LEARNED,
16 DOT11D_STATE_DONE,
17 } DOT11D_STATE;
19 /**
20 * struct _RT_DOT11D_INFO
21 * @CountryIeLen: value greater than 0 if @CountryIeBuf contains
22 * valid country information element.
23 * @chanell_map: holds channel values
24 * 0 - invalid,
25 * 1 - valid (active scan),
26 * 2 - valid (passive scan)
27 * @CountryIeSrcAddr - Source AP of the country IE
30 typedef struct _RT_DOT11D_INFO {
31 bool bEnabled;
33 u16 CountryIeLen;
34 u8 CountryIeBuf[MAX_IE_LEN];
35 u8 CountryIeSrcAddr[6];
36 u8 CountryIeWatchdog;
38 u8 channel_map[MAX_CHANNEL_NUMBER+1];
39 u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER+1];
41 DOT11D_STATE State;
42 } RT_DOT11D_INFO, *PRT_DOT11D_INFO;
44 static inline void cpMacAddr(unsigned char *des, unsigned char *src)
46 memcpy(des, src, 6);
49 #define GET_DOT11D_INFO(__pIeeeDev) ((PRT_DOT11D_INFO) \
50 ((__pIeeeDev)->pDot11dInfo))
52 #define IS_DOT11D_ENABLE(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->bEnabled
53 #define IS_COUNTRY_IE_VALID(__pIeeeDev) \
54 (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0)
56 #define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) \
57 eqMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
59 #define UPDATE_CIE_SRC(__pIeeeDev, __pTa) \
60 cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
62 #define IS_COUNTRY_IE_CHANGED(__pIeeeDev, __Ie) \
63 (((__Ie).Length == 0 || (__Ie).Length != \
64 GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen) ? FALSE : \
65 (!memcmp(GET_DOT11D_INFO(__pIeeeDev)->CountryIeBuf, \
66 (__Ie).Octet, (__Ie).Length)))
68 #define CIE_WATCHDOG_TH 1
69 #define GET_CIE_WATCHDOG(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog
70 #define RESET_CIE_WATCHDOG(__pIeeeDev) GET_CIE_WATCHDOG(__pIeeeDev) = 0
71 #define UPDATE_CIE_WATCHDOG(__pIeeeDev) ++GET_CIE_WATCHDOG(__pIeeeDev)
73 #define IS_DOT11D_STATE_DONE(__pIeeeDev) \
74 (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE)
77 void Dot11d_Init(struct ieee80211_device *dev);
79 void Dot11d_Reset(struct ieee80211_device *dev);
81 void Dot11d_UpdateCountryIe(struct ieee80211_device *dev, u8 *pTaddr,
82 u16 CoutryIeLen, u8 *pCoutryIe);
84 u8 DOT11D_GetMaxTxPwrInDbm(struct ieee80211_device *dev, u8 channel);
86 void DOT11D_ScanComplete(struct ieee80211_device *dev);
88 int IsLegalChannel(struct ieee80211_device *dev, u8 channel);
90 int ToLegalChannel(struct ieee80211_device *dev, u8 channel);
92 #endif /* ENABLE_DOT11D */
93 #endif /* INC_DOT11D_H */