diff options
author | Yves-Alexis Perez <corsac@corsac.net> | 2012-06-28 21:16:07 +0200 |
---|---|---|
committer | Yves-Alexis Perez <corsac@corsac.net> | 2012-06-28 21:16:07 +0200 |
commit | b34738ed08c2227300d554b139e2495ca5da97d6 (patch) | |
tree | 62f33b52820f2e49f0e53c0f8c636312037c8054 /src/manager/gateway.c | |
parent | 0a9d51a49042a68daa15b0c74a2b7f152f52606b (diff) | |
download | vyos-strongswan-b34738ed08c2227300d554b139e2495ca5da97d6.tar.gz vyos-strongswan-b34738ed08c2227300d554b139e2495ca5da97d6.zip |
Imported Upstream version 4.6.4
Diffstat (limited to 'src/manager/gateway.c')
-rw-r--r-- | src/manager/gateway.c | 65 |
1 files changed, 27 insertions, 38 deletions
diff --git a/src/manager/gateway.c b/src/manager/gateway.c index fd462afa7..8a8fbe895 100644 --- a/src/manager/gateway.c +++ b/src/manager/gateway.c @@ -98,10 +98,8 @@ static bool connect_(private_gateway_t *this) return TRUE; } -/** - * Implementation of gateway_t.request. - */ -static char* request(private_gateway_t *this, char *xml, ...) +METHOD(gateway_t, request, char*, + private_gateway_t *this, char *xml, ...) { if (this->fd < 0) { @@ -145,10 +143,8 @@ static char* request(private_gateway_t *this, char *xml, ...) } } -/** - * Implementation of gateway_t.query_ikesalist. - */ -static enumerator_t* query_ikesalist(private_gateway_t *this) +METHOD(gateway_t, query_ikesalist, enumerator_t*, + private_gateway_t *this) { char *str, *name, *value; xml_t *xml; @@ -202,11 +198,8 @@ static enumerator_t* query_ikesalist(private_gateway_t *this) return NULL; } - -/** - * Implementation of gateway_t.query_configlist. - */ -static enumerator_t* query_configlist(private_gateway_t *this) +METHOD(gateway_t, query_configlist, enumerator_t*, + private_gateway_t *this) { char *str, *name, *value; xml_t *xml; @@ -302,10 +295,8 @@ static enumerator_t* read_result(private_gateway_t *this, char *res) return NULL; } -/** - * Implementation of gateway_t.initiate. - */ -static enumerator_t* initiate(private_gateway_t *this, bool ike, char *name) +METHOD(gateway_t, initiate, enumerator_t*, + private_gateway_t *this, bool ike, char *name) { char *str, *kind; @@ -325,10 +316,8 @@ static enumerator_t* initiate(private_gateway_t *this, bool ike, char *name) return read_result(this, str); } -/** - * Implementation of gateway_t.terminate. - */ -static enumerator_t* terminate(private_gateway_t *this, bool ike, u_int32_t id) +METHOD(gateway_t, terminate, enumerator_t*, + private_gateway_t *this, bool ike, u_int32_t id) { char *str, *kind; @@ -348,10 +337,8 @@ static enumerator_t* terminate(private_gateway_t *this, bool ike, u_int32_t id) return read_result(this, str); } -/** - * Implementation of gateway_t.destroy - */ -static void destroy(private_gateway_t *this) +METHOD(gateway_t, destroy, void, + private_gateway_t *this) { if (this->fd >= 0) { @@ -367,19 +354,21 @@ static void destroy(private_gateway_t *this) */ static private_gateway_t *gateway_create(char *name) { - private_gateway_t *this = malloc_thing(private_gateway_t); - - this->public.request = (char*(*)(gateway_t*, char *xml))request; - this->public.query_ikesalist = (enumerator_t*(*)(gateway_t*))query_ikesalist; - this->public.query_configlist = (enumerator_t*(*)(gateway_t*))query_configlist; - this->public.initiate = (enumerator_t*(*)(gateway_t*, bool ike, char *name))initiate; - this->public.terminate = (enumerator_t*(*)(gateway_t*, bool ike, u_int32_t id))terminate; - this->public.destroy = (void(*)(gateway_t*))destroy; - - this->name = strdup(name); - this->host = NULL; - this->fd = -1; - this->xmlid = 1; + private_gateway_t *this; + + INIT(this, + .public = { + .request = _request, + .query_ikesalist = _query_ikesalist, + .query_configlist = _query_configlist, + .initiate = _initiate, + .terminate = _terminate, + .destroy = _destroy, + }, + .name = strdup(name), + .fd = -1, + .xmlid = 1, + ); return this; } |