eapol_supp_sm.h
Go to the documentation of this file.
00001 /*
00002  * EAPOL supplicant state machines
00003  * Copyright (c) 2004-2008, 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 EAPOL_SUPP_SM_H
00016 #define EAPOL_SUPP_SM_H
00017 
00018 #include "common/defs.h"
00019 
00020 typedef enum { Unauthorized, Authorized } PortStatus;
00021 typedef enum { Auto, ForceUnauthorized, ForceAuthorized } PortControl;
00022 
00026 struct eapol_config {
00035         int accept_802_1x_keys;
00036 
00037 #define EAPOL_REQUIRE_KEY_UNICAST BIT(0)
00038 #define EAPOL_REQUIRE_KEY_BROADCAST BIT(1)
00039 
00046         int required_keys;
00047 
00051         int fast_reauth;
00052 
00056         unsigned int workaround;
00057 
00061         int eap_disabled;
00062 };
00063 
00064 struct eapol_sm;
00065 struct wpa_config_blob;
00066 
00070 struct eapol_ctx {
00074         void *ctx;
00075 
00082         int preauth;
00083 
00095         void (*cb)(struct eapol_sm *eapol, int success, void *ctx);
00096 
00100         void *cb_ctx;
00101 
00105         void *msg_ctx;
00106 
00112         void *scard_ctx;
00113 
00117         void *eapol_send_ctx;
00118 
00127         void (*eapol_done_cb)(void *ctx);
00128 
00137         int (*eapol_send)(void *ctx, int type, const u8 *buf, size_t len);
00138 
00148         int (*set_wep_key)(void *ctx, int unicast, int keyidx,
00149                            const u8 *key, size_t keylen);
00150 
00159         void (*set_config_blob)(void *ctx, struct wpa_config_blob *blob);
00160 
00167         const struct wpa_config_blob * (*get_config_blob)(void *ctx,
00168                                                           const char *name);
00169 
00174         void (*aborted_cached)(void *ctx);
00175 
00182         const char *opensc_engine_path;
00183 
00190         const char *pkcs11_engine_path;
00191 
00199         const char *pkcs11_module_path;
00200 
00206         struct wps_context *wps;
00207 
00214         void (*eap_param_needed)(void *ctx, const char *field,
00215                                  const char *txt);
00216 
00222         void (*port_cb)(void *ctx, int authorized);
00223 };
00224 
00225 
00226 struct eap_peer_config;
00227 
00228 #ifdef IEEE8021X_EAPOL
00229 struct eapol_sm *eapol_sm_init(struct eapol_ctx *ctx);
00230 void eapol_sm_deinit(struct eapol_sm *sm);
00231 void eapol_sm_step(struct eapol_sm *sm);
00232 int eapol_sm_get_status(struct eapol_sm *sm, char *buf, size_t buflen,
00233                         int verbose);
00234 int eapol_sm_get_mib(struct eapol_sm *sm, char *buf, size_t buflen);
00235 void eapol_sm_configure(struct eapol_sm *sm, int heldPeriod, int authPeriod,
00236                         int startPeriod, int maxStart);
00237 int eapol_sm_rx_eapol(struct eapol_sm *sm, const u8 *src, const u8 *buf,
00238                       size_t len);
00239 void eapol_sm_notify_tx_eapol_key(struct eapol_sm *sm);
00240 void eapol_sm_notify_portEnabled(struct eapol_sm *sm, Boolean enabled);
00241 void eapol_sm_notify_portValid(struct eapol_sm *sm, Boolean valid);
00242 void eapol_sm_notify_eap_success(struct eapol_sm *sm, Boolean success);
00243 void eapol_sm_notify_eap_fail(struct eapol_sm *sm, Boolean fail);
00244 void eapol_sm_notify_config(struct eapol_sm *sm,
00245                             struct eap_peer_config *config,
00246                             const struct eapol_config *conf);
00247 int eapol_sm_get_key(struct eapol_sm *sm, u8 *key, size_t len);
00248 void eapol_sm_notify_logoff(struct eapol_sm *sm, Boolean logoff);
00249 void eapol_sm_notify_cached(struct eapol_sm *sm);
00250 void eapol_sm_notify_pmkid_attempt(struct eapol_sm *sm, int attempt);
00251 void eapol_sm_register_scard_ctx(struct eapol_sm *sm, void *ctx);
00252 void eapol_sm_notify_portControl(struct eapol_sm *sm, PortControl portControl);
00253 void eapol_sm_notify_ctrl_attached(struct eapol_sm *sm);
00254 void eapol_sm_notify_ctrl_response(struct eapol_sm *sm);
00255 void eapol_sm_request_reauth(struct eapol_sm *sm);
00256 void eapol_sm_notify_lower_layer_success(struct eapol_sm *sm, int in_eapol_sm);
00257 void eapol_sm_invalidate_cached_session(struct eapol_sm *sm);
00258 #else /* IEEE8021X_EAPOL */
00259 static inline struct eapol_sm *eapol_sm_init(struct eapol_ctx *ctx)
00260 {
00261         free(ctx);
00262         return (struct eapol_sm *) 1;
00263 }
00264 static inline void eapol_sm_deinit(struct eapol_sm *sm)
00265 {
00266 }
00267 static inline void eapol_sm_step(struct eapol_sm *sm)
00268 {
00269 }
00270 static inline int eapol_sm_get_status(struct eapol_sm *sm, char *buf,
00271                                       size_t buflen, int verbose)
00272 {
00273         return 0;
00274 }
00275 static inline int eapol_sm_get_mib(struct eapol_sm *sm, char *buf,
00276                                    size_t buflen)
00277 {
00278         return 0;
00279 }
00280 static inline void eapol_sm_configure(struct eapol_sm *sm, int heldPeriod,
00281                                       int authPeriod, int startPeriod,
00282                                       int maxStart)
00283 {
00284 }
00285 static inline int eapol_sm_rx_eapol(struct eapol_sm *sm, const u8 *src,
00286                                     const u8 *buf, size_t len)
00287 {
00288         return 0;
00289 }
00290 static inline void eapol_sm_notify_tx_eapol_key(struct eapol_sm *sm)
00291 {
00292 }
00293 static inline void eapol_sm_notify_portEnabled(struct eapol_sm *sm,
00294                                                Boolean enabled)
00295 {
00296 }
00297 static inline void eapol_sm_notify_portValid(struct eapol_sm *sm,
00298                                              Boolean valid)
00299 {
00300 }
00301 static inline void eapol_sm_notify_eap_success(struct eapol_sm *sm,
00302                                                Boolean success)
00303 {
00304 }
00305 static inline void eapol_sm_notify_eap_fail(struct eapol_sm *sm, Boolean fail)
00306 {
00307 }
00308 static inline void eapol_sm_notify_config(struct eapol_sm *sm,
00309                                           struct eap_peer_config *config,
00310                                           struct eapol_config *conf)
00311 {
00312 }
00313 static inline int eapol_sm_get_key(struct eapol_sm *sm, u8 *key, size_t len)
00314 {
00315         return -1;
00316 }
00317 static inline void eapol_sm_notify_logoff(struct eapol_sm *sm, Boolean logoff)
00318 {
00319 }
00320 static inline void eapol_sm_notify_cached(struct eapol_sm *sm)
00321 {
00322 }
00323 #define eapol_sm_notify_pmkid_attempt(sm, attempt) do { } while (0)
00324 #define eapol_sm_register_scard_ctx(sm, ctx) do { } while (0)
00325 static inline void eapol_sm_notify_portControl(struct eapol_sm *sm,
00326                                                PortControl portControl)
00327 {
00328 }
00329 static inline void eapol_sm_notify_ctrl_attached(struct eapol_sm *sm)
00330 {
00331 }
00332 static inline void eapol_sm_notify_ctrl_response(struct eapol_sm *sm)
00333 {
00334 }
00335 static inline void eapol_sm_request_reauth(struct eapol_sm *sm)
00336 {
00337 }
00338 static inline void eapol_sm_notify_lower_layer_success(struct eapol_sm *sm,
00339                                                        int in_eapol_sm)
00340 {
00341 }
00342 static inline void eapol_sm_invalidate_cached_session(struct eapol_sm *sm)
00343 {
00344 }
00345 #endif /* IEEE8021X_EAPOL */
00346 
00347 #endif /* EAPOL_SUPP_SM_H */


wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Jan 2 2014 11:26:37