builder_function_t constructor;
};
-/**
- * Implementation of credential_factory_t.add_builder_constructor.
- */
-static void add_builder(private_credential_factory_t *this,
- credential_type_t type, int subtype,
- builder_function_t constructor)
+METHOD(credential_factory_t, add_builder, void,
+ private_credential_factory_t *this, credential_type_t type, int subtype,
+ builder_function_t constructor)
{
entry_t *entry = malloc_thing(entry_t);
this->lock->unlock(this->lock);
}
-/**
- * Implementation of credential_factory_t.remove_builder.
- */
-static void remove_builder(private_credential_factory_t *this,
- builder_function_t constructor)
+METHOD(credential_factory_t, remove_builder, void,
+ private_credential_factory_t *this, builder_function_t constructor)
{
enumerator_t *enumerator;
entry_t *entry;
this->lock->unlock(this->lock);
}
-/**
- * Implementation of credential_factory_t.create.
- */
-static void* create(private_credential_factory_t *this, credential_type_t type,
- int subtype, ...)
+METHOD(credential_factory_t, create, void*,
+ private_credential_factory_t *this, credential_type_t type, int subtype, ...)
{
enumerator_t *enumerator;
entry_t *entry;
return construct;
}
-/**
- * Implementation of credential_factory_t.destroy
- */
-static void destroy(private_credential_factory_t *this)
+METHOD(credential_factory_t, destroy, void,
+ private_credential_factory_t *this)
{
this->constructors->destroy_function(this->constructors, free);
this->recursive->destroy(this->recursive);
*/
credential_factory_t *credential_factory_create()
{
- private_credential_factory_t *this = malloc_thing(private_credential_factory_t);
-
- this->public.create = (void*(*)(credential_factory_t*, credential_type_t type, int subtype, ...))create;
- this->public.add_builder = (void(*)(credential_factory_t*,credential_type_t type, int subtype, builder_function_t constructor))add_builder;
- this->public.remove_builder = (void(*)(credential_factory_t*,builder_function_t constructor))remove_builder;
- this->public.destroy = (void(*)(credential_factory_t*))destroy;
-
- this->constructors = linked_list_create();
- this->recursive = thread_value_create(NULL);
- this->lock = rwlock_create(RWLOCK_TYPE_DEFAULT);
+ private_credential_factory_t *this;
+
+ INIT(this,
+ .public = {
+ .create = _create,
+ .add_builder = _add_builder,
+ .remove_builder = _remove_builder,
+ .destroy = _destroy,
+ },
+ .constructors = linked_list_create(),
+ .recursive = thread_value_create(NULL),
+ .lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
+ );
return &this->public;
}