From: Martin Willi Date: Thu, 19 Mar 2015 10:24:31 +0000 (+0100) Subject: attr-sql: Rename sql_attribute_t to attr_sql_provider_t X-Git-Tag: 5.3.0rc1~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd6cc7f243c2e627a7264c916bb15e2f22484071;p=thirdparty%2Fstrongswan.git attr-sql: Rename sql_attribute_t to attr_sql_provider_t As the plugin has its origins in the sql plugin, it still uses the naming scheme for the attribute provider implementation. Rename the class to better match the naming scheme we use in any other plugin --- diff --git a/src/libcharon/plugins/attr_sql/Makefile.am b/src/libcharon/plugins/attr_sql/Makefile.am index 5d89e67cbd..366c902f7f 100644 --- a/src/libcharon/plugins/attr_sql/Makefile.am +++ b/src/libcharon/plugins/attr_sql/Makefile.am @@ -14,6 +14,6 @@ endif libstrongswan_attr_sql_la_SOURCES = \ attr_sql_plugin.h attr_sql_plugin.c \ - sql_attribute.h sql_attribute.c + attr_sql_provider.h attr_sql_provider.c libstrongswan_attr_sql_la_LDFLAGS = -module -avoid-version diff --git a/src/libcharon/plugins/attr_sql/attr_sql_plugin.c b/src/libcharon/plugins/attr_sql/attr_sql_plugin.c index 247cc11c32..9088775141 100644 --- a/src/libcharon/plugins/attr_sql/attr_sql_plugin.c +++ b/src/libcharon/plugins/attr_sql/attr_sql_plugin.c @@ -19,7 +19,7 @@ #include #include "attr_sql_plugin.h" -#include "sql_attribute.h" +#include "attr_sql_provider.h" typedef struct private_attr_sql_plugin_t private_attr_sql_plugin_t; @@ -41,7 +41,7 @@ struct private_attr_sql_plugin_t { /** * configuration attributes */ - sql_attribute_t *attribute; + attr_sql_provider_t *attribute; }; METHOD(plugin_t, get_name, char*, @@ -74,7 +74,7 @@ static bool open_database(private_attr_sql_plugin_t *this, DBG1(DBG_CFG, "attr-sql plugin failed to connect to database"); return FALSE; } - this->attribute = sql_attribute_create(this->db); + this->attribute = attr_sql_provider_create(this->db); charon->attributes->add_provider(charon->attributes, &this->attribute->provider); } diff --git a/src/libcharon/plugins/attr_sql/attr_sql_plugin.h b/src/libcharon/plugins/attr_sql/attr_sql_plugin.h index ef71492f35..b6b04ccc06 100644 --- a/src/libcharon/plugins/attr_sql/attr_sql_plugin.h +++ b/src/libcharon/plugins/attr_sql/attr_sql_plugin.h @@ -17,7 +17,7 @@ * @defgroup attr_sql attr_sql * @ingroup cplugins * - * @defgroup sql_plugin sql_plugin + * @defgroup attr_sql_plugin attr_sql_plugin * @{ @ingroup attr_sql */ diff --git a/src/libcharon/plugins/attr_sql/sql_attribute.c b/src/libcharon/plugins/attr_sql/attr_sql_provider.c similarity index 91% rename from src/libcharon/plugins/attr_sql/sql_attribute.c rename to src/libcharon/plugins/attr_sql/attr_sql_provider.c index fc9fc37173..c2410705d1 100644 --- a/src/libcharon/plugins/attr_sql/sql_attribute.c +++ b/src/libcharon/plugins/attr_sql/attr_sql_provider.c @@ -18,19 +18,19 @@ #include #include -#include "sql_attribute.h" +#include "attr_sql_provider.h" -typedef struct private_sql_attribute_t private_sql_attribute_t; +typedef struct private_attr_sql_provider_t private_attr_sql_provider_t; /** - * private data of sql_attribute + * private data of attr_sql_provider */ -struct private_sql_attribute_t { +struct private_attr_sql_provider_t { /** * public functions */ - sql_attribute_t public; + attr_sql_provider_t public; /** * database connection @@ -46,7 +46,7 @@ struct private_sql_attribute_t { /** * lookup/insert an identity */ -static u_int get_identity(private_sql_attribute_t *this, ike_sa_t *ike_sa) +static u_int get_identity(private_attr_sql_provider_t *this, ike_sa_t *ike_sa) { identification_t *id; enumerator_t *e; @@ -82,7 +82,7 @@ static u_int get_identity(private_sql_attribute_t *this, ike_sa_t *ike_sa) /** * Lookup an attribute pool by name */ -static u_int get_attr_pool(private_sql_attribute_t *this, char *name) +static u_int get_attr_pool(private_attr_sql_provider_t *this, char *name) { enumerator_t *e; u_int row = 0; @@ -102,7 +102,7 @@ static u_int get_attr_pool(private_sql_attribute_t *this, char *name) /** * Lookup pool by name and address family */ -static u_int get_pool(private_sql_attribute_t *this, char *name, int family, +static u_int get_pool(private_attr_sql_provider_t *this, char *name, int family, u_int *timeout) { enumerator_t *e; @@ -128,7 +128,7 @@ static u_int get_pool(private_sql_attribute_t *this, char *name, int family, /** * Look up an existing lease */ -static host_t* check_lease(private_sql_attribute_t *this, char *name, +static host_t* check_lease(private_attr_sql_provider_t *this, char *name, u_int pool, u_int identity) { while (TRUE) @@ -174,7 +174,7 @@ static host_t* check_lease(private_sql_attribute_t *this, char *name, * address as a candidate, but double check later on if it is still available * during the update operation. This allows us to work without locking. */ -static host_t* get_lease(private_sql_attribute_t *this, char *name, +static host_t* get_lease(private_attr_sql_provider_t *this, char *name, u_int pool, u_int timeout, u_int identity) { while (TRUE) @@ -246,7 +246,7 @@ static host_t* get_lease(private_sql_attribute_t *this, char *name, } METHOD(attribute_provider_t, acquire_address, host_t*, - private_sql_attribute_t *this, linked_list_t *pools, ike_sa_t *ike_sa, + private_attr_sql_provider_t *this, linked_list_t *pools, ike_sa_t *ike_sa, host_t *requested) { enumerator_t *enumerator; @@ -298,7 +298,7 @@ METHOD(attribute_provider_t, acquire_address, host_t*, } METHOD(attribute_provider_t, release_address, bool, - private_sql_attribute_t *this, linked_list_t *pools, host_t *address, + private_attr_sql_provider_t *this, linked_list_t *pools, host_t *address, ike_sa_t *ike_sa) { enumerator_t *enumerator; @@ -341,7 +341,7 @@ METHOD(attribute_provider_t, release_address, bool, } METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*, - private_sql_attribute_t *this, linked_list_t *pools, ike_sa_t *ike_sa, + private_attr_sql_provider_t *this, linked_list_t *pools, ike_sa_t *ike_sa, linked_list_t *vips) { enumerator_t *attr_enumerator = NULL; @@ -435,8 +435,8 @@ METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*, return (attr_enumerator ? attr_enumerator : enumerator_create_empty()); } -METHOD(sql_attribute_t, destroy, void, - private_sql_attribute_t *this) +METHOD(attr_sql_provider_t, destroy, void, + private_attr_sql_provider_t *this) { free(this); } @@ -444,9 +444,9 @@ METHOD(sql_attribute_t, destroy, void, /* * see header file */ -sql_attribute_t *sql_attribute_create(database_t *db) +attr_sql_provider_t *attr_sql_provider_create(database_t *db) { - private_sql_attribute_t *this; + private_attr_sql_provider_t *this; time_t now = time(NULL); INIT(this, diff --git a/src/libcharon/plugins/attr_sql/sql_attribute.h b/src/libcharon/plugins/attr_sql/attr_sql_provider.h similarity index 68% rename from src/libcharon/plugins/attr_sql/sql_attribute.h rename to src/libcharon/plugins/attr_sql/attr_sql_provider.h index ca87eb27e9..a9b037bf5e 100644 --- a/src/libcharon/plugins/attr_sql/sql_attribute.h +++ b/src/libcharon/plugins/attr_sql/attr_sql_provider.h @@ -14,22 +14,22 @@ */ /** - * @defgroup sql_attribute sql_attribute + * @defgroup attr_sql_provider attr_sql_provider * @{ @ingroup attr_sql */ -#ifndef SQL_ATTRIBUTE_H_ -#define SQL_ATTRIBUTE_H_ +#ifndef ATTR_SQL_PROVIDER_H_ +#define ATTR_SQL_PROVIDER_H_ #include #include -typedef struct sql_attribute_t sql_attribute_t; +typedef struct attr_sql_provider_t attr_sql_provider_t; /** * SQL database based IKEv2 cfg attribute provider. */ -struct sql_attribute_t { +struct attr_sql_provider_t { /** * Implements attribute provider interface @@ -37,14 +37,14 @@ struct sql_attribute_t { attribute_provider_t provider; /** - * Destroy a sql_attribute instance. + * Destroy a attr_sql_provider instance. */ - void (*destroy)(sql_attribute_t *this); + void (*destroy)(attr_sql_provider_t *this); }; /** - * Create a sql_attribute instance. + * Create a attr_sql_provider instance. */ -sql_attribute_t *sql_attribute_create(database_t *db); +attr_sql_provider_t *attr_sql_provider_create(database_t *db); -#endif /** SQL_ATTRIBUTE_H_ @}*/ +#endif /** ATTR_SQL_PROVIDER_H_ @}*/