removed private parser function pointers, allows compiler to inline

This commit is contained in:
Martin Willi 2008-11-26 10:54:08 +00:00
parent 98bcdfe2c9
commit 09f407a14f
1 changed files with 48 additions and 200 deletions

View File

@ -61,147 +61,6 @@ struct private_parser_t {
*/
parser_t public;
/**
* Parse a 4-Bit unsigned integer from the current parsing position.
*
* @param this parser_t object
* @param rule_number number of current rule
* @param[out] output_pos pointer where to write the parsed result
* @return
* - SUCCESS or
* - PARSE_ERROR when not successful
*/
status_t (*parse_uint4) (private_parser_t *this, int rule_number, u_int8_t *output_pos);
/**
* Parse a 8-Bit unsigned integer from the current parsing position.
*
* @param this parser_t object
* @param rule_number number of current rule
* @param[out] output_pos pointer where to write the parsed result
* @return
* - SUCCESS or
* - PARSE_ERROR when not successful
*/
status_t (*parse_uint8) (private_parser_t *this, int rule_number, u_int8_t *output_pos);
/**
* Parse a 15-Bit unsigned integer from the current parsing position.
*
* This is a special case used for ATTRIBUTE_TYPE.
* Big-/Little-endian conversion is done here.
*
* @param this parser_t object
* @param rule_number number of current rule
* @param[out] output_pos pointer where to write the parsed result
* @return
* - SUCCESS or
* - PARSE_ERROR when not successful
*/
status_t (*parse_uint15) (private_parser_t *this, int rule_number, u_int16_t *output_pos);
/**
* Parse a 16-Bit unsigned integer from the current parsing position.
*
* Big-/Little-endian conversion is done here.
*
* @param this parser_t object
* @param rule_number number of current rule
* @param[out] output_pos pointer where to write the parsed result
* @return
* - SUCCESS or
* - PARSE_ERROR when not successful
*/
status_t (*parse_uint16) (private_parser_t *this, int rule_number, u_int16_t *output_pos);
/**
* Parse a 32-Bit unsigned integer from the current parsing position.
*
* Big-/Little-endian conversion is done here.
*
* @param this parser_t object
* @param rule_number number of current rule
* @param[out] output_pos pointer where to write the parsed result
* @return
* - SUCCESS or
* - PARSE_ERROR when not successful
*/
status_t (*parse_uint32) (private_parser_t *this, int rule_number, u_int32_t *output_pos);
/**
* Parse a 64-Bit unsigned integer from the current parsing position.
*
* @todo add support for big-endian machines.
*
* @param this parser_t object
* @param rule_number number of current rule
* @param[out] output_pos pointer where to write the parsed result
* @return
* - SUCCESS or
* - PARSE_ERROR when not successful
*/
status_t (*parse_uint64) (private_parser_t *this, int rule_number, u_int64_t *output_pos);
/**
* Parse a given amount of bytes and writes them to a specific location
*
* @param this parser_t object
* @param rule_number number of current rule
* @param[out] output_pos pointer where to write the parsed result
* @param bytes number of bytes to parse
* @return
* - SUCCESS or
* - PARSE_ERROR when not successful
*/
status_t (*parse_bytes) (private_parser_t *this, int rule_number, u_int8_t *output_pos,size_t bytes);
/**
* Parse a single Bit from the current parsing position
*
* @param this parser_t object
* @param rule_number number of current rule
* @param[out] output_pos pointer where to write the parsed result
* @return
* - SUCCESS or
* - PARSE_ERROR when not successful
*/
status_t (*parse_bit) (private_parser_t *this, int rule_number, bool *output_pos);
/**
* Parse substructures in a list
*
* This function calls the parser recursively to parse contained substructures
* in a linked_list_t. The list must already be created. Payload defines
* the type of the substructures. parsing is continued until the specified length
* is completely parsed.
*
* @param this parser_t object
* @param rule_number number of current rule
* @param[out] output_pos pointer of a linked_list where substructures are added
* @param payload_type type of the contained substructures to parse
* @param length number of bytes to parse in this list
* @return
* - SUCCESS or
* - PARSE_ERROR when not successful
*/
status_t (*parse_list) (private_parser_t *this, int rule_number, linked_list_t **output_pos, payload_type_t payload_ype, size_t length);
/**
* Parse data from current parsing position in a chunk.
*
* This function clones length number of bytes to output_pos, without
* modifiyng them. Space will be allocated and must be freed by caller.
*
* @param this parser_t object
* @param rule_number number of current rule
* @param[out] output_pos pointer of a chunk which will point to the allocated data
* @param length number of bytes to clone
* @return
* - SUCCESS or
* - PARSE_ERROR when not successful
*/
status_t (*parse_chunk) (private_parser_t *this, int rule_number, chunk_t *output_pos, size_t length);
/**
* Current bit for reading in input data.
*/
@ -229,7 +88,7 @@ struct private_parser_t {
};
/**
* Implementation of private_parser_t.parse_uint4.
* Parse a 4-Bit unsigned integer from the current parsing position.
*/
static status_t parse_uint4(private_parser_t *this, int rule_number, u_int8_t *output_pos)
{
@ -274,7 +133,7 @@ static status_t parse_uint4(private_parser_t *this, int rule_number, u_int8_t *o
}
/**
* Implementation of private_parser_t.parse_uint8.
* Parse a 8-Bit unsigned integer from the current parsing position.
*/
static status_t parse_uint8(private_parser_t *this, int rule_number, u_int8_t *output_pos)
{
@ -304,7 +163,7 @@ static status_t parse_uint8(private_parser_t *this, int rule_number, u_int8_t *o
}
/**
* Implementation of private_parser_t.parse_uint15.
* Parse a 15-Bit unsigned integer from the current parsing position.
*/
static status_t parse_uint15(private_parser_t *this, int rule_number, u_int16_t *output_pos)
{
@ -333,7 +192,7 @@ static status_t parse_uint15(private_parser_t *this, int rule_number, u_int16_t
}
/**
* Implementation of private_parser_t.parse_uint16.
* Parse a 16-Bit unsigned integer from the current parsing position.
*/
static status_t parse_uint16(private_parser_t *this, int rule_number, u_int16_t *output_pos)
{
@ -361,7 +220,7 @@ static status_t parse_uint16(private_parser_t *this, int rule_number, u_int16_t
return SUCCESS;
}
/**
* Implementation of private_parser_t.parse_uint32.
* Parse a 32-Bit unsigned integer from the current parsing position.
*/
static status_t parse_uint32(private_parser_t *this, int rule_number, u_int32_t *output_pos)
{
@ -390,7 +249,7 @@ static status_t parse_uint32(private_parser_t *this, int rule_number, u_int32_t
}
/**
* Implementation of private_parser_t.parse_uint64.
* Parse a 64-Bit unsigned integer from the current parsing position.
*/
static status_t parse_uint64(private_parser_t *this, int rule_number, u_int64_t *output_pos)
{
@ -421,7 +280,7 @@ static status_t parse_uint64(private_parser_t *this, int rule_number, u_int64_t
}
/**
* Implementation of private_parser_t.parse_bytes.
* Parse a given amount of bytes and writes them to a specific location
*/
static status_t parse_bytes (private_parser_t *this, int rule_number, u_int8_t *output_pos,size_t bytes)
{
@ -451,7 +310,7 @@ static status_t parse_bytes (private_parser_t *this, int rule_number, u_int8_t *
}
/**
* Implementation of private_parser_t.parse_bit.
* Parse a single Bit from the current parsing position
*/
static status_t parse_bit(private_parser_t *this, int rule_number, bool *output_pos)
{
@ -486,7 +345,7 @@ static status_t parse_bit(private_parser_t *this, int rule_number, bool *output_
}
/**
* Implementation of private_parser_t.parse_list.
* Parse substructures in a list.
*/
static status_t parse_list(private_parser_t *this, int rule_number, linked_list_t **output_pos, payload_type_t payload_type, size_t length)
{
@ -528,7 +387,7 @@ static status_t parse_list(private_parser_t *this, int rule_number, linked_list_
}
/**
* Implementation of private_parser_t.parse_chunk.
* Parse data from current parsing position in a chunk.
*/
static status_t parse_chunk(private_parser_t *this, int rule_number, chunk_t *output_pos, size_t length)
{
@ -598,7 +457,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
{
case U_INT_4:
{
if (this->parse_uint4(this, rule_number, output + rule->offset) != SUCCESS)
if (parse_uint4(this, rule_number, output + rule->offset) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -607,7 +466,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case U_INT_8:
{
if (this->parse_uint8(this, rule_number, output + rule->offset) != SUCCESS)
if (parse_uint8(this, rule_number, output + rule->offset) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -616,7 +475,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case U_INT_16:
{
if (this->parse_uint16(this, rule_number, output + rule->offset) != SUCCESS)
if (parse_uint16(this, rule_number, output + rule->offset) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -625,7 +484,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case U_INT_32:
{
if (this->parse_uint32(this, rule_number, output + rule->offset) != SUCCESS)
if (parse_uint32(this, rule_number, output + rule->offset) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -634,7 +493,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case U_INT_64:
{
if (this->parse_uint64(this, rule_number, output + rule->offset) != SUCCESS)
if (parse_uint64(this, rule_number, output + rule->offset) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -643,7 +502,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case IKE_SPI:
{
if (this->parse_bytes(this, rule_number, output + rule->offset,8) != SUCCESS)
if (parse_bytes(this, rule_number, output + rule->offset,8) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -652,7 +511,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case RESERVED_BIT:
{
if (this->parse_bit(this, rule_number, NULL) != SUCCESS)
if (parse_bit(this, rule_number, NULL) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -661,7 +520,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case RESERVED_BYTE:
{
if (this->parse_uint8(this, rule_number, NULL) != SUCCESS)
if (parse_uint8(this, rule_number, NULL) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -670,7 +529,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case FLAG:
{
if (this->parse_bit(this, rule_number, output + rule->offset) != SUCCESS)
if (parse_bit(this, rule_number, output + rule->offset) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -679,7 +538,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case PAYLOAD_LENGTH:
{
if (this->parse_uint16(this, rule_number, output + rule->offset) != SUCCESS)
if (parse_uint16(this, rule_number, output + rule->offset) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -694,7 +553,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case HEADER_LENGTH:
{
if (this->parse_uint32(this, rule_number, output + rule->offset) != SUCCESS)
if (parse_uint32(this, rule_number, output + rule->offset) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -703,7 +562,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case SPI_SIZE:
{
if (this->parse_uint8(this, rule_number, output + rule->offset) != SUCCESS)
if (parse_uint8(this, rule_number, output + rule->offset) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -713,7 +572,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case SPI:
{
if (this->parse_chunk(this, rule_number, output + rule->offset, spi_size) != SUCCESS)
if (parse_chunk(this, rule_number, output + rule->offset, spi_size) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -723,7 +582,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case PROPOSALS:
{
if (payload_length < SA_PAYLOAD_HEADER_LENGTH ||
this->parse_list(this, rule_number, output + rule->offset, PROPOSAL_SUBSTRUCTURE,
parse_list(this, rule_number, output + rule->offset, PROPOSAL_SUBSTRUCTURE,
payload_length - SA_PAYLOAD_HEADER_LENGTH) != SUCCESS)
{
pld->destroy(pld);
@ -734,7 +593,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case TRANSFORMS:
{
if (payload_length < spi_size + PROPOSAL_SUBSTRUCTURE_HEADER_LENGTH ||
this->parse_list(this, rule_number, output + rule->offset, TRANSFORM_SUBSTRUCTURE,
parse_list(this, rule_number, output + rule->offset, TRANSFORM_SUBSTRUCTURE,
payload_length - spi_size - PROPOSAL_SUBSTRUCTURE_HEADER_LENGTH) != SUCCESS)
{
pld->destroy(pld);
@ -745,7 +604,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case TRANSFORM_ATTRIBUTES:
{
if (payload_length < TRANSFORM_SUBSTRUCTURE_HEADER_LENGTH ||
this->parse_list(this, rule_number, output + rule->offset, TRANSFORM_ATTRIBUTE,
parse_list(this, rule_number, output + rule->offset, TRANSFORM_ATTRIBUTE,
payload_length - TRANSFORM_SUBSTRUCTURE_HEADER_LENGTH) != SUCCESS)
{
pld->destroy(pld);
@ -756,7 +615,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case CONFIGURATION_ATTRIBUTES:
{
if (payload_length < CP_PAYLOAD_HEADER_LENGTH ||
this->parse_list(this, rule_number, output + rule->offset, CONFIGURATION_ATTRIBUTE,
parse_list(this, rule_number, output + rule->offset, CONFIGURATION_ATTRIBUTE,
payload_length - CP_PAYLOAD_HEADER_LENGTH) != SUCCESS)
{
pld->destroy(pld);
@ -766,7 +625,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case ATTRIBUTE_FORMAT:
{
if (this->parse_bit(this, rule_number, output + rule->offset) != SUCCESS)
if (parse_bit(this, rule_number, output + rule->offset) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -776,7 +635,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case ATTRIBUTE_TYPE:
{
if (this->parse_uint15(this, rule_number, output + rule->offset) != SUCCESS)
if (parse_uint15(this, rule_number, output + rule->offset) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -786,7 +645,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case CONFIGURATION_ATTRIBUTE_LENGTH:
{
if (this->parse_uint16(this, rule_number, output + rule->offset) != SUCCESS)
if (parse_uint16(this, rule_number, output + rule->offset) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -796,7 +655,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case ATTRIBUTE_LENGTH_OR_VALUE:
{
if (this->parse_uint16(this, rule_number, output + rule->offset) != SUCCESS)
if (parse_uint16(this, rule_number, output + rule->offset) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -808,7 +667,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
{
if (attribute_format == FALSE)
{
if (this->parse_chunk(this, rule_number, output + rule->offset, attribute_length) != SUCCESS)
if (parse_chunk(this, rule_number, output + rule->offset, attribute_length) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -819,7 +678,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case NONCE_DATA:
{
if (payload_length < NONCE_PAYLOAD_HEADER_LENGTH ||
this->parse_chunk(this, rule_number, output + rule->offset,
parse_chunk(this, rule_number, output + rule->offset,
payload_length - NONCE_PAYLOAD_HEADER_LENGTH) != SUCCESS)
{
pld->destroy(pld);
@ -830,7 +689,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case ID_DATA:
{
if (payload_length < ID_PAYLOAD_HEADER_LENGTH ||
this->parse_chunk(this, rule_number, output + rule->offset,
parse_chunk(this, rule_number, output + rule->offset,
payload_length - ID_PAYLOAD_HEADER_LENGTH) != SUCCESS)
{
pld->destroy(pld);
@ -841,7 +700,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case AUTH_DATA:
{
if (payload_length < AUTH_PAYLOAD_HEADER_LENGTH ||
this->parse_chunk(this, rule_number, output + rule->offset,
parse_chunk(this, rule_number, output + rule->offset,
payload_length - AUTH_PAYLOAD_HEADER_LENGTH) != SUCCESS)
{
pld->destroy(pld);
@ -852,7 +711,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case CERT_DATA:
{
if (payload_length < CERT_PAYLOAD_HEADER_LENGTH ||
this->parse_chunk(this, rule_number, output + rule->offset,
parse_chunk(this, rule_number, output + rule->offset,
payload_length - CERT_PAYLOAD_HEADER_LENGTH) != SUCCESS)
{
pld->destroy(pld);
@ -863,7 +722,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case CERTREQ_DATA:
{
if (payload_length < CERTREQ_PAYLOAD_HEADER_LENGTH ||
this->parse_chunk(this, rule_number, output + rule->offset,
parse_chunk(this, rule_number, output + rule->offset,
payload_length - CERTREQ_PAYLOAD_HEADER_LENGTH) != SUCCESS)
{
pld->destroy(pld);
@ -874,7 +733,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case EAP_DATA:
{
if (payload_length < EAP_PAYLOAD_HEADER_LENGTH ||
this->parse_chunk(this, rule_number, output + rule->offset,
parse_chunk(this, rule_number, output + rule->offset,
payload_length - EAP_PAYLOAD_HEADER_LENGTH) != SUCCESS)
{
pld->destroy(pld);
@ -885,7 +744,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case SPIS:
{
if (payload_length < DELETE_PAYLOAD_HEADER_LENGTH ||
this->parse_chunk(this, rule_number, output + rule->offset,
parse_chunk(this, rule_number, output + rule->offset,
payload_length - DELETE_PAYLOAD_HEADER_LENGTH) != SUCCESS)
{
pld->destroy(pld);
@ -896,7 +755,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case VID_DATA:
{
if (payload_length < VENDOR_ID_PAYLOAD_HEADER_LENGTH ||
this->parse_chunk(this, rule_number, output + rule->offset,
parse_chunk(this, rule_number, output + rule->offset,
payload_length - VENDOR_ID_PAYLOAD_HEADER_LENGTH) != SUCCESS)
{
pld->destroy(pld);
@ -907,7 +766,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case CONFIGURATION_ATTRIBUTE_VALUE:
{
size_t data_length = attribute_length;
if (this->parse_chunk(this, rule_number, output + rule->offset, data_length) != SUCCESS)
if (parse_chunk(this, rule_number, output + rule->offset, data_length) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -917,7 +776,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case KEY_EXCHANGE_DATA:
{
if (payload_length < KE_PAYLOAD_HEADER_LENGTH ||
this->parse_chunk(this, rule_number, output + rule->offset,
parse_chunk(this, rule_number, output + rule->offset,
payload_length - KE_PAYLOAD_HEADER_LENGTH) != SUCCESS)
{
pld->destroy(pld);
@ -928,7 +787,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case NOTIFICATION_DATA:
{
if (payload_length < NOTIFY_PAYLOAD_HEADER_LENGTH + spi_size ||
this->parse_chunk(this, rule_number, output + rule->offset,
parse_chunk(this, rule_number, output + rule->offset,
payload_length - NOTIFY_PAYLOAD_HEADER_LENGTH - spi_size) != SUCCESS)
{
pld->destroy(pld);
@ -939,7 +798,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case ENCRYPTED_DATA:
{
if (payload_length < ENCRYPTION_PAYLOAD_HEADER_LENGTH ||
this->parse_chunk(this, rule_number, output + rule->offset,
parse_chunk(this, rule_number, output + rule->offset,
payload_length - ENCRYPTION_PAYLOAD_HEADER_LENGTH) != SUCCESS)
{
pld->destroy(pld);
@ -949,7 +808,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case TS_TYPE:
{
if (this->parse_uint8(this, rule_number, output + rule->offset) != SUCCESS)
if (parse_uint8(this, rule_number, output + rule->offset) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -960,7 +819,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case ADDRESS:
{
size_t address_length = (ts_type == TS_IPV4_ADDR_RANGE) ? 4 : 16;
if (this->parse_chunk(this, rule_number, output + rule->offset,address_length) != SUCCESS)
if (parse_chunk(this, rule_number, output + rule->offset,address_length) != SUCCESS)
{
pld->destroy(pld);
return PARSE_ERROR;
@ -970,7 +829,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case TRAFFIC_SELECTORS:
{
if (payload_length < TS_PAYLOAD_HEADER_LENGTH ||
this->parse_list(this, rule_number, output + rule->offset, TRAFFIC_SELECTOR_SUBSTRUCTURE,
parse_list(this, rule_number, output + rule->offset, TRAFFIC_SELECTOR_SUBSTRUCTURE,
payload_length - TS_PAYLOAD_HEADER_LENGTH) != SUCCESS)
{
pld->destroy(pld);
@ -981,7 +840,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case UNKNOWN_DATA:
{
if (payload_length < UNKNOWN_PAYLOAD_HEADER_LENGTH ||
this->parse_chunk(this, rule_number, output + rule->offset,
parse_chunk(this, rule_number, output + rule->offset,
payload_length - UNKNOWN_PAYLOAD_HEADER_LENGTH) != SUCCESS)
{
pld->destroy(pld);
@ -1045,17 +904,6 @@ parser_t *parser_create(chunk_t data)
this->public.get_remaining_byte_count = (int (*) (parser_t *))get_remaining_byte_count;
this->public.destroy = (void(*)(parser_t*)) destroy;
this->parse_uint4 = parse_uint4;
this->parse_uint8 = parse_uint8;
this->parse_uint15 = parse_uint15;
this->parse_uint16 = parse_uint16;
this->parse_uint32 = parse_uint32;
this->parse_uint64 = parse_uint64;
this->parse_bytes = parse_bytes;
this->parse_bit = parse_bit;
this->parse_list = parse_list;
this->parse_chunk = parse_chunk;
this->input = data.ptr;
this->byte_pos = data.ptr;
this->bit_pos = 0;