Migrated auth_cfg to INIT/METHOD macros

This commit is contained in:
Andreas Steffen
2011-10-02 10:42:01 +02:00
parent 784ce91d8b
commit 7b9e6ddd20
+29 -39
View File
@@ -118,10 +118,8 @@ static void entry_enumerator_destroy(entry_enumerator_t *this)
free(this); free(this);
} }
/** METHOD(auth_cfg_t, create_enumerator, enumerator_t*,
* Implementation of auth_cfg_t.create_enumerator. private_auth_cfg_t *this)
*/
static enumerator_t* create_enumerator(private_auth_cfg_t *this)
{ {
entry_enumerator_t *enumerator; entry_enumerator_t *enumerator;
@@ -181,7 +179,7 @@ static void destroy_entry_value(entry_t *entry)
/** /**
* Implementation of auth_cfg_t.replace. * Implementation of auth_cfg_t.replace.
*/ */
static void replace(auth_cfg_t *this, entry_enumerator_t *enumerator, static void replace(private_auth_cfg_t *this, entry_enumerator_t *enumerator,
auth_rule_t type, ...) auth_rule_t type, ...)
{ {
if (enumerator->current) if (enumerator->current)
@@ -225,10 +223,8 @@ static void replace(auth_cfg_t *this, entry_enumerator_t *enumerator,
} }
} }
/** METHOD(auth_cfg_t, get, void*,
* Implementation of auth_cfg_t.get. private_auth_cfg_t *this, auth_rule_t type)
*/
static void* get(private_auth_cfg_t *this, auth_rule_t type)
{ {
enumerator_t *enumerator; enumerator_t *enumerator;
void *current_value, *best_value = NULL; void *current_value, *best_value = NULL;
@@ -335,11 +331,8 @@ static void add(private_auth_cfg_t *this, auth_rule_t type, ...)
this->entries->insert_last(this->entries, entry); this->entries->insert_last(this->entries, entry);
} }
/** METHOD(auth_cfg_t, complies, bool,
* Implementation of auth_cfg_t.complies. private_auth_cfg_t *this, auth_cfg_t *constraints, bool log_error)
*/
static bool complies(private_auth_cfg_t *this, auth_cfg_t *constraints,
bool log_error)
{ {
enumerator_t *e1, *e2; enumerator_t *e1, *e2;
bool success = TRUE, has_group = FALSE, group_match = FALSE; bool success = TRUE, has_group = FALSE, group_match = FALSE;
@@ -788,10 +781,8 @@ static bool equals(private_auth_cfg_t *this, private_auth_cfg_t *other)
return equal; return equal;
} }
/** METHOD(auth_cfg_t, purge, void,
* Implementation of auth_cfg_t.purge private_auth_cfg_t *this, bool keep_ca)
*/
static void purge(private_auth_cfg_t *this, bool keep_ca)
{ {
entry_t *entry; entry_t *entry;
linked_list_t *cas; linked_list_t *cas;
@@ -816,10 +807,8 @@ static void purge(private_auth_cfg_t *this, bool keep_ca)
cas->destroy(cas); cas->destroy(cas);
} }
/** METHOD(auth_cfg_t, clone_, auth_cfg_t*,
* Implementation of auth_cfg_t.clone private_auth_cfg_t *this)
*/
static auth_cfg_t* clone_(private_auth_cfg_t *this)
{ {
enumerator_t *enumerator; enumerator_t *enumerator;
auth_cfg_t *clone; auth_cfg_t *clone;
@@ -873,10 +862,8 @@ static auth_cfg_t* clone_(private_auth_cfg_t *this)
return clone; return clone;
} }
/** METHOD(auth_cfg_t, destroy, void,
* Implementation of auth_cfg_t.destroy private_auth_cfg_t *this)
*/
static void destroy(private_auth_cfg_t *this)
{ {
purge(this, FALSE); purge(this, FALSE);
this->entries->destroy(this->entries); this->entries->destroy(this->entries);
@@ -888,20 +875,23 @@ static void destroy(private_auth_cfg_t *this)
*/ */
auth_cfg_t *auth_cfg_create() auth_cfg_t *auth_cfg_create()
{ {
private_auth_cfg_t *this = malloc_thing(private_auth_cfg_t); private_auth_cfg_t *this;
this->public.add = (void(*)(auth_cfg_t*, auth_rule_t type, ...))add; INIT(this,
this->public.get = (void*(*)(auth_cfg_t*, auth_rule_t type))get; .public = {
this->public.create_enumerator = (enumerator_t*(*)(auth_cfg_t*))create_enumerator; .add = (void(*)(auth_cfg_t*, auth_rule_t type, ...))add,
this->public.replace = (void(*)(auth_cfg_t*,enumerator_t*,auth_rule_t,...))replace; .get = _get,
this->public.complies = (bool(*)(auth_cfg_t*, auth_cfg_t *,bool))complies; .create_enumerator = _create_enumerator,
this->public.merge = (void(*)(auth_cfg_t*, auth_cfg_t *other,bool))merge; .replace = (void(*)(auth_cfg_t*,enumerator_t*,auth_rule_t,...))replace,
this->public.purge = (void(*)(auth_cfg_t*,bool))purge; .complies = _complies,
this->public.equals = (bool(*)(auth_cfg_t*, auth_cfg_t *other))equals; .merge = (void(*)(auth_cfg_t*,auth_cfg_t*,bool))merge,
this->public.clone = (auth_cfg_t*(*)(auth_cfg_t*))clone_; .purge = _purge,
this->public.destroy = (void(*)(auth_cfg_t*))destroy; .equals = (bool(*)(auth_cfg_t*,auth_cfg_t*))equals,
.clone = _clone_,
this->entries = linked_list_create(); .destroy = _destroy,
},
.entries = linked_list_create(),
);
return &this->public; return &this->public;
} }