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

Go to the source code of this file.

Functions

int libwifi_set_assoc_resp_channel (struct libwifi_assoc_resp *assoc_resp, uint8_t channel)
 Set the channel of a libwifi_assoc_resp. More...
 
size_t libwifi_get_assoc_resp_length (struct libwifi_assoc_resp *assoc_resp)
 Calculate the length of a given libwifi_assoc_resp. More...
 
int libwifi_create_assoc_resp (struct libwifi_assoc_resp *assoc_resp, const unsigned char receiver[6], const unsigned char transmitter[6], const unsigned char address3[6], uint8_t channel)
 Generate a populated libwifi assoc_resp. More...
 
size_t libwifi_dump_assoc_resp (struct libwifi_assoc_resp *assoc_resp, unsigned char *buf, size_t buf_len)
 Dump a libwifi_assoc_resp into a raw format for packet injection. More...
 
void libwifi_free_assoc_resp (struct libwifi_assoc_resp *assoc_resp)
 Free any memory claimed by a libwifi_assoc_resp back to the system. More...
 

Function Documentation

◆ libwifi_create_assoc_resp()

int libwifi_create_assoc_resp ( struct libwifi_assoc_resp assoc_resp,
const unsigned char  receiver[6],
const unsigned char  transmitter[6],
const unsigned char  address3[6],
uint8_t  channel 
)

Generate a populated libwifi assoc_resp.

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

Parameters
assoc_respA libwifi_assoc_resp
receiverThe receiver MAC address, aka address 1
transmitterThe source MAC address, aka address 2
address3The address 3 frame field value, typically the BSSID
channelThe desired channel of the assoc_resp
Returns
Zero on success, or negative error

Generate a populated libwifi assoc_resp.

Two tagged parameters are also added to the association response: Channel and Supported Rates.

Definition at line 65 of file assoc_response.c.

◆ libwifi_dump_assoc_resp()

size_t libwifi_dump_assoc_resp ( struct libwifi_assoc_resp assoc_resp,
unsigned char *  buf,
size_t  buf_len 
)

Dump a libwifi_assoc_resp into a raw format for packet injection.

Parameters
assoc_respA libwifi_assoc_resp
bufThe output buffer for the frame data
buf_lenThe length of the output buffer
Returns
The length of the dumped assoc_resp, or negative error

Dump a libwifi_assoc_resp into a raw format for packet injection.

This is useful when injecting generated libwifi frames.

Definition at line 94 of file assoc_response.c.

◆ libwifi_free_assoc_resp()

void libwifi_free_assoc_resp ( struct libwifi_assoc_resp assoc_resp)

Free any memory claimed by a libwifi_assoc_resp back to the system.

Parameters
assoc_respA libwifi_assoc_resp

Free any memory claimed by a libwifi_assoc_resp back to the system.

Definition at line 117 of file assoc_response.c.

◆ libwifi_get_assoc_resp_length()

size_t libwifi_get_assoc_resp_length ( struct libwifi_assoc_resp assoc_resp)

Calculate the length of a given libwifi_assoc_resp.

Parameters
assoc_respA libwifi_assoc_resp
Returns
The length of the given assoc_resp, or negative error

Calculate the length of a given libwifi_assoc_resp.

Definition at line 34 of file assoc_response.c.

◆ libwifi_set_assoc_resp_channel()

int libwifi_set_assoc_resp_channel ( struct libwifi_assoc_resp assoc_resp,
uint8_t  channel 
)

Set the channel of a libwifi_assoc_resp.

Parameters
assoc_respA libwifi_assoc_resp
channelThe new channel
Returns
Zero on success, or negative error

Set the channel of a libwifi_assoc_resp.

Definition at line 44 of file assoc_response.c.