| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
ws80211_utils.h
Go to the documentation of this file.
1
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 enum ws80211_channel_type {
25 WS80211_CHAN_NO_HT,
26 WS80211_CHAN_HT20,
27 WS80211_CHAN_HT40MINUS,
28 WS80211_CHAN_HT40PLUS,
29 WS80211_CHAN_HE40, /* 40 MHz with explicit center freq */
30 WS80211_CHAN_VHT80,
31 WS80211_CHAN_VHT80P80,
32 WS80211_CHAN_VHT160,
33 WS80211_CHAN_EHT320
34};
35
36#define CHAN_NO_HT "NOHT"
37#define CHAN_HT20 "HT20"
38#define CHAN_HT40MINUS "HT40-"
39#define CHAN_HT40PLUS "HT40+"
40#define CHAN_HE40 "HE40"
41#define CHAN_VHT80 "VHT80"
42#define CHAN_VHT80P80 "VHT80+80"
43#define CHAN_VHT160 "VHT160"
44#define CHAN_EHT320 "EHT320"
45
46/* These are *not* the same values as the Linux NL80211_BAND_* enum,
47 * because we don't support the 60 GHz or 900 MHz (S1G, HaLow) bands,
48 * which have different channel widths. */
49 enum ws80211_band_type {
50 WS80211_BAND_2GHZ,
51 WS80211_BAND_5GHZ,
52 WS80211_BAND_6GHZ
53};
54
55 enum ws80211_fcs_validation {
56 WS80211_FCS_ALL,
57 WS80211_FCS_VALID,
58 WS80211_FCS_INVALID
59};
60
61 struct ws80211_frequency
62{
63 uint32_t freq; // MHz
64 int channel_mask; /* Bitmask of ws80211_channel_types *not* supported for this frequency (e.g., for regulatory reasons) even if supported by the PHY for this band */
65};
66
67 struct ws80211_band
68{
69 GArray *frequencies; /* Array of uint32_t (MHz) (lazily created, can be NULL) */
70 int channel_types; /* Bitmask of ws80211_channel_types supported by the PHY on this band */
71};
72
73 struct ws80211_interface
74{
75 char *ifname;
76 bool can_set_freq;
77 bool can_check_fcs;
78 GArray *bands; /* Array of struct ws80211_band, indexed by
79 ws80211_band_type. (array always exists but might
80 be shorter than the number of possible bands.) */
81 int cap_monitor;
82};
83
84 struct ws80211_iface_info {
85 int current_freq;
86 enum ws80211_channel_type current_chan_type;
87 int current_center_freq1;
88 int current_center_freq2;
89 enum ws80211_fcs_validation current_fcs_validation;
90};
91
92/*
93 * List of error types.
94 * WS80211_ERROR is a generic error that might have a platform-specific
95 * error message that depends on the last failed operation.
96 */
97#define WS80211_OK 0
98#define WS80211_ERROR_NOT_SUPPORTED 1
99#define WS80211_ERROR 2
100
104 const char *ws80211_geterror(int error);
105
112 int ws80211_init(void);
113
118/* XXX Should we make this an array of structs instead of an array of struct pointers?
119 * It'd save a bit of mallocing and freeing. */
120GArray* ws80211_find_interfaces(void);
121
129 int ws80211_get_iface_info(const char *name, struct ws80211_iface_info *iface_info);
130
136 void ws80211_free_interfaces(GArray *interfaces);
137
143 void ws80211_clear_band(struct ws80211_band *band);
144
155 int ws80211_set_freq(const char *name, uint32_t freq, int chan_type, uint32_t _U_ center_freq, uint32_t _U_ center_freq2);
156
163 int ws80211_str_to_chan_type(const char *s);
164
171 const char *ws80211_chan_type_to_str(enum ws80211_channel_type type);
172
173 const char *ws80211_band_type_to_str(enum ws80211_band_type type);
174
180 bool ws80211_has_fcs_filter(void);
181
189 int ws80211_set_fcs_validation(const char *name, enum ws80211_fcs_validation fcs_validation);
190
191
200 const char *ws80211_get_helper_path(void);
201
202
213 int ws80211_get_center_frequency(int control_frequency, enum ws80211_channel_type channel_type);
214
215#ifdef __cplusplus
216}
217#endif /* __cplusplus */
218
219#endif /* __WS80211_UTILS_H__ */
ws80211_band
Definition ws80211_utils.h:68
ws80211_frequency
Definition ws80211_utils.h:62
ws80211_iface_info
Definition ws80211_utils.h:84
ws80211_interface
Definition ws80211_utils.h:74
ws80211_find_interfaces
GArray * ws80211_find_interfaces(void)
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_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_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_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