1e28a4053SRui Paulo /*
2e28a4053SRui Paulo * hostapd - Driver operations
35b9c547cSRui Paulo * Copyright (c) 2009-2014, Jouni Malinen <j@w1.fi>
4e28a4053SRui Paulo *
5f05cddf9SRui Paulo * This software may be distributed under the terms of the BSD license.
6f05cddf9SRui Paulo * See README for more details.
7e28a4053SRui Paulo */
8e28a4053SRui Paulo
9e28a4053SRui Paulo #ifndef AP_DRV_OPS
10e28a4053SRui Paulo #define AP_DRV_OPS
11e28a4053SRui Paulo
12e28a4053SRui Paulo enum wpa_driver_if_type;
13e28a4053SRui Paulo struct wpa_bss_params;
14e28a4053SRui Paulo struct wpa_driver_scan_params;
15f05cddf9SRui Paulo struct ieee80211_ht_capabilities;
165b9c547cSRui Paulo struct ieee80211_vht_capabilities;
175b9c547cSRui Paulo struct hostapd_freq_params;
18e28a4053SRui Paulo
19f05cddf9SRui Paulo u32 hostapd_sta_flags_to_drv(u32 flags);
20f05cddf9SRui Paulo int hostapd_build_ap_extra_ies(struct hostapd_data *hapd,
21f05cddf9SRui Paulo struct wpabuf **beacon,
22f05cddf9SRui Paulo struct wpabuf **proberesp,
23f05cddf9SRui Paulo struct wpabuf **assocresp);
24f05cddf9SRui Paulo void hostapd_free_ap_extra_ies(struct hostapd_data *hapd, struct wpabuf *beacon,
25f05cddf9SRui Paulo struct wpabuf *proberesp,
26f05cddf9SRui Paulo struct wpabuf *assocresp);
27325151a3SRui Paulo int hostapd_reset_ap_wps_ie(struct hostapd_data *hapd);
28f05cddf9SRui Paulo int hostapd_set_ap_wps_ie(struct hostapd_data *hapd);
29*a90b9d01SCy Schubert bool hostapd_sta_is_link_sta(struct hostapd_data *hapd,
30*a90b9d01SCy Schubert struct sta_info *sta);
31f05cddf9SRui Paulo int hostapd_set_authorized(struct hostapd_data *hapd,
32f05cddf9SRui Paulo struct sta_info *sta, int authorized);
33f05cddf9SRui Paulo int hostapd_set_sta_flags(struct hostapd_data *hapd, struct sta_info *sta);
34f05cddf9SRui Paulo int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
35f05cddf9SRui Paulo int enabled);
36f05cddf9SRui Paulo int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname);
37f05cddf9SRui Paulo int hostapd_vlan_if_remove(struct hostapd_data *hapd, const char *ifname);
385b9c547cSRui Paulo int hostapd_set_wds_sta(struct hostapd_data *hapd, char *ifname_wds,
395b9c547cSRui Paulo const u8 *addr, int aid, int val);
40f05cddf9SRui Paulo int hostapd_sta_add(struct hostapd_data *hapd,
41f05cddf9SRui Paulo const u8 *addr, u16 aid, u16 capability,
42f05cddf9SRui Paulo const u8 *supp_rates, size_t supp_rates_len,
43f05cddf9SRui Paulo u16 listen_interval,
44f05cddf9SRui Paulo const struct ieee80211_ht_capabilities *ht_capab,
455b9c547cSRui Paulo const struct ieee80211_vht_capabilities *vht_capab,
46206b73d0SCy Schubert const struct ieee80211_he_capabilities *he_capab,
47206b73d0SCy Schubert size_t he_capab_len,
48*a90b9d01SCy Schubert const struct ieee80211_eht_capabilities *eht_capab,
49*a90b9d01SCy Schubert size_t eht_capab_len,
50c1d255d3SCy Schubert const struct ieee80211_he_6ghz_band_cap *he_6ghz_capab,
51780fb4a2SCy Schubert u32 flags, u8 qosinfo, u8 vht_opmode, int supp_p2p_ps,
52*a90b9d01SCy Schubert int set, const u8 *link_addr, bool mld_link_sta);
53e28a4053SRui Paulo int hostapd_set_privacy(struct hostapd_data *hapd, int enabled);
54e28a4053SRui Paulo int hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
55e28a4053SRui Paulo size_t elem_len);
56e28a4053SRui Paulo int hostapd_get_ssid(struct hostapd_data *hapd, u8 *buf, size_t len);
57e28a4053SRui Paulo int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len);
58e28a4053SRui Paulo int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
59e28a4053SRui Paulo const char *ifname, const u8 *addr, void *bss_ctx,
60f05cddf9SRui Paulo void **drv_priv, char *force_ifname, u8 *if_addr,
615b9c547cSRui Paulo const char *bridge, int use_existing);
62e28a4053SRui Paulo int hostapd_if_remove(struct hostapd_data *hapd, enum wpa_driver_if_type type,
63e28a4053SRui Paulo const char *ifname);
64*a90b9d01SCy Schubert int hostapd_if_link_remove(struct hostapd_data *hapd,
65*a90b9d01SCy Schubert enum wpa_driver_if_type type,
66*a90b9d01SCy Schubert const char *ifname, u8 link_id);
67e28a4053SRui Paulo int hostapd_set_ieee8021x(struct hostapd_data *hapd,
68e28a4053SRui Paulo struct wpa_bss_params *params);
69e28a4053SRui Paulo int hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd,
70*a90b9d01SCy Schubert const u8 *addr, int idx, int link_id, u8 *seq);
71e28a4053SRui Paulo int hostapd_flush(struct hostapd_data *hapd);
725b9c547cSRui Paulo int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode,
73c1d255d3SCy Schubert int freq, int channel, int edmg, u8 edmg_channel,
74*a90b9d01SCy Schubert int ht_enabled, int vht_enabled, int he_enabled,
75*a90b9d01SCy Schubert bool eht_enabled, int sec_channel_offset, int oper_chwidth,
765b9c547cSRui Paulo int center_segment0, int center_segment1);
77e28a4053SRui Paulo int hostapd_set_rts(struct hostapd_data *hapd, int rts);
78e28a4053SRui Paulo int hostapd_set_frag(struct hostapd_data *hapd, int frag);
79e28a4053SRui Paulo int hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
80e28a4053SRui Paulo int total_flags, int flags_or, int flags_and);
81206b73d0SCy Schubert int hostapd_sta_set_airtime_weight(struct hostapd_data *hapd, const u8 *addr,
82206b73d0SCy Schubert unsigned int weight);
83e28a4053SRui Paulo int hostapd_set_country(struct hostapd_data *hapd, const char *country);
84e28a4053SRui Paulo int hostapd_set_tx_queue_params(struct hostapd_data *hapd, int queue, int aifs,
85e28a4053SRui Paulo int cw_min, int cw_max, int burst_time);
86e28a4053SRui Paulo struct hostapd_hw_modes *
87e28a4053SRui Paulo hostapd_get_hw_feature_data(struct hostapd_data *hapd, u16 *num_modes,
8885732ac8SCy Schubert u16 *flags, u8 *dfs_domain);
89e28a4053SRui Paulo int hostapd_driver_commit(struct hostapd_data *hapd);
90e28a4053SRui Paulo int hostapd_drv_none(struct hostapd_data *hapd);
91c1d255d3SCy Schubert bool hostapd_drv_nl80211(struct hostapd_data *hapd);
92e28a4053SRui Paulo int hostapd_driver_scan(struct hostapd_data *hapd,
93e28a4053SRui Paulo struct wpa_driver_scan_params *params);
94e28a4053SRui Paulo struct wpa_scan_results * hostapd_driver_get_scan_results(
95e28a4053SRui Paulo struct hostapd_data *hapd);
96f05cddf9SRui Paulo int hostapd_driver_set_noa(struct hostapd_data *hapd, u8 count, int start,
97f05cddf9SRui Paulo int duration);
98f05cddf9SRui Paulo int hostapd_drv_set_key(const char *ifname,
99f05cddf9SRui Paulo struct hostapd_data *hapd,
100f05cddf9SRui Paulo enum wpa_alg alg, const u8 *addr,
101c1d255d3SCy Schubert int key_idx, int vlan_id, int set_tx,
102f05cddf9SRui Paulo const u8 *seq, size_t seq_len,
103c1d255d3SCy Schubert const u8 *key, size_t key_len, enum key_flag key_flag);
104f05cddf9SRui Paulo int hostapd_drv_send_mlme(struct hostapd_data *hapd,
105780fb4a2SCy Schubert const void *msg, size_t len, int noack,
106c1d255d3SCy Schubert const u16 *csa_offs, size_t csa_offs_len,
107c1d255d3SCy Schubert int no_encrypt);
108f05cddf9SRui Paulo int hostapd_drv_sta_deauth(struct hostapd_data *hapd,
109f05cddf9SRui Paulo const u8 *addr, int reason);
110f05cddf9SRui Paulo int hostapd_drv_sta_disassoc(struct hostapd_data *hapd,
111f05cddf9SRui Paulo const u8 *addr, int reason);
112f05cddf9SRui Paulo int hostapd_drv_send_action(struct hostapd_data *hapd, unsigned int freq,
113f05cddf9SRui Paulo unsigned int wait, const u8 *dst, const u8 *data,
114f05cddf9SRui Paulo size_t len);
115780fb4a2SCy Schubert int hostapd_drv_send_action_addr3_ap(struct hostapd_data *hapd,
116780fb4a2SCy Schubert unsigned int freq,
117780fb4a2SCy Schubert unsigned int wait, const u8 *dst,
118780fb4a2SCy Schubert const u8 *data, size_t len);
11985732ac8SCy Schubert static inline void
hostapd_drv_send_action_cancel_wait(struct hostapd_data * hapd)12085732ac8SCy Schubert hostapd_drv_send_action_cancel_wait(struct hostapd_data *hapd)
12185732ac8SCy Schubert {
12285732ac8SCy Schubert if (!hapd->driver || !hapd->driver->send_action_cancel_wait ||
12385732ac8SCy Schubert !hapd->drv_priv)
12485732ac8SCy Schubert return;
12585732ac8SCy Schubert hapd->driver->send_action_cancel_wait(hapd->drv_priv);
12685732ac8SCy Schubert }
127f05cddf9SRui Paulo int hostapd_add_sta_node(struct hostapd_data *hapd, const u8 *addr,
128f05cddf9SRui Paulo u16 auth_alg);
129f05cddf9SRui Paulo int hostapd_sta_auth(struct hostapd_data *hapd, const u8 *addr,
130f05cddf9SRui Paulo u16 seq, u16 status, const u8 *ie, size_t len);
131f05cddf9SRui Paulo int hostapd_sta_assoc(struct hostapd_data *hapd, const u8 *addr,
132f05cddf9SRui Paulo int reassoc, u16 status, const u8 *ie, size_t len);
133f05cddf9SRui Paulo int hostapd_add_tspec(struct hostapd_data *hapd, const u8 *addr,
134f05cddf9SRui Paulo u8 *tspec_ie, size_t tspec_ielen);
1355b9c547cSRui Paulo int hostapd_start_dfs_cac(struct hostapd_iface *iface,
1365b9c547cSRui Paulo enum hostapd_hw_mode mode, int freq,
1375b9c547cSRui Paulo int channel, int ht_enabled, int vht_enabled,
138*a90b9d01SCy Schubert int he_enabled, bool eht_enabled,
139206b73d0SCy Schubert int sec_channel_offset, int oper_chwidth,
140*a90b9d01SCy Schubert int center_segment0, int center_segment1,
141*a90b9d01SCy Schubert bool radar_background);
1425b9c547cSRui Paulo int hostapd_drv_do_acs(struct hostapd_data *hapd);
143206b73d0SCy Schubert int hostapd_drv_update_dh_ie(struct hostapd_data *hapd, const u8 *peer,
144206b73d0SCy Schubert u16 reason_code, const u8 *ie, size_t ielen);
145c1d255d3SCy Schubert int hostapd_drv_dpp_listen(struct hostapd_data *hapd, bool enable);
146*a90b9d01SCy Schubert int hostapd_drv_set_secure_ranging_ctx(struct hostapd_data *hapd,
147*a90b9d01SCy Schubert const u8 *own_addr, const u8 *addr,
148*a90b9d01SCy Schubert u32 cipher, u8 key_len, const u8 *key,
149*a90b9d01SCy Schubert u8 ltf_keyseed_len,
150*a90b9d01SCy Schubert const u8 *ltf_keyseed, u32 action);
151f05cddf9SRui Paulo
152f05cddf9SRui Paulo
153f05cddf9SRui Paulo #include "drivers/driver.h"
154f05cddf9SRui Paulo
155f05cddf9SRui Paulo int hostapd_drv_wnm_oper(struct hostapd_data *hapd,
156f05cddf9SRui Paulo enum wnm_oper oper, const u8 *peer,
157f05cddf9SRui Paulo u8 *buf, u16 *buf_len);
158f05cddf9SRui Paulo
1595b9c547cSRui Paulo int hostapd_drv_set_qos_map(struct hostapd_data *hapd, const u8 *qos_map_set,
1605b9c547cSRui Paulo u8 qos_map_set_len);
1615b9c547cSRui Paulo
162780fb4a2SCy Schubert void hostapd_get_ext_capa(struct hostapd_iface *iface);
163*a90b9d01SCy Schubert void hostapd_get_mld_capa(struct hostapd_iface *iface);
164*a90b9d01SCy Schubert
165*a90b9d01SCy Schubert void hostapd_get_hw_mode_any_channels(struct hostapd_data *hapd,
166*a90b9d01SCy Schubert struct hostapd_hw_modes *mode,
167*a90b9d01SCy Schubert int acs_ch_list_all, bool allow_disabled,
168*a90b9d01SCy Schubert int **freq_list);
169780fb4a2SCy Schubert
hostapd_drv_set_countermeasures(struct hostapd_data * hapd,int enabled)170f05cddf9SRui Paulo static inline int hostapd_drv_set_countermeasures(struct hostapd_data *hapd,
171f05cddf9SRui Paulo int enabled)
172f05cddf9SRui Paulo {
173f05cddf9SRui Paulo if (hapd->driver == NULL ||
174f05cddf9SRui Paulo hapd->driver->hapd_set_countermeasures == NULL)
175f05cddf9SRui Paulo return 0;
176f05cddf9SRui Paulo return hapd->driver->hapd_set_countermeasures(hapd->drv_priv, enabled);
177f05cddf9SRui Paulo }
178f05cddf9SRui Paulo
hostapd_drv_set_sta_vlan(const char * ifname,struct hostapd_data * hapd,const u8 * addr,int vlan_id,int link_id)179f05cddf9SRui Paulo static inline int hostapd_drv_set_sta_vlan(const char *ifname,
180f05cddf9SRui Paulo struct hostapd_data *hapd,
181*a90b9d01SCy Schubert const u8 *addr, int vlan_id,
182*a90b9d01SCy Schubert int link_id)
183f05cddf9SRui Paulo {
184f05cddf9SRui Paulo if (hapd->driver == NULL || hapd->driver->set_sta_vlan == NULL)
185f05cddf9SRui Paulo return 0;
186f05cddf9SRui Paulo return hapd->driver->set_sta_vlan(hapd->drv_priv, addr, ifname,
187*a90b9d01SCy Schubert vlan_id, link_id);
188f05cddf9SRui Paulo }
189f05cddf9SRui Paulo
hostapd_drv_get_inact_sec(struct hostapd_data * hapd,const u8 * addr)190f05cddf9SRui Paulo static inline int hostapd_drv_get_inact_sec(struct hostapd_data *hapd,
191f05cddf9SRui Paulo const u8 *addr)
192f05cddf9SRui Paulo {
193f05cddf9SRui Paulo if (hapd->driver == NULL || hapd->driver->get_inact_sec == NULL)
194f05cddf9SRui Paulo return 0;
195f05cddf9SRui Paulo return hapd->driver->get_inact_sec(hapd->drv_priv, addr);
196f05cddf9SRui Paulo }
197f05cddf9SRui Paulo
hostapd_drv_sta_remove(struct hostapd_data * hapd,const u8 * addr)198f05cddf9SRui Paulo static inline int hostapd_drv_sta_remove(struct hostapd_data *hapd,
199f05cddf9SRui Paulo const u8 *addr)
200f05cddf9SRui Paulo {
201780fb4a2SCy Schubert if (!hapd->driver || !hapd->driver->sta_remove || !hapd->drv_priv)
202f05cddf9SRui Paulo return 0;
203f05cddf9SRui Paulo return hapd->driver->sta_remove(hapd->drv_priv, addr);
204f05cddf9SRui Paulo }
205f05cddf9SRui Paulo
hostapd_drv_hapd_send_eapol(struct hostapd_data * hapd,const u8 * addr,const u8 * data,size_t data_len,int encrypt,u32 flags,int link_id)206f05cddf9SRui Paulo static inline int hostapd_drv_hapd_send_eapol(struct hostapd_data *hapd,
207f05cddf9SRui Paulo const u8 *addr, const u8 *data,
208f05cddf9SRui Paulo size_t data_len, int encrypt,
209*a90b9d01SCy Schubert u32 flags, int link_id)
210f05cddf9SRui Paulo {
211f05cddf9SRui Paulo if (hapd->driver == NULL || hapd->driver->hapd_send_eapol == NULL)
212f05cddf9SRui Paulo return 0;
213f05cddf9SRui Paulo return hapd->driver->hapd_send_eapol(hapd->drv_priv, addr, data,
214f05cddf9SRui Paulo data_len, encrypt,
215*a90b9d01SCy Schubert hapd->own_addr, flags, link_id);
216f05cddf9SRui Paulo }
217f05cddf9SRui Paulo
hostapd_drv_read_sta_data(struct hostapd_data * hapd,struct hostap_sta_driver_data * data,const u8 * addr)218f05cddf9SRui Paulo static inline int hostapd_drv_read_sta_data(
219f05cddf9SRui Paulo struct hostapd_data *hapd, struct hostap_sta_driver_data *data,
220f05cddf9SRui Paulo const u8 *addr)
221f05cddf9SRui Paulo {
222f05cddf9SRui Paulo if (hapd->driver == NULL || hapd->driver->read_sta_data == NULL)
223f05cddf9SRui Paulo return -1;
224f05cddf9SRui Paulo return hapd->driver->read_sta_data(hapd->drv_priv, data, addr);
225f05cddf9SRui Paulo }
226f05cddf9SRui Paulo
hostapd_drv_sta_clear_stats(struct hostapd_data * hapd,const u8 * addr)227f05cddf9SRui Paulo static inline int hostapd_drv_sta_clear_stats(struct hostapd_data *hapd,
228f05cddf9SRui Paulo const u8 *addr)
229f05cddf9SRui Paulo {
230f05cddf9SRui Paulo if (hapd->driver == NULL || hapd->driver->sta_clear_stats == NULL)
231f05cddf9SRui Paulo return 0;
232f05cddf9SRui Paulo return hapd->driver->sta_clear_stats(hapd->drv_priv, addr);
233f05cddf9SRui Paulo }
234f05cddf9SRui Paulo
hostapd_drv_set_acl(struct hostapd_data * hapd,struct hostapd_acl_params * params)2355b9c547cSRui Paulo static inline int hostapd_drv_set_acl(struct hostapd_data *hapd,
2365b9c547cSRui Paulo struct hostapd_acl_params *params)
2375b9c547cSRui Paulo {
2385b9c547cSRui Paulo if (hapd->driver == NULL || hapd->driver->set_acl == NULL)
2395b9c547cSRui Paulo return 0;
2405b9c547cSRui Paulo return hapd->driver->set_acl(hapd->drv_priv, params);
2415b9c547cSRui Paulo }
2425b9c547cSRui Paulo
hostapd_drv_set_ap(struct hostapd_data * hapd,struct wpa_driver_ap_params * params)243f05cddf9SRui Paulo static inline int hostapd_drv_set_ap(struct hostapd_data *hapd,
244f05cddf9SRui Paulo struct wpa_driver_ap_params *params)
245f05cddf9SRui Paulo {
246f05cddf9SRui Paulo if (hapd->driver == NULL || hapd->driver->set_ap == NULL)
247f05cddf9SRui Paulo return 0;
248f05cddf9SRui Paulo return hapd->driver->set_ap(hapd->drv_priv, params);
249f05cddf9SRui Paulo }
250f05cddf9SRui Paulo
hostapd_drv_set_radius_acl_auth(struct hostapd_data * hapd,const u8 * mac,int accepted,u32 session_timeout)251f05cddf9SRui Paulo static inline int hostapd_drv_set_radius_acl_auth(struct hostapd_data *hapd,
252f05cddf9SRui Paulo const u8 *mac, int accepted,
253f05cddf9SRui Paulo u32 session_timeout)
254f05cddf9SRui Paulo {
255f05cddf9SRui Paulo if (hapd->driver == NULL || hapd->driver->set_radius_acl_auth == NULL)
256f05cddf9SRui Paulo return 0;
257f05cddf9SRui Paulo return hapd->driver->set_radius_acl_auth(hapd->drv_priv, mac, accepted,
258f05cddf9SRui Paulo session_timeout);
259f05cddf9SRui Paulo }
260f05cddf9SRui Paulo
hostapd_drv_set_radius_acl_expire(struct hostapd_data * hapd,const u8 * mac)261f05cddf9SRui Paulo static inline int hostapd_drv_set_radius_acl_expire(struct hostapd_data *hapd,
262f05cddf9SRui Paulo const u8 *mac)
263f05cddf9SRui Paulo {
264f05cddf9SRui Paulo if (hapd->driver == NULL ||
265f05cddf9SRui Paulo hapd->driver->set_radius_acl_expire == NULL)
266f05cddf9SRui Paulo return 0;
267f05cddf9SRui Paulo return hapd->driver->set_radius_acl_expire(hapd->drv_priv, mac);
268f05cddf9SRui Paulo }
269f05cddf9SRui Paulo
hostapd_drv_set_authmode(struct hostapd_data * hapd,int auth_algs)270f05cddf9SRui Paulo static inline int hostapd_drv_set_authmode(struct hostapd_data *hapd,
271f05cddf9SRui Paulo int auth_algs)
272f05cddf9SRui Paulo {
273f05cddf9SRui Paulo if (hapd->driver == NULL || hapd->driver->set_authmode == NULL)
274f05cddf9SRui Paulo return 0;
275f05cddf9SRui Paulo return hapd->driver->set_authmode(hapd->drv_priv, auth_algs);
276f05cddf9SRui Paulo }
277f05cddf9SRui Paulo
hostapd_drv_poll_client(struct hostapd_data * hapd,const u8 * own_addr,const u8 * addr,int qos)278f05cddf9SRui Paulo static inline void hostapd_drv_poll_client(struct hostapd_data *hapd,
279f05cddf9SRui Paulo const u8 *own_addr, const u8 *addr,
280f05cddf9SRui Paulo int qos)
281f05cddf9SRui Paulo {
282f05cddf9SRui Paulo if (hapd->driver == NULL || hapd->driver->poll_client == NULL)
283f05cddf9SRui Paulo return;
284f05cddf9SRui Paulo hapd->driver->poll_client(hapd->drv_priv, own_addr, addr, qos);
285f05cddf9SRui Paulo }
286e28a4053SRui Paulo
hostapd_drv_get_survey(struct hostapd_data * hapd,unsigned int freq)2875b9c547cSRui Paulo static inline int hostapd_drv_get_survey(struct hostapd_data *hapd,
2885b9c547cSRui Paulo unsigned int freq)
2895b9c547cSRui Paulo {
2905b9c547cSRui Paulo if (hapd->driver == NULL)
2915b9c547cSRui Paulo return -1;
2925b9c547cSRui Paulo if (!hapd->driver->get_survey)
2935b9c547cSRui Paulo return -1;
2945b9c547cSRui Paulo return hapd->driver->get_survey(hapd->drv_priv, freq);
2955b9c547cSRui Paulo }
2965b9c547cSRui Paulo
hostapd_get_country(struct hostapd_data * hapd,char * alpha2)2975b9c547cSRui Paulo static inline int hostapd_get_country(struct hostapd_data *hapd, char *alpha2)
2985b9c547cSRui Paulo {
2995b9c547cSRui Paulo if (hapd->driver == NULL || hapd->driver->get_country == NULL)
3005b9c547cSRui Paulo return -1;
3015b9c547cSRui Paulo return hapd->driver->get_country(hapd->drv_priv, alpha2);
3025b9c547cSRui Paulo }
3035b9c547cSRui Paulo
hostapd_drv_get_radio_name(struct hostapd_data * hapd)3045b9c547cSRui Paulo static inline const char * hostapd_drv_get_radio_name(struct hostapd_data *hapd)
3055b9c547cSRui Paulo {
3065b9c547cSRui Paulo if (hapd->driver == NULL || hapd->drv_priv == NULL ||
3075b9c547cSRui Paulo hapd->driver->get_radio_name == NULL)
3085b9c547cSRui Paulo return NULL;
3095b9c547cSRui Paulo return hapd->driver->get_radio_name(hapd->drv_priv);
3105b9c547cSRui Paulo }
3115b9c547cSRui Paulo
hostapd_drv_switch_channel(struct hostapd_data * hapd,struct csa_settings * settings)3125b9c547cSRui Paulo static inline int hostapd_drv_switch_channel(struct hostapd_data *hapd,
3135b9c547cSRui Paulo struct csa_settings *settings)
3145b9c547cSRui Paulo {
31585732ac8SCy Schubert if (hapd->driver == NULL || hapd->driver->switch_channel == NULL ||
31685732ac8SCy Schubert hapd->drv_priv == NULL)
31785732ac8SCy Schubert return -1;
3185b9c547cSRui Paulo
3195b9c547cSRui Paulo return hapd->driver->switch_channel(hapd->drv_priv, settings);
3205b9c547cSRui Paulo }
3215b9c547cSRui Paulo
322*a90b9d01SCy Schubert #ifdef CONFIG_IEEE80211AX
hostapd_drv_switch_color(struct hostapd_data * hapd,struct cca_settings * settings)323*a90b9d01SCy Schubert static inline int hostapd_drv_switch_color(struct hostapd_data *hapd,
324*a90b9d01SCy Schubert struct cca_settings *settings)
325*a90b9d01SCy Schubert {
326*a90b9d01SCy Schubert if (!hapd->driver || !hapd->driver->switch_color || !hapd->drv_priv)
327*a90b9d01SCy Schubert return -1;
328*a90b9d01SCy Schubert
329*a90b9d01SCy Schubert return hapd->driver->switch_color(hapd->drv_priv, settings);
330*a90b9d01SCy Schubert }
331*a90b9d01SCy Schubert #endif /* CONFIG_IEEE80211AX */
332*a90b9d01SCy Schubert
hostapd_drv_status(struct hostapd_data * hapd,char * buf,size_t buflen)3335b9c547cSRui Paulo static inline int hostapd_drv_status(struct hostapd_data *hapd, char *buf,
3345b9c547cSRui Paulo size_t buflen)
3355b9c547cSRui Paulo {
336780fb4a2SCy Schubert if (!hapd->driver || !hapd->driver->status || !hapd->drv_priv)
3375b9c547cSRui Paulo return -1;
3385b9c547cSRui Paulo return hapd->driver->status(hapd->drv_priv, buf, buflen);
3395b9c547cSRui Paulo }
3405b9c547cSRui Paulo
hostapd_drv_br_add_ip_neigh(struct hostapd_data * hapd,int version,const u8 * ipaddr,int prefixlen,const u8 * addr)3415b9c547cSRui Paulo static inline int hostapd_drv_br_add_ip_neigh(struct hostapd_data *hapd,
3425b9c547cSRui Paulo int version, const u8 *ipaddr,
3435b9c547cSRui Paulo int prefixlen, const u8 *addr)
3445b9c547cSRui Paulo {
3455b9c547cSRui Paulo if (hapd->driver == NULL || hapd->drv_priv == NULL ||
3465b9c547cSRui Paulo hapd->driver->br_add_ip_neigh == NULL)
3475b9c547cSRui Paulo return -1;
3485b9c547cSRui Paulo return hapd->driver->br_add_ip_neigh(hapd->drv_priv, version, ipaddr,
3495b9c547cSRui Paulo prefixlen, addr);
3505b9c547cSRui Paulo }
3515b9c547cSRui Paulo
hostapd_drv_br_delete_ip_neigh(struct hostapd_data * hapd,u8 version,const u8 * ipaddr)3525b9c547cSRui Paulo static inline int hostapd_drv_br_delete_ip_neigh(struct hostapd_data *hapd,
3535b9c547cSRui Paulo u8 version, const u8 *ipaddr)
3545b9c547cSRui Paulo {
3555b9c547cSRui Paulo if (hapd->driver == NULL || hapd->drv_priv == NULL ||
3565b9c547cSRui Paulo hapd->driver->br_delete_ip_neigh == NULL)
3575b9c547cSRui Paulo return -1;
3585b9c547cSRui Paulo return hapd->driver->br_delete_ip_neigh(hapd->drv_priv, version,
3595b9c547cSRui Paulo ipaddr);
3605b9c547cSRui Paulo }
3615b9c547cSRui Paulo
hostapd_drv_br_port_set_attr(struct hostapd_data * hapd,enum drv_br_port_attr attr,unsigned int val)3625b9c547cSRui Paulo static inline int hostapd_drv_br_port_set_attr(struct hostapd_data *hapd,
3635b9c547cSRui Paulo enum drv_br_port_attr attr,
3645b9c547cSRui Paulo unsigned int val)
3655b9c547cSRui Paulo {
3665b9c547cSRui Paulo if (hapd->driver == NULL || hapd->drv_priv == NULL ||
3675b9c547cSRui Paulo hapd->driver->br_port_set_attr == NULL)
3685b9c547cSRui Paulo return -1;
3695b9c547cSRui Paulo return hapd->driver->br_port_set_attr(hapd->drv_priv, attr, val);
3705b9c547cSRui Paulo }
3715b9c547cSRui Paulo
hostapd_drv_br_set_net_param(struct hostapd_data * hapd,enum drv_br_net_param param,unsigned int val)3725b9c547cSRui Paulo static inline int hostapd_drv_br_set_net_param(struct hostapd_data *hapd,
3735b9c547cSRui Paulo enum drv_br_net_param param,
3745b9c547cSRui Paulo unsigned int val)
3755b9c547cSRui Paulo {
3765b9c547cSRui Paulo if (hapd->driver == NULL || hapd->drv_priv == NULL ||
3775b9c547cSRui Paulo hapd->driver->br_set_net_param == NULL)
3785b9c547cSRui Paulo return -1;
3795b9c547cSRui Paulo return hapd->driver->br_set_net_param(hapd->drv_priv, param, val);
3805b9c547cSRui Paulo }
3815b9c547cSRui Paulo
hostapd_drv_vendor_cmd(struct hostapd_data * hapd,int vendor_id,int subcmd,const u8 * data,size_t data_len,enum nested_attr nested_attr_flag,struct wpabuf * buf)3825b9c547cSRui Paulo static inline int hostapd_drv_vendor_cmd(struct hostapd_data *hapd,
3835b9c547cSRui Paulo int vendor_id, int subcmd,
3845b9c547cSRui Paulo const u8 *data, size_t data_len,
385c1d255d3SCy Schubert enum nested_attr nested_attr_flag,
3865b9c547cSRui Paulo struct wpabuf *buf)
3875b9c547cSRui Paulo {
3885b9c547cSRui Paulo if (hapd->driver == NULL || hapd->driver->vendor_cmd == NULL)
3895b9c547cSRui Paulo return -1;
3905b9c547cSRui Paulo return hapd->driver->vendor_cmd(hapd->drv_priv, vendor_id, subcmd, data,
391c1d255d3SCy Schubert data_len, nested_attr_flag, buf);
3925b9c547cSRui Paulo }
3935b9c547cSRui Paulo
hostapd_drv_stop_ap(struct hostapd_data * hapd)3945b9c547cSRui Paulo static inline int hostapd_drv_stop_ap(struct hostapd_data *hapd)
3955b9c547cSRui Paulo {
396*a90b9d01SCy Schubert int link_id = -1;
397*a90b9d01SCy Schubert
398780fb4a2SCy Schubert if (!hapd->driver || !hapd->driver->stop_ap || !hapd->drv_priv)
3995b9c547cSRui Paulo return 0;
400*a90b9d01SCy Schubert #ifdef CONFIG_IEEE80211BE
401*a90b9d01SCy Schubert if (hapd->conf->mld_ap)
402*a90b9d01SCy Schubert link_id = hapd->mld_link_id;
403*a90b9d01SCy Schubert #endif /* CONFIG_IEEE80211BE */
404*a90b9d01SCy Schubert return hapd->driver->stop_ap(hapd->drv_priv, link_id);
4055b9c547cSRui Paulo }
4065b9c547cSRui Paulo
hostapd_drv_channel_info(struct hostapd_data * hapd,struct wpa_channel_info * ci)4074bc52338SCy Schubert static inline int hostapd_drv_channel_info(struct hostapd_data *hapd,
4084bc52338SCy Schubert struct wpa_channel_info *ci)
4094bc52338SCy Schubert {
4104bc52338SCy Schubert if (!hapd->driver || !hapd->driver->channel_info)
4114bc52338SCy Schubert return -1;
4124bc52338SCy Schubert return hapd->driver->channel_info(hapd->drv_priv, ci);
4134bc52338SCy Schubert }
4144bc52338SCy Schubert
4154bc52338SCy Schubert static inline int
hostapd_drv_send_external_auth_status(struct hostapd_data * hapd,struct external_auth * params)4164bc52338SCy Schubert hostapd_drv_send_external_auth_status(struct hostapd_data *hapd,
4174bc52338SCy Schubert struct external_auth *params)
4184bc52338SCy Schubert {
4194bc52338SCy Schubert if (!hapd->driver || !hapd->drv_priv ||
4204bc52338SCy Schubert !hapd->driver->send_external_auth_status)
4214bc52338SCy Schubert return -1;
4224bc52338SCy Schubert return hapd->driver->send_external_auth_status(hapd->drv_priv, params);
4234bc52338SCy Schubert }
4244bc52338SCy Schubert
425c1d255d3SCy Schubert static inline int
hostapd_drv_set_band(struct hostapd_data * hapd,u32 band_mask)426c1d255d3SCy Schubert hostapd_drv_set_band(struct hostapd_data *hapd, u32 band_mask)
427c1d255d3SCy Schubert {
428c1d255d3SCy Schubert if (!hapd->driver || !hapd->drv_priv || !hapd->driver->set_band)
429c1d255d3SCy Schubert return -1;
430c1d255d3SCy Schubert return hapd->driver->set_band(hapd->drv_priv, band_mask);
431c1d255d3SCy Schubert }
432c1d255d3SCy Schubert
433c1d255d3SCy Schubert #ifdef ANDROID
hostapd_drv_driver_cmd(struct hostapd_data * hapd,char * cmd,char * buf,size_t buf_len)434c1d255d3SCy Schubert static inline int hostapd_drv_driver_cmd(struct hostapd_data *hapd,
435c1d255d3SCy Schubert char *cmd, char *buf, size_t buf_len)
436c1d255d3SCy Schubert {
437c1d255d3SCy Schubert if (!hapd->driver->driver_cmd)
438c1d255d3SCy Schubert return -1;
439c1d255d3SCy Schubert return hapd->driver->driver_cmd(hapd->drv_priv, cmd, buf, buf_len);
440c1d255d3SCy Schubert }
441c1d255d3SCy Schubert #endif /* ANDROID */
442c1d255d3SCy Schubert
443c1d255d3SCy Schubert #ifdef CONFIG_TESTING_OPTIONS
444c1d255d3SCy Schubert static inline int
hostapd_drv_register_frame(struct hostapd_data * hapd,u16 type,const u8 * match,size_t match_len,bool multicast)445c1d255d3SCy Schubert hostapd_drv_register_frame(struct hostapd_data *hapd, u16 type,
446c1d255d3SCy Schubert const u8 *match, size_t match_len,
447c1d255d3SCy Schubert bool multicast)
448c1d255d3SCy Schubert {
449c1d255d3SCy Schubert if (!hapd->driver || !hapd->drv_priv || !hapd->driver->register_frame)
450c1d255d3SCy Schubert return -1;
451c1d255d3SCy Schubert return hapd->driver->register_frame(hapd->drv_priv, type, match,
452c1d255d3SCy Schubert match_len, multicast);
453c1d255d3SCy Schubert }
454c1d255d3SCy Schubert #endif /* CONFIG_TESTING_OPTIONS */
455c1d255d3SCy Schubert
456*a90b9d01SCy Schubert #ifdef CONFIG_IEEE80211BE
457*a90b9d01SCy Schubert
hostapd_drv_link_add(struct hostapd_data * hapd,u8 link_id,const u8 * addr)458*a90b9d01SCy Schubert static inline int hostapd_drv_link_add(struct hostapd_data *hapd,
459*a90b9d01SCy Schubert u8 link_id, const u8 *addr)
460*a90b9d01SCy Schubert {
461*a90b9d01SCy Schubert if (!hapd->driver || !hapd->drv_priv || !hapd->driver->link_add)
462*a90b9d01SCy Schubert return -1;
463*a90b9d01SCy Schubert
464*a90b9d01SCy Schubert return hapd->driver->link_add(hapd->drv_priv, link_id, addr, hapd);
465*a90b9d01SCy Schubert
466*a90b9d01SCy Schubert }
467*a90b9d01SCy Schubert
hostapd_drv_link_sta_remove(struct hostapd_data * hapd,const u8 * addr)468*a90b9d01SCy Schubert static inline int hostapd_drv_link_sta_remove(struct hostapd_data *hapd,
469*a90b9d01SCy Schubert const u8 *addr)
470*a90b9d01SCy Schubert {
471*a90b9d01SCy Schubert if (!hapd->conf->mld_ap || !hapd->driver || !hapd->drv_priv ||
472*a90b9d01SCy Schubert !hapd->driver->link_sta_remove)
473*a90b9d01SCy Schubert return -1;
474*a90b9d01SCy Schubert
475*a90b9d01SCy Schubert return hapd->driver->link_sta_remove(hapd->drv_priv, hapd->mld_link_id,
476*a90b9d01SCy Schubert addr);
477*a90b9d01SCy Schubert }
478*a90b9d01SCy Schubert
479*a90b9d01SCy Schubert #endif /* CONFIG_IEEE80211BE */
480*a90b9d01SCy Schubert
481e28a4053SRui Paulo #endif /* AP_DRV_OPS */
482