libwifi 0.0.3
An 802.11 Frame Parsing and Generation library in C
assoc_response.c File Reference
#include "assoc_response.h"
#include "../../core/frame/tag.h"
#include "../../core/frame/tag_iterator.h"
#include "../../core/misc/byteswap.h"
#include "../../core/misc/epoch.h"
#include "../../core/misc/types.h"
#include "common.h"
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>

Go to the source code of this file.

Functions

size_t libwifi_get_assoc_resp_length (struct libwifi_assoc_resp *assoc_resp)
 The length of an association response frame is the sum of the header length, the fixed parameters length, and the tagged parameters length. More...
 
int libwifi_set_assoc_resp_channel (struct libwifi_assoc_resp *assoc_resp, uint8_t channel)
 Simple helper function to set the channel of an association response by removing and re-adding the DS tagged parameter. 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)
 The generated association response frame is made with sane defaults defined in common.h and core/types.h. More...
 
size_t libwifi_dump_assoc_resp (struct libwifi_assoc_resp *assoc_resp, unsigned char *buf, size_t buf_len)
 Copy a libwifi_assoc_resp into a regular unsigned char buffer. More...
 
void libwifi_free_assoc_resp (struct libwifi_assoc_resp *assoc_resp)
 Because the tagged parameters memory is managed inside of the library, the library must be the one to free it, too. 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 
)

The generated association response frame is made with sane defaults defined in common.h and core/types.h.

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 
)

Copy a libwifi_assoc_resp into a regular unsigned char buffer.

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)

Because the tagged parameters memory is managed inside of the library, the library must be the one to free it, too.

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)

The length of an association response frame is the sum of the header length, the fixed parameters length, and the tagged parameters length.

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 
)

Simple helper function to set the channel of an association response by removing and re-adding the DS tagged parameter.

Set the channel of a libwifi_assoc_resp.

Definition at line 44 of file assoc_response.c.