Changed plugin constructors from plugin_create to plugin_name_plugin_create.

This commit is contained in:
Tobias Brunner
2010-03-02 09:10:26 +01:00
parent 6cc13cd9c5
commit 9ce567f895
61 changed files with 92 additions and 67 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ METHOD(plugin_t, destroy, void,
/**
* See header
*/
plugin_t *plugin_create()
plugin_t *android_plugin_create()
{
private_android_plugin_t *this;
+1 -1
View File
@@ -49,7 +49,7 @@ static void destroy(private_attr_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *attr_plugin_create()
{
private_attr_plugin_t *this = malloc_thing(private_attr_plugin_t);
+1 -1
View File
@@ -35,7 +35,7 @@ static void destroy(eap_aka_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *eap_aka_plugin_create()
{
eap_aka_plugin_t *this = malloc_thing(eap_aka_plugin_t);
@@ -64,7 +64,7 @@ static void destroy(private_eap_aka_3gpp2_t *this)
/**
* See header
*/
plugin_t *plugin_create()
plugin_t *eap_aka_3gpp2_plugin_create()
{
private_eap_aka_3gpp2_t *this = malloc_thing(private_eap_aka_3gpp2_t);
+1 -1
View File
@@ -37,7 +37,7 @@ static void destroy(eap_gtc_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *eap_gtc_plugin_create()
{
eap_gtc_plugin_t *this = malloc_thing(eap_gtc_plugin_t);
@@ -34,7 +34,7 @@ static void destroy(eap_identity_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *eap_identity_plugin_create()
{
eap_identity_plugin_t *this = malloc_thing(eap_identity_plugin_t);
+1 -1
View File
@@ -34,7 +34,7 @@ static void destroy(eap_md5_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *eap_md5_plugin_create()
{
eap_md5_plugin_t *this = malloc_thing(eap_md5_plugin_t);
@@ -34,7 +34,7 @@ static void destroy(eap_mschapv2_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *eap_mschapv2_plugin_create()
{
eap_mschapv2_plugin_t *this = malloc_thing(eap_mschapv2_plugin_t);
@@ -33,7 +33,7 @@ static void destroy(eap_radius_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *eap_radius_plugin_create()
{
eap_radius_plugin_t *this;
+1 -1
View File
@@ -35,7 +35,7 @@ static void destroy(eap_sim_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *eap_sim_plugin_create()
{
eap_sim_plugin_t *this = malloc_thing(eap_sim_plugin_t);
@@ -19,7 +19,7 @@
#include "eap_sim_file_triplets.h"
#include <daemon.h>
#define TRIPLET_FILE IPSEC_CONFDIR "/ipsec.d/triplets.dat"
typedef struct private_eap_sim_file_t private_eap_sim_file_t;
@@ -66,7 +66,7 @@ static void destroy(private_eap_sim_file_t *this)
/**
* See header
*/
plugin_t *plugin_create()
plugin_t *eap_sim_file_plugin_create()
{
private_eap_sim_file_t *this = malloc_thing(private_eap_sim_file_t);
@@ -57,7 +57,7 @@ static void destroy(private_eap_simaka_pseudonym_t *this)
/**
* See header
*/
plugin_t *plugin_create()
plugin_t *eap_simaka_pseudonym_plugin_create()
{
private_eap_simaka_pseudonym_t *this;
@@ -57,7 +57,7 @@ static void destroy(private_eap_simaka_reauth_t *this)
/**
* See header
*/
plugin_t *plugin_create()
plugin_t *eap_simaka_reauth_plugin_create()
{
private_eap_simaka_reauth_t *this = malloc_thing(private_eap_simaka_reauth_t);
@@ -44,7 +44,7 @@ static void destroy(private_kernel_klips_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *kernel_klips_plugin_create()
{
private_kernel_klips_plugin_t *this = malloc_thing(private_kernel_klips_plugin_t);
@@ -46,7 +46,7 @@ static void destroy(private_kernel_netlink_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *kernel_netlink_plugin_create()
{
private_kernel_netlink_plugin_t *this = malloc_thing(private_kernel_netlink_plugin_t);
@@ -44,7 +44,7 @@ static void destroy(private_kernel_pfkey_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *kernel_pfkey_plugin_create()
{
private_kernel_pfkey_plugin_t *this = malloc_thing(private_kernel_pfkey_plugin_t);
@@ -45,7 +45,7 @@ static void destroy(private_kernel_pfroute_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *kernel_pfroute_plugin_create()
{
private_kernel_pfroute_plugin_t *this = malloc_thing(private_kernel_pfroute_plugin_t);
@@ -173,7 +173,7 @@ static void destroy(private_load_tester_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *load_tester_plugin_create()
{
private_load_tester_plugin_t *this;
u_int i, shutdown_on = 0;
+1 -1
View File
@@ -72,7 +72,7 @@ static void destroy(private_medcli_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *medcli_plugin_create()
{
char *uri;
private_medcli_plugin_t *this = malloc_thing(private_medcli_plugin_t);
+1 -1
View File
@@ -64,7 +64,7 @@ static void destroy(private_medsrv_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *medsrv_plugin_create()
{
char *uri;
private_medsrv_plugin_t *this = malloc_thing(private_medsrv_plugin_t);
+1 -1
View File
@@ -93,7 +93,7 @@ static void destroy(private_nm_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *nm_plugin_create()
{
private_nm_plugin_t *this = malloc_thing(private_nm_plugin_t);
+1 -1
View File
@@ -49,7 +49,7 @@ static void destroy(private_resolve_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *resolve_plugin_create()
{
private_resolve_plugin_t *this = malloc_thing(private_resolve_plugin_t);
+1 -1
View File
@@ -720,7 +720,7 @@ static void destroy(private_smp_t *this)
/*
* Described in header file
*/
plugin_t *plugin_create()
plugin_t *smp_plugin_create()
{
struct sockaddr_un unix_addr = { AF_UNIX, IPSEC_PIDDIR "/charon.xml"};
private_smp_t *this = malloc_thing(private_smp_t);
@@ -48,7 +48,7 @@ METHOD(plugin_t, destroy, void,
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *socket_default_plugin_create()
{
private_socket_default_plugin_t *this;
@@ -48,7 +48,7 @@ METHOD(plugin_t, destroy, void,
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *socket_dynamic_plugin_create()
{
private_socket_dynamic_plugin_t *this;
@@ -48,7 +48,7 @@ METHOD(plugin_t, destroy, void,
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *socket_raw_plugin_create()
{
private_socket_raw_plugin_t *this;
+1 -1
View File
@@ -71,7 +71,7 @@ static void destroy(private_sql_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *sql_plugin_create()
{
char *uri;
private_sql_plugin_t *this;
+1 -1
View File
@@ -48,7 +48,7 @@ static void destroy(private_stroke_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *stroke_plugin_create()
{
private_stroke_plugin_t *this = malloc_thing(private_stroke_plugin_t);
+1 -1
View File
@@ -75,7 +75,7 @@ static void destroy(private_uci_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *uci_plugin_create()
{
private_uci_plugin_t *this = malloc_thing(private_uci_plugin_t);
+1 -1
View File
@@ -103,7 +103,7 @@ static void destroy(private_unit_tester_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *unit_tester_plugin_create()
{
private_unit_tester_t *this = malloc_thing(private_unit_tester_t);
+1 -1
View File
@@ -49,7 +49,7 @@ static void destroy(private_updown_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *updown_plugin_create()
{
private_updown_plugin_t *this = malloc_thing(private_updown_plugin_t);
+1 -1
View File
@@ -44,7 +44,7 @@ static void destroy(private_aes_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *aes_plugin_create()
{
private_aes_plugin_t *this = malloc_thing(private_aes_plugin_t);
@@ -44,7 +44,7 @@ static void destroy(private_agent_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *agent_plugin_create()
{
private_agent_plugin_t *this = malloc_thing(private_agent_plugin_t);
@@ -57,7 +57,7 @@ static void destroy(private_attr_sql_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *attr_sql_plugin_create()
{
char *uri;
private_attr_sql_plugin_t *this;
@@ -45,7 +45,7 @@ static void destroy(private_blowfish_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *blowfish_plugin_create()
{
private_blowfish_plugin_t *this = malloc_thing(private_blowfish_plugin_t);
+1 -1
View File
@@ -48,7 +48,7 @@ static void destroy(private_curl_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *curl_plugin_create()
{
CURLcode res;
private_curl_plugin_t *this = malloc_thing(private_curl_plugin_t);
+1 -1
View File
@@ -44,7 +44,7 @@ static void destroy(private_des_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *des_plugin_create()
{
private_des_plugin_t *this = malloc_thing(private_des_plugin_t);
@@ -44,7 +44,7 @@ static void destroy(private_dnskey_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *dnskey_plugin_create()
{
private_dnskey_plugin_t *this = malloc_thing(private_dnskey_plugin_t);
@@ -44,7 +44,7 @@ static void destroy(private_fips_prf_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *fips_prf_plugin_create()
{
private_fips_prf_plugin_t *this = malloc_thing(private_fips_prf_plugin_t);
@@ -118,7 +118,7 @@ static void destroy(private_gcrypt_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *gcrypt_plugin_create()
{
private_gcrypt_plugin_t *this;
+1 -1
View File
@@ -52,7 +52,7 @@ static void destroy(private_gmp_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *gmp_plugin_create()
{
private_gmp_plugin_t *this = malloc_thing(private_gmp_plugin_t);
+1 -1
View File
@@ -47,7 +47,7 @@ static void destroy(private_hmac_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *hmac_plugin_create()
{
private_hmac_plugin_t *this = malloc_thing(private_hmac_plugin_t);
+1 -1
View File
@@ -44,7 +44,7 @@ static void destroy(private_ldap_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *ldap_plugin_create()
{
private_ldap_plugin_t *this = malloc_thing(private_ldap_plugin_t);
+1 -1
View File
@@ -44,7 +44,7 @@ static void destroy(private_md4_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *md4_plugin_create()
{
private_md4_plugin_t *this = malloc_thing(private_md4_plugin_t);
+1 -1
View File
@@ -44,7 +44,7 @@ static void destroy(private_md5_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *md5_plugin_create()
{
private_md5_plugin_t *this = malloc_thing(private_md5_plugin_t);
@@ -46,7 +46,7 @@ static void destroy(private_mysql_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *mysql_plugin_create()
{
private_mysql_plugin_t *this;
@@ -201,7 +201,7 @@ static void destroy(private_openssl_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *openssl_plugin_create()
{
private_openssl_plugin_t *this = malloc_thing(private_openssl_plugin_t);
@@ -131,7 +131,7 @@ static void destroy(private_padlock_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *padlock_plugin_create()
{
private_padlock_plugin_t *this = malloc_thing(private_padlock_plugin_t);
+1 -1
View File
@@ -48,7 +48,7 @@ static void destroy(private_pem_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *pem_plugin_create()
{
private_pem_plugin_t *this = malloc_thing(private_pem_plugin_t);
+1 -1
View File
@@ -54,7 +54,7 @@ static void destroy(private_pgp_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *pgp_plugin_create()
{
private_pgp_plugin_t *this = malloc_thing(private_pgp_plugin_t);
@@ -50,7 +50,7 @@ static void destroy(private_pkcs1_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *pkcs1_plugin_create()
{
private_pkcs1_plugin_t *this = malloc_thing(private_pkcs1_plugin_t);
+2 -2
View File
@@ -38,9 +38,9 @@ struct plugin_t {
/**
* Plugin constructor function definiton.
*
* Each plugin has a constructor functions. This function is called on daemon
* Each plugin has a constructor function. This function is called on daemon
* startup to initialize each plugin.
* The plugin function is named plugin_create().
* The plugin function is named plugin_name_plugin_create().
*
* @return plugin_t instance
*/
+30 -5
View File
@@ -1,4 +1,5 @@
/*
* Copyright (C) 2010 Tobias Brunner
* Copyright (C) 2007 Martin Willi
* Hochschule fuer Technik Rapperswil
*
@@ -49,19 +50,43 @@ struct private_plugin_loader_t {
linked_list_t *names;
};
/**
* Replace '-' with '_' to use str as identifier.
*/
static char* sanitize(char *str)
{
char *pos = str;
while (pos && *pos)
{
if (*pos == '-')
{
*pos = '_';
}
pos++;
}
return str;
}
/**
* load a single plugin
*/
static plugin_t* load_plugin(private_plugin_loader_t *this,
char *path, char *name)
{
char create[128];
char file[PATH_MAX];
void *handle;
plugin_t *plugin;
plugin_constructor_t constructor;
snprintf(file, sizeof(file), "%s/libstrongswan-%s.so", path, name);
if (snprintf(file, sizeof(file), "%s/libstrongswan-%s.so", path,
name) >= sizeof(file) ||
snprintf(create, sizeof(create), "%s_plugin_create",
name) >= sizeof(create))
{
return NULL;
}
sanitize(create);
if (lib->integrity)
{
if (!lib->integrity->check_file(lib->integrity, name, file))
@@ -76,10 +101,10 @@ static plugin_t* load_plugin(private_plugin_loader_t *this,
DBG1("plugin '%s': failed to load '%s' - %s", name, file, dlerror());
return NULL;
}
constructor = dlsym(handle, "plugin_create");
constructor = dlsym(handle, create);
if (constructor == NULL)
{
DBG1("plugin '%s': failed to load - no plugin_create() function", name);
DBG1("plugin '%s': failed to load - %s not found", name, create);
dlclose(handle);
return NULL;
}
@@ -96,7 +121,7 @@ static plugin_t* load_plugin(private_plugin_loader_t *this,
plugin = constructor();
if (plugin == NULL)
{
DBG1("plugin '%s': failed to load - plugin_create() returned NULL", name);
DBG1("plugin '%s': failed to load - %s returned NULL", name, create);
dlclose(handle);
return NULL;
}
@@ -44,7 +44,7 @@ static void destroy(private_pubkey_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *pubkey_plugin_create()
{
private_pubkey_plugin_t *this = malloc_thing(private_pubkey_plugin_t);
@@ -44,7 +44,7 @@ static void destroy(private_random_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *random_plugin_create()
{
private_random_plugin_t *this = malloc_thing(private_random_plugin_t);
+1 -1
View File
@@ -47,7 +47,7 @@ static void destroy(private_sha1_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *sha1_plugin_create()
{
private_sha1_plugin_t *this = malloc_thing(private_sha1_plugin_t);
+1 -1
View File
@@ -44,7 +44,7 @@ static void destroy(private_sha2_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *sha2_plugin_create()
{
private_sha2_plugin_t *this = malloc_thing(private_sha2_plugin_t);
@@ -44,7 +44,7 @@ static void destroy(private_sqlite_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *sqlite_plugin_create()
{
private_sqlite_plugin_t *this = malloc_thing(private_sqlite_plugin_t);
@@ -104,7 +104,7 @@ static void destroy(private_test_vectors_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *test_vectors_plugin_create()
{
private_test_vectors_plugin_t *this = malloc_thing(private_test_vectors_plugin_t);
int i;
+1 -1
View File
@@ -65,7 +65,7 @@ static void destroy(private_x509_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *x509_plugin_create()
{
private_x509_plugin_t *this = malloc_thing(private_x509_plugin_t);
+1 -1
View File
@@ -47,7 +47,7 @@ static void destroy(private_xcbc_plugin_t *this)
/*
* see header file
*/
plugin_t *plugin_create()
plugin_t *xcbc_plugin_create()
{
private_xcbc_plugin_t *this = malloc_thing(private_xcbc_plugin_t);