2 * hostapd - Driver operations
3 * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
18 enum wpa_driver_if_type;
19 struct wpa_bss_params;
20 struct wpa_driver_scan_params;
22 void hostapd_set_driver_ops(struct hostapd_driver_ops *ops);
23 int hostapd_set_privacy(struct hostapd_data *hapd, int enabled);
24 int hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
26 int hostapd_get_ssid(struct hostapd_data *hapd, u8 *buf, size_t len);
27 int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len);
28 int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
29 const char *ifname, const u8 *addr, void *bss_ctx,
30 void **drv_priv, char *force_ifname, u8 *if_addr);
31 int hostapd_if_remove(struct hostapd_data *hapd, enum wpa_driver_if_type type,
33 int hostapd_set_ieee8021x(struct hostapd_data *hapd,
34 struct wpa_bss_params *params);
35 int hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd,
36 const u8 *addr, int idx, u8 *seq);
37 int hostapd_flush(struct hostapd_data *hapd);
38 int hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq,
39 int channel, int ht_enabled, int sec_channel_offset);
40 int hostapd_set_rts(struct hostapd_data *hapd, int rts);
41 int hostapd_set_frag(struct hostapd_data *hapd, int frag);
42 int hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
43 int total_flags, int flags_or, int flags_and);
44 int hostapd_set_rate_sets(struct hostapd_data *hapd, int *supp_rates,
45 int *basic_rates, int mode);
46 int hostapd_set_country(struct hostapd_data *hapd, const char *country);
47 int hostapd_set_cts_protect(struct hostapd_data *hapd, int value);
48 int hostapd_set_preamble(struct hostapd_data *hapd, int value);
49 int hostapd_set_short_slot_time(struct hostapd_data *hapd, int value);
50 int hostapd_set_tx_queue_params(struct hostapd_data *hapd, int queue, int aifs,
51 int cw_min, int cw_max, int burst_time);
52 int hostapd_valid_bss_mask(struct hostapd_data *hapd, const u8 *addr,
54 struct hostapd_hw_modes *
55 hostapd_get_hw_feature_data(struct hostapd_data *hapd, u16 *num_modes,
57 int hostapd_driver_commit(struct hostapd_data *hapd);
58 int hostapd_set_ht_params(struct hostapd_data *hapd,
59 const u8 *ht_capab, size_t ht_capab_len,
60 const u8 *ht_oper, size_t ht_oper_len);
61 int hostapd_drv_none(struct hostapd_data *hapd);
62 int hostapd_driver_scan(struct hostapd_data *hapd,
63 struct wpa_driver_scan_params *params);
64 struct wpa_scan_results * hostapd_driver_get_scan_results(
65 struct hostapd_data *hapd);
66 int hostapd_driver_set_noa(struct hostapd_data *hapd, u8 count, int start,
70 #include "drivers/driver.h"
72 static inline int hostapd_drv_send_mlme(struct hostapd_data *hapd,
73 const void *msg, size_t len)
75 if (hapd->driver == NULL || hapd->driver->send_mlme == NULL)
77 return hapd->driver->send_mlme(hapd->drv_priv, msg, len);
80 static inline int hostapd_drv_set_countermeasures(struct hostapd_data *hapd,
83 if (hapd->driver == NULL ||
84 hapd->driver->hapd_set_countermeasures == NULL)
86 return hapd->driver->hapd_set_countermeasures(hapd->drv_priv, enabled);
89 static inline int hostapd_drv_set_sta_vlan(const char *ifname,
90 struct hostapd_data *hapd,
91 const u8 *addr, int vlan_id)
93 if (hapd->driver == NULL || hapd->driver->set_sta_vlan == NULL)
95 return hapd->driver->set_sta_vlan(hapd->drv_priv, addr, ifname,
99 static inline int hostapd_drv_get_inact_sec(struct hostapd_data *hapd,
102 if (hapd->driver == NULL || hapd->driver->get_inact_sec == NULL)
104 return hapd->driver->get_inact_sec(hapd->drv_priv, addr);
107 static inline int hostapd_drv_sta_deauth(struct hostapd_data *hapd,
108 const u8 *addr, int reason)
110 if (hapd->driver == NULL || hapd->driver->sta_deauth == NULL)
112 return hapd->driver->sta_deauth(hapd->drv_priv, hapd->own_addr, addr,
116 static inline int hostapd_drv_sta_disassoc(struct hostapd_data *hapd,
117 const u8 *addr, int reason)
119 if (hapd->driver == NULL || hapd->driver->sta_disassoc == NULL)
121 return hapd->driver->sta_disassoc(hapd->drv_priv, hapd->own_addr, addr,
125 static inline int hostapd_drv_sta_remove(struct hostapd_data *hapd,
128 if (hapd->driver == NULL || hapd->driver->sta_remove == NULL)
130 return hapd->driver->sta_remove(hapd->drv_priv, addr);
133 static inline int hostapd_drv_hapd_send_eapol(struct hostapd_data *hapd,
134 const u8 *addr, const u8 *data,
135 size_t data_len, int encrypt)
137 if (hapd->driver == NULL || hapd->driver->hapd_send_eapol == NULL)
139 return hapd->driver->hapd_send_eapol(hapd->drv_priv, addr, data,
144 static inline int hostapd_drv_set_key(const char *ifname,
145 struct hostapd_data *hapd,
146 enum wpa_alg alg, const u8 *addr,
147 int key_idx, int set_tx,
148 const u8 *seq, size_t seq_len,
149 const u8 *key, size_t key_len)
151 if (hapd->driver == NULL || hapd->driver->set_key == NULL)
153 return hapd->driver->set_key(ifname, hapd->drv_priv, alg, addr,
154 key_idx, set_tx, seq, seq_len, key,
158 static inline int hostapd_drv_read_sta_data(
159 struct hostapd_data *hapd, struct hostap_sta_driver_data *data,
162 if (hapd->driver == NULL || hapd->driver->read_sta_data == NULL)
164 return hapd->driver->read_sta_data(hapd->drv_priv, data, addr);
167 static inline int hostapd_drv_sta_clear_stats(struct hostapd_data *hapd,
170 if (hapd->driver == NULL || hapd->driver->sta_clear_stats == NULL)
172 return hapd->driver->sta_clear_stats(hapd->drv_priv, addr);
175 static inline int hostapd_drv_set_beacon(struct hostapd_data *hapd,
176 const u8 *head, size_t head_len,
177 const u8 *tail, size_t tail_len,
178 int dtim_period, int beacon_int)
180 if (hapd->driver == NULL || hapd->driver->set_beacon == NULL)
182 return hapd->driver->set_beacon(hapd->drv_priv,
183 head, head_len, tail, tail_len,
184 dtim_period, beacon_int);
187 static inline int hostapd_drv_set_radius_acl_auth(struct hostapd_data *hapd,
188 const u8 *mac, int accepted,
191 if (hapd->driver == NULL || hapd->driver->set_radius_acl_auth == NULL)
193 return hapd->driver->set_radius_acl_auth(hapd->drv_priv, mac, accepted,
197 static inline int hostapd_drv_set_radius_acl_expire(struct hostapd_data *hapd,
200 if (hapd->driver == NULL ||
201 hapd->driver->set_radius_acl_expire == NULL)
203 return hapd->driver->set_radius_acl_expire(hapd->drv_priv, mac);
206 #endif /* AP_DRV_OPS */