1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef __INC_DOT11D_H
20#define __INC_DOT11D_H
21
22#include "rtllib.h"
23
24
25
26struct chnl_txpow_triple {
27 u8 FirstChnl;
28 u8 NumChnls;
29 u8 MaxTxPowerInDbm;
30};
31
32enum dot11d_state {
33 DOT11D_STATE_NONE = 0,
34 DOT11D_STATE_LEARNED,
35 DOT11D_STATE_DONE,
36};
37
38
39
40
41
42
43
44
45
46
47
48struct rt_dot11d_info {
49
50 bool bEnabled;
51
52 u16 CountryIeLen;
53 u8 CountryIeBuf[MAX_IE_LEN];
54 u8 CountryIeSrcAddr[6];
55 u8 CountryIeWatchdog;
56
57 u8 channel_map[MAX_CHANNEL_NUMBER+1];
58 u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER+1];
59
60 enum dot11d_state State;
61};
62
63static inline void cpMacAddr(unsigned char *des, unsigned char *src)
64{
65 memcpy(des, src, 6);
66}
67
68#define GET_DOT11D_INFO(__pIeeeDev) \
69 ((struct rt_dot11d_info *)((__pIeeeDev)->pDot11dInfo))
70
71#define IS_DOT11D_ENABLE(__pIeeeDev) \
72 (GET_DOT11D_INFO(__pIeeeDev)->bEnabled)
73#define IS_COUNTRY_IE_VALID(__pIeeeDev) \
74 (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0)
75
76#define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) \
77 ether_addr_equal_unaligned( \
78 GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
79#define UPDATE_CIE_SRC(__pIeeeDev, __pTa) \
80 cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
81
82#define GET_CIE_WATCHDOG(__pIeeeDev) \
83 (GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog)
84static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__pIeeeDev)
85{
86 GET_CIE_WATCHDOG(__pIeeeDev) = 0;
87}
88#define UPDATE_CIE_WATCHDOG(__pIeeeDev) (++GET_CIE_WATCHDOG(__pIeeeDev))
89
90void dot11d_init(struct rtllib_device *dev);
91void Dot11d_Channelmap(u8 channel_plan, struct rtllib_device *ieee);
92void Dot11d_Reset(struct rtllib_device *dev);
93void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr,
94 u16 CoutryIeLen, u8 *pCoutryIe);
95void DOT11D_ScanComplete(struct rtllib_device *dev);
96
97#endif
98