Annotation of embedaddon/strongswan/src/libcharon/plugins/eap_sim/eap_sim_plugin.c, revision 1.1
1.1 ! misho 1: /*
! 2: * Copyright (C) 2008-2009 Martin Willi
! 3: * HSR Hochschule fuer Technik Rapperswil
! 4: *
! 5: * This program is free software; you can redistribute it and/or modify it
! 6: * under the terms of the GNU General Public License as published by the
! 7: * Free Software Foundation; either version 2 of the License, or (at your
! 8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
! 9: *
! 10: * This program is distributed in the hope that it will be useful, but
! 11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
! 12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
! 13: * for more details.
! 14: */
! 15:
! 16: #include "eap_sim_plugin.h"
! 17:
! 18: #include "eap_sim_server.h"
! 19: #include "eap_sim_peer.h"
! 20:
! 21: #include <daemon.h>
! 22: #include <simaka_manager.h>
! 23:
! 24: typedef struct private_eap_sim_plugin_t private_eap_sim_plugin_t;
! 25:
! 26: /**
! 27: * Private data of an eap_sim_plugin_t object.
! 28: */
! 29: struct private_eap_sim_plugin_t {
! 30:
! 31: /**
! 32: * Public interface.
! 33: */
! 34: eap_sim_plugin_t public;
! 35:
! 36: /**
! 37: * EAP-SIM backend manager
! 38: */
! 39: simaka_manager_t *mgr;
! 40: };
! 41:
! 42: METHOD(plugin_t, get_name, char*,
! 43: private_eap_sim_plugin_t *this)
! 44: {
! 45: return "eap-sim";
! 46: }
! 47:
! 48: METHOD(plugin_t, get_features, int,
! 49: private_eap_sim_plugin_t *this, plugin_feature_t *features[])
! 50: {
! 51: static plugin_feature_t f[] = {
! 52: PLUGIN_PROVIDE(CUSTOM, "sim-manager"),
! 53: PLUGIN_CALLBACK(eap_method_register, eap_sim_server_create),
! 54: PLUGIN_PROVIDE(EAP_SERVER, EAP_SIM),
! 55: PLUGIN_DEPENDS(RNG, RNG_WEAK),
! 56: PLUGIN_DEPENDS(HASHER, HASH_SHA1),
! 57: PLUGIN_DEPENDS(PRF, PRF_FIPS_SHA1_160),
! 58: PLUGIN_DEPENDS(SIGNER, AUTH_HMAC_SHA1_128),
! 59: PLUGIN_DEPENDS(CRYPTER, ENCR_AES_CBC, 16),
! 60: PLUGIN_CALLBACK(eap_method_register, eap_sim_peer_create),
! 61: PLUGIN_PROVIDE(EAP_PEER, EAP_SIM),
! 62: PLUGIN_DEPENDS(RNG, RNG_WEAK),
! 63: PLUGIN_DEPENDS(HASHER, HASH_SHA1),
! 64: PLUGIN_DEPENDS(PRF, PRF_FIPS_SHA1_160),
! 65: PLUGIN_DEPENDS(SIGNER, AUTH_HMAC_SHA1_128),
! 66: PLUGIN_DEPENDS(CRYPTER, ENCR_AES_CBC, 16),
! 67: };
! 68: *features = f;
! 69: return countof(f);
! 70: }
! 71:
! 72: METHOD(plugin_t, destroy, void,
! 73: private_eap_sim_plugin_t *this)
! 74: {
! 75: lib->set(lib, "sim-manager", NULL);
! 76: this->mgr->destroy(this->mgr);
! 77: free(this);
! 78: }
! 79:
! 80: /*
! 81: * see header file
! 82: */
! 83: plugin_t *eap_sim_plugin_create()
! 84: {
! 85: private_eap_sim_plugin_t *this;
! 86:
! 87: INIT(this,
! 88: .public = {
! 89: .plugin = {
! 90: .get_name = _get_name,
! 91: .get_features = _get_features,
! 92: .destroy = _destroy,
! 93: },
! 94: },
! 95: .mgr = simaka_manager_create(),
! 96: );
! 97: lib->set(lib, "sim-manager", this->mgr);
! 98:
! 99: return &this->public.plugin;
! 100: }
! 101:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>