Fix a bug when '-f -H' is used and the target already exists. cpdup was
[dragonfly.git] / contrib / wpa_supplicant-0.4.9 / preauth.h
1 /*
2  * wpa_supplicant - WPA2/RSN pre-authentication functions
3  * Copyright (c) 2003-2005, Jouni Malinen <jkmaline@cc.hut.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 PREAUTH_H
16 #define PREAUTH_H
17
18 struct wpa_scan_result;
19
20 #ifndef CONFIG_NO_WPA
21
22 void pmksa_cache_free(struct wpa_sm *sm);
23 struct rsn_pmksa_cache * pmksa_cache_get(struct wpa_sm *sm,
24                                          const u8 *aa, const u8 *pmkid);
25 int pmksa_cache_list(struct wpa_sm *sm, char *buf, size_t len);
26 void pmksa_candidate_free(struct wpa_sm *sm);
27 struct rsn_pmksa_cache *
28 pmksa_cache_add(struct wpa_sm *sm, const u8 *pmk,
29                 size_t pmk_len, const u8 *aa, const u8 *spa,
30                 struct wpa_ssid *ssid);
31 void pmksa_cache_notify_reconfig(struct wpa_sm *sm);
32 struct rsn_pmksa_cache * pmksa_cache_get_current(struct wpa_sm *sm);
33 void pmksa_cache_clear_current(struct wpa_sm *sm);
34 int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid,
35                             const u8 *bssid, struct wpa_ssid *ssid,
36                             int try_opportunistic);
37
38 #else /* CONFIG_NO_WPA */
39
40 static inline void pmksa_cache_free(struct wpa_sm *sm)
41 {
42 }
43
44 static inline void pmksa_candidate_free(struct wpa_sm *sm)
45 {
46 }
47
48 static inline void pmksa_cache_notify_reconfig(struct wpa_sm *sm)
49 {
50 }
51
52 static inline struct rsn_pmksa_cache *
53 pmksa_cache_get_current(struct wpa_sm *sm)
54 {
55         return NULL;
56 }
57
58 static inline int pmksa_cache_list(struct wpa_sm *sm, char *buf, size_t len)
59 {
60         return -1;
61 }
62
63 static inline void pmksa_cache_clear_current(struct wpa_sm *sm)
64 {
65 }
66
67 static inline int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid,
68                                           const u8 *bssid,
69                                           struct wpa_ssid *ssid,
70                                           int try_opportunistic)
71 {
72         return -1;
73 }
74
75 #endif /* CONFIG_NO_WPA */
76
77
78 #if defined(IEEE8021X_EAPOL) && !defined(CONFIG_NO_WPA)
79
80 int rsn_preauth_init(struct wpa_sm *sm, const u8 *dst,
81                      struct wpa_ssid *config);
82 void rsn_preauth_deinit(struct wpa_sm *sm);
83 void rsn_preauth_scan_results(struct wpa_sm *sm,
84                               struct wpa_scan_result *results, int count);
85 void pmksa_candidate_add(struct wpa_sm *sm, const u8 *bssid,
86                          int prio, int preauth);
87 void rsn_preauth_candidate_process(struct wpa_sm *sm);
88 int rsn_preauth_get_status(struct wpa_sm *sm, char *buf, size_t buflen,
89                            int verbose);
90 int rsn_preauth_in_progress(struct wpa_sm *sm);
91
92 #else /* IEEE8021X_EAPOL and !CONFIG_NO_WPA */
93
94 static inline void rsn_preauth_candidate_process(struct wpa_sm *sm)
95 {
96 }
97
98 static inline int rsn_preauth_init(struct wpa_sm *sm, const u8 *dst,
99                                    struct wpa_ssid *config)
100 {
101         return -1;
102 }
103
104 static inline void rsn_preauth_deinit(struct wpa_sm *sm)
105 {
106 }
107 static inline void rsn_preauth_scan_results(struct wpa_sm *sm,
108                                             struct wpa_scan_result *results,
109                                             int count)
110 {
111 }
112
113 static inline void pmksa_candidate_add(struct wpa_sm *sm,
114                                        const u8 *bssid,
115                                        int prio, int preauth)
116 {
117 }
118
119 static inline int rsn_preauth_get_status(struct wpa_sm *sm, char *buf,
120                                          size_t buflen, int verbose)
121 {
122         return 0;
123 }
124
125 static inline int rsn_preauth_in_progress(struct wpa_sm *sm)
126 {
127         return 0;
128 }
129
130 #endif /* IEEE8021X_EAPOL and !CONFIG_NO_WPA */
131
132 #endif /* PREAUTH_H */