aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2011-10-04 11:29:34 +0200
committerTobias Brunner <tobias@strongswan.org>2011-10-04 11:29:34 +0200
commit4ad6b41a07bc02b64c01ce83ae146631e7c99897 (patch)
tree170282e9ef6479812bcd053ada2b00d1d868ec2f
parent542afcb078ff2bf60168c2e2ce5062e6b0523c0e (diff)
downloadstrongswan-4ad6b41a07bc02b64c01ce83ae146631e7c99897.tar.bz2
strongswan-4ad6b41a07bc02b64c01ce83ae146631e7c99897.tar.xz
Migrated auth_controller_t to INIT/METHOD macros.
-rw-r--r--src/manager/controller/auth_controller.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/manager/controller/auth_controller.c b/src/manager/controller/auth_controller.c
index dd469cee4..c9a9b5461 100644
--- a/src/manager/controller/auth_controller.c
+++ b/src/manager/controller/auth_controller.c
@@ -67,19 +67,15 @@ static void logout(private_auth_controller_t *this, request_t *request)
request->redirect(request, "auth/login");
}
-/**
- * Implementation of controller_t.get_name
- */
-static char* get_name(private_auth_controller_t *this)
+METHOD(controller_t, get_name, char*,
+ private_auth_controller_t *this)
{
return "auth";
}
-/**
- * Implementation of controller_t.handle
- */
-static void handle(private_auth_controller_t *this,
- request_t *request, char *action)
+METHOD(controller_t, handle, void,
+ private_auth_controller_t *this, request_t *request, char *action,
+ char *p2, char *p3, char *p4, char *p5)
{
if (action)
{
@@ -99,10 +95,8 @@ static void handle(private_auth_controller_t *this,
request->redirect(request, "auth/login");
}
-/**
- * Implementation of controller_t.destroy
- */
-static void destroy(private_auth_controller_t *this)
+METHOD(controller_t, destroy, void,
+ private_auth_controller_t *this)
{
free(this);
}
@@ -112,13 +106,18 @@ static void destroy(private_auth_controller_t *this)
*/
controller_t *auth_controller_create(context_t *context, void *param)
{
- private_auth_controller_t *this = malloc_thing(private_auth_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_auth_controller_t *this;
+
+ INIT(this,
+ .public = {
+ .controller = {
+ .get_name = _get_name,
+ .handle = _handle,
+ .destroy = _destroy,
+ },
+ },
+ .manager = (manager_t*)context,
+ );
return &this->public.controller;
}