wpa_supplicant: Report EAP connection progress to DBus
[mech_eap.git] / src / eapol_supp / eapol_supp_sm.h
index 719fbd3..1a20e4b 100644 (file)
@@ -2,20 +2,14 @@
  * EAPOL supplicant state machines
  * Copyright (c) 2004-2008, Jouni Malinen <j@w1.fi>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Alternatively, this software may be distributed under the terms of BSD
- * license.
- *
- * See README and COPYING for more details.
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
  */
 
 #ifndef EAPOL_SUPP_SM_H
 #define EAPOL_SUPP_SM_H
 
-#include "defs.h"
+#include "common/defs.h"
 
 typedef enum { Unauthorized, Authorized } PortStatus;
 typedef enum { Auto, ForceUnauthorized, ForceAuthorized } PortControl;
@@ -173,7 +167,6 @@ struct eapol_ctx {
         */
        void (*aborted_cached)(void *ctx);
 
-#ifdef EAP_TLS_OPENSSL
        /**
         * opensc_engine_path - Path to the OpenSSL engine for opensc
         *
@@ -198,16 +191,54 @@ struct eapol_ctx {
         * module is not loaded.
         */
        const char *pkcs11_module_path;
-#endif /* EAP_TLS_OPENSSL */
+
+       /**
+        * wps - WPS context data
+        *
+        * This is only used by EAP-WSC and can be left %NULL if not available.
+        */
+       struct wps_context *wps;
 
        /**
         * eap_param_needed - Notify that EAP parameter is needed
         * @ctx: Callback context (ctx)
-        * @field: Field name (e.g., "IDENTITY")
+        * @field: Field indicator (e.g., WPA_CTRL_REQ_EAP_IDENTITY)
         * @txt: User readable text describing the required parameter
         */
-       void (*eap_param_needed)(void *ctx, const char *field,
+       void (*eap_param_needed)(void *ctx, enum wpa_ctrl_req_type field,
                                 const char *txt);
+
+       /**
+        * port_cb - Set port authorized/unauthorized callback (optional)
+        * @ctx: Callback context (ctx)
+        * @authorized: Whether the supplicant port is now in authorized state
+        */
+       void (*port_cb)(void *ctx, int authorized);
+
+       /**
+        * cert_cb - Notification of a peer certificate
+        * @ctx: Callback context (ctx)
+        * @depth: Depth in certificate chain (0 = server)
+        * @subject: Subject of the peer certificate
+        * @cert_hash: SHA-256 hash of the certificate
+        * @cert: Peer certificate
+        */
+       void (*cert_cb)(void *ctx, int depth, const char *subject,
+                       const char *cert_hash, const struct wpabuf *cert);
+
+       /**
+        * cert_in_cb - Include server certificates in callback
+        */
+       int cert_in_cb;
+
+       /**
+        * status_cb - Notification of a change in EAP status
+        * @ctx: Callback context (ctx)
+        * @status: Step in the process of EAP authentication
+        * @parameter: Step-specific parameter, e.g., EAP method name
+        */
+       void (*status_cb)(void *ctx, const char *status,
+                         const char *parameter);
 };
 
 
@@ -243,6 +274,7 @@ void eapol_sm_notify_ctrl_response(struct eapol_sm *sm);
 void eapol_sm_request_reauth(struct eapol_sm *sm);
 void eapol_sm_notify_lower_layer_success(struct eapol_sm *sm, int in_eapol_sm);
 void eapol_sm_invalidate_cached_session(struct eapol_sm *sm);
+const char * eapol_sm_get_method_name(struct eapol_sm *sm);
 #else /* IEEE8021X_EAPOL */
 static inline struct eapol_sm *eapol_sm_init(struct eapol_ctx *ctx)
 {
@@ -330,6 +362,10 @@ static inline void eapol_sm_notify_lower_layer_success(struct eapol_sm *sm,
 static inline void eapol_sm_invalidate_cached_session(struct eapol_sm *sm)
 {
 }
+static inline const char * eapol_sm_get_method_name(struct eapol_sm *sm)
+{
+       return NULL;
+}
 #endif /* IEEE8021X_EAPOL */
 
 #endif /* EAPOL_SUPP_SM_H */