wctl.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
  3. * All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program; if not, write to the Free Software Foundation, Inc.,
  17. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18. *
  19. * File: wctl.h
  20. *
  21. * Purpose:
  22. *
  23. * Author: Jerry Chen
  24. *
  25. * Date: Jun. 27, 2002
  26. *
  27. */
  28. #ifndef __WCTL_H__
  29. #define __WCTL_H__
  30. #include "ttype.h"
  31. #include "tether.h"
  32. #include "device.h"
  33. /*--------------------- Export Definitions -------------------------*/
  34. #define IS_TYPE_DATA(pMACHeader) \
  35. ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_DATA)
  36. #define IS_TYPE_MGMT(pMACHeader) \
  37. ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_MGMT)
  38. #define IS_TYPE_CONTROL(pMACHeader) \
  39. ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_CTL)
  40. #define IS_FC_MOREDATA(pMACHeader) \
  41. ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREDATA) == FC_MOREDATA)
  42. #define IS_FC_POWERMGT(pMACHeader) \
  43. ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_POWERMGT) == FC_POWERMGT)
  44. #define IS_FC_RETRY(pMACHeader) \
  45. ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_RETRY) == FC_RETRY)
  46. #define IS_FC_WEP(pMACHeader) \
  47. ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_WEP) == FC_WEP)
  48. #ifdef __BIG_ENDIAN
  49. #define IS_FRAGMENT_PKT(pMACHeader) \
  50. (((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \
  51. ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) != 0))
  52. #define IS_FIRST_FRAGMENT_PKT(pMACHeader) \
  53. ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) == 0)
  54. #else
  55. #define IS_FRAGMENT_PKT(pMACHeader) \
  56. (((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \
  57. ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) != 0))
  58. #define IS_FIRST_FRAGMENT_PKT(pMACHeader) \
  59. ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) == 0)
  60. #endif//#ifdef __BIG_ENDIAN
  61. #define IS_LAST_FRAGMENT_PKT(pMACHeader) \
  62. ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) == 0)
  63. #define IS_CTL_PSPOLL(pMACHeader) \
  64. ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL)
  65. #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \
  66. if ((uVar) >= ((uModulo) - 1)) \
  67. (uVar) = 0; \
  68. else \
  69. (uVar)++; \
  70. }
  71. /*--------------------- Export Classes ----------------------------*/
  72. /*--------------------- Export Variables --------------------------*/
  73. /*--------------------- Export Functions --------------------------*/
  74. bool WCTLbIsDuplicate(PSCache pCache, PS802_11Header pMACHeader);
  75. bool WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader,
  76. unsigned int cbFrameLength, bool bWEP, bool bExtIV);
  77. unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader);
  78. unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader);
  79. #endif // __WCTL_H__