Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
802_11-utils.h
Go to the documentation of this file.
1/* 802_11-utils.h
2 * 802.11 utility definitions
3 *
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 2007 Gerald Combs
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10
11#ifndef __802_11_UTILS_H__
12#define __802_11_UTILS_H__
13
14#include <wireshark.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
29WS_DLL_PUBLIC
30int
31ieee80211_mhz_to_chan(unsigned freq);
32
39WS_DLL_PUBLIC
40unsigned
41ieee80211_chan_to_mhz(int chan, bool is_bg);
42
50WS_DLL_PUBLIC
51char*
52ieee80211_mhz_to_str(unsigned freq);
53
61WS_DLL_PUBLIC
62unsigned
63ieee80211_chan_band_to_mhz(int chan, bool is_bg, bool is_6ghz);
64
65/* Should this be "(freq < 4920)", or something else? */
66#define FREQ_IS_BG(freq) ((freq) <= 2484)
67#define CHAN_IS_BG(chan) ((chan) <= 14)
68
69#define FREQ_IS_6G(freq) (5950 <= (freq) && (freq) <= 7125)
70
71/*
72 * Test whether a data rate is an {HR}/DSSS (legacy DSSS/11b) data rate
73 * and whether it's an OFDM (11a/11g OFDM mode) data rate.
74 *
75 * rate is in units of 500 Kb/s.
76 *
77 * The 22 and 33 Mb/s rates for DSSS use Packet Binary Convolutional
78 * Coding (PBCC). That was provided by Texas Instruments as 11b+,
79 * and was in section 19.6 "ERP-PBCC operation specifications" of
80 * IEEE Std 802.11g-2003, and sections 18.4.6.6 "DSSS/PBCC data modulation
81 * and modulation rate (optional)" and 19.6 "ERP-PBCC operation
82 * specifications" of IEEE Std 802.11-2007, and sections 17.4.6.7 "DSSS/PBCC
83 * data modulation and modulation rate (optional)" and 19.6 "ERP-PBCC
84 * operation specifications" of IEEE Std 802.11-2012, marked as optional
85 * in both cases, but is not present in IEEE Std 802.11-2016.
86 *
87 * (Note: not to be confused with "peanut butter and chocolate chips":
88 *
89 * https://www.bigoven.com/recipe/peanut-butter-chocolate-chip-cookies-pbcc-cookies/186266
90 *
91 * :-))
92 */
93#define RATE_IS_DSSS(rate) \
94 ((rate) == 2 /* 1 Mb/s */ || \
95 (rate) == 4 /* 2 Mb/s */ || \
96 (rate) == 11 /* 5.5 Mb/s */ || \
97 (rate) == 22 /* 11 Mb/s */ || \
98 (rate) == 44 /* 22 Mb/s */ || \
99 (rate) == 66 /* 33 Mb/s */)
100
101#define RATE_IS_OFDM(rate) \
102 ((rate) == 12 /* 6 Mb/s */ || \
103 (rate) == 18 /* 9 Mb/s */ || \
104 (rate) == 24 /* 12 Mb/s */ || \
105 (rate) == 36 /* 18 Mb/s */ || \
106 (rate) == 48 /* 24 Mb/s */ || \
107 (rate) == 72 /* 36 Mb/s */ || \
108 (rate) == 96 /* 48 Mb/s */ || \
109 (rate) == 108 /* 54 Mb/s */)
110
111#ifdef __cplusplus
112}
113#endif /* __cplusplus */
114
115#endif /* __802_11_UTILS_H__ */
116
117/*
118 * Editor modelines
119 *
120 * Local Variables:
121 * c-basic-offset: 4
122 * tab-width: 8
123 * indent-tabs-mode: nil
124 * End:
125 *
126 * vi: set shiftwidth=4 tabstop=8 expandtab:
127 * :indentSize=4:tabSize=8:noTabs=true:
128 */
WS_DLL_PUBLIC int ieee80211_mhz_to_chan(unsigned freq)
Definition 802_11-utils.c:52
WS_DLL_PUBLIC unsigned ieee80211_chan_band_to_mhz(int chan, bool is_bg, bool is_6ghz)
Get Frequency given a Channel number and band.
Definition 802_11-utils.c:91
WS_DLL_PUBLIC char * ieee80211_mhz_to_str(unsigned freq)
Definition 802_11-utils.c:111
WS_DLL_PUBLIC unsigned ieee80211_chan_to_mhz(int chan, bool is_bg)
Definition 802_11-utils.c:75