Commit | Line | Data |
---|---|---|
00b3ed16 GKH |
1 | /* p80211conv.h |
2 | * | |
3 | * Ether/802.11 conversions and packet buffer routines | |
4 | * | |
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | |
6 | * -------------------------------------------------------------------- | |
7 | * | |
8 | * linux-wlan | |
9 | * | |
10 | * The contents of this file are subject to the Mozilla Public | |
11 | * License Version 1.1 (the "License"); you may not use this file | |
12 | * except in compliance with the License. You may obtain a copy of | |
13 | * the License at http://www.mozilla.org/MPL/ | |
14 | * | |
15 | * Software distributed under the License is distributed on an "AS | |
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | |
17 | * implied. See the License for the specific language governing | |
18 | * rights and limitations under the License. | |
19 | * | |
20 | * Alternatively, the contents of this file may be used under the | |
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | |
22 | * case the provisions of the GPL are applicable instead of the | |
23 | * above. If you wish to allow the use of your version of this file | |
24 | * only under the terms of the GPL and not to allow others to use | |
25 | * your version of this file under the MPL, indicate your decision | |
26 | * by deleting the provisions above and replace them with the notice | |
27 | * and other provisions required by the GPL. If you do not delete | |
28 | * the provisions above, a recipient may use your version of this | |
29 | * file under either the MPL or the GPL. | |
30 | * | |
31 | * -------------------------------------------------------------------- | |
32 | * | |
33 | * Inquiries regarding the linux-wlan Open Source project can be | |
34 | * made directly to: | |
35 | * | |
36 | * AbsoluteValue Systems Inc. | |
37 | * info@linux-wlan.com | |
38 | * http://www.linux-wlan.com | |
39 | * | |
40 | * -------------------------------------------------------------------- | |
41 | * | |
42 | * Portions of the development of this software were funded by | |
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | |
44 | * | |
45 | * -------------------------------------------------------------------- | |
46 | * | |
47 | * This file declares the functions, types and macros that perform | |
48 | * Ethernet to/from 802.11 frame conversions. | |
49 | * | |
50 | * -------------------------------------------------------------------- | |
51 | */ | |
52 | ||
53 | #ifndef _LINUX_P80211CONV_H | |
54 | #define _LINUX_P80211CONV_H | |
55 | ||
00b3ed16 GKH |
56 | #define WLAN_ETHADDR_LEN 6 |
57 | #define WLAN_IEEE_OUI_LEN 3 | |
58 | ||
59 | #define WLAN_ETHCONV_ENCAP 1 | |
00b3ed16 GKH |
60 | #define WLAN_ETHCONV_8021h 3 |
61 | ||
00b3ed16 GKH |
62 | #define WLAN_ETHHDR_LEN 14 |
63 | ||
64 | #define P80211CAPTURE_VERSION 0x80211001 | |
65 | ||
51e4896a | 66 | #define P80211_FRMMETA_MAGIC 0x802110 |
00b3ed16 GKH |
67 | |
68 | #define P80211SKB_FRMMETA(s) \ | |
869c4b4a JM |
69 | (((((struct p80211_frmmeta *)((s)->cb))->magic) == \ |
70 | P80211_FRMMETA_MAGIC) ? \ | |
51e4896a | 71 | ((struct p80211_frmmeta *)((s)->cb)) : \ |
00b3ed16 GKH |
72 | (NULL)) |
73 | ||
74 | #define P80211SKB_RXMETA(s) \ | |
869c4b4a JM |
75 | (P80211SKB_FRMMETA((s)) ? P80211SKB_FRMMETA((s))->rx : \ |
76 | ((struct p80211_rxmeta *)(NULL))) | |
00b3ed16 | 77 | |
51e4896a | 78 | struct p80211_rxmeta { |
c979aec7 | 79 | struct wlandevice *wlandev; |
00b3ed16 | 80 | |
c979aec7 MM |
81 | u64 mactime; /* Hi-rez MAC-supplied time value */ |
82 | u64 hosttime; /* Best-rez host supplied time value */ | |
00b3ed16 | 83 | |
c979aec7 MM |
84 | unsigned int rxrate; /* Receive data rate in 100kbps */ |
85 | unsigned int priority; /* 0-15, 0=contention, 6=CF */ | |
86 | int signal; /* An SSI, see p80211netdev.h */ | |
87 | int noise; /* An SSI, see p80211netdev.h */ | |
88 | unsigned int channel; /* Receive channel (mostly for snifs) */ | |
89 | unsigned int preamble; /* P80211ENUM_preambletype_* */ | |
90 | unsigned int encoding; /* P80211ENUM_encoding_* */ | |
00b3ed16 | 91 | |
51e4896a | 92 | }; |
00b3ed16 | 93 | |
51e4896a | 94 | struct p80211_frmmeta { |
c979aec7 | 95 | unsigned int magic; |
51e4896a EH |
96 | struct p80211_rxmeta *rx; |
97 | }; | |
00b3ed16 GKH |
98 | |
99 | void p80211skb_free(struct wlandevice *wlandev, struct sk_buff *skb); | |
100 | int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb); | |
101 | void p80211skb_rxmeta_detach(struct sk_buff *skb); | |
102 | ||
00b3ed16 GKH |
103 | /* |
104 | * Frame capture header. (See doc/capturefrm.txt) | |
105 | */ | |
51e4896a | 106 | struct p80211_caphdr { |
c979aec7 MM |
107 | u32 version; |
108 | u32 length; | |
109 | u64 mactime; | |
110 | u64 hosttime; | |
111 | u32 phytype; | |
112 | u32 channel; | |
113 | u32 datarate; | |
114 | u32 antenna; | |
115 | u32 priority; | |
116 | u32 ssi_type; | |
117 | s32 ssi_signal; | |
118 | s32 ssi_noise; | |
119 | u32 preamble; | |
120 | u32 encoding; | |
51e4896a | 121 | }; |
00b3ed16 GKH |
122 | |
123 | /* buffer free method pointer type */ | |
c979aec7 | 124 | typedef void (*freebuf_method_t) (void *buf, int size); |
00b3ed16 | 125 | |
51e4896a | 126 | struct p80211_metawep { |
c979aec7 | 127 | void *data; |
aaad4303 SP |
128 | u8 iv[4]; |
129 | u8 icv[4]; | |
51e4896a | 130 | }; |
00b3ed16 GKH |
131 | |
132 | /* local ether header type */ | |
51e4896a | 133 | struct wlan_ethhdr { |
c979aec7 MM |
134 | u8 daddr[WLAN_ETHADDR_LEN]; |
135 | u8 saddr[WLAN_ETHADDR_LEN]; | |
136 | u16 type; | |
7d3864d1 | 137 | } __packed; |
00b3ed16 GKH |
138 | |
139 | /* local llc header type */ | |
51e4896a | 140 | struct wlan_llc { |
c979aec7 MM |
141 | u8 dsap; |
142 | u8 ssap; | |
143 | u8 ctl; | |
7d3864d1 | 144 | } __packed; |
00b3ed16 GKH |
145 | |
146 | /* local snap header type */ | |
51e4896a | 147 | struct wlan_snap { |
c979aec7 MM |
148 | u8 oui[WLAN_IEEE_OUI_LEN]; |
149 | u16 type; | |
7d3864d1 | 150 | } __packed; |
00b3ed16 GKH |
151 | |
152 | /* Circular include trick */ | |
153 | struct wlandevice; | |
154 | ||
c979aec7 MM |
155 | int skb_p80211_to_ether(struct wlandevice *wlandev, u32 ethconv, |
156 | struct sk_buff *skb); | |
157 | int skb_ether_to_p80211(struct wlandevice *wlandev, u32 ethconv, | |
93df38e5 | 158 | struct sk_buff *skb, union p80211_hdr *p80211_hdr, |
51e4896a | 159 | struct p80211_metawep *p80211_wep); |
00b3ed16 | 160 | |
aaad4303 | 161 | int p80211_stt_findproto(u16 proto); |
00b3ed16 GKH |
162 | |
163 | #endif |