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