Commit | Line | Data |
---|---|---|
92b96797 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: tether.h | |
20 | * | |
21 | * Purpose: | |
22 | * | |
23 | * Author: Tevin Chen | |
24 | * | |
25 | * Date: Jan. 28, 1997 | |
26 | * | |
27 | */ | |
28 | ||
92b96797 FB |
29 | #ifndef __TETHER_H__ |
30 | #define __TETHER_H__ | |
31 | ||
9a0e756c | 32 | #include <linux/if_ether.h> |
92b96797 | 33 | #include "ttype.h" |
92b96797 FB |
34 | |
35 | /*--------------------- Export Definitions -------------------------*/ | |
36 | // | |
37 | // constants | |
38 | // | |
9a0e756c | 39 | #define U_ETHER_ADDR_STR_LEN (ETH_ALEN * 2 + 1) |
92b96797 | 40 | // Ethernet address string length |
92b96797 FB |
41 | #define U_MULTI_ADDR_LEN 8 // multicast address length |
42 | ||
92b96797 FB |
43 | #ifdef __BIG_ENDIAN |
44 | ||
92b96797 | 45 | #define TYPE_MGMT_PROBE_RSP 0x5000 |
203e4615 | 46 | |
92b96797 FB |
47 | // |
48 | // wFrameCtl field in the S802_11Header | |
49 | // | |
50 | // NOTE.... | |
51 | // in network byte order, high byte is going first | |
52 | #define FC_TODS 0x0001 | |
53 | #define FC_FROMDS 0x0002 | |
54 | #define FC_MOREFRAG 0x0004 | |
55 | #define FC_RETRY 0x0008 | |
56 | #define FC_POWERMGT 0x0010 | |
57 | #define FC_MOREDATA 0x0020 | |
58 | #define FC_WEP 0x0040 | |
59 | #define TYPE_802_11_ATIM 0x9000 | |
60 | ||
61 | #define TYPE_802_11_DATA 0x0800 | |
62 | #define TYPE_802_11_CTL 0x0400 | |
63 | #define TYPE_802_11_MGMT 0x0000 | |
64 | #define TYPE_802_11_MASK 0x0C00 | |
65 | #define TYPE_SUBTYPE_MASK 0xFC00 | |
66 | #define TYPE_802_11_NODATA 0x4000 | |
67 | #define TYPE_DATE_NULL 0x4800 | |
68 | ||
69 | #define TYPE_CTL_PSPOLL 0xa400 | |
70 | #define TYPE_CTL_RTS 0xb400 | |
71 | #define TYPE_CTL_CTS 0xc400 | |
72 | #define TYPE_CTL_ACK 0xd400 | |
73 | ||
74 | ||
92b96797 FB |
75 | |
76 | #else //if LITTLE_ENDIAN | |
77 | // | |
78 | // wType field in the SEthernetHeader | |
79 | // | |
80 | // NOTE.... | |
81 | // in network byte order, high byte is going first | |
92b96797 | 82 | |
92b96797 | 83 | #define TYPE_MGMT_PROBE_RSP 0x0050 |
203e4615 | 84 | |
92b96797 FB |
85 | // |
86 | // wFrameCtl field in the S802_11Header | |
87 | // | |
88 | // NOTE.... | |
89 | // in network byte order, high byte is going first | |
90 | #define FC_TODS 0x0100 | |
91 | #define FC_FROMDS 0x0200 | |
92 | #define FC_MOREFRAG 0x0400 | |
93 | #define FC_RETRY 0x0800 | |
94 | #define FC_POWERMGT 0x1000 | |
95 | #define FC_MOREDATA 0x2000 | |
96 | #define FC_WEP 0x4000 | |
97 | #define TYPE_802_11_ATIM 0x0090 | |
98 | ||
99 | #define TYPE_802_11_DATA 0x0008 | |
100 | #define TYPE_802_11_CTL 0x0004 | |
101 | #define TYPE_802_11_MGMT 0x0000 | |
102 | #define TYPE_802_11_MASK 0x000C | |
103 | #define TYPE_SUBTYPE_MASK 0x00FC | |
104 | #define TYPE_802_11_NODATA 0x0040 | |
105 | #define TYPE_DATE_NULL 0x0048 | |
106 | ||
107 | #define TYPE_CTL_PSPOLL 0x00a4 | |
108 | #define TYPE_CTL_RTS 0x00b4 | |
109 | #define TYPE_CTL_CTS 0x00c4 | |
110 | #define TYPE_CTL_ACK 0x00d4 | |
111 | ||
112 | ||
92b96797 FB |
113 | |
114 | #endif //#ifdef __BIG_ENDIAN | |
115 | ||
116 | #define WEP_IV_MASK 0x00FFFFFF | |
117 | ||
118 | /*--------------------- Export Types ------------------------------*/ | |
119 | // | |
120 | // Ethernet packet | |
121 | // | |
122 | typedef struct tagSEthernetHeader { | |
9a0e756c AM |
123 | BYTE abyDstAddr[ETH_ALEN]; |
124 | BYTE abySrcAddr[ETH_ALEN]; | |
92b96797 | 125 | WORD wType; |
d9d1ccb5 | 126 | } __attribute__ ((__packed__)) |
193a823c | 127 | SEthernetHeader, *PSEthernetHeader; |
92b96797 FB |
128 | |
129 | ||
130 | // | |
131 | // 802_3 packet | |
132 | // | |
133 | typedef struct tagS802_3Header { | |
9a0e756c AM |
134 | BYTE abyDstAddr[ETH_ALEN]; |
135 | BYTE abySrcAddr[ETH_ALEN]; | |
92b96797 | 136 | WORD wLen; |
d9d1ccb5 | 137 | } __attribute__ ((__packed__)) |
193a823c | 138 | S802_3Header, *PS802_3Header; |
92b96797 FB |
139 | |
140 | // | |
141 | // 802_11 packet | |
142 | // | |
143 | typedef struct tagS802_11Header { | |
144 | WORD wFrameCtl; | |
145 | WORD wDurationID; | |
9a0e756c AM |
146 | BYTE abyAddr1[ETH_ALEN]; |
147 | BYTE abyAddr2[ETH_ALEN]; | |
148 | BYTE abyAddr3[ETH_ALEN]; | |
92b96797 | 149 | WORD wSeqCtl; |
9a0e756c | 150 | BYTE abyAddr4[ETH_ALEN]; |
d9d1ccb5 | 151 | } __attribute__ ((__packed__)) |
193a823c | 152 | S802_11Header, *PS802_11Header; |
92b96797 FB |
153 | |
154 | /*--------------------- Export Macros ------------------------------*/ | |
92b96797 | 155 | |
92b96797 FB |
156 | /*--------------------- Export Classes ----------------------------*/ |
157 | ||
158 | /*--------------------- Export Variables --------------------------*/ | |
159 | ||
160 | /*--------------------- Export Functions --------------------------*/ | |
92b96797 FB |
161 | |
162 | BYTE ETHbyGetHashIndexByCrc32(PBYTE pbyMultiAddr); | |
163 | //BYTE ETHbyGetHashIndexByCrc(PBYTE pbyMultiAddr); | |
cc856e61 | 164 | BOOL ETHbIsBufferCrc32Ok(PBYTE pbyBuffer, unsigned int cbFrameLength); |
92b96797 | 165 | |
e7b07d1d | 166 | #endif /* __TETHER_H__ */ |