Migrated x509_ocsp_request to INIT/METHOD macros

This commit is contained in:
Andreas Steffen
2011-09-28 20:58:15 +02:00
parent 6f07a5b46f
commit fbe52bb008
@@ -304,18 +304,14 @@ static chunk_t build_OCSPRequest(private_x509_ocsp_request_t *this)
} }
/** METHOD(certificate_t, get_type, certificate_type_t,
* Implementation of certificate_t.get_type private_x509_ocsp_request_t *this)
*/
static certificate_type_t get_type(private_x509_ocsp_request_t *this)
{ {
return CERT_X509_OCSP_REQUEST; return CERT_X509_OCSP_REQUEST;
} }
/** METHOD(certificate_t, get_subject, identification_t*,
* Implementation of certificate_t.get_subject private_x509_ocsp_request_t *this)
*/
static identification_t* get_subject(private_x509_ocsp_request_t *this)
{ {
certificate_t *ca = (certificate_t*)this->ca; certificate_t *ca = (certificate_t*)this->ca;
@@ -330,21 +326,16 @@ static identification_t* get_subject(private_x509_ocsp_request_t *this)
return ca->get_subject(ca); return ca->get_subject(ca);
} }
/** METHOD(certificate_t, get_issuer, identification_t*,
* Implementation of certificate_t.get_issuer private_x509_ocsp_request_t *this)
*/
static identification_t* get_issuer(private_x509_ocsp_request_t *this)
{ {
certificate_t *ca = (certificate_t*)this->ca; certificate_t *ca = (certificate_t*)this->ca;
return ca->get_subject(ca); return ca->get_subject(ca);
} }
/** METHOD(certificate_t, has_subject, id_match_t,
* Implementation of certificate_t.has_subject. private_x509_ocsp_request_t *this, identification_t *subject)
*/
static id_match_t has_subject(private_x509_ocsp_request_t *this,
identification_t *subject)
{ {
certificate_t *current; certificate_t *current;
enumerator_t *enumerator; enumerator_t *enumerator;
@@ -363,10 +354,8 @@ static id_match_t has_subject(private_x509_ocsp_request_t *this,
return best; return best;
} }
/** METHOD(certificate_t, has_issuer, id_match_t,
* Implementation of certificate_t.has_subject. private_x509_ocsp_request_t *this,
*/
static id_match_t has_issuer(private_x509_ocsp_request_t *this,
identification_t *issuer) identification_t *issuer)
{ {
certificate_t *ca = (certificate_t*)this->ca; certificate_t *ca = (certificate_t*)this->ca;
@@ -374,28 +363,22 @@ static id_match_t has_issuer(private_x509_ocsp_request_t *this,
return ca->has_subject(ca, issuer); return ca->has_subject(ca, issuer);
} }
/** METHOD(certificate_t, issued_by, bool,
* Implementation of certificate_t.issued_by private_x509_ocsp_request_t *this, certificate_t *issuer)
*/
static bool issued_by(private_x509_ocsp_request_t *this, certificate_t *issuer)
{ {
DBG1(DBG_LIB, "OCSP request validation not implemented!"); DBG1(DBG_LIB, "OCSP request validation not implemented!");
return FALSE; return FALSE;
} }
/** METHOD(certificate_t, get_public_key, public_key_t*,
* Implementation of certificate_t.get_public_key private_x509_ocsp_request_t *this)
*/
static public_key_t* get_public_key(private_x509_ocsp_request_t *this)
{ {
return NULL; return NULL;
} }
/** METHOD(certificate_t, get_validity, bool,
* Implementation of x509_cert_t.get_validity. private_x509_ocsp_request_t *this, time_t *when, time_t *not_before,
*/ time_t *not_after)
static bool get_validity(private_x509_ocsp_request_t *this, time_t *when,
time_t *not_before, time_t *not_after)
{ {
certificate_t *cert; certificate_t *cert;
@@ -410,11 +393,9 @@ static bool get_validity(private_x509_ocsp_request_t *this, time_t *when,
return cert->get_validity(cert, when, not_before, not_after); return cert->get_validity(cert, when, not_before, not_after);
} }
/** METHOD(certificate_t, get_encoding, bool,
* Implementation of certificate_t.get_encoding. private_x509_ocsp_request_t *this, cred_encoding_type_t type,
*/ chunk_t *encoding)
static bool get_encoding(private_x509_ocsp_request_t *this,
cred_encoding_type_t type, chunk_t *encoding)
{ {
if (type == CERT_ASN1_DER) if (type == CERT_ASN1_DER)
{ {
@@ -425,10 +406,8 @@ static bool get_encoding(private_x509_ocsp_request_t *this,
CRED_PART_X509_OCSP_REQ_ASN1_DER, this->encoding, CRED_PART_END); CRED_PART_X509_OCSP_REQ_ASN1_DER, this->encoding, CRED_PART_END);
} }
/** METHOD(certificate_t, equals, bool,
* Implementation of certificate_t.equals. private_x509_ocsp_request_t *this, certificate_t *other)
*/
static bool equals(private_x509_ocsp_request_t *this, certificate_t *other)
{ {
chunk_t encoding; chunk_t encoding;
bool equal; bool equal;
@@ -454,19 +433,15 @@ static bool equals(private_x509_ocsp_request_t *this, certificate_t *other)
return equal; return equal;
} }
/** METHOD(certificate_t, get_ref, certificate_t*,
* Implementation of certificate_t.asdf private_x509_ocsp_request_t *this)
*/
static private_x509_ocsp_request_t* get_ref(private_x509_ocsp_request_t *this)
{ {
ref_get(&this->ref); ref_get(&this->ref);
return this; return &this->public.interface.interface;
} }
/** METHOD(certificate_t, destroy, void,
* Implementation of x509_ocsp_request_t.destroy private_x509_ocsp_request_t *this)
*/
static void destroy(private_x509_ocsp_request_t *this)
{ {
if (ref_put(&this->ref)) if (ref_put(&this->ref))
{ {
@@ -486,29 +461,30 @@ static void destroy(private_x509_ocsp_request_t *this)
*/ */
static private_x509_ocsp_request_t *create_empty() static private_x509_ocsp_request_t *create_empty()
{ {
private_x509_ocsp_request_t *this = malloc_thing(private_x509_ocsp_request_t); private_x509_ocsp_request_t *this;
this->public.interface.interface.get_type = (certificate_type_t (*)(certificate_t *this))get_type; INIT(this,
this->public.interface.interface.get_subject = (identification_t* (*)(certificate_t *this))get_subject; .public = {
this->public.interface.interface.get_issuer = (identification_t* (*)(certificate_t *this))get_issuer; .interface = {
this->public.interface.interface.has_subject = (id_match_t(*)(certificate_t*, identification_t *subject))has_subject; .interface = {
this->public.interface.interface.has_issuer = (id_match_t(*)(certificate_t*, identification_t *issuer))has_issuer; .get_type = _get_type,
this->public.interface.interface.issued_by = (bool (*)(certificate_t *this, certificate_t *issuer))issued_by; .get_subject = _get_subject,
this->public.interface.interface.get_public_key = (public_key_t* (*)(certificate_t *this))get_public_key; .get_issuer = _get_issuer,
this->public.interface.interface.get_validity = (bool(*)(certificate_t*, time_t *when, time_t *, time_t*))get_validity; .has_subject = _has_subject,
this->public.interface.interface.get_encoding = (bool(*)(certificate_t*,cred_encoding_type_t,chunk_t*))get_encoding; .has_issuer = _has_issuer,
this->public.interface.interface.equals = (bool(*)(certificate_t*, certificate_t *other))equals; .issued_by = _issued_by,
this->public.interface.interface.get_ref = (certificate_t* (*)(certificate_t *this))get_ref; .get_public_key = _get_public_key,
this->public.interface.interface.destroy = (void (*)(certificate_t *this))destroy; .get_validity = _get_validity,
.get_encoding = _get_encoding,
this->ca = NULL; .equals = _equals,
this->requestor = NULL; .get_ref = _get_ref,
this->cert = NULL; .destroy = _destroy,
this->key = NULL; },
this->nonce = chunk_empty; },
this->encoding = chunk_empty; },
this->candidates = linked_list_create(); .candidates = linked_list_create(),
this->ref = 1; .ref = 1,
);
return this; return this;
} }