1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef __INC_DOT11D_H
16#define __INC_DOT11D_H
17
18#include "rtllib.h"
19
20
21
22struct chnl_txpow_triple {
23 u8 FirstChnl;
24 u8 NumChnls;
25 u8 MaxTxPowerInDbm;
26};
27
28enum dot11d_state {
29 DOT11D_STATE_NONE = 0,
30 DOT11D_STATE_LEARNED,
31 DOT11D_STATE_DONE,
32};
33
34
35
36
37
38
39
40
41
42
43
44struct 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
59static 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)
80static 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
86void dot11d_init(struct rtllib_device *dev);
87void Dot11d_Channelmap(u8 channel_plan, struct rtllib_device *ieee);
88void Dot11d_Reset(struct rtllib_device *dev);
89void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr,
90 u16 CoutryIeLen, u8 *pCoutryIe);
91void DOT11D_ScanComplete(struct rtllib_device *dev);
92
93#endif
94