summaryrefslogtreecommitdiff
path: root/src/medsrv/controller
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2013-08-25 15:37:26 +0200
committerYves-Alexis Perez <corsac@debian.org>2013-08-25 15:37:26 +0200
commit6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349 (patch)
tree009fc492961e13860d2a4bc2de8caf2bbe2975e7 /src/medsrv/controller
parentc83921a2b566aa9d55d8ccc7258f04fca6292ee6 (diff)
downloadvyos-strongswan-6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349.tar.gz
vyos-strongswan-6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349.zip
Imported Upstream version 5.1.0
Diffstat (limited to 'src/medsrv/controller')
-rw-r--r--src/medsrv/controller/peer_controller.c23
-rw-r--r--src/medsrv/controller/peer_controller.h6
-rw-r--r--src/medsrv/controller/user_controller.c26
-rw-r--r--src/medsrv/controller/user_controller.h6
4 files changed, 30 insertions, 31 deletions
diff --git a/src/medsrv/controller/peer_controller.c b/src/medsrv/controller/peer_controller.c
index 7b0b9e6ac..4943647b5 100644
--- a/src/medsrv/controller/peer_controller.c
+++ b/src/medsrv/controller/peer_controller.c
@@ -52,7 +52,7 @@ struct private_peer_controller_t {
/**
* list the configured peer configs
*/
-static void list(private_peer_controller_t *this, request_t *request)
+static void list(private_peer_controller_t *this, fast_request_t *request)
{
enumerator_t *query;
@@ -83,7 +83,7 @@ static void list(private_peer_controller_t *this, request_t *request)
/**
* verify a peer alias
*/
-static bool verify_alias(private_peer_controller_t *this, request_t *request,
+static bool verify_alias(private_peer_controller_t *this, fast_request_t *request,
char *alias)
{
if (!alias || *alias == '\0')
@@ -117,7 +117,7 @@ static bool verify_alias(private_peer_controller_t *this, request_t *request,
* parse and verify a public key
*/
static bool parse_public_key(private_peer_controller_t *this,
- request_t *request, char *public_key,
+ fast_request_t *request, char *public_key,
chunk_t *encoding, chunk_t *keyid)
{
public_key_t *public;
@@ -153,7 +153,7 @@ static bool parse_public_key(private_peer_controller_t *this,
/**
* register a new peer
*/
-static void add(private_peer_controller_t *this, request_t *request)
+static void add(private_peer_controller_t *this, fast_request_t *request)
{
char *alias = "", *public_key = "";
@@ -231,7 +231,7 @@ char* pem_encode(chunk_t der)
/**
* edit a peer
*/
-static void edit(private_peer_controller_t *this, request_t *request, int id)
+static void edit(private_peer_controller_t *this, fast_request_t *request, int id)
{
char *alias = "", *public_key = "", *pem;
chunk_t encoding, keyid;
@@ -305,21 +305,21 @@ static void edit(private_peer_controller_t *this, request_t *request, int id)
/**
* delete a peer from the database
*/
-static void delete(private_peer_controller_t *this, request_t *request, int id)
+static void delete(private_peer_controller_t *this, fast_request_t *request, int id)
{
this->db->execute(this->db, NULL,
"DELETE FROM peer WHERE id = ? AND user = ?",
DB_INT, id, DB_UINT, this->user->get_user(this->user));
}
-METHOD(controller_t, get_name, char*,
+METHOD(fast_controller_t, get_name, char*,
private_peer_controller_t *this)
{
return "peer";
}
-METHOD(controller_t, handle, void,
- private_peer_controller_t *this, request_t *request, char *action,
+METHOD(fast_controller_t, handle, void,
+ private_peer_controller_t *this, fast_request_t *request, char *action,
char *idstr, char *p3, char *p4, char *p5)
{
if (action)
@@ -350,7 +350,7 @@ METHOD(controller_t, handle, void,
request->redirect(request, "peer/list");
}
-METHOD(controller_t, destroy, void,
+METHOD(fast_controller_t, destroy, void,
private_peer_controller_t *this)
{
free(this);
@@ -359,7 +359,7 @@ METHOD(controller_t, destroy, void,
/*
* see header file
*/
-controller_t *peer_controller_create(user_t *user, database_t *db)
+fast_controller_t *peer_controller_create(user_t *user, database_t *db)
{
private_peer_controller_t *this;
@@ -377,4 +377,3 @@ controller_t *peer_controller_create(user_t *user, database_t *db)
return &this->public.controller;
}
-
diff --git a/src/medsrv/controller/peer_controller.h b/src/medsrv/controller/peer_controller.h
index b5a5e0bb8..1282156b7 100644
--- a/src/medsrv/controller/peer_controller.h
+++ b/src/medsrv/controller/peer_controller.h
@@ -24,7 +24,7 @@
#include <user.h>
-#include <controller.h>
+#include <fast_controller.h>
#include <database/database.h>
typedef struct peer_controller_t peer_controller_t;
@@ -37,12 +37,12 @@ struct peer_controller_t {
/**
* Implements controller_t interface.
*/
- controller_t controller;
+ fast_controller_t controller;
};
/**
* Create a peer_controller controller instance.
*/
-controller_t *peer_controller_create(user_t *user, database_t *db);
+fast_controller_t *peer_controller_create(user_t *user, database_t *db);
#endif /** PEER_CONTROLLER_H_ @}*/
diff --git a/src/medsrv/controller/user_controller.c b/src/medsrv/controller/user_controller.c
index 35c9d90c8..36d04e12c 100644
--- a/src/medsrv/controller/user_controller.c
+++ b/src/medsrv/controller/user_controller.c
@@ -76,7 +76,7 @@ static chunk_t hash_password(char *login, char *password)
/**
* Login a user.
*/
-static void login(private_user_controller_t *this, request_t *request)
+static void login(private_user_controller_t *this, fast_request_t *request)
{
if (request->get_query_data(request, "submit"))
{
@@ -115,7 +115,7 @@ static void login(private_user_controller_t *this, request_t *request)
/**
* Logout a user.
*/
-static void logout(private_user_controller_t *this, request_t *request)
+static void logout(private_user_controller_t *this, fast_request_t *request)
{
request->redirect(request, "user/login");
request->close_session(request);
@@ -124,8 +124,8 @@ static void logout(private_user_controller_t *this, request_t *request)
/**
* verify a user entered username for validity
*/
-static bool verify_login(private_user_controller_t *this, request_t *request,
- char *login)
+static bool verify_login(private_user_controller_t *this,
+ fast_request_t *request, char *login)
{
if (!login || *login == '\0')
{
@@ -156,7 +156,8 @@ static bool verify_login(private_user_controller_t *this, request_t *request,
/**
* verify a user entered password for validity
*/
-static bool verify_password(private_user_controller_t *this, request_t *request,
+static bool verify_password(private_user_controller_t *this,
+ fast_request_t *request,
char *password, char *confirm)
{
if (!password || *password == '\0')
@@ -181,7 +182,7 @@ static bool verify_password(private_user_controller_t *this, request_t *request,
/**
* Register a user.
*/
-static void add(private_user_controller_t *this, request_t *request)
+static void add(private_user_controller_t *this, fast_request_t *request)
{
char *login = "";
@@ -222,7 +223,7 @@ static void add(private_user_controller_t *this, request_t *request)
/**
* Edit the logged in user
*/
-static void edit(private_user_controller_t *this, request_t *request)
+static void edit(private_user_controller_t *this, fast_request_t *request)
{
enumerator_t *query;
char *old_login;
@@ -297,14 +298,14 @@ static void edit(private_user_controller_t *this, request_t *request)
request->render(request, "templates/user/edit.cs");
}
-METHOD(controller_t, get_name, char*,
+METHOD(fast_controller_t, get_name, char*,
private_user_controller_t *this)
{
return "user";
}
-METHOD(controller_t, handle, void,
- private_user_controller_t *this, request_t *request, char *action,
+METHOD(fast_controller_t, handle, void,
+ private_user_controller_t *this, fast_request_t *request, char *action,
char *p2, char *p3, char *p4, char *p5)
{
if (action)
@@ -333,7 +334,7 @@ METHOD(controller_t, handle, void,
request->redirect(request, "user/login");
}
-METHOD(controller_t, destroy, void,
+METHOD(fast_controller_t, destroy, void,
private_user_controller_t *this)
{
free(this);
@@ -342,7 +343,7 @@ METHOD(controller_t, destroy, void,
/*
* see header file
*/
-controller_t *user_controller_create(user_t *user, database_t *db)
+fast_controller_t *user_controller_create(user_t *user, database_t *db)
{
private_user_controller_t *this;
@@ -362,4 +363,3 @@ controller_t *user_controller_create(user_t *user, database_t *db)
return &this->public.controller;
}
-
diff --git a/src/medsrv/controller/user_controller.h b/src/medsrv/controller/user_controller.h
index 540dc74a2..8443a8d2b 100644
--- a/src/medsrv/controller/user_controller.h
+++ b/src/medsrv/controller/user_controller.h
@@ -24,7 +24,7 @@
#include <user.h>
-#include <controller.h>
+#include <fast_controller.h>
#include <database/database.h>
typedef struct user_controller_t user_controller_t;
@@ -37,12 +37,12 @@ struct user_controller_t {
/**
* Implements controller_t interface.
*/
- controller_t controller;
+ fast_controller_t controller;
};
/**
* Create a user_controller controller instance.
*/
-controller_t *user_controller_create(user_t *user, database_t *db);
+fast_controller_t *user_controller_create(user_t *user, database_t *db);
#endif /** USER_CONTROLLER_H_ @}*/