3 * Ether/802.11 conversions and packet buffer routines
5 * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
6 * --------------------------------------------------------------------
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/
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.
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.
31 * --------------------------------------------------------------------
33 * Inquiries regarding the linux-wlan Open Source project can be
36 * AbsoluteValue Systems Inc.
38 * http://www.linux-wlan.com
40 * --------------------------------------------------------------------
42 * Portions of the development of this software were funded by
43 * Intersil Corporation as part of PRISM(R) chipset product development.
45 * --------------------------------------------------------------------
47 * This file declares the functions, types and macros that perform
48 * Ethernet to/from 802.11 frame conversions.
50 * --------------------------------------------------------------------
53 #ifndef _LINUX_P80211CONV_H
54 #define _LINUX_P80211CONV_H
56 #define WLAN_ETHADDR_LEN 6
57 #define WLAN_IEEE_OUI_LEN 3
59 #define WLAN_ETHCONV_ENCAP 1
60 #define WLAN_ETHCONV_8021h 3
62 #define WLAN_ETHHDR_LEN 14
64 #define P80211CAPTURE_VERSION 0x80211001
66 #define P80211_FRMMETA_MAGIC 0x802110
68 #define P80211SKB_FRMMETA(s) \
69 (((((p80211_frmmeta_t *)((s)->cb))->magic) == P80211_FRMMETA_MAGIC) ? \
70 ((p80211_frmmeta_t *)((s)->cb)) : \
73 #define P80211SKB_RXMETA(s) \
74 (P80211SKB_FRMMETA((s)) ? P80211SKB_FRMMETA((s))->rx : ((p80211_rxmeta_t *)(NULL)))
76 typedef struct p80211_rxmeta
{
77 struct wlandevice
*wlandev
;
79 u64 mactime
; /* Hi-rez MAC-supplied time value */
80 u64 hosttime
; /* Best-rez host supplied time value */
82 unsigned int rxrate
; /* Receive data rate in 100kbps */
83 unsigned int priority
; /* 0-15, 0=contention, 6=CF */
84 int signal
; /* An SSI, see p80211netdev.h */
85 int noise
; /* An SSI, see p80211netdev.h */
86 unsigned int channel
; /* Receive channel (mostly for snifs) */
87 unsigned int preamble
; /* P80211ENUM_preambletype_* */
88 unsigned int encoding
; /* P80211ENUM_encoding_* */
92 typedef struct p80211_frmmeta
{
97 void p80211skb_free(struct wlandevice
*wlandev
, struct sk_buff
*skb
);
98 int p80211skb_rxmeta_attach(struct wlandevice
*wlandev
, struct sk_buff
*skb
);
99 void p80211skb_rxmeta_detach(struct sk_buff
*skb
);
102 * Frame capture header. (See doc/capturefrm.txt)
104 typedef struct p80211_caphdr
{
121 /* buffer free method pointer type */
122 typedef void (*freebuf_method_t
) (void *buf
, int size
);
124 typedef struct p80211_metawep
{
130 /* local ether header type */
131 typedef struct wlan_ethhdr
{
132 u8 daddr
[WLAN_ETHADDR_LEN
];
133 u8 saddr
[WLAN_ETHADDR_LEN
];
135 } __attribute__ ((packed
)) wlan_ethhdr_t
;
137 /* local llc header type */
138 typedef struct wlan_llc
{
142 } __attribute__ ((packed
)) wlan_llc_t
;
144 /* local snap header type */
145 typedef struct wlan_snap
{
146 u8 oui
[WLAN_IEEE_OUI_LEN
];
148 } __attribute__ ((packed
)) wlan_snap_t
;
150 /* Circular include trick */
153 int skb_p80211_to_ether(struct wlandevice
*wlandev
, u32 ethconv
,
154 struct sk_buff
*skb
);
155 int skb_ether_to_p80211(struct wlandevice
*wlandev
, u32 ethconv
,
156 struct sk_buff
*skb
, p80211_hdr_t
* p80211_hdr
,
157 p80211_metawep_t
* p80211_wep
);
159 int p80211_stt_findproto(u16 proto
);