wpa_supplicant / hostapd 2.0

eapol_supp_sm.h

Go to the documentation of this file.
00001 
00010 #ifndef EAPOL_SUPP_SM_H
00011 #define EAPOL_SUPP_SM_H
00012 
00013 #include "common/defs.h"
00014 
00015 typedef enum { Unauthorized, Authorized } PortStatus;
00016 typedef enum { Auto, ForceUnauthorized, ForceAuthorized } PortControl;
00017 
00022 struct eapol_config {
00032         int accept_802_1x_keys;
00033 
00034 #define EAPOL_REQUIRE_KEY_UNICAST BIT(0)
00035 #define EAPOL_REQUIRE_KEY_BROADCAST BIT(1)
00036 
00044         int required_keys;
00045 
00050         int fast_reauth;
00051 
00056         unsigned int workaround;
00057 
00062         int eap_disabled;
00063 };
00064 
00065 struct eapol_sm;
00066 struct wpa_config_blob;
00067 
00072 struct eapol_ctx {
00077         void *ctx;
00078 
00086         int preauth;
00087 
00100         void (*cb)(struct eapol_sm *eapol, int success, void *ctx);
00101 
00106         void *cb_ctx;
00107 
00112         void *msg_ctx;
00113 
00120         void *scard_ctx;
00121 
00126         void *eapol_send_ctx;
00127 
00137         void (*eapol_done_cb)(void *ctx);
00138 
00148         int (*eapol_send)(void *ctx, int type, const u8 *buf, size_t len);
00149 
00160         int (*set_wep_key)(void *ctx, int unicast, int keyidx,
00161                            const u8 *key, size_t keylen);
00162 
00172         void (*set_config_blob)(void *ctx, struct wpa_config_blob *blob);
00173 
00181         const struct wpa_config_blob * (*get_config_blob)(void *ctx,
00182                                                           const char *name);
00183 
00189         void (*aborted_cached)(void *ctx);
00190 
00198         const char *opensc_engine_path;
00199 
00207         const char *pkcs11_engine_path;
00208 
00217         const char *pkcs11_module_path;
00218 
00225         struct wps_context *wps;
00226 
00234         void (*eap_param_needed)(void *ctx, enum wpa_ctrl_req_type field,
00235                                  const char *txt);
00236 
00243         void (*port_cb)(void *ctx, int authorized);
00244 
00254         void (*cert_cb)(void *ctx, int depth, const char *subject,
00255                         const char *cert_hash, const struct wpabuf *cert);
00256 
00261         int cert_in_cb;
00262 };
00263 
00264 
00265 struct eap_peer_config;
00266 
00267 #ifdef IEEE8021X_EAPOL
00268 struct eapol_sm *eapol_sm_init(struct eapol_ctx *ctx);
00269 void eapol_sm_deinit(struct eapol_sm *sm);
00270 void eapol_sm_step(struct eapol_sm *sm);
00271 int eapol_sm_get_status(struct eapol_sm *sm, char *buf, size_t buflen,
00272                         int verbose);
00273 int eapol_sm_get_mib(struct eapol_sm *sm, char *buf, size_t buflen);
00274 void eapol_sm_configure(struct eapol_sm *sm, int heldPeriod, int authPeriod,
00275                         int startPeriod, int maxStart);
00276 int eapol_sm_rx_eapol(struct eapol_sm *sm, const u8 *src, const u8 *buf,
00277                       size_t len);
00278 void eapol_sm_notify_tx_eapol_key(struct eapol_sm *sm);
00279 void eapol_sm_notify_portEnabled(struct eapol_sm *sm, Boolean enabled);
00280 void eapol_sm_notify_portValid(struct eapol_sm *sm, Boolean valid);
00281 void eapol_sm_notify_eap_success(struct eapol_sm *sm, Boolean success);
00282 void eapol_sm_notify_eap_fail(struct eapol_sm *sm, Boolean fail);
00283 void eapol_sm_notify_config(struct eapol_sm *sm,
00284                             struct eap_peer_config *config,
00285                             const struct eapol_config *conf);
00286 int eapol_sm_get_key(struct eapol_sm *sm, u8 *key, size_t len);
00287 void eapol_sm_notify_logoff(struct eapol_sm *sm, Boolean logoff);
00288 void eapol_sm_notify_cached(struct eapol_sm *sm);
00289 void eapol_sm_notify_pmkid_attempt(struct eapol_sm *sm, int attempt);
00290 void eapol_sm_register_scard_ctx(struct eapol_sm *sm, void *ctx);
00291 void eapol_sm_notify_portControl(struct eapol_sm *sm, PortControl portControl);
00292 void eapol_sm_notify_ctrl_attached(struct eapol_sm *sm);
00293 void eapol_sm_notify_ctrl_response(struct eapol_sm *sm);
00294 void eapol_sm_request_reauth(struct eapol_sm *sm);
00295 void eapol_sm_notify_lower_layer_success(struct eapol_sm *sm, int in_eapol_sm);
00296 void eapol_sm_invalidate_cached_session(struct eapol_sm *sm);
00297 const char * eapol_sm_get_method_name(struct eapol_sm *sm);
00298 #else /* IEEE8021X_EAPOL */
00299 static inline struct eapol_sm *eapol_sm_init(struct eapol_ctx *ctx)
00300 {
00301         free(ctx);
00302         return (struct eapol_sm *) 1;
00303 }
00304 static inline void eapol_sm_deinit(struct eapol_sm *sm)
00305 {
00306 }
00307 static inline void eapol_sm_step(struct eapol_sm *sm)
00308 {
00309 }
00310 static inline int eapol_sm_get_status(struct eapol_sm *sm, char *buf,
00311                                       size_t buflen, int verbose)
00312 {
00313         return 0;
00314 }
00315 static inline int eapol_sm_get_mib(struct eapol_sm *sm, char *buf,
00316                                    size_t buflen)
00317 {
00318         return 0;
00319 }
00320 static inline void eapol_sm_configure(struct eapol_sm *sm, int heldPeriod,
00321                                       int authPeriod, int startPeriod,
00322                                       int maxStart)
00323 {
00324 }
00325 static inline int eapol_sm_rx_eapol(struct eapol_sm *sm, const u8 *src,
00326                                     const u8 *buf, size_t len)
00327 {
00328         return 0;
00329 }
00330 static inline void eapol_sm_notify_tx_eapol_key(struct eapol_sm *sm)
00331 {
00332 }
00333 static inline void eapol_sm_notify_portEnabled(struct eapol_sm *sm,
00334                                                Boolean enabled)
00335 {
00336 }
00337 static inline void eapol_sm_notify_portValid(struct eapol_sm *sm,
00338                                              Boolean valid)
00339 {
00340 }
00341 static inline void eapol_sm_notify_eap_success(struct eapol_sm *sm,
00342                                                Boolean success)
00343 {
00344 }
00345 static inline void eapol_sm_notify_eap_fail(struct eapol_sm *sm, Boolean fail)
00346 {
00347 }
00348 static inline void eapol_sm_notify_config(struct eapol_sm *sm,
00349                                           struct eap_peer_config *config,
00350                                           struct eapol_config *conf)
00351 {
00352 }
00353 static inline int eapol_sm_get_key(struct eapol_sm *sm, u8 *key, size_t len)
00354 {
00355         return -1;
00356 }
00357 static inline void eapol_sm_notify_logoff(struct eapol_sm *sm, Boolean logoff)
00358 {
00359 }
00360 static inline void eapol_sm_notify_cached(struct eapol_sm *sm)
00361 {
00362 }
00363 #define eapol_sm_notify_pmkid_attempt(sm, attempt) do { } while (0)
00364 #define eapol_sm_register_scard_ctx(sm, ctx) do { } while (0)
00365 static inline void eapol_sm_notify_portControl(struct eapol_sm *sm,
00366                                                PortControl portControl)
00367 {
00368 }
00369 static inline void eapol_sm_notify_ctrl_attached(struct eapol_sm *sm)
00370 {
00371 }
00372 static inline void eapol_sm_notify_ctrl_response(struct eapol_sm *sm)
00373 {
00374 }
00375 static inline void eapol_sm_request_reauth(struct eapol_sm *sm)
00376 {
00377 }
00378 static inline void eapol_sm_notify_lower_layer_success(struct eapol_sm *sm,
00379                                                        int in_eapol_sm)
00380 {
00381 }
00382 static inline void eapol_sm_invalidate_cached_session(struct eapol_sm *sm)
00383 {
00384 }
00385 static inline const char * eapol_sm_get_method_name(struct eapol_sm *sm)
00386 {
00387         return NULL;
00388 }
00389 #endif /* IEEE8021X_EAPOL */
00390 
00391 #endif /* EAPOL_SUPP_SM_H */
00392 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines