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

hostapd / Initialization and configuration More...

#include "utils/includes.h"
#include "utils/common.h"
#include "utils/eloop.h"
#include "common/ieee802_11_defs.h"
#include "common/wpa_ctrl.h"
#include "radius/radius_client.h"
#include "radius/radius_das.h"
#include "eap_server/tncs.h"
#include "eapol_auth/eapol_auth_sm.h"
#include "eapol_auth/eapol_auth_sm_i.h"
#include "fst/fst.h"
#include "hostapd.h"
#include "authsrv.h"
#include "sta_info.h"
#include "accounting.h"
#include "ap_list.h"
#include "beacon.h"
#include "iapp.h"
#include "ieee802_1x.h"
#include "ieee802_11_auth.h"
#include "vlan_init.h"
#include "wpa_auth.h"
#include "wps_hostapd.h"
#include "hw_features.h"
#include "wpa_auth_glue.h"
#include "ap_drv_ops.h"
#include "ap_config.h"
#include "p2p_hostapd.h"
#include "gas_serv.h"
#include "dfs.h"
#include "ieee802_11.h"
#include "bss_load.h"
#include "x_snoop.h"
#include "dhcp_snoop.h"
#include "ndisc_snoop.h"

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)
 
void hostapd_channel_list_updated (struct hostapd_iface *iface, int initiator)
 
int hostapd_setup_interface_complete (struct hostapd_iface *iface, int err)
 Complete interface setup. More...
 
int hostapd_setup_interface (struct hostapd_iface *iface)
 Setup of an interface. More...
 
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...
 
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_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 *interfaces, char *buf)
 
int hostapd_remove_iface (struct hapd_interfaces *interfaces, char *buf)
 
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...
 
const char * hostapd_state_text (enum hostapd_iface_state s)
 
void hostapd_set_state (struct hostapd_iface *iface, enum hostapd_iface_state s)
 
void hostapd_periodic_iface (struct hostapd_iface *iface)
 

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.

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.