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 * --------------------------------------------------------------------
13 * Inquiries regarding the linux-wlan Open Source project can be
16 * AbsoluteValue Systems Inc.
18 * http://www.linux-wlan.com
20 * --------------------------------------------------------------------
22 * Portions of the development of this software were funded by
23 * Intersil Corporation as part of PRISM(R) chipset product development.
25 * --------------------------------------------------------------------
27 * This file declares the functions, types and macros that perform
28 * Ethernet to/from 802.11 frame conversions.
30 * --------------------------------------------------------------------
33 #ifndef _LINUX_P80211CONV_H
34 #define _LINUX_P80211CONV_H
36 #define WLAN_IEEE_OUI_LEN 3
38 #define WLAN_ETHCONV_ENCAP 1
39 #define WLAN_ETHCONV_8021h 3
41 #define P80211CAPTURE_VERSION 0x80211001
43 #define P80211_FRMMETA_MAGIC 0x802110
45 struct p80211_rxmeta {
46 struct wlandevice *wlandev;
48 u64 mactime; /* Hi-rez MAC-supplied time value */
49 u64 hosttime; /* Best-rez host supplied time value */
51 unsigned int rxrate; /* Receive data rate in 100kbps */
52 unsigned int priority; /* 0-15, 0=contention, 6=CF */
53 int signal; /* An SSI, see p80211netdev.h */
54 int noise; /* An SSI, see p80211netdev.h */
55 unsigned int channel; /* Receive channel (mostly for snifs) */
56 unsigned int preamble; /* P80211ENUM_preambletype_* */
57 unsigned int encoding; /* P80211ENUM_encoding_* */
61 struct p80211_frmmeta {
63 struct p80211_rxmeta *rx;
66 void p80211skb_free(struct wlandevice *wlandev, struct sk_buff *skb);
67 int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb);
68 void p80211skb_rxmeta_detach(struct sk_buff *skb);
70 static inline struct p80211_frmmeta *p80211skb_frmmeta(struct sk_buff *skb)
72 struct p80211_frmmeta *frmmeta = (struct p80211_frmmeta *)skb->cb;
74 return frmmeta->magic == P80211_FRMMETA_MAGIC ? frmmeta : NULL;
77 static inline struct p80211_rxmeta *p80211skb_rxmeta(struct sk_buff *skb)
79 struct p80211_frmmeta *frmmeta = p80211skb_frmmeta(skb);
81 return frmmeta ? frmmeta->rx : NULL;
85 * Frame capture header. (See doc/capturefrm.txt)
87 struct p80211_caphdr {
104 struct p80211_metawep {
110 /* local ether header type */
117 /* local llc header type */
124 /* local snap header type */
126 u8 oui[WLAN_IEEE_OUI_LEN];
130 /* Circular include trick */
133 int skb_p80211_to_ether(struct wlandevice *wlandev, u32 ethconv,
134 struct sk_buff *skb);
135 int skb_ether_to_p80211(struct wlandevice *wlandev, u32 ethconv,
136 struct sk_buff *skb, struct p80211_hdr *p80211_hdr,
137 struct p80211_metawep *p80211_wep);
139 int p80211_stt_findproto(u16 proto);