]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - contrib/hostapd/driver.h
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.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         int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted, 
146                         u32 session_timeout);
147         int (*set_radius_acl_expire)(void *priv, const u8 *mac);
148 };
149
150 static inline int
151 hostapd_driver_init(struct hostapd_data *hapd)
152 {
153         if (hapd->driver == NULL || hapd->driver->init == NULL)
154                 return -1;
155         return hapd->driver->init(hapd);
156 }
157
158 static inline void
159 hostapd_driver_deinit(struct hostapd_data *hapd)
160 {
161         if (hapd->driver == NULL || hapd->driver->deinit == NULL)
162                 return;
163         hapd->driver->deinit(hapd->driver);
164 }
165
166 static inline int
167 hostapd_wireless_event_init(struct hostapd_data *hapd)
168 {
169         if (hapd->driver == NULL ||
170             hapd->driver->wireless_event_init == NULL)
171                 return 0;
172         return hapd->driver->wireless_event_init(hapd->driver);
173 }
174
175 static inline void
176 hostapd_wireless_event_deinit(struct hostapd_data *hapd)
177 {
178         if (hapd->driver == NULL ||
179             hapd->driver->wireless_event_deinit == NULL)
180                 return;
181         hapd->driver->wireless_event_deinit(hapd->driver);
182 }
183
184 static inline int
185 hostapd_set_ieee8021x(const char *ifname, struct hostapd_data *hapd,
186                       int enabled)
187 {
188         if (hapd->driver == NULL || hapd->driver->set_ieee8021x == NULL)
189                 return 0;
190         return hapd->driver->set_ieee8021x(ifname, hapd->driver, enabled);
191 }
192
193 static inline int
194 hostapd_set_privacy(struct hostapd_data *hapd, int enabled)
195 {
196         if (hapd->driver == NULL || hapd->driver->set_privacy == NULL)
197                 return 0;
198         return hapd->driver->set_privacy(hapd->conf->iface, hapd->driver,
199                                          enabled);
200 }
201
202 static inline int
203 hostapd_set_encryption(const char *ifname, struct hostapd_data *hapd,
204                        const char *alg, const u8 *addr, int idx,
205                        u8 *key, size_t key_len, int txkey)
206 {
207         if (hapd->driver == NULL || hapd->driver->set_encryption == NULL)
208                 return 0;
209         return hapd->driver->set_encryption(ifname, hapd->driver, alg, addr,
210                                             idx, key, key_len, txkey);
211 }
212
213 static inline int
214 hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd,
215                    const u8 *addr, int idx, u8 *seq)
216 {
217         if (hapd->driver == NULL || hapd->driver->get_seqnum == NULL)
218                 return 0;
219         return hapd->driver->get_seqnum(ifname, hapd->driver, addr, idx, seq);
220 }
221
222 static inline int
223 hostapd_get_seqnum_igtk(const char *ifname, struct hostapd_data *hapd,
224                         const u8 *addr, int idx, u8 *seq)
225 {
226         if (hapd->driver == NULL || hapd->driver->get_seqnum_igtk == NULL)
227                 return -1;
228         return hapd->driver->get_seqnum_igtk(ifname, hapd->driver, addr, idx,
229                                              seq);
230 }
231
232 static inline int
233 hostapd_flush(struct hostapd_data *hapd)
234 {
235         if (hapd->driver == NULL || hapd->driver->flush == NULL)
236                 return 0;
237         return hapd->driver->flush(hapd->driver);
238 }
239
240 static inline int
241 hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
242                          size_t elem_len)
243 {
244         if (hapd->driver == NULL || hapd->driver->set_generic_elem == NULL)
245                 return 0;
246         return hapd->driver->set_generic_elem(hapd->conf->iface, hapd->driver,
247                                               elem, elem_len);
248 }
249
250 static inline int
251 hostapd_read_sta_data(struct hostapd_data *hapd,
252                       struct hostap_sta_driver_data *data, const u8 *addr)
253 {
254         if (hapd->driver == NULL || hapd->driver->read_sta_data == NULL)
255                 return -1;
256         return hapd->driver->read_sta_data(hapd->driver, data, addr);
257 }
258
259 static inline int
260 hostapd_send_eapol(struct hostapd_data *hapd, const u8 *addr, const u8 *data,
261                    size_t data_len, int encrypt)
262 {
263         if (hapd->driver == NULL || hapd->driver->send_eapol == NULL)
264                 return 0;
265         return hapd->driver->send_eapol(hapd->driver, addr, data, data_len,
266                                         encrypt, hapd->own_addr);
267 }
268
269 static inline int
270 hostapd_sta_deauth(struct hostapd_data *hapd, const u8 *addr, int reason)
271 {
272         if (hapd->driver == NULL || hapd->driver->sta_deauth == NULL)
273                 return 0;
274         return hapd->driver->sta_deauth(hapd->driver, addr, reason);
275 }
276
277 static inline int
278 hostapd_sta_disassoc(struct hostapd_data *hapd, const u8 *addr, int reason)
279 {
280         if (hapd->driver == NULL || hapd->driver->sta_disassoc == NULL)
281                 return 0;
282         return hapd->driver->sta_disassoc(hapd->driver, addr, reason);
283 }
284
285 static inline int
286 hostapd_sta_remove(struct hostapd_data *hapd, const u8 *addr)
287 {
288         if (hapd->driver == NULL || hapd->driver->sta_remove == NULL)
289                 return 0;
290         return hapd->driver->sta_remove(hapd->driver, addr);
291 }
292
293 static inline int
294 hostapd_get_ssid(struct hostapd_data *hapd, u8 *buf, size_t len)
295 {
296         if (hapd->driver == NULL || hapd->driver->get_ssid == NULL)
297                 return 0;
298         return hapd->driver->get_ssid(hapd->conf->iface, hapd->driver, buf,
299                                       len);
300 }
301
302 static inline int
303 hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len)
304 {
305         if (hapd->driver == NULL || hapd->driver->set_ssid == NULL)
306                 return 0;
307         return hapd->driver->set_ssid(hapd->conf->iface, hapd->driver, buf,
308                                       len);
309 }
310
311 static inline int
312 hostapd_send_mgmt_frame(struct hostapd_data *hapd, const void *msg, size_t len,
313                         int flags)
314 {
315         if (hapd->driver == NULL || hapd->driver->send_mgmt_frame == NULL)
316                 return 0;
317         return hapd->driver->send_mgmt_frame(hapd->driver, msg, len, flags);
318 }
319
320 static inline int
321 hostapd_set_assoc_ap(struct hostapd_data *hapd, const u8 *addr)
322 {
323         if (hapd->driver == NULL || hapd->driver->set_assoc_ap == NULL)
324                 return 0;
325         return hapd->driver->set_assoc_ap(hapd->driver, addr);
326 }
327
328 static inline int
329 hostapd_set_countermeasures(struct hostapd_data *hapd, int enabled)
330 {
331         if (hapd->driver == NULL || hapd->driver->set_countermeasures == NULL)
332                 return 0;
333         return hapd->driver->set_countermeasures(hapd->driver, enabled);
334 }
335
336 static inline int
337 hostapd_sta_add(const char *ifname, struct hostapd_data *hapd, const u8 *addr,
338                 u16 aid, u16 capability, u8 *supp_rates, size_t supp_rates_len,
339                 int flags)
340 {
341         if (hapd->driver == NULL || hapd->driver->sta_add == NULL)
342                 return 0;
343         return hapd->driver->sta_add(ifname, hapd->driver, addr, aid,
344                                      capability, supp_rates, supp_rates_len,
345                                      flags);
346 }
347
348 static inline int
349 hostapd_get_inact_sec(struct hostapd_data *hapd, const u8 *addr)
350 {
351         if (hapd->driver == NULL || hapd->driver->get_inact_sec == NULL)
352                 return 0;
353         return hapd->driver->get_inact_sec(hapd->driver, addr);
354 }
355
356 static inline int
357 hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq)
358 {
359         if (hapd->driver == NULL || hapd->driver->set_freq == NULL)
360                 return 0;
361         return hapd->driver->set_freq(hapd->driver, mode, freq);
362 }
363
364 static inline int
365 hostapd_set_rts(struct hostapd_data *hapd, int rts)
366 {
367         if (hapd->driver == NULL || hapd->driver->set_rts == NULL)
368                 return 0;
369         return hapd->driver->set_rts(hapd->driver, rts);
370 }
371
372 static inline int
373 hostapd_get_rts(struct hostapd_data *hapd, int *rts)
374 {
375         if (hapd->driver == NULL || hapd->driver->get_rts == NULL)
376                 return 0;
377         return hapd->driver->get_rts(hapd->driver, rts);
378 }
379
380 static inline int
381 hostapd_set_frag(struct hostapd_data *hapd, int frag)
382 {
383         if (hapd->driver == NULL || hapd->driver->set_frag == NULL)
384                 return 0;
385         return hapd->driver->set_frag(hapd->driver, frag);
386 }
387
388 static inline int
389 hostapd_get_frag(struct hostapd_data *hapd, int *frag)
390 {
391         if (hapd->driver == NULL || hapd->driver->get_frag == NULL)
392                 return 0;
393         return hapd->driver->get_frag(hapd->driver, frag);
394 }
395
396 static inline int
397 hostapd_set_retry(struct hostapd_data *hapd, int short_retry, int long_retry)
398 {
399         if (hapd->driver == NULL || hapd->driver->set_retry == NULL)
400                 return 0;
401         return hapd->driver->set_retry(hapd->driver, short_retry, long_retry);
402 }
403
404 static inline int
405 hostapd_get_retry(struct hostapd_data *hapd, int *short_retry, int *long_retry)
406 {
407         if (hapd->driver == NULL || hapd->driver->get_retry == NULL)
408                 return 0;
409         return hapd->driver->get_retry(hapd->driver, short_retry, long_retry);
410 }
411
412 static inline int
413 hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
414                       int flags_or, int flags_and)
415 {
416         if (hapd->driver == NULL || hapd->driver->sta_set_flags == NULL)
417                 return 0;
418         return hapd->driver->sta_set_flags(hapd->driver, addr, flags_or,
419                                            flags_and);
420 }
421
422 static inline int
423 hostapd_set_rate_sets(struct hostapd_data *hapd, int *supp_rates,
424                       int *basic_rates, int mode)
425 {
426         if (hapd->driver == NULL || hapd->driver->set_rate_sets == NULL)
427                 return 0;
428         return hapd->driver->set_rate_sets(hapd->driver, supp_rates,
429                                            basic_rates, mode);
430 }
431
432 static inline int
433 hostapd_set_channel_flag(struct hostapd_data *hapd, int mode, int chan,
434                          int flag, unsigned char power_level,
435                          unsigned char antenna_max)
436 {
437         if (hapd->driver == NULL || hapd->driver->set_channel_flag == NULL)
438                 return 0;
439         return hapd->driver->set_channel_flag(hapd->driver, mode, chan, flag,
440                                               power_level, antenna_max);
441 }
442
443 static inline int
444 hostapd_set_regulatory_domain(struct hostapd_data *hapd, unsigned int rd)
445 {
446         if (hapd->driver == NULL ||
447             hapd->driver->set_regulatory_domain == NULL)
448                 return 0;
449         return hapd->driver->set_regulatory_domain(hapd->driver, rd);
450 }
451
452 static inline int
453 hostapd_set_country(struct hostapd_data *hapd, const char *country)
454 {
455         if (hapd->driver == NULL ||
456             hapd->driver->set_country == NULL)
457                 return 0;
458         return hapd->driver->set_country(hapd->driver, country);
459 }
460
461 static inline int
462 hostapd_set_ieee80211d(struct hostapd_data *hapd, int enabled)
463 {
464         if (hapd->driver == NULL ||
465             hapd->driver->set_ieee80211d == NULL)
466                 return 0;
467         return hapd->driver->set_ieee80211d(hapd->driver, enabled);
468 }
469
470 void driver_register(const char *name, const struct driver_ops *ops);
471 void driver_unregister(const char *name);
472 const struct driver_ops *driver_lookup(const char *name);
473
474 static inline int
475 hostapd_sta_clear_stats(struct hostapd_data *hapd, const u8 *addr)
476 {
477         if (hapd->driver == NULL || hapd->driver->sta_clear_stats == NULL)
478                 return 0;
479         return hapd->driver->sta_clear_stats(hapd->driver, addr);
480 }
481
482 static inline int
483 hostapd_set_beacon(const char *ifname, struct hostapd_data *hapd,
484                    u8 *head, size_t head_len,
485                    u8 *tail, size_t tail_len)
486 {
487         if (hapd->driver == NULL || hapd->driver->set_beacon == NULL)
488                 return 0;
489         return hapd->driver->set_beacon(ifname, hapd->driver, head, head_len,
490                                         tail, tail_len);
491 }
492
493 static inline int
494 hostapd_set_internal_bridge(struct hostapd_data *hapd, int value)
495 {
496         if (hapd->driver == NULL || hapd->driver->set_internal_bridge == NULL)
497                 return 0;
498         return hapd->driver->set_internal_bridge(hapd->driver, value);
499 }
500
501 static inline int
502 hostapd_set_beacon_int(struct hostapd_data *hapd, int value)
503 {
504         if (hapd->driver == NULL || hapd->driver->set_beacon_int == NULL)
505                 return 0;
506         return hapd->driver->set_beacon_int(hapd->driver, value);
507 }
508
509 static inline int
510 hostapd_set_dtim_period(struct hostapd_data *hapd, int value)
511 {
512         if (hapd->driver == NULL || hapd->driver->set_dtim_period == NULL)
513                 return 0;
514         return hapd->driver->set_dtim_period(hapd->conf->iface, hapd->driver,
515                                              value);
516 }
517
518 static inline int
519 hostapd_set_broadcast_ssid(struct hostapd_data *hapd, int value)
520 {
521         if (hapd->driver == NULL || hapd->driver->set_broadcast_ssid == NULL)
522                 return 0;
523         return hapd->driver->set_broadcast_ssid(hapd->driver, value);
524 }
525
526 static inline int
527 hostapd_set_cts_protect(struct hostapd_data *hapd, int value)
528 {
529         if (hapd->driver == NULL || hapd->driver->set_cts_protect == NULL)
530                 return 0;
531         return hapd->driver->set_cts_protect(hapd->driver, value);
532 }
533
534 static inline int
535 hostapd_set_key_tx_rx_threshold(struct hostapd_data *hapd, int value)
536 {
537         if (hapd->driver == NULL ||
538             hapd->driver->set_key_tx_rx_threshold == NULL)
539                 return 0;
540         return hapd->driver->set_key_tx_rx_threshold(hapd->driver, value);
541 }
542
543 static inline int
544 hostapd_set_preamble(struct hostapd_data *hapd, int value)
545 {
546         if (hapd->driver == NULL || hapd->driver->set_preamble == NULL)
547                 return 0;
548         return hapd->driver->set_preamble(hapd->driver, value);
549 }
550
551 static inline int
552 hostapd_set_short_slot_time(struct hostapd_data *hapd, int value)
553 {
554         if (hapd->driver == NULL || hapd->driver->set_short_slot_time == NULL)
555                 return 0;
556         return hapd->driver->set_short_slot_time(hapd->driver, value);
557 }
558
559 static inline int
560 hostapd_set_tx_queue_params(struct hostapd_data *hapd, int queue, int aifs,
561                             int cw_min, int cw_max, int burst_time)
562 {
563         if (hapd->driver == NULL || hapd->driver->set_tx_queue_params == NULL)
564                 return 0;
565         return hapd->driver->set_tx_queue_params(hapd->driver, queue, aifs,
566                                                  cw_min, cw_max, burst_time);
567 }
568
569 static inline int
570 hostapd_bss_add(struct hostapd_data *hapd, const char *ifname, const u8 *bssid)
571 {
572         if (hapd->driver == NULL || hapd->driver->bss_add == NULL)
573                 return 0;
574         return hapd->driver->bss_add(hapd->driver, ifname, bssid);
575 }
576
577 static inline int
578 hostapd_bss_remove(struct hostapd_data *hapd, const char *ifname)
579 {
580         if (hapd->driver == NULL || hapd->driver->bss_remove == NULL)
581                 return 0;
582         return hapd->driver->bss_remove(hapd->driver, ifname);
583 }
584
585 static inline int
586 hostapd_valid_bss_mask(struct hostapd_data *hapd, const u8 *addr,
587                        const u8 *mask)
588 {
589         if (hapd->driver == NULL || hapd->driver->valid_bss_mask == NULL)
590                 return 1;
591         return hapd->driver->valid_bss_mask(hapd->driver, addr, mask);
592 }
593
594 static inline int
595 hostapd_if_add(struct hostapd_data *hapd, enum hostapd_driver_if_type type,
596                char *ifname, const u8 *addr)
597 {
598         if (hapd->driver == NULL || hapd->driver->if_add == NULL)
599                 return -1;
600         return hapd->driver->if_add(hapd->conf->iface, hapd->driver, type,
601                                     ifname, addr);
602 }
603
604 static inline int
605 hostapd_if_update(struct hostapd_data *hapd, enum hostapd_driver_if_type type,
606                   char *ifname, const u8 *addr)
607 {
608         if (hapd->driver == NULL || hapd->driver->if_update == NULL)
609                 return -1;
610         return hapd->driver->if_update(hapd->driver, type, ifname, addr);
611 }
612
613 static inline int
614 hostapd_if_remove(struct hostapd_data *hapd, enum hostapd_driver_if_type type,
615                   char *ifname, const u8 *addr)
616 {
617         if (hapd->driver == NULL || hapd->driver->if_remove == NULL)
618                 return -1;
619         return hapd->driver->if_remove(hapd->driver, type, ifname, addr);
620 }
621
622 static inline int
623 hostapd_passive_scan(struct hostapd_data *hapd, int now, int our_mode_only,
624                      int interval, int _listen, int *channel,
625                      int *last_rx)
626 {
627         if (hapd->driver == NULL || hapd->driver->passive_scan == NULL)
628                 return -1;
629         return hapd->driver->passive_scan(hapd->driver, now, our_mode_only,
630                                           interval, _listen, channel, last_rx);
631 }
632
633 static inline struct hostapd_hw_modes *
634 hostapd_get_hw_feature_data(struct hostapd_data *hapd, u16 *num_modes,
635                             u16 *flags)
636 {
637         if (hapd->driver == NULL || hapd->driver->get_hw_feature_data == NULL)
638                 return NULL;
639         return hapd->driver->get_hw_feature_data(hapd->driver, num_modes,
640                                                  flags);
641 }
642
643 static inline int
644 hostapd_set_sta_vlan(const char *ifname, struct hostapd_data *hapd,
645                      const u8 *addr, int vlan_id)
646 {
647         if (hapd->driver == NULL || hapd->driver->set_sta_vlan == NULL)
648                 return 0;
649         return hapd->driver->set_sta_vlan(hapd->driver, addr, ifname, vlan_id);
650 }
651
652 static inline int
653 hostapd_driver_commit(struct hostapd_data *hapd)
654 {
655         if (hapd->driver == NULL || hapd->driver->commit == NULL)
656                 return 0;
657         return hapd->driver->commit(hapd->driver);
658 }
659
660 static inline int 
661 hostapd_set_radius_acl_auth(struct hostapd_data *hapd, const u8 *mac, int accepted, 
662         u32 session_timeout)
663 {
664         if (hapd->driver == NULL || hapd->driver->set_radius_acl_auth == NULL)
665                 return 0;
666         return hapd->driver->set_radius_acl_auth(hapd->driver, mac, accepted,
667                                                  session_timeout);
668 }
669
670 static inline int 
671 hostapd_set_radius_acl_expire(struct hostapd_data *hapd, const u8 *mac)
672 {
673         if (hapd->driver == NULL || hapd->driver->set_radius_acl_expire == NULL)
674                 return 0;
675         return hapd->driver->set_radius_acl_expire(hapd->driver, mac);
676 }
677
678 #endif /* DRIVER_H */