1 /* SPDX-License-Identifier: (GPL-2.0 OR MPL-1.1) */
4 * Ether/802.11 conversions and packet buffer routines
6 * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
7 * --------------------------------------------------------------------
11 * The contents of this file are subject to the Mozilla Public
12 * License Version 1.1 (the "License"); you may not use this file
13 * except in compliance with the License. You may obtain a copy of
14 * the License at http://www.mozilla.org/MPL/
16 * Software distributed under the License is distributed on an "AS
17 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
18 * implied. See the License for the specific language governing
19 * rights and limitations under the License.
21 * Alternatively, the contents of this file may be used under the
22 * terms of the GNU Public License version 2 (the "GPL"), in which
23 * case the provisions of the GPL are applicable instead of the
24 * above. If you wish to allow the use of your version of this file
25 * only under the terms of the GPL and not to allow others to use
26 * your version of this file under the MPL, indicate your decision
27 * by deleting the provisions above and replace them with the notice
28 * and other provisions required by the GPL. If you do not delete
29 * the provisions above, a recipient may use your version of this
30 * file under either the MPL or the GPL.
32 * --------------------------------------------------------------------
34 * Inquiries regarding the linux-wlan Open Source project can be
37 * AbsoluteValue Systems Inc.
39 * http://www.linux-wlan.com
41 * --------------------------------------------------------------------
43 * Portions of the development of this software were funded by
44 * Intersil Corporation as part of PRISM(R) chipset product development.
46 * --------------------------------------------------------------------
48 * This file declares the functions, types and macros that perform
49 * Ethernet to/from 802.11 frame conversions.
51 * --------------------------------------------------------------------
54 #ifndef _LINUX_P80211CONV_H
55 #define _LINUX_P80211CONV_H
57 #define WLAN_IEEE_OUI_LEN 3
59 #define WLAN_ETHCONV_ENCAP 1
60 #define WLAN_ETHCONV_8021h 3
62 #define P80211CAPTURE_VERSION 0x80211001
64 #define P80211_FRMMETA_MAGIC 0x802110
66 struct p80211_rxmeta
{
67 struct wlandevice
*wlandev
;
69 u64 mactime
; /* Hi-rez MAC-supplied time value */
70 u64 hosttime
; /* Best-rez host supplied time value */
72 unsigned int rxrate
; /* Receive data rate in 100kbps */
73 unsigned int priority
; /* 0-15, 0=contention, 6=CF */
74 int signal
; /* An SSI, see p80211netdev.h */
75 int noise
; /* An SSI, see p80211netdev.h */
76 unsigned int channel
; /* Receive channel (mostly for snifs) */
77 unsigned int preamble
; /* P80211ENUM_preambletype_* */
78 unsigned int encoding
; /* P80211ENUM_encoding_* */
82 struct p80211_frmmeta
{
84 struct p80211_rxmeta
*rx
;
87 void p80211skb_free(struct wlandevice
*wlandev
, struct sk_buff
*skb
);
88 int p80211skb_rxmeta_attach(struct wlandevice
*wlandev
, struct sk_buff
*skb
);
89 void p80211skb_rxmeta_detach(struct sk_buff
*skb
);
91 static inline struct p80211_frmmeta
*p80211skb_frmmeta(struct sk_buff
*skb
)
93 struct p80211_frmmeta
*frmmeta
= (struct p80211_frmmeta
*)skb
->cb
;
95 return frmmeta
->magic
== P80211_FRMMETA_MAGIC
? frmmeta
: NULL
;
98 static inline struct p80211_rxmeta
*p80211skb_rxmeta(struct sk_buff
*skb
)
100 struct p80211_frmmeta
*frmmeta
= p80211skb_frmmeta(skb
);
102 return frmmeta
? frmmeta
->rx
: NULL
;
106 * Frame capture header. (See doc/capturefrm.txt)
108 struct p80211_caphdr
{
125 /* buffer free method pointer type */
126 typedef void (*freebuf_method_t
) (void *buf
, int size
);
128 struct p80211_metawep
{
134 /* local ether header type */
141 /* local llc header type */
148 /* local snap header type */
150 u8 oui
[WLAN_IEEE_OUI_LEN
];
154 /* Circular include trick */
157 int skb_p80211_to_ether(struct wlandevice
*wlandev
, u32 ethconv
,
158 struct sk_buff
*skb
);
159 int skb_ether_to_p80211(struct wlandevice
*wlandev
, u32 ethconv
,
160 struct sk_buff
*skb
, union p80211_hdr
*p80211_hdr
,
161 struct p80211_metawep
*p80211_wep
);
163 int p80211_stt_findproto(u16 proto
);