]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Added a get_name() function to plugin_t, create_plugin_enumerator enumerates over...
authorMartin Willi <martin@revosec.ch>
Mon, 11 Apr 2011 16:54:18 +0000 (18:54 +0200)
committerMartin Willi <martin@revosec.ch>
Fri, 15 Apr 2011 08:07:12 +0000 (10:07 +0200)
107 files changed:
src/libcharon/daemon.c
src/libcharon/plugins/addrblock/addrblock_plugin.c
src/libcharon/plugins/addrblock/addrblock_validator.c
src/libcharon/plugins/android/android_plugin.c
src/libcharon/plugins/coupling/coupling_plugin.c
src/libcharon/plugins/dhcp/dhcp_plugin.c
src/libcharon/plugins/duplicheck/duplicheck_plugin.c
src/libcharon/plugins/eap_aka/eap_aka_plugin.c
src/libcharon/plugins/eap_aka_3gpp2/eap_aka_3gpp2_plugin.c
src/libcharon/plugins/eap_gtc/eap_gtc_plugin.c
src/libcharon/plugins/eap_identity/eap_identity_plugin.c
src/libcharon/plugins/eap_md5/eap_md5_plugin.c
src/libcharon/plugins/eap_mschapv2/eap_mschapv2_plugin.c
src/libcharon/plugins/eap_peap/eap_peap_plugin.c
src/libcharon/plugins/eap_radius/eap_radius_plugin.c
src/libcharon/plugins/eap_sim/eap_sim_plugin.c
src/libcharon/plugins/eap_sim_file/eap_sim_file_plugin.c
src/libcharon/plugins/eap_sim_pcsc/eap_sim_pcsc_plugin.c
src/libcharon/plugins/eap_simaka_pseudonym/eap_simaka_pseudonym_plugin.c
src/libcharon/plugins/eap_simaka_reauth/eap_simaka_reauth_plugin.c
src/libcharon/plugins/eap_simaka_sql/eap_simaka_sql_plugin.c
src/libcharon/plugins/eap_tls/eap_tls_plugin.c
src/libcharon/plugins/eap_tnc/eap_tnc_plugin.c
src/libcharon/plugins/eap_ttls/eap_ttls_plugin.c
src/libcharon/plugins/farp/farp_plugin.c
src/libcharon/plugins/ha/ha_plugin.c
src/libcharon/plugins/led/led_plugin.c
src/libcharon/plugins/load_tester/load_tester_plugin.c
src/libcharon/plugins/maemo/maemo_plugin.c
src/libcharon/plugins/medcli/medcli_plugin.c
src/libcharon/plugins/medsrv/medsrv_plugin.c
src/libcharon/plugins/nm/nm_plugin.c
src/libcharon/plugins/smp/smp.c
src/libcharon/plugins/socket_default/socket_default_plugin.c
src/libcharon/plugins/socket_dynamic/socket_dynamic_plugin.c
src/libcharon/plugins/socket_raw/socket_raw_plugin.c
src/libcharon/plugins/sql/sql_plugin.c
src/libcharon/plugins/stroke/stroke_list.c
src/libcharon/plugins/stroke/stroke_plugin.c
src/libcharon/plugins/tnc_imc/tnc_imc_plugin.c
src/libcharon/plugins/tnc_imv/tnc_imv_plugin.c
src/libcharon/plugins/tnccs_11/tnccs_11_plugin.c
src/libcharon/plugins/tnccs_20/tnccs_20_plugin.c
src/libcharon/plugins/tnccs_dynamic/tnccs_dynamic_plugin.c
src/libcharon/plugins/uci/uci_plugin.c
src/libcharon/plugins/unit_tester/unit_tester.c
src/libcharon/plugins/updown/updown_plugin.c
src/libcharon/plugins/whitelist/whitelist_plugin.c
src/libhydra/plugins/attr/attr_plugin.c
src/libhydra/plugins/attr_sql/attr_sql_plugin.c
src/libhydra/plugins/kernel_klips/kernel_klips_plugin.c
src/libhydra/plugins/kernel_netlink/kernel_netlink_plugin.c
src/libhydra/plugins/kernel_pfkey/kernel_pfkey_plugin.c
src/libhydra/plugins/kernel_pfroute/kernel_pfroute_plugin.c
src/libhydra/plugins/resolve/resolve_plugin.c
src/libstrongswan/plugins/aes/aes_plugin.c
src/libstrongswan/plugins/af_alg/af_alg_crypter.c
src/libstrongswan/plugins/af_alg/af_alg_crypter.h
src/libstrongswan/plugins/af_alg/af_alg_hasher.c
src/libstrongswan/plugins/af_alg/af_alg_hasher.h
src/libstrongswan/plugins/af_alg/af_alg_ops.c
src/libstrongswan/plugins/af_alg/af_alg_ops.h
src/libstrongswan/plugins/af_alg/af_alg_plugin.c
src/libstrongswan/plugins/af_alg/af_alg_prf.c
src/libstrongswan/plugins/af_alg/af_alg_prf.h
src/libstrongswan/plugins/af_alg/af_alg_signer.c
src/libstrongswan/plugins/af_alg/af_alg_signer.h
src/libstrongswan/plugins/agent/agent_plugin.c
src/libstrongswan/plugins/blowfish/blowfish_plugin.c
src/libstrongswan/plugins/ccm/ccm_plugin.c
src/libstrongswan/plugins/constraints/constraints_plugin.c
src/libstrongswan/plugins/ctr/ctr_plugin.c
src/libstrongswan/plugins/curl/curl_plugin.c
src/libstrongswan/plugins/des/des_plugin.c
src/libstrongswan/plugins/dnskey/dnskey_plugin.c
src/libstrongswan/plugins/fips_prf/fips_prf_plugin.c
src/libstrongswan/plugins/gcm/gcm_plugin.c
src/libstrongswan/plugins/gcrypt/gcrypt_plugin.c
src/libstrongswan/plugins/gmp/gmp_plugin.c
src/libstrongswan/plugins/hmac/hmac_plugin.c
src/libstrongswan/plugins/ldap/ldap_plugin.c
src/libstrongswan/plugins/md4/md4_plugin.c
src/libstrongswan/plugins/md5/md5_plugin.c
src/libstrongswan/plugins/mysql/mysql_plugin.c
src/libstrongswan/plugins/openssl/openssl_plugin.c
src/libstrongswan/plugins/padlock/padlock_plugin.c
src/libstrongswan/plugins/pem/pem_plugin.c
src/libstrongswan/plugins/pgp/pgp_plugin.c
src/libstrongswan/plugins/pkcs1/pkcs1_plugin.c
src/libstrongswan/plugins/pkcs11/pkcs11_plugin.c
src/libstrongswan/plugins/plugin.h
src/libstrongswan/plugins/plugin_loader.c
src/libstrongswan/plugins/plugin_loader.h
src/libstrongswan/plugins/pubkey/pubkey_plugin.c
src/libstrongswan/plugins/random/random_plugin.c
src/libstrongswan/plugins/revocation/revocation_plugin.c
src/libstrongswan/plugins/sha1/sha1_plugin.c
src/libstrongswan/plugins/sha2/sha2_plugin.c
src/libstrongswan/plugins/soup/soup_plugin.c
src/libstrongswan/plugins/sqlite/sqlite_plugin.c
src/libstrongswan/plugins/test_vectors/test_vectors_plugin.c
src/libstrongswan/plugins/x509/x509_plugin.c
src/libstrongswan/plugins/xcbc/xcbc_plugin.c
src/pluto/log.c
src/pluto/plugins/xauth/xauth_plugin.c
src/pluto/plutomain.c
src/scepclient/scepclient.c

index 71a1cf29a4b1cb553dc60e812ef193531fc43eca..796e455a7af10baa29a344fbf8fe96965a6fc83f 100644 (file)
@@ -200,15 +200,17 @@ METHOD(daemon_t, start, void,
  */
 static void print_plugins()
 {
-       char buf[512], *plugin;
+       char buf[512];
        int len = 0;
        enumerator_t *enumerator;
+       plugin_t *plugin;
 
        buf[0] = '\0';
        enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
        while (len < sizeof(buf) && enumerator->enumerate(enumerator, &plugin))
        {
-               len += snprintf(&buf[len], sizeof(buf)-len, "%s ", plugin);
+               len += snprintf(&buf[len], sizeof(buf)-len, "%s ",
+                                               plugin->get_name(plugin));
        }
        enumerator->destroy(enumerator);
        DBG1(DBG_DMN, "loaded plugins: %s", buf);
index 5fdb36c5c97be03919b4bb2bbfa47e76cda31058..a64956803f717139e3331a021ab9a3fe84718454 100644 (file)
@@ -43,6 +43,12 @@ struct private_addrblock_plugin_t {
        addrblock_narrow_t *narrower;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_addrblock_plugin_t *this)
+{
+       return "addrblock";
+}
+
 METHOD(plugin_t, destroy, void,
        private_addrblock_plugin_t *this)
 {
@@ -63,6 +69,7 @@ plugin_t *addrblock_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 12cf0c941a852a164df3b29541953e87c79fdfe3..1b07378f73bba54e8885e79f68a3456acce1f70f 100644 (file)
@@ -88,7 +88,7 @@ static bool check_addrblock(x509_t *subject, x509_t *issuer)
 
 METHOD(cert_validator_t, validate, bool,
        private_addrblock_validator_t *this, certificate_t *subject,
-       certificate_t *issuer, bool online, int pathlen, bool anchor,
+       certificate_t *issuer, bool online, u_int pathlen, bool anchor,
        auth_cfg_t *auth)
 {
        if (subject->get_type(subject) == CERT_X509 &&
@@ -114,7 +114,9 @@ addrblock_validator_t *addrblock_validator_create()
 
        INIT(this,
                .public = {
-                       .validator.validate = _validate,
+                       .validator = {
+                               .validate = _validate,
+                       },
                        .destroy = _destroy,
                },
        );
index 3d82d8f609209032ea0a360e5bfb7531b8789fcc..c55a829099d8e1c21de3b40ce3a1b24adcfbb0be 100644 (file)
@@ -54,11 +54,16 @@ struct private_android_plugin_t {
         * Service that interacts with the Android Settings frontend
         */
        android_service_t *service;
-
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_android_plugin_t *this)
+{
+       return "android";
+}
+
 METHOD(plugin_t, destroy, void,
-          private_android_plugin_t *this)
+       private_android_plugin_t *this)
 {
        hydra->attributes->remove_handler(hydra->attributes,
                                                                          &this->handler->handler);
@@ -81,6 +86,7 @@ plugin_t *android_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 8e0705c2ea18ce7c19491d37a274159b54dc7b1f..f2125d97381fe07f5e204fae86099735616b9be6 100644 (file)
@@ -37,6 +37,12 @@ struct private_coupling_plugin_t {
        coupling_validator_t *validator;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_coupling_plugin_t *this)
+{
+       return "coupling";
+}
+
 METHOD(plugin_t, destroy, void,
        private_coupling_plugin_t *this)
 {
@@ -55,6 +61,7 @@ plugin_t *coupling_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index fccc99ba58a21ef07c9b957cbed264d7055e97a2..25906e36e48462b2a48979b320235fa0494c2660 100644 (file)
@@ -44,6 +44,12 @@ struct private_dhcp_plugin_t {
        dhcp_provider_t *provider;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_dhcp_plugin_t *this)
+{
+       return "dhcp";
+}
+
 METHOD(plugin_t, destroy, void,
        private_dhcp_plugin_t *this)
 {
@@ -64,6 +70,7 @@ plugin_t *dhcp_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 69a8dbf45045c36c1df82f4dd442289dc9d6cafa..f8868e4b085990cbb3490a2e67343ee4f88916ba 100644 (file)
@@ -43,6 +43,12 @@ struct private_duplicheck_plugin_t {
        duplicheck_notify_t *notify;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_duplicheck_plugin_t *this)
+{
+       return "duplicheck";
+}
+
 METHOD(plugin_t, destroy, void,
        private_duplicheck_plugin_t *this)
 {
@@ -68,6 +74,7 @@ plugin_t *duplicheck_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 92f5e6650da6e13db38719a7e0d418115ccdb02d..7f120f9aa1dd65b080d75656d7ccc572ae51e6dd 100644 (file)
 
 #include <daemon.h>
 
+METHOD(plugin_t, get_name, char*,
+       eap_aka_plugin_t *this)
+{
+       return "eap-aka";
+}
+
 METHOD(plugin_t, destroy, void,
        eap_aka_plugin_t *this)
 {
@@ -39,6 +45,7 @@ plugin_t *eap_aka_plugin_create()
 
        INIT(this,
                .plugin = {
+                       .get_name = _get_name,
                        .destroy = _destroy,
                },
        );
index fc971b3d929f3c54359338751eb40f27b3e7fb58..743744da2c213daf92648c4e2916108b454d67c4 100644 (file)
@@ -48,6 +48,12 @@ struct private_eap_aka_3gpp2_t {
        eap_aka_3gpp2_functions_t *functions;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_eap_aka_3gpp2_t *this)
+{
+       return "eap-aka-3gpp2";
+}
+
 METHOD(plugin_t, destroy, void,
        private_eap_aka_3gpp2_t *this)
 {
@@ -69,10 +75,11 @@ plugin_t *eap_aka_3gpp2_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
-               this->functions = eap_aka_3gpp2_functions_create();
+               .functions = eap_aka_3gpp2_functions_create(),
        );
 
        if (!this->functions)
index 4eb587dcc434d118526afdefc11dbccf5f135289..da1ee1c716167f2f4a5fb4bbdd8e122fb4c2061e 100644 (file)
 /* missing in cababilities.h */
 #define CAP_AUDIT_WRITE 29
 
+METHOD(plugin_t, get_name, char*,
+       eap_gtc_plugin_t *this)
+{
+       return "eap-gtc";
+}
+
 METHOD(plugin_t, destroy, void,
        eap_gtc_plugin_t *this)
 {
@@ -41,6 +47,7 @@ plugin_t *eap_gtc_plugin_create()
 
        INIT(this,
                .plugin = {
+                       .get_name = _get_name,
                        .destroy = _destroy,
                },
        );
index 079c279098a1efe984b345a1fec2aa83da96b028..57762b3e2466403931ffe5fa3e8ed2eccec9dc59 100644 (file)
 
 #include <daemon.h>
 
+METHOD(plugin_t, get_name, char*,
+       eap_identity_plugin_t *this)
+{
+       return "eap-identity";
+}
+
 METHOD(plugin_t, destroy, void,
        eap_identity_plugin_t *this)
 {
@@ -37,6 +43,7 @@ plugin_t *eap_identity_plugin_create()
 
        INIT(this,
                .plugin = {
+                       .get_name = _get_name,
                        .destroy = _destroy,
                },
        );
index 39a6f5731d8c83d52071ca94e555852194c933b9..13d34e9932c4b2aa679584668d571c78de9e6104 100644 (file)
 
 #include <daemon.h>
 
+METHOD(plugin_t, get_name, char*,
+       eap_md5_plugin_t *this)
+{
+       return "eap-md5";
+}
+
 METHOD(plugin_t, destroy, void,
        eap_md5_plugin_t *this)
 {
@@ -37,6 +43,7 @@ plugin_t *eap_md5_plugin_create()
 
        INIT(this,
                .plugin = {
+                       .get_name = _get_name,
                        .destroy = _destroy,
                },
        );
index f8130e6a4efd4b37b51fe44efe2c57eed0e139fe..ae4f613fdb7d25a4326590866c144b91130643f9 100644 (file)
 
 #include <daemon.h>
 
+METHOD(plugin_t, get_name, char*,
+       eap_mschapv2_plugin_t *this)
+{
+       return "eap-mschapv2";
+}
+
 METHOD(plugin_t, destroy, void,
        eap_mschapv2_plugin_t *this)
 {
@@ -38,6 +44,7 @@ plugin_t *eap_mschapv2_plugin_create()
 
        INIT(this,
                .plugin = {
+                       .get_name = _get_name,
                        .destroy = _destroy,
                },
        );
index 1a0253a75a0e4b01831edd67730beed4d4f91dc8..b39b49c9ed3424e0597a009c9b21728d3ee5e2ec 100644 (file)
 
 #include <daemon.h>
 
+METHOD(plugin_t, get_name, char*,
+       eap_peap_plugin_t *this)
+{
+       return "eap-peap";
+}
 
 METHOD(plugin_t, destroy, void,
        eap_peap_plugin_t *this)
@@ -39,6 +44,7 @@ plugin_t *eap_peap_plugin_create()
 
        INIT(this,
                .plugin = {
+                       .get_name = _get_name,
                        .destroy = _destroy,
                },
        );
index 1c24d77d5f4034cccd5aa6f5ebf3f84f571ca003..80b72e79f214e4f7bb1bc1a0e3d0231fee5935e0 100644 (file)
@@ -49,6 +49,12 @@ struct private_eap_radius_plugin_t {
  */
 static private_eap_radius_plugin_t *instance = NULL;
 
+METHOD(plugin_t, get_name, char*,
+       private_eap_radius_plugin_t *this)
+{
+       return "eap-radius";
+}
+
 METHOD(plugin_t, destroy, void,
        private_eap_radius_plugin_t *this)
 {
@@ -153,6 +159,7 @@ plugin_t *eap_radius_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 8eae6d7d67963212802e1d324183d180e07ae88c..1327f7f2d022532c4f94c9f8eeef5f4322f2b26d 100644 (file)
 
 #include <daemon.h>
 
+METHOD(plugin_t, get_name, char*,
+       eap_sim_plugin_t *this)
+{
+       return "eap-sim";
+}
+
 METHOD(plugin_t, destroy, void,
        eap_sim_plugin_t *this)
 {
@@ -39,6 +45,7 @@ plugin_t *eap_sim_plugin_create()
 
        INIT(this,
                .plugin = {
+                       .get_name = _get_name,
                        .destroy = _destroy,
                },
        );
index 5bb9a9a64c92e38e641c07e6d909a8cc6f7f16f5..97b726d1ab4cf3940eefcc49fd8d94771ac876fb 100644 (file)
@@ -50,6 +50,12 @@ struct private_eap_sim_file_t {
        eap_sim_file_triplets_t *triplets;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_eap_sim_file_t *this)
+{
+       return "eap-sim-file";
+}
+
 METHOD(plugin_t, destroy, void,
        private_eap_sim_file_t *this)
 {
@@ -71,6 +77,7 @@ plugin_t *eap_sim_file_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 52b6ae9a99e06f2d8f67f4923f68abeb99f75ac3..ee8fe9559062136c583dcacf4a988f5494d59a5f 100644 (file)
@@ -35,6 +35,12 @@ struct private_eap_sim_pcsc_plugin_t {
        eap_sim_pcsc_card_t *card;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_eap_sim_pcsc_plugin_t *this)
+{
+       return "eap-sim-pcsc";
+}
+
 METHOD(plugin_t, destroy, void,
        private_eap_sim_pcsc_plugin_t *this)
 {
@@ -53,6 +59,7 @@ plugin_t *eap_sim_pcsc_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index c4a1ec255c301939f066b4d9a02b1317ecfc5f39..507869ede0abc03e6f80f09d0a1322cd6ce32dc6 100644 (file)
@@ -42,6 +42,12 @@ struct private_eap_simaka_pseudonym_t {
        eap_simaka_pseudonym_provider_t *provider;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_eap_simaka_pseudonym_t *this)
+{
+       return "eap-simaka-pseudonym";
+}
+
 METHOD(plugin_t, destroy, void,
        private_eap_simaka_pseudonym_t *this)
 {
@@ -62,6 +68,7 @@ plugin_t *eap_simaka_pseudonym_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index fc7a0b2a116260c878b803da09f47f83302601d4..cf39b436dc9a506227bb7369a5a7b46767c120ba 100644 (file)
@@ -42,6 +42,12 @@ struct private_eap_simaka_reauth_t {
        eap_simaka_reauth_provider_t *provider;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_eap_simaka_reauth_t *this)
+{
+       return "eap-simaka-reauth";
+}
+
 METHOD(plugin_t, destroy, void,
        private_eap_simaka_reauth_t *this)
 {
@@ -62,6 +68,7 @@ plugin_t *eap_simaka_reauth_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 1cc5352d8fdfa9751eab4f7e6001c4329eb02d59..192bfbc1ce2f0c408233ae7db47b1c6706133ed2 100644 (file)
@@ -47,6 +47,12 @@ struct private_eap_simaka_sql_t {
        database_t *db;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_eap_simaka_sql_t *this)
+{
+       return "eap-simaka-sql";
+}
+
 METHOD(plugin_t, destroy, void,
        private_eap_simaka_sql_t *this)
 {
@@ -87,6 +93,7 @@ plugin_t *eap_simaka_sql_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index a7c040bf4e03c06114f5d9ece380349a3f885fe0..c8578b78dc869726832f0c2e292ba9b1255fc5bd 100644 (file)
 
 #include <daemon.h>
 
+METHOD(plugin_t, get_name, char*,
+       eap_tls_plugin_t *this)
+{
+       return "eap-tls";
+}
 
 METHOD(plugin_t, destroy, void,
        eap_tls_plugin_t *this)
@@ -39,6 +44,7 @@ plugin_t *eap_tls_plugin_create()
 
        INIT(this,
                .plugin = {
+                       .get_name = _get_name,
                        .destroy = _destroy,
                },
        );
index 7430e4caca02efd761143036fda7339ad2a562e7..2b982a22bc5aa3c50d486eac15aaf200975540e5 100644 (file)
 
 #include <daemon.h>
 
+METHOD(plugin_t, get_name, char*,
+       eap_tnc_plugin_t *this)
+{
+       return "eap-tnc";
+}
+
 METHOD(plugin_t, destroy, void,
        eap_tnc_plugin_t *this)
 {
@@ -37,6 +43,7 @@ plugin_t *eap_tnc_plugin_create()
 
        INIT(this,
                .plugin = {
+                       .get_name = _get_name,
                        .destroy = _destroy,
                },
        );
index 48e759dcc5d0b0d0ad6260a4500d4fee77522f01..25876807c63da4955cf0a5ac3e654ee59c9fd2c1 100644 (file)
 
 #include <daemon.h>
 
+METHOD(plugin_t, get_name, char*,
+       eap_ttls_plugin_t *this)
+{
+       return "eap-ttls";
+}
 
 METHOD(plugin_t, destroy, void,
        eap_ttls_plugin_t *this)
@@ -39,6 +44,7 @@ plugin_t *eap_ttls_plugin_create()
 
        INIT(this,
                .plugin = {
+                       .get_name = _get_name,
                        .destroy = _destroy,
                },
        );
index d83bc1fd2bb27c1f42814753508500c6dec5e745..a0401e356bb62b48b47f985d99a7e98309768c05 100644 (file)
@@ -43,6 +43,12 @@ struct private_farp_plugin_t {
        farp_spoofer_t *spoofer;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_farp_plugin_t *this)
+{
+       return "farp";
+}
+
 METHOD(plugin_t, destroy, void,
        private_farp_plugin_t *this)
 {
@@ -62,6 +68,7 @@ plugin_t *farp_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 581294e60ae28ed97ade9968cdf2d8563de1b44d..c02e0262a8dc9faa77c2ecff2ec211ef009016e9 100644 (file)
@@ -91,6 +91,12 @@ struct private_ha_plugin_t {
        ha_attribute_t *attr;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_ha_plugin_t *this)
+{
+       return "ha";
+}
+
 METHOD(plugin_t, destroy, void,
        private_ha_plugin_t *this)
 {
@@ -144,6 +150,7 @@ plugin_t *ha_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 322d198ffc550910c3e10ab7546cbd4e078a7d63..04443df321098fe242573eaa32a15e63db99085b 100644 (file)
@@ -37,6 +37,12 @@ struct private_led_plugin_t {
        led_listener_t *listener;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_led_plugin_t *this)
+{
+       return "led";
+}
+
 METHOD(plugin_t, destroy, void,
        private_led_plugin_t *this)
 {
@@ -55,6 +61,7 @@ plugin_t *led_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index e9092e17a3863ca59853a389c988957e5adddaa7..c4a470f517beb2b3882552334f84e3d6075bc7f1 100644 (file)
@@ -146,6 +146,12 @@ static job_requeue_t do_load_test(private_load_tester_plugin_t *this)
        return JOB_REQUEUE_NONE;
 }
 
+METHOD(plugin_t, get_name, char*,
+       private_load_tester_plugin_t *this)
+{
+       return "load-tester";
+}
+
 METHOD(plugin_t, destroy, void,
        private_load_tester_plugin_t *this)
 {
@@ -189,6 +195,7 @@ plugin_t *load_tester_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index d4549f43a7bfb9f540f979fb582f4db60840aa23..2a946a1bc7634b0765bb510193c2dd1479817276 100644 (file)
@@ -34,11 +34,16 @@ struct private_maemo_plugin_t {
         * service
         */
        maemo_service_t *service;
-
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_maemo_plugin_t *this)
+{
+       return "maemo";
+}
+
 METHOD(plugin_t, destroy, void,
-          private_maemo_plugin_t *this)
+       private_maemo_plugin_t *this)
 {
        this->service->destroy(this->service);
        free(this);
@@ -54,6 +59,7 @@ plugin_t *maemo_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 30608a01f6edee2be2e116b80425052188dca3be..c6ee094e5575d7e2c5fd36c6f05dc463a9615742 100644 (file)
@@ -54,6 +54,12 @@ struct private_medcli_plugin_t {
        medcli_listener_t *listener;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_medcli_plugin_t *this)
+{
+       return "medcli";
+}
+
 METHOD(plugin_t, destroy, void,
        private_medcli_plugin_t *this)
 {
@@ -78,6 +84,7 @@ plugin_t *medcli_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 214a43399ccc54b58ffcac22ef3039e22e3f75bb..1b4e4bbc3ac49e11fb60b3583ab7bdeefb1f8a08 100644 (file)
@@ -48,6 +48,12 @@ struct private_medsrv_plugin_t {
        medsrv_config_t *config;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_medsrv_plugin_t *this)
+{
+       return "medsrv";
+}
+
 METHOD(plugin_t, destroy, void,
        private_medsrv_plugin_t *this)
 {
@@ -70,6 +76,7 @@ plugin_t *medsrv_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 860b83d03513626c53555bb0e9da469fa20e0020..c0612404dd44a36b1c840846019d8f1c34051737 100644 (file)
@@ -67,6 +67,12 @@ static job_requeue_t run(private_nm_plugin_t *this)
        return JOB_REQUEUE_NONE;
 }
 
+METHOD(plugin_t, get_name, char*,
+       private_nm_plugin_t *this)
+{
+       return "nm";
+}
+
 METHOD(plugin_t, destroy, void,
        private_nm_plugin_t *this)
 {
@@ -105,6 +111,7 @@ plugin_t *nm_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 0e6cf2a2af60c8e1473141c733ddd222d33e59ee..c65830ba61f5a8fff2b19c32513af1e377e28f67 100644 (file)
@@ -707,6 +707,12 @@ static job_requeue_t dispatch(private_smp_t *this)
        return JOB_REQUEUE_DIRECT;
 }
 
+METHOD(plugin_t, get_name, char*,
+       private_smp_t *this)
+{
+       return "smp";
+}
+
 METHOD(plugin_t, destroy, void,
        private_smp_t *this)
 {
@@ -727,6 +733,7 @@ plugin_t *smp_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index b5dea68b6ba27a1f4c9a1b6ced848699f23427b7..2227f4aa7bce277efa7a5c7579d3e375e425f10b 100644 (file)
@@ -32,9 +32,14 @@ struct private_socket_default_plugin_t {
         * Implements plugin interface
         */
        socket_default_plugin_t public;
-
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_socket_default_plugin_t *this)
+{
+       return "socket-default";
+}
+
 METHOD(plugin_t, destroy, void,
        private_socket_default_plugin_t *this)
 {
@@ -53,6 +58,7 @@ plugin_t *socket_default_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index a6ff14efd97b5a5f1f45e1c0fc0b094b9b1ad7b1..d481ce0ffc77c09cb057c220fc34df64cf0f897d 100644 (file)
@@ -32,9 +32,14 @@ struct private_socket_dynamic_plugin_t {
         * Implements plugin interface
         */
        socket_dynamic_plugin_t public;
-
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_socket_dynamic_plugin_t *this)
+{
+       return "socket-dynamic";
+}
+
 METHOD(plugin_t, destroy, void,
        private_socket_dynamic_plugin_t *this)
 {
@@ -53,6 +58,7 @@ plugin_t *socket_dynamic_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 17a3a8db7d76b773923140d4cda8625599868d52..a441aa36d9795dc1354cb7265184e79ecb43ef7e 100644 (file)
@@ -32,9 +32,14 @@ struct private_socket_raw_plugin_t {
         * Implements plugin interface
         */
        socket_raw_plugin_t public;
-
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_socket_raw_plugin_t *this)
+{
+       return "socket-raw";
+}
+
 METHOD(plugin_t, destroy, void,
        private_socket_raw_plugin_t *this)
 {
@@ -53,6 +58,7 @@ plugin_t *socket_raw_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index ad1eb91b10136423a7ed7bb008fdf6023117aa30..f71ffa111cc69acab2a20e7271e4037245b49e1d 100644 (file)
@@ -53,6 +53,12 @@ struct private_sql_plugin_t {
        sql_logger_t *logger;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_sql_plugin_t *this)
+{
+       return "sql";
+}
+
 METHOD(plugin_t, destroy, void,
        private_sql_plugin_t *this)
 {
@@ -84,6 +90,7 @@ plugin_t *sql_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 36311f09237002f92d87a7139f0394a9a9f89e15..6c42f8f8a677efad5b214f55ac7f9467f70b5b88 100644 (file)
@@ -402,7 +402,8 @@ METHOD(stroke_list_t, status, void,
        if (all)
        {
                peer_cfg_t *peer_cfg;
-               char *plugin, *pool;
+               plugin_t *plugin;
+               char *pool;
                host_t *host;
                u_int32_t dpd;
                time_t since, now;
@@ -431,7 +432,7 @@ METHOD(stroke_list_t, status, void,
                enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
                while (enumerator->enumerate(enumerator, &plugin))
                {
-                       fprintf(out, "%s ", plugin);
+                       fprintf(out, "%s ", plugin->get_name(plugin));
                }
                enumerator->destroy(enumerator);
                fprintf(out, "\n");
@@ -1069,12 +1070,12 @@ static void print_alg(FILE *out, int *len, enum_name_t *alg_names, int alg_type,
 {
        char alg_name[BUF_LEN];
        int alg_name_len;
-       
+
        alg_name_len = sprintf(alg_name, " %N[%s]", alg_names, alg_type, plugin_name);
        if (*len + alg_name_len > CRYPTO_MAX_ALG_LINE)
        {
                fprintf(out, "\n             ");
-               *len = 13;      
+               *len = 13;
        }
        fprintf(out, "%s", alg_name);
        *len += alg_name_len;
index 2e83d0d28a3ae534a67c603681a65659b4638811..a23924261a73dcbb530fa4bb2bf52490ec799bff 100644 (file)
@@ -36,6 +36,12 @@ struct private_stroke_plugin_t {
        stroke_socket_t *socket;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_stroke_plugin_t *this)
+{
+       return "stroke";
+}
+
 METHOD(plugin_t, destroy, void,
        private_stroke_plugin_t *this)
 {
@@ -53,6 +59,7 @@ plugin_t *stroke_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 89888040a0964bdaf54cac278f66d5703cfac306..44ca082d5c46addd07d6a4899930b38d901e1001 100644 (file)
@@ -141,6 +141,12 @@ static bool load_imcs(char *filename)
        return TRUE;
 }
 
+METHOD(plugin_t, get_name, char*,
+       tnc_imc_plugin_t *this)
+{
+       return "tnc-imc";
+}
+
 METHOD(plugin_t, destroy, void,
        tnc_imc_plugin_t *this)
 {
@@ -158,6 +164,7 @@ plugin_t *tnc_imc_plugin_create()
 
        INIT(this,
                .plugin = {
+                       .get_name = _get_name,
                        .destroy = _destroy,
                },
        );
index f238f01ea573dd2a06927deb0e9fdb5eaf8f0687..8f92ead2190164016b0e2bc3e6017e72c7349c71 100644 (file)
@@ -141,6 +141,12 @@ static bool load_imvs(char *filename)
        return TRUE;
 }
 
+METHOD(plugin_t, get_name, char*,
+       tnc_imv_plugin_t *this)
+{
+       return "tnc-imv";
+}
+
 METHOD(plugin_t, destroy, void,
        tnc_imv_plugin_t *this)
 {
@@ -158,6 +164,7 @@ plugin_t *tnc_imv_plugin_create()
 
        INIT(this,
                .plugin = {
+                       .get_name = _get_name,
                        .destroy = _destroy,
                },
        );
index 03905ca3733d0ffedf4b43c5d0f3631f7acba831..984bdedbaf60e6b9f665566ae3c334f04d0b6d33 100644 (file)
 
 #include <daemon.h>
 
+METHOD(plugin_t, get_name, char*,
+       tnccs_11_plugin_t *this)
+{
+       return "tnccs-11";
+}
+
 METHOD(plugin_t, destroy, void,
        tnccs_11_plugin_t *this)
 {
@@ -35,11 +41,12 @@ plugin_t *tnccs_11_plugin_create()
 
        INIT(this,
                .plugin = {
+                       .get_name = _get_name,
                        .destroy = _destroy,
                },
        );
 
-       charon->tnccs->add_method(charon->tnccs, TNCCS_1_1, 
+       charon->tnccs->add_method(charon->tnccs, TNCCS_1_1,
                                                         (tnccs_constructor_t)tnccs_11_create);
 
        return &this->plugin;
index 82c78f74c980f3e728ba4caf69f040dfe4aa8afb..7f4aeff4537b11d5288f2a793c771c23a6afc042 100644 (file)
 
 #include <daemon.h>
 
+METHOD(plugin_t, get_name, char*,
+       tnccs_20_plugin_t *this)
+{
+       return "tnccs-20";
+}
+
 METHOD(plugin_t, destroy, void,
        tnccs_20_plugin_t *this)
 {
@@ -35,11 +41,12 @@ plugin_t *tnccs_20_plugin_create()
 
        INIT(this,
                .plugin = {
+                       .get_name = _get_name,
                        .destroy = _destroy,
                },
        );
 
-       charon->tnccs->add_method(charon->tnccs, TNCCS_2_0, 
+       charon->tnccs->add_method(charon->tnccs, TNCCS_2_0,
                                                         (tnccs_constructor_t)tnccs_20_create);
 
        return &this->plugin;
index dbbf222e0627d628fb08caf6fb3686525d0bc986..ec6e637d693b6418a5bd469b43700f9a247c22a7 100644 (file)
 
 #include <daemon.h>
 
+METHOD(plugin_t, get_name, char*,
+       tnccs_dynamic_plugin_t *this)
+{
+       return "tnccs-dynamic";
+}
+
 METHOD(plugin_t, destroy, void,
        tnccs_dynamic_plugin_t *this)
 {
@@ -35,11 +41,12 @@ plugin_t *tnccs_dynamic_plugin_create()
 
        INIT(this,
                .plugin = {
+                       .get_name = _get_name,
                        .destroy = _destroy,
                },
        );
 
-       charon->tnccs->add_method(charon->tnccs, TNCCS_DYNAMIC, 
+       charon->tnccs->add_method(charon->tnccs, TNCCS_DYNAMIC,
                                                         (tnccs_constructor_t)tnccs_dynamic_create);
 
        return &this->plugin;
index 6d6d5d23418503270d95cd18e20df4b2924117ce..0d4cd0af5568851e7080b2a317b09f57922cbdda 100644 (file)
@@ -58,6 +58,12 @@ struct private_uci_plugin_t {
        uci_control_t *control;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_uci_plugin_t *this)
+{
+       return "uci";
+}
+
 METHOD(plugin_t, destroy, void,
        private_uci_plugin_t *this)
 {
@@ -80,6 +86,7 @@ plugin_t *uci_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 4a0347aa115cecfbd889641ded5b53a42c1fa85e..fe4e8e2525e8e9d40f5d44ef35bc2bfda717b3a4 100644 (file)
@@ -92,6 +92,12 @@ static void run_tests(private_unit_tester_t *this)
                 success, run, failed, skipped);
 }
 
+METHOD(plugin_t, get_name, char*,
+       private_unit_tester_plugin_t *this)
+{
+       return "unit-tester";
+}
+
 METHOD(plugin_t, destroy, void,
        private_unit_tester_t *this)
 {
@@ -108,6 +114,7 @@ plugin_t *unit_tester_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 8b790cb0ffe7dec9040989d0976bcb68b6193d78..5f2885a8bc8b0a93ed2bc51447dcc7b468735f79 100644 (file)
@@ -36,6 +36,12 @@ struct private_updown_plugin_t {
        updown_listener_t *listener;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_updown_plugin_t *this)
+{
+       return "updown";
+}
+
 METHOD(plugin_t, destroy, void,
        private_updown_plugin_t *this)
 {
@@ -54,6 +60,7 @@ plugin_t *updown_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 75392a88349ea1f2ad8f3783fab70ceb8a4277cb..cbd36ff8346394809af7f3a4baa6d32b14048b0d 100644 (file)
@@ -43,6 +43,12 @@ struct private_whitelist_plugin_t {
        whitelist_control_t *control;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_whitelist_plugin_t *this)
+{
+       return "whitelist";
+}
+
 METHOD(plugin_t, destroy, void,
        private_whitelist_plugin_t *this)
 {
@@ -62,6 +68,7 @@ plugin_t *whitelist_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 0f66b680aa5469fdd1e40370c3b3a16919898052..762dc88b2ea58e12d2d1efa30e45924f42bf3a7c 100644 (file)
@@ -36,6 +36,12 @@ struct private_attr_plugin_t {
        attr_provider_t *provider;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_attr_plugin_t *this)
+{
+       return "attr";
+}
+
 METHOD(plugin_t, destroy, void,
        private_attr_plugin_t *this)
 {
@@ -54,6 +60,7 @@ plugin_t *attr_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index ca9de023ea96fbf4e0de88d7a614c8cc075765e1..f9be3d2457c45061bf7a40b34bc8f45101816065 100644 (file)
@@ -40,9 +40,14 @@ struct private_attr_sql_plugin_t {
         * configuration attributes
         */
        sql_attribute_t *attribute;
-
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_attr_sql_plugin_t *this)
+{
+       return "attr-sql";
+}
+
 METHOD(plugin_t, destroy, void,
        private_attr_sql_plugin_t *this)
 {
@@ -71,6 +76,7 @@ plugin_t *attr_sql_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 3c312ca2b3e097e4ddf3778808ee283f1aaa70ac..c5b9fa6924d155adf3a0026ce1f256d67b3250fa 100644 (file)
@@ -32,6 +32,12 @@ struct private_kernel_klips_plugin_t {
        kernel_klips_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_kernel_klips_plugin_t *this)
+{
+       return "kernel-klips";
+}
+
 METHOD(plugin_t, destroy, void,
        private_kernel_klips_plugin_t *this)
 {
@@ -50,6 +56,7 @@ plugin_t *kernel_klips_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 9fc1a03f5dc4463bc6f55d07b7566554d21a4b76..78823c9687c03dc79ba14a10d62dc6f6ea3cff1c 100644 (file)
@@ -33,6 +33,12 @@ struct private_kernel_netlink_plugin_t {
        kernel_netlink_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_kernel_netlink_plugin_t *this)
+{
+       return "kernel-netlink";
+}
+
 METHOD(plugin_t, destroy, void,
        private_kernel_netlink_plugin_t *this)
 {
@@ -53,6 +59,7 @@ plugin_t *kernel_netlink_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 9e7a7904d5343c33161fc9e18c50f9a3552e2353..fa3d3866525e2666da5b70f62eff112519fea96b 100644 (file)
@@ -32,6 +32,12 @@ struct private_kernel_pfkey_plugin_t {
        kernel_pfkey_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_kernel_pfkey_plugin_t *this)
+{
+       return "kernel-pfkey";
+}
+
 METHOD(plugin_t, destroy, void,
        private_kernel_pfkey_plugin_t *this)
 {
@@ -50,6 +56,7 @@ plugin_t *kernel_pfkey_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index a4cb53edd1799d84227ce74402a31b0d0f045deb..1749a89d26cf36391dfefe4100e8140dc2374a9b 100644 (file)
@@ -32,6 +32,12 @@ struct private_kernel_pfroute_plugin_t {
        kernel_pfroute_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_kernel_pfroute_plugin_t *this)
+{
+       return "kernel-pfroute";
+}
+
 METHOD(plugin_t, destroy, void,
        private_kernel_pfroute_plugin_t *this)
 {
@@ -50,6 +56,7 @@ plugin_t *kernel_pfroute_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index ad18c7060ad7d37f8692424700c00e7355f786fe..070596b754807b947a2a4112f436f527e7e21174 100644 (file)
@@ -36,6 +36,12 @@ struct private_resolve_plugin_t {
        resolve_handler_t *handler;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_resolve_plugin_t *this)
+{
+       return "resolve";
+}
+
 METHOD(plugin_t, destroy, void,
        private_resolve_plugin_t *this)
 {
@@ -54,6 +60,7 @@ plugin_t *resolve_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 1c060b6c840401a653e5b1d767041f534c8b40c9..6034e67d95014e84f1c1bbe94b82b28e9bbc9086 100644 (file)
@@ -18,8 +18,6 @@
 #include <library.h>
 #include "aes_crypter.h"
 
-static const char *plugin_name = "aes";
-
 typedef struct private_aes_plugin_t private_aes_plugin_t;
 
 /**
@@ -33,6 +31,12 @@ struct private_aes_plugin_t {
        aes_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_aes_plugin_t *this)
+{
+       return "aes";
+}
+
 METHOD(plugin_t, destroy, void,
        private_aes_plugin_t *this)
 {
@@ -51,12 +55,13 @@ plugin_t *aes_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
        );
 
-       lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC, get_name(this),
                                                         (crypter_constructor_t)aes_crypter_create);
 
        return &this->public.plugin;
index 441b35435b0807278f71ba479125df0ae88bebf1..7b3c062aa667e8a2e788a11eb8cc51fa8de3276d 100644 (file)
@@ -92,7 +92,7 @@ static struct {
 /**
  * See header.
  */
-void af_alg_crypter_probe()
+void af_alg_crypter_probe(char *plugin)
 {
        encryption_algorithm_t prev = -1;
        af_alg_ops_t *ops;
@@ -106,7 +106,7 @@ void af_alg_crypter_probe()
                        if (ops)
                        {
                                ops->destroy(ops);
-                               lib->crypto->add_crypter(lib->crypto, algs[i].id, af_alg_plugin_name,
+                               lib->crypto->add_crypter(lib->crypto, algs[i].id, plugin,
                                                                (crypter_constructor_t)af_alg_crypter_create);
                        }
                }
index 711d2fc353652efa2c0d165a169e02fc5bbe0388..ed7799cc8923e85378525143ac215fec45e9616e 100644 (file)
@@ -48,7 +48,9 @@ af_alg_crypter_t *af_alg_crypter_create(encryption_algorithm_t algo,
 
 /**
  * Probe algorithms and register af_alg_crypter_create().
+ *
+ * @param plugin               plugin name to register algorithms for
  */
-void af_alg_crypter_probe();
+void af_alg_crypter_probe(char *plugin);
 
 #endif /** AF_ALG_CRYPTER_H_ @}*/
index 7c6297d441232cd051f0e6cde3c45a7a855ecfad..11074c4bd435ce43a3b5739062833474320e8702 100644 (file)
@@ -59,7 +59,7 @@ static struct {
 /**
  * See header.
  */
-void af_alg_hasher_probe()
+void af_alg_hasher_probe(char *plugin)
 {
        af_alg_ops_t *ops;
        int i;
@@ -70,7 +70,7 @@ void af_alg_hasher_probe()
                if (ops)
                {
                        ops->destroy(ops);
-                       lib->crypto->add_hasher(lib->crypto, algs[i].id, af_alg_plugin_name,
+                       lib->crypto->add_hasher(lib->crypto, algs[i].id, plugin,
                                                        (hasher_constructor_t)af_alg_hasher_create);
                }
        }
index e0833e23a9bd0ada837d334eecea8dd0c6ac43f1..f44ba2938560e4bc5cef65c129c82506bc5b0c6a 100644 (file)
@@ -46,7 +46,9 @@ af_alg_hasher_t *af_alg_hasher_create(hash_algorithm_t algo);
 
 /**
  * Probe algorithms and register af_alg_hasher_create().
+ *
+ * @param plugin               plugin name to register algorithms for
  */
-void af_alg_hasher_probe();
+void af_alg_hasher_probe(char *plugin);
 
 #endif /** af_alg_HASHER_H_ @}*/
index 7bf1d90db90db9117821d67ce8aad2704bf72bb2..82a227d978a86e53927d03bc406489f855e68baf 100644 (file)
@@ -21,8 +21,6 @@
 
 #include <debug.h>
 
-const char *af_alg_plugin_name = "af-alg";
-
 typedef struct private_af_alg_ops_t private_af_alg_ops_t;
 
 /**
index b7d642c009fce35cdb0bf1afae7f0d50d70648ba..ad164029f0bbaf9b3e699d04639155f55ec13d11 100644 (file)
@@ -33,8 +33,6 @@
 #define SOL_ALG 279
 #endif /* SOL_ALG */
 
-extern const char *af_alg_plugin_name;
-
 typedef struct af_alg_ops_t af_alg_ops_t;
 
 /**
index 54e39f1a010d1b1af8ef36c33bde2506a152be37..c5c177108bf8cf2ca33db5c93d6165678dd22e97 100644 (file)
@@ -35,6 +35,12 @@ struct private_af_alg_plugin_t {
        af_alg_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_af_alg_plugin_t *this)
+{
+       return "af-alg";
+}
+
 METHOD(plugin_t, destroy, void,
        private_af_alg_plugin_t *this)
 {
@@ -60,15 +66,16 @@ plugin_t *af_alg_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
        );
 
-       af_alg_hasher_probe();
-       af_alg_signer_probe();
-       af_alg_prf_probe();
-       af_alg_crypter_probe();
+       af_alg_hasher_probe(get_name(this));
+       af_alg_signer_probe(get_name(this));
+       af_alg_prf_probe(get_name(this));
+       af_alg_crypter_probe(get_name(this));
 
        return &this->public.plugin;
 }
index 575906bae70f7930fd15cd977f0b2be9422e6c6d..1c1174abb0e438660302c300f15d80448a502aff 100644 (file)
@@ -70,7 +70,7 @@ static struct {
 /**
  * See header.
  */
-void af_alg_prf_probe()
+void af_alg_prf_probe(char *plugin)
 {
        af_alg_ops_t *ops;
        int i;
@@ -81,7 +81,7 @@ void af_alg_prf_probe()
                if (ops)
                {
                        ops->destroy(ops);
-                       lib->crypto->add_prf(lib->crypto, algs[i].id, af_alg_plugin_name,
+                       lib->crypto->add_prf(lib->crypto, algs[i].id, plugin,
                                                        (prf_constructor_t)af_alg_prf_create);
                }
        }
index a3dea5649b71b0a1695bb165ff8301905d2ffffe..d3275e7be8ae470ad06ac44c2e07e814f49145b6 100644 (file)
@@ -46,7 +46,9 @@ af_alg_prf_t *af_alg_prf_create(pseudo_random_function_t algo);
 
 /**
  * Probe algorithms and register af_alg_prf_create().
+ *
+ * @param plugin               plugin name to register algorithms for
  */
-void af_alg_prf_probe();
+void af_alg_prf_probe(char *plugin);
 
 #endif /** AF_ALG_PRF_H_ @}*/
index 3d6f907bf08c1480ea11989cceb3b39a3650012c..34534a06bac71c533c7220fc94bbef2ae6328d1a 100644 (file)
@@ -71,7 +71,7 @@ static struct {
 /**
  * See header.
  */
-void af_alg_signer_probe()
+void af_alg_signer_probe(char *plugin)
 {
        af_alg_ops_t *ops;
        int i;
@@ -82,7 +82,7 @@ void af_alg_signer_probe()
                if (ops)
                {
                        ops->destroy(ops);
-                       lib->crypto->add_signer(lib->crypto, algs[i].id, af_alg_plugin_name,
+                       lib->crypto->add_signer(lib->crypto, algs[i].id, plugin,
                                                        (signer_constructor_t)af_alg_signer_create);
                }
        }
index b1d90707fce38715beacb0c319c4872c384f3e79..21487a11853a7336ef1a5a34f671c46d8f53ed53 100644 (file)
@@ -46,7 +46,9 @@ af_alg_signer_t *af_alg_signer_create(integrity_algorithm_t algo);
 
 /**
  * Probe algorithms and register af_alg_signer_create().
+ *
+ * @param plugin               plugin name to register algorithms for
  */
-void af_alg_signer_probe();
+void af_alg_signer_probe(char *plugin);
 
 #endif /** AF_ALG_SIGNER_H_ @}*/
index bd3c1ac753eb0b540a2a07138a83c8bb6429c299..00cd3f690ef7fb823663eb6ebb63f19b605a7199 100644 (file)
@@ -31,6 +31,12 @@ struct private_agent_plugin_t {
        agent_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_agent_plugin_t *this)
+{
+       return "agent";
+}
+
 METHOD(plugin_t, destroy, void,
        private_agent_plugin_t *this)
 {
@@ -49,6 +55,7 @@ plugin_t *agent_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 5232eca286b9cad8e334fd301e1126e89ae790ec..364fb3901fcb4ac5a1aeb9203f57dcc8668db039 100644 (file)
@@ -19,8 +19,6 @@
 #include <library.h>
 #include "blowfish_crypter.h"
 
-static const char *plugin_name = "blowfish";
-
 typedef struct private_blowfish_plugin_t private_blowfish_plugin_t;
 
 /**
@@ -34,6 +32,12 @@ struct private_blowfish_plugin_t {
        blowfish_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_blowfish_plugin_t *this)
+{
+       return "blowfish";
+}
+
 METHOD(plugin_t, destroy, void,
        private_blowfish_plugin_t *this)
 {
@@ -52,12 +56,13 @@ plugin_t *blowfish_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
        );
 
-       lib->crypto->add_crypter(lib->crypto, ENCR_BLOWFISH, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_BLOWFISH, get_name(this),
                                                         (crypter_constructor_t)blowfish_crypter_create);
 
        return &this->public.plugin;
index a4c89b5484c53b17f9907509bdb1f7751e5d5920..cab3c666e70be306a9a014a87df1e5de8f38421b 100644 (file)
@@ -19,8 +19,6 @@
 
 #include "ccm_aead.h"
 
-static const char *plugin_name = "ccm";
-
 typedef struct private_ccm_plugin_t private_ccm_plugin_t;
 
 /**
@@ -34,6 +32,12 @@ struct private_ccm_plugin_t {
        ccm_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_ccm_plugin_t *this)
+{
+       return "ccm";
+}
+
 METHOD(plugin_t, destroy, void,
        private_ccm_plugin_t *this)
 {
@@ -52,29 +56,34 @@ plugin_t *ccm_plugin_create()
        crypter_t *crypter;
 
        INIT(this,
-               .public.plugin.destroy = _destroy,
+               .public = {
+                       .plugin = {
+                               .get_name = _get_name,
+                               .destroy = _destroy,
+                       },
+               },
        );
 
        crypter = lib->crypto->create_crypter(lib->crypto, ENCR_AES_CBC, 0);
        if (crypter)
        {
                crypter->destroy(crypter);
-               lib->crypto->add_aead(lib->crypto, ENCR_AES_CCM_ICV8, plugin_name,
+               lib->crypto->add_aead(lib->crypto, ENCR_AES_CCM_ICV8, get_name(this),
                                                (aead_constructor_t)ccm_aead_create);
-               lib->crypto->add_aead(lib->crypto, ENCR_AES_CCM_ICV12, plugin_name,
+               lib->crypto->add_aead(lib->crypto, ENCR_AES_CCM_ICV12, get_name(this),
                                                (aead_constructor_t)ccm_aead_create);
-               lib->crypto->add_aead(lib->crypto, ENCR_AES_CCM_ICV16, plugin_name,
+               lib->crypto->add_aead(lib->crypto, ENCR_AES_CCM_ICV16, get_name(this),
                                                (aead_constructor_t)ccm_aead_create);
        }
        crypter = lib->crypto->create_crypter(lib->crypto, ENCR_CAMELLIA_CBC, 0);
        if (crypter)
        {
                crypter->destroy(crypter);
-               lib->crypto->add_aead(lib->crypto, ENCR_CAMELLIA_CCM_ICV8, plugin_name,
+               lib->crypto->add_aead(lib->crypto, ENCR_CAMELLIA_CCM_ICV8, get_name(this),
                                                (aead_constructor_t)ccm_aead_create);
-               lib->crypto->add_aead(lib->crypto, ENCR_CAMELLIA_CCM_ICV12, plugin_name,
+               lib->crypto->add_aead(lib->crypto, ENCR_CAMELLIA_CCM_ICV12, get_name(this),
                                                (aead_constructor_t)ccm_aead_create);
-               lib->crypto->add_aead(lib->crypto, ENCR_CAMELLIA_CCM_ICV16, plugin_name,
+               lib->crypto->add_aead(lib->crypto, ENCR_CAMELLIA_CCM_ICV16, get_name(this),
                                                (aead_constructor_t)ccm_aead_create);
        }
 
index 1c3f0c835917069083a58330c446ebcc4fb97fe5..055ddf7e8e7c693d2e8c3649dc8a23413365ce74 100644 (file)
@@ -36,6 +36,12 @@ struct private_constraints_plugin_t {
        constraints_validator_t *validator;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_constraints_plugin_t *this)
+{
+       return "constraints";
+}
+
 METHOD(plugin_t, destroy, void,
        private_constraints_plugin_t *this)
 {
@@ -54,6 +60,7 @@ plugin_t *constraints_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 9f1bf957f0bb827b9079e87e3a4873503c2b138c..b55a1652df51b81849c3807bb58471a41960deaf 100644 (file)
@@ -19,8 +19,6 @@
 
 #include "ctr_ipsec_crypter.h"
 
-static const char *plugin_name = "ctr";
-
 typedef struct private_ctr_plugin_t private_ctr_plugin_t;
 
 /**
@@ -34,6 +32,12 @@ struct private_ctr_plugin_t {
        ctr_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_ctr_plugin_t *this)
+{
+       return "ctr";
+}
+
 METHOD(plugin_t, destroy, void,
        private_ctr_plugin_t *this)
 {
@@ -54,6 +58,7 @@ plugin_t *ctr_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
@@ -63,14 +68,14 @@ plugin_t *ctr_plugin_create()
        if (crypter)
        {
                crypter->destroy(crypter);
-               lib->crypto->add_crypter(lib->crypto, ENCR_AES_CTR, plugin_name,
+               lib->crypto->add_crypter(lib->crypto, ENCR_AES_CTR, get_name(this),
                                                (crypter_constructor_t)ctr_ipsec_crypter_create);
        }
        crypter = lib->crypto->create_crypter(lib->crypto, ENCR_CAMELLIA_CBC, 16);
        if (crypter)
        {
                crypter->destroy(crypter);
-               lib->crypto->add_crypter(lib->crypto, ENCR_CAMELLIA_CTR, plugin_name,
+               lib->crypto->add_crypter(lib->crypto, ENCR_CAMELLIA_CTR, get_name(this),
                                                (crypter_constructor_t)ctr_ipsec_crypter_create);
        }
        return &this->public.plugin;
index 387da03aacfd19a35cfad18ba3c052fa95401ded..fe68efd951aaf91264ef45507bdaf4e780bf26c7 100644 (file)
@@ -34,6 +34,12 @@ struct private_curl_plugin_t {
        curl_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_curl_plugin_t *this)
+{
+       return "curl";
+}
+
 METHOD(plugin_t, destroy, void,
        private_curl_plugin_t *this)
 {
@@ -54,6 +60,7 @@ plugin_t *curl_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index d420d789e0b529b887eff0dc59095d9c0f2fc9a6..49c4a3dc56d6311bb8dc3db3f747c0a6e9b9eba7 100644 (file)
@@ -18,8 +18,6 @@
 #include <library.h>
 #include "des_crypter.h"
 
-static const char *plugin_name = "des";
-
 typedef struct private_des_plugin_t private_des_plugin_t;
 
 /**
@@ -33,6 +31,12 @@ struct private_des_plugin_t {
        des_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_des_plugin_t *this)
+{
+       return "des";
+}
+
 METHOD(plugin_t, destroy, void,
        private_des_plugin_t *this)
 {
@@ -51,16 +55,17 @@ plugin_t *des_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
        );
 
-       lib->crypto->add_crypter(lib->crypto, ENCR_3DES, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_3DES, get_name(this),
                                                         (crypter_constructor_t)des_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_DES, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_DES, get_name(this),
                                                         (crypter_constructor_t)des_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_DES_ECB, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_DES_ECB, get_name(this),
                                                         (crypter_constructor_t)des_crypter_create);
 
        return &this->public.plugin;
index d11b149df516751ae2cf55cfceaaa6f0d5bb40c2..112bf683ff1ea52cdc251efaeac81d848994d834 100644 (file)
@@ -31,6 +31,12 @@ struct private_dnskey_plugin_t {
        dnskey_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_dnskey_plugin_t *this)
+{
+       return "dnskey";
+}
+
 METHOD(plugin_t, destroy, void,
        private_dnskey_plugin_t *this)
 {
@@ -49,6 +55,7 @@ plugin_t *dnskey_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 3cce6ad91dfa35b0e187c74a61c49c1e1f74afd9..de232fdc5f361b51565cd440180f142f2f45b755 100644 (file)
@@ -18,8 +18,6 @@
 #include <library.h>
 #include "fips_prf.h"
 
-static const char *plugin_name = "fips-prf";
-
 typedef struct private_fips_prf_plugin_t private_fips_prf_plugin_t;
 
 /**
@@ -33,6 +31,12 @@ struct private_fips_prf_plugin_t {
        fips_prf_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_fips_prf_plugin_t *this)
+{
+       return "fips-prf";
+}
+
 METHOD(plugin_t, destroy, void,
        private_fips_prf_plugin_t *this)
 {
@@ -52,6 +56,7 @@ plugin_t *fips_prf_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
@@ -61,7 +66,7 @@ plugin_t *fips_prf_plugin_create()
        if (prf)
        {
                prf->destroy(prf);
-               lib->crypto->add_prf(lib->crypto, PRF_FIPS_SHA1_160, plugin_name,
+               lib->crypto->add_prf(lib->crypto, PRF_FIPS_SHA1_160, get_name(this),
                                                         (prf_constructor_t)fips_prf_create);
        }
 
index a438fb0730f6d84d3edcf80dce0ca9f117791f71..c86ea1f038063ddcdecb1d209058300b5c733d9e 100644 (file)
@@ -19,8 +19,6 @@
 
 #include "gcm_aead.h"
 
-static const char *plugin_name = "gcm";
-
 typedef struct private_gcm_plugin_t private_gcm_plugin_t;
 
 /**
@@ -34,6 +32,12 @@ struct private_gcm_plugin_t {
        gcm_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_gcm_plugin_t *this)
+{
+       return "gcm";
+}
+
 METHOD(plugin_t, destroy, void,
        private_gcm_plugin_t *this)
 {
@@ -52,18 +56,23 @@ plugin_t *gcm_plugin_create()
        crypter_t *crypter;
 
        INIT(this,
-               .public.plugin.destroy = _destroy,
+               .public = {
+                       .plugin = {
+                               .get_name = _get_name,
+                               .destroy = _destroy,
+                       },
+               },
        );
 
        crypter = lib->crypto->create_crypter(lib->crypto, ENCR_AES_CBC, 0);
        if (crypter)
        {
                crypter->destroy(crypter);
-               lib->crypto->add_aead(lib->crypto, ENCR_AES_GCM_ICV8, plugin_name,
+               lib->crypto->add_aead(lib->crypto, ENCR_AES_GCM_ICV8, get_name(this),
                                                (aead_constructor_t)gcm_aead_create);
-               lib->crypto->add_aead(lib->crypto, ENCR_AES_GCM_ICV12, plugin_name,
+               lib->crypto->add_aead(lib->crypto, ENCR_AES_GCM_ICV12, get_name(this),
                                                (aead_constructor_t)gcm_aead_create);
-               lib->crypto->add_aead(lib->crypto, ENCR_AES_GCM_ICV16, plugin_name,
+               lib->crypto->add_aead(lib->crypto, ENCR_AES_GCM_ICV16, get_name(this),
                                                (aead_constructor_t)gcm_aead_create);
        }
 
index a53fed44895984935f0c554424984e3334a4daf6..b6a19917c211b6938b5510bfbbbb47e39d42fe34 100644 (file)
@@ -29,8 +29,6 @@
 #include <errno.h>
 #include <gcrypt.h>
 
-static const char *plugin_name = "gcrypt";
-
 typedef struct private_gcrypt_plugin_t private_gcrypt_plugin_t;
 
 /**
@@ -95,6 +93,12 @@ static struct gcry_thread_cbs thread_functions = {
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_gcrypt_plugin_t *this)
+{
+       return "gcrypt";
+}
+
 METHOD(plugin_t, destroy, void,
        private_gcrypt_plugin_t *this)
 {
@@ -144,85 +148,86 @@ plugin_t *gcrypt_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
        );
 
        /* hashers */
-       lib->crypto->add_hasher(lib->crypto, HASH_SHA1, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_SHA1, get_name(this),
                                        (hasher_constructor_t)gcrypt_hasher_create);
-       lib->crypto->add_hasher(lib->crypto, HASH_MD4, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_MD4, get_name(this),
                                        (hasher_constructor_t)gcrypt_hasher_create);
-       lib->crypto->add_hasher(lib->crypto, HASH_MD5, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_MD5, get_name(this),
                                        (hasher_constructor_t)gcrypt_hasher_create);
-       lib->crypto->add_hasher(lib->crypto, HASH_SHA224, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_SHA224, get_name(this),
                                        (hasher_constructor_t)gcrypt_hasher_create);
-       lib->crypto->add_hasher(lib->crypto, HASH_SHA256, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_SHA256, get_name(this),
                                        (hasher_constructor_t)gcrypt_hasher_create);
-       lib->crypto->add_hasher(lib->crypto, HASH_SHA384, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_SHA384, get_name(this),
                                        (hasher_constructor_t)gcrypt_hasher_create);
-       lib->crypto->add_hasher(lib->crypto, HASH_SHA512, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_SHA512, get_name(this),
                                        (hasher_constructor_t)gcrypt_hasher_create);
 
        /* crypters */
-       lib->crypto->add_crypter(lib->crypto, ENCR_3DES, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_3DES, get_name(this),
                                        (crypter_constructor_t)gcrypt_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_CAST, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_CAST, get_name(this),
                                        (crypter_constructor_t)gcrypt_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_BLOWFISH, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_BLOWFISH, get_name(this),
                                        (crypter_constructor_t)gcrypt_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_DES, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_DES, get_name(this),
                                        (crypter_constructor_t)gcrypt_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_DES_ECB, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_DES_ECB, get_name(this),
                                        (crypter_constructor_t)gcrypt_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC, get_name(this),
                                        (crypter_constructor_t)gcrypt_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_AES_CTR, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_AES_CTR, get_name(this),
                                        (crypter_constructor_t)gcrypt_crypter_create);
 #ifdef HAVE_GCRY_CIPHER_CAMELLIA
-       lib->crypto->add_crypter(lib->crypto, ENCR_CAMELLIA_CBC, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_CAMELLIA_CBC, get_name(this),
                                        (crypter_constructor_t)gcrypt_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_CAMELLIA_CTR, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_CAMELLIA_CTR, get_name(this),
                                        (crypter_constructor_t)gcrypt_crypter_create);
 #endif /* HAVE_GCRY_CIPHER_CAMELLIA */
-       lib->crypto->add_crypter(lib->crypto, ENCR_SERPENT_CBC, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_SERPENT_CBC, get_name(this),
                                        (crypter_constructor_t)gcrypt_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_TWOFISH_CBC, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_TWOFISH_CBC, get_name(this),
                                        (crypter_constructor_t)gcrypt_crypter_create);
 
        /* random numbers */
-       lib->crypto->add_rng(lib->crypto, RNG_WEAK, plugin_name,
+       lib->crypto->add_rng(lib->crypto, RNG_WEAK, get_name(this),
                                                 (rng_constructor_t)gcrypt_rng_create);
-       lib->crypto->add_rng(lib->crypto, RNG_STRONG, plugin_name,
+       lib->crypto->add_rng(lib->crypto, RNG_STRONG, get_name(this),
                                                 (rng_constructor_t)gcrypt_rng_create);
-       lib->crypto->add_rng(lib->crypto, RNG_TRUE, plugin_name,
+       lib->crypto->add_rng(lib->crypto, RNG_TRUE, get_name(this),
                                                 (rng_constructor_t)gcrypt_rng_create);
 
        /* diffie hellman groups, using modp */
-       lib->crypto->add_dh(lib->crypto, MODP_2048_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_2048_BIT, get_name(this),
                                        (dh_constructor_t)gcrypt_dh_create);
-       lib->crypto->add_dh(lib->crypto, MODP_2048_224, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_2048_224, get_name(this),
                                        (dh_constructor_t)gcrypt_dh_create);
-       lib->crypto->add_dh(lib->crypto, MODP_2048_256, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_2048_256, get_name(this),
                                        (dh_constructor_t)gcrypt_dh_create);
-       lib->crypto->add_dh(lib->crypto, MODP_1536_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_1536_BIT, get_name(this),
                                        (dh_constructor_t)gcrypt_dh_create);
-       lib->crypto->add_dh(lib->crypto, MODP_3072_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_3072_BIT, get_name(this),
                                        (dh_constructor_t)gcrypt_dh_create);
-       lib->crypto->add_dh(lib->crypto, MODP_4096_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_4096_BIT, get_name(this),
                                        (dh_constructor_t)gcrypt_dh_create);
-       lib->crypto->add_dh(lib->crypto, MODP_6144_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_6144_BIT, get_name(this),
                                        (dh_constructor_t)gcrypt_dh_create);
-       lib->crypto->add_dh(lib->crypto, MODP_8192_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_8192_BIT, get_name(this),
                                        (dh_constructor_t)gcrypt_dh_create);
-       lib->crypto->add_dh(lib->crypto, MODP_1024_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_1024_BIT, get_name(this),
                                        (dh_constructor_t)gcrypt_dh_create);
-       lib->crypto->add_dh(lib->crypto, MODP_1024_160, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_1024_160, get_name(this),
                                        (dh_constructor_t)gcrypt_dh_create);
-       lib->crypto->add_dh(lib->crypto, MODP_768_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_768_BIT, get_name(this),
                                        (dh_constructor_t)gcrypt_dh_create);
-       lib->crypto->add_dh(lib->crypto, MODP_CUSTOM, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_CUSTOM, get_name(this),
                                        (dh_constructor_t)gcrypt_dh_create_custom);
 
        /* RSA */
index e9bfbcc2864082c88db0d935cf003cab53936ece..8ac4e87616708c4ad31d1e673651c43194ad097a 100644 (file)
@@ -20,8 +20,6 @@
 #include "gmp_rsa_private_key.h"
 #include "gmp_rsa_public_key.h"
 
-static const char *plugin_name = "gmp";
-
 typedef struct private_gmp_plugin_t private_gmp_plugin_t;
 
 /**
@@ -35,6 +33,12 @@ struct private_gmp_plugin_t {
        gmp_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_gmp_plugin_t *this)
+{
+       return "gmp";
+}
+
 METHOD(plugin_t, destroy, void,
        private_gmp_plugin_t *this)
 {
@@ -61,35 +65,36 @@ plugin_t *gmp_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
        );
 
-       lib->crypto->add_dh(lib->crypto, MODP_2048_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_2048_BIT, get_name(this),
                                                (dh_constructor_t)gmp_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_2048_224, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_2048_224, get_name(this),
                                                (dh_constructor_t)gmp_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_2048_256, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_2048_256, get_name(this),
                                                (dh_constructor_t)gmp_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_1536_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_1536_BIT, get_name(this),
                                                (dh_constructor_t)gmp_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_3072_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_3072_BIT, get_name(this),
                                                (dh_constructor_t)gmp_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_4096_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_4096_BIT, get_name(this),
                                                (dh_constructor_t)gmp_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_6144_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_6144_BIT, get_name(this),
                                                (dh_constructor_t)gmp_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_8192_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_8192_BIT, get_name(this),
                                                (dh_constructor_t)gmp_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_1024_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_1024_BIT, get_name(this),
                                                (dh_constructor_t)gmp_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_1024_160, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_1024_160, get_name(this),
                                                (dh_constructor_t)gmp_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_768_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_768_BIT, get_name(this),
                                                (dh_constructor_t)gmp_diffie_hellman_create);
 
-       lib->crypto->add_dh(lib->crypto, MODP_CUSTOM, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_CUSTOM, get_name(this),
                                                (dh_constructor_t)gmp_diffie_hellman_create_custom);
 
        lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA, FALSE,
index 76d6157ae160f93ce1ae3ea5e1228dc6d29b4abb..0ac1fb9893fd98669cdd3f2c8245cfc1985d9c8f 100644 (file)
@@ -19,8 +19,6 @@
 #include "hmac_signer.h"
 #include "hmac_prf.h"
 
-static const char *plugin_name = "hmac";
-
 typedef struct private_hmac_plugin_t private_hmac_plugin_t;
 
 /**
@@ -34,6 +32,12 @@ struct private_hmac_plugin_t {
        hmac_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_hmac_plugin_t *this)
+{
+       return "hmac";
+}
+
 METHOD(plugin_t, destroy, void,
        private_hmac_plugin_t *this)
 {
@@ -55,6 +59,7 @@ plugin_t *hmac_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
@@ -64,24 +69,24 @@ plugin_t *hmac_plugin_create()
        if (hasher)
        {
                hasher->destroy(hasher);
-               lib->crypto->add_prf(lib->crypto, PRF_HMAC_SHA1, plugin_name,
+               lib->crypto->add_prf(lib->crypto, PRF_HMAC_SHA1, get_name(this),
                                                (prf_constructor_t)hmac_prf_create);
-               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA1_96, plugin_name,
+               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA1_96, get_name(this),
                                                (signer_constructor_t)hmac_signer_create);
-               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA1_128, plugin_name,
+               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA1_128, get_name(this),
                                                (signer_constructor_t)hmac_signer_create);
-               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA1_160, plugin_name,
+               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA1_160, get_name(this),
                                                (signer_constructor_t)hmac_signer_create);
        }
        hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA256);
        if (hasher)
        {
                hasher->destroy(hasher);
-               lib->crypto->add_prf(lib->crypto, PRF_HMAC_SHA2_256, plugin_name,
+               lib->crypto->add_prf(lib->crypto, PRF_HMAC_SHA2_256, get_name(this),
                                                (prf_constructor_t)hmac_prf_create);
-               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_256_128, plugin_name,
+               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_256_128, get_name(this),
                                                (signer_constructor_t)hmac_signer_create);
-               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_256_256, plugin_name,
+               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_256_256, get_name(this),
                                                (signer_constructor_t)hmac_signer_create);
 
        }
@@ -89,31 +94,31 @@ plugin_t *hmac_plugin_create()
        if (hasher)
        {
                hasher->destroy(hasher);
-               lib->crypto->add_prf(lib->crypto, PRF_HMAC_MD5, plugin_name,
+               lib->crypto->add_prf(lib->crypto, PRF_HMAC_MD5, get_name(this),
                                                (prf_constructor_t)hmac_prf_create);
-               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_MD5_96, plugin_name,
+               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_MD5_96, get_name(this),
                                                (signer_constructor_t)hmac_signer_create);
-               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_MD5_128, plugin_name,
+               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_MD5_128, get_name(this),
                                                (signer_constructor_t)hmac_signer_create);
        }
        hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA384);
        if (hasher)
        {
                hasher->destroy(hasher);
-               lib->crypto->add_prf(lib->crypto, PRF_HMAC_SHA2_384, plugin_name,
+               lib->crypto->add_prf(lib->crypto, PRF_HMAC_SHA2_384, get_name(this),
                                                (prf_constructor_t)hmac_prf_create);
-               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_384_192, plugin_name,
+               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_384_192, get_name(this),
                                                (signer_constructor_t)hmac_signer_create);
-               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_384_384, plugin_name,
+               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_384_384, get_name(this),
                                                (signer_constructor_t)hmac_signer_create);
        }
        hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA512);
        if (hasher)
        {
                hasher->destroy(hasher);
-               lib->crypto->add_prf(lib->crypto, PRF_HMAC_SHA2_512, plugin_name,
+               lib->crypto->add_prf(lib->crypto, PRF_HMAC_SHA2_512, get_name(this),
                                                (prf_constructor_t)hmac_prf_create);
-               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_512_256, plugin_name,
+               lib->crypto->add_signer(lib->crypto, AUTH_HMAC_SHA2_512_256, get_name(this),
                                                (signer_constructor_t)hmac_signer_create);
        }
 
index 3682ddd1ff8a2205b5b75e3fe60263c1eec0371b..f8ab080d90613c9698f8502638dd6cd27c2f96e0 100644 (file)
@@ -31,6 +31,12 @@ struct private_ldap_plugin_t {
        ldap_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_ldap_plugin_t *this)
+{
+       return "ldap";
+}
+
 METHOD(plugin_t, destroy, void,
        private_ldap_plugin_t *this)
 {
@@ -49,6 +55,7 @@ plugin_t *ldap_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index cea1a61f342729318f0683db23cfa7a48a7a4800..20dd9b8fae87b4c066f718accbefb6543faac869 100644 (file)
@@ -18,8 +18,6 @@
 #include <library.h>
 #include "md4_hasher.h"
 
-static const char *plugin_name = "md4";
-
 typedef struct private_md4_plugin_t private_md4_plugin_t;
 
 /**
@@ -33,6 +31,12 @@ struct private_md4_plugin_t {
        md4_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_md4_plugin_t *this)
+{
+       return "md4";
+}
+
 METHOD(plugin_t, destroy, void,
        private_md4_plugin_t *this)
 {
@@ -51,12 +55,13 @@ plugin_t *md4_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
        );
 
-       lib->crypto->add_hasher(lib->crypto, HASH_MD4, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_MD4, get_name(this),
                                                        (hasher_constructor_t)md4_hasher_create);
 
        return &this->public.plugin;
index d111738179e0090255359781e6893cdedd1e6f4d..8f5c78e9f849eefd0184eb529e40fb47ca596a03 100644 (file)
@@ -18,8 +18,6 @@
 #include <library.h>
 #include "md5_hasher.h"
 
-static const char *plugin_name = "md5";
-
 typedef struct private_md5_plugin_t private_md5_plugin_t;
 
 /**
@@ -33,6 +31,12 @@ struct private_md5_plugin_t {
        md5_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_md5_plugin_t *this)
+{
+       return "md5";
+}
+
 METHOD(plugin_t, destroy, void,
        private_md5_plugin_t *this)
 {
@@ -51,12 +55,13 @@ plugin_t *md5_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
        );
 
-       lib->crypto->add_hasher(lib->crypto, HASH_MD5, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_MD5, get_name(this),
                                                        (hasher_constructor_t)md5_hasher_create);
 
        return &this->public.plugin;
index 65d8681cb18a9b9674937fe552fb37275ce91a5a..6ed74e2bf3816b3bf4a0d376fe5e7d5ebe39bd44 100644 (file)
@@ -32,6 +32,12 @@ struct private_mysql_plugin_t {
        mysql_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_mysql_plugin_t *this)
+{
+       return "mysql";
+}
+
 METHOD(plugin_t, destroy, void,
        private_mysql_plugin_t *this)
 {
@@ -57,6 +63,7 @@ plugin_t *mysql_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 0050572eeddec3e31883f3867be7266284a0508f..f7804bb6bdad00453201112e86964a709aecb2b7 100644 (file)
@@ -41,8 +41,6 @@
 #include "openssl_x509.h"
 #include "openssl_crl.h"
 
-static const char *plugin_name = "openssl";
-
 typedef struct private_openssl_plugin_t private_openssl_plugin_t;
 
 /**
@@ -195,6 +193,12 @@ static void threading_cleanup()
        mutex = NULL;
 }
 
+METHOD(plugin_t, get_name, char*,
+       private_openssl_plugin_t *this)
+{
+       return "openssl";
+}
+
 METHOD(plugin_t, destroy, void,
        private_openssl_plugin_t *this)
 {
@@ -250,6 +254,7 @@ plugin_t *openssl_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
@@ -274,85 +279,85 @@ plugin_t *openssl_plugin_create()
        }
 
        /* crypter */
-       lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC, get_name(this),
                                        (crypter_constructor_t)openssl_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_CAMELLIA_CBC, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_CAMELLIA_CBC, get_name(this),
                                        (crypter_constructor_t)openssl_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_3DES, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_3DES, get_name(this),
                                        (crypter_constructor_t)openssl_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_RC5, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_RC5, get_name(this),
                                        (crypter_constructor_t)openssl_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_IDEA, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_IDEA, get_name(this),
                                        (crypter_constructor_t)openssl_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_CAST, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_CAST, get_name(this),
                                        (crypter_constructor_t)openssl_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_BLOWFISH, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_BLOWFISH, get_name(this),
                                        (crypter_constructor_t)openssl_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_DES, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_DES, get_name(this),
                                        (crypter_constructor_t)openssl_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_DES_ECB, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_DES_ECB, get_name(this),
                                        (crypter_constructor_t)openssl_crypter_create);
-       lib->crypto->add_crypter(lib->crypto, ENCR_NULL, plugin_name,
+       lib->crypto->add_crypter(lib->crypto, ENCR_NULL, get_name(this),
                                        (crypter_constructor_t)openssl_crypter_create);
 
        /* hasher */
-       lib->crypto->add_hasher(lib->crypto, HASH_SHA1, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_SHA1, get_name(this),
                                        (hasher_constructor_t)openssl_hasher_create);
-       lib->crypto->add_hasher(lib->crypto, HASH_MD2, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_MD2, get_name(this),
                                        (hasher_constructor_t)openssl_hasher_create);
-       lib->crypto->add_hasher(lib->crypto, HASH_MD4, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_MD4, get_name(this),
                                        (hasher_constructor_t)openssl_hasher_create);
-       lib->crypto->add_hasher(lib->crypto, HASH_MD5, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_MD5, get_name(this),
                                        (hasher_constructor_t)openssl_hasher_create);
-       lib->crypto->add_hasher(lib->crypto, HASH_SHA224, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_SHA224, get_name(this),
                                        (hasher_constructor_t)openssl_hasher_create);
-       lib->crypto->add_hasher(lib->crypto, HASH_SHA256, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_SHA256, get_name(this),
                                        (hasher_constructor_t)openssl_hasher_create);
-       lib->crypto->add_hasher(lib->crypto, HASH_SHA384, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_SHA384, get_name(this),
                                        (hasher_constructor_t)openssl_hasher_create);
-       lib->crypto->add_hasher(lib->crypto, HASH_SHA512, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_SHA512, get_name(this),
                                        (hasher_constructor_t)openssl_hasher_create);
 
        /* prf */
-       lib->crypto->add_prf(lib->crypto, PRF_KEYED_SHA1, plugin_name,
+       lib->crypto->add_prf(lib->crypto, PRF_KEYED_SHA1, get_name(this),
                                        (prf_constructor_t)openssl_sha1_prf_create);
 
        /* (ec) diffie hellman */
-       lib->crypto->add_dh(lib->crypto, MODP_2048_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_2048_BIT, get_name(this),
                                                (dh_constructor_t)openssl_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_2048_224, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_2048_224, get_name(this),
                                                (dh_constructor_t)openssl_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_2048_256, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_2048_256, get_name(this),
                                                (dh_constructor_t)openssl_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_1536_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_1536_BIT, get_name(this),
                                                (dh_constructor_t)openssl_diffie_hellman_create);
 #ifndef OPENSSL_NO_EC
-       lib->crypto->add_dh(lib->crypto, ECP_256_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, ECP_256_BIT, get_name(this),
                                                (dh_constructor_t)openssl_ec_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, ECP_384_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, ECP_384_BIT, get_name(this),
                                                (dh_constructor_t)openssl_ec_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, ECP_521_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, ECP_521_BIT, get_name(this),
                                                (dh_constructor_t)openssl_ec_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, ECP_224_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, ECP_224_BIT, get_name(this),
                                                (dh_constructor_t)openssl_ec_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, ECP_192_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, ECP_192_BIT, get_name(this),
                                                (dh_constructor_t)openssl_ec_diffie_hellman_create);
 #endif /* OPENSSL_NO_EC */
-       lib->crypto->add_dh(lib->crypto, MODP_3072_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_3072_BIT, get_name(this),
                                                (dh_constructor_t)openssl_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_4096_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_4096_BIT, get_name(this),
                                                (dh_constructor_t)openssl_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_6144_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_6144_BIT, get_name(this),
                                                (dh_constructor_t)openssl_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_8192_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_8192_BIT, get_name(this),
                                                (dh_constructor_t)openssl_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_1024_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_1024_BIT, get_name(this),
                                                (dh_constructor_t)openssl_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_1024_160, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_1024_160, get_name(this),
                                                (dh_constructor_t)openssl_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_768_BIT, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_768_BIT, get_name(this),
                                                (dh_constructor_t)openssl_diffie_hellman_create);
-       lib->crypto->add_dh(lib->crypto, MODP_CUSTOM, plugin_name,
+       lib->crypto->add_dh(lib->crypto, MODP_CUSTOM, get_name(this),
                                                (dh_constructor_t)openssl_diffie_hellman_create);
 
        /* rsa */
index 695823acf192a3b86fc91b7ed7ee5ea644f341d9..0bf03e16738b2d5721dae40b14e44de02f21aaa5 100644 (file)
@@ -23,8 +23,6 @@
 #include <library.h>
 #include <debug.h>
 
-static const char *plugin_name = "padlock";
-
 typedef struct private_padlock_plugin_t private_padlock_plugin_t;
 typedef enum padlock_feature_t padlock_feature_t;
 
@@ -103,6 +101,12 @@ static padlock_feature_t get_padlock_features()
        return 0;
 }
 
+METHOD(plugin_t, get_name, char*,
+       private_padlock_plugin_t *this)
+{
+       return "padlock";
+}
+
 METHOD(plugin_t, destroy, void,
        private_padlock_plugin_t *this)
 {
@@ -138,6 +142,7 @@ plugin_t *padlock_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
@@ -163,21 +168,21 @@ plugin_t *padlock_plugin_create()
 
        if (this->features & PADLOCK_RNG_ENABLED)
        {
-               lib->crypto->add_rng(lib->crypto, RNG_TRUE, plugin_name,
+               lib->crypto->add_rng(lib->crypto, RNG_TRUE, get_name(this),
                                                (rng_constructor_t)padlock_rng_create);
-               lib->crypto->add_rng(lib->crypto, RNG_STRONG, plugin_name,
+               lib->crypto->add_rng(lib->crypto, RNG_STRONG, get_name(this),
                                                (rng_constructor_t)padlock_rng_create);
-               lib->crypto->add_rng(lib->crypto, RNG_WEAK, plugin_name,
+               lib->crypto->add_rng(lib->crypto, RNG_WEAK, get_name(this),
                                                (rng_constructor_t)padlock_rng_create);
        }
        if (this->features & PADLOCK_ACE2_ENABLED)
        {
-               lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC, plugin_name,
+               lib->crypto->add_crypter(lib->crypto, ENCR_AES_CBC, get_name(this),
                                                (crypter_constructor_t)padlock_aes_crypter_create);
        }
        if (this->features & PADLOCK_PHE_ENABLED)
        {
-               lib->crypto->add_hasher(lib->crypto, HASH_SHA1, plugin_name,
+               lib->crypto->add_hasher(lib->crypto, HASH_SHA1, get_name(this),
                                                (hasher_constructor_t)padlock_sha1_hasher_create);
        }
        return &this->public.plugin;
index f2415a31866c8bd17edf369afceae88b793ceecc..32aeb23be813d103f8572d3390a7f133c7dcaa92 100644 (file)
@@ -33,6 +33,12 @@ struct private_pem_plugin_t {
        pem_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_pem_plugin_t *this)
+{
+       return "pem";
+}
+
 METHOD(plugin_t, destroy, void,
        private_pem_plugin_t *this)
 {
@@ -55,6 +61,7 @@ plugin_t *pem_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index eaf0a1088698598990c7a9dd5c635e2fc5f23568..160f0d701691a7bc37e38977ceae2cc4569b7946 100644 (file)
@@ -33,6 +33,12 @@ struct private_pgp_plugin_t {
        pgp_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_pgp_plugin_t *this)
+{
+       return "pgp";
+}
+
 METHOD(plugin_t, destroy, void,
        private_pgp_plugin_t *this)
 {
@@ -59,6 +65,7 @@ plugin_t *pgp_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 33732f8a4d0cac8b931515ca0b6921277fd48362..e953b14152cf27c0d61318dcbc730d4b7d0ceab7 100644 (file)
@@ -32,6 +32,12 @@ struct private_pkcs1_plugin_t {
        pkcs1_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_pkcs1_plugin_t *this)
+{
+       return "pkcs1";
+}
+
 METHOD(plugin_t, destroy, void,
        private_pkcs1_plugin_t *this)
 {
@@ -55,6 +61,7 @@ plugin_t *pkcs1_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 071d2f7828e706b1666e6ca45d7694f9071772b9..cfa3bbae5a7d626933537199aee8a2b02171a62c 100644 (file)
@@ -26,8 +26,6 @@
 #include "pkcs11_public_key.h"
 #include "pkcs11_hasher.h"
 
-static const char *plugin_name = "pkcs11";
-
 typedef struct private_pkcs11_plugin_t private_pkcs11_plugin_t;
 
 /**
@@ -103,6 +101,12 @@ static void token_event_cb(private_pkcs11_plugin_t *this, pkcs11_library_t *p11,
        }
 }
 
+METHOD(plugin_t, get_name, char*,
+       private_pkcs11_plugin_t *this)
+{
+       return "pkcs11";
+}
+
 METHOD(plugin_t, destroy, void,
        private_pkcs11_plugin_t *this)
 {
@@ -136,6 +140,7 @@ plugin_t *pkcs11_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
@@ -148,17 +153,17 @@ plugin_t *pkcs11_plugin_create()
        if (lib->settings->get_bool(lib->settings,
                                                        "libstrongswan.plugins.pkcs11.use_hasher", FALSE))
        {
-               lib->crypto->add_hasher(lib->crypto, HASH_MD2, plugin_name,
+               lib->crypto->add_hasher(lib->crypto, HASH_MD2, get_name(this),
                                        (hasher_constructor_t)pkcs11_hasher_create);
-               lib->crypto->add_hasher(lib->crypto, HASH_MD5, plugin_name,
+               lib->crypto->add_hasher(lib->crypto, HASH_MD5, get_name(this),
                                        (hasher_constructor_t)pkcs11_hasher_create);
-               lib->crypto->add_hasher(lib->crypto, HASH_SHA1, plugin_name,
+               lib->crypto->add_hasher(lib->crypto, HASH_SHA1, get_name(this),
                                        (hasher_constructor_t)pkcs11_hasher_create);
-               lib->crypto->add_hasher(lib->crypto, HASH_SHA256, plugin_name,
+               lib->crypto->add_hasher(lib->crypto, HASH_SHA256, get_name(this),
                                        (hasher_constructor_t)pkcs11_hasher_create);
-               lib->crypto->add_hasher(lib->crypto, HASH_SHA384, plugin_name,
+               lib->crypto->add_hasher(lib->crypto, HASH_SHA384, get_name(this),
                                        (hasher_constructor_t)pkcs11_hasher_create);
-               lib->crypto->add_hasher(lib->crypto, HASH_SHA512, plugin_name,
+               lib->crypto->add_hasher(lib->crypto, HASH_SHA512, get_name(this),
                                        (hasher_constructor_t)pkcs11_hasher_create);
        }
 
index 6d8a370fb17c3d60cd0236a65709b1e661bc7605..7491160cb5cd82970049c8f515769cea3ad78df0 100644 (file)
@@ -28,6 +28,13 @@ typedef struct plugin_t plugin_t;
  */
 struct plugin_t {
 
+       /**
+        * Get the name of the plugin.
+        *
+        * @return              plugin name
+        */
+       char* (*get_name)(plugin_t *this);
+
        /**
         * Destroy a plugin instance.
         */
index 222ebb92845a9f8ec743fb14db174fa6ab89b12f..dafe647988153b7b7362ee14878e8e8defb55960 100644 (file)
@@ -43,11 +43,6 @@ struct private_plugin_loader_t {
         * list of loaded plugins
         */
        linked_list_t *plugins;
-
-       /**
-        * names of loaded plugins
-        */
-       linked_list_t *names;
 };
 
 /**
@@ -151,12 +146,12 @@ static bool plugin_loaded(private_plugin_loader_t *this, char *name)
 {
        enumerator_t *enumerator;
        bool found = FALSE;
-       char *current;
+       plugin_t *plugin;
 
-       enumerator = this->names->create_enumerator(this->names);
-       while (enumerator->enumerate(enumerator, &current))
+       enumerator = this->plugins->create_enumerator(this->plugins);
+       while (enumerator->enumerate(enumerator, &plugin))
        {
-               if (streq(name, current))
+               if (streq(plugin->get_name(plugin), name))
                {
                        found = TRUE;
                        break;
@@ -201,7 +196,6 @@ METHOD(plugin_loader_t, load_plugins, bool,
                if (plugin)
                {
                        this->plugins->insert_last(this->plugins, plugin);
-                       this->names->insert_last(this->names, token);
                }
                else
                {
@@ -210,8 +204,8 @@ METHOD(plugin_loader_t, load_plugins, bool,
                                critical_failed = TRUE;
                                DBG1(DBG_LIB, "loading critical plugin '%s' failed", token);
                        }
-                       free(token);
                }
+               free(token);
        }
        enumerator->destroy(enumerator);
        return !critical_failed;
@@ -221,7 +215,6 @@ METHOD(plugin_loader_t, unload, void,
        private_plugin_loader_t *this)
 {
        plugin_t *plugin;
-       char *name;
 
        /* unload plugins in reverse order */
        while (this->plugins->remove_last(this->plugins,
@@ -229,23 +222,18 @@ METHOD(plugin_loader_t, unload, void,
        {
                plugin->destroy(plugin);
        }
-       while (this->names->remove_last(this->names, (void**)&name) == SUCCESS)
-       {
-               free(name);
-       }
 }
 
 METHOD(plugin_loader_t, create_plugin_enumerator, enumerator_t*,
        private_plugin_loader_t *this)
 {
-       return this->names->create_enumerator(this->names);
+       return this->plugins->create_enumerator(this->plugins);
 }
 
 METHOD(plugin_loader_t, destroy, void,
        private_plugin_loader_t *this)
 {
        this->plugins->destroy_offset(this->plugins, offsetof(plugin_t, destroy));
-       this->names->destroy_function(this->names, free);
        free(this);
 }
 
@@ -264,7 +252,6 @@ plugin_loader_t *plugin_loader_create()
                        .destroy = _destroy,
                },
                .plugins = linked_list_create(),
-               .names = linked_list_create(),
        );
 
        return &this->public;
index f72c91c60fa9875ccbcecd184034b526c023f2f9..417b6fedb6817b22aabe6a871ea2bb1e9ba80a9c 100644 (file)
@@ -49,9 +49,9 @@ struct plugin_loader_t {
        void (*unload)(plugin_loader_t *this);
 
        /**
-        * Create an enumerator over all loaded plugin names.
+        * Create an enumerator over all loaded plugins.
         *
-        * @return                              enumerator over char*
+        * @return                              enumerator over plugin_t*
         */
        enumerator_t* (*create_plugin_enumerator)(plugin_loader_t *this);
 
index cc12217a4152d0ebb504fae576035506c8083b93..68c14a0dfe2cb7cb77d7bf58da26251d3bd92afa 100644 (file)
@@ -31,6 +31,12 @@ struct private_pubkey_plugin_t {
        pubkey_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_pubkey_plugin_t *this)
+{
+       return "pubkey";
+}
+
 METHOD(plugin_t, destroy, void,
        private_pubkey_plugin_t *this)
 {
@@ -49,6 +55,7 @@ plugin_t *pubkey_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index cc5cb0a3c6f1188ca328da76f643f0c28ee11646..764ac1b78dba777d166c684f4351c0077690db1a 100644 (file)
@@ -18,8 +18,6 @@
 #include <library.h>
 #include "random_rng.h"
 
-static const char *plugin_name = "random";
-
 typedef struct private_random_plugin_t private_random_plugin_t;
 
 /**
@@ -33,6 +31,12 @@ struct private_random_plugin_t {
        random_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_random_plugin_t *this)
+{
+       return "random";
+}
+
 METHOD(plugin_t, destroy, void,
        private_random_plugin_t *this)
 {
@@ -51,14 +55,15 @@ plugin_t *random_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
        );
 
-       lib->crypto->add_rng(lib->crypto, RNG_STRONG, plugin_name,
+       lib->crypto->add_rng(lib->crypto, RNG_STRONG, get_name(this),
                                                 (rng_constructor_t)random_rng_create);
-       lib->crypto->add_rng(lib->crypto, RNG_TRUE, plugin_name,
+       lib->crypto->add_rng(lib->crypto, RNG_TRUE, get_name(this),
                                                 (rng_constructor_t)random_rng_create);
 
        return &this->public.plugin;
index 02393b907544648414b019b81122aaaf4da80bc1..3c2560a6d8c3d5685a58745dc06026608818c532 100644 (file)
@@ -36,6 +36,12 @@ struct private_revocation_plugin_t {
        revocation_validator_t *validator;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_revocation_plugin_t *this)
+{
+       return "revocation";
+}
+
 METHOD(plugin_t, destroy, void,
        private_revocation_plugin_t *this)
 {
@@ -54,6 +60,7 @@ plugin_t *revocation_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index dda2cbc1a8b65f722137a97402c1fe98dd3da963..c7e6be72ebc377228e548bcefc9dd483cd38847d 100644 (file)
@@ -19,8 +19,6 @@
 #include "sha1_hasher.h"
 #include "sha1_prf.h"
 
-static const char *plugin_name = "sha1";
-
 typedef struct private_sha1_plugin_t private_sha1_plugin_t;
 
 /**
@@ -34,6 +32,12 @@ struct private_sha1_plugin_t {
        sha1_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_sha1_plugin_t *this)
+{
+       return "sha1";
+}
+
 METHOD(plugin_t, destroy, void,
        private_sha1_plugin_t *this)
 {
@@ -54,14 +58,15 @@ plugin_t *sha1_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
        );
 
-       lib->crypto->add_hasher(lib->crypto, HASH_SHA1, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_SHA1, get_name(this),
                                                        (hasher_constructor_t)sha1_hasher_create);
-       lib->crypto->add_prf(lib->crypto, PRF_KEYED_SHA1, plugin_name,
+       lib->crypto->add_prf(lib->crypto, PRF_KEYED_SHA1, get_name(this),
                                                        (prf_constructor_t)sha1_prf_create);
 
        return &this->public.plugin;
index a5937dbb2a41b992cbf989615a2ce7248b70c130..42a21312e599054cf8f792701e0a892e1f4b7895 100644 (file)
@@ -18,8 +18,6 @@
 #include <library.h>
 #include "sha2_hasher.h"
 
-static const char *plugin_name = "sha2";
-
 typedef struct private_sha2_plugin_t private_sha2_plugin_t;
 
 /**
@@ -33,6 +31,12 @@ struct private_sha2_plugin_t {
        sha2_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_sha2_plugin_t *this)
+{
+       return "sha2";
+}
+
 METHOD(plugin_t, destroy, void,
        private_sha2_plugin_t *this)
 {
@@ -51,18 +55,19 @@ plugin_t *sha2_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
        );
 
-       lib->crypto->add_hasher(lib->crypto, HASH_SHA224, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_SHA224, get_name(this),
                                                        (hasher_constructor_t)sha2_hasher_create);
-       lib->crypto->add_hasher(lib->crypto, HASH_SHA256, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_SHA256, get_name(this),
                                                        (hasher_constructor_t)sha2_hasher_create);
-       lib->crypto->add_hasher(lib->crypto, HASH_SHA384, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_SHA384, get_name(this),
                                                        (hasher_constructor_t)sha2_hasher_create);
-       lib->crypto->add_hasher(lib->crypto, HASH_SHA512, plugin_name,
+       lib->crypto->add_hasher(lib->crypto, HASH_SHA512, get_name(this),
                                                        (hasher_constructor_t)sha2_hasher_create);
 
        return &this->public.plugin;
index 970e3247275acd700357356441cf0aa017fdccc5..911fbd45cb7ca6160cb70c2b57506659991b3d3c 100644 (file)
@@ -34,6 +34,12 @@ struct private_soup_plugin_t {
        soup_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_soup_plugin_t *this)
+{
+       return "soup";
+}
+
 METHOD(plugin_t, destroy, void,
        private_soup_plugin_t *this)
 {
@@ -58,6 +64,7 @@ plugin_t *soup_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index e0b8e6ce1b47d62dec3ee47d940b239ed2eac5cc..059f1c4aefb753ccf848e7d190955d9e265d9100 100644 (file)
@@ -31,6 +31,12 @@ struct private_sqlite_plugin_t {
        sqlite_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_sqlite_plugin_t *this)
+{
+       return "sqlite";
+}
+
 METHOD(plugin_t, destroy, void,
        private_sqlite_plugin_t *this)
 {
@@ -49,6 +55,7 @@ plugin_t *sqlite_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 176bc438d9bc7525f8d41cdc2b729112d336730d..b2419df96bc15b5aa12342d845047129ab9b91e1 100644 (file)
@@ -104,6 +104,12 @@ struct private_test_vectors_plugin_t {
        test_vectors_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_test_vectors_plugin_t *this)
+{
+       return "test-vectors";
+}
+
 METHOD(plugin_t, destroy, void,
        private_test_vectors_plugin_t *this)
 {
@@ -121,6 +127,7 @@ plugin_t *test_vectors_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index d40cc3567a5c9ef769023ee9d2e0c9a98841e523..1aefda0e0c44b2582a4e2c992d3f61aba28f33aa 100644 (file)
@@ -36,6 +36,12 @@ struct private_x509_plugin_t {
        x509_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_x509_plugin_t *this)
+{
+       return "x509";
+}
+
 METHOD(plugin_t, destroy, void,
        private_x509_plugin_t *this)
 {
@@ -72,6 +78,7 @@ plugin_t *x509_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
index 65e88335c31e3c6f18ba93180b316b267e353da7..1026be8f412f86c60dfeb52619d651992eeb1578 100644 (file)
@@ -19,8 +19,6 @@
 #include "xcbc_signer.h"
 #include "xcbc_prf.h"
 
-static const char *plugin_name = "xcbc";
-
 typedef struct private_xcbc_plugin_t private_xcbc_plugin_t;
 
 /**
@@ -34,6 +32,12 @@ struct private_xcbc_plugin_t {
        xcbc_plugin_t public;
 };
 
+METHOD(plugin_t, get_name, char*,
+       private_xcbc_plugin_t *this)
+{
+       return "xcbc";
+}
+
 METHOD(plugin_t, destroy, void,
        private_xcbc_plugin_t *this)
 {
@@ -55,6 +59,7 @@ plugin_t *xcbc_plugin_create()
        INIT(this,
                .public = {
                        .plugin = {
+                               .get_name = _get_name,
                                .destroy = _destroy,
                        },
                },
@@ -64,18 +69,18 @@ plugin_t *xcbc_plugin_create()
        if (crypter)
        {
                crypter->destroy(crypter);
-               lib->crypto->add_prf(lib->crypto, PRF_AES128_XCBC, plugin_name,
+               lib->crypto->add_prf(lib->crypto, PRF_AES128_XCBC, get_name(this),
                                                (prf_constructor_t)xcbc_prf_create);
-               lib->crypto->add_signer(lib->crypto, AUTH_AES_XCBC_96, plugin_name,
+               lib->crypto->add_signer(lib->crypto, AUTH_AES_XCBC_96, get_name(this),
                                                (signer_constructor_t)xcbc_signer_create);
        }
        crypter = lib->crypto->create_crypter(lib->crypto, ENCR_CAMELLIA_CBC, 16);
        if (crypter)
        {
                crypter->destroy(crypter);
-               lib->crypto->add_prf(lib->crypto, PRF_CAMELLIA128_XCBC, plugin_name,
+               lib->crypto->add_prf(lib->crypto, PRF_CAMELLIA128_XCBC, get_name(this),
                                                (prf_constructor_t)xcbc_prf_create);
-               lib->crypto->add_signer(lib->crypto, AUTH_CAMELLIA_XCBC_96, plugin_name,
+               lib->crypto->add_signer(lib->crypto, AUTH_CAMELLIA_XCBC_96, get_name(this),
                                                (signer_constructor_t)xcbc_signer_create);
        }
        return &this->public.plugin;
index ee33172b4dfb7bb97b3242921c472f7c90598b6f..c5f1776ec8d97c16f29b1083b817d717de2c9388 100644 (file)
@@ -834,7 +834,8 @@ DBG_dump(const char *label, const void *p, size_t len)
 
 static void show_loaded_plugins()
 {
-       char buf[BUF_LEN], *plugin;
+       char buf[BUF_LEN];
+       plugin_t *plugin;
        int len = 0;
        enumerator_t *enumerator;
 
@@ -842,7 +843,7 @@ static void show_loaded_plugins()
        enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
        while (len < BUF_LEN && enumerator->enumerate(enumerator, &plugin))
        {
-               len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin);
+               len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin->get_name(plugin));
        }
        enumerator->destroy(enumerator);
        whack_log(RC_COMMENT, "loaded plugins: %s", buf);
index 841464943ed7506ffd6e7d5995a6ce507810882e..2ee54ec0acd3cf16275332be8cf06ee5666dd009 100644 (file)
 #include "xauth_default_provider.h"
 #include "xauth_default_verifier.h"
 
+METHOD(plugin_t, get_name, char*,
+       xauth_plugin_t *this)
+{
+       return "xauth";
+}
+
 METHOD(plugin_t, destroy, void,
        xauth_plugin_t *this)
 {
@@ -34,6 +40,7 @@ plugin_t *xauth_plugin_create()
 
        INIT(this,
                .plugin = {
+                       .get_name = _get_name,
                        .destroy = _destroy,
                },
        );
index 627176c1b71d9ab18d1790f2cf423109a27f2190..309bde64965f6cc22e2ece2aea17cf1c2fa434cf 100644 (file)
@@ -239,7 +239,8 @@ options_t *options;
  */
 static void print_plugins()
 {
-       char buf[BUF_LEN], *plugin;
+       char buf[BUF_LEN];
+       plugin_t *plugin;
        int len = 0;
        enumerator_t *enumerator;
 
@@ -247,7 +248,7 @@ static void print_plugins()
        enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
        while (len < BUF_LEN && enumerator->enumerate(enumerator, &plugin))
        {
-               len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin);
+               len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin->get_name(plugin));
        }
        enumerator->destroy(enumerator);
        DBG1(DBG_DMN, "loaded plugins: %s", buf);
index 448854acd25b2192e7ba7f68a66673b05e1afd20..887b41765c01a77c3fee5370c90c9c18ce5976f2 100644 (file)
@@ -279,14 +279,15 @@ usage(const char *message)
  */
 static void print_plugins()
 {
-       char buf[BUF_LEN], *plugin;
+       char buf[BUF_LEN];
+       plugin_t *plugin;
        int len = 0;
        enumerator_t *enumerator;
 
        enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
        while (len < BUF_LEN && enumerator->enumerate(enumerator, &plugin))
        {
-               len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin);
+               len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin->get_name(plugin));
        }
        enumerator->destroy(enumerator);
        DBG1(DBG_LIB, "  loaded plugins: %s", buf);