mirror of
https://github.com/strongswan/strongswan.git
synced 2025-12-08 00:00:29 -05:00
Migrated ldap plugin to INIT/METHOD macros
This commit is contained in:
parent
4df49844d9
commit
1e84aa74aa
@ -100,8 +100,8 @@ static bool parse(LDAP *ldap, LDAPMessage *result, chunk_t *response)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t fetch(private_ldap_fetcher_t *this, char *url,
|
METHOD(fetcher_t, fetch, status_t,
|
||||||
chunk_t *result, va_list args)
|
private_ldap_fetcher_t *this, char *url, chunk_t *result)
|
||||||
{
|
{
|
||||||
LDAP *ldap;
|
LDAP *ldap;
|
||||||
LDAPURLDesc *lurl;
|
LDAPURLDesc *lurl;
|
||||||
@ -166,10 +166,8 @@ static status_t fetch(private_ldap_fetcher_t *this, char *url,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
METHOD(fetcher_t, set_option, bool,
|
||||||
* Implementation of fetcher_t.set_option.
|
private_ldap_fetcher_t *this, fetcher_option_t option, ...)
|
||||||
*/
|
|
||||||
static bool set_option(private_ldap_fetcher_t *this, fetcher_option_t option, ...)
|
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
@ -186,10 +184,8 @@ static bool set_option(private_ldap_fetcher_t *this, fetcher_option_t option, ..
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(fetcher_t, destroy, void,
|
||||||
* Implements ldap_fetcher_t.destroy
|
private_ldap_fetcher_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_ldap_fetcher_t *this)
|
|
||||||
{
|
{
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
@ -199,13 +195,18 @@ static void destroy(private_ldap_fetcher_t *this)
|
|||||||
*/
|
*/
|
||||||
ldap_fetcher_t *ldap_fetcher_create()
|
ldap_fetcher_t *ldap_fetcher_create()
|
||||||
{
|
{
|
||||||
private_ldap_fetcher_t *this = malloc_thing(private_ldap_fetcher_t);
|
private_ldap_fetcher_t *this;
|
||||||
|
|
||||||
this->public.interface.fetch = (status_t(*)(fetcher_t*,char*,chunk_t*))fetch;
|
INIT(this,
|
||||||
this->public.interface.set_option = (bool(*)(fetcher_t*, fetcher_option_t option, ...))set_option;
|
.public = {
|
||||||
this->public.interface.destroy = (void (*)(fetcher_t*))destroy;
|
.interface = {
|
||||||
|
.fetch = _fetch,
|
||||||
this->timeout = DEFAULT_TIMEOUT;
|
.set_option = _set_option,
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.timeout = DEFAULT_TIMEOUT,
|
||||||
|
);
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,10 +31,8 @@ struct private_ldap_plugin_t {
|
|||||||
ldap_plugin_t public;
|
ldap_plugin_t public;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
METHOD(plugin_t, destroy, void,
|
||||||
* Implementation of ldap_plugin_t.destroy
|
private_ldap_plugin_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_ldap_plugin_t *this)
|
|
||||||
{
|
{
|
||||||
lib->fetcher->remove_fetcher(lib->fetcher,
|
lib->fetcher->remove_fetcher(lib->fetcher,
|
||||||
(fetcher_constructor_t)ldap_fetcher_create);
|
(fetcher_constructor_t)ldap_fetcher_create);
|
||||||
@ -46,9 +44,15 @@ static void destroy(private_ldap_plugin_t *this)
|
|||||||
*/
|
*/
|
||||||
plugin_t *ldap_plugin_create()
|
plugin_t *ldap_plugin_create()
|
||||||
{
|
{
|
||||||
private_ldap_plugin_t *this = malloc_thing(private_ldap_plugin_t);
|
private_ldap_plugin_t *this;
|
||||||
|
|
||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
INIT(this,
|
||||||
|
.public = {
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
lib->fetcher->add_fetcher(lib->fetcher,
|
lib->fetcher->add_fetcher(lib->fetcher,
|
||||||
(fetcher_constructor_t)ldap_fetcher_create, "ldap://");
|
(fetcher_constructor_t)ldap_fetcher_create, "ldap://");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user