Annotation of embedaddon/strongswan/src/libcharon/sa/eap/eap_manager.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2012 Tobias Brunner
                      3:  * Copyright (C) 2008 Martin Willi
                      4:  * HSR Hochschule fuer Technik Rapperswil
                      5:  *
                      6:  * This program is free software; you can redistribute it and/or modify it
                      7:  * under the terms of the GNU General Public License as published by the
                      8:  * Free Software Foundation; either version 2 of the License, or (at your
                      9:  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
                     10:  *
                     11:  * This program is distributed in the hope that it will be useful, but
                     12:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
                     13:  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
                     14:  * for more details.
                     15:  */
                     16: 
                     17: /**
                     18:  * @defgroup eap_manager eap_manager
                     19:  * @{ @ingroup eap
                     20:  */
                     21: 
                     22: #ifndef EAP_MANAGER_H_
                     23: #define EAP_MANAGER_H_
                     24: 
                     25: #include <sa/eap/eap_method.h>
                     26: 
                     27: typedef struct eap_manager_t eap_manager_t;
                     28: 
                     29: /**
                     30:  * The EAP manager manages all EAP implementations and creates instances.
                     31:  *
                     32:  * A plugin registers it's implemented EAP method at the manager by
                     33:  * providing type and a constructor function. The manager then instantiates
                     34:  * eap_method_t instances through the provided constructor to handle
                     35:  * EAP authentication.
                     36:  */
                     37: struct eap_manager_t {
                     38: 
                     39:        /**
                     40:         * Register a EAP method implementation.
                     41:         *
                     42:         * @param method                vendor specific method, if vendor != 0
                     43:         * @param vendor                vendor ID, 0 for non-vendor (default) EAP methods
                     44:         * @param role                  EAP role of the registered method
                     45:         * @param constructor   constructor function, returns an eap_method_t
                     46:         */
                     47:        void (*add_method)(eap_manager_t *this, eap_type_t type, uint32_t vendor,
                     48:                                           eap_role_t role, eap_constructor_t constructor);
                     49: 
                     50:        /**
                     51:         * Unregister a EAP method implementation using it's constructor.
                     52:         *
                     53:         * @param constructor   constructor function to remove, as added in add_method
                     54:         */
                     55:        void (*remove_method)(eap_manager_t *this, eap_constructor_t constructor);
                     56: 
                     57:        /**
                     58:         * Enumerate the registered EAP authentication methods for the given role.
                     59:         *
                     60:         * @note Only authentication types are enumerated (e.g. EAP-Identity is not
                     61:         * even though it is registered as method with this manager).
                     62:         *
                     63:         * @param role                  EAP role of methods to enumerate
                     64:         * @return                              enumerator over (eap_type_t type, uint32_t vendor)
                     65:         */
                     66:        enumerator_t* (*create_enumerator)(eap_manager_t *this, eap_role_t role);
                     67: 
                     68:        /**
                     69:         * Create a new EAP method instance.
                     70:         *
                     71:         * @param type                  type of the EAP method
                     72:         * @param vendor                vendor ID, 0 for non-vendor (default) EAP methods
                     73:         * @param role                  role of EAP method, either EAP_SERVER or EAP_PEER
                     74:         * @param server                identity of the server
                     75:         * @param peer                  identity of the peer (client)
                     76:         * @return                              EAP method instance, NULL if no constructor found
                     77:         */
                     78:        eap_method_t* (*create_instance)(eap_manager_t *this, eap_type_t type,
                     79:                                                                         uint32_t vendor, eap_role_t role,
                     80:                                                                         identification_t *server,
                     81:                                                                         identification_t *peer);
                     82: 
                     83:        /**
                     84:         * Destroy a eap_manager instance.
                     85:         */
                     86:        void (*destroy)(eap_manager_t *this);
                     87: };
                     88: 
                     89: /**
                     90:  * Create a eap_manager instance.
                     91:  */
                     92: eap_manager_t *eap_manager_create();
                     93: 
                     94: #endif /** EAP_MANAGER_H_ @}*/

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>