]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Migrated auth_filter_t to INIT/METHOD macros.
authorTobias Brunner <tobias@strongswan.org>
Tue, 4 Oct 2011 08:39:43 +0000 (10:39 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 4 Oct 2011 08:40:37 +0000 (10:40 +0200)
src/medsrv/filter/auth_filter.c

index d06f96db146d89ca15ed35165a96c07e3499d890..d21abdc46647927cf4859ca6833d8aaf3da1bd80 100755 (executable)
@@ -40,11 +40,9 @@ struct private_auth_filter_t {
        database_t *db;
 };
 
-/**
- * Implementation of filter_t.run
- */
-static bool run(private_auth_filter_t *this, request_t *request,
-                               char *controller, char *action)
+METHOD(filter_t, run, bool,
+       private_auth_filter_t *this, request_t *request, char *controller,
+       char *action, char *p2, char *p3, char *p4, char *p5)
 {
        if (this->user->get_user(this->user))
        {
@@ -72,10 +70,8 @@ static bool run(private_auth_filter_t *this, request_t *request,
        return FALSE;
 }
 
-/**
- * Implementation of filter_t.destroy
- */
-static void destroy(private_auth_filter_t *this)
+METHOD(filter_t, destroy, void,
+       private_auth_filter_t *this)
 {
        free(this);
 }
@@ -85,13 +81,18 @@ static void destroy(private_auth_filter_t *this)
  */
 filter_t *auth_filter_create(user_t *user, database_t *db)
 {
-       private_auth_filter_t *this= malloc_thing(private_auth_filter_t);
-
-       this->public.filter.destroy = (void(*)(filter_t*))destroy;
-       this->public.filter.run = (bool(*)(filter_t*, request_t*,char*,char*,char*,char*,char*,char*))run;
+       private_auth_filter_t *this;
 
-       this->user = user;
-       this->db = db;
+       INIT(this,
+               .public = {
+                       .filter = {
+                               .destroy = _destroy,
+                               .run = _run,
+                       },
+               },
+               .user = user,
+               .db = db,
+       );
 
        return &this->public.filter;
 }