wpa_supplicant: update vendor branch to 0.6.10
[dragonfly.git] / contrib / hostapd / driver.h
1 #ifndef DRIVER_H
2 #define DRIVER_H
3
4 enum hostapd_driver_if_type {
5         HOSTAPD_IF_VLAN, HOSTAPD_IF_WDS
6 };
7
8 struct driver_ops {
9         const char *name;               /* as appears in the config file */
10
11         int (*init)(struct hostapd_data *hapd);
12         void (*deinit)(void *priv);
13
14         int (*wireless_event_init)(void *priv);
15         void (*wireless_event_deinit)(void *priv);
16
17         /**
18          * set_8021x - enable/disable IEEE 802.1X support
19          * @ifname: Interface name (for multi-SSID/VLAN support)
20          * @priv: driver private data
21          * @enabled: 1 = enable, 0 = disable
22          *
23          * Returns: 0 on success, -1 on failure
24          *
25          * Configure the kernel driver to enable/disable 802.1X support.
26          * This may be an empty function if 802.1X support is always enabled.
27          */
28         int (*set_ieee8021x)(const char *ifname, void *priv, int enabled);
29
30         /**
31          * set_privacy - enable/disable privacy
32          * @priv: driver private data
33          * @enabled: 1 = privacy enabled, 0 = disabled
34          *
35          * Return: 0 on success, -1 on failure
36          *
37          * Configure privacy.
38          */
39         int (*set_privacy)(const char *ifname, void *priv, int enabled);
40
41         int (*set_encryption)(const char *ifname, void *priv, const char *alg,
42                               const u8 *addr, int idx,
43                               const u8 *key, size_t key_len, int txkey);
44         int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
45                           int idx, u8 *seq);
46         int (*get_seqnum_igtk)(const char *ifname, void *priv, const u8 *addr,
47                                int idx, u8 *seq);
48         int (*flush)(void *priv);
49         int (*set_generic_elem)(const char *ifname, void *priv, const u8 *elem,
50                                 size_t elem_len);
51
52         int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data,
53                              const u8 *addr);
54         int (*send_eapol)(void *priv, const u8 *addr, const u8 *data,
55                           size_t data_len, int encrypt, const u8 *own_addr);
56         int (*sta_deauth)(void *priv, const u8 *addr, int reason);
57         int (*sta_disassoc)(void *priv, const u8 *addr, int reason);
58         int (*sta_remove)(void *priv, const u8 *addr);
59         int (*get_ssid)(const char *ifname, void *priv, u8 *buf, int len);
60         int (*set_ssid)(const char *ifname, void *priv, const u8 *buf,
61                         int len);
62         int (*set_countermeasures)(void *priv, int enabled);
63         int (*send_mgmt_frame)(void *priv, const void *msg, size_t len,
64                                int flags);
65         int (*set_assoc_ap)(void *priv, const u8 *addr);
66         int (*sta_add)(const char *ifname, void *priv, const u8 *addr, u16 aid,
67                        u16 capability, u8 *supp_rates, size_t supp_rates_len,
68                        int flags);
69         int (*get_inact_sec)(void *priv, const u8 *addr);
70         int (*sta_clear_stats)(void *priv, const u8 *addr);
71
72         int (*set_freq)(void *priv, int mode, int freq);
73         int (*set_rts)(void *priv, int rts);
74         int (*get_rts)(void *priv, int *rts);
75         int (*set_frag)(void *priv, int frag);
76         int (*get_frag)(void *priv, int *frag);
77         int (*set_retry)(void *priv, int short_retry, int long_retry);
78         int (*get_retry)(void *priv, int *short_retry, int *long_retry);
79
80         int (*sta_set_flags)(void *priv, const u8 *addr,
81                              int flags_or, int flags_and);
82         int (*set_rate_sets)(void *priv, int *supp_rates, int *basic_rates,
83                              int mode);
84         int (*set_channel_flag)(void *priv, int mode, int chan, int flag,
85                                 unsigned char power_level,
86                                 unsigned char antenna_max);
87         int (*set_regulatory_domain)(void *priv, unsigned int rd);
88         int (*set_country)(void *priv, const char *country);
89         int (*set_ieee80211d)(void *priv, int enabled);
90         int (*set_beacon)(const char *ifname, void *priv,
91                           u8 *head, size_t head_len,
92                           u8 *tail, size_t tail_len);
93
94         /* Configure internal bridge:
95          * 0 = disabled, i.e., client separation is enabled (no bridging of
96          *     packets between associated STAs
97          * 1 = enabled, i.e., bridge packets between associated STAs (default)
98          */
99         int (*set_internal_bridge)(void *priv, int value);
100         int (*set_beacon_int)(void *priv, int value);
101         int (*set_dtim_period)(const char *ifname, void *priv, int value);
102         /* Configure broadcast SSID mode:
103          * 0 = include SSID in Beacon frames and reply to Probe Request frames
104          *     that use broadcast SSID
105          * 1 = hide SSID from Beacon frames and ignore Probe Request frames for
106          *     broadcast SSID
107          */
108         int (*set_broadcast_ssid)(void *priv, int value);
109         int (*set_cts_protect)(void *priv, int value);
110         int (*set_key_tx_rx_threshold)(void *priv, int value);
111         int (*set_preamble)(void *priv, int value);
112         int (*set_short_slot_time)(void *priv, int value);
113         int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min,
114                                    int cw_max, int burst_time);
115         int (*bss_add)(void *priv, const char *ifname, const u8 *bssid);
116         int (*bss_remove)(void *priv, const char *ifname);
117         int (*valid_bss_mask)(void *priv, const u8 *addr, const u8 *mask);
118         int (*passive_scan)(void *priv, int now, int our_mode_only,
119                             int interval, int _listen, int *channel,
120                             int *last_rx);
121         struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
122                                                          u16 *num_modes,
123                                                          u16 *flags);
124         int (*if_add)(const char *iface, void *priv,
125                       enum hostapd_driver_if_type type, char *ifname,
126                       const u8 *addr);
127         int (*if_update)(void *priv, enum hostapd_driver_if_type type,
128                          char *ifname, const u8 *addr);
129         int (*if_remove)(void *priv, enum hostapd_driver_if_type type,
130                          const char *ifname, const u8 *addr);
131         int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
132                             int vlan_id);
133         /**
134          * commit - Optional commit changes handler
135          * @priv: driver private data
136          * Returns: 0 on success, -1 on failure
137          *
138          * This optional handler function can be registered if the driver
139          * interface implementation needs to commit changes (e.g., by setting
140          * network interface up) at the end of initial configuration. If set,
141          * this handler will be called after initial setup has been completed.
142          */
143         int (*commit)(void *priv);
144 };
145
146 static inline int
147 hostapd_driver_init(struct hostapd_data *hapd)
148 {
149         if (hapd->driver == NULL || hapd->driver->init == NULL)
150                 return -1;
151         return hapd->driver->init(hapd);
152 }
153
154 static inline void
155 hostapd_driver_deinit(struct hostapd_data *hapd)
156 {
157         if (hapd->driver == NULL || hapd->driver->deinit == NULL)
158                 return;
159         hapd->driver->deinit(hapd->driver);
160 }
161
162 static inline int
163 hostapd_wireless_event_init(struct hostapd_data *hapd)
164 {
165         if (hapd->driver == NULL ||
166             hapd->driver->wireless_event_init == NULL)
167                 return 0;
168         return hapd->driver->wireless_event_init(hapd->driver);
169 }
170
171 static inline void
172 hostapd_wireless_event_deinit(struct hostapd_data *hapd)
173 {
174         if (hapd->driver == NULL ||
175             hapd->driver->wireless_event_deinit == NULL)
176                 return;
177         hapd->driver->wireless_event_deinit(hapd->driver);
178 }
179
180 static inline int
181 hostapd_set_ieee8021x(const char *ifname, struct hostapd_data *hapd,
182                       int enabled)
183 {
184         if (hapd->driver == NULL || hapd->driver->set_ieee8021x == NULL)
185                 return 0;
186         return hapd->driver->set_ieee8021x(ifname, hapd->driver, enabled);
187 }
188
189 static inline int
190 hostapd_set_privacy(struct hostapd_data *hapd, int enabled)
191 {
192         if (hapd->driver == NULL || hapd->driver->set_privacy == NULL)
193                 return 0;
194         return hapd->driver->set_privacy(hapd->conf->iface, hapd->driver,
195                                          enabled);
196 }
197
198 static inline int
199 hostapd_set_encryption(const char *ifname, struct hostapd_data *hapd,
200                        const char *alg, const u8 *addr, int idx,
201                        u8 *key, size_t key_len, int txkey)
202 {
203         if (hapd->driver == NULL || hapd->driver->set_encryption == NULL)
204                 return 0;
205         return hapd->driver->set_encryption(ifname, hapd->driver, alg, addr,
206                                             idx, key, key_len, txkey);
207 }
208
209 static inline int
210 hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd,
211                    const u8 *addr, int idx, u8 *seq)
212 {
213         if (hapd->driver == NULL || hapd->driver->get_seqnum == NULL)
214                 return 0;
215         return hapd->driver->get_seqnum(ifname, hapd->driver, addr, idx, seq);
216 }
217
218 static inline int
219 hostapd_get_seqnum_igtk(const char *ifname, struct hostapd_data *hapd,
220                         const u8 *addr, int idx, u8 *seq)
221 {
222         if (hapd->driver == NULL || hapd->driver->get_seqnum_igtk == NULL)
223                 return -1;
224         return hapd->driver->get_seqnum_igtk(ifname, hapd->driver, addr, idx,
225                                              seq);
226 }
227
228 static inline int
229 hostapd_flush(struct hostapd_data *hapd)
230 {
231         if (hapd->driver == NULL || hapd->driver->flush == NULL)
232                 return 0;
233         return hapd->driver->flush(hapd->driver);
234 }
235
236 static inline int
237 hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
238                          size_t elem_len)
239 {
240         if (hapd->driver == NULL || hapd->driver->set_generic_elem == NULL)
241                 return 0;
242         return hapd->driver->set_generic_elem(hapd->conf->iface, hapd->driver,
243                                               elem, elem_len);
244 }
245
246 static inline int
247 hostapd_read_sta_data(struct hostapd_data *hapd,
248                       struct hostap_sta_driver_data *data, const u8 *addr)
249 {
250         if (hapd->driver == NULL || hapd->driver->read_sta_data == NULL)
251                 return -1;
252         return hapd->driver->read_sta_data(hapd->driver, data, addr);
253 }
254
255 static inline int
256 hostapd_send_eapol(struct hostapd_data *hapd, const u8 *addr, const u8 *data,
257                    size_t data_len, int encrypt)
258 {
259         if (hapd->driver == NULL || hapd->driver->send_eapol == NULL)
260                 return 0;
261         return hapd->driver->send_eapol(hapd->driver, addr, data, data_len,
262                                         encrypt, hapd->own_addr);
263 }
264
265 static inline int
266 hostapd_sta_deauth(struct hostapd_data *hapd, const u8 *addr, int reason)
267 {
268         if (hapd->driver == NULL || hapd->driver->sta_deauth == NULL)
269                 return 0;
270         return hapd->driver->sta_deauth(hapd->driver, addr, reason);
271 }
272
273 static inline int
274 hostapd_sta_disassoc(struct hostapd_data *hapd, const u8 *addr, int reason)
275 {
276         if (hapd->driver == NULL || hapd->driver->sta_disassoc == NULL)
277                 return 0;
278         return hapd->driver->sta_disassoc(hapd->driver, addr, reason);
279 }
280
281 static inline int
282 hostapd_sta_remove(struct hostapd_data *hapd, const u8 *addr)
283 {
284         if (hapd->driver == NULL || hapd->driver->sta_remove == NULL)
285                 return 0;
286         return hapd->driver->sta_remove(hapd->driver, addr);
287 }
288
289 static inline int
290 hostapd_get_ssid(struct hostapd_data *hapd, u8 *buf, size_t len)
291 {
292         if (hapd->driver == NULL || hapd->driver->get_ssid == NULL)
293                 return 0;
294         return hapd->driver->get_ssid(hapd->conf->iface, hapd->driver, buf,
295                                       len);
296 }
297
298 static inline int
299 hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len)
300 {
301         if (hapd->driver == NULL || hapd->driver->set_ssid == NULL)
302                 return 0;
303         return hapd->driver->set_ssid(hapd->conf->iface, hapd->driver, buf,
304                                       len);
305 }
306
307 static inline int
308 hostapd_send_mgmt_frame(struct hostapd_data *hapd, const void *msg, size_t len,
309                         int flags)
310 {
311         if (hapd->driver == NULL || hapd->driver->send_mgmt_frame == NULL)
312                 return 0;
313         return hapd->driver->send_mgmt_frame(hapd->driver, msg, len, flags);
314 }
315
316 static inline int
317 hostapd_set_assoc_ap(struct hostapd_data *hapd, const u8 *addr)
318 {
319         if (hapd->driver == NULL || hapd->driver->set_assoc_ap == NULL)
320                 return 0;
321         return hapd->driver->set_assoc_ap(hapd->driver, addr);
322 }
323
324 static inline int
325 hostapd_set_countermeasures(struct hostapd_data *hapd, int enabled)
326 {
327         if (hapd->driver == NULL || hapd->driver->set_countermeasures == NULL)
328                 return 0;
329         return hapd->driver->set_countermeasures(hapd->driver, enabled);
330 }
331
332 static inline int
333 hostapd_sta_add(const char *ifname, struct hostapd_data *hapd, const u8 *addr,
334                 u16 aid, u16 capability, u8 *supp_rates, size_t supp_rates_len,
335                 int flags)
336 {
337         if (hapd->driver == NULL || hapd->driver->sta_add == NULL)
338                 return 0;
339         return hapd->driver->sta_add(ifname, hapd->driver, addr, aid,
340                                      capability, supp_rates, supp_rates_len,
341                                      flags);
342 }
343
344 static inline int
345 hostapd_get_inact_sec(struct hostapd_data *hapd, const u8 *addr)
346 {
347         if (hapd->driver == NULL || hapd->driver->get_inact_sec == NULL)
348                 return 0;
349         return hapd->driver->get_inact_sec(hapd->driver, addr);
350 }
351
352 static inline int
353 hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq)
354 {
355         if (hapd->driver == NULL || hapd->driver->set_freq == NULL)
356                 return 0;
357         return hapd->driver->set_freq(hapd->driver, mode, freq);
358 }
359
360 static inline int
361 hostapd_set_rts(struct hostapd_data *hapd, int rts)
362 {
363         if (hapd->driver == NULL || hapd->driver->set_rts == NULL)
364                 return 0;
365         return hapd->driver->set_rts(hapd->driver, rts);
366 }
367
368 static inline int
369 hostapd_get_rts(struct hostapd_data *hapd, int *rts)
370 {
371         if (hapd->driver == NULL || hapd->driver->get_rts == NULL)
372                 return 0;
373         return hapd->driver->get_rts(hapd->driver, rts);
374 }
375
376 static inline int
377 hostapd_set_frag(struct hostapd_data *hapd, int frag)
378 {
379         if (hapd->driver == NULL || hapd->driver->set_frag == NULL)
380                 return 0;
381         return hapd->driver->set_frag(hapd->driver, frag);
382 }
383
384 static inline int
385 hostapd_get_frag(struct hostapd_data *hapd, int *frag)
386 {
387         if (hapd->driver == NULL || hapd->driver->get_frag == NULL)
388                 return 0;
389         return hapd->driver->get_frag(hapd->driver, frag);
390 }
391
392 static inline int
393 hostapd_set_retry(struct hostapd_data *hapd, int short_retry, int long_retry)
394 {
395         if (hapd->driver == NULL || hapd->driver->set_retry == NULL)
396                 return 0;
397         return hapd->driver->set_retry(hapd->driver, short_retry, long_retry);
398 }
399
400 static inline int
401 hostapd_get_retry(struct hostapd_data *hapd, int *short_retry, int *long_retry)
402 {
403         if (hapd->driver == NULL || hapd->driver->get_retry == NULL)
404                 return 0;
405         return hapd->driver->get_retry(hapd->driver, short_retry, long_retry);
406 }
407
408 static inline int
409 hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
410                       int flags_or, int flags_and)
411 {
412         if (hapd->driver == NULL || hapd->driver->sta_set_flags == NULL)
413                 return 0;
414         return hapd->driver->sta_set_flags(hapd->driver, addr, flags_or,
415                                            flags_and);
416 }
417
418 static inline int
419 hostapd_set_rate_sets(struct hostapd_data *hapd, int *supp_rates,
420                       int *basic_rates, int mode)
421 {
422         if (hapd->driver == NULL || hapd->driver->set_rate_sets == NULL)
423                 return 0;
424         return hapd->driver->set_rate_sets(hapd->driver, supp_rates,
425                                            basic_rates, mode);
426 }
427
428 static inline int
429 hostapd_set_channel_flag(struct hostapd_data *hapd, int mode, int chan,
430                          int flag, unsigned char power_level,
431                          unsigned char antenna_max)
432 {
433         if (hapd->driver == NULL || hapd->driver->set_channel_flag == NULL)
434                 return 0;
435         return hapd->driver->set_channel_flag(hapd->driver, mode, chan, flag,
436                                               power_level, antenna_max);
437 }
438
439 static inline int
440 hostapd_set_regulatory_domain(struct hostapd_data *hapd, unsigned int rd)
441 {
442         if (hapd->driver == NULL ||
443             hapd->driver->set_regulatory_domain == NULL)
444                 return 0;
445         return hapd->driver->set_regulatory_domain(hapd->driver, rd);
446 }
447
448 static inline int
449 hostapd_set_country(struct hostapd_data *hapd, const char *country)
450 {
451         if (hapd->driver == NULL ||
452             hapd->driver->set_country == NULL)
453                 return 0;
454         return hapd->driver->set_country(hapd->driver, country);
455 }
456
457 static inline int
458 hostapd_set_ieee80211d(struct hostapd_data *hapd, int enabled)
459 {
460         if (hapd->driver == NULL ||
461             hapd->driver->set_ieee80211d == NULL)
462                 return 0;
463         return hapd->driver->set_ieee80211d(hapd->driver, enabled);
464 }
465
466 void driver_register(const char *name, const struct driver_ops *ops);
467 void driver_unregister(const char *name);
468 const struct driver_ops *driver_lookup(const char *name);
469
470 static inline int
471 hostapd_sta_clear_stats(struct hostapd_data *hapd, const u8 *addr)
472 {
473         if (hapd->driver == NULL || hapd->driver->sta_clear_stats == NULL)
474                 return 0;
475         return hapd->driver->sta_clear_stats(hapd->driver, addr);
476 }
477
478 static inline int
479 hostapd_set_beacon(const char *ifname, struct hostapd_data *hapd,
480                    u8 *head, size_t head_len,
481                    u8 *tail, size_t tail_len)
482 {
483         if (hapd->driver == NULL || hapd->driver->set_beacon == NULL)
484                 return 0;
485         return hapd->driver->set_beacon(ifname, hapd->driver, head, head_len,
486                                         tail, tail_len);
487 }
488
489 static inline int
490 hostapd_set_internal_bridge(struct hostapd_data *hapd, int value)
491 {
492         if (hapd->driver == NULL || hapd->driver->set_internal_bridge == NULL)
493                 return 0;
494         return hapd->driver->set_internal_bridge(hapd->driver, value);
495 }
496
497 static inline int
498 hostapd_set_beacon_int(struct hostapd_data *hapd, int value)
499 {
500         if (hapd->driver == NULL || hapd->driver->set_beacon_int == NULL)
501                 return 0;
502         return hapd->driver->set_beacon_int(hapd->driver, value);
503 }
504
505 static inline int
506 hostapd_set_dtim_period(struct hostapd_data *hapd, int value)
507 {
508         if (hapd->driver == NULL || hapd->driver->set_dtim_period == NULL)
509                 return 0;
510         return hapd->driver->set_dtim_period(hapd->conf->iface, hapd->driver,
511                                              value);
512 }
513
514 static inline int
515 hostapd_set_broadcast_ssid(struct hostapd_data *hapd, int value)
516 {
517         if (hapd->driver == NULL || hapd->driver->set_broadcast_ssid == NULL)
518                 return 0;
519         return hapd->driver->set_broadcast_ssid(hapd->driver, value);
520 }
521
522 static inline int
523 hostapd_set_cts_protect(struct hostapd_data *hapd, int value)
524 {
525         if (hapd->driver == NULL || hapd->driver->set_cts_protect == NULL)
526                 return 0;
527         return hapd->driver->set_cts_protect(hapd->driver, value);
528 }
529
530 static inline int
531 hostapd_set_key_tx_rx_threshold(struct hostapd_data *hapd, int value)
532 {
533         if (hapd->driver == NULL ||
534             hapd->driver->set_key_tx_rx_threshold == NULL)
535                 return 0;
536         return hapd->driver->set_key_tx_rx_threshold(hapd->driver, value);
537 }
538
539 static inline int
540 hostapd_set_preamble(struct hostapd_data *hapd, int value)
541 {
542         if (hapd->driver == NULL || hapd->driver->set_preamble == NULL)
543                 return 0;
544         return hapd->driver->set_preamble(hapd->driver, value);
545 }
546
547 static inline int
548 hostapd_set_short_slot_time(struct hostapd_data *hapd, int value)
549 {
550         if (hapd->driver == NULL || hapd->driver->set_short_slot_time == NULL)
551                 return 0;
552         return hapd->driver->set_short_slot_time(hapd->driver, value);
553 }
554
555 static inline int
556 hostapd_set_tx_queue_params(struct hostapd_data *hapd, int queue, int aifs,
557                             int cw_min, int cw_max, int burst_time)
558 {
559         if (hapd->driver == NULL || hapd->driver->set_tx_queue_params == NULL)
560                 return 0;
561         return hapd->driver->set_tx_queue_params(hapd->driver, queue, aifs,
562                                                  cw_min, cw_max, burst_time);
563 }
564
565 static inline int
566 hostapd_bss_add(struct hostapd_data *hapd, const char *ifname, const u8 *bssid)
567 {
568         if (hapd->driver == NULL || hapd->driver->bss_add == NULL)
569                 return 0;
570         return hapd->driver->bss_add(hapd->driver, ifname, bssid);
571 }
572
573 static inline int
574 hostapd_bss_remove(struct hostapd_data *hapd, const char *ifname)
575 {
576         if (hapd->driver == NULL || hapd->driver->bss_remove == NULL)
577                 return 0;
578         return hapd->driver->bss_remove(hapd->driver, ifname);
579 }
580
581 static inline int
582 hostapd_valid_bss_mask(struct hostapd_data *hapd, const u8 *addr,
583                        const u8 *mask)
584 {
585         if (hapd->driver == NULL || hapd->driver->valid_bss_mask == NULL)
586                 return 1;
587         return hapd->driver->valid_bss_mask(hapd->driver, addr, mask);
588 }
589
590 static inline int
591 hostapd_if_add(struct hostapd_data *hapd, enum hostapd_driver_if_type type,
592                char *ifname, const u8 *addr)
593 {
594         if (hapd->driver == NULL || hapd->driver->if_add == NULL)
595                 return -1;
596         return hapd->driver->if_add(hapd->conf->iface, hapd->driver, type,
597                                     ifname, addr);
598 }
599
600 static inline int
601 hostapd_if_update(struct hostapd_data *hapd, enum hostapd_driver_if_type type,
602                   char *ifname, const u8 *addr)
603 {
604         if (hapd->driver == NULL || hapd->driver->if_update == NULL)
605                 return -1;
606         return hapd->driver->if_update(hapd->driver, type, ifname, addr);
607 }
608
609 static inline int
610 hostapd_if_remove(struct hostapd_data *hapd, enum hostapd_driver_if_type type,
611                   char *ifname, const u8 *addr)
612 {
613         if (hapd->driver == NULL || hapd->driver->if_remove == NULL)
614                 return -1;
615         return hapd->driver->if_remove(hapd->driver, type, ifname, addr);
616 }
617
618 static inline int
619 hostapd_passive_scan(struct hostapd_data *hapd, int now, int our_mode_only,
620                      int interval, int _listen, int *channel,
621                      int *last_rx)
622 {
623         if (hapd->driver == NULL || hapd->driver->passive_scan == NULL)
624                 return -1;
625         return hapd->driver->passive_scan(hapd->driver, now, our_mode_only,
626                                           interval, _listen, channel, last_rx);
627 }
628
629 static inline struct hostapd_hw_modes *
630 hostapd_get_hw_feature_data(struct hostapd_data *hapd, u16 *num_modes,
631                             u16 *flags)
632 {
633         if (hapd->driver == NULL || hapd->driver->get_hw_feature_data == NULL)
634                 return NULL;
635         return hapd->driver->get_hw_feature_data(hapd->driver, num_modes,
636                                                  flags);
637 }
638
639 static inline int
640 hostapd_set_sta_vlan(const char *ifname, struct hostapd_data *hapd,
641                      const u8 *addr, int vlan_id)
642 {
643         if (hapd->driver == NULL || hapd->driver->set_sta_vlan == NULL)
644                 return 0;
645         return hapd->driver->set_sta_vlan(hapd->driver, addr, ifname, vlan_id);
646 }
647
648 static inline int
649 hostapd_driver_commit(struct hostapd_data *hapd)
650 {
651         if (hapd->driver == NULL || hapd->driver->commit == NULL)
652                 return 0;
653         return hapd->driver->commit(hapd->driver);
654 }
655
656 #endif /* DRIVER_H */