aboutsummaryrefslogtreecommitdiffstats
path: root/src/manager
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2011-10-04 11:33:38 +0200
committerTobias Brunner <tobias@strongswan.org>2011-10-04 11:33:38 +0200
commit339fe4fda3272def09097090144c9f07d83b0c0d (patch)
tree7bae6dab3cef778d5e23e75ab50a2fe09090721d /src/manager
parentcd27d66788e07e2964e73b1514521a00bfd76b5e (diff)
downloadstrongswan-339fe4fda3272def09097090144c9f07d83b0c0d.tar.bz2
strongswan-339fe4fda3272def09097090144c9f07d83b0c0d.tar.xz
Migrated gateway_controller_t to INIT/METHOD macros.
Diffstat (limited to 'src/manager')
-rw-r--r--src/manager/controller/gateway_controller.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/manager/controller/gateway_controller.c b/src/manager/controller/gateway_controller.c
index 9fca220e9..39d344502 100644
--- a/src/manager/controller/gateway_controller.c
+++ b/src/manager/controller/gateway_controller.c
@@ -82,19 +82,15 @@ static void _select(private_gateway_controller_t *this, request_t *request)
request->redirect(request, "gateway/list");
}
-/**
- * Implementation of controller_t.get_name
- */
-static char* get_name(private_gateway_controller_t *this)
+METHOD(controller_t, get_name, char*,
+ private_gateway_controller_t *this)
{
return "gateway";
}
-/**
- * Implementation of controller_t.handle
- */
-static void handle(private_gateway_controller_t *this,
- request_t *request, char *action)
+METHOD(controller_t, handle, void,
+ private_gateway_controller_t *this, request_t *request, char *action,
+ char *p2, char *p3, char *p4, char *p5)
{
if (!this->manager->logged_in(this->manager))
{
@@ -114,11 +110,8 @@ static void handle(private_gateway_controller_t *this,
request->redirect(request, "gateway/list");
}
-
-/**
- * Implementation of controller_t.destroy
- */
-static void destroy(private_gateway_controller_t *this)
+METHOD(controller_t, destroy, void,
+ private_gateway_controller_t *this)
{
free(this);
}
@@ -128,13 +121,18 @@ static void destroy(private_gateway_controller_t *this)
*/
controller_t *gateway_controller_create(context_t *context, void *param)
{
- private_gateway_controller_t *this = malloc_thing(private_gateway_controller_t);
-
- this->public.controller.get_name = (char*(*)(controller_t*))get_name;
- this->public.controller.handle = (void(*)(controller_t*,request_t*,char*,char*,char*,char*,char*))handle;
- this->public.controller.destroy = (void(*)(controller_t*))destroy;
-
- this->manager = (manager_t*)context;
+ private_gateway_controller_t *this;
+
+ INIT(this,
+ .public = {
+ .controller = {
+ .get_name = _get_name,
+ .handle = _handle,
+ .destroy = _destroy,
+ },
+ },
+ .manager = (manager_t*)context,
+ );
return &this->public.controller;
}