wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Macros | Enumerations | Functions
hostapd.h File Reference

hostapd / Initialization and configuration More...

#include "common/defs.h"
#include "utils/list.h"
#include "ap_config.h"
#include "drivers/driver.h"

Go to the source code of this file.

Data Structures

struct  hapd_interfaces
 
struct  hostapd_probereq_cb
 
struct  hostapd_rate_data
 
struct  hostapd_frame_info
 
struct  wps_stat
 
struct  hostapd_data
 hostapd per-BSS data structure More...
 
struct  hostapd_sta_info
 
struct  hostapd_iface
 hostapd per-interface data structure More...
 

Macros

#define HOSTAPD_RATE_BASIC   0x00000001
 
#define STA_HASH_SIZE   256
 
#define STA_HASH(sta)   (sta[5])
 
#define AID_WORDS   ((2008 + 31) / 32)
 

Enumerations

enum  hostapd_chan_status { HOSTAPD_CHAN_VALID = 0, HOSTAPD_CHAN_INVALID = 1, HOSTAPD_CHAN_ACS = 2 }
 
enum  wps_status { WPS_STATUS_SUCCESS = 1, WPS_STATUS_FAILURE }
 
enum  pbc_status { WPS_PBC_STATUS_DISABLE, WPS_PBC_STATUS_ACTIVE, WPS_PBC_STATUS_TIMEOUT, WPS_PBC_STATUS_OVERLAP }
 

Functions

int hostapd_for_each_interface (struct hapd_interfaces *interfaces, int(*cb)(struct hostapd_iface *iface, void *ctx), void *ctx)
 
int hostapd_reload_config (struct hostapd_iface *iface)
 
struct hostapd_datahostapd_alloc_bss_data (struct hostapd_iface *hapd_iface, struct hostapd_config *conf, struct hostapd_bss_config *bss)
 Allocate and initialize per-BSS data. More...
 
int hostapd_setup_interface (struct hostapd_iface *iface)
 Setup of an interface. More...
 
int hostapd_setup_interface_complete (struct hostapd_iface *iface, int err)
 Complete interface setup. More...
 
void hostapd_interface_deinit (struct hostapd_iface *iface)
 
void hostapd_interface_free (struct hostapd_iface *iface)
 
struct hostapd_ifacehostapd_init (struct hapd_interfaces *interfaces, const char *config_file)
 Allocate and initialize per-interface data. More...
 
struct hostapd_ifacehostapd_interface_init_bss (struct hapd_interfaces *interfaces, const char *phy, const char *config_fname, int debug)
 Read configuration file and init BSS data. More...
 
void hostapd_new_assoc_sta (struct hostapd_data *hapd, struct sta_info *sta, int reassoc)
 Notify that a new station associated with the AP. More...
 
void hostapd_interface_deinit_free (struct hostapd_iface *iface)
 
int hostapd_enable_iface (struct hostapd_iface *hapd_iface)
 
int hostapd_reload_iface (struct hostapd_iface *hapd_iface)
 
int hostapd_disable_iface (struct hostapd_iface *hapd_iface)
 
int hostapd_add_iface (struct hapd_interfaces *ifaces, char *buf)
 
int hostapd_remove_iface (struct hapd_interfaces *ifaces, char *buf)
 
void hostapd_channel_list_updated (struct hostapd_iface *iface, int initiator)
 
void hostapd_set_state (struct hostapd_iface *iface, enum hostapd_iface_state s)
 
const char * hostapd_state_text (enum hostapd_iface_state s)
 
int hostapd_switch_channel (struct hostapd_data *hapd, struct csa_settings *settings)
 
void hostapd_switch_channel_fallback (struct hostapd_iface *iface, const struct hostapd_freq_params *freq_params)
 
void hostapd_cleanup_cs_params (struct hostapd_data *hapd)
 
void hostapd_periodic_iface (struct hostapd_iface *iface)
 
int hostapd_register_probereq_cb (struct hostapd_data *hapd, int(*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid, const u8 *ie, size_t ie_len, int ssi_signal), void *ctx)
 
void hostapd_prune_associations (struct hostapd_data *hapd, const u8 *addr)
 Remove extraneous associations. More...
 
int hostapd_notif_assoc (struct hostapd_data *hapd, const u8 *addr, const u8 *ie, size_t ielen, int reassoc)
 
void hostapd_notif_disassoc (struct hostapd_data *hapd, const u8 *addr)
 
void hostapd_event_sta_low_ack (struct hostapd_data *hapd, const u8 *addr)
 
void hostapd_event_connect_failed_reason (struct hostapd_data *hapd, const u8 *addr, int reason_code)
 
int hostapd_probe_req_rx (struct hostapd_data *hapd, const u8 *sa, const u8 *da, const u8 *bssid, const u8 *ie, size_t ie_len, int ssi_signal)
 
void hostapd_event_ch_switch (struct hostapd_data *hapd, int freq, int ht, int offset, int width, int cf1, int cf2)
 
const struct hostapd_eap_userhostapd_get_eap_user (struct hostapd_data *hapd, const u8 *identity, size_t identity_len, int phase2)
 
struct hostapd_datahostapd_get_iface (struct hapd_interfaces *interfaces, const char *ifname)
 

Detailed Description

hostapd / Initialization and configuration

Function Documentation

struct hostapd_data* hostapd_alloc_bss_data ( struct hostapd_iface hapd_iface,
struct hostapd_config conf,
struct hostapd_bss_config bss 
)

Allocate and initialize per-BSS data.

Parameters
hapd_ifacePointer to interface data
confPointer to per-interface configuration
bssPointer to per-BSS configuration for this BSS
Returns
Pointer to allocated BSS data

This function is used to allocate per-BSS data structure. This data will be freed after hostapd_cleanup() is called for it during interface deinitialization.

struct hostapd_iface* hostapd_init ( struct hapd_interfaces interfaces,
const char *  config_file 
)

Allocate and initialize per-interface data.

Parameters
config_filePath to the configuration file
Returns
Pointer to the allocated interface data or NULL on failure

This function is used to allocate main data structures for per-interface data. The allocated data buffer will be freed by calling hostapd_cleanup_iface().

struct hostapd_iface* hostapd_interface_init_bss ( struct hapd_interfaces interfaces,
const char *  phy,
const char *  config_fname,
int  debug 
)

Read configuration file and init BSS data.

This function is used to parse configuration file for a BSS. This BSS is added to an existing interface sharing the same radio (if any) or a new interface is created if this is the first interface on a radio. This allocate memory for the BSS. No actual driver operations are started.

This is similar to hostapd_interface_init(), but for a case where the configuration is used to add a single BSS instead of all BSSes for a radio.

void hostapd_new_assoc_sta ( struct hostapd_data hapd,
struct sta_info sta,
int  reassoc 
)

Notify that a new station associated with the AP.

Parameters
hapdPointer to BSS data
staPointer to the associated STA data
reassoc1 to indicate this was a re-association; 0 = first association

This function will be called whenever a station associates with the AP. It can be called from ieee802_11.c for drivers that export MLME to hostapd and from drv_callbacks.c based on driver events for drivers that take care of management frames (IEEE 802.11 authentication and association) internally.

void hostapd_prune_associations ( struct hostapd_data hapd,
const u8 *  addr 
)

Remove extraneous associations.

Parameters
hapdPointer to BSS data for the most recent association
addrAssociated STA address

This function looks through all radios and BSS's for previous (stale) associations of STA. If any are found they are removed.

int hostapd_setup_interface ( struct hostapd_iface iface)

Setup of an interface.

Parameters
ifacePointer to interface data.
Returns
0 on success, -1 on failure

Initializes the driver interface, validates the configuration, and sets driver parameters based on the configuration. Flushes old stations, sets the channel, encryption, beacons, and WDS links based on the configuration.

If interface setup requires more time, e.g., to perform HT co-ex scans, ACS, or DFS operations, this function returns 0 before such operations have been completed. The pending operations are registered into eloop and will be completed from eloop callbacks. Those callbacks end up calling hostapd_setup_interface_complete() once setup has been completed.

int hostapd_setup_interface_complete ( struct hostapd_iface iface,
int  err 
)

Complete interface setup.

This function is called when previous steps in the interface setup has been completed. This can also start operations, e.g., DFS, that will require additional processing before interface is ready to be enabled. Such operations will call this function from eloop callbacks when finished.