libwifi 0.0.3
An 802.11 Frame Parsing and Generation library in C
common.c File Reference
#include "common.h"
#include "../../core/frame/tag.h"
#include "../misc/security.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Functions

void libwifi_handle_ssid_tag (void *target, int target_type, const char *tag_data, int tag_len)
 Different implementations can have variations of hidden SSIDs. More...
 
int libwifi_bss_handle_rsn_tag (struct libwifi_bss *bss, const unsigned char *rsn_data, int rsn_len)
 Handle the RSN Tagged Parameter. More...
 
int libwifi_bss_handle_msft_tag (struct libwifi_bss *bss, const unsigned char *msft_data, int msft_len)
 The Microsoft vendor tag is used to advertise WPA and WPS information, as well as some other features such as WMM/WME. More...
 
int libwifi_bss_tag_parser (struct libwifi_bss *bss, struct libwifi_tag_iterator *it)
 This function is a parser for common and useful tags found in frames usually originating from the BSS. More...
 
int libwifi_sta_tag_parser (struct libwifi_sta *sta, struct libwifi_tag_iterator *it)
 This function is a parser for common and useful tags found in frames usually originating from the 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 
)

The Microsoft vendor tag is used to advertise WPA and WPS information, as well as some other features such as WMM/WME.

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 
)

Handle the RSN Tagged Parameter.

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 
)

This function is a parser for common and useful tags found in frames usually originating from the BSS.

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 
)

Different implementations can have variations of hidden SSIDs.

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 
)

This function is a parser for common and useful tags found in frames usually originating from the STA.

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.