libwifi 0.0.3
An 802.11 Frame Parsing and Generation library in C
probe_response.c File Reference
#include "probe_response.h"
#include "../../core/frame/tag.h"
#include "../../core/frame/tag_iterator.h"
#include "../../core/misc/byteswap.h"
#include "../../core/misc/epoch.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_probe_resp_length (struct libwifi_probe_resp *probe_resp)
 The length of a probe response frame is the sum of the header length, the fixed parameters length, and the tagged parameters length. More...
 
int libwifi_set_probe_resp_ssid (struct libwifi_probe_resp *probe_resp, const char *ssid)
 Simple helper to set the probe response SSID tag by removing it and then adding it back with the new value. More...
 
int libwifi_set_probe_resp_channel (struct libwifi_probe_resp *probe_resp, uint8_t channel)
 Simple helper to set the probe response DS tag by removing it and then adding it back with the new value. More...
 
int libwifi_create_probe_resp (struct libwifi_probe_resp *probe_resp, const unsigned char receiver[6], const unsigned char transmitter[6], const unsigned char address3[6], const char *ssid, uint8_t channel)
 The generated probe response frame is made with sane defaults defined in common.h. More...
 
size_t libwifi_dump_probe_resp (struct libwifi_probe_resp *probe_resp, unsigned char *buf, size_t buf_len)
 Copy a libwifi_probe_resp into a regular unsigned char buffer. More...
 
void libwifi_free_probe_resp (struct libwifi_probe_resp *probe_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_probe_resp()

int libwifi_create_probe_resp ( struct libwifi_probe_resp probe_resp,
const unsigned char  receiver[6],
const unsigned char  transmitter[6],
const unsigned char  address3[6],
const char *  ssid,
uint8_t  channel 
)

The generated probe response frame is made with sane defaults defined in common.h.

Generate a populated libwifi probe_resp.

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

Definition at line 81 of file probe_response.c.

◆ libwifi_dump_probe_resp()

size_t libwifi_dump_probe_resp ( struct libwifi_probe_resp probe_resp,
unsigned char *  buf,
size_t  buf_len 
)

Copy a libwifi_probe_resp into a regular unsigned char buffer.

Dump a libwifi_probe_resp into a raw format for packet injection.

This is useful when injecting generated libwifi frames.

Definition at line 115 of file probe_response.c.

◆ libwifi_free_probe_resp()

void libwifi_free_probe_resp ( struct libwifi_probe_resp probe_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_probe_resp back to the system.

Definition at line 138 of file probe_response.c.

◆ libwifi_get_probe_resp_length()

size_t libwifi_get_probe_resp_length ( struct libwifi_probe_resp probe_resp)

The length of a probe 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_probe_resp.

Definition at line 33 of file probe_response.c.

◆ libwifi_set_probe_resp_channel()

int libwifi_set_probe_resp_channel ( struct libwifi_probe_resp probe_resp,
uint8_t  channel 
)

Simple helper to set the probe response DS tag by removing it and then adding it back with the new value.

Set the channel of a libwifi_probe_resp.

Definition at line 60 of file probe_response.c.

◆ libwifi_set_probe_resp_ssid()

int libwifi_set_probe_resp_ssid ( struct libwifi_probe_resp probe_resp,
const char *  ssid 
)

Simple helper to set the probe response SSID tag by removing it and then adding it back with the new value.

Set the SSID of a libwifi_probe_resp.

Definition at line 42 of file probe_response.c.