Migrated cert_cache to INIT/METHOD macros
This commit is contained in:
@@ -132,11 +132,8 @@ static void cache(private_cert_cache_t *this,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(cert_cache_t, issued_by, bool,
|
||||||
* Implementation of cert_cache_t.issued_by.
|
private_cert_cache_t *this, certificate_t *subject, certificate_t *issuer)
|
||||||
*/
|
|
||||||
static bool issued_by(private_cert_cache_t *this,
|
|
||||||
certificate_t *subject, certificate_t *issuer)
|
|
||||||
{
|
{
|
||||||
relation_t *found = NULL, *current;
|
relation_t *found = NULL, *current;
|
||||||
int i;
|
int i;
|
||||||
@@ -270,12 +267,9 @@ static void cert_enumerator_destroy(cert_enumerator_t *this)
|
|||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(credential_set_t, create_enumerator, enumerator_t*,
|
||||||
* implementation of credential_set_t.create_cert_enumerator
|
private_cert_cache_t *this, certificate_type_t cert, key_type_t key,
|
||||||
*/
|
identification_t *id, bool trusted)
|
||||||
static enumerator_t *create_enumerator(private_cert_cache_t *this,
|
|
||||||
certificate_type_t cert, key_type_t key,
|
|
||||||
identification_t *id, bool trusted)
|
|
||||||
{
|
{
|
||||||
cert_enumerator_t *enumerator;
|
cert_enumerator_t *enumerator;
|
||||||
|
|
||||||
@@ -296,10 +290,8 @@ static enumerator_t *create_enumerator(private_cert_cache_t *this,
|
|||||||
return &enumerator->public;
|
return &enumerator->public;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(cert_cache_t, flush, void,
|
||||||
* Implementation of cert_cache_t.flush.
|
private_cert_cache_t *this, certificate_type_t type)
|
||||||
*/
|
|
||||||
static void flush(private_cert_cache_t *this, certificate_type_t type)
|
|
||||||
{
|
{
|
||||||
relation_t *rel;
|
relation_t *rel;
|
||||||
int i;
|
int i;
|
||||||
@@ -339,10 +331,8 @@ static void flush(private_cert_cache_t *this, certificate_type_t type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(cert_cache_t, destroy, void,
|
||||||
* Implementation of cert_cache_t.destroy
|
private_cert_cache_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_cert_cache_t *this)
|
|
||||||
{
|
{
|
||||||
relation_t *rel;
|
relation_t *rel;
|
||||||
int i;
|
int i;
|
||||||
@@ -368,15 +358,20 @@ cert_cache_t *cert_cache_create()
|
|||||||
private_cert_cache_t *this;
|
private_cert_cache_t *this;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
this = malloc_thing(private_cert_cache_t);
|
INIT(this,
|
||||||
this->public.set.create_private_enumerator = (void*)return_null;
|
.public = {
|
||||||
this->public.set.create_cert_enumerator = (void*)create_enumerator;
|
.set = {
|
||||||
this->public.set.create_shared_enumerator = (void*)return_null;
|
.create_cert_enumerator = _create_enumerator,
|
||||||
this->public.set.create_cdp_enumerator = (void*)return_null;
|
.create_private_enumerator = (void*)return_null,
|
||||||
this->public.set.cache_cert = (void*)nop;
|
.create_shared_enumerator = (void*)return_null,
|
||||||
this->public.issued_by = (bool(*)(cert_cache_t*, certificate_t *subject, certificate_t *issuer))issued_by;
|
.create_cdp_enumerator = (void*)return_null,
|
||||||
this->public.flush = (void(*)(cert_cache_t*, certificate_type_t type))flush;
|
.cache_cert = (void*)nop,
|
||||||
this->public.destroy = (void(*)(cert_cache_t*))destroy;
|
},
|
||||||
|
.issued_by = _issued_by,
|
||||||
|
.flush = _flush,
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
for (i = 0; i < CACHE_SIZE; i++)
|
for (i = 0; i < CACHE_SIZE; i++)
|
||||||
{
|
{
|
||||||
@@ -385,5 +380,6 @@ cert_cache_t *cert_cache_create()
|
|||||||
this->relations[i].hits = 0;
|
this->relations[i].hits = 0;
|
||||||
this->relations[i].lock = rwlock_create(RWLOCK_TYPE_DEFAULT);
|
this->relations[i].lock = rwlock_create(RWLOCK_TYPE_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user