summaryrefslogtreecommitdiff
path: root/src/libfast/session.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@corsac.net>2012-06-28 21:16:07 +0200
committerYves-Alexis Perez <corsac@corsac.net>2012-06-28 21:16:07 +0200
commitb34738ed08c2227300d554b139e2495ca5da97d6 (patch)
tree62f33b52820f2e49f0e53c0f8c636312037c8054 /src/libfast/session.c
parent0a9d51a49042a68daa15b0c74a2b7f152f52606b (diff)
downloadvyos-strongswan-b34738ed08c2227300d554b139e2495ca5da97d6.tar.gz
vyos-strongswan-b34738ed08c2227300d554b139e2495ca5da97d6.zip
Imported Upstream version 4.6.4
Diffstat (limited to 'src/libfast/session.c')
-rw-r--r--src/libfast/session.c56
1 files changed, 24 insertions, 32 deletions
diff --git a/src/libfast/session.c b/src/libfast/session.c
index 7c4548ee5..1d9ed0107 100644
--- a/src/libfast/session.c
+++ b/src/libfast/session.c
@@ -63,18 +63,14 @@ struct private_session_t {
context_t *context;
};
-/**
- * Implementation of session_t.add_controller.
- */
-static void add_controller(private_session_t *this, controller_t *controller)
+METHOD(session_t, add_controller, void,
+ private_session_t *this, controller_t *controller)
{
this->controllers->insert_last(this->controllers, controller);
}
-/**
- * Implementation of session_t.add_filter.
- */
-static void add_filter(private_session_t *this, filter_t *filter)
+METHOD(session_t, add_filter, void,
+ private_session_t *this, filter_t *filter)
{
this->filters->insert_last(this->filters, filter);
}
@@ -120,10 +116,8 @@ static bool run_filter(private_session_t *this, request_t *request, char *p0,
return TRUE;
}
-/**
- * Implementation of session_t.process.
- */
-static void process(private_session_t *this, request_t *request)
+METHOD(session_t, process, void,
+ private_session_t *this, request_t *request)
{
char *pos, *start, *param[6] = {NULL, NULL, NULL, NULL, NULL, NULL};
enumerator_t *enumerator;
@@ -184,18 +178,14 @@ static void process(private_session_t *this, request_t *request)
}
}
-/**
- * Implementation of session_t.get_sid.
- */
-static char* get_sid(private_session_t *this)
+METHOD(session_t, get_sid, char*,
+ private_session_t *this)
{
return this->sid;
}
-/**
- * Implementation of session_t.destroy
- */
-static void destroy(private_session_t *this)
+METHOD(session_t, destroy, void,
+ private_session_t *this)
{
this->controllers->destroy_offset(this->controllers, offsetof(controller_t, destroy));
this->filters->destroy_offset(this->filters, offsetof(filter_t, destroy));
@@ -208,19 +198,21 @@ static void destroy(private_session_t *this)
*/
session_t *session_create(context_t *context)
{
- private_session_t *this = malloc_thing(private_session_t);
-
- this->public.add_controller = (void(*)(session_t*, controller_t*))add_controller;
- this->public.add_filter = (void(*)(session_t*, filter_t*))add_filter;
- this->public.process = (void(*)(session_t*,request_t*))process;
- this->public.get_sid = (char*(*)(session_t*))get_sid;
- this->public.destroy = (void(*)(session_t*))destroy;
-
+ private_session_t *this;
+
+ INIT(this,
+ .public = {
+ .add_controller = _add_controller,
+ .add_filter = _add_filter,
+ .process = _process,
+ .get_sid = _get_sid,
+ .destroy = _destroy,
+ },
+ .controllers = linked_list_create(),
+ .filters = linked_list_create(),
+ .context = context,
+ );
create_sid(this);
- this->cookie_sent = FALSE;
- this->controllers = linked_list_create();
- this->filters = linked_list_create();
- this->context = context;
return &this->public;
}