| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
ws80211_utils.h
Go to the documentation of this file.
1
11
12#ifndef __WS80211_UTILS_H__
13#define __WS80211_UTILS_H__
14
15#include <wireshark.h>
16
17#ifdef __cplusplus
18 extern "C" {
19#endif /* __cplusplus */
20
21/* For our (monitor mode tuning) purposes we shouldn't care about 20 MHz
22 * non HT vs 20 MHz HT. We do care about HT40- vs HT40+ vs HE40 (whether
23 * the center freq must be provided, */
24
28 enum ws80211_channel_type {
29 WS80211_CHAN_NO_HT,
30 WS80211_CHAN_HT20,
31 WS80211_CHAN_HT40MINUS,
32 WS80211_CHAN_HT40PLUS,
33 WS80211_CHAN_HE40,
34 WS80211_CHAN_VHT80,
35 WS80211_CHAN_VHT80P80,
36 WS80211_CHAN_VHT160,
37 WS80211_CHAN_EHT320
38};
39
41#define CHAN_NO_HT "NOHT"
43#define CHAN_HT20 "HT20"
45#define CHAN_HT40MINUS "HT40-"
47#define CHAN_HT40PLUS "HT40+"
49#define CHAN_HE40 "HE40"
51#define CHAN_VHT80 "VHT80"
53#define CHAN_VHT80P80 "VHT80+80"
55#define CHAN_VHT160 "VHT160"
57#define CHAN_EHT320 "EHT320"
58
59/* These are *not* the same values as the Linux NL80211_BAND_* enum,
60 * because we don't support the 60 GHz or 900 MHz (S1G, HaLow) bands,
61 * which have different channel widths. */
62
66 enum ws80211_band_type {
67 WS80211_BAND_2GHZ,
68 WS80211_BAND_5GHZ,
69 WS80211_BAND_6GHZ
70};
71
75 enum ws80211_fcs_validation {
76 WS80211_FCS_ALL,
77 WS80211_FCS_VALID,
78 WS80211_FCS_INVALID
79};
80
84 struct ws80211_frequency
85{
86 uint32_t freq;
87 int channel_mask;
90};
91
95 struct ws80211_band
96{
97 GArray *frequencies;
99 int channel_types;
101};
102
106 struct ws80211_interface
107{
108 char *ifname;
109 bool can_set_freq;
110 bool can_check_fcs;
111 GArray *bands;
114 int cap_monitor;
115};
116
120 struct ws80211_iface_info {
121 int current_freq;
122 enum ws80211_channel_type current_chan_type;
123 int current_center_freq1;
124 int current_center_freq2;
125 enum ws80211_fcs_validation current_fcs_validation;
126};
127
128/*
129 * List of error types.
130 * WS80211_ERROR is a generic error that might have a platform-specific
131 * error message that depends on the last failed operation.
132 */
133#define WS80211_OK 0
134#define WS80211_ERROR_NOT_SUPPORTED 1
135#define WS80211_ERROR 2
136
140 const char *ws80211_geterror(int error);
141
148 int ws80211_init(void);
149
154/* XXX Should we make this an array of structs instead of an array of struct pointers?
155 * It'd save a bit of mallocing and freeing. */
156
162GArray* ws80211_find_interfaces(void);
163
171 int ws80211_get_iface_info(const char *name, struct ws80211_iface_info *iface_info);
172
178 void ws80211_free_interfaces(GArray *interfaces);
179
185 void ws80211_clear_band(struct ws80211_band *band);
186
197 int ws80211_set_freq(const char *name, uint32_t freq, int chan_type, uint32_t _U_ center_freq, uint32_t _U_ center_freq2);
198
205 int ws80211_str_to_chan_type(const char *s);
206
213 const char *ws80211_chan_type_to_str(enum ws80211_channel_type type);
214
221 const char *ws80211_band_type_to_str(enum ws80211_band_type type);
222
228 bool ws80211_has_fcs_filter(void);
229
237 int ws80211_set_fcs_validation(const char *name, enum ws80211_fcs_validation fcs_validation);
238
239
248 const char *ws80211_get_helper_path(void);
249
250
261 int ws80211_get_center_frequency(int control_frequency, enum ws80211_channel_type channel_type);
262
263#ifdef __cplusplus
264}
265#endif /* __cplusplus */
266
267#endif /* __WS80211_UTILS_H__ */
ws80211_band
Describes the channel capabilities of a single RF band on a PHY.
Definition ws80211_utils.h:96
ws80211_band::channel_types
int channel_types
Definition ws80211_utils.h:99
ws80211_band::frequencies
GArray * frequencies
Definition ws80211_utils.h:97
ws80211_frequency
Describes a single frequency and its channel-type constraints.
Definition ws80211_utils.h:85
ws80211_frequency::channel_mask
int channel_mask
Definition ws80211_utils.h:87
ws80211_frequency::freq
uint32_t freq
Definition ws80211_utils.h:86
ws80211_iface_info
Snapshot of the current configuration of a wireless interface.
Definition ws80211_utils.h:120
ws80211_iface_info::current_fcs_validation
enum ws80211_fcs_validation current_fcs_validation
Definition ws80211_utils.h:125
ws80211_iface_info::current_center_freq1
int current_center_freq1
Definition ws80211_utils.h:123
ws80211_iface_info::current_center_freq2
int current_center_freq2
Definition ws80211_utils.h:124
ws80211_iface_info::current_freq
int current_freq
Definition ws80211_utils.h:121
ws80211_iface_info::current_chan_type
enum ws80211_channel_type current_chan_type
Definition ws80211_utils.h:122
ws80211_interface
Represents a wireless network interface and its capture capabilities.
Definition ws80211_utils.h:107
ws80211_interface::bands
GArray * bands
Definition ws80211_utils.h:111
ws80211_interface::ifname
char * ifname
Definition ws80211_utils.h:108
ws80211_interface::can_set_freq
bool can_set_freq
Definition ws80211_utils.h:109
ws80211_interface::cap_monitor
int cap_monitor
Definition ws80211_utils.h:114
ws80211_interface::can_check_fcs
bool can_check_fcs
Definition ws80211_utils.h:110
ws80211_find_interfaces
GArray * ws80211_find_interfaces(void)
Finds and returns a list of wireless network interfaces.
Definition ws80211_utils.c:1179
ws80211_clear_band
void ws80211_clear_band(struct ws80211_band *band)
Clear the frequencies array in a ws80211_band structure.
Definition ws80211_utils.c:1244
ws80211_band_type
ws80211_band_type
Supported RF band identifiers (not equivalent to Linux NL80211_BAND_*).
Definition ws80211_utils.h:66
WS80211_BAND_6GHZ
@ WS80211_BAND_6GHZ
Definition ws80211_utils.h:69
WS80211_BAND_5GHZ
@ WS80211_BAND_5GHZ
Definition ws80211_utils.h:68
WS80211_BAND_2GHZ
@ WS80211_BAND_2GHZ
Definition ws80211_utils.h:67
ws80211_str_to_chan_type
int ws80211_str_to_chan_type(const char *s)
Convert a string representation of a channel type to its corresponding enum value.
ws80211_geterror
const char * ws80211_geterror(int error)
Definition ws80211_utils.c:1174
ws80211_channel_type
ws80211_channel_type
IEEE 802.11 channel width/type for monitor mode configuration.
Definition ws80211_utils.h:28
WS80211_CHAN_HE40
@ WS80211_CHAN_HE40
Definition ws80211_utils.h:33
WS80211_CHAN_HT40PLUS
@ WS80211_CHAN_HT40PLUS
Definition ws80211_utils.h:32
WS80211_CHAN_VHT80
@ WS80211_CHAN_VHT80
Definition ws80211_utils.h:34
WS80211_CHAN_VHT160
@ WS80211_CHAN_VHT160
Definition ws80211_utils.h:36
WS80211_CHAN_HT40MINUS
@ WS80211_CHAN_HT40MINUS
Definition ws80211_utils.h:31
WS80211_CHAN_VHT80P80
@ WS80211_CHAN_VHT80P80
Definition ws80211_utils.h:35
WS80211_CHAN_EHT320
@ WS80211_CHAN_EHT320
Definition ws80211_utils.h:37
WS80211_CHAN_NO_HT
@ WS80211_CHAN_NO_HT
Definition ws80211_utils.h:29
WS80211_CHAN_HT20
@ WS80211_CHAN_HT20
Definition ws80211_utils.h:30
ws80211_fcs_validation
ws80211_fcs_validation
FCS (Frame Check Sequence) capture filter policy.
Definition ws80211_utils.h:75
WS80211_FCS_VALID
@ WS80211_FCS_VALID
Definition ws80211_utils.h:77
WS80211_FCS_INVALID
@ WS80211_FCS_INVALID
Definition ws80211_utils.h:78
WS80211_FCS_ALL
@ WS80211_FCS_ALL
Definition ws80211_utils.h:76
ws80211_set_freq
int ws80211_set_freq(const char *name, uint32_t freq, int chan_type, uint32_t _U_ center_freq, uint32_t _U_ center_freq2)
Set the frequency and channel width for an interface.
ws80211_set_fcs_validation
int ws80211_set_fcs_validation(const char *name, enum ws80211_fcs_validation fcs_validation)
Set the FCS validation behavior for an interface.
ws80211_init
int ws80211_init(void)
Definition ws80211_utils.c:1169
ws80211_band_type_to_str
const char * ws80211_band_type_to_str(enum ws80211_band_type type)
Convert a Wi-Fi band type to its string representation.
Definition ws80211_utils.c:1204
ws80211_get_helper_path
const char * ws80211_get_helper_path(void)
Get the path to a helper application.
Definition ws80211_utils.c:1219
ws80211_get_iface_info
int ws80211_get_iface_info(const char *name, struct ws80211_iface_info *iface_info)
Get information about a wireless interface.
ws80211_chan_type_to_str
const char * ws80211_chan_type_to_str(enum ws80211_channel_type type)
Convert a Wi-Fi channel type to its string representation.
Definition ws80211_utils.c:1199
ws80211_get_center_frequency
int ws80211_get_center_frequency(int control_frequency, enum ws80211_channel_type channel_type)
Return center frequency of an 80M/160M/320M channel.
Definition ws80211_utils.c:1251
ws80211_free_interfaces
void ws80211_free_interfaces(GArray *interfaces)
Free an interface list.
Definition ws80211_utils.c:1227
ws80211_has_fcs_filter
bool ws80211_has_fcs_filter(void)
Check to see if we have FCS filtering.
Definition ws80211_utils.c:1209