encoding: Remove unused TS_TYPE and ADDRESS encodings

This commit is contained in:
Tobias Brunner
2022-04-14 18:42:01 +02:00
parent f4c0ec0b71
commit c4e2b7617f
4 changed files with 0 additions and 55 deletions
-4
View File
@@ -205,7 +205,6 @@ static void generate_u_int_type(private_generator_t *this,
case U_INT_4: case U_INT_4:
number_of_bits = 4; number_of_bits = 4;
break; break;
case TS_TYPE:
case RESERVED_BYTE: case RESERVED_BYTE:
case SPI_SIZE: case SPI_SIZE:
case U_INT_8: case U_INT_8:
@@ -281,7 +280,6 @@ static void generate_u_int_type(private_generator_t *this,
} }
break; break;
} }
case TS_TYPE:
case RESERVED_BYTE: case RESERVED_BYTE:
case SPI_SIZE: case SPI_SIZE:
case U_INT_8: case U_INT_8:
@@ -478,7 +476,6 @@ METHOD(generator_t, generate_payload, void,
case IKE_SPI: case IKE_SPI:
case RESERVED_BYTE: case RESERVED_BYTE:
case SPI_SIZE: case SPI_SIZE:
case TS_TYPE:
case ATTRIBUTE_TYPE: case ATTRIBUTE_TYPE:
case ATTRIBUTE_LENGTH: case ATTRIBUTE_LENGTH:
generate_u_int_type(this, rules[i].type, rules[i].offset); generate_u_int_type(this, rules[i].type, rules[i].offset);
@@ -491,7 +488,6 @@ METHOD(generator_t, generate_payload, void,
this->header_length_offset = get_offset(this); this->header_length_offset = get_offset(this);
generate_u_int_type(this, U_INT_32, rules[i].offset); generate_u_int_type(this, U_INT_32, rules[i].offset);
break; break;
case ADDRESS:
case SPI: case SPI:
case CHUNK_DATA: case CHUNK_DATA:
case ENCRYPTED_DATA: case ENCRYPTED_DATA:
-23
View File
@@ -368,7 +368,6 @@ METHOD(parser_t, parse_payload, status_t,
payload_t *pld; payload_t *pld;
void *output; void *output;
int payload_length = 0, spi_size = 0, attribute_length = 0, header_length; int payload_length = 0, spi_size = 0, attribute_length = 0, header_length;
uint16_t ts_type = 0;
bool attribute_format = FALSE; bool attribute_format = FALSE;
int rule_number, rule_count; int rule_number, rule_count;
encoding_rule_t *rule; encoding_rule_t *rule;
@@ -588,28 +587,6 @@ METHOD(parser_t, parse_payload, status_t,
} }
break; break;
} }
case TS_TYPE:
{
if (!parse_uint8(this, rule_number, output + rule->offset))
{
pld->destroy(pld);
return PARSE_ERROR;
}
ts_type = *(uint8_t*)(output + rule->offset);
break;
}
case ADDRESS:
{
int address_length = (ts_type == TS_IPV4_ADDR_RANGE) ? 4 : 16;
if (!parse_chunk(this, rule_number, output + rule->offset,
address_length))
{
pld->destroy(pld);
return PARSE_ERROR;
}
break;
}
default: default:
{ {
DBG1(DBG_ENC, " no rule to parse rule %d %N", DBG1(DBG_ENC, " no rule to parse rule %d %N",
@@ -34,8 +34,6 @@ ENUM(encoding_type_names, U_INT_4, ENCRYPTED_DATA,
"ATTRIBUTE_LENGTH_OR_VALUE", "ATTRIBUTE_LENGTH_OR_VALUE",
"ATTRIBUTE_LENGTH", "ATTRIBUTE_LENGTH",
"ATTRIBUTE_VALUE", "ATTRIBUTE_VALUE",
"TS_TYPE",
"ADDRESS",
"CHUNK_DATA", "CHUNK_DATA",
"IKE_SPI", "IKE_SPI",
"ENCRYPTED_DATA", "ENCRYPTED_DATA",
@@ -255,32 +255,6 @@ enum encoding_type_t {
*/ */
ATTRIBUTE_VALUE, ATTRIBUTE_VALUE,
/**
* Representing a Traffic selector type field.
*
* 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 16 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 16 bit forward afterwards.
*/
TS_TYPE,
/**
* Representing an address field in a traffic selector.
*
* Depending on the last field of type TS_TYPE
* this field is either 4 or 16 byte long.
*
* When generating the content of the chunk pointing to
* is written.
*
* When parsing 4 or 16 bytes are read and written into the chunk pointing to.
*/
ADDRESS,
/** /**
* Representing a variable length byte field. * Representing a variable length byte field.
*/ */