aboutsummaryrefslogtreecommitdiffstats
path: root/src/manager/controller/gateway_controller.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2007-09-14 14:07:30 +0000
committerMartin Willi <martin@strongswan.org>2007-09-14 14:07:30 +0000
commitc01f7bf989dedcc61e4e812fd57d6d73997cfd85 (patch)
treee50601b98d290e941b0ea2ab9ac1769dc6f9519a /src/manager/controller/gateway_controller.c
parent15a9d460c05ac73dfae41bc8a66b07f0c2a48328 (diff)
downloadstrongswan-c01f7bf989dedcc61e4e812fd57d6d73997cfd85.tar.bz2
strongswan-c01f7bf989dedcc61e4e812fd57d6d73997cfd85.tar.xz
added subnets of CHILD_SAs to xml interface
a first design of Managers IKE_SA list page
Diffstat (limited to 'src/manager/controller/gateway_controller.c')
-rw-r--r--src/manager/controller/gateway_controller.c40
1 files changed, 23 insertions, 17 deletions
diff --git a/src/manager/controller/gateway_controller.c b/src/manager/controller/gateway_controller.c
index 32576216e..1ebb51192 100644
--- a/src/manager/controller/gateway_controller.c
+++ b/src/manager/controller/gateway_controller.c
@@ -72,6 +72,7 @@ static void list(private_gateway_controller_t *this,
}
enumerator->destroy(enumerator);
t->set(t, "action", "select");
+ t->set(t, "title", "Choose gateway");
t->render(t, response);
t->destroy(t);
}
@@ -90,16 +91,7 @@ static void _select(private_gateway_controller_t *this,
return;
}
}
- response->printf(response, "selecting dings failed: %s", id);
-}
-
-/**
- * redirect to authentication login
- */
-static void login(private_gateway_controller_t *this,
- request_t *request, response_t *response)
-{
- response->redirect(response, "auth/login");
+ response->printf(response, "selecting gateway failed: %s", id);
}
/**
@@ -111,16 +103,30 @@ static char* get_name(private_gateway_controller_t *this)
}
/**
- * Implementation of controller_t.get_handler
+ * Implementation of controller_t.handle
*/
-static controller_handler_t get_handler(private_gateway_controller_t *this, char *name)
+static void handle(private_gateway_controller_t *this,
+ request_t *request, response_t *response, char *action)
{
- if (!this->manager->logged_in(this->manager)) return (controller_handler_t)login;
- if (streq(name, "list")) return (controller_handler_t)list;
- if (streq(name, "select")) return (controller_handler_t)_select;
- return NULL;
+ if (!this->manager->logged_in(this->manager))
+ {
+ return response->redirect(response, "auth/login");
+ }
+ if (action)
+ {
+ if (streq(action, "list"))
+ {
+ return list(this, request, response);
+ }
+ else if (streq(action, "select"))
+ {
+ return _select(this, request, response);
+ }
+ }
+ response->redirect(response, "gateway/list");
}
+
/**
* Implementation of controller_t.destroy
*/
@@ -137,7 +143,7 @@ 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.get_handler = (controller_handler_t(*)(controller_t*,char*))get_handler;
+ this->public.controller.handle = (void(*)(controller_t*,request_t*,response_t*,char*,char*,char*,char*,char*))handle;
this->public.controller.destroy = (void(*)(controller_t*))destroy;
this->manager = (manager_t*)context;