Migrated gateway_controller_t to INIT/METHOD macros.
This commit is contained in:
@@ -82,19 +82,15 @@ static void _select(private_gateway_controller_t *this, request_t *request)
|
|||||||
request->redirect(request, "gateway/list");
|
request->redirect(request, "gateway/list");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(controller_t, get_name, char*,
|
||||||
* Implementation of controller_t.get_name
|
private_gateway_controller_t *this)
|
||||||
*/
|
|
||||||
static char* get_name(private_gateway_controller_t *this)
|
|
||||||
{
|
{
|
||||||
return "gateway";
|
return "gateway";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(controller_t, handle, void,
|
||||||
* Implementation of controller_t.handle
|
private_gateway_controller_t *this, request_t *request, char *action,
|
||||||
*/
|
char *p2, char *p3, char *p4, char *p5)
|
||||||
static void handle(private_gateway_controller_t *this,
|
|
||||||
request_t *request, char *action)
|
|
||||||
{
|
{
|
||||||
if (!this->manager->logged_in(this->manager))
|
if (!this->manager->logged_in(this->manager))
|
||||||
{
|
{
|
||||||
@@ -114,11 +110,8 @@ static void handle(private_gateway_controller_t *this,
|
|||||||
request->redirect(request, "gateway/list");
|
request->redirect(request, "gateway/list");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
METHOD(controller_t, destroy, void,
|
||||||
/**
|
private_gateway_controller_t *this)
|
||||||
* Implementation of controller_t.destroy
|
|
||||||
*/
|
|
||||||
static void destroy(private_gateway_controller_t *this)
|
|
||||||
{
|
{
|
||||||
free(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)
|
controller_t *gateway_controller_create(context_t *context, void *param)
|
||||||
{
|
{
|
||||||
private_gateway_controller_t *this = malloc_thing(private_gateway_controller_t);
|
private_gateway_controller_t *this;
|
||||||
|
|
||||||
this->public.controller.get_name = (char*(*)(controller_t*))get_name;
|
INIT(this,
|
||||||
this->public.controller.handle = (void(*)(controller_t*,request_t*,char*,char*,char*,char*,char*))handle;
|
.public = {
|
||||||
this->public.controller.destroy = (void(*)(controller_t*))destroy;
|
.controller = {
|
||||||
|
.get_name = _get_name,
|
||||||
this->manager = (manager_t*)context;
|
.handle = _handle,
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.manager = (manager_t*)context,
|
||||||
|
);
|
||||||
|
|
||||||
return &this->public.controller;
|
return &this->public.controller;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user