• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * hostapd - Driver operations
3  * Copyright (c) 2009-2014, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 
9 #ifndef AP_DRV_OPS
10 #define AP_DRV_OPS
11 #ifdef LOS_WPA_PATCH
12 #include "drivers/driver.h"
13 #include "hostapd.h"
14 #endif
15 enum wpa_driver_if_type;
16 struct wpa_bss_params;
17 struct wpa_driver_scan_params;
18 struct ieee80211_ht_capabilities;
19 #ifndef EXT_CODE_CROP
20 struct ieee80211_vht_capabilities;
21 #endif /* EXT_CODE_CROP */
22 struct hostapd_freq_params;
23 
24 #ifdef CONFIG_WEP
25 int hostapd_set_privacy(struct hostapd_data *hapd, int enabled);
26 int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
27                   int enabled);
28 int hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
29 			     size_t elem_len);
30 int hostapd_set_ieee8021x(struct hostapd_data *hapd,
31 			  struct wpa_bss_params *params);
32 #endif
33 
34 u32 hostapd_sta_flags_to_drv(u32 flags);
35 int hostapd_build_ap_extra_ies(struct hostapd_data *hapd,
36 			       struct wpabuf **beacon,
37 			       struct wpabuf **proberesp,
38 			       struct wpabuf **assocresp);
39 void hostapd_free_ap_extra_ies(struct hostapd_data *hapd, struct wpabuf *beacon,
40 			       struct wpabuf *proberesp,
41 			       struct wpabuf *assocresp);
42 int hostapd_reset_ap_wps_ie(struct hostapd_data *hapd);
43 int hostapd_set_ap_wps_ie(struct hostapd_data *hapd);
44 
45 #ifndef LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT
46 int hostapd_set_authorized(struct hostapd_data *hapd,
47 			   struct sta_info *sta, int authorized);
48 int hostapd_set_sta_flags(struct hostapd_data *hapd, struct sta_info *sta);
49 int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname);
50 int hostapd_vlan_if_remove(struct hostapd_data *hapd, const char *ifname);
51 int hostapd_set_wds_sta(struct hostapd_data *hapd, char *ifname_wds,
52 			const u8 *addr, int aid, int val);
53 #endif /* LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT */
54 #ifndef EXT_CODE_CROP
55 int hostapd_sta_add(struct hostapd_data *hapd,
56 		    const u8 *addr, u16 aid, u16 capability,
57 		    const u8 *supp_rates, size_t supp_rates_len,
58 		    u16 listen_interval,
59 		    const struct ieee80211_ht_capabilities *ht_capab,
60 		    const struct ieee80211_vht_capabilities *vht_capab,
61 		    const struct ieee80211_he_capabilities *he_capab,
62 		    size_t he_capab_len,
63 		    const struct ieee80211_he_6ghz_band_cap *he_6ghz_capab,
64 		    u32 flags, u8 qosinfo, u8 vht_opmode, int supp_p2p_ps,
65 		    int set);
66 #else
67 int hostapd_sta_add(struct hostapd_data *hapd,
68 			const u8 *addr, u16 aid, u16 capability,
69 			const u8 *supp_rates, size_t supp_rates_len,
70 			u16 listen_interval,
71 			const struct ieee80211_ht_capabilities *ht_capab,
72 			u32 flags, u8 qosinfo, int supp_p2p_ps,
73 			int set);
74 #endif /* EXT_CODE_CROP */
75 #ifndef LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT
76 int hostapd_get_ssid(struct hostapd_data *hapd, u8 *buf, size_t len);
77 int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len);
78 int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
79 		   const char *ifname, const u8 *addr, void *bss_ctx,
80 		   void **drv_priv, char *force_ifname, u8 *if_addr,
81 		   const char *bridge, int use_existing);
82 int hostapd_if_remove(struct hostapd_data *hapd, enum wpa_driver_if_type type,
83 		      const char *ifname);
84 int hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd,
85 		       const u8 *addr, int idx, u8 *seq);
86 int hostapd_flush(struct hostapd_data *hapd);
87 #ifndef EXT_CODE_CROP
88 int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode,
89 		     int freq, int channel, int edmg, u8 edmg_channel,
90 		     int ht_enabled, int vht_enabled,
91 		     int he_enabled, int sec_channel_offset, int oper_chwidth,
92 		     int center_segment0, int center_segment1);
93 #else
94 int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode,
95 			 int freq, int channel, int ht_enabled,
96 			 int sec_channel_offset);
97 #endif /* EXT_CODE_CROP */
98 int hostapd_set_rts(struct hostapd_data *hapd, int rts);
99 int hostapd_set_frag(struct hostapd_data *hapd, int frag);
100 int hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
101 			  int total_flags, int flags_or, int flags_and);
102 int hostapd_sta_set_airtime_weight(struct hostapd_data *hapd, const u8 *addr,
103 				   unsigned int weight);
104 int hostapd_set_country(struct hostapd_data *hapd, const char *country);
105 int hostapd_set_tx_queue_params(struct hostapd_data *hapd, int queue, int aifs,
106 				int cw_min, int cw_max, int burst_time);
107 #endif /* LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT */
108 struct hostapd_hw_modes *
109 #ifndef EXT_CODE_CROP
110 hostapd_get_hw_feature_data(struct hostapd_data *hapd, u16 *num_modes,
111 			    u16 *flags, u8 *dfs_domain);
112 #else
113 hostapd_get_hw_feature_data(struct hostapd_data *hapd, u16 *num_modes,
114 			    u16 *flags);
115 #endif /* EXT_CODE_CROP */
116 #ifndef LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT
117 int hostapd_driver_commit(struct hostapd_data *hapd);
118 int hostapd_drv_none(struct hostapd_data *hapd);
119 #endif /* LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT */
120 bool hostapd_drv_nl80211(struct hostapd_data *hapd);
121 int hostapd_driver_scan(struct hostapd_data *hapd,
122 			struct wpa_driver_scan_params *params);
123 struct wpa_scan_results * hostapd_driver_get_scan_results(
124 	struct hostapd_data *hapd);
125 int hostapd_driver_set_noa(struct hostapd_data *hapd, u8 count, int start,
126 			   int duration);
127 int hostapd_drv_set_key(const char *ifname,
128 			struct hostapd_data *hapd,
129 			enum wpa_alg alg, const u8 *addr,
130 			int key_idx, int vlan_id, int set_tx,
131 			const u8 *seq, size_t seq_len,
132 			const u8 *key, size_t key_len, enum key_flag key_flag);
133 int hostapd_drv_send_mlme(struct hostapd_data *hapd,
134 			  const void *msg, size_t len, int noack,
135 			  const u16 *csa_offs, size_t csa_offs_len,
136 			  int no_encrypt);
137 #ifdef LOS_CONFIG_P2P
138 int hostapd_drv_sta_deauth(struct hostapd_data *hapd,
139 			   const u8 *addr, int reason);
140 #endif /* LOS_CONFIG_P2P */
141 #ifndef EXT_CODE_CROP
142 int hostapd_drv_sta_disassoc(struct hostapd_data *hapd,
143 			     const u8 *addr, int reason);
144 #endif /* EXT_CODE_CROP */
145 int hostapd_drv_send_action(struct hostapd_data *hapd, unsigned int freq,
146 			    unsigned int wait, const u8 *dst, const u8 *data,
147 			    size_t len);
148 int hostapd_drv_send_action_addr3_ap(struct hostapd_data *hapd,
149 				     unsigned int freq,
150 				     unsigned int wait, const u8 *dst,
151 				     const u8 *data, size_t len);
152 int hostapd_drv_do_acs(struct hostapd_data *hapd);
153 #ifndef LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT
154 static inline void
hostapd_drv_send_action_cancel_wait(struct hostapd_data * hapd)155 hostapd_drv_send_action_cancel_wait(struct hostapd_data *hapd)
156 {
157 	if (!hapd->driver || !hapd->driver->send_action_cancel_wait ||
158 	    !hapd->drv_priv)
159 		return;
160 	hapd->driver->send_action_cancel_wait(hapd->drv_priv);
161 }
162 int hostapd_add_sta_node(struct hostapd_data *hapd, const u8 *addr,
163 			 u16 auth_alg);
164 int hostapd_sta_auth(struct hostapd_data *hapd, const u8 *addr,
165 		     u16 seq, u16 status, const u8 *ie, size_t len);
166 int hostapd_sta_assoc(struct hostapd_data *hapd, const u8 *addr,
167 		      int reassoc, u16 status, const u8 *ie, size_t len);
168 int hostapd_add_tspec(struct hostapd_data *hapd, const u8 *addr,
169 		      u8 *tspec_ie, size_t tspec_ielen);
170 #ifndef EXT_CODE_CROP
171 int hostapd_start_dfs_cac(struct hostapd_iface *iface,
172 			  enum hostapd_hw_mode mode, int freq,
173 			  int channel, int ht_enabled, int vht_enabled,
174 			  int he_enabled,
175 			  int sec_channel_offset, int oper_chwidth,
176 			  int center_segment0, int center_segment1);
177 #endif /* EXT_CODE_CROP */
178 #ifdef CONFIG_OWE
179 int hostapd_drv_update_dh_ie(struct hostapd_data *hapd, const u8 *peer,
180 			     u16 reason_code, const u8 *ie, size_t ielen);
181 #endif /* CONFIG_OWE */
182 int hostapd_drv_dpp_listen(struct hostapd_data *hapd, bool enable);
183 
184 
185 
186 int hostapd_drv_wnm_oper(struct hostapd_data *hapd,
187 			 enum wnm_oper oper, const u8 *peer,
188 			 u8 *buf, u16 *buf_len);
189 
190 int hostapd_drv_set_qos_map(struct hostapd_data *hapd, const u8 *qos_map_set,
191 			    u8 qos_map_set_len);
192 
193 void hostapd_get_ext_capa(struct hostapd_iface *iface);
194 
hostapd_drv_set_countermeasures(struct hostapd_data * hapd,int enabled)195 static inline int hostapd_drv_set_countermeasures(struct hostapd_data *hapd,
196 						  int enabled)
197 {
198 	if (hapd->driver == NULL ||
199 	    hapd->driver->hapd_set_countermeasures == NULL)
200 		return 0;
201 	return hapd->driver->hapd_set_countermeasures(hapd->drv_priv, enabled);
202 }
203 
hostapd_drv_set_sta_vlan(const char * ifname,struct hostapd_data * hapd,const u8 * addr,int vlan_id)204 static inline int hostapd_drv_set_sta_vlan(const char *ifname,
205 					   struct hostapd_data *hapd,
206 					   const u8 *addr, int vlan_id)
207 {
208 	if (hapd->driver == NULL || hapd->driver->set_sta_vlan == NULL)
209 		return 0;
210 	return hapd->driver->set_sta_vlan(hapd->drv_priv, addr, ifname,
211 					  vlan_id);
212 }
213 
hostapd_drv_get_inact_sec(struct hostapd_data * hapd,const u8 * addr)214 static inline int hostapd_drv_get_inact_sec(struct hostapd_data *hapd,
215 					    const u8 *addr)
216 {
217 	if (hapd->driver == NULL || hapd->driver->get_inact_sec == NULL)
218 		return 0;
219 	return hapd->driver->get_inact_sec(hapd->drv_priv, addr);
220 }
221 #endif /* LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT */
222 
hostapd_drv_sta_remove(struct hostapd_data * hapd,const u8 * addr)223 static inline int hostapd_drv_sta_remove(struct hostapd_data *hapd,
224 					 const u8 *addr)
225 {
226 	if (!hapd->driver || !hapd->driver->sta_remove || !hapd->drv_priv)
227 		return 0;
228 	return hapd->driver->sta_remove(hapd->drv_priv, addr);
229 }
230 
hostapd_drv_hapd_send_eapol(struct hostapd_data * hapd,const u8 * addr,const u8 * data,size_t data_len,int encrypt,u32 flags)231 static inline int hostapd_drv_hapd_send_eapol(struct hostapd_data *hapd,
232 					      const u8 *addr, const u8 *data,
233 					      size_t data_len, int encrypt,
234 					      u32 flags)
235 {
236 	if (hapd->driver == NULL || hapd->driver->hapd_send_eapol == NULL)
237 		return 0;
238 	return hapd->driver->hapd_send_eapol(hapd->drv_priv, addr, data,
239 					     data_len, encrypt,
240 					     hapd->own_addr, flags);
241 }
242 
243 #ifndef LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT
hostapd_drv_read_sta_data(struct hostapd_data * hapd,struct hostap_sta_driver_data * data,const u8 * addr)244 static inline int hostapd_drv_read_sta_data(
245 	struct hostapd_data *hapd, struct hostap_sta_driver_data *data,
246 	const u8 *addr)
247 {
248 	if (hapd->driver == NULL || hapd->driver->read_sta_data == NULL)
249 		return -1;
250 	return hapd->driver->read_sta_data(hapd->drv_priv, data, addr);
251 }
252 
hostapd_drv_sta_clear_stats(struct hostapd_data * hapd,const u8 * addr)253 static inline int hostapd_drv_sta_clear_stats(struct hostapd_data *hapd,
254 					      const u8 *addr)
255 {
256 	if (hapd->driver == NULL || hapd->driver->sta_clear_stats == NULL)
257 		return 0;
258 	return hapd->driver->sta_clear_stats(hapd->drv_priv, addr);
259 }
260 
hostapd_drv_set_acl(struct hostapd_data * hapd,struct hostapd_acl_params * params)261 static inline int hostapd_drv_set_acl(struct hostapd_data *hapd,
262 				      struct hostapd_acl_params *params)
263 {
264 	if (hapd->driver == NULL || hapd->driver->set_acl == NULL)
265 		return 0;
266 	return hapd->driver->set_acl(hapd->drv_priv, params);
267 }
268 #endif /* LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT */
hostapd_drv_set_ap(struct hostapd_data * hapd,struct wpa_driver_ap_params * params)269 static inline int hostapd_drv_set_ap(struct hostapd_data *hapd,
270 				     struct wpa_driver_ap_params *params)
271 {
272 	if (hapd->driver == NULL || hapd->driver->set_ap == NULL)
273 		return 0;
274 	return hapd->driver->set_ap(hapd->drv_priv, params);
275 }
276 
277 #ifdef CONFIG_WEP
hostapd_drv_set_authmode(struct hostapd_data * hapd,int auth_algs)278 static inline int hostapd_drv_set_authmode(struct hostapd_data *hapd,
279 					   int auth_algs)
280 {
281 	if (hapd->driver == NULL || hapd->driver->set_authmode == NULL)
282 		return 0;
283 	return hapd->driver->set_authmode(hapd->drv_priv, auth_algs);
284 }
285 #endif /* CONFIG_WEP */
286 
287 #ifndef LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT
hostapd_drv_set_radius_acl_auth(struct hostapd_data * hapd,const u8 * mac,int accepted,u32 session_timeout)288 static inline int hostapd_drv_set_radius_acl_auth(struct hostapd_data *hapd,
289 						  const u8 *mac, int accepted,
290 						  u32 session_timeout)
291 {
292 	if (hapd->driver == NULL || hapd->driver->set_radius_acl_auth == NULL)
293 		return 0;
294 	return hapd->driver->set_radius_acl_auth(hapd->drv_priv, mac, accepted,
295 						 session_timeout);
296 }
297 
hostapd_drv_set_radius_acl_expire(struct hostapd_data * hapd,const u8 * mac)298 static inline int hostapd_drv_set_radius_acl_expire(struct hostapd_data *hapd,
299 						    const u8 *mac)
300 {
301 	if (hapd->driver == NULL ||
302 	    hapd->driver->set_radius_acl_expire == NULL)
303 		return 0;
304 	return hapd->driver->set_radius_acl_expire(hapd->drv_priv, mac);
305 }
306 
hostapd_drv_poll_client(struct hostapd_data * hapd,const u8 * own_addr,const u8 * addr,int qos)307 static inline void hostapd_drv_poll_client(struct hostapd_data *hapd,
308 					   const u8 *own_addr, const u8 *addr,
309 					   int qos)
310 {
311 	if (hapd->driver == NULL || hapd->driver->poll_client == NULL)
312 		return;
313 	hapd->driver->poll_client(hapd->drv_priv, own_addr, addr, qos);
314 }
315 #endif /* LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT */
316 #if !defined(LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT) || defined(CONFIG_ACS)
hostapd_drv_get_survey(struct hostapd_data * hapd,unsigned int freq)317 static inline int hostapd_drv_get_survey(struct hostapd_data *hapd,
318 					 unsigned int freq)
319 {
320 	if (hapd->driver == NULL)
321 		return -1;
322 	if (!hapd->driver->get_survey)
323 		return -1;
324 	return hapd->driver->get_survey(hapd->drv_priv, freq);
325 }
326 #endif
327 #ifndef LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT
hostapd_get_country(struct hostapd_data * hapd,char * alpha2)328 static inline int hostapd_get_country(struct hostapd_data *hapd, char *alpha2)
329 {
330 	if (hapd->driver == NULL || hapd->driver->get_country == NULL)
331 		return -1;
332 	return hapd->driver->get_country(hapd->drv_priv, alpha2);
333 }
334 
hostapd_drv_get_radio_name(struct hostapd_data * hapd)335 static inline const char * hostapd_drv_get_radio_name(struct hostapd_data *hapd)
336 {
337 	if (hapd->driver == NULL || hapd->drv_priv == NULL ||
338 	    hapd->driver->get_radio_name == NULL)
339 		return NULL;
340 	return hapd->driver->get_radio_name(hapd->drv_priv);
341 }
342 
hostapd_drv_switch_channel(struct hostapd_data * hapd,struct csa_settings * settings)343 static inline int hostapd_drv_switch_channel(struct hostapd_data *hapd,
344 					     struct csa_settings *settings)
345 {
346 	if (hapd->driver == NULL || hapd->driver->switch_channel == NULL ||
347 	    hapd->drv_priv == NULL)
348 		return -1;
349 
350 	return hapd->driver->switch_channel(hapd->drv_priv, settings);
351 }
352 
hostapd_drv_status(struct hostapd_data * hapd,char * buf,size_t buflen)353 static inline int hostapd_drv_status(struct hostapd_data *hapd, char *buf,
354 				     size_t buflen)
355 {
356 	if (!hapd->driver || !hapd->driver->status || !hapd->drv_priv)
357 		return -1;
358 	return hapd->driver->status(hapd->drv_priv, buf, buflen);
359 }
360 
hostapd_drv_br_add_ip_neigh(struct hostapd_data * hapd,int version,const u8 * ipaddr,int prefixlen,const u8 * addr)361 static inline int hostapd_drv_br_add_ip_neigh(struct hostapd_data *hapd,
362 					      int version, const u8 *ipaddr,
363 					      int prefixlen, const u8 *addr)
364 {
365 	if (hapd->driver == NULL || hapd->drv_priv == NULL ||
366 	    hapd->driver->br_add_ip_neigh == NULL)
367 		return -1;
368 	return hapd->driver->br_add_ip_neigh(hapd->drv_priv, version, ipaddr,
369 					     prefixlen, addr);
370 }
371 
hostapd_drv_br_delete_ip_neigh(struct hostapd_data * hapd,u8 version,const u8 * ipaddr)372 static inline int hostapd_drv_br_delete_ip_neigh(struct hostapd_data *hapd,
373 						 u8 version, const u8 *ipaddr)
374 {
375 	if (hapd->driver == NULL || hapd->drv_priv == NULL ||
376 	    hapd->driver->br_delete_ip_neigh == NULL)
377 		return -1;
378 	return hapd->driver->br_delete_ip_neigh(hapd->drv_priv, version,
379 						ipaddr);
380 }
381 
hostapd_drv_br_port_set_attr(struct hostapd_data * hapd,enum drv_br_port_attr attr,unsigned int val)382 static inline int hostapd_drv_br_port_set_attr(struct hostapd_data *hapd,
383 					       enum drv_br_port_attr attr,
384 					       unsigned int val)
385 {
386 	if (hapd->driver == NULL || hapd->drv_priv == NULL ||
387 	    hapd->driver->br_port_set_attr == NULL)
388 		return -1;
389 	return hapd->driver->br_port_set_attr(hapd->drv_priv, attr, val);
390 }
391 
hostapd_drv_br_set_net_param(struct hostapd_data * hapd,enum drv_br_net_param param,unsigned int val)392 static inline int hostapd_drv_br_set_net_param(struct hostapd_data *hapd,
393 					       enum drv_br_net_param param,
394 					       unsigned int val)
395 {
396 	if (hapd->driver == NULL || hapd->drv_priv == NULL ||
397 	    hapd->driver->br_set_net_param == NULL)
398 		return -1;
399 	return hapd->driver->br_set_net_param(hapd->drv_priv, param, val);
400 }
401 
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)402 static inline int hostapd_drv_vendor_cmd(struct hostapd_data *hapd,
403 					 int vendor_id, int subcmd,
404 					 const u8 *data, size_t data_len,
405 					 enum nested_attr nested_attr_flag,
406 					 struct wpabuf *buf)
407 {
408 	if (hapd->driver == NULL || hapd->driver->vendor_cmd == NULL)
409 		return -1;
410 	return hapd->driver->vendor_cmd(hapd->drv_priv, vendor_id, subcmd, data,
411 					data_len, nested_attr_flag, buf);
412 }
413 
hostapd_drv_stop_ap(struct hostapd_data * hapd)414 static inline int hostapd_drv_stop_ap(struct hostapd_data *hapd)
415 {
416 	if (!hapd->driver || !hapd->driver->stop_ap || !hapd->drv_priv)
417 		return 0;
418 	return hapd->driver->stop_ap(hapd->drv_priv);
419 }
420 
hostapd_drv_channel_info(struct hostapd_data * hapd,struct wpa_channel_info * ci)421 static inline int hostapd_drv_channel_info(struct hostapd_data *hapd,
422 					   struct wpa_channel_info *ci)
423 {
424 	if (!hapd->driver || !hapd->driver->channel_info)
425 		return -1;
426 	return hapd->driver->channel_info(hapd->drv_priv, ci);
427 }
428 
429 #endif /* LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT */
430 #ifdef CONFIG_HOSTAPD_WPA3
431 static inline int
hostapd_drv_send_external_auth_status(struct hostapd_data * hapd,struct external_auth * params)432 hostapd_drv_send_external_auth_status(struct hostapd_data *hapd,
433 				      struct external_auth *params)
434 {
435 	if (!hapd->driver || !hapd->drv_priv ||
436 	    !hapd->driver->send_external_auth_status)
437 		return -1;
438 	return hapd->driver->send_external_auth_status(hapd->drv_priv, params);
439 }
440 #endif /* CONFIG_HOSTAPD_WPA3 */
441 
442 static inline int
hostapd_drv_set_band(struct hostapd_data * hapd,u32 band_mask)443 hostapd_drv_set_band(struct hostapd_data *hapd, u32 band_mask)
444 {
445 	if (!hapd->driver || !hapd->drv_priv || !hapd->driver->set_band)
446 		return -1;
447 	return hapd->driver->set_band(hapd->drv_priv, band_mask);
448 }
449 
450 #ifdef ANDROID
hostapd_drv_driver_cmd(struct hostapd_data * hapd,char * cmd,char * buf,size_t buf_len)451 static inline int hostapd_drv_driver_cmd(struct hostapd_data *hapd,
452 					 char *cmd, char *buf, size_t buf_len)
453 {
454 	if (!hapd->driver->driver_cmd)
455 		return -1;
456 	return hapd->driver->driver_cmd(hapd->drv_priv, cmd, buf, buf_len);
457 }
458 #endif /* ANDROID */
459 
460 #ifdef CONFIG_TESTING_OPTIONS
461 static inline int
hostapd_drv_register_frame(struct hostapd_data * hapd,u16 type,const u8 * match,size_t match_len,bool multicast)462 hostapd_drv_register_frame(struct hostapd_data *hapd, u16 type,
463 			   const u8 *match, size_t match_len,
464 			   bool multicast)
465 {
466 	if (!hapd->driver || !hapd->drv_priv || !hapd->driver->register_frame)
467 		return -1;
468 	return hapd->driver->register_frame(hapd->drv_priv, type, match,
469 					    match_len, multicast);
470 }
471 #endif /* CONFIG_TESTING_OPTIONS */
472 
473 #endif /* AP_DRV_OPS */
474