From: Andreas Steffen Date: Sun, 14 Nov 2010 10:23:47 +0000 (+0100) Subject: configure recommendation policy via strongswan.conf X-Git-Tag: 4.5.1~518 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de1cb3283a788a74e3dfeeeb4c49a4a489dad1cd;p=thirdparty%2Fstrongswan.git configure recommendation policy via strongswan.conf --- diff --git a/src/libcharon/Makefile.am b/src/libcharon/Makefile.am index bb820d7c32..3fa2d6b60d 100644 --- a/src/libcharon/Makefile.am +++ b/src/libcharon/Makefile.am @@ -90,7 +90,8 @@ sa/tasks/task.c sa/tasks/task.h \ tnc/tncif.h tnc/tncifimc.h tnc/tncifimv.h \ tnc/tncifimv_names.h tnc/tncifimv_names.c \ tnc/imc/imc.h tnc/imc/imc_manager.h \ -tnc/imv/imv.h tnc/imv/imv_manager.h tnc/imv/imv_recommendations.h \ +tnc/imv/imv.h tnc/imv/imv_manager.h \ +tnc/imv/imv_recommendations.c tnc/imv/imv_recommendations.h \ tnc/tnccs/tnccs.c tnc/tnccs/tnccs.h \ tnc/tnccs/tnccs_manager.c tnc/tnccs/tnccs_manager.h diff --git a/src/libcharon/plugins/tnc_imv/tnc_imv_manager.c b/src/libcharon/plugins/tnc_imv/tnc_imv_manager.c index 527879e113..f378510cba 100644 --- a/src/libcharon/plugins/tnc_imv/tnc_imv_manager.c +++ b/src/libcharon/plugins/tnc_imv/tnc_imv_manager.c @@ -46,6 +46,11 @@ struct private_tnc_imv_manager_t { * Next IMV ID to be assigned */ TNC_IMVID next_imv_id; + + /** + * Policy defining how to derive final recommendation from individual ones + */ + recommendation_policy_t policy; }; METHOD(imv_manager_t, add, bool, @@ -255,6 +260,7 @@ METHOD(imv_manager_t, destroy, void, imv_manager_t* tnc_imv_manager_create(void) { private_tnc_imv_manager_t *this; + recommendation_policy_t policy; INIT(this, .public = { @@ -272,6 +278,10 @@ imv_manager_t* tnc_imv_manager_create(void) .imvs = linked_list_create(), .next_imv_id = 1, ); + policy = enum_from_name(recommendation_policy_names, + lib->settings->get_str(lib->settings, + "charon.plugins.tnc-imv.recommendation_policy", "any")); + this->policy = (policy != -1) ? policy : RECOMMENDATION_POLICY_NONE; return &this->public; } diff --git a/src/libcharon/tnc/imv/imv_recommendations.c b/src/libcharon/tnc/imv/imv_recommendations.c new file mode 100644 index 0000000000..99c92c78f2 --- /dev/null +++ b/src/libcharon/tnc/imv/imv_recommendations.c @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2010 Andreas Steffen + * HSR Hochschule fuer Technik Rapperswil + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. See . + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "imv_recommendations.h" + +ENUM(recommendation_policy_names, RECOMMENDATION_POLICY_NONE, + RECOMMENDATION_POLICY_ALL, + "none", + "any", + "all" +); + diff --git a/src/libcharon/tnc/imv/imv_recommendations.h b/src/libcharon/tnc/imv/imv_recommendations.h index daf618b659..c0fe01b60a 100644 --- a/src/libcharon/tnc/imv/imv_recommendations.h +++ b/src/libcharon/tnc/imv/imv_recommendations.h @@ -24,6 +24,17 @@ #include #include +typedef enum recommendation_policy_t recommendation_policy_t; + +enum recommendation_policy_t { + RECOMMENDATION_POLICY_NONE, + RECOMMENDATION_POLICY_ANY, + RECOMMENDATION_POLICY_ALL +}; + +extern enum_name_t *recommendation_policy_names; + + typedef struct recommendations_t recommendations_t; /**