libwifi 0.0.3
An 802.11 Frame Parsing and Generation library in C
common.h File Reference

Go to the source code of this file.

Functions

void libwifi_handle_ssid_tag (void *target, int target_type, const char *ssid, int ssid_len)
 A helper function to set the SSID of a libwifi_bss, as well as check if it is hidden or not. More...
 
int libwifi_bss_handle_rsn_tag (struct libwifi_bss *bss, const unsigned char *rsn_data, int rsn_len)
 A helper function to handle the parsing of the RSN IE. More...
 
int libwifi_bss_handle_msft_tag (struct libwifi_bss *bss, const unsigned char *msft_data, int msft_len)
 A helper function to handle the parsing of the Microsoft Vendor IE. More...
 
int libwifi_bss_tag_parser (struct libwifi_bss *bss, struct libwifi_tag_iterator *it)
 A helper function to iterate through common tags found in a libwifi_bss. More...
 
int libwifi_sta_tag_parser (struct libwifi_sta *sta, struct libwifi_tag_iterator *it)
 A helper function to iterate through common tags found in a libwifi_sta. More...
 

Function Documentation

◆ libwifi_bss_handle_msft_tag()

int libwifi_bss_handle_msft_tag ( struct libwifi_bss bss,
const unsigned char *  msft_data,
int  msft_len 
)

A helper function to handle the parsing of the Microsoft Vendor IE.

Parameters
bssA libwifi_bss
msft_dataThe Microsoft vendor tag data
msft_lenThe length of the Microsoft tag data

A helper function to handle the parsing of the Microsoft Vendor IE.

The difference between the tags is found via the "Vendor Specific OUI Type" field. A common representation of this is XX:XX:XX:YY, such as 00:50:F2:04, where 00:50:F2 is the Microsoft OUI and 04 is the type.

It is important to skip the OUI and Type as described above before parsing the data of the tag. This is encapsulated with the libwifi_tag_vendor_header struct.

Definition at line 102 of file common.c.

◆ libwifi_bss_handle_rsn_tag()

int libwifi_bss_handle_rsn_tag ( struct libwifi_bss bss,
const unsigned char *  rsn_data,
int  rsn_len 
)

A helper function to handle the parsing of the RSN IE.

Parameters
bssA libwifi_bss
rsn_dataThe RSN tag data
rsn_lenThe length of the RSN tag data

A helper function to handle the parsing of the RSN IE.

At the minimum, the required RSN data is the version and the group cipher suites. RSN information is then enumerated within the libwifi_get_rsn_info() function.

Definition at line 68 of file common.c.

◆ libwifi_bss_tag_parser()

int libwifi_bss_tag_parser ( struct libwifi_bss bss,
struct libwifi_tag_iterator it 
)

A helper function to iterate through common tags found in a libwifi_bss.

Parameters
bssA libwifi_bss
itA libwifi_tag_iterator
Returns
0 if successful, a negative number if not

A helper function to iterate through common tags found in a libwifi_bss.

These include the SSID and DS or HT fields, which can be used to determine the channel.

Definition at line 139 of file common.c.

◆ libwifi_handle_ssid_tag()

void libwifi_handle_ssid_tag ( void *  target,
int  target_type,
const char *  tag_data,
int  tag_len 
)

A helper function to set the SSID of a libwifi_bss, as well as check if it is hidden or not.

Parameters
targetA libwifi_bss or libwifi_sta
target_typeLIBWIFI_BSS or LIBWIFI_STA
ssidThe SSID to set
ssid_lenThe length of the supplied SSID

A helper function to set the SSID of a libwifi_bss, as well as check if it is hidden or not.

It is common to simply set the SSID to an empty string, but some devices may "blank" the real SSID without reducing the character count.

Example: "My-SSID" -> "\x00\x00\x00\x00\x00\x00\x00"

Definition at line 31 of file common.c.

◆ libwifi_sta_tag_parser()

int libwifi_sta_tag_parser ( struct libwifi_sta sta,
struct libwifi_tag_iterator it 
)

A helper function to iterate through common tags found in a libwifi_sta.

Parameters
staA libwifi_sta
itA libwifi_tag_iterator
Returns
0 if successful, a negative number if not

A helper function to iterate through common tags found in a libwifi_sta.

These include the SSID and DS or HT fields, which can be used to determine the channel.

Definition at line 177 of file common.c.