nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* $FreeBSD: src/sys/net80211/ieee80211_radiotap.h,v 1.5 2005/01/22 20:12:05 sam Exp $ */ |
2 | /* $NetBSD: ieee80211_radiotap.h,v 1.11 2005/06/22 06:16:02 dyoung Exp $ */ |
||
3 | |||
4 | /*- |
||
5 | * Copyright (c) 2003, 2004 David Young. All rights reserved. |
||
6 | * |
||
7 | * Redistribution and use in source and binary forms, with or without |
||
8 | * modification, are permitted provided that the following conditions |
||
9 | * are met: |
||
10 | * 1. Redistributions of source code must retain the above copyright |
||
11 | * notice, this list of conditions and the following disclaimer. |
||
12 | * 2. Redistributions in binary form must reproduce the above copyright |
||
13 | * notice, this list of conditions and the following disclaimer in the |
||
14 | * documentation and/or other materials provided with the distribution. |
||
15 | * 3. The name of David Young may not be used to endorse or promote |
||
16 | * products derived from this software without specific prior |
||
17 | * written permission. |
||
18 | * |
||
19 | * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY |
||
20 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
||
21 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
||
22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID |
||
23 | * YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
||
25 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
||
28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
||
29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
||
30 | * OF SUCH DAMAGE. |
||
31 | */ |
||
32 | |||
33 | #ifndef RADIOTAP_H |
||
34 | #define RADIOTAP_H |
||
35 | |||
36 | /* Kluge the radiotap linktype for now if we don't have it */ |
||
37 | #ifndef LNX_ARPHRD_IEEE80211_RADIOTAP |
||
38 | #define LNX_ARPHRD_IEEE80211_RADIOTAP 803 |
||
39 | #endif |
||
40 | |||
41 | /* Radiotap header version (from official NetBSD feed) */ |
||
42 | #define IEEE80211RADIOTAP_VERSION "1.5" |
||
43 | /* Base version of the radiotap packet header data */ |
||
44 | #define PKTHDR_RADIOTAP_VERSION 0 |
||
45 | |||
46 | /* The radio capture header precedes the 802.11 header. */ |
||
47 | struct ieee80211_radiotap_header { |
||
48 | u_int8_t it_version; /* Version 0. Only increases |
||
49 | * for drastic changes, |
||
50 | * introduction of compatible |
||
51 | * new fields does not count. |
||
52 | */ |
||
53 | u_int8_t it_pad; |
||
54 | u_int16_t it_len; /* length of the whole |
||
55 | * header in bytes, including |
||
56 | * int_version, it_pad, |
||
57 | * it_len, and data fields. |
||
58 | */ |
||
59 | u_int32_t it_present; /* A bitmap telling which |
||
60 | * fields are present. Set bit 31 |
||
61 | * (0x80000000) to extend the |
||
62 | * bitmap by another 32 bits. |
||
63 | * Additional extensions are made |
||
64 | * by setting bit 31. |
||
65 | */ |
||
66 | }; |
||
67 | |||
68 | /* Name Data type Units |
||
69 | * ---- --------- ----- |
||
70 | * |
||
71 | * IEEE80211_RADIOTAP_TSFT u_int64_t microseconds |
||
72 | * |
||
73 | * Value in microseconds of the MAC's 64-bit 802.11 Time |
||
74 | * Synchronization Function timer when the first bit of the |
||
75 | * MPDU arrived at the MAC. For received frames, only. |
||
76 | * |
||
77 | * IEEE80211_RADIOTAP_CHANNEL 2 x u_int16_t MHz, bitmap |
||
78 | * |
||
79 | * Tx/Rx frequency in MHz, followed by flags (see below). |
||
80 | * |
||
81 | * IEEE80211_RADIOTAP_FHSS u_int16_t see below |
||
82 | * |
||
83 | * For frequency-hopping radios, the hop set (first byte) |
||
84 | * and pattern (second byte). |
||
85 | * |
||
86 | * IEEE80211_RADIOTAP_RATE u_int8_t 500kb/s |
||
87 | * |
||
88 | * Tx/Rx data rate |
||
89 | * |
||
90 | * IEEE80211_RADIOTAP_DBM_ANTSIGNAL int8_t decibels from |
||
91 | * one milliwatt (dBm) |
||
92 | * |
||
93 | * RF signal power at the antenna, decibel difference from |
||
94 | * one milliwatt. |
||
95 | * |
||
96 | * IEEE80211_RADIOTAP_DBM_ANTNOISE int8_t decibels from |
||
97 | * one milliwatt (dBm) |
||
98 | * |
||
99 | * RF noise power at the antenna, decibel difference from one |
||
100 | * milliwatt. |
||
101 | * |
||
102 | * IEEE80211_RADIOTAP_DB_ANTSIGNAL u_int8_t decibel (dB) |
||
103 | * |
||
104 | * RF signal power at the antenna, decibel difference from an |
||
105 | * arbitrary, fixed reference. |
||
106 | * |
||
107 | * IEEE80211_RADIOTAP_DB_ANTNOISE u_int8_t decibel (dB) |
||
108 | * |
||
109 | * RF noise power at the antenna, decibel difference from an |
||
110 | * arbitrary, fixed reference point. |
||
111 | * |
||
112 | * IEEE80211_RADIOTAP_LOCK_QUALITY u_int16_t unitless |
||
113 | * |
||
114 | * Quality of Barker code lock. Unitless. Monotonically |
||
115 | * nondecreasing with "better" lock strength. Called "Signal |
||
116 | * Quality" in datasheets. (Is there a standard way to measure |
||
117 | * this?) |
||
118 | * |
||
119 | * IEEE80211_RADIOTAP_TX_ATTENUATION u_int16_t unitless |
||
120 | * |
||
121 | * Transmit power expressed as unitless distance from max |
||
122 | * power set at factory calibration. 0 is max power. |
||
123 | * Monotonically nondecreasing with lower power levels. |
||
124 | * |
||
125 | * IEEE80211_RADIOTAP_DB_TX_ATTENUATION u_int16_t decibels (dB) |
||
126 | * |
||
127 | * Transmit power expressed as decibel distance from max power |
||
128 | * set at factory calibration. 0 is max power. Monotonically |
||
129 | * nondecreasing with lower power levels. |
||
130 | * |
||
131 | * IEEE80211_RADIOTAP_DBM_TX_POWER int8_t decibels from |
||
132 | * one milliwatt (dBm) |
||
133 | * |
||
134 | * Transmit power expressed as dBm (decibels from a 1 milliwatt |
||
135 | * reference). This is the absolute power level measured at |
||
136 | * the antenna port. |
||
137 | * |
||
138 | * IEEE80211_RADIOTAP_FLAGS u_int8_t bitmap |
||
139 | * |
||
140 | * Properties of transmitted and received frames. See flags |
||
141 | * defined below. |
||
142 | * |
||
143 | * IEEE80211_RADIOTAP_ANTENNA u_int8_t antenna index |
||
144 | * |
||
145 | * Unitless indication of the Rx/Tx antenna for this packet. |
||
146 | * The first antenna is antenna 0. |
||
147 | * |
||
148 | * IEEE80211_RADIOTAP_FCS u_int32_t data |
||
149 | * |
||
150 | * FCS from frame in network byte order. |
||
151 | */ |
||
152 | enum ieee80211_radiotap_type { |
||
153 | IEEE80211_RADIOTAP_TSFT = 0, |
||
154 | IEEE80211_RADIOTAP_FLAGS = 1, |
||
155 | IEEE80211_RADIOTAP_RATE = 2, |
||
156 | IEEE80211_RADIOTAP_CHANNEL = 3, |
||
157 | IEEE80211_RADIOTAP_FHSS = 4, |
||
158 | IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5, |
||
159 | IEEE80211_RADIOTAP_DBM_ANTNOISE = 6, |
||
160 | IEEE80211_RADIOTAP_LOCK_QUALITY = 7, |
||
161 | IEEE80211_RADIOTAP_TX_ATTENUATION = 8, |
||
162 | IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9, |
||
163 | IEEE80211_RADIOTAP_DBM_TX_POWER = 10, |
||
164 | IEEE80211_RADIOTAP_ANTENNA = 11, |
||
165 | IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, |
||
166 | IEEE80211_RADIOTAP_DB_ANTNOISE = 13, |
||
167 | IEEE80211_RADIOTAP_FCS = 14, |
||
168 | IEEE80211_RADIOTAP_EXT = 31, |
||
169 | }; |
||
170 | |||
171 | /* Channel flags. */ |
||
172 | #define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */ |
||
173 | #define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */ |
||
174 | #define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */ |
||
175 | #define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */ |
||
176 | #define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */ |
||
177 | #define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ |
||
178 | #define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ |
||
179 | #define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ |
||
180 | |||
181 | /* For IEEE80211_RADIOTAP_FLAGS */ |
||
182 | #define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received |
||
183 | * during CFP |
||
184 | */ |
||
185 | #define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /* sent/received |
||
186 | * with short |
||
187 | * preamble |
||
188 | */ |
||
189 | #define IEEE80211_RADIOTAP_F_WEP 0x04 /* sent/received |
||
190 | * with WEP encryption |
||
191 | */ |
||
192 | #define IEEE80211_RADIOTAP_F_FRAG 0x08 /* sent/received |
||
193 | * with fragmentation |
||
194 | */ |
||
195 | #define IEEE80211_RADIOTAP_F_FCS 0x10 /* frame includes FCS */ |
||
196 | #define IEEE80211_RADIOTAP_F_DATAPAD 0x20 /* frame has padding between |
||
197 | * 802.11 header and payload |
||
198 | * (to 32-bit boundary) |
||
199 | */ |
||
200 | |||
201 | /* Ugly macro to convert literal channel numbers into their mhz equivalents |
||
202 | * There are certianly some conditions that will break this (like feeding it '30') |
||
203 | * but they shouldn't arise since nothing talks on channel 30. */ |
||
204 | #define ieee80211chan2mhz(x) \ |
||
205 | (((x) <= 14) ? \ |
||
206 | (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \ |
||
207 | ((x) + 1000) * 5) |
||
208 | |||
209 | #endif /* RADIOTAP_H */ |
||
210 |