diff options
author | Tobias Brunner <tobias@strongswan.org> | 2011-10-04 11:27:26 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2011-10-04 11:27:26 +0200 |
commit | 542afcb078ff2bf60168c2e2ce5062e6b0523c0e (patch) | |
tree | 4fa0045d7c8b5b668d0ed4669d4fad87a0f7d003 /src/manager | |
parent | a17eb787de4ea2c25920d5ab1382a279fae4fa5c (diff) | |
download | strongswan-542afcb078ff2bf60168c2e2ce5062e6b0523c0e.tar.bz2 strongswan-542afcb078ff2bf60168c2e2ce5062e6b0523c0e.tar.xz |
Migrated ikesa_controller_t to INIT/METHOD macros.
Diffstat (limited to 'src/manager')
-rw-r--r-- | src/manager/controller/ikesa_controller.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/manager/controller/ikesa_controller.c b/src/manager/controller/ikesa_controller.c index afa4a67f8..716d51a7a 100644 --- a/src/manager/controller/ikesa_controller.c +++ b/src/manager/controller/ikesa_controller.c @@ -173,19 +173,15 @@ static void list(private_ikesa_controller_t *this, request_t *r) } } -/** - * Implementation of controller_t.get_name - */ -static char* get_name(private_ikesa_controller_t *this) +METHOD(controller_t, get_name, char*, + private_ikesa_controller_t *this) { return "ikesa"; } -/** - * Implementation of controller_t.handle - */ -static void handle(private_ikesa_controller_t *this, - request_t *request, char *action) +METHOD(controller_t, handle, void, + private_ikesa_controller_t *this, request_t *request, char *action, + char *p2, char *p3, char *p4, char *p5) { if (!this->manager->logged_in(this->manager)) { @@ -205,10 +201,8 @@ static void handle(private_ikesa_controller_t *this, return request->redirect(request, "ikesa/list"); } -/** - * Implementation of controller_t.destroy - */ -static void destroy(private_ikesa_controller_t *this) +METHOD(controller_t, destroy, void, + private_ikesa_controller_t *this) { free(this); } @@ -218,13 +212,18 @@ static void destroy(private_ikesa_controller_t *this) */ controller_t *ikesa_controller_create(context_t *context, void *param) { - private_ikesa_controller_t *this = malloc_thing(private_ikesa_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_ikesa_controller_t *this; + + INIT(this, + .public = { + .controller = { + .get_name = _get_name, + .handle = _handle, + .destroy = _destroy, + }, + }, + .manager = (manager_t*)context, + ); return &this->public.controller; } |