From 79a2afedd5fd939483ebfd45a42c661743b96872 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Mon, 18 May 2009 13:36:56 +0200 Subject: removed unused 64-bit integer parsing rule --- src/charon/encoding/generator.c | 18 ----------------- src/charon/encoding/parser.c | 34 -------------------------------- src/charon/encoding/payloads/encodings.c | 1 - src/charon/encoding/payloads/encodings.h | 13 ------------ 4 files changed, 66 deletions(-) (limited to 'src/charon/encoding') diff --git a/src/charon/encoding/generator.c b/src/charon/encoding/generator.c index 48317069d..a969ad049 100644 --- a/src/charon/encoding/generator.c +++ b/src/charon/encoding/generator.c @@ -242,9 +242,6 @@ static void generate_u_int_type(private_generator_t *this, case U_INT_32: number_of_bits = 32; break; - case U_INT_64: - number_of_bits = 64; - break; case ATTRIBUTE_TYPE: number_of_bits = 15; 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)); 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: { /* 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_16: case U_INT_32: - case U_INT_64: case IKE_SPI: case TS_TYPE: case ATTRIBUTE_TYPE: diff --git a/src/charon/encoding/parser.c b/src/charon/encoding/parser.c index d73ca279f..bef8219bf 100644 --- a/src/charon/encoding/parser.c +++ b/src/charon/encoding/parser.c @@ -243,31 +243,6 @@ static bool parse_uint32(private_parser_t *this, int rule_number, 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 */ @@ -459,15 +434,6 @@ static status_t parse_payload(private_parser_t *this, } break; } - case U_INT_64: - { - if (!parse_uint64(this, rule_number, output + rule->offset)) - { - pld->destroy(pld); - return PARSE_ERROR; - } - break; - } case IKE_SPI: { if (!parse_bytes(this, rule_number, output + rule->offset, 8)) diff --git a/src/charon/encoding/payloads/encodings.c b/src/charon/encoding/payloads/encodings.c index 35faf42cc..85caeda82 100644 --- a/src/charon/encoding/payloads/encodings.c +++ b/src/charon/encoding/payloads/encodings.c @@ -22,7 +22,6 @@ ENUM(encoding_type_names, U_INT_4, ENCRYPTED_DATA, "U_INT_8", "U_INT_16", "U_INT_32", - "U_INT_64", "RESERVED_BIT", "RESERVED_BYTE", "FLAG", diff --git a/src/charon/encoding/payloads/encodings.h b/src/charon/encoding/payloads/encodings.h index 4df942d77..03554f0af 100644 --- a/src/charon/encoding/payloads/encodings.h +++ b/src/charon/encoding/payloads/encodings.h @@ -96,19 +96,6 @@ enum encoding_type_t { */ 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. * -- cgit v1.2.3