removed unused 64-bit integer parsing rule
This commit is contained in:
@@ -242,9 +242,6 @@ static void generate_u_int_type(private_generator_t *this,
|
|||||||
case U_INT_32:
|
case U_INT_32:
|
||||||
number_of_bits = 32;
|
number_of_bits = 32;
|
||||||
break;
|
break;
|
||||||
case U_INT_64:
|
|
||||||
number_of_bits = 64;
|
|
||||||
break;
|
|
||||||
case ATTRIBUTE_TYPE:
|
case ATTRIBUTE_TYPE:
|
||||||
number_of_bits = 15;
|
number_of_bits = 15;
|
||||||
break;
|
break;
|
||||||
@@ -358,20 +355,6 @@ static void generate_u_int_type(private_generator_t *this,
|
|||||||
write_bytes_to_buffer(this, &int32_val, sizeof(u_int32_t));
|
write_bytes_to_buffer(this, &int32_val, sizeof(u_int32_t));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case U_INT_64:
|
|
||||||
{
|
|
||||||
/* 64 bit integers are written as two 32 bit integers */
|
|
||||||
u_int32_t int32_val_low = htonl(*((u_int32_t*)(this->data_struct + offset)));
|
|
||||||
u_int32_t int32_val_high = htonl(*((u_int32_t*)(this->data_struct + offset) + 1));
|
|
||||||
DBG3(DBG_ENC, " => %b %b",
|
|
||||||
(void*)&int32_val_low, sizeof(int32_val_low),
|
|
||||||
(void*)&int32_val_high, sizeof(int32_val_high));
|
|
||||||
/* TODO add support for big endian machines */
|
|
||||||
write_bytes_to_buffer(this, &int32_val_high, sizeof(u_int32_t));
|
|
||||||
write_bytes_to_buffer(this, &int32_val_low, sizeof(u_int32_t));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case IKE_SPI:
|
case IKE_SPI:
|
||||||
{
|
{
|
||||||
/* 64 bit are written as they come :-) */
|
/* 64 bit are written as they come :-) */
|
||||||
@@ -548,7 +531,6 @@ static void generate_payload (private_generator_t *this,payload_t *payload)
|
|||||||
case U_INT_8:
|
case U_INT_8:
|
||||||
case U_INT_16:
|
case U_INT_16:
|
||||||
case U_INT_32:
|
case U_INT_32:
|
||||||
case U_INT_64:
|
|
||||||
case IKE_SPI:
|
case IKE_SPI:
|
||||||
case TS_TYPE:
|
case TS_TYPE:
|
||||||
case ATTRIBUTE_TYPE:
|
case ATTRIBUTE_TYPE:
|
||||||
|
|||||||
@@ -243,31 +243,6 @@ static bool parse_uint32(private_parser_t *this, int rule_number,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse a 64-Bit unsigned integer from the current parsing position.
|
|
||||||
*/
|
|
||||||
static bool parse_uint64(private_parser_t *this, int rule_number,
|
|
||||||
u_int64_t *output_pos)
|
|
||||||
{
|
|
||||||
if (this->byte_pos + sizeof(u_int64_t) > this->input_roof)
|
|
||||||
{
|
|
||||||
return short_input(this, rule_number);
|
|
||||||
}
|
|
||||||
if (this->bit_pos)
|
|
||||||
{
|
|
||||||
return bad_bitpos(this, rule_number);
|
|
||||||
}
|
|
||||||
if (output_pos)
|
|
||||||
{
|
|
||||||
/* assuming little endian host order */
|
|
||||||
*(output_pos + 1) = ntohl(*((u_int32_t*)this->byte_pos));
|
|
||||||
*output_pos = ntohl(*(((u_int32_t*)this->byte_pos) + 1));
|
|
||||||
DBG3(DBG_ENC, " => %b", output_pos, sizeof(u_int64_t));
|
|
||||||
}
|
|
||||||
this->byte_pos += sizeof(u_int64_t);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a given amount of bytes and writes them to a specific location
|
* Parse a given amount of bytes and writes them to a specific location
|
||||||
*/
|
*/
|
||||||
@@ -459,15 +434,6 @@ static status_t parse_payload(private_parser_t *this,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case U_INT_64:
|
|
||||||
{
|
|
||||||
if (!parse_uint64(this, rule_number, output + rule->offset))
|
|
||||||
{
|
|
||||||
pld->destroy(pld);
|
|
||||||
return PARSE_ERROR;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case IKE_SPI:
|
case IKE_SPI:
|
||||||
{
|
{
|
||||||
if (!parse_bytes(this, rule_number, output + rule->offset, 8))
|
if (!parse_bytes(this, rule_number, output + rule->offset, 8))
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ ENUM(encoding_type_names, U_INT_4, ENCRYPTED_DATA,
|
|||||||
"U_INT_8",
|
"U_INT_8",
|
||||||
"U_INT_16",
|
"U_INT_16",
|
||||||
"U_INT_32",
|
"U_INT_32",
|
||||||
"U_INT_64",
|
|
||||||
"RESERVED_BIT",
|
"RESERVED_BIT",
|
||||||
"RESERVED_BYTE",
|
"RESERVED_BYTE",
|
||||||
"FLAG",
|
"FLAG",
|
||||||
|
|||||||
@@ -96,19 +96,6 @@ enum encoding_type_t {
|
|||||||
*/
|
*/
|
||||||
U_INT_32,
|
U_INT_32,
|
||||||
|
|
||||||
/**
|
|
||||||
* Representing a 64 Bit unsigned int value.
|
|
||||||
*
|
|
||||||
* When generating it must be changed from host to network order.
|
|
||||||
* The value is read from the associated data struct.
|
|
||||||
* The current write position is moved 64 bit forward afterwards.
|
|
||||||
*
|
|
||||||
* When parsing it must be changed from network to host order.
|
|
||||||
* The value is written to the associated data struct.
|
|
||||||
* The current read pointer is moved 64 bit forward afterwards.
|
|
||||||
*/
|
|
||||||
U_INT_64,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* represents a RESERVED_BIT used in FLAG-Bytes.
|
* represents a RESERVED_BIT used in FLAG-Bytes.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user