dot11d.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. #include "rtllib.h"
  18. struct chnl_txpow_triple {
  19. u8 FirstChnl;
  20. u8 NumChnls;
  21. u8 MaxTxPowerInDbm;
  22. };
  23. enum dot11d_state {
  24. DOT11D_STATE_NONE = 0,
  25. DOT11D_STATE_LEARNED,
  26. DOT11D_STATE_DONE,
  27. };
  28. /**
  29. * struct rt_dot11d_info * @CountryIeLen: value greater than 0 if
  30. * @CountryIeBuf contains valid country information element.
  31. * @channel_map: holds channel values
  32. * 0 - invalid,
  33. * 1 - valid (active scan),
  34. * 2 - valid (passive scan)
  35. * @CountryIeSrcAddr - Source AP of the country IE
  36. */
  37. struct rt_dot11d_info {
  38. bool bEnabled;
  39. u16 CountryIeLen;
  40. u8 CountryIeBuf[MAX_IE_LEN];
  41. u8 CountryIeSrcAddr[6];
  42. u8 CountryIeWatchdog;
  43. u8 channel_map[MAX_CHANNEL_NUMBER + 1];
  44. u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER + 1];
  45. enum dot11d_state State;
  46. };
  47. static inline void cpMacAddr(unsigned char *des, unsigned char *src)
  48. {
  49. memcpy(des, src, 6);
  50. }
  51. #define GET_DOT11D_INFO(__pIeeeDev) \
  52. ((struct rt_dot11d_info *)((__pIeeeDev)->pDot11dInfo))
  53. #define IS_DOT11D_ENABLE(__pIeeeDev) \
  54. (GET_DOT11D_INFO(__pIeeeDev)->bEnabled)
  55. #define IS_COUNTRY_IE_VALID(__pIeeeDev) \
  56. (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0)
  57. #define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) \
  58. ether_addr_equal_unaligned( \
  59. GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
  60. #define UPDATE_CIE_SRC(__pIeeeDev, __pTa) \
  61. cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
  62. #define GET_CIE_WATCHDOG(__pIeeeDev) \
  63. (GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog)
  64. static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__pIeeeDev)
  65. {
  66. GET_CIE_WATCHDOG(__pIeeeDev) = 0;
  67. }
  68. #define UPDATE_CIE_WATCHDOG(__pIeeeDev) (++GET_CIE_WATCHDOG(__pIeeeDev))
  69. void dot11d_init(struct rtllib_device *dev);
  70. void Dot11d_Channelmap(u8 channel_plan, struct rtllib_device *ieee);
  71. void Dot11d_Reset(struct rtllib_device *dev);
  72. void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr,
  73. u16 CoutryIeLen, u8 *pCoutryIe);
  74. void DOT11D_ScanComplete(struct rtllib_device *dev);
  75. #endif