Return to tnccs_manager.c CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / strongswan / src / libtnccs / tnc / tnccs |
1.1 misho 1: /* 2: * Copyright (C) 2011 Andreas Steffen 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 "tnccs_manager.h" 17: 18: #include "tnc/tnc.h" 19: 20: #include <utils/debug.h> 21: 22: /** 23: * See header 24: */ 25: bool tnccs_method_register(plugin_t *plugin, plugin_feature_t *feature, 26: bool reg, void *data) 27: { 28: if (!tnc || !tnc->tnccs) 29: { 30: DBG1(DBG_TNC, "TNC TNCCS manager does not exist"); 31: return FALSE; 32: } 33: if (reg) 34: { 35: if (feature->type == FEATURE_CUSTOM) 36: { 37: tnccs_type_t type = TNCCS_UNKNOWN; 38: 39: if (streq(feature->arg.custom, "tnccs-2.0")) 40: { 41: type = TNCCS_2_0; 42: } 43: else if (streq(feature->arg.custom, "tnccs-1.1")) 44: { 45: type = TNCCS_1_1; 46: } 47: else if (streq(feature->arg.custom, "tnccs-dynamic")) 48: { 49: type = TNCCS_DYNAMIC; 50: } 51: else 52: { 53: return FALSE; 54: } 55: tnc->tnccs->add_method(tnc->tnccs, type, (tnccs_constructor_t)data); 56: } 57: } 58: else 59: { 60: tnc->tnccs->remove_method(tnc->tnccs, (tnccs_constructor_t)data); 61: } 62: return TRUE; 63: }