]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - contrib/wpa_supplicant/wpa_supplicant_i.h
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / contrib / wpa_supplicant / 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          * wpa_debug_syslog - Enable log output through syslog
167          */
168         const char *wpa_debug_syslog;
169 };
170
171 /**
172  * struct wpa_global - Internal, global data for all %wpa_supplicant interfaces
173  *
174  * This structure is initialized by calling wpa_supplicant_init() when starting
175  * %wpa_supplicant.
176  */
177 struct wpa_global {
178         struct wpa_supplicant *ifaces;
179         struct wpa_params params;
180         struct ctrl_iface_global_priv *ctrl_iface;
181         struct ctrl_iface_dbus_priv *dbus_ctrl_iface;
182 };
183
184
185 struct wpa_client_mlme {
186 #ifdef CONFIG_CLIENT_MLME
187         enum {
188                 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
189                 IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
190                 IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED
191         } state;
192         u8 prev_bssid[ETH_ALEN];
193         u8 ssid[32];
194         size_t ssid_len;
195         u16 aid;
196         u16 ap_capab, capab;
197         u8 *extra_ie; /* to be added to the end of AssocReq */
198         size_t extra_ie_len;
199         wpa_key_mgmt key_mgmt;
200
201         /* The last AssocReq/Resp IEs */
202         u8 *assocreq_ies, *assocresp_ies;
203         size_t assocreq_ies_len, assocresp_ies_len;
204
205         int auth_tries, assoc_tries;
206
207         unsigned int ssid_set:1;
208         unsigned int bssid_set:1;
209         unsigned int prev_bssid_set:1;
210         unsigned int authenticated:1;
211         unsigned int associated:1;
212         unsigned int probereq_poll:1;
213         unsigned int use_protection:1;
214         unsigned int create_ibss:1;
215         unsigned int mixed_cell:1;
216         unsigned int wmm_enabled:1;
217
218         struct os_time last_probe;
219
220 #define IEEE80211_AUTH_ALG_OPEN BIT(0)
221 #define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
222 #define IEEE80211_AUTH_ALG_LEAP BIT(2)
223         unsigned int auth_algs; /* bitfield of allowed auth algs */
224         int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
225         int auth_transaction;
226
227         struct os_time ibss_join_req;
228         u8 *probe_resp; /* ProbeResp template for IBSS */
229         size_t probe_resp_len;
230         u32 supp_rates_bits;
231
232         int wmm_last_param_set;
233
234         int sta_scanning;
235         int scan_hw_mode_idx;
236         int scan_channel_idx;
237         enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
238         struct os_time last_scan_completed;
239         int scan_oper_channel;
240         int scan_oper_freq;
241         int scan_oper_phymode;
242         u8 scan_ssid[32];
243         size_t scan_ssid_len;
244         int scan_skip_11b;
245
246         struct ieee80211_sta_bss *sta_bss_list;
247 #define STA_HASH_SIZE 256
248 #define STA_HASH(sta) (sta[5])
249         struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
250
251         int cts_protect_erp_frames;
252
253         int phymode; /* current mode; WPA_MODE_IEEE80211A, .. */
254         struct wpa_hw_modes *modes;
255         size_t num_modes;
256         unsigned int hw_modes; /* bitfield of allowed hardware modes;
257                                 * (1 << MODE_*) */
258         int num_curr_rates;
259         struct wpa_rate_data *curr_rates;
260         int freq; /* The current frequency in MHz */
261         int channel; /* The current IEEE 802.11 channel number */
262 #else /* CONFIG_CLIENT_MLME */
263         int dummy; /* to keep MSVC happy */
264 #endif /* CONFIG_CLIENT_MLME */
265 };
266
267 /**
268  * struct wpa_supplicant - Internal data for wpa_supplicant interface
269  *
270  * This structure contains the internal data for core wpa_supplicant code. This
271  * should be only used directly from the core code. However, a pointer to this
272  * data is used from other files as an arbitrary context pointer in calls to
273  * core functions.
274  */
275 struct wpa_supplicant {
276         struct wpa_global *global;
277         struct wpa_supplicant *next;
278         struct l2_packet_data *l2;
279         struct l2_packet_data *l2_br;
280         unsigned char own_addr[ETH_ALEN];
281         char ifname[100];
282 #ifdef CONFIG_CTRL_IFACE_DBUS
283         char *dbus_path;
284 #endif /* CONFIG_CTRL_IFACE_DBUS */
285         char bridge_ifname[16];
286
287         char *confname;
288         struct wpa_config *conf;
289         int countermeasures;
290         os_time_t last_michael_mic_error;
291         u8 bssid[ETH_ALEN];
292         u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
293                                      * field contains the targer BSSID. */
294         int reassociate; /* reassociation requested */
295         int disconnected; /* all connections disabled; i.e., do no reassociate
296                            * before this has been cleared */
297         struct wpa_ssid *current_ssid;
298
299         /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
300         int pairwise_cipher;
301         int group_cipher;
302         int key_mgmt;
303         int mgmt_group_cipher;
304
305         void *drv_priv; /* private data used by driver_ops */
306
307         struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
308                                           * NULL = not yet initialized (start
309                                           * with broadcast SSID)
310                                           * BROADCAST_SSID_SCAN = broadcast
311                                           * SSID was used in the previous scan
312                                           */
313 #define BROADCAST_SSID_SCAN ((struct wpa_ssid *) 1)
314
315         struct wpa_scan_result *scan_results;
316         int num_scan_results;
317
318         struct wpa_driver_ops *driver;
319         int interface_removed; /* whether the network interface has been
320                                 * removed */
321         struct wpa_sm *wpa;
322         struct eapol_sm *eapol;
323
324         struct ctrl_iface_priv *ctrl_iface;
325
326         wpa_states wpa_state;
327         int new_connection;
328         int reassociated_connection;
329
330         int eapol_received; /* number of EAPOL packets received after the
331                              * previous association event */
332
333         struct scard_data *scard;
334
335         unsigned char last_eapol_src[ETH_ALEN];
336
337         int keys_cleared;
338
339         struct wpa_blacklist *blacklist;
340
341         int scan_req; /* manual scan request; this forces a scan even if there
342                        * are no enabled networks in the configuration */
343         int scan_res_tried; /* whether ap_scan=1 mode has tried to fetch scan
344                              * results without a new scan request; this is used
345                              * to speed up the first association if the driver
346                              * has already available scan results. */
347
348         struct wpa_client_mlme mlme;
349         int use_client_mlme;
350 };
351
352
353 /* wpa_supplicant.c */
354 void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s);
355
356 int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
357
358 const char * wpa_supplicant_state_txt(int state);
359 int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s,
360                                int wait_for_interface);
361 struct wpa_blacklist * wpa_blacklist_get(struct wpa_supplicant *wpa_s,
362                                          const u8 *bssid);
363 int wpa_blacklist_add(struct wpa_supplicant *wpa_s, const u8 *bssid);
364 void wpa_blacklist_clear(struct wpa_supplicant *wpa_s);
365 int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
366                               struct wpa_scan_result *bss,
367                               struct wpa_ssid *ssid,
368                               u8 *wpa_ie, size_t *wpa_ie_len);
369 void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
370                               struct wpa_scan_result *bss,
371                               struct wpa_ssid *ssid);
372 void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
373                                        struct wpa_ssid *ssid);
374 void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
375 int wpa_supplicant_get_scan_results(struct wpa_supplicant *wpa_s);
376 void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
377 void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
378                                      int sec, int usec);
379 void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, wpa_states state);
380 struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
381 void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
382 void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
383                                    int reason_code);
384 void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
385                                  int reason_code);
386 void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);
387
388 void wpa_show_license(void);
389
390 struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
391                                                  struct wpa_interface *iface);
392 int wpa_supplicant_remove_iface(struct wpa_global *global,
393                                 struct wpa_supplicant *wpa_s);
394 struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
395                                                  const char *ifname);
396 struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
397 int wpa_supplicant_run(struct wpa_global *global);
398 void wpa_supplicant_deinit(struct wpa_global *global);
399
400 int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
401                               struct wpa_ssid *ssid);
402
403 /* events.c */
404 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
405
406 /* driver_ops */
407 static inline void * wpa_drv_init(struct wpa_supplicant *wpa_s,
408                                   const char *ifname)
409 {
410         if (wpa_s->driver->init) {
411                 return wpa_s->driver->init(wpa_s, ifname);
412         }
413         return NULL;
414 }
415
416 static inline void wpa_drv_deinit(struct wpa_supplicant *wpa_s)
417 {
418         if (wpa_s->driver->deinit)
419                 wpa_s->driver->deinit(wpa_s->drv_priv);
420 }
421
422 static inline int wpa_drv_set_param(struct wpa_supplicant *wpa_s,
423                                     const char *param)
424 {
425         if (wpa_s->driver->set_param)
426                 return wpa_s->driver->set_param(wpa_s->drv_priv, param);
427         return 0;
428 }
429
430 static inline int wpa_drv_set_drop_unencrypted(struct wpa_supplicant *wpa_s,
431                                                int enabled)
432 {
433         if (wpa_s->driver->set_drop_unencrypted) {
434                 return wpa_s->driver->set_drop_unencrypted(wpa_s->drv_priv,
435                                                            enabled);
436         }
437         return -1;
438 }
439
440 static inline int wpa_drv_set_countermeasures(struct wpa_supplicant *wpa_s,
441                                               int enabled)
442 {
443         if (wpa_s->driver->set_countermeasures) {
444                 return wpa_s->driver->set_countermeasures(wpa_s->drv_priv,
445                                                           enabled);
446         }
447         return -1;
448 }
449
450 static inline int wpa_drv_set_auth_alg(struct wpa_supplicant *wpa_s,
451                                        int auth_alg)
452 {
453         if (wpa_s->driver->set_auth_alg) {
454                 return wpa_s->driver->set_auth_alg(wpa_s->drv_priv,
455                                                    auth_alg);
456         }
457         return -1;
458 }
459
460 static inline int wpa_drv_set_wpa(struct wpa_supplicant *wpa_s, int enabled)
461 {
462         if (wpa_s->driver->set_wpa) {
463                 return wpa_s->driver->set_wpa(wpa_s->drv_priv, enabled);
464         }
465         return 0;
466 }
467
468 static inline int wpa_drv_associate(struct wpa_supplicant *wpa_s,
469                                     struct wpa_driver_associate_params *params)
470 {
471         if (wpa_s->driver->associate) {
472                 return wpa_s->driver->associate(wpa_s->drv_priv, params);
473         }
474         return -1;
475 }
476
477 static inline int wpa_drv_scan(struct wpa_supplicant *wpa_s, const u8 *ssid,
478                                size_t ssid_len)
479 {
480         if (wpa_s->driver->scan) {
481                 return wpa_s->driver->scan(wpa_s->drv_priv, ssid, ssid_len);
482         }
483         return -1;
484 }
485
486 static inline int wpa_drv_get_scan_results(struct wpa_supplicant *wpa_s,
487                                            struct wpa_scan_result *results,
488                                            size_t max_size)
489 {
490         if (wpa_s->driver->get_scan_results) {
491                 return wpa_s->driver->get_scan_results(wpa_s->drv_priv,
492                                                        results, max_size);
493         }
494         return -1;
495 }
496
497 static inline int wpa_drv_get_bssid(struct wpa_supplicant *wpa_s, u8 *bssid)
498 {
499         if (wpa_s->driver->get_bssid) {
500                 return wpa_s->driver->get_bssid(wpa_s->drv_priv, bssid);
501         }
502         return -1;
503 }
504
505 static inline int wpa_drv_get_ssid(struct wpa_supplicant *wpa_s, u8 *ssid)
506 {
507         if (wpa_s->driver->get_ssid) {
508                 return wpa_s->driver->get_ssid(wpa_s->drv_priv, ssid);
509         }
510         return -1;
511 }
512
513 static inline int wpa_drv_set_key(struct wpa_supplicant *wpa_s, wpa_alg alg,
514                                    const u8 *addr, int key_idx, int set_tx,
515                                    const u8 *seq, size_t seq_len,
516                                    const u8 *key, size_t key_len)
517 {
518         if (wpa_s->driver->set_key) {
519                 wpa_s->keys_cleared = 0;
520                 return wpa_s->driver->set_key(wpa_s->drv_priv, alg, addr,
521                                               key_idx, set_tx, seq, seq_len,
522                                               key, key_len);
523         }
524         return -1;
525 }
526
527 static inline int wpa_drv_deauthenticate(struct wpa_supplicant *wpa_s,
528                                          const u8 *addr, int reason_code)
529 {
530         if (wpa_s->driver->deauthenticate) {
531                 return wpa_s->driver->deauthenticate(wpa_s->drv_priv, addr,
532                                                      reason_code);
533         }
534         return -1;
535 }
536
537 static inline int wpa_drv_disassociate(struct wpa_supplicant *wpa_s,
538                                        const u8 *addr, int reason_code)
539 {
540         if (wpa_s->driver->disassociate) {
541                 return wpa_s->driver->disassociate(wpa_s->drv_priv, addr,
542                                                    reason_code);
543         }
544         return -1;
545 }
546
547 static inline int wpa_drv_add_pmkid(struct wpa_supplicant *wpa_s,
548                                     const u8 *bssid, const u8 *pmkid)
549 {
550         if (wpa_s->driver->add_pmkid) {
551                 return wpa_s->driver->add_pmkid(wpa_s->drv_priv, bssid, pmkid);
552         }
553         return -1;
554 }
555
556 static inline int wpa_drv_remove_pmkid(struct wpa_supplicant *wpa_s,
557                                        const u8 *bssid, const u8 *pmkid)
558 {
559         if (wpa_s->driver->remove_pmkid) {
560                 return wpa_s->driver->remove_pmkid(wpa_s->drv_priv, bssid,
561                                                    pmkid);
562         }
563         return -1;
564 }
565
566 static inline int wpa_drv_flush_pmkid(struct wpa_supplicant *wpa_s)
567 {
568         if (wpa_s->driver->flush_pmkid) {
569                 return wpa_s->driver->flush_pmkid(wpa_s->drv_priv);
570         }
571         return -1;
572 }
573
574 static inline int wpa_drv_get_capa(struct wpa_supplicant *wpa_s,
575                                    struct wpa_driver_capa *capa)
576 {
577         if (wpa_s->driver->get_capa) {
578                 return wpa_s->driver->get_capa(wpa_s->drv_priv, capa);
579         }
580         return -1;
581 }
582
583 static inline void wpa_drv_poll(struct wpa_supplicant *wpa_s)
584 {
585         if (wpa_s->driver->poll) {
586                 wpa_s->driver->poll(wpa_s->drv_priv);
587         }
588 }
589
590 static inline const char * wpa_drv_get_ifname(struct wpa_supplicant *wpa_s)
591 {
592         if (wpa_s->driver->get_ifname) {
593                 return wpa_s->driver->get_ifname(wpa_s->drv_priv);
594         }
595         return NULL;
596 }
597
598 static inline const u8 * wpa_drv_get_mac_addr(struct wpa_supplicant *wpa_s)
599 {
600         if (wpa_s->driver->get_mac_addr) {
601                 return wpa_s->driver->get_mac_addr(wpa_s->drv_priv);
602         }
603         return NULL;
604 }
605
606 static inline int wpa_drv_send_eapol(struct wpa_supplicant *wpa_s,
607                                      const u8 *dst, u16 proto,
608                                      const u8 *data, size_t data_len)
609 {
610         if (wpa_s->driver->send_eapol)
611                 return wpa_s->driver->send_eapol(wpa_s->drv_priv, dst, proto,
612                                                  data, data_len);
613         return -1;
614 }
615
616 static inline int wpa_drv_set_operstate(struct wpa_supplicant *wpa_s,
617                                         int state)
618 {
619         if (wpa_s->driver->set_operstate)
620                 return wpa_s->driver->set_operstate(wpa_s->drv_priv, state);
621         return 0;
622 }
623
624 static inline int wpa_drv_mlme_setprotection(struct wpa_supplicant *wpa_s,
625                                              const u8 *addr, int protect_type,
626                                              int key_type)
627 {
628         if (wpa_s->driver->mlme_setprotection)
629                 return wpa_s->driver->mlme_setprotection(wpa_s->drv_priv, addr,
630                                                          protect_type,
631                                                          key_type);
632         return 0;
633 }
634
635 static inline struct wpa_hw_modes *
636 wpa_drv_get_hw_feature_data(struct wpa_supplicant *wpa_s, u16 *num_modes,
637                             u16 *flags)
638 {
639         if (wpa_s->driver->get_hw_feature_data)
640                 return wpa_s->driver->get_hw_feature_data(wpa_s->drv_priv,
641                                                           num_modes, flags);
642         return NULL;
643 }
644
645 static inline int wpa_drv_set_channel(struct wpa_supplicant *wpa_s,
646                                       wpa_hw_mode phymode, int chan,
647                                       int freq)
648 {
649         if (wpa_s->driver->set_channel)
650                 return wpa_s->driver->set_channel(wpa_s->drv_priv, phymode,
651                                                   chan, freq);
652         return -1;
653 }
654
655 static inline int wpa_drv_set_ssid(struct wpa_supplicant *wpa_s,
656                                    const u8 *ssid, size_t ssid_len)
657 {
658         if (wpa_s->driver->set_ssid) {
659                 return wpa_s->driver->set_ssid(wpa_s->drv_priv, ssid,
660                                                ssid_len);
661         }
662         return -1;
663 }
664
665 static inline int wpa_drv_set_bssid(struct wpa_supplicant *wpa_s,
666                                     const u8 *bssid)
667 {
668         if (wpa_s->driver->set_bssid) {
669                 return wpa_s->driver->set_bssid(wpa_s->drv_priv, bssid);
670         }
671         return -1;
672 }
673
674 static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s,
675                                     const u8 *data, size_t data_len)
676 {
677         if (wpa_s->driver->send_mlme)
678                 return wpa_s->driver->send_mlme(wpa_s->drv_priv,
679                                                 data, data_len);
680         return -1;
681 }
682
683 static inline int wpa_drv_mlme_add_sta(struct wpa_supplicant *wpa_s,
684                                        const u8 *addr, const u8 *supp_rates,
685                                        size_t supp_rates_len)
686 {
687         if (wpa_s->driver->mlme_add_sta)
688                 return wpa_s->driver->mlme_add_sta(wpa_s->drv_priv, addr,
689                                                    supp_rates, supp_rates_len);
690         return -1;
691 }
692
693 static inline int wpa_drv_mlme_remove_sta(struct wpa_supplicant *wpa_s,
694                                           const u8 *addr)
695 {
696         if (wpa_s->driver->mlme_remove_sta)
697                 return wpa_s->driver->mlme_remove_sta(wpa_s->drv_priv, addr);
698         return -1;
699 }
700
701 #endif /* WPA_SUPPLICANT_I_H */