wpa.h
Go to the documentation of this file.
00001 /*
00002  * wpa_supplicant - WPA definitions
00003  * Copyright (c) 2003-2007, Jouni Malinen <j@w1.fi>
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 2 as
00007  * published by the Free Software Foundation.
00008  *
00009  * Alternatively, this software may be distributed under the terms of BSD
00010  * license.
00011  *
00012  * See README and COPYING for more details.
00013  */
00014 
00015 #ifndef WPA_H
00016 #define WPA_H
00017 
00018 #include "common/defs.h"
00019 #include "common/eapol_common.h"
00020 #include "common/wpa_common.h"
00021 
00022 struct wpa_sm;
00023 struct eapol_sm;
00024 struct wpa_config_blob;
00025 
00026 struct wpa_sm_ctx {
00027         void *ctx; /* pointer to arbitrary upper level context */
00028         void *msg_ctx; /* upper level context for wpa_msg() calls */
00029 
00030         void (*set_state)(void *ctx, enum wpa_states state);
00031         enum wpa_states (*get_state)(void *ctx);
00032         void (*deauthenticate)(void * ctx, int reason_code); 
00033         void (*disassociate)(void *ctx, int reason_code);
00034         int (*set_key)(void *ctx, enum wpa_alg alg,
00035                        const u8 *addr, int key_idx, int set_tx,
00036                        const u8 *seq, size_t seq_len,
00037                        const u8 *key, size_t key_len);
00038         void * (*get_network_ctx)(void *ctx);
00039         int (*get_bssid)(void *ctx, u8 *bssid);
00040         int (*ether_send)(void *ctx, const u8 *dest, u16 proto, const u8 *buf,
00041                           size_t len);
00042         int (*get_beacon_ie)(void *ctx);
00043         void (*cancel_auth_timeout)(void *ctx);
00044         u8 * (*alloc_eapol)(void *ctx, u8 type, const void *data, u16 data_len,
00045                             size_t *msg_len, void **data_pos);
00046         int (*add_pmkid)(void *ctx, const u8 *bssid, const u8 *pmkid);
00047         int (*remove_pmkid)(void *ctx, const u8 *bssid, const u8 *pmkid);
00048         void (*set_config_blob)(void *ctx, struct wpa_config_blob *blob);
00049         const struct wpa_config_blob * (*get_config_blob)(void *ctx,
00050                                                           const char *name);
00051         int (*mlme_setprotection)(void *ctx, const u8 *addr,
00052                                   int protection_type, int key_type);
00053         int (*update_ft_ies)(void *ctx, const u8 *md, const u8 *ies,
00054                              size_t ies_len);
00055         int (*send_ft_action)(void *ctx, u8 action, const u8 *target_ap,
00056                               const u8 *ies, size_t ies_len);
00057         int (*mark_authenticated)(void *ctx, const u8 *target_ap);
00058 };
00059 
00060 
00061 enum wpa_sm_conf_params {
00062         RSNA_PMK_LIFETIME /* dot11RSNAConfigPMKLifetime */,
00063         RSNA_PMK_REAUTH_THRESHOLD /* dot11RSNAConfigPMKReauthThreshold */,
00064         RSNA_SA_TIMEOUT /* dot11RSNAConfigSATimeout */,
00065         WPA_PARAM_PROTO,
00066         WPA_PARAM_PAIRWISE,
00067         WPA_PARAM_GROUP,
00068         WPA_PARAM_KEY_MGMT,
00069         WPA_PARAM_MGMT_GROUP,
00070         WPA_PARAM_RSN_ENABLED,
00071         WPA_PARAM_MFP
00072 };
00073 
00074 struct rsn_supp_config {
00075         void *network_ctx;
00076         int peerkey_enabled;
00077         int allowed_pairwise_cipher; /* bitfield of WPA_CIPHER_* */
00078         int proactive_key_caching;
00079         int eap_workaround;
00080         void *eap_conf_ctx;
00081         const u8 *ssid;
00082         size_t ssid_len;
00083         int wpa_ptk_rekey;
00084 };
00085 
00086 #ifndef CONFIG_NO_WPA
00087 
00088 struct wpa_sm * wpa_sm_init(struct wpa_sm_ctx *ctx);
00089 void wpa_sm_deinit(struct wpa_sm *sm);
00090 void wpa_sm_notify_assoc(struct wpa_sm *sm, const u8 *bssid);
00091 void wpa_sm_notify_disassoc(struct wpa_sm *sm);
00092 void wpa_sm_set_pmk(struct wpa_sm *sm, const u8 *pmk, size_t pmk_len);
00093 void wpa_sm_set_pmk_from_pmksa(struct wpa_sm *sm);
00094 void wpa_sm_set_fast_reauth(struct wpa_sm *sm, int fast_reauth);
00095 void wpa_sm_set_scard_ctx(struct wpa_sm *sm, void *scard_ctx);
00096 void wpa_sm_set_config(struct wpa_sm *sm, struct rsn_supp_config *config);
00097 void wpa_sm_set_own_addr(struct wpa_sm *sm, const u8 *addr);
00098 void wpa_sm_set_ifname(struct wpa_sm *sm, const char *ifname,
00099                        const char *bridge_ifname);
00100 void wpa_sm_set_eapol(struct wpa_sm *sm, struct eapol_sm *eapol);
00101 int wpa_sm_set_assoc_wpa_ie(struct wpa_sm *sm, const u8 *ie, size_t len);
00102 int wpa_sm_set_assoc_wpa_ie_default(struct wpa_sm *sm, u8 *wpa_ie,
00103                                     size_t *wpa_ie_len);
00104 int wpa_sm_set_ap_wpa_ie(struct wpa_sm *sm, const u8 *ie, size_t len);
00105 int wpa_sm_set_ap_rsn_ie(struct wpa_sm *sm, const u8 *ie, size_t len);
00106 int wpa_sm_get_mib(struct wpa_sm *sm, char *buf, size_t buflen);
00107 
00108 int wpa_sm_set_param(struct wpa_sm *sm, enum wpa_sm_conf_params param,
00109                      unsigned int value);
00110 unsigned int wpa_sm_get_param(struct wpa_sm *sm,
00111                               enum wpa_sm_conf_params param);
00112 
00113 int wpa_sm_get_status(struct wpa_sm *sm, char *buf, size_t buflen,
00114                       int verbose);
00115 
00116 void wpa_sm_key_request(struct wpa_sm *sm, int error, int pairwise);
00117 
00118 int wpa_parse_wpa_ie(const u8 *wpa_ie, size_t wpa_ie_len,
00119                      struct wpa_ie_data *data);
00120 
00121 void wpa_sm_aborted_cached(struct wpa_sm *sm);
00122 int wpa_sm_rx_eapol(struct wpa_sm *sm, const u8 *src_addr,
00123                     const u8 *buf, size_t len);
00124 int wpa_sm_parse_own_wpa_ie(struct wpa_sm *sm, struct wpa_ie_data *data);
00125 int wpa_sm_pmksa_cache_list(struct wpa_sm *sm, char *buf, size_t len);
00126 void wpa_sm_drop_sa(struct wpa_sm *sm);
00127 int wpa_sm_has_ptk(struct wpa_sm *sm);
00128 
00129 #else /* CONFIG_NO_WPA */
00130 
00131 static inline struct wpa_sm * wpa_sm_init(struct wpa_sm_ctx *ctx)
00132 {
00133         return (struct wpa_sm *) 1;
00134 }
00135 
00136 static inline void wpa_sm_deinit(struct wpa_sm *sm)
00137 {
00138 }
00139 
00140 static inline void wpa_sm_notify_assoc(struct wpa_sm *sm, const u8 *bssid)
00141 {
00142 }
00143 
00144 static inline void wpa_sm_notify_disassoc(struct wpa_sm *sm)
00145 {
00146 }
00147 
00148 static inline void wpa_sm_set_pmk(struct wpa_sm *sm, const u8 *pmk,
00149                                   size_t pmk_len)
00150 {
00151 }
00152 
00153 static inline void wpa_sm_set_pmk_from_pmksa(struct wpa_sm *sm)
00154 {
00155 }
00156 
00157 static inline void wpa_sm_set_fast_reauth(struct wpa_sm *sm, int fast_reauth)
00158 {
00159 }
00160 
00161 static inline void wpa_sm_set_scard_ctx(struct wpa_sm *sm, void *scard_ctx)
00162 {
00163 }
00164 
00165 static inline void wpa_sm_set_config(struct wpa_sm *sm,
00166                                      struct rsn_supp_config *config)
00167 {
00168 }
00169 
00170 static inline void wpa_sm_set_own_addr(struct wpa_sm *sm, const u8 *addr)
00171 {
00172 }
00173 
00174 static inline void wpa_sm_set_ifname(struct wpa_sm *sm, const char *ifname,
00175                                      const char *bridge_ifname)
00176 {
00177 }
00178 
00179 static inline void wpa_sm_set_eapol(struct wpa_sm *sm, struct eapol_sm *eapol)
00180 {
00181 }
00182 
00183 static inline int wpa_sm_set_assoc_wpa_ie(struct wpa_sm *sm, const u8 *ie,
00184                                           size_t len)
00185 {
00186         return -1;
00187 }
00188 
00189 static inline int wpa_sm_set_assoc_wpa_ie_default(struct wpa_sm *sm,
00190                                                   u8 *wpa_ie,
00191                                                   size_t *wpa_ie_len)
00192 {
00193         return -1;
00194 }
00195 
00196 static inline int wpa_sm_set_ap_wpa_ie(struct wpa_sm *sm, const u8 *ie,
00197                                        size_t len)
00198 {
00199         return -1;
00200 }
00201 
00202 static inline int wpa_sm_set_ap_rsn_ie(struct wpa_sm *sm, const u8 *ie,
00203                                        size_t len)
00204 {
00205         return -1;
00206 }
00207 
00208 static inline int wpa_sm_get_mib(struct wpa_sm *sm, char *buf, size_t buflen)
00209 {
00210         return 0;
00211 }
00212 
00213 static inline int wpa_sm_set_param(struct wpa_sm *sm,
00214                                    enum wpa_sm_conf_params param,
00215                                    unsigned int value)
00216 {
00217         return -1;
00218 }
00219 
00220 static inline unsigned int wpa_sm_get_param(struct wpa_sm *sm,
00221                                             enum wpa_sm_conf_params param)
00222 {
00223         return 0;
00224 }
00225 
00226 static inline int wpa_sm_get_status(struct wpa_sm *sm, char *buf,
00227                                     size_t buflen, int verbose)
00228 {
00229         return 0;
00230 }
00231 
00232 static inline void wpa_sm_key_request(struct wpa_sm *sm, int error,
00233                                       int pairwise)
00234 {
00235 }
00236 
00237 static inline int wpa_parse_wpa_ie(const u8 *wpa_ie, size_t wpa_ie_len,
00238                                    struct wpa_ie_data *data)
00239 {
00240         return -1;
00241 }
00242 
00243 static inline void wpa_sm_aborted_cached(struct wpa_sm *sm)
00244 {
00245 }
00246 
00247 static inline int wpa_sm_rx_eapol(struct wpa_sm *sm, const u8 *src_addr,
00248                                   const u8 *buf, size_t len)
00249 {
00250         return -1;
00251 }
00252 
00253 static inline int wpa_sm_parse_own_wpa_ie(struct wpa_sm *sm,
00254                                           struct wpa_ie_data *data)
00255 {
00256         return -1;
00257 }
00258 
00259 static inline int wpa_sm_pmksa_cache_list(struct wpa_sm *sm, char *buf,
00260                                           size_t len)
00261 {
00262         return -1;
00263 }
00264 
00265 static inline void wpa_sm_drop_sa(struct wpa_sm *sm)
00266 {
00267 }
00268 
00269 static inline int wpa_sm_has_ptk(struct wpa_sm *sm)
00270 {
00271         return 0;
00272 }
00273 
00274 #endif /* CONFIG_NO_WPA */
00275 
00276 #ifdef CONFIG_PEERKEY
00277 int wpa_sm_stkstart(struct wpa_sm *sm, const u8 *peer);
00278 #else /* CONFIG_PEERKEY */
00279 static inline int wpa_sm_stkstart(struct wpa_sm *sm, const u8 *peer)
00280 {
00281         return -1;
00282 }
00283 #endif /* CONFIG_PEERKEY */
00284 
00285 #ifdef CONFIG_IEEE80211R
00286 
00287 int wpa_sm_set_ft_params(struct wpa_sm *sm, const u8 *ies, size_t ies_len);
00288 int wpa_ft_prepare_auth_request(struct wpa_sm *sm, const u8 *mdie);
00289 int wpa_ft_process_response(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
00290                             int ft_action, const u8 *target_ap,
00291                             const u8 *ric_ies, size_t ric_ies_len);
00292 int wpa_ft_is_completed(struct wpa_sm *sm);
00293 int wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies,
00294                                  size_t ies_len, const u8 *src_addr);
00295 int wpa_ft_start_over_ds(struct wpa_sm *sm, const u8 *target_ap,
00296                          const u8 *mdie);
00297 
00298 #else /* CONFIG_IEEE80211R */
00299 
00300 static inline int
00301 wpa_sm_set_ft_params(struct wpa_sm *sm, const u8 *ies, size_t ies_len)
00302 {
00303         return 0;
00304 }
00305 
00306 static inline int wpa_ft_prepare_auth_request(struct wpa_sm *sm,
00307                                               const u8 *mdie)
00308 {
00309         return 0;
00310 }
00311 
00312 static inline int
00313 wpa_ft_process_response(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
00314                         int ft_action, const u8 *target_ap)
00315 {
00316         return 0;
00317 }
00318 
00319 static inline int wpa_ft_is_completed(struct wpa_sm *sm)
00320 {
00321         return 0;
00322 }
00323 
00324 static inline int
00325 wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
00326                              const u8 *src_addr)
00327 {
00328         return -1;
00329 }
00330 
00331 #endif /* CONFIG_IEEE80211R */
00332 
00333 #endif /* WPA_H */


wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Apr 24 2014 15:34:36