Migrated stroke_cat_t to INIT/METHOD macros

This commit is contained in:
Andreas Steffen
2010-11-27 00:49:15 +01:00
parent 31f6f1513d
commit a5ffb559d2
+33 -40
View File
@@ -207,11 +207,8 @@ static enumerator_t *create_inner_cdp_hashandurl(ca_section_t *section, cdp_data
return enumerator; return enumerator;
} }
/** METHOD(credential_set_t, create_cdp_enumerator, enumerator_t*,
* Implementation of credential_set_t.create_cdp_enumerator. private_stroke_ca_t *this, certificate_type_t type, identification_t *id)
*/
static enumerator_t *create_cdp_enumerator(private_stroke_ca_t *this,
certificate_type_t type, identification_t *id)
{ {
cdp_data_t *data; cdp_data_t *data;
@@ -235,10 +232,9 @@ static enumerator_t *create_cdp_enumerator(private_stroke_ca_t *this,
(type == CERT_X509) ? (void*)create_inner_cdp_hashandurl : (void*)create_inner_cdp, (type == CERT_X509) ? (void*)create_inner_cdp_hashandurl : (void*)create_inner_cdp,
data, (void*)cdp_data_destroy); data, (void*)cdp_data_destroy);
} }
/**
* Implementation of stroke_ca_t.add. METHOD(stroke_ca_t, add, void,
*/ private_stroke_ca_t *this, stroke_msg_t *msg)
static void add(private_stroke_ca_t *this, stroke_msg_t *msg)
{ {
certificate_t *cert; certificate_t *cert;
ca_section_t *ca; ca_section_t *ca;
@@ -279,10 +275,8 @@ static void add(private_stroke_ca_t *this, stroke_msg_t *msg)
} }
} }
/** METHOD(stroke_ca_t, del, void,
* Implementation of stroke_ca_t.del. private_stroke_ca_t *this, stroke_msg_t *msg)
*/
static void del(private_stroke_ca_t *this, stroke_msg_t *msg)
{ {
enumerator_t *enumerator; enumerator_t *enumerator;
ca_section_t *ca = NULL; ca_section_t *ca = NULL;
@@ -336,10 +330,8 @@ static void list_uris(linked_list_t *list, char *label, FILE *out)
enumerator->destroy(enumerator); enumerator->destroy(enumerator);
} }
/** METHOD(stroke_ca_t, check_for_hash_and_url, void,
* Implementation of stroke_ca_t.check_for_hash_and_url. private_stroke_ca_t *this, certificate_t* cert)
*/
static void check_for_hash_and_url(private_stroke_ca_t *this, certificate_t* cert)
{ {
ca_section_t *section; ca_section_t *section;
enumerator_t *enumerator; enumerator_t *enumerator;
@@ -376,10 +368,8 @@ static void check_for_hash_and_url(private_stroke_ca_t *this, certificate_t* cer
hasher->destroy(hasher); hasher->destroy(hasher);
} }
/** METHOD(stroke_ca_t, list, void,
* Implementation of stroke_ca_t.list. private_stroke_ca_t *this, stroke_msg_t *msg, FILE *out)
*/
static void list(private_stroke_ca_t *this, stroke_msg_t *msg, FILE *out)
{ {
bool first = TRUE; bool first = TRUE;
ca_section_t *section; ca_section_t *section;
@@ -426,10 +416,8 @@ static void list(private_stroke_ca_t *this, stroke_msg_t *msg, FILE *out)
this->lock->unlock(this->lock); this->lock->unlock(this->lock);
} }
/** METHOD(stroke_ca_t, destroy, void,
* Implementation of stroke_ca_t.destroy private_stroke_ca_t *this)
*/
static void destroy(private_stroke_ca_t *this)
{ {
this->sections->destroy_function(this->sections, (void*)ca_section_destroy); this->sections->destroy_function(this->sections, (void*)ca_section_destroy);
this->lock->destroy(this->lock); this->lock->destroy(this->lock);
@@ -441,22 +429,27 @@ static void destroy(private_stroke_ca_t *this)
*/ */
stroke_ca_t *stroke_ca_create(stroke_cred_t *cred) stroke_ca_t *stroke_ca_create(stroke_cred_t *cred)
{ {
private_stroke_ca_t *this = malloc_thing(private_stroke_ca_t); private_stroke_ca_t *this;
this->public.set.create_private_enumerator = (void*)return_null; INIT(this,
this->public.set.create_cert_enumerator = (void*)return_null; .public = {
this->public.set.create_shared_enumerator = (void*)return_null; .set = {
this->public.set.create_cdp_enumerator = (void*)create_cdp_enumerator; .create_private_enumerator = (void*)return_null,
this->public.set.cache_cert = (void*)nop; .create_cert_enumerator = (void*)return_null,
this->public.add = (void(*)(stroke_ca_t*, stroke_msg_t *msg))add; .create_shared_enumerator = (void*)return_null,
this->public.del = (void(*)(stroke_ca_t*, stroke_msg_t *msg))del; .create_cdp_enumerator = _create_cdp_enumerator,
this->public.list = (void(*)(stroke_ca_t*, stroke_msg_t *msg, FILE *out))list; .cache_cert = (void*)nop,
this->public.check_for_hash_and_url = (void(*)(stroke_ca_t*, certificate_t*))check_for_hash_and_url; },
this->public.destroy = (void(*)(stroke_ca_t*))destroy; .add = _add,
.del = _del,
this->sections = linked_list_create(); .list = _list,
this->lock = rwlock_create(RWLOCK_TYPE_DEFAULT); .check_for_hash_and_url = _check_for_hash_and_url,
this->cred = cred; .destroy = _destroy,
},
.sections = linked_list_create(),
.lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
.cred = cred,
);
return &this->public; return &this->public;
} }