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/controller/control_controller.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/controller/control_controller.c')
-rw-r--r-- | src/manager/controller/control_controller.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/manager/controller/control_controller.c b/src/manager/controller/control_controller.c index fdf66bf14..68238d02f 100644 --- a/src/manager/controller/control_controller.c +++ b/src/manager/controller/control_controller.c @@ -120,19 +120,15 @@ static void terminate(private_control_controller_t *this, request_t *r, handle_result(this, r, e); } -/** - * Implementation of controller_t.get_name - */ -static char* get_name(private_control_controller_t *this) +METHOD(controller_t, get_name, char*, + private_control_controller_t *this) { return "control"; } -/** - * Implementation of controller_t.handle - */ -static void handle(private_control_controller_t *this, - request_t *request, char *action, char *str) +METHOD(controller_t, handle, void, + private_control_controller_t *this, request_t *request, char *action, + char *str, char *p3, char *p4, char *p5) { if (!this->manager->logged_in(this->manager)) { @@ -178,10 +174,8 @@ static void handle(private_control_controller_t *this, return request->redirect(request, "ikesa/list"); } -/** - * Implementation of controller_t.destroy - */ -static void destroy(private_control_controller_t *this) +METHOD(controller_t, destroy, void, + private_control_controller_t *this) { free(this); } @@ -191,13 +185,18 @@ static void destroy(private_control_controller_t *this) */ controller_t *control_controller_create(context_t *context, void *param) { - private_control_controller_t *this = malloc_thing(private_control_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_control_controller_t *this; + + INIT(this, + .public = { + .controller = { + .get_name = _get_name, + .handle = _handle, + .destroy = _destroy, + }, + }, + .manager = (manager_t*)context, + ); return &this->public.controller; } |