Migrated asn1_parser_t to INIT/METHOD macros
This commit is contained in:
@@ -78,10 +78,8 @@ struct private_asn1_parser_t {
|
|||||||
chunk_t blobs[ASN1_MAX_LEVEL + 2];
|
chunk_t blobs[ASN1_MAX_LEVEL + 2];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
METHOD(asn1_parser_t, iterate, bool,
|
||||||
* Implementation of asn1_parser_t.iterate
|
private_asn1_parser_t *this, int *objectID, chunk_t *object)
|
||||||
*/
|
|
||||||
static bool iterate(private_asn1_parser_t *this, int *objectID, chunk_t *object)
|
|
||||||
{
|
{
|
||||||
chunk_t *blob, *blob1;
|
chunk_t *blob, *blob1;
|
||||||
u_char *start_ptr;
|
u_char *start_ptr;
|
||||||
@@ -234,43 +232,33 @@ end:
|
|||||||
return this->success;
|
return this->success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(asn1_parser_t, get_level, u_int,
|
||||||
* Implementation of asn1_parser_t.get_level
|
private_asn1_parser_t *this)
|
||||||
*/
|
|
||||||
static u_int get_level(private_asn1_parser_t *this)
|
|
||||||
{
|
{
|
||||||
return this->level0 + this->objects[this->line].level;
|
return this->level0 + this->objects[this->line].level;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(asn1_parser_t, set_top_level, void,
|
||||||
* Implementation of asn1_parser_t.set_top_level
|
private_asn1_parser_t *this, u_int level0)
|
||||||
*/
|
|
||||||
static void set_top_level(private_asn1_parser_t *this, u_int level0)
|
|
||||||
{
|
{
|
||||||
this->level0 = level0;
|
this->level0 = level0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(asn1_parser_t, set_flags, void,
|
||||||
* Implementation of asn1_parser_t.set_flags
|
private_asn1_parser_t *this, bool implicit, bool private)
|
||||||
*/
|
|
||||||
static void set_flags(private_asn1_parser_t *this, bool implicit, bool private)
|
|
||||||
{
|
{
|
||||||
this->implicit = implicit;
|
this->implicit = implicit;
|
||||||
this->private = private;
|
this->private = private;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(asn1_parser_t, success, bool,
|
||||||
* Implementation of asn1_parser_t.success
|
private_asn1_parser_t *this)
|
||||||
*/
|
|
||||||
static bool success(private_asn1_parser_t *this)
|
|
||||||
{
|
{
|
||||||
return this->success;
|
return this->success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(asn1_parser_t, destroy, void,
|
||||||
* Implementation of asn1_parser_t.destroy
|
private_asn1_parser_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_asn1_parser_t *this)
|
|
||||||
{
|
{
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
@@ -280,20 +268,22 @@ static void destroy(private_asn1_parser_t *this)
|
|||||||
*/
|
*/
|
||||||
asn1_parser_t* asn1_parser_create(asn1Object_t const *objects, chunk_t blob)
|
asn1_parser_t* asn1_parser_create(asn1Object_t const *objects, chunk_t blob)
|
||||||
{
|
{
|
||||||
private_asn1_parser_t *this = malloc_thing(private_asn1_parser_t);
|
private_asn1_parser_t *this;
|
||||||
|
|
||||||
memset(this, '\0', sizeof(private_asn1_parser_t));
|
INIT(this,
|
||||||
this->objects = objects;
|
.public = {
|
||||||
this->blobs[0] = blob;
|
.iterate = _iterate,
|
||||||
this->line = -1;
|
.get_level = _get_level,
|
||||||
this->success = TRUE;
|
.set_top_level = _set_top_level,
|
||||||
|
.set_flags = _set_flags,
|
||||||
this->public.iterate = (bool (*)(asn1_parser_t*, int*, chunk_t*))iterate;
|
.success = _success,
|
||||||
this->public.get_level = (u_int (*)(asn1_parser_t*))get_level;
|
.destroy = _destroy,
|
||||||
this->public.set_top_level = (void (*)(asn1_parser_t*, u_int))set_top_level;
|
},
|
||||||
this->public.set_flags = (void (*)(asn1_parser_t*, bool, bool))set_flags;
|
.objects = objects,
|
||||||
this->public.success = (bool (*)(asn1_parser_t*))success;
|
.blobs[0] = blob,
|
||||||
this->public.destroy = (void (*)(asn1_parser_t*))destroy;
|
.line = -1,
|
||||||
|
.success = TRUE,
|
||||||
|
);
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user