libwifi 0.0.3
An 802.11 Frame Parsing and Generation library in C
frame.h File Reference
#include "../../core/misc/byteswap.h"
#include <stdint.h>
#include <sys/types.h>

Go to the source code of this file.

Data Structures

struct  libwifi_frame_ctrl_flags
 
struct  libwifi_frame_ctrl
 
struct  libwifi_seq_control
 
struct  libwifi_qos_control
 
struct  libwifi_mgmt_ordered_frame_header
 
struct  libwifi_mgmt_unordered_frame_header
 
struct  libwifi_ctrl_frame_header
 
struct  libwifi_data_frame_header
 
struct  libwifi_data_qos_frame_header
 
union  libwifi_frame_header
 
union  libwifi_mgmt_frame_header
 
struct  libwifi_frame
 

Macros

#define LIBWIFI_FLAGS_FCS_PRESENT   (1 << 0)
 
#define LIBWIFI_FLAGS_IS_QOS   (1 << 1)
 
#define LIBWIFI_FLAGS_IS_ORDERED   (1 << 2)
 

Enumerations

enum  libwifi_frame_type { TYPE_MANAGEMENT = 0 , TYPE_CONTROL = 1 , TYPE_DATA = 2 , TYPE_EXTENSION = 3 }
 
enum  libwifi_mgmt_subtypes {
  SUBTYPE_ASSOC_REQ = 0 , SUBTYPE_ASSOC_RESP = 1 , SUBTYPE_REASSOC_REQ = 2 , SUBTYPE_REASSOC_RESP = 3 ,
  SUBTYPE_PROBE_REQ = 4 , SUBTYPE_PROBE_RESP = 5 , SUBTYPE_TIME_ADV = 6 , SUBTYPE_BEACON = 8 ,
  SUBTYPE_ATIM = 9 , SUBTYPE_DISASSOC = 10 , SUBTYPE_AUTH = 11 , SUBTYPE_DEAUTH = 12 ,
  SUBTYPE_ACTION = 13 , SUBTYPE_ACTION_NOACK = 14
}
 
enum  libwifi_control_subtypes {
  SUBTYPE_TACK = 3 , SUBTYPE_BEAMFORM_REPORT_POLL = 4 , SUBTYPE_VHT_NDP_ANNOUNCE = 5 , SUBTYPE_CF_EXTENSION = 6 ,
  SUBTYPE_WRAPPER = 7 , SUBTYPE_BLOCK_ACK_REQ = 8 , SUBTYPE_BLOCK_ACK = 9 , SUBTYPE_PS_POLL = 10 ,
  SUBTYPE_RTS = 11 , SUBTYPE_CTS = 12 , SUBTYPE_ACK = 13 , SUBTYPE_CF_END = 14 ,
  SUBTYPE_CF_END_CF_ACK = 15
}
 
enum  libwifi_control_extension_subtypes {
  SUBTYPE_CF_EXT_POLL = 2 , SUBTYPE_CF_EXT_SPR = 3 , SUBTYPE_CF_EXT_GRANT = 4 , SUBTYPE_CF_EXT_DMG_CTS = 5 ,
  SUBTYPE_CF_EXT_DMG_DTS = 6 , SUBTYPE_CF_EXT_GRANT_ACK = 7 , SUBTYPE_CF_EXT_SSW = 8 , SUBTYPE_CF_EXT_SSW_FEEDBACK = 9 ,
  SUBTYPE_CF_EXT_SSW_ACK = 10
}
 
enum  libwifi_data_subtypes {
  SUBTYPE_DATA = 0 , SUBTYPE_DATA_NULL = 4 , SUBTYPE_DATA_QOS_DATA = 8 , SUBTYPE_DATA_QOS_DATA_CF_ACK = 9 ,
  SUBTYPE_DATA_QOS_DATA_CF_POLL = 10 , SUBTYPE_DATA_QOS_DATA_CF_ACK_CF_POLL = 11 , SUBTYPE_DATA_QOS_NULL = 12 , SUBTYPE_DATA_QOS_CF_POLL = 14 ,
  SUBTYPE_DATA_QOS_CF_ACK_CF_POLL = 15
}
 
enum  libwifi_extension_subtypes { SUBTYPE_EXTENSION_DMG_BEACON = 0 , SUBTYPE_EXTENSION_SIG_BEACON = 1 }
 

Functions

struct libwifi_frame_ctrl_flags __attribute__ ((packed))
 
int libwifi_get_wifi_frame (struct libwifi_frame *fi, const unsigned char *frame, size_t frame_len, int radiotap)
 Convert a sniffed 802.11 frame into a libwifi_frame. More...
 
void libwifi_free_wifi_frame (struct libwifi_frame *fi)
 Free any dynamically allocated data inside a libwifi_frame. More...
 

Variables

unsigned int to_ds
 
unsigned int from_ds
 
unsigned int more_frags
 
unsigned int retry
 
unsigned int power_mgmt
 
unsigned int more_data
 
unsigned int protect
 
unsigned int ordered
 
unsigned int version
 
unsigned int type
 
unsigned int subtype
 
struct libwifi_frame_ctrl_flags flags
 
unsigned int fragment_number
 
unsigned int sequence_number
 
unsigned int bit1
 
unsigned int bit2
 
unsigned int bit3
 
unsigned int bit4
 
unsigned int bit5
 
unsigned int bit6
 
unsigned int bit7
 
unsigned int bit8
 
unsigned int bit9
 
unsigned int bit10
 
unsigned int bit11
 
unsigned int bit12
 
unsigned int bit13
 
unsigned int bit14
 
unsigned int bit15
 
unsigned int bit16
 
struct libwifi_frame_ctrl frame_control
 
uint16_t duration
 
unsigned char addr1 [6]
 
unsigned char addr2 [6]
 
unsigned char addr3 [6]
 
struct libwifi_seq_control seq_control
 
uint32_t ht_control
 
struct libwifi_qos_control qos_control
 
union libwifi_frame_header __attribute__
 

Macro Definition Documentation

◆ LIBWIFI_FLAGS_FCS_PRESENT

#define LIBWIFI_FLAGS_FCS_PRESENT   (1 << 0)

Definition at line 25 of file frame.h.

◆ LIBWIFI_FLAGS_IS_ORDERED

#define LIBWIFI_FLAGS_IS_ORDERED   (1 << 2)

Definition at line 27 of file frame.h.

◆ LIBWIFI_FLAGS_IS_QOS

#define LIBWIFI_FLAGS_IS_QOS   (1 << 1)

Definition at line 26 of file frame.h.

Enumeration Type Documentation

◆ libwifi_control_extension_subtypes

Enumerator
SUBTYPE_CF_EXT_POLL 
SUBTYPE_CF_EXT_SPR 
SUBTYPE_CF_EXT_GRANT 
SUBTYPE_CF_EXT_DMG_CTS 
SUBTYPE_CF_EXT_DMG_DTS 
SUBTYPE_CF_EXT_GRANT_ACK 
SUBTYPE_CF_EXT_SSW 
SUBTYPE_CF_EXT_SSW_FEEDBACK 
SUBTYPE_CF_EXT_SSW_ACK 

Definition at line 70 of file frame.h.

◆ libwifi_control_subtypes

Enumerator
SUBTYPE_TACK 
SUBTYPE_BEAMFORM_REPORT_POLL 
SUBTYPE_VHT_NDP_ANNOUNCE 
SUBTYPE_CF_EXTENSION 
SUBTYPE_WRAPPER 
SUBTYPE_BLOCK_ACK_REQ 
SUBTYPE_BLOCK_ACK 
SUBTYPE_PS_POLL 
SUBTYPE_RTS 
SUBTYPE_CTS 
SUBTYPE_ACK 
SUBTYPE_CF_END 
SUBTYPE_CF_END_CF_ACK 

Definition at line 54 of file frame.h.

◆ libwifi_data_subtypes

Enumerator
SUBTYPE_DATA 
SUBTYPE_DATA_NULL 
SUBTYPE_DATA_QOS_DATA 
SUBTYPE_DATA_QOS_DATA_CF_ACK 
SUBTYPE_DATA_QOS_DATA_CF_POLL 
SUBTYPE_DATA_QOS_DATA_CF_ACK_CF_POLL 
SUBTYPE_DATA_QOS_NULL 
SUBTYPE_DATA_QOS_CF_POLL 
SUBTYPE_DATA_QOS_CF_ACK_CF_POLL 

Definition at line 83 of file frame.h.

◆ libwifi_extension_subtypes

Enumerator
SUBTYPE_EXTENSION_DMG_BEACON 
SUBTYPE_EXTENSION_SIG_BEACON 

Definition at line 97 of file frame.h.

◆ libwifi_frame_type

Enumerator
TYPE_MANAGEMENT 
TYPE_CONTROL 
TYPE_DATA 
TYPE_EXTENSION 

Definition at line 30 of file frame.h.

◆ libwifi_mgmt_subtypes

Enumerator
SUBTYPE_ASSOC_REQ 
SUBTYPE_ASSOC_RESP 
SUBTYPE_REASSOC_REQ 
SUBTYPE_REASSOC_RESP 
SUBTYPE_PROBE_REQ 
SUBTYPE_PROBE_RESP 
SUBTYPE_TIME_ADV 
SUBTYPE_BEACON 
SUBTYPE_ATIM 
SUBTYPE_DISASSOC 
SUBTYPE_AUTH 
SUBTYPE_DEAUTH 
SUBTYPE_ACTION 
SUBTYPE_ACTION_NOACK 

Definition at line 36 of file frame.h.

Function Documentation

◆ __attribute__()

struct libwifi_frame_ctrl_flags __attribute__ ( (packed)  )

◆ libwifi_free_wifi_frame()

void libwifi_free_wifi_frame ( struct libwifi_frame fi)

Free any dynamically allocated data inside a libwifi_frame.

Parameters
fiA libwifi_frame struct

Definition at line 144 of file frame.c.

◆ libwifi_get_wifi_frame()

int libwifi_get_wifi_frame ( struct libwifi_frame fi,
const unsigned char *  frame,
size_t  frame_len,
int  radiotap 
)

Convert a sniffed 802.11 frame into a libwifi_frame.

Parameters
fiA libwifi_frame struct
frameAn 802.11 frame
frame_lenLength of the sniffed 802.11 frame
Returns

Definition at line 35 of file frame.c.

Variable Documentation

◆ __attribute__

struct libwifi_wpa_auth_data __attribute__

◆ addr1

unsigned char addr1

Definition at line 2 of file frame.h.

◆ addr2

unsigned char addr2

Definition at line 3 of file frame.h.

◆ addr3

unsigned char addr3

Definition at line 4 of file frame.h.

◆ bit1

unsigned int bit1

Definition at line 0 of file frame.h.

◆ bit10

unsigned int bit10

Definition at line 9 of file frame.h.

◆ bit11

unsigned int bit11

Definition at line 10 of file frame.h.

◆ bit12

unsigned int bit12

Definition at line 11 of file frame.h.

◆ bit13

unsigned int bit13

Definition at line 12 of file frame.h.

◆ bit14

unsigned int bit14

Definition at line 13 of file frame.h.

◆ bit15

unsigned int bit15

Definition at line 14 of file frame.h.

◆ bit16

unsigned int bit16

Definition at line 15 of file frame.h.

◆ bit2

unsigned int bit2

Definition at line 1 of file frame.h.

◆ bit3

unsigned int bit3

Definition at line 2 of file frame.h.

◆ bit4

unsigned int bit4

Definition at line 3 of file frame.h.

◆ bit5

unsigned int bit5

Definition at line 4 of file frame.h.

◆ bit6

unsigned int bit6

Definition at line 5 of file frame.h.

◆ bit7

unsigned int bit7

Definition at line 6 of file frame.h.

◆ bit8

unsigned int bit8

Definition at line 7 of file frame.h.

◆ bit9

unsigned int bit9

Definition at line 8 of file frame.h.

◆ duration

uint16_t duration

Definition at line 1 of file frame.h.

◆ flags

uint8_t flags

Definition at line 3 of file frame.h.

◆ fragment_number

unsigned int fragment_number

Definition at line 0 of file frame.h.

◆ frame_control

struct libwifi_frame_ctrl frame_control

Definition at line 0 of file frame.h.

◆ from_ds

unsigned int from_ds

Definition at line 1 of file frame.h.

◆ ht_control

uint32_t ht_control

Definition at line 6 of file frame.h.

◆ more_data

unsigned int more_data

Definition at line 5 of file frame.h.

◆ more_frags

unsigned int more_frags

Definition at line 2 of file frame.h.

◆ ordered

unsigned int ordered

Definition at line 7 of file frame.h.

◆ power_mgmt

unsigned int power_mgmt

Definition at line 4 of file frame.h.

◆ protect

unsigned int protect

Definition at line 6 of file frame.h.

◆ qos_control

struct libwifi_qos_control qos_control

Definition at line 6 of file frame.h.

◆ retry

unsigned int retry

Definition at line 3 of file frame.h.

◆ seq_control

struct libwifi_seq_control seq_control

Definition at line 5 of file frame.h.

◆ sequence_number

unsigned int sequence_number

Definition at line 1 of file frame.h.

◆ subtype

unsigned int subtype

Definition at line 2 of file frame.h.

◆ to_ds

unsigned int to_ds

Definition at line 0 of file frame.h.

◆ type

unsigned int type

Definition at line 1 of file frame.h.

◆ version

unsigned int version

Definition at line 0 of file frame.h.