Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Macros | Enumerations | Functions
ws80211_utils.h File Reference
#include <wireshark.h>

Go to the source code of this file.

Classes

struct  ws80211_frequency
 Describes a single frequency and its channel-type constraints. More...
 
struct  ws80211_band
 Describes the channel capabilities of a single RF band on a PHY. More...
 
struct  ws80211_interface
 Represents a wireless network interface and its capture capabilities. More...
 
struct  ws80211_iface_info
 Snapshot of the current configuration of a wireless interface. More...
 

Macros

#define CHAN_NO_HT   "NOHT"
 String token for WS80211_CHAN_NO_HT; used in channel type serialization.
 
#define CHAN_HT20   "HT20"
 String token for WS80211_CHAN_HT20.
 
#define CHAN_HT40MINUS   "HT40-"
 String token for WS80211_CHAN_HT40MINUS.
 
#define CHAN_HT40PLUS   "HT40+"
 String token for WS80211_CHAN_HT40PLUS.
 
#define CHAN_HE40   "HE40"
 String token for WS80211_CHAN_HE40.
 
#define CHAN_VHT80   "VHT80"
 String token for WS80211_CHAN_VHT80.
 
#define CHAN_VHT80P80   "VHT80+80"
 String token for WS80211_CHAN_VHT80P80.
 
#define CHAN_VHT160   "VHT160"
 String token for WS80211_CHAN_VHT160.
 
#define CHAN_EHT320   "EHT320"
 String token for WS80211_CHAN_EHT320.
 
#define WS80211_OK   0
 
#define WS80211_ERROR_NOT_SUPPORTED   1
 
#define WS80211_ERROR   2
 

Enumerations

enum  ws80211_channel_type {
  WS80211_CHAN_NO_HT , WS80211_CHAN_HT20 , WS80211_CHAN_HT40MINUS , WS80211_CHAN_HT40PLUS ,
  WS80211_CHAN_HE40 , WS80211_CHAN_VHT80 , WS80211_CHAN_VHT80P80 , WS80211_CHAN_VHT160 ,
  WS80211_CHAN_EHT320
}
 IEEE 802.11 channel width/type for monitor mode configuration. More...
 
enum  ws80211_band_type { WS80211_BAND_2GHZ , WS80211_BAND_5GHZ , WS80211_BAND_6GHZ }
 Supported RF band identifiers (not equivalent to Linux NL80211_BAND_*). More...
 
enum  ws80211_fcs_validation { WS80211_FCS_ALL , WS80211_FCS_VALID , WS80211_FCS_INVALID }
 FCS (Frame Check Sequence) capture filter policy. More...
 

Functions

const char * ws80211_geterror (int error)
 
int ws80211_init (void)
 
GArray * ws80211_find_interfaces (void)
 Finds and returns a list of wireless network interfaces.
 
int ws80211_get_iface_info (const char *name, struct ws80211_iface_info *iface_info)
 Get information about a wireless interface.
 
void ws80211_free_interfaces (GArray *interfaces)
 Free an interface list.
 
void ws80211_clear_band (struct ws80211_band *band)
 Clear the frequencies array in a ws80211_band structure.
 
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.
 
int ws80211_str_to_chan_type (const char *s)
 Convert a string representation of a channel type to its corresponding enum value.
 
const char * ws80211_chan_type_to_str (enum ws80211_channel_type type)
 Convert a Wi-Fi channel type to its string representation.
 
const char * ws80211_band_type_to_str (enum ws80211_band_type type)
 Convert a Wi-Fi band type to its string representation.
 
bool ws80211_has_fcs_filter (void)
 Check to see if we have FCS filtering.
 
int ws80211_set_fcs_validation (const char *name, enum ws80211_fcs_validation fcs_validation)
 Set the FCS validation behavior for an interface.
 
const char * ws80211_get_helper_path (void)
 Get the path to a helper application.
 
int ws80211_get_center_frequency (int control_frequency, enum ws80211_channel_type channel_type)
 Return center frequency of an 80M/160M/320M channel.
 

Detailed Description

Copyright 2012, Pontus Fuchs pontu.nosp@m.s.fu.nosp@m.chs@g.nosp@m.mail.nosp@m..com

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later

Enumeration Type Documentation

◆ ws80211_band_type

Supported RF band identifiers (not equivalent to Linux NL80211_BAND_*).

Enumerator
WS80211_BAND_2GHZ 

2.4 GHz band

WS80211_BAND_5GHZ 

5 GHz band

WS80211_BAND_6GHZ 

6 GHz band (Wi-Fi 6E/7)

◆ ws80211_channel_type

IEEE 802.11 channel width/type for monitor mode configuration.

Enumerator
WS80211_CHAN_NO_HT 

Legacy 20 MHz, no High Throughput (non-HT)

WS80211_CHAN_HT20 

20 MHz High Throughput (HT20)

WS80211_CHAN_HT40MINUS 

40 MHz HT, secondary channel below primary (HT40-)

WS80211_CHAN_HT40PLUS 

40 MHz HT, secondary channel above primary (HT40+)

WS80211_CHAN_HE40 

40 MHz High Efficiency (HE/Wi-Fi 6) with explicit center frequency

WS80211_CHAN_VHT80 

80 MHz Very High Throughput (VHT/Wi-Fi 5)

WS80211_CHAN_VHT80P80 

80+80 MHz VHT with two non-contiguous 80 MHz segments

WS80211_CHAN_VHT160 

160 MHz VHT contiguous channel

WS80211_CHAN_EHT320 

320 MHz Extremely High Throughput (EHT/Wi-Fi 7)

◆ ws80211_fcs_validation

FCS (Frame Check Sequence) capture filter policy.

Enumerator
WS80211_FCS_ALL 

Capture all frames regardless of FCS validity

WS80211_FCS_VALID 

Capture only frames with a valid FCS

WS80211_FCS_INVALID 

Capture only frames with an invalid FCS

Function Documentation

◆ 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.

Parameters
typeThe Wi-Fi band type to convert.
Returns
String representation of the band type, or NULL if invalid.

◆ 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.

Parameters
typeThe Wi-Fi channel type to convert.
Returns
const char* The string representation of the channel type, or NULL if unknown.

◆ ws80211_clear_band()

void ws80211_clear_band ( struct ws80211_band band)

Clear the frequencies array in a ws80211_band structure.

Parameters
bandThe pointer to the ws80211_band structure whose frequencies array is to be cleared.

◆ ws80211_find_interfaces()

GArray * ws80211_find_interfaces ( void  )

Finds and returns a list of wireless network interfaces.

Build a list of 802.11 interfaces.

Returns
A GArray of pointers to struct ws80211_interface on success, NULL on failure.
A GArray containing pointers to struct ws80211_interface, each representing a wireless interface. The caller is responsible for freeing the returned array and its contents.

◆ ws80211_free_interfaces()

void ws80211_free_interfaces ( GArray *  interfaces)

Free an interface list.

Parameters
interfacesA list of interfaces created with ws80211_find_interfaces().

◆ 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.

Parameters
control_frequencyControl channel frequency in MHz.
channel_typeThe channel type.
Returns
Center frequency of the channel in MHz or -1 on failure.
Note
-1 is returned for channel types smaller than 80MHz, where ws80211_set_freq does not need a center frequency.

◆ ws80211_get_helper_path()

const char * ws80211_get_helper_path ( void  )

Get the path to a helper application.

Return the path to a separate 802.11 helper application, e.g. the GNOME Network Manager.

Returns
The path to the helper on success, NULL on failure.

◆ ws80211_get_iface_info()

int ws80211_get_iface_info ( const char *  name,
struct ws80211_iface_info iface_info 
)

Get information about a wireless interface.

Parameters
nameThe name of the interface to query.
iface_infoA pointer to a structure where the interface information will be stored.
Returns
0 on success, non-zero on failure.

◆ ws80211_geterror()

const char * ws80211_geterror ( int  error)

Retrieve an 802.11 error message based on the most recent returned error.

◆ ws80211_has_fcs_filter()

bool ws80211_has_fcs_filter ( void  )

Check to see if we have FCS filtering.

Returns
true if FCS filtering is supported on this platform.

◆ ws80211_init()

int ws80211_init ( void  )

Initialize the 802.11 environment. On Linux this initializes an nl80211_state struct.

Returns
WS80211_OK on success, WS80211_ERROR_NOT_SUPPORTED if the 802.11 environment isn't supported, or WS80211_ERROR for other errors.

◆ 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.

Parameters
nameThe interface name.
fcs_validationThe desired validation behavior.
Returns
WS80211_OK on success, other values on failure.

◆ 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.

Parameters
nameThe interface name.
freqThe frequency in MHz.
chan_typeThe HT channel type (no, 20Mhz, 40Mhz...).
center_freqThe center frequency in MHz (if 80MHz, 80+80MHz or 160MHz).
center_freq2The 2nd center frequency in MHz (if 80+80MHz).
Returns
WS80211_OK on success, other values on failure.

◆ 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.

Parameters
sThe string representation of the channel type.
Returns
int The corresponding enum value, or -1 if the string is invalid.