Migrated gateway_t to INIT/METHOD macros.

This commit is contained in:
Tobias Brunner
2011-10-04 11:13:37 +02:00
parent 152d835d83
commit 99c0fa208f
+26 -37
View File
@@ -98,10 +98,8 @@ static bool connect_(private_gateway_t *this)
return TRUE; return TRUE;
} }
/** METHOD(gateway_t, request, char*,
* Implementation of gateway_t.request. private_gateway_t *this, char *xml, ...)
*/
static char* request(private_gateway_t *this, char *xml, ...)
{ {
if (this->fd < 0) if (this->fd < 0)
{ {
@@ -145,10 +143,8 @@ static char* request(private_gateway_t *this, char *xml, ...)
} }
} }
/** METHOD(gateway_t, query_ikesalist, enumerator_t*,
* Implementation of gateway_t.query_ikesalist. private_gateway_t *this)
*/
static enumerator_t* query_ikesalist(private_gateway_t *this)
{ {
char *str, *name, *value; char *str, *name, *value;
xml_t *xml; xml_t *xml;
@@ -202,11 +198,8 @@ static enumerator_t* query_ikesalist(private_gateway_t *this)
return NULL; return NULL;
} }
METHOD(gateway_t, query_configlist, enumerator_t*,
/** private_gateway_t *this)
* Implementation of gateway_t.query_configlist.
*/
static enumerator_t* query_configlist(private_gateway_t *this)
{ {
char *str, *name, *value; char *str, *name, *value;
xml_t *xml; xml_t *xml;
@@ -302,10 +295,8 @@ static enumerator_t* read_result(private_gateway_t *this, char *res)
return NULL; return NULL;
} }
/** METHOD(gateway_t, initiate, enumerator_t*,
* Implementation of gateway_t.initiate. private_gateway_t *this, bool ike, char *name)
*/
static enumerator_t* initiate(private_gateway_t *this, bool ike, char *name)
{ {
char *str, *kind; char *str, *kind;
@@ -325,10 +316,8 @@ static enumerator_t* initiate(private_gateway_t *this, bool ike, char *name)
return read_result(this, str); return read_result(this, str);
} }
/** METHOD(gateway_t, terminate, enumerator_t*,
* Implementation of gateway_t.terminate. private_gateway_t *this, bool ike, u_int32_t id)
*/
static enumerator_t* terminate(private_gateway_t *this, bool ike, u_int32_t id)
{ {
char *str, *kind; 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); return read_result(this, str);
} }
/** METHOD(gateway_t, destroy, void,
* Implementation of gateway_t.destroy private_gateway_t *this)
*/
static void destroy(private_gateway_t *this)
{ {
if (this->fd >= 0) if (this->fd >= 0)
{ {
@@ -367,19 +354,21 @@ static void destroy(private_gateway_t *this)
*/ */
static private_gateway_t *gateway_create(char *name) static private_gateway_t *gateway_create(char *name)
{ {
private_gateway_t *this = malloc_thing(private_gateway_t); private_gateway_t *this;
this->public.request = (char*(*)(gateway_t*, char *xml))request; INIT(this,
this->public.query_ikesalist = (enumerator_t*(*)(gateway_t*))query_ikesalist; .public = {
this->public.query_configlist = (enumerator_t*(*)(gateway_t*))query_configlist; .request = _request,
this->public.initiate = (enumerator_t*(*)(gateway_t*, bool ike, char *name))initiate; .query_ikesalist = _query_ikesalist,
this->public.terminate = (enumerator_t*(*)(gateway_t*, bool ike, u_int32_t id))terminate; .query_configlist = _query_configlist,
this->public.destroy = (void(*)(gateway_t*))destroy; .initiate = _initiate,
.terminate = _terminate,
this->name = strdup(name); .destroy = _destroy,
this->host = NULL; },
this->fd = -1; .name = strdup(name),
this->xmlid = 1; .fd = -1,
.xmlid = 1,
);
return this; return this;
} }