Commit | Line | Data |
---|---|---|
5449c685 FB |
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 | ||
5449c685 FB |
29 | #ifndef __WCTL_H__ |
30 | #define __WCTL_H__ | |
31 | ||
5449c685 | 32 | #include "ttype.h" |
5449c685 | 33 | #include "tether.h" |
5449c685 | 34 | #include "device.h" |
5449c685 FB |
35 | |
36 | /*--------------------- Export Definitions -------------------------*/ | |
37 | ||
e2b8c6d3 JP |
38 | #define IS_TYPE_DATA(pMACHeader) \ |
39 | ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_DATA) | |
5449c685 | 40 | |
e2b8c6d3 JP |
41 | #define IS_TYPE_MGMT(pMACHeader) \ |
42 | ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_MGMT) | |
5449c685 | 43 | |
e2b8c6d3 JP |
44 | #define IS_TYPE_CONTROL(pMACHeader) \ |
45 | ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_CTL) | |
5449c685 | 46 | |
e2b8c6d3 JP |
47 | #define IS_FC_MOREDATA(pMACHeader) \ |
48 | ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREDATA) == FC_MOREDATA) | |
5449c685 | 49 | |
e2b8c6d3 JP |
50 | #define IS_FC_POWERMGT(pMACHeader) \ |
51 | ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_POWERMGT) == FC_POWERMGT) | |
5449c685 | 52 | |
e2b8c6d3 JP |
53 | #define IS_FC_RETRY(pMACHeader) \ |
54 | ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_RETRY) == FC_RETRY) | |
5449c685 | 55 | |
e2b8c6d3 JP |
56 | #define IS_FC_WEP(pMACHeader) \ |
57 | ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_WEP) == FC_WEP) | |
5449c685 FB |
58 | |
59 | #ifdef __BIG_ENDIAN | |
60 | ||
e2b8c6d3 JP |
61 | #define IS_FRAGMENT_PKT(pMACHeader) \ |
62 | (((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \ | |
63 | ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) != 0)) | |
5449c685 | 64 | |
e2b8c6d3 JP |
65 | #define IS_FIRST_FRAGMENT_PKT(pMACHeader) \ |
66 | ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) == 0) | |
5449c685 FB |
67 | |
68 | #else | |
69 | ||
e2b8c6d3 JP |
70 | #define IS_FRAGMENT_PKT(pMACHeader) \ |
71 | (((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \ | |
72 | ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) != 0)) | |
5449c685 | 73 | |
e2b8c6d3 JP |
74 | #define IS_FIRST_FRAGMENT_PKT(pMACHeader) \ |
75 | ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) == 0) | |
5449c685 FB |
76 | |
77 | #endif//#ifdef __BIG_ENDIAN | |
78 | ||
e2b8c6d3 JP |
79 | #define IS_LAST_FRAGMENT_PKT(pMACHeader) \ |
80 | ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) == 0) | |
5449c685 | 81 | |
e2b8c6d3 JP |
82 | #define IS_CTL_PSPOLL(pMACHeader) \ |
83 | ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL) | |
5449c685 | 84 | |
bda2a44e JP |
85 | #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) \ |
86 | do { \ | |
87 | if ((uVar) >= ((uModulo) - 1)) \ | |
88 | (uVar) = 0; \ | |
89 | else \ | |
90 | (uVar)++; \ | |
91 | } while (0) | |
5449c685 | 92 | |
5449c685 FB |
93 | /*--------------------- Export Classes ----------------------------*/ |
94 | ||
95 | /*--------------------- Export Variables --------------------------*/ | |
96 | ||
97 | /*--------------------- Export Functions --------------------------*/ | |
5449c685 | 98 | |
7b6a0013 CC |
99 | bool WCTLbIsDuplicate(PSCache pCache, PS802_11Header pMACHeader); |
100 | bool WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader, | |
e2b8c6d3 | 101 | unsigned int cbFrameLength, bool bWEP, bool bExtIV); |
b6e95cd5 CC |
102 | unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader); |
103 | unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader); | |
5449c685 | 104 | |
5449c685 | 105 | #endif // __WCTL_H__ |