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 * You should have received a copy of the GNU General Public License along with 10 * this program; if not, write to the Free Software Foundation, Inc., 11 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 12 * 13 * The full GNU General Public License is included in this distribution in the 14 * file called LICENSE. 15 * 16 * Contact Information: 17 * wlanfae <wlanfae@realtek.com> 18******************************************************************************/ 19#ifndef __INC_DOT11D_H 20#define __INC_DOT11D_H 21 22#include "ieee80211.h" 23 24typedef struct _CHNL_TXPOWER_TRIPLE { 25 u8 FirstChnl; 26 u8 NumChnls; 27 u8 MaxTxPowerInDbm; 28}CHNL_TXPOWER_TRIPLE, *PCHNL_TXPOWER_TRIPLE; 29 30typedef enum _DOT11D_STATE { 31 DOT11D_STATE_NONE = 0, 32 DOT11D_STATE_LEARNED, 33 DOT11D_STATE_DONE, 34}DOT11D_STATE; 35 36typedef struct _RT_DOT11D_INFO { 37 38 bool bEnabled; // dot11MultiDomainCapabilityEnabled 39 40 u16 CountryIeLen; // > 0 if CountryIeBuf[] contains valid country information element. 41 u8 CountryIeBuf[MAX_IE_LEN]; 42 u8 CountryIeSrcAddr[6]; // Source AP of the country IE. 43 u8 CountryIeWatchdog; 44 45 u8 channel_map[MAX_CHANNEL_NUMBER+1]; //!!!Value 0: Invalid, 1: Valid (active scan), 2: Valid (passive scan) 46 u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER+1]; 47 48 DOT11D_STATE State; 49}RT_DOT11D_INFO, *PRT_DOT11D_INFO; 50#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 ) 51#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]) 52#define GET_DOT11D_INFO(__pIeeeDev) ((PRT_DOT11D_INFO)((__pIeeeDev)->pDot11dInfo)) 53 54#define IS_DOT11D_ENABLE(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->bEnabled 55#define IS_COUNTRY_IE_VALID(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0) 56 57#define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) eqMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) 58#define UPDATE_CIE_SRC(__pIeeeDev, __pTa) cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) 59 60#define IS_COUNTRY_IE_CHANGED(__pIeeeDev, __Ie) \ 61 (((__Ie).Length == 0 || (__Ie).Length != GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen) ? \ 62 FALSE : \ 63 (!memcmp(GET_DOT11D_INFO(__pIeeeDev)->CountryIeBuf, (__Ie).Octet, (__Ie).Length))) 64 65#define CIE_WATCHDOG_TH 1 66#define GET_CIE_WATCHDOG(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog 67#define RESET_CIE_WATCHDOG(__pIeeeDev) GET_CIE_WATCHDOG(__pIeeeDev) = 0 68#define UPDATE_CIE_WATCHDOG(__pIeeeDev) ++GET_CIE_WATCHDOG(__pIeeeDev) 69 70#define IS_DOT11D_STATE_DONE(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE) 71 72 73void 74Dot11d_Init( 75 struct ieee80211_device *dev 76 ); 77 78void 79Dot11d_Reset( 80 struct ieee80211_device *dev 81 ); 82 83void 84Dot11d_UpdateCountryIe( 85 struct ieee80211_device *dev, 86 u8 * pTaddr, 87 u16 CoutryIeLen, 88 u8 * pCoutryIe 89 ); 90 91u8 92DOT11D_GetMaxTxPwrInDbm( 93 struct ieee80211_device *dev, 94 u8 Channel 95 ); 96 97void 98DOT11D_ScanComplete( 99 struct ieee80211_device * dev 100 ); 101 102int IsLegalChannel( 103 struct ieee80211_device * dev, 104 u8 channel 105); 106 107int ToLegalChannel( 108 struct ieee80211_device * dev, 109 u8 channel 110); 111#endif 112