18d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/*
28d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * hostapd - Driver operations
3fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt * Copyright (c) 2009-2014, Jouni Malinen <j@w1.fi>
48d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
5c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * This software may be distributed under the terms of the BSD license.
6c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * See README for more details.
78d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
88d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
98d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifndef AP_DRV_OPS
108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define AP_DRV_OPS
118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtenum wpa_driver_if_type;
138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct wpa_bss_params;
148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct wpa_driver_scan_params;
158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct ieee80211_ht_capabilities;
16a54fa5fb807eaeff45464139b5a7759f060cec68Dmitry Shmidtstruct ieee80211_vht_capabilities;
1704f534e89ed127da4077485376f24debc50d80d5Dmitry Shmidtstruct hostapd_freq_params;
188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtu32 hostapd_sta_flags_to_drv(u32 flags);
201f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint hostapd_build_ap_extra_ies(struct hostapd_data *hapd,
211f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt			       struct wpabuf **beacon,
221f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt			       struct wpabuf **proberesp,
231f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt			       struct wpabuf **assocresp);
241f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtvoid hostapd_free_ap_extra_ies(struct hostapd_data *hapd, struct wpabuf *beacon,
251f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt			       struct wpabuf *proberesp,
261f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt			       struct wpabuf *assocresp);
278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_set_ap_wps_ie(struct hostapd_data *hapd);
288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_set_authorized(struct hostapd_data *hapd,
298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			   struct sta_info *sta, int authorized);
308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_set_sta_flags(struct hostapd_data *hapd, struct sta_info *sta);
318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			      int enabled);
338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname);
348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_vlan_if_remove(struct hostapd_data *hapd, const char *ifname);
35c2ebb4b85d69b65f552fee71ac68f44e8d87b39eDmitry Shmidtint hostapd_set_wds_sta(struct hostapd_data *hapd, char *ifname_wds,
36c2ebb4b85d69b65f552fee71ac68f44e8d87b39eDmitry Shmidt			const u8 *addr, int aid, int val);
378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_sta_add(struct hostapd_data *hapd,
388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		    const u8 *addr, u16 aid, u16 capability,
398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		    const u8 *supp_rates, size_t supp_rates_len,
408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		    u16 listen_interval,
411f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt		    const struct ieee80211_ht_capabilities *ht_capab,
42a54fa5fb807eaeff45464139b5a7759f060cec68Dmitry Shmidt		    const struct ieee80211_vht_capabilities *vht_capab,
43bd14a57187b024f49f5b9ace55ef457d8d04650aDmitry Shmidt		    u32 flags, u8 qosinfo, u8 vht_opmode);
448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_set_privacy(struct hostapd_data *hapd, int enabled);
458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			     size_t elem_len);
478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_get_ssid(struct hostapd_data *hapd, u8 *buf, size_t len);
488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len);
498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		   const char *ifname, const u8 *addr, void *bss_ctx,
518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		   void **drv_priv, char *force_ifname, u8 *if_addr,
52cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt		   const char *bridge, int use_existing);
538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_if_remove(struct hostapd_data *hapd, enum wpa_driver_if_type type,
548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		      const char *ifname);
558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_set_ieee8021x(struct hostapd_data *hapd,
568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			  struct wpa_bss_params *params);
578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd,
588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		       const u8 *addr, int idx, u8 *seq);
598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_flush(struct hostapd_data *hapd);
608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq,
61a54fa5fb807eaeff45464139b5a7759f060cec68Dmitry Shmidt		     int channel, int ht_enabled, int vht_enabled,
62a54fa5fb807eaeff45464139b5a7759f060cec68Dmitry Shmidt		     int sec_channel_offset, int vht_oper_chwidth,
63a54fa5fb807eaeff45464139b5a7759f060cec68Dmitry Shmidt		     int center_segment0, int center_segment1);
648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_set_rts(struct hostapd_data *hapd, int rts);
658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_set_frag(struct hostapd_data *hapd, int frag);
668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			  int total_flags, int flags_or, int flags_and);
688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_set_country(struct hostapd_data *hapd, const char *country);
698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_set_tx_queue_params(struct hostapd_data *hapd, int queue, int aifs,
708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt				int cw_min, int cw_max, int burst_time);
718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct hostapd_hw_modes *
728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidthostapd_get_hw_feature_data(struct hostapd_data *hapd, u16 *num_modes,
738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			    u16 *flags);
748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_driver_commit(struct hostapd_data *hapd);
758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_drv_none(struct hostapd_data *hapd);
768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_driver_scan(struct hostapd_data *hapd,
778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			struct wpa_driver_scan_params *params);
788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct wpa_scan_results * hostapd_driver_get_scan_results(
798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct hostapd_data *hapd);
808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_driver_set_noa(struct hostapd_data *hapd, u8 count, int start,
818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			   int duration);
828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_drv_set_key(const char *ifname,
838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			struct hostapd_data *hapd,
848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			enum wpa_alg alg, const u8 *addr,
858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			int key_idx, int set_tx,
868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			const u8 *seq, size_t seq_len,
878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			const u8 *key, size_t key_len);
888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_drv_send_mlme(struct hostapd_data *hapd,
891f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt			  const void *msg, size_t len, int noack);
908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_drv_sta_deauth(struct hostapd_data *hapd,
918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			   const u8 *addr, int reason);
928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint hostapd_drv_sta_disassoc(struct hostapd_data *hapd,
938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt			     const u8 *addr, int reason);
9404949598a23f501be6eec21697465fd46a28840aDmitry Shmidtint hostapd_drv_send_action(struct hostapd_data *hapd, unsigned int freq,
9504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt			    unsigned int wait, const u8 *dst, const u8 *data,
9604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt			    size_t len);
971f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint hostapd_add_sta_node(struct hostapd_data *hapd, const u8 *addr,
981f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt			 u16 auth_alg);
991f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint hostapd_sta_auth(struct hostapd_data *hapd, const u8 *addr,
1001f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt		     u16 seq, u16 status, const u8 *ie, size_t len);
1011f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint hostapd_sta_assoc(struct hostapd_data *hapd, const u8 *addr,
1021f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt		      int reassoc, u16 status, const u8 *ie, size_t len);
1031f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtint hostapd_add_tspec(struct hostapd_data *hapd, const u8 *addr,
1041f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt		      u8 *tspec_ie, size_t tspec_ielen);
105cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidtint hostapd_start_dfs_cac(struct hostapd_iface *iface, int mode, int freq,
106051af73b8f8014eff33330aead0f36944b3403e6Dmitry Shmidt			  int channel, int ht_enabled, int vht_enabled,
107051af73b8f8014eff33330aead0f36944b3403e6Dmitry Shmidt			  int sec_channel_offset, int vht_oper_chwidth,
108051af73b8f8014eff33330aead0f36944b3403e6Dmitry Shmidt			  int center_segment0, int center_segment1);
10904f534e89ed127da4077485376f24debc50d80d5Dmitry Shmidtint hostapd_set_freq_params(struct hostapd_freq_params *data, int mode,
11004f534e89ed127da4077485376f24debc50d80d5Dmitry Shmidt			    int freq, int channel, int ht_enabled,
11104f534e89ed127da4077485376f24debc50d80d5Dmitry Shmidt			    int vht_enabled, int sec_channel_offset,
11204f534e89ed127da4077485376f24debc50d80d5Dmitry Shmidt			    int vht_oper_chwidth, int center_segment0,
11304f534e89ed127da4077485376f24debc50d80d5Dmitry Shmidt			    int center_segment1, u32 vht_caps);
1148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "drivers/driver.h"
1178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
11861d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtint hostapd_drv_wnm_oper(struct hostapd_data *hapd,
11961d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt			 enum wnm_oper oper, const u8 *peer,
12061d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt			 u8 *buf, u16 *buf_len);
12161d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt
122051af73b8f8014eff33330aead0f36944b3403e6Dmitry Shmidtint hostapd_drv_set_qos_map(struct hostapd_data *hapd, const u8 *qos_map_set,
123051af73b8f8014eff33330aead0f36944b3403e6Dmitry Shmidt			    u8 qos_map_set_len);
124051af73b8f8014eff33330aead0f36944b3403e6Dmitry Shmidt
1258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic inline int hostapd_drv_set_countermeasures(struct hostapd_data *hapd,
1268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt						  int enabled)
1278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	if (hapd->driver == NULL ||
1298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	    hapd->driver->hapd_set_countermeasures == NULL)
1308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		return 0;
1318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	return hapd->driver->hapd_set_countermeasures(hapd->drv_priv, enabled);
1328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic inline int hostapd_drv_set_sta_vlan(const char *ifname,
1358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					   struct hostapd_data *hapd,
1368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					   const u8 *addr, int vlan_id)
1378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	if (hapd->driver == NULL || hapd->driver->set_sta_vlan == NULL)
1398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		return 0;
1408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	return hapd->driver->set_sta_vlan(hapd->drv_priv, addr, ifname,
1418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					  vlan_id);
1428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic inline int hostapd_drv_get_inact_sec(struct hostapd_data *hapd,
1458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					    const u8 *addr)
1468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	if (hapd->driver == NULL || hapd->driver->get_inact_sec == NULL)
1488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		return 0;
1498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	return hapd->driver->get_inact_sec(hapd->drv_priv, addr);
1508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic inline int hostapd_drv_sta_remove(struct hostapd_data *hapd,
1538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					 const u8 *addr)
1548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	if (hapd->driver == NULL || hapd->driver->sta_remove == NULL)
1568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		return 0;
1578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	return hapd->driver->sta_remove(hapd->drv_priv, addr);
1588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic inline int hostapd_drv_hapd_send_eapol(struct hostapd_data *hapd,
1618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					      const u8 *addr, const u8 *data,
1628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					      size_t data_len, int encrypt,
1638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					      u32 flags)
1648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	if (hapd->driver == NULL || hapd->driver->hapd_send_eapol == NULL)
1668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		return 0;
1678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	return hapd->driver->hapd_send_eapol(hapd->drv_priv, addr, data,
1688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					     data_len, encrypt,
1698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					     hapd->own_addr, flags);
1708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic inline int hostapd_drv_read_sta_data(
1738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	struct hostapd_data *hapd, struct hostap_sta_driver_data *data,
1748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	const u8 *addr)
1758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	if (hapd->driver == NULL || hapd->driver->read_sta_data == NULL)
1778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		return -1;
1788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	return hapd->driver->read_sta_data(hapd->drv_priv, data, addr);
1798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic inline int hostapd_drv_sta_clear_stats(struct hostapd_data *hapd,
1828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt					      const u8 *addr)
1838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
1848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	if (hapd->driver == NULL || hapd->driver->sta_clear_stats == NULL)
1858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		return 0;
1868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	return hapd->driver->sta_clear_stats(hapd->drv_priv, addr);
1878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
1888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1898bae4138a0356709720a96f3e50b4d734e532c12Dmitry Shmidtstatic inline int hostapd_drv_set_acl(struct hostapd_data *hapd,
1908bae4138a0356709720a96f3e50b4d734e532c12Dmitry Shmidt				      struct hostapd_acl_params *params)
1918bae4138a0356709720a96f3e50b4d734e532c12Dmitry Shmidt{
1928bae4138a0356709720a96f3e50b4d734e532c12Dmitry Shmidt	if (hapd->driver == NULL || hapd->driver->set_acl == NULL)
1938bae4138a0356709720a96f3e50b4d734e532c12Dmitry Shmidt		return 0;
1948bae4138a0356709720a96f3e50b4d734e532c12Dmitry Shmidt	return hapd->driver->set_acl(hapd->drv_priv, params);
1958bae4138a0356709720a96f3e50b4d734e532c12Dmitry Shmidt}
1968bae4138a0356709720a96f3e50b4d734e532c12Dmitry Shmidt
1971f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtstatic inline int hostapd_drv_set_ap(struct hostapd_data *hapd,
1981f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt				     struct wpa_driver_ap_params *params)
1998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
2001f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	if (hapd->driver == NULL || hapd->driver->set_ap == NULL)
2018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		return 0;
2021f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	return hapd->driver->set_ap(hapd->drv_priv, params);
2038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
2048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic inline int hostapd_drv_set_radius_acl_auth(struct hostapd_data *hapd,
2068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt						  const u8 *mac, int accepted,
2078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt						  u32 session_timeout)
2088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
2098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	if (hapd->driver == NULL || hapd->driver->set_radius_acl_auth == NULL)
2108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		return 0;
2118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	return hapd->driver->set_radius_acl_auth(hapd->drv_priv, mac, accepted,
2128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt						 session_timeout);
2138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
2148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic inline int hostapd_drv_set_radius_acl_expire(struct hostapd_data *hapd,
2168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt						    const u8 *mac)
2178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{
2188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	if (hapd->driver == NULL ||
2198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	    hapd->driver->set_radius_acl_expire == NULL)
2208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		return 0;
2218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt	return hapd->driver->set_radius_acl_expire(hapd->drv_priv, mac);
2228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
2238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
22475ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinenstatic inline int hostapd_drv_set_authmode(struct hostapd_data *hapd,
22575ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen					   int auth_algs)
22675ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen{
22775ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	if (hapd->driver == NULL || hapd->driver->set_authmode == NULL)
22875ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen		return 0;
22975ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen	return hapd->driver->set_authmode(hapd->drv_priv, auth_algs);
23075ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen}
23175ecf5267604f166b85a7ee2cf0d9cb682966680Jouni Malinen
2321f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtstatic inline void hostapd_drv_poll_client(struct hostapd_data *hapd,
2331f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt					   const u8 *own_addr, const u8 *addr,
2341f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt					   int qos)
2351f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt{
2361f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	if (hapd->driver == NULL || hapd->driver->poll_client == NULL)
2371f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt		return;
2381f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt	hapd->driver->poll_client(hapd->drv_priv, own_addr, addr, qos);
2391f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt}
2401f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt
241b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidtstatic inline int hostapd_drv_get_survey(struct hostapd_data *hapd,
242b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt					 unsigned int freq)
243b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt{
244b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	if (hapd->driver == NULL)
245b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt		return -1;
246b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	if (!hapd->driver->get_survey)
247b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt		return -1;
248b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt	return hapd->driver->get_survey(hapd->drv_priv, freq);
249b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt}
250b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt
251cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidtstatic inline int hostapd_get_country(struct hostapd_data *hapd, char *alpha2)
252cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt{
253cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt	if (hapd->driver == NULL || hapd->driver->get_country == NULL)
254cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt		return -1;
255cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt	return hapd->driver->get_country(hapd->drv_priv, alpha2);
256cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt}
257cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt
258cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidtstatic inline const char * hostapd_drv_get_radio_name(struct hostapd_data *hapd)
259cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt{
260cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt	if (hapd->driver == NULL || hapd->drv_priv == NULL ||
261cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt	    hapd->driver->get_radio_name == NULL)
262cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt		return NULL;
263cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt	return hapd->driver->get_radio_name(hapd->drv_priv);
264cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt}
265cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt
266e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidtstatic inline int hostapd_drv_switch_channel(struct hostapd_data *hapd,
267e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt					     struct csa_settings *settings)
268e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt{
269e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt	if (hapd->driver == NULL || hapd->driver->switch_channel == NULL)
270e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt		return -ENOTSUP;
271e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt
272e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt	return hapd->driver->switch_channel(hapd->drv_priv, settings);
273e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt}
274e0e48dc666fb14a7bb60264ca87463ba7bc1fe0bDmitry Shmidt
275fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidtstatic inline int hostapd_drv_status(struct hostapd_data *hapd, char *buf,
276fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt				     size_t buflen)
277fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt{
278fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt	if (hapd->driver == NULL || hapd->driver->status == NULL)
279fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt		return -1;
280fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt	return hapd->driver->status(hapd->drv_priv, buf, buflen);
281fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt}
282fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt
283df5a7e4c5c64890c2425bb47d665bbce4992b676Dmitry Shmidtstatic inline int hostapd_drv_vendor_cmd(struct hostapd_data *hapd,
284df5a7e4c5c64890c2425bb47d665bbce4992b676Dmitry Shmidt					 int vendor_id, int subcmd,
285df5a7e4c5c64890c2425bb47d665bbce4992b676Dmitry Shmidt					 const u8 *data, size_t data_len,
286df5a7e4c5c64890c2425bb47d665bbce4992b676Dmitry Shmidt					 struct wpabuf *buf)
287df5a7e4c5c64890c2425bb47d665bbce4992b676Dmitry Shmidt{
288df5a7e4c5c64890c2425bb47d665bbce4992b676Dmitry Shmidt	if (hapd->driver == NULL || hapd->driver->vendor_cmd == NULL)
289df5a7e4c5c64890c2425bb47d665bbce4992b676Dmitry Shmidt		return -1;
290df5a7e4c5c64890c2425bb47d665bbce4992b676Dmitry Shmidt	return hapd->driver->vendor_cmd(hapd->drv_priv, vendor_id, subcmd, data,
291df5a7e4c5c64890c2425bb47d665bbce4992b676Dmitry Shmidt					data_len, buf);
292df5a7e4c5c64890c2425bb47d665bbce4992b676Dmitry Shmidt}
293df5a7e4c5c64890c2425bb47d665bbce4992b676Dmitry Shmidt
2948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* AP_DRV_OPS */
295