Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 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 | |
| 29 | |
| 30 | #ifndef __WCTL_H__ |
| 31 | #define __WCTL_H__ |
| 32 | |
| 33 | #if !defined(__TTYPE_H__) |
| 34 | #include "ttype.h" |
| 35 | #endif |
| 36 | #if !defined(__TETHER_H__) |
| 37 | #include "tether.h" |
| 38 | #endif |
| 39 | #if !defined(__DEVICE_H__) |
| 40 | #include "device.h" |
| 41 | #endif |
| 42 | |
| 43 | |
| 44 | |
| 45 | /*--------------------- Export Definitions -------------------------*/ |
| 46 | |
| 47 | #define IS_TYPE_DATA(pMACHeader) \ |
| 48 | ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_DATA) |
| 49 | |
| 50 | #define IS_TYPE_MGMT(pMACHeader) \ |
| 51 | ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_MGMT) |
| 52 | |
| 53 | #define IS_TYPE_CONTROL(pMACHeader) \ |
| 54 | ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_CTL) |
| 55 | |
| 56 | #define IS_FC_MOREDATA(pMACHeader) \ |
| 57 | ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREDATA) == FC_MOREDATA) |
| 58 | |
| 59 | #define IS_FC_POWERMGT(pMACHeader) \ |
| 60 | ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_POWERMGT) == FC_POWERMGT) |
| 61 | |
| 62 | #define IS_FC_RETRY(pMACHeader) \ |
| 63 | ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_RETRY) == FC_RETRY) |
| 64 | |
| 65 | #define IS_FC_WEP(pMACHeader) \ |
| 66 | ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_WEP) == FC_WEP) |
| 67 | |
| 68 | #ifdef __BIG_ENDIAN |
| 69 | |
| 70 | #define IS_FRAGMENT_PKT(pMACHeader) \ |
| 71 | (((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \ |
| 72 | ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) != 0)) |
| 73 | |
| 74 | #define IS_FIRST_FRAGMENT_PKT(pMACHeader) \ |
| 75 | ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) == 0) |
| 76 | |
| 77 | #else |
| 78 | |
| 79 | #define IS_FRAGMENT_PKT(pMACHeader) \ |
| 80 | (((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \ |
| 81 | ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) != 0)) |
| 82 | |
| 83 | #define IS_FIRST_FRAGMENT_PKT(pMACHeader) \ |
| 84 | ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) == 0) |
| 85 | |
| 86 | #endif//#ifdef __BIG_ENDIAN |
| 87 | |
| 88 | #define IS_LAST_FRAGMENT_PKT(pMACHeader) \ |
| 89 | ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) == 0) |
| 90 | |
| 91 | #define IS_CTL_PSPOLL(pMACHeader) \ |
| 92 | ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL) |
| 93 | |
| 94 | |
| 95 | #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \ |
| 96 | if ((uVar) >= ((uModulo) - 1)) \ |
| 97 | (uVar) = 0; \ |
| 98 | else \ |
| 99 | (uVar)++; \ |
| 100 | } |
| 101 | |
| 102 | |
| 103 | /*--------------------- Export Classes ----------------------------*/ |
| 104 | |
| 105 | /*--------------------- Export Variables --------------------------*/ |
| 106 | |
| 107 | /*--------------------- Export Functions --------------------------*/ |
| 108 | #ifdef __cplusplus |
| 109 | extern "C" { /* Assume C declarations for C++ */ |
| 110 | #endif /* __cplusplus */ |
| 111 | |
| 112 | BOOL WCTLbIsDuplicate(PSCache pCache, PS802_11Header pMACHeader); |
| 113 | BOOL WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader, UINT cbFrameLength, BOOL bWEP, BOOL bExtIV); |
| 114 | UINT WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader); |
| 115 | UINT WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader); |
| 116 | |
| 117 | #ifdef __cplusplus |
| 118 | } /* End of extern "C" { */ |
| 119 | #endif /* __cplusplus */ |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | #endif // __WCTL_H__ |
| 125 | |
| 126 | |
| 127 | |