dot11d.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #ifndef __INC_DOT11D_H
  2. #define __INC_DOT11D_H
  3. #include "ieee80211/ieee80211.h"
  4. typedef struct _CHNL_TXPOWER_TRIPLE {
  5. u8 FirstChnl;
  6. u8 NumChnls;
  7. u8 MaxTxPowerInDbm;
  8. } CHNL_TXPOWER_TRIPLE, *PCHNL_TXPOWER_TRIPLE;
  9. typedef enum _DOT11D_STATE {
  10. DOT11D_STATE_NONE = 0,
  11. DOT11D_STATE_LEARNED,
  12. DOT11D_STATE_DONE,
  13. } DOT11D_STATE;
  14. typedef struct _RT_DOT11D_INFO {
  15. /* DECLARE_RT_OBJECT(RT_DOT11D_INFO); */
  16. bool bEnabled; /* dot11MultiDomainCapabilityEnabled */
  17. u16 CountryIeLen; /* > 0 if CountryIeBuf[] contains valid country information element. */
  18. u8 CountryIeBuf[MAX_IE_LEN];
  19. u8 CountryIeSrcAddr[6]; /* Source AP of the country IE. */
  20. u8 CountryIeWatchdog;
  21. u8 channel_map[MAX_CHANNEL_NUMBER+1]; /* !Value 0: Invalid, 1: Valid (active scan), 2: Valid (passive scan) */
  22. u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER+1];
  23. DOT11D_STATE State;
  24. } RT_DOT11D_INFO, *PRT_DOT11D_INFO;
  25. #define eqMacAddr(a, b) (((a)[0] == (b)[0] && \
  26. (a)[1] == (b)[1] && (a)[2] == (b)[2] && (a)[3] == (b)[3] && \
  27. (a)[4] == (b)[4] && (a)[5] == (b)[5]) ? 1 : 0)
  28. #define cpMacAddr(des, src) ((des)[0] = (src)[0], \
  29. (des)[1] = (src)[1], (des)[2] = (src)[2], \
  30. (des)[3] = (src)[3], (des)[4] = (src)[4], \
  31. (des)[5] = (src)[5])
  32. #define GET_DOT11D_INFO(__pIeeeDev) ((PRT_DOT11D_INFO)((__pIeeeDev)->pDot11dInfo))
  33. #define IS_DOT11D_ENABLE(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->bEnabled)
  34. #define IS_COUNTRY_IE_VALID(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0)
  35. #define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) eqMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
  36. #define UPDATE_CIE_SRC(__pIeeeDev, __pTa) cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
  37. #define IS_COUNTRY_IE_CHANGED(__pIeeeDev, __Ie) \
  38. (((__Ie).Length == 0 || (__Ie).Length != GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen) ? \
  39. FALSE : \
  40. (!memcmp(GET_DOT11D_INFO(__pIeeeDev)->CountryIeBuf, (__Ie).Octet, (__Ie).Length)))
  41. #define CIE_WATCHDOG_TH 1
  42. #define GET_CIE_WATCHDOG(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog)
  43. #define RESET_CIE_WATCHDOG(__pIeeeDev) GET_CIE_WATCHDOG(__pIeeeDev) = 0
  44. #define UPDATE_CIE_WATCHDOG(__pIeeeDev) (++GET_CIE_WATCHDOG(__pIeeeDev))
  45. #define IS_DOT11D_STATE_DONE(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE)
  46. void
  47. Dot11d_Init(
  48. struct ieee80211_device *dev
  49. );
  50. void
  51. Dot11d_Reset(
  52. struct ieee80211_device *dev
  53. );
  54. void
  55. Dot11d_UpdateCountryIe(
  56. struct ieee80211_device *dev,
  57. u8 *pTaddr,
  58. u16 CoutryIeLen,
  59. u8 *pCoutryIe
  60. );
  61. u8
  62. DOT11D_GetMaxTxPwrInDbm(
  63. struct ieee80211_device *dev,
  64. u8 Channel
  65. );
  66. void
  67. DOT11D_ScanComplete(
  68. struct ieee80211_device *dev
  69. );
  70. int IsLegalChannel(
  71. struct ieee80211_device *dev,
  72. u8 channel
  73. );
  74. int ToLegalChannel(
  75. struct ieee80211_device *dev,
  76. u8 channel
  77. );
  78. #endif /* #ifndef __INC_DOT11D_H */