• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
3  *
4  * This program is distributed in the hope that it will be useful, but WITHOUT
5  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
7  * more details.
8  *
9  * The full GNU General Public License is included in this distribution in the
10  * file called LICENSE.
11  *
12  * Contact Information:
13  * wlanfae <wlanfae@realtek.com>
14 ******************************************************************************/
15 #ifndef __INC_DOT11D_H
16 #define __INC_DOT11D_H
17 
18 #include "rtllib.h"
19 
20 
21 
22 struct chnl_txpow_triple {
23 	u8 FirstChnl;
24 	u8  NumChnls;
25 	u8  MaxTxPowerInDbm;
26 };
27 
28 enum dot11d_state {
29 	DOT11D_STATE_NONE = 0,
30 	DOT11D_STATE_LEARNED,
31 	DOT11D_STATE_DONE,
32 };
33 
34 /**
35  * struct rt_dot11d_info * @CountryIeLen: value greater than 0 if @CountryIeBuf contains
36  *		  valid country information element.
37  * @channel_map: holds channel values
38  *		0 - invalid,
39  *		1 - valid (active scan),
40  *		2 - valid (passive scan)
41  * @CountryIeSrcAddr - Source AP of the country IE
42  */
43 
44 struct rt_dot11d_info {
45 
46 	bool bEnabled;
47 
48 	u16 CountryIeLen;
49 	u8  CountryIeBuf[MAX_IE_LEN];
50 	u8  CountryIeSrcAddr[6];
51 	u8  CountryIeWatchdog;
52 
53 	u8  channel_map[MAX_CHANNEL_NUMBER+1];
54 	u8  MaxTxPwrDbmList[MAX_CHANNEL_NUMBER+1];
55 
56 	enum dot11d_state State;
57 };
58 
cpMacAddr(unsigned char * des,unsigned char * src)59 static inline void cpMacAddr(unsigned char *des, unsigned char *src)
60 {
61 	memcpy(des, src, 6);
62 }
63 
64 #define GET_DOT11D_INFO(__pIeeeDev)			\
65 	 ((struct rt_dot11d_info *)((__pIeeeDev)->pDot11dInfo))
66 
67 #define IS_DOT11D_ENABLE(__pIeeeDev)			\
68 	 (GET_DOT11D_INFO(__pIeeeDev)->bEnabled)
69 #define IS_COUNTRY_IE_VALID(__pIeeeDev)			\
70 	(GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0)
71 
72 #define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa)		\
73 	 ether_addr_equal_unaligned( \
74 		GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
75 #define UPDATE_CIE_SRC(__pIeeeDev, __pTa)		\
76 	cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
77 
78 #define GET_CIE_WATCHDOG(__pIeeeDev)				\
79 	 (GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog)
RESET_CIE_WATCHDOG(struct rtllib_device * __pIeeeDev)80 static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__pIeeeDev)
81 {
82 	GET_CIE_WATCHDOG(__pIeeeDev) = 0;
83 }
84 #define UPDATE_CIE_WATCHDOG(__pIeeeDev) (++GET_CIE_WATCHDOG(__pIeeeDev))
85 
86 void dot11d_init(struct rtllib_device *dev);
87 void Dot11d_Channelmap(u8 channel_plan, struct rtllib_device *ieee);
88 void Dot11d_Reset(struct rtllib_device *dev);
89 void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr,
90 			    u16 CoutryIeLen, u8 *pCoutryIe);
91 void DOT11D_ScanComplete(struct rtllib_device *dev);
92 
93 #endif
94