OSDN Git Service

merge from open-source master
[android-x86/external-wpa_supplicant.git] / wpa_supplicant_i.h
1 /*
2  * wpa_supplicant - Internal definitions
3  * Copyright (c) 2003-2006, Jouni Malinen <j@w1.fi>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  *
9  * Alternatively, this software may be distributed under the terms of BSD
10  * license.
11  *
12  * See README and COPYING for more details.
13  */
14
15 #ifndef WPA_SUPPLICANT_I_H
16 #define WPA_SUPPLICANT_I_H
17
18 #include "driver.h"
19
20 struct wpa_blacklist {
21         struct wpa_blacklist *next;
22         u8 bssid[ETH_ALEN];
23         int count;
24 };
25
26
27 struct wpa_scan_result;
28 struct wpa_sm;
29 struct wpa_supplicant;
30
31 /*
32  * Forward declarations of private structures used within the ctrl_iface
33  * backends. Other parts of wpa_supplicant do not have access to data stored in
34  * these structures.
35  */
36 struct ctrl_iface_priv;
37 struct ctrl_iface_global_priv;
38 struct ctrl_iface_dbus_priv;
39
40 /**
41  * struct wpa_interface - Parameters for wpa_supplicant_add_iface()
42  */
43 struct wpa_interface {
44         /**
45          * confname - Configuration name (file or profile) name
46          *
47          * This can also be %NULL when a configuration file is not used. In
48          * that case, ctrl_interface must be set to allow the interface to be
49          * configured.
50          */
51         const char *confname;
52
53         /**
54          * ctrl_interface - Control interface parameter
55          *
56          * If a configuration file is not used, this variable can be used to
57          * set the ctrl_interface parameter that would have otherwise been read
58          * from the configuration file. If both confname and ctrl_interface are
59          * set, ctrl_interface is used to override the value from configuration
60          * file.
61          */
62         const char *ctrl_interface;
63
64         /**
65          * driver - Driver interface name, or %NULL to use the default driver
66          */
67         const char *driver;
68
69         /**
70          * driver_param - Driver interface parameters
71          *
72          * If a configuration file is not used, this variable can be used to
73          * set the driver_param parameters that would have otherwise been read
74          * from the configuration file. If both confname and driver_param are
75          * set, driver_param is used to override the value from configuration
76          * file.
77          */
78         const char *driver_param;
79
80         /**
81          * ifname - Interface name
82          */
83         const char *ifname;
84
85         /**
86          * bridge_ifname - Optional bridge interface name
87          *
88          * If the driver interface (ifname) is included in a Linux bridge
89          * device, the bridge interface may need to be used for receiving EAPOL
90          * frames. This can be enabled by setting this variable to enable
91          * receiving of EAPOL frames from an additional interface.
92          */
93         const char *bridge_ifname;
94 };
95
96 /**
97  * struct wpa_params - Parameters for wpa_supplicant_init()
98  */
99 struct wpa_params {
100         /**
101          * daemonize - Run %wpa_supplicant in the background
102          */
103         int daemonize;
104
105         /**
106          * wait_for_interface - Wait for the network interface to appear
107          *
108          * If set, %wpa_supplicant will wait until all the configured network
109          * interfaces are available before starting processing. Please note
110          * that in many cases, a better alternative would be to start
111          * %wpa_supplicant without network interfaces and add the interfaces
112          * dynamically whenever they become available.
113          */
114         int wait_for_interface;
115
116         /**
117          * wait_for_monitor - Wait for a monitor program before starting
118          */
119         int wait_for_monitor;
120
121         /**
122          * pid_file - Path to a PID (process ID) file
123          *
124          * If this and daemonize are set, process ID of the background process
125          * will be written to the specified file.
126          */
127         char *pid_file;
128
129         /**
130          * wpa_debug_level - Debugging verbosity level (e.g., MSG_INFO)
131          */
132         int wpa_debug_level;
133
134         /**
135          * wpa_debug_show_keys - Whether keying material is included in debug
136          *
137          * This parameter can be used to allow keying material to be included
138          * in debug messages. This is a security risk and this option should
139          * not be enabled in normal configuration. If needed during
140          * development or while troubleshooting, this option can provide more
141          * details for figuring out what is happening.
142          */
143         int wpa_debug_show_keys;
144
145         /**
146          * wpa_debug_timestamp - Whether to include timestamp in debug messages
147          */
148         int wpa_debug_timestamp;
149
150         /**
151          * ctrl_interface - Global ctrl_iface path/parameter
152          */
153         char *ctrl_interface;
154
155         /**
156          * dbus_ctrl_interface - Enable the DBus control interface
157          */
158         int dbus_ctrl_interface;
159
160         /**
161          * wpa_debug_file_path - Path of debug file or %NULL to use stdout
162          */
163         const char *wpa_debug_file_path;
164 };
165
166 /**
167  * struct wpa_global - Internal, global data for all %wpa_supplicant interfaces
168  *
169  * This structure is initialized by calling wpa_supplicant_init() when starting
170  * %wpa_supplicant.
171  */
172 struct wpa_global {
173         struct wpa_supplicant *ifaces;
174         struct wpa_params params;
175         struct ctrl_iface_global_priv *ctrl_iface;
176         struct ctrl_iface_dbus_priv *dbus_ctrl_iface;
177 };
178
179
180 struct wpa_client_mlme {
181 #ifdef CONFIG_CLIENT_MLME
182         enum {
183                 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
184                 IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
185                 IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED
186         } state;
187         u8 prev_bssid[ETH_ALEN];
188         u8 ssid[32];
189         size_t ssid_len;
190         u16 aid;
191         u16 ap_capab, capab;
192         u8 *extra_ie; /* to be added to the end of AssocReq */
193         size_t extra_ie_len;
194         wpa_key_mgmt key_mgmt;
195
196         /* The last AssocReq/Resp IEs */
197         u8 *assocreq_ies, *assocresp_ies;
198         size_t assocreq_ies_len, assocresp_ies_len;
199
200         int auth_tries, assoc_tries;
201
202         unsigned int ssid_set:1;
203         unsigned int bssid_set:1;
204         unsigned int prev_bssid_set:1;
205         unsigned int authenticated:1;
206         unsigned int associated:1;
207         unsigned int probereq_poll:1;
208         unsigned int use_protection:1;
209         unsigned int create_ibss:1;
210         unsigned int mixed_cell:1;
211         unsigned int wmm_enabled:1;
212
213         struct os_time last_probe;
214
215 #define IEEE80211_AUTH_ALG_OPEN BIT(0)
216 #define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
217 #define IEEE80211_AUTH_ALG_LEAP BIT(2)
218         unsigned int auth_algs; /* bitfield of allowed auth algs */
219         int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
220         int auth_transaction;
221
222         struct os_time ibss_join_req;
223         u8 *probe_resp; /* ProbeResp template for IBSS */
224         size_t probe_resp_len;
225         u32 supp_rates_bits;
226
227         int wmm_last_param_set;
228
229         int sta_scanning;
230         int scan_hw_mode_idx;
231         int scan_channel_idx;
232         enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
233         struct os_time last_scan_completed;
234         int scan_oper_channel;
235         int scan_oper_freq;
236         int scan_oper_phymode;
237         u8 scan_ssid[32];
238         size_t scan_ssid_len;
239         int scan_skip_11b;
240
241         struct ieee80211_sta_bss *sta_bss_list;
242 #define STA_HASH_SIZE 256
243 #define STA_HASH(sta) (sta[5])
244         struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
245
246         int cts_protect_erp_frames;
247
248         int phymode; /* current mode; WPA_MODE_IEEE80211A, .. */
249         struct wpa_hw_modes *modes;
250         size_t num_modes;
251         unsigned int hw_modes; /* bitfield of allowed hardware modes;
252                                 * (1 << MODE_*) */
253         int num_curr_rates;
254         struct wpa_rate_data *curr_rates;
255         int freq; /* The current frequency in MHz */
256         int channel; /* The current IEEE 802.11 channel number */
257 #else /* CONFIG_CLIENT_MLME */
258         int dummy; /* to keep MSVC happy */
259 #endif /* CONFIG_CLIENT_MLME */
260 };
261
262 /**
263  * struct wpa_supplicant - Internal data for wpa_supplicant interface
264  *
265  * This structure contains the internal data for core wpa_supplicant code. This
266  * should be only used directly from the core code. However, a pointer to this
267  * data is used from other files as an arbitrary context pointer in calls to
268  * core functions.
269  */
270 struct wpa_supplicant {
271         struct wpa_global *global;
272         struct wpa_supplicant *next;
273         struct l2_packet_data *l2;
274         struct l2_packet_data *l2_br;
275         unsigned char own_addr[ETH_ALEN];
276         char ifname[100];
277 #ifdef CONFIG_CTRL_IFACE_DBUS
278         char *dbus_path;
279 #endif /* CONFIG_CTRL_IFACE_DBUS */
280         char bridge_ifname[16];
281
282         char *confname;
283         struct wpa_config *conf;
284         int countermeasures;
285         os_time_t last_michael_mic_error;
286         u8 bssid[ETH_ALEN];
287         u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
288                                      * field contains the targer BSSID. */
289         int reassociate; /* reassociation requested */
290         int disconnected; /* all connections disabled; i.e., do no reassociate
291                            * before this has been cleared */
292         struct wpa_ssid *current_ssid;
293
294         /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
295         int pairwise_cipher;
296         int group_cipher;
297         int key_mgmt;
298         int mgmt_group_cipher;
299
300         void *drv_priv; /* private data used by driver_ops */
301
302         struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
303                                           * NULL = not yet initialized (start
304                                           * with broadcast SSID)
305                                           * BROADCAST_SSID_SCAN = broadcast
306                                           * SSID was used in the previous scan
307                                           */
308 #define BROADCAST_SSID_SCAN ((struct wpa_ssid *) 1)
309
310         struct wpa_scan_result *scan_results;
311         int num_scan_results;
312
313         struct wpa_driver_ops *driver;
314         int interface_removed; /* whether the network interface has been
315                                 * removed */
316         struct wpa_sm *wpa;
317         struct eapol_sm *eapol;
318
319         struct ctrl_iface_priv *ctrl_iface;
320
321         wpa_states wpa_state;
322         int new_connection;
323         int reassociated_connection;
324
325         int eapol_received; /* number of EAPOL packets received after the
326                              * previous association event */
327
328         struct scard_data *scard;
329
330         unsigned char last_eapol_src[ETH_ALEN];
331
332         int keys_cleared;
333
334         struct wpa_blacklist *blacklist;
335
336         int scan_req; /* manual scan request; this forces a scan even if there
337                        * are no enabled networks in the configuration */
338         int scan_res_tried; /* whether ap_scan=1 mode has tried to fetch scan
339                              * results without a new scan request; this is used
340                              * to speed up the first association if the driver
341                              * has already available scan results. */
342
343         struct wpa_client_mlme mlme;
344         int use_client_mlme;
345         int scan_ongoing;   /* scan ongoing or not */
346         int link_speed;     /* current link speed */
347         int rssi;           /* current signal level */
348 #ifdef ANDROID
349         int scan_interval;  /* time between scans when no APs available */
350 #endif
351 };
352
353
354 /* wpa_supplicant.c */
355 void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s);
356
357 int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
358
359 const char * wpa_supplicant_state_txt(int state);
360 int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s,
361                                int wait_for_interface);
362 struct wpa_blacklist * wpa_blacklist_get(struct wpa_supplicant *wpa_s,
363                                          const u8 *bssid);
364 int wpa_blacklist_add(struct wpa_supplicant *wpa_s, const u8 *bssid);
365 void wpa_blacklist_clear(struct wpa_supplicant *wpa_s);
366 int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
367                               struct wpa_scan_result *bss,
368                               struct wpa_ssid *ssid,
369                               u8 *wpa_ie, size_t *wpa_ie_len);
370 void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
371                               struct wpa_scan_result *bss,
372                               struct wpa_ssid *ssid);
373 void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
374                                        struct wpa_ssid *ssid);
375 void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
376 int wpa_supplicant_get_scan_results(struct wpa_supplicant *wpa_s);
377 void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
378 void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
379                                      int sec, int usec);
380 void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, wpa_states state);
381 struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
382 void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
383 void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
384                                    int reason_code);
385 void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
386                                  int reason_code);
387 void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);
388
389 void wpa_show_license(void);
390
391 struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
392                                                  struct wpa_interface *iface);
393 int wpa_supplicant_remove_iface(struct wpa_global *global,
394                                 struct wpa_supplicant *wpa_s);
395 struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
396                                                  const char *ifname);
397 struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
398 int wpa_supplicant_run(struct wpa_global *global);
399 void wpa_supplicant_deinit(struct wpa_global *global);
400
401 int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
402                               struct wpa_ssid *ssid);
403
404 /* events.c */
405 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
406
407 /* driver_ops */
408 static inline void * wpa_drv_init(struct wpa_supplicant *wpa_s,
409                                   const char *ifname)
410 {
411         if (wpa_s->driver->init) {
412                 return wpa_s->driver->init(wpa_s, ifname);
413         }
414         return NULL;
415 }
416
417 static inline void wpa_drv_deinit(struct wpa_supplicant *wpa_s)
418 {
419         if (wpa_s->driver->deinit)
420                 wpa_s->driver->deinit(wpa_s->drv_priv);
421 }
422
423 static inline int wpa_drv_set_param(struct wpa_supplicant *wpa_s,
424                                     const char *param)
425 {
426         if (wpa_s->driver->set_param)
427                 return wpa_s->driver->set_param(wpa_s->drv_priv, param);
428         return 0;
429 }
430
431 static inline int wpa_drv_set_drop_unencrypted(struct wpa_supplicant *wpa_s,
432                                                int enabled)
433 {
434         if (wpa_s->driver->set_drop_unencrypted) {
435                 return wpa_s->driver->set_drop_unencrypted(wpa_s->drv_priv,
436                                                            enabled);
437         }
438         return -1;
439 }
440
441 static inline int wpa_drv_set_countermeasures(struct wpa_supplicant *wpa_s,
442                                               int enabled)
443 {
444         if (wpa_s->driver->set_countermeasures) {
445                 return wpa_s->driver->set_countermeasures(wpa_s->drv_priv,
446                                                           enabled);
447         }
448         return -1;
449 }
450
451 static inline int wpa_drv_set_auth_alg(struct wpa_supplicant *wpa_s,
452                                        int auth_alg)
453 {
454         if (wpa_s->driver->set_auth_alg) {
455                 return wpa_s->driver->set_auth_alg(wpa_s->drv_priv,
456                                                    auth_alg);
457         }
458         return -1;
459 }
460
461 static inline int wpa_drv_set_wpa(struct wpa_supplicant *wpa_s, int enabled)
462 {
463         if (wpa_s->driver->set_wpa) {
464                 return wpa_s->driver->set_wpa(wpa_s->drv_priv, enabled);
465         }
466         return 0;
467 }
468
469 static inline int wpa_drv_associate(struct wpa_supplicant *wpa_s,
470                                     struct wpa_driver_associate_params *params)
471 {
472         if (wpa_s->driver->associate) {
473                 return wpa_s->driver->associate(wpa_s->drv_priv, params);
474         }
475         return -1;
476 }
477
478 static inline int wpa_drv_scan(struct wpa_supplicant *wpa_s, const u8 *ssid,
479                                size_t ssid_len)
480 {
481         if (wpa_s->driver->scan) {
482                 return wpa_s->driver->scan(wpa_s->drv_priv, ssid, ssid_len);
483         }
484         return -1;
485 }
486
487 static inline int wpa_drv_get_scan_results(struct wpa_supplicant *wpa_s,
488                                            struct wpa_scan_result *results,
489                                            size_t max_size)
490 {
491         if (wpa_s->driver->get_scan_results) {
492                 return wpa_s->driver->get_scan_results(wpa_s->drv_priv,
493                                                        results, max_size);
494         }
495         return -1;
496 }
497
498 static inline int wpa_drv_get_bssid(struct wpa_supplicant *wpa_s, u8 *bssid)
499 {
500         if (wpa_s->driver->get_bssid) {
501                 return wpa_s->driver->get_bssid(wpa_s->drv_priv, bssid);
502         }
503         return -1;
504 }
505
506 static inline int wpa_drv_get_ssid(struct wpa_supplicant *wpa_s, u8 *ssid)
507 {
508         if (wpa_s->driver->get_ssid) {
509                 return wpa_s->driver->get_ssid(wpa_s->drv_priv, ssid);
510         }
511         return -1;
512 }
513
514 static inline int wpa_drv_set_key(struct wpa_supplicant *wpa_s, wpa_alg alg,
515                                    const u8 *addr, int key_idx, int set_tx,
516                                    const u8 *seq, size_t seq_len,
517                                    const u8 *key, size_t key_len)
518 {
519         if (wpa_s->driver->set_key) {
520                 wpa_s->keys_cleared = 0;
521                 return wpa_s->driver->set_key(wpa_s->drv_priv, alg, addr,
522                                               key_idx, set_tx, seq, seq_len,
523                                               key, key_len);
524         }
525         return -1;
526 }
527
528 static inline int wpa_drv_deauthenticate(struct wpa_supplicant *wpa_s,
529                                          const u8 *addr, int reason_code)
530 {
531         if (wpa_s->driver->deauthenticate) {
532                 return wpa_s->driver->deauthenticate(wpa_s->drv_priv, addr,
533                                                      reason_code);
534         }
535         return -1;
536 }
537
538 static inline int wpa_drv_disassociate(struct wpa_supplicant *wpa_s,
539                                        const u8 *addr, int reason_code)
540 {
541         if (wpa_s->driver->disassociate) {
542                 return wpa_s->driver->disassociate(wpa_s->drv_priv, addr,
543                                                    reason_code);
544         }
545         return -1;
546 }
547
548 static inline int wpa_drv_add_pmkid(struct wpa_supplicant *wpa_s,
549                                     const u8 *bssid, const u8 *pmkid)
550 {
551         if (wpa_s->driver->add_pmkid) {
552                 return wpa_s->driver->add_pmkid(wpa_s->drv_priv, bssid, pmkid);
553         }
554         return -1;
555 }
556
557 static inline int wpa_drv_remove_pmkid(struct wpa_supplicant *wpa_s,
558                                        const u8 *bssid, const u8 *pmkid)
559 {
560         if (wpa_s->driver->remove_pmkid) {
561                 return wpa_s->driver->remove_pmkid(wpa_s->drv_priv, bssid,
562                                                    pmkid);
563         }
564         return -1;
565 }
566
567 static inline int wpa_drv_flush_pmkid(struct wpa_supplicant *wpa_s)
568 {
569         if (wpa_s->driver->flush_pmkid) {
570                 return wpa_s->driver->flush_pmkid(wpa_s->drv_priv);
571         }
572         return -1;
573 }
574
575 static inline int wpa_drv_get_capa(struct wpa_supplicant *wpa_s,
576                                    struct wpa_driver_capa *capa)
577 {
578         if (wpa_s->driver->get_capa) {
579                 return wpa_s->driver->get_capa(wpa_s->drv_priv, capa);
580         }
581         return -1;
582 }
583
584 static inline void wpa_drv_poll(struct wpa_supplicant *wpa_s)
585 {
586         if (wpa_s->driver->poll) {
587                 wpa_s->driver->poll(wpa_s->drv_priv);
588         }
589 }
590
591 static inline const char * wpa_drv_get_ifname(struct wpa_supplicant *wpa_s)
592 {
593         if (wpa_s->driver->get_ifname) {
594                 return wpa_s->driver->get_ifname(wpa_s->drv_priv);
595         }
596         return NULL;
597 }
598
599 static inline const u8 * wpa_drv_get_mac_addr(struct wpa_supplicant *wpa_s)
600 {
601         if (wpa_s->driver->get_mac_addr) {
602                 return wpa_s->driver->get_mac_addr(wpa_s->drv_priv);
603         }
604         return NULL;
605 }
606
607 static inline int wpa_drv_send_eapol(struct wpa_supplicant *wpa_s,
608                                      const u8 *dst, u16 proto,
609                                      const u8 *data, size_t data_len)
610 {
611         if (wpa_s->driver->send_eapol)
612                 return wpa_s->driver->send_eapol(wpa_s->drv_priv, dst, proto,
613                                                  data, data_len);
614         return -1;
615 }
616
617 static inline int wpa_drv_set_operstate(struct wpa_supplicant *wpa_s,
618                                         int state)
619 {
620         if (wpa_s->driver->set_operstate)
621                 return wpa_s->driver->set_operstate(wpa_s->drv_priv, state);
622         return 0;
623 }
624
625 static inline int wpa_drv_mlme_setprotection(struct wpa_supplicant *wpa_s,
626                                              const u8 *addr, int protect_type,
627                                              int key_type)
628 {
629         if (wpa_s->driver->mlme_setprotection)
630                 return wpa_s->driver->mlme_setprotection(wpa_s->drv_priv, addr,
631                                                          protect_type,
632                                                          key_type);
633         return 0;
634 }
635
636 static inline struct wpa_hw_modes *
637 wpa_drv_get_hw_feature_data(struct wpa_supplicant *wpa_s, u16 *num_modes,
638                             u16 *flags)
639 {
640         if (wpa_s->driver->get_hw_feature_data)
641                 return wpa_s->driver->get_hw_feature_data(wpa_s->drv_priv,
642                                                           num_modes, flags);
643         return NULL;
644 }
645
646 static inline int wpa_drv_set_channel(struct wpa_supplicant *wpa_s,
647                                       wpa_hw_mode phymode, int chan,
648                                       int freq)
649 {
650         if (wpa_s->driver->set_channel)
651                 return wpa_s->driver->set_channel(wpa_s->drv_priv, phymode,
652                                                   chan, freq);
653         return -1;
654 }
655
656 static inline int wpa_drv_set_ssid(struct wpa_supplicant *wpa_s,
657                                    const u8 *ssid, size_t ssid_len)
658 {
659         if (wpa_s->driver->set_ssid) {
660                 return wpa_s->driver->set_ssid(wpa_s->drv_priv, ssid,
661                                                ssid_len);
662         }
663         return -1;
664 }
665
666 static inline int wpa_drv_set_bssid(struct wpa_supplicant *wpa_s,
667                                     const u8 *bssid)
668 {
669         if (wpa_s->driver->set_bssid) {
670                 return wpa_s->driver->set_bssid(wpa_s->drv_priv, bssid);
671         }
672         return -1;
673 }
674
675 static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s,
676                                     const u8 *data, size_t data_len)
677 {
678         if (wpa_s->driver->send_mlme)
679                 return wpa_s->driver->send_mlme(wpa_s->drv_priv,
680                                                 data, data_len);
681         return -1;
682 }
683
684 static inline int wpa_drv_mlme_add_sta(struct wpa_supplicant *wpa_s,
685                                        const u8 *addr, const u8 *supp_rates,
686                                        size_t supp_rates_len)
687 {
688         if (wpa_s->driver->mlme_add_sta)
689                 return wpa_s->driver->mlme_add_sta(wpa_s->drv_priv, addr,
690                                                    supp_rates, supp_rates_len);
691         return -1;
692 }
693
694 static inline int wpa_drv_mlme_remove_sta(struct wpa_supplicant *wpa_s,
695                                           const u8 *addr)
696 {
697         if (wpa_s->driver->mlme_remove_sta)
698                 return wpa_s->driver->mlme_remove_sta(wpa_s->drv_priv, addr);
699         return -1;
700 }
701
702 static inline int wpa_drv_driver_cmd(struct wpa_supplicant *wpa_s,
703                                           char *cmd, char *buf, size_t buf_len)
704 {
705         if (wpa_s->driver->driver_cmd)
706                 return wpa_s->driver->driver_cmd(wpa_s->drv_priv, cmd, buf, buf_len);
707         return -1;
708 }
709
710 #endif /* WPA_SUPPLICANT_I_H */