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

Go to the source code of this file.

Functions

int libwifi_set_beacon_ssid (struct libwifi_beacon *beacon, const char *ssid)
 Set the SSID of a struct libwifi_beacon. More...
 
int libwifi_set_beacon_channel (struct libwifi_beacon *beacon, uint8_t channel)
 Set the channel of a struct libwifi_beacon. More...
 
size_t libwifi_get_beacon_length (struct libwifi_beacon *beacon)
 Calculate the length of a given struct libwifi_beacon. More...
 
int libwifi_create_beacon (struct libwifi_beacon *beacon, const unsigned char receiver[6], const unsigned char transmitter[6], const unsigned char address3[6], const char *ssid, uint8_t channel)
 Generate a populated libwifi beacon. More...
 
size_t libwifi_dump_beacon (struct libwifi_beacon *beacon, unsigned char *buf, size_t buf_len)
 Dump a struct libwifi_beacon into a raw format for packet injection. More...
 
void libwifi_free_beacon (struct libwifi_beacon *beacon)
 Free any memory claimed by a struct libwifi_beacon back to the system. More...
 

Function Documentation

◆ libwifi_create_beacon()

int libwifi_create_beacon ( struct libwifi_beacon beacon,
const unsigned char  receiver[6],
const unsigned char  transmitter[6],
const unsigned char  address3[6],
const char *  ssid,
uint8_t  channel 
)

Generate a populated libwifi beacon.

A generated libwifi beacon can be "dumped" into a buffer for packet injection via the libwifi_dump_beacon.

Parameters
beaconA struct libwifi_beacon
receiverThe receiver MAC address, aka address 1
transmitterThe source MAC address, aka address 2
address3The address 3 frame field value, typically the BSSID
ssidThe SSID of the beacon. Maximum length is 32 characters
channelThe desired channel of the beacon
Returns
Zero on success, or negative error

Generate a populated libwifi beacon.

Two tagged parameters are also added to the beacon: SSID and Channel.

Definition at line 81 of file beacon.c.

◆ libwifi_dump_beacon()

size_t libwifi_dump_beacon ( struct libwifi_beacon beacon,
unsigned char *  buf,
size_t  buf_len 
)

Dump a struct libwifi_beacon into a raw format for packet injection.

Parameters
beaconA struct libwifi_beacon
bufThe output buffer for the frame data
buf_lenThe length of the output buffer
Returns
The length of the dumped beacon, or negative error

Dump a struct libwifi_beacon into a raw format for packet injection.

This is useful when injecting generated libwifi frames.

Definition at line 114 of file beacon.c.

◆ libwifi_free_beacon()

void libwifi_free_beacon ( struct libwifi_beacon beacon)

Free any memory claimed by a struct libwifi_beacon back to the system.

Parameters
beaconA struct libwifi_beacon

Free any memory claimed by a struct libwifi_beacon back to the system.

Definition at line 137 of file beacon.c.

◆ libwifi_get_beacon_length()

size_t libwifi_get_beacon_length ( struct libwifi_beacon beacon)

Calculate the length of a given struct libwifi_beacon.

Parameters
beaconA libwifi_beacon struct
Returns
The length of the given beacon, or negative error

Calculate the length of a given struct libwifi_beacon.

Definition at line 33 of file beacon.c.

◆ libwifi_set_beacon_channel()

int libwifi_set_beacon_channel ( struct libwifi_beacon beacon,
uint8_t  channel 
)

Set the channel of a struct libwifi_beacon.

Parameters
beaconA struct libwifi_beacon
channelThe new channel
Returns
Zero on success, or negative error

Set the channel of a struct libwifi_beacon.

Definition at line 60 of file beacon.c.

◆ libwifi_set_beacon_ssid()

int libwifi_set_beacon_ssid ( struct libwifi_beacon beacon,
const char *  ssid 
)

Set the SSID of a struct libwifi_beacon.

Parameters
beaconA struct libwifi_beacon
ssidThe new SSID
Returns
Zero on success, or negative error

Set the SSID of a struct libwifi_beacon.

Definition at line 42 of file beacon.c.