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
18extern "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, */
24enum 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. */
49enum ws80211_band_type {
50 WS80211_BAND_2GHZ,
51 WS80211_BAND_5GHZ,
52 WS80211_BAND_6GHZ
53};
54
55enum ws80211_fcs_validation {
56 WS80211_FCS_ALL,
57 WS80211_FCS_VALID,
58 WS80211_FCS_INVALID
59};
60
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
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
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
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 mssage 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
104const char *ws80211_geterror(int error);
105
112int 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
122int ws80211_get_iface_info(const char *name, struct ws80211_iface_info *iface_info);
123
128void ws80211_free_interfaces(GArray *interfaces);
129
130void ws80211_clear_band(struct ws80211_band *band);
131
141int ws80211_set_freq(const char *name, uint32_t freq, int chan_type, uint32_t _U_ center_freq, uint32_t _U_ center_freq2);
142
143int ws80211_str_to_chan_type(const char *s);
144const char *ws80211_chan_type_to_str(enum ws80211_channel_type type);
145
146const char *ws80211_band_type_to_str(enum ws80211_band_type type);
147
152bool ws80211_has_fcs_filter(void);
153
160int ws80211_set_fcs_validation(const char *name, enum ws80211_fcs_validation fcs_validation);
161
162
169const char *ws80211_get_helper_path(void);
170
171
181int ws80211_get_center_frequency(int control_frequency, enum ws80211_channel_type channel_type);
182
183#ifdef __cplusplus
184}
185#endif /* __cplusplus */
186
187#endif /* __WS80211_UTILS_H__ */
Definition ws80211_utils.h:68
Definition ws80211_utils.h:62
Definition ws80211_utils.h:84
Definition ws80211_utils.h:74
GArray * ws80211_find_interfaces(void)
Definition ws80211_utils.c:1179
const char * ws80211_geterror(int error)
Definition ws80211_utils.c:1174
int ws80211_set_freq(const char *name, uint32_t freq, int chan_type, uint32_t _U_ center_freq, uint32_t _U_ center_freq2)
int ws80211_set_fcs_validation(const char *name, enum ws80211_fcs_validation fcs_validation)
int ws80211_init(void)
Definition ws80211_utils.c:1169
const char * ws80211_get_helper_path(void)
Definition ws80211_utils.c:1219
int ws80211_get_center_frequency(int control_frequency, enum ws80211_channel_type channel_type)
Definition ws80211_utils.c:1251
void ws80211_free_interfaces(GArray *interfaces)
Definition ws80211_utils.c:1227
bool ws80211_has_fcs_filter(void)
Definition ws80211_utils.c:1209