libwifi 0.0.3
An 802.11 Frame Parsing and Generation library in C
tag.h File Reference
#include <stdint.h>
#include <sys/types.h>

Go to the source code of this file.

Data Structures

struct  libwifi_tag_header
 A tagged parameter always consists of a tag number and length. More...
 
struct  libwifi_tagged_parameter
 
struct  libwifi_tagged_parameters
 
struct  libwifi_tag_vendor_header
 

Enumerations

enum  libwifi_tag_numbers {
  TAG_SSID = 0 , TAG_SUPP_RATES = 1 , TAG_DS_PARAMETER = 3 , TAG_CF_PARAMETER = 4 ,
  TAG_TIM = 5 , TAG_BSS_PARAMETERS = 6 , TAG_COUNTRY = 7 , TAG_REQUEST = 10 ,
  TAG_BSS_LOAD = 11 , TAG_EDCA_PARAMETERS = 12 , TAG_TSPEC = 13 , TAG_TCLAS = 14 ,
  TAG_SCHEDULE = 15 , TAG_CHALLENGE_TEXT = 16 , TAG_POWER_CONSTRAINT = 32 , TAG_POWER_CAPABILITY = 33 ,
  TAG_TPC_REQUEST = 34 , TAG_TPC_REPORT = 35 , TAG_SUPPORTED_CHANNELS = 36 , TAG_CHANNEL_SWITCH_ANNOUNCEMENT = 37 ,
  TAG_MEASUREMENT_REQUEST = 38 , TAG_MEASUREMENT_REPORT = 39 , TAG_QUIET = 40 , TAG_IBSS_DFS = 41 ,
  TAG_ERP = 42 , TAG_TS_DELAY = 43 , TAG_TCLAS_PROCESSING = 44 , TAG_HT_CAPABILITIES = 45 ,
  TAG_QOS_CAPABILITY = 46 , TAG_RSN = 48 , TAG_EXTENDED_SUPPORTED_RATES = 50 , TAG_AP_CHANNEL_REPORT = 51 ,
  TAG_NEIGHBOR_REPORT = 52 , TAG_RCPI = 53 , TAG_MOBILITY_DOMAIN = 54 , TAG_FAST_BSS_TRANSITION = 55 ,
  TAG_TIMEOUT_INTERVAL = 56 , TAG_RIC_DATA = 57 , TAG_DSE_REGISTERED_LOCATION = 58 , TAG_SUPPORTED_OPERATING_CLASSES = 59 ,
  TAG_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT = 60 , TAG_HT_OPERATION = 61 , TAG_SECONDARY_CHANNEL_OFFSET = 62 , TAG_BSS_AVERAGE_ACCESS_DELAY = 63 ,
  TAG_ANTENNA = 64 , TAG_RSNI = 65 , TAG_MEASUREMENT_PILOT_TRANSMISSION = 66 , TAG_BSS_AVAILABLE_ADMISSION_CAPACITY = 67 ,
  TAG_BSS_AC_ACCESS_DELAY = 68 , TAG_TIME_ADVERTISEMENT = 69 , TAG_RM_ENABLED_CAPABILITIES = 70 , TAG_MULTIPLE_BSSID = 71 ,
  TAG_BSS_COEXISTENCE = 72 , TAG_BSS_INTOLERANT_CHANNEL_REPORT = 73 , TAG_OVERLAPPING_BSS_PARAMETERS = 74 , TAG_RIC_DESCRIPTOR = 75 ,
  TAG_MANAGEMENT_MIC = 76 , TAG_EVENT_REQUEST = 78 , TAG_EVENT_REPORT = 79 , TAG_DIAGNOSTIC_REQUEST = 80 ,
  TAG_DIAGNOSTIC_REPORT = 81 , TAG_LOCATION_PARAMTERS = 82 , TAG_NONTRANSMITTED_BSSID_CAPABILITY = 83 , TAG_SSID_LIST = 84 ,
  TAG_MULTIPLE_BSSID_INDEX = 85 , TAG_FMS_DESCRIPTOR = 86 , TAG_FMS_REQUEST = 87 , TAG_FMS_RESPONSE = 88 ,
  TAG_QOS_TRAFFIC_CAPABILITY = 89 , TAG_BSS_MAX_IDLE_PERIOD = 90 , TAG_TFS_REQUEST = 91 , TAG_TFS_RESPONSE = 92 ,
  TAG_WNM_SLEEP_MODE = 93 , TAG_TIM_BROADCAST_REQUEST = 94 , TAG_TIM_BROADCAST_RESPONSE = 95 , TAG_COLLOCATED_INTERFERENCE_REPORT = 96 ,
  TAG_CHANNEL_USAGE = 97 , TAG_TIME_ZONE = 98 , TAG_DMS_REQUEST = 99 , TAG_DMS_RESPONSE = 100 ,
  TAG_LINK_IDENTIFIER = 101 , TAG_WAKEUP_SCHEDULE = 102 , TAG_CHANNEL_SWITCH_TIMING = 104 , TAG_PTI_CONTROL = 105 ,
  TAG_TPU_BUFFER_STATUS = 106 , TAG_INTERWORKING = 107 , TAG_ADVERTISEMENT_PROTOCOL = 108 , TAG_EXPEDITED_BANDWIDTH_REQUEST = 109 ,
  TAG_QOS_MAP = 110 , TAG_ROAMING_CONSORTIUM = 111 , TAG_EMERGENCY_ALERT_IDENTIFIER = 112 , TAG_MESH_CONFIGURATION = 113 ,
  TAG_MESH_ID = 114 , TAG_MESH_LINK_METRIC_REPORT = 115 , TAG_CONGESTION_NOTIFICATION = 116 , TAG_MESH_PEERING_MANAGEMENT = 117 ,
  TAG_MESH_CHANNEL_SWITCH_PARAMETERS = 118 , TAG_MESH_AWAKE_WINDOW = 119 , TAG_BEACON_TIMING = 120 , TAG_MCCAOP_SETUP_REQUEST = 121 ,
  TAG_MCCAOP_SETUP_REPLY = 122 , TAG_MCCAOP_ADVERTISEMENT = 123 , TAG_MCCAOP_TEARDOWN = 124 , TAG_GANN = 125 ,
  TAG_RANN = 126 , TAG_EXTENDED_CAPABILITIES = 127 , TAG_PREQ = 130 , TAG_PREP = 131 ,
  TAG_PERR = 132 , TAG_PXU = 137 , TAG_PXUC = 138 , TAG_AUTHENTICATED_MESH_PEERING_EXCHANGE = 139 ,
  TAG_MIC = 140 , TAG_DESTINATION_URI = 141 , TAG_U_APSD_COEXISTENCE = 142 , TAG_DMG_WAKEUP_SCHEDULE = 143 ,
  TAG_EXTENDED_SCHEDULE = 144 , TAG_STA_AVAILABILITY = 145 , TAG_DMG_TSPEC = 146 , TAG_NEXT_DMG_ATI = 147 ,
  TAG_DMG_OPERATION = 151 , TAG_DMG_BSS_PARAMETER_CHANGE = 152 , TAG_DMG_BEAM_REFINEMENT = 153 , TAG_CHANNEL_MEASUREMENT_FEEDBACK = 154 ,
  TAG_AWAKE_WINDOW = 157 , TAG_MULTI_BAND = 158 , TAG_ADDBA_EXTENSION = 159 , TAG_NEXTPCP_LIST = 160 ,
  TAG_PCP_HANDOVER = 161 , TAG_DMG_LINK_MARGIN = 162 , TAG_SWITCHING_STREAM = 163 , TAG_SESSION_TRANSITION = 164 ,
  TAG_DYNAMIC_TONE_PAIRING_REPORT = 165 , TAG_CLUSTER_REPORT = 166 , TAG_RELAY_CAPABILITIES = 167 , TAG_RELAY_TRANSFER_PARAMETER_SET = 168 ,
  TAG_BEAMLINK_MAINTENANCE = 169 , TAG_MULTIPLE_MAC_SUBLAYERS = 170 , TAG_U_PID = 171 , TAG_DMG_LINK_ADAPTATION_ACKNOWLEDGEMENT = 172 ,
  TAG_MCCAOP_ADVERTISEMENT_OVERVIEW = 174 , TAG_QUIET_PERIOD_REQUEST = 175 , TAG_QUIET_PERIOD_RESPONSE = 177 , TAG_QMF_POLICY = 181 ,
  TAG_ECAPC_POLICY = 182 , TAG_CLUSTER_TIME_OFFSET = 183 , TAG_INTRA_ACCESS_CATEGORY_PRIORITY = 184 , TAG_SCS_DESCRIPTOR = 185 ,
  TAG_QLOAD_REPORT = 186 , TAG_HCCA_TXOP_UPDATE_COUNT = 187 , TAG_HIGHER_LAYER_STREAM_ID = 188 , TAG_GCR_GROUP_ADDRESS = 189 ,
  TAG_ANTENNA_SECTOR_ID_PATTERN = 190 , TAG_VHT_CAPABILITIES = 191 , TAG_VHT_OPERATION = 192 , TAG_EXTENDED_BSS_LOAD = 193 ,
  TAG_WIDE_BANDWIDTH_CHANNEL_SWITCH = 194 , TAG_TRANSMIT_POWER_ENVELOPE = 195 , TAG_CHANNEL_SWITCH_WRAPPER = 196 , TAG_AID = 197 ,
  TAG_QUIET_CHANNEL = 198 , TAG_UPSIM = 200 , TAG_REDUCED_NEIGHBOR_REPORT = 201 , TAG_TVHT_OPERATION = 202 ,
  TAG_DEVICE_LOCATION = 204 , TAG_WHITE_SPACE_MAP = 205 , TAG_FINE_TIMING_MEASUREMENT_PARAMETERS = 206 , TAG_VENDOR_SPECIFIC = 221 ,
  TAG_ELEMENT_EXTENSION = 255
}
 

Functions

struct libwifi_tag_header __attribute__ ((packed))
 
int libwifi_add_tag (struct libwifi_tagged_parameters *tagged_parameters, struct libwifi_tagged_parameter *tagged_parameter)
 Add a tagged parameter to a list of frame tagged parameters. More...
 
int libwifi_remove_tag (struct libwifi_tagged_parameters *tagged_parameters, int tag_number)
 Remove a tagged parameter from a list of frame tagged parameters. More...
 
size_t libwifi_create_tag (struct libwifi_tagged_parameter *tagged_parameter, int tag_number, const unsigned char *tag_data, size_t tag_length)
 Create a tagged parameter from a tag number, length and data. More...
 
void libwifi_free_tag (struct libwifi_tagged_parameter *tagged_parameter)
 Free a tagged parameters body. More...
 
size_t libwifi_dump_tag (struct libwifi_tagged_parameter *tag, unsigned char *buf, size_t buf_len)
 Dump a tagged parameter into a raw buffer, for use with other buffers or injection. More...
 
int libwifi_quick_add_tag (struct libwifi_tagged_parameters *tagged_parameters, int tag_number, const unsigned char *tag_data, size_t tag_length)
 Add a tagged parameter via tag number and data to a management frame. More...
 
int libwifi_check_tag (struct libwifi_tagged_parameters *tags, int tag_number)
 Check if a tagged parameter is present via tag number. More...
 
char * libwifi_get_tag_name (int tag_number)
 Get the name of a tagged parameter via a supplied tag number. More...
 

Variables

uint8_t tag_num
 
uint8_t tag_len
 
struct libwifi_tag_header header
 
unsigned char * body
 
size_t length
 
unsigned char * parameters
 
unsigned char oui [3]
 
int8_t type
 

Enumeration Type Documentation

◆ libwifi_tag_numbers

Enumerator
TAG_SSID 
TAG_SUPP_RATES 
TAG_DS_PARAMETER 
TAG_CF_PARAMETER 
TAG_TIM 
TAG_BSS_PARAMETERS 
TAG_COUNTRY 
TAG_REQUEST 
TAG_BSS_LOAD 
TAG_EDCA_PARAMETERS 
TAG_TSPEC 
TAG_TCLAS 
TAG_SCHEDULE 
TAG_CHALLENGE_TEXT 
TAG_POWER_CONSTRAINT 
TAG_POWER_CAPABILITY 
TAG_TPC_REQUEST 
TAG_TPC_REPORT 
TAG_SUPPORTED_CHANNELS 
TAG_CHANNEL_SWITCH_ANNOUNCEMENT 
TAG_MEASUREMENT_REQUEST 
TAG_MEASUREMENT_REPORT 
TAG_QUIET 
TAG_IBSS_DFS 
TAG_ERP 
TAG_TS_DELAY 
TAG_TCLAS_PROCESSING 
TAG_HT_CAPABILITIES 
TAG_QOS_CAPABILITY 
TAG_RSN 
TAG_EXTENDED_SUPPORTED_RATES 
TAG_AP_CHANNEL_REPORT 
TAG_NEIGHBOR_REPORT 
TAG_RCPI 
TAG_MOBILITY_DOMAIN 
TAG_FAST_BSS_TRANSITION 
TAG_TIMEOUT_INTERVAL 
TAG_RIC_DATA 
TAG_DSE_REGISTERED_LOCATION 
TAG_SUPPORTED_OPERATING_CLASSES 
TAG_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT 
TAG_HT_OPERATION 
TAG_SECONDARY_CHANNEL_OFFSET 
TAG_BSS_AVERAGE_ACCESS_DELAY 
TAG_ANTENNA 
TAG_RSNI 
TAG_MEASUREMENT_PILOT_TRANSMISSION 
TAG_BSS_AVAILABLE_ADMISSION_CAPACITY 
TAG_BSS_AC_ACCESS_DELAY 
TAG_TIME_ADVERTISEMENT 
TAG_RM_ENABLED_CAPABILITIES 
TAG_MULTIPLE_BSSID 
TAG_BSS_COEXISTENCE 
TAG_BSS_INTOLERANT_CHANNEL_REPORT 
TAG_OVERLAPPING_BSS_PARAMETERS 
TAG_RIC_DESCRIPTOR 
TAG_MANAGEMENT_MIC 
TAG_EVENT_REQUEST 
TAG_EVENT_REPORT 
TAG_DIAGNOSTIC_REQUEST 
TAG_DIAGNOSTIC_REPORT 
TAG_LOCATION_PARAMTERS 
TAG_NONTRANSMITTED_BSSID_CAPABILITY 
TAG_SSID_LIST 
TAG_MULTIPLE_BSSID_INDEX 
TAG_FMS_DESCRIPTOR 
TAG_FMS_REQUEST 
TAG_FMS_RESPONSE 
TAG_QOS_TRAFFIC_CAPABILITY 
TAG_BSS_MAX_IDLE_PERIOD 
TAG_TFS_REQUEST 
TAG_TFS_RESPONSE 
TAG_WNM_SLEEP_MODE 
TAG_TIM_BROADCAST_REQUEST 
TAG_TIM_BROADCAST_RESPONSE 
TAG_COLLOCATED_INTERFERENCE_REPORT 
TAG_CHANNEL_USAGE 
TAG_TIME_ZONE 
TAG_DMS_REQUEST 
TAG_DMS_RESPONSE 
TAG_LINK_IDENTIFIER 
TAG_WAKEUP_SCHEDULE 
TAG_CHANNEL_SWITCH_TIMING 
TAG_PTI_CONTROL 
TAG_TPU_BUFFER_STATUS 
TAG_INTERWORKING 
TAG_ADVERTISEMENT_PROTOCOL 
TAG_EXPEDITED_BANDWIDTH_REQUEST 
TAG_QOS_MAP 
TAG_ROAMING_CONSORTIUM 
TAG_EMERGENCY_ALERT_IDENTIFIER 
TAG_MESH_CONFIGURATION 
TAG_MESH_ID 
TAG_MESH_LINK_METRIC_REPORT 
TAG_CONGESTION_NOTIFICATION 
TAG_MESH_PEERING_MANAGEMENT 
TAG_MESH_CHANNEL_SWITCH_PARAMETERS 
TAG_MESH_AWAKE_WINDOW 
TAG_BEACON_TIMING 
TAG_MCCAOP_SETUP_REQUEST 
TAG_MCCAOP_SETUP_REPLY 
TAG_MCCAOP_ADVERTISEMENT 
TAG_MCCAOP_TEARDOWN 
TAG_GANN 
TAG_RANN 
TAG_EXTENDED_CAPABILITIES 
TAG_PREQ 
TAG_PREP 
TAG_PERR 
TAG_PXU 
TAG_PXUC 
TAG_AUTHENTICATED_MESH_PEERING_EXCHANGE 
TAG_MIC 
TAG_DESTINATION_URI 
TAG_U_APSD_COEXISTENCE 
TAG_DMG_WAKEUP_SCHEDULE 
TAG_EXTENDED_SCHEDULE 
TAG_STA_AVAILABILITY 
TAG_DMG_TSPEC 
TAG_NEXT_DMG_ATI 
TAG_DMG_OPERATION 
TAG_DMG_BSS_PARAMETER_CHANGE 
TAG_DMG_BEAM_REFINEMENT 
TAG_CHANNEL_MEASUREMENT_FEEDBACK 
TAG_AWAKE_WINDOW 
TAG_MULTI_BAND 
TAG_ADDBA_EXTENSION 
TAG_NEXTPCP_LIST 
TAG_PCP_HANDOVER 
TAG_DMG_LINK_MARGIN 
TAG_SWITCHING_STREAM 
TAG_SESSION_TRANSITION 
TAG_DYNAMIC_TONE_PAIRING_REPORT 
TAG_CLUSTER_REPORT 
TAG_RELAY_CAPABILITIES 
TAG_RELAY_TRANSFER_PARAMETER_SET 
TAG_BEAMLINK_MAINTENANCE 
TAG_MULTIPLE_MAC_SUBLAYERS 
TAG_U_PID 
TAG_DMG_LINK_ADAPTATION_ACKNOWLEDGEMENT 
TAG_MCCAOP_ADVERTISEMENT_OVERVIEW 
TAG_QUIET_PERIOD_REQUEST 
TAG_QUIET_PERIOD_RESPONSE 
TAG_QMF_POLICY 
TAG_ECAPC_POLICY 
TAG_CLUSTER_TIME_OFFSET 
TAG_INTRA_ACCESS_CATEGORY_PRIORITY 
TAG_SCS_DESCRIPTOR 
TAG_QLOAD_REPORT 
TAG_HCCA_TXOP_UPDATE_COUNT 
TAG_HIGHER_LAYER_STREAM_ID 
TAG_GCR_GROUP_ADDRESS 
TAG_ANTENNA_SECTOR_ID_PATTERN 
TAG_VHT_CAPABILITIES 
TAG_VHT_OPERATION 
TAG_EXTENDED_BSS_LOAD 
TAG_WIDE_BANDWIDTH_CHANNEL_SWITCH 
TAG_TRANSMIT_POWER_ENVELOPE 
TAG_CHANNEL_SWITCH_WRAPPER 
TAG_AID 
TAG_QUIET_CHANNEL 
TAG_UPSIM 
TAG_REDUCED_NEIGHBOR_REPORT 
TAG_TVHT_OPERATION 
TAG_DEVICE_LOCATION 
TAG_WHITE_SPACE_MAP 
TAG_FINE_TIMING_MEASUREMENT_PARAMETERS 
TAG_VENDOR_SPECIFIC 
TAG_ELEMENT_EXTENSION 

Definition at line 23 of file tag.h.

Function Documentation

◆ __attribute__()

struct libwifi_tag_header __attribute__ ( (packed)  )

◆ libwifi_add_tag()

int libwifi_add_tag ( struct libwifi_tagged_parameters tagged_parameters,
struct libwifi_tagged_parameter tagged_parameter 
)

Add a tagged parameter to a list of frame tagged parameters.

Parameters
tagged_parametersA management frame's tagged parameters
tagged_parameterThe new tagged parameter

Definition at line 25 of file tag.c.

◆ libwifi_check_tag()

int libwifi_check_tag ( struct libwifi_tagged_parameters tags,
int  tag_number 
)

Check if a tagged parameter is present via tag number.

Parameters
tagsA tagged parameters list
tag_numberThe number of the tagged parameter to find
Returns
The number of times the supplied tag_number was found in tags

Definition at line 133 of file tag.c.

◆ libwifi_create_tag()

size_t libwifi_create_tag ( struct libwifi_tagged_parameter tagged_parameter,
int  tag_number,
const unsigned char *  tag_data,
size_t  tag_length 
)

Create a tagged parameter from a tag number, length and data.

This can be useful when generating tags on their own, for use with action frame body's.

Parameters
tagged_parameterA new tagged parameter struct
tag_numberTagged parameter number
tag_dataThe tag body
tag_lengthLength of the tag body
Returns
length of the created tag

Definition at line 81 of file tag.c.

◆ libwifi_dump_tag()

size_t libwifi_dump_tag ( struct libwifi_tagged_parameter tag,
unsigned char *  buf,
size_t  buf_len 
)

Dump a tagged parameter into a raw buffer, for use with other buffers or injection.

Parameters
tagA used tagged parameter struct
bufA buffer for the raw data
buf_lenLength of buf

Definition at line 103 of file tag.c.

◆ libwifi_free_tag()

void libwifi_free_tag ( struct libwifi_tagged_parameter tagged_parameter)

Free a tagged parameters body.

Parameters
tagged_parameterA used tagged parameter

Definition at line 99 of file tag.c.

◆ libwifi_get_tag_name()

char * libwifi_get_tag_name ( int  tag_number)

Get the name of a tagged parameter via a supplied tag number.

Parameters
tag_numberThe number of the tagged parameter to name
Returns
The name of the tag

Definition at line 149 of file tag.c.

◆ libwifi_quick_add_tag()

int libwifi_quick_add_tag ( struct libwifi_tagged_parameters tagged_parameters,
int  tag_number,
const unsigned char *  tag_data,
size_t  tag_length 
)

Add a tagged parameter via tag number and data to a management frame.

Parameters
tagged_parametersA management frame's tagged parameters
tag_numberTagged parameter to add
tag_dataData to copy into new tag
tag_lengthLength of the new tag
Returns
0 on success, negative number on error

Definition at line 118 of file tag.c.

◆ libwifi_remove_tag()

int libwifi_remove_tag ( struct libwifi_tagged_parameters tagged_parameters,
int  tag_number 
)

Remove a tagged parameter from a list of frame tagged parameters.

Parameters
tagged_parametersA management frame's tagged parameters
tag_numberNumber of the tag to remove

Definition at line 55 of file tag.c.

Variable Documentation

◆ body

unsigned char* body

Definition at line 1 of file tag.h.

◆ header

struct libwifi_tag_header header

Definition at line 0 of file tag.h.

◆ length

size_t length

Definition at line 0 of file tag.h.

◆ oui

unsigned char oui[3]

Definition at line 0 of file tag.h.

◆ parameters

unsigned char* parameters

Definition at line 1 of file tag.h.

◆ tag_len

uint8_t tag_len

Definition at line 1 of file tag.h.

◆ tag_num

uint8_t tag_num

Definition at line 0 of file tag.h.

◆ type

int8_t type

Definition at line 1 of file tag.h.