diff options
Diffstat (limited to 'src/libcharon/encoding')
37 files changed, 23 insertions, 4100 deletions
diff --git a/src/libcharon/encoding/generator.c b/src/libcharon/encoding/generator.c index 785f1430a..ce3844361 100644 --- a/src/libcharon/encoding/generator.c +++ b/src/libcharon/encoding/generator.c @@ -41,10 +41,7 @@ #include <encoding/payloads/cp_payload.h> #include <encoding/payloads/configuration_attribute.h> #include <encoding/payloads/eap_payload.h> -<<<<<<< HEAD -======= #include <encoding/payloads/unknown_payload.h> ->>>>>>> upstream/4.5.1 /** * Generating is done in a data buffer. @@ -93,27 +90,10 @@ struct private_generator_t { */ void *data_struct; -<<<<<<< HEAD - /* - * Last payload length position offset in the buffer. - */ - u_int32_t last_payload_length_position_offset; - - /** - * Offset of the header length field in the buffer. - */ - u_int32_t header_length_position_offset; - - /** - * Last SPI size. - */ - u_int8_t last_spi_size; -======= /** * Offset of the header length field in the buffer. */ u_int32_t header_length_offset; ->>>>>>> upstream/4.5.1 /** * Attribute format of the last generated transform attribute. @@ -204,36 +184,6 @@ static void write_bytes_to_buffer(private_generator_t *this, void *bytes, } /** -<<<<<<< HEAD - * Writes a specific amount of byte into the buffer at a specific offset. - */ -static void write_bytes_to_buffer_at_offset(private_generator_t *this, - void *bytes, int number_of_bytes, u_int32_t offset) -{ - int i; - u_int8_t *read_position = (u_int8_t *)bytes; - u_int8_t *write_position; - u_int32_t free_space_after_offset = get_size(this) - offset; - - /* check first if enough space for new data is available */ - if (number_of_bytes > free_space_after_offset) - { - make_space_available(this, - (number_of_bytes - free_space_after_offset) * 8); - } - - write_position = this->buffer + offset; - for (i = 0; i < number_of_bytes; i++) - { - *write_position = *read_position; - read_position++; - write_position++; - } -} - -/** -======= ->>>>>>> upstream/4.5.1 * Generates a U_INT-Field type and writes it to buffer. */ static void generate_u_int_type(private_generator_t *this, @@ -248,19 +198,13 @@ static void generate_u_int_type(private_generator_t *this, number_of_bits = 4; break; case TS_TYPE: -<<<<<<< HEAD -======= case RESERVED_BYTE: case SPI_SIZE: ->>>>>>> upstream/4.5.1 case U_INT_8: number_of_bits = 8; break; case U_INT_16: -<<<<<<< HEAD -======= case PAYLOAD_LENGTH: ->>>>>>> upstream/4.5.1 case CONFIGURATION_ATTRIBUTE_LENGTH: number_of_bits = 16; break; @@ -324,11 +268,8 @@ static void generate_u_int_type(private_generator_t *this, break; } case TS_TYPE: -<<<<<<< HEAD -======= case RESERVED_BYTE: case SPI_SIZE: ->>>>>>> upstream/4.5.1 case U_INT_8: { /* 8 bit values are written as they are */ @@ -366,10 +307,7 @@ static void generate_u_int_type(private_generator_t *this, } case U_INT_16: -<<<<<<< HEAD -======= case PAYLOAD_LENGTH: ->>>>>>> upstream/4.5.1 case CONFIGURATION_ATTRIBUTE_LENGTH: { u_int16_t val = htons(*((u_int16_t*)(this->data_struct + offset))); @@ -403,52 +341,6 @@ static void generate_u_int_type(private_generator_t *this, } /** -<<<<<<< HEAD - * Generate a reserved bit or byte - */ -static void generate_reserved_field(private_generator_t *this, int bits) -{ - /* only one bit or 8 bit fields are supported */ - if (bits != 1 && bits != 8) - { - DBG1(DBG_ENC, "reserved field of %d bits cannot be generated", bits); - return ; - } - make_space_available(this, bits); - - if (bits == 1) - { - u_int8_t reserved_bit = ~(1 << (7 - this->current_bit)); - - *(this->out_position) = *(this->out_position) & reserved_bit; - if (this->current_bit == 0) - { - /* memory must be zero */ - *(this->out_position) = 0x00; - } - this->current_bit++; - if (this->current_bit >= 8) - { - this->current_bit = this->current_bit % 8; - this->out_position++; - } - } - else - { - if (this->current_bit > 0) - { - DBG1(DBG_ENC, "reserved field cannot be written cause " - "alignement of current bit is %d", this->current_bit); - return; - } - *(this->out_position) = 0x00; - this->out_position++; - } -} - -/** -======= ->>>>>>> upstream/4.5.1 * Generate a FLAG filed */ static void generate_flag(private_generator_t *this, u_int32_t offset) @@ -503,11 +395,7 @@ METHOD(generator_t, get_chunk, chunk_t, { chunk_t data; -<<<<<<< HEAD - *lenpos = (u_int32_t*)(this->buffer + this->header_length_position_offset); -======= *lenpos = (u_int32_t*)(this->buffer + this->header_length_offset); ->>>>>>> upstream/4.5.1 data = chunk_create(this->buffer, get_length(this)); DBG3(DBG_ENC, "generated data of this generator %B", &data); return data; @@ -523,11 +411,6 @@ METHOD(generator_t, generate_payload, void, this->data_struct = payload; payload_type = payload->get_type(payload); -<<<<<<< HEAD - /* spi size has to get reseted */ - this->last_spi_size = 0; -======= ->>>>>>> upstream/4.5.1 offset_start = this->out_position - this->buffer; @@ -547,58 +430,6 @@ METHOD(generator_t, generate_payload, void, case U_INT_8: case U_INT_16: case U_INT_32: -<<<<<<< HEAD - case IKE_SPI: - case TS_TYPE: - case ATTRIBUTE_TYPE: - case CONFIGURATION_ATTRIBUTE_LENGTH: - { - generate_u_int_type(this, rules[i].type, rules[i].offset); - break; - } - case RESERVED_BIT: - { - generate_reserved_field(this, 1); - break; - } - case RESERVED_BYTE: - { - generate_reserved_field(this, 8); - break; - } - case FLAG: - { - generate_flag(this, rules[i].offset); - break; - } - case PAYLOAD_LENGTH: - { - this->last_payload_length_position_offset = get_offset(this); - generate_u_int_type(this, U_INT_16,rules[i].offset); - break; - } - case HEADER_LENGTH: - { - this->header_length_position_offset = get_offset(this); - generate_u_int_type(this ,U_INT_32, rules[i].offset); - break; - } - case SPI_SIZE: - generate_u_int_type(this, U_INT_8, rules[i].offset); - this->last_spi_size = *((u_int8_t *)(this->data_struct + - rules[i].offset)); - break; - case ADDRESS: - { - generate_from_chunk(this, rules[i].offset); - break; - } - case SPI: - { - generate_from_chunk(this, rules[i].offset); - break; - } -======= case PAYLOAD_LENGTH: case IKE_SPI: case RESERVED_BYTE: @@ -618,7 +449,6 @@ METHOD(generator_t, generate_payload, void, break; case ADDRESS: case SPI: ->>>>>>> upstream/4.5.1 case KEY_EXCHANGE_DATA: case NOTIFICATION_DATA: case NONCE_DATA: @@ -630,198 +460,6 @@ METHOD(generator_t, generate_payload, void, case CONFIGURATION_ATTRIBUTE_VALUE: case VID_DATA: case EAP_DATA: -<<<<<<< HEAD - { - u_int32_t payload_length_position_offset; - u_int16_t length_of_payload; - u_int16_t header_length = 0; - u_int16_t length_in_network_order; - - switch(rules[i].type) - { - case KEY_EXCHANGE_DATA: - header_length = KE_PAYLOAD_HEADER_LENGTH; - break; - case NOTIFICATION_DATA: - header_length = NOTIFY_PAYLOAD_HEADER_LENGTH + - this->last_spi_size; - break; - case NONCE_DATA: - header_length = NONCE_PAYLOAD_HEADER_LENGTH; - break; - case ID_DATA: - header_length = ID_PAYLOAD_HEADER_LENGTH; - break; - case AUTH_DATA: - header_length = AUTH_PAYLOAD_HEADER_LENGTH; - break; - case CERT_DATA: - header_length = CERT_PAYLOAD_HEADER_LENGTH; - break; - case CERTREQ_DATA: - header_length = CERTREQ_PAYLOAD_HEADER_LENGTH; - break; - case SPIS: - header_length = DELETE_PAYLOAD_HEADER_LENGTH; - break; - case VID_DATA: - header_length = VENDOR_ID_PAYLOAD_HEADER_LENGTH; - break; - case CONFIGURATION_ATTRIBUTE_VALUE: - header_length = CONFIGURATION_ATTRIBUTE_HEADER_LENGTH; - break; - case EAP_DATA: - header_length = EAP_PAYLOAD_HEADER_LENGTH; - break; - default: - break; - } - generate_from_chunk(this, rules[i].offset); - - payload_length_position_offset = - this->last_payload_length_position_offset; - - length_of_payload = header_length + - ((chunk_t *)(this->data_struct + rules[i].offset))->len; - - length_in_network_order = htons(length_of_payload); - write_bytes_to_buffer_at_offset(this, &length_in_network_order, - sizeof(u_int16_t), payload_length_position_offset); - break; - } - case PROPOSALS: - { - u_int32_t payload_length_position_offset = - this->last_payload_length_position_offset; - /* Length of SA_PAYLOAD is calculated */ - u_int16_t length_of_sa_payload = SA_PAYLOAD_HEADER_LENGTH; - u_int16_t int16_val; - linked_list_t *proposals = *((linked_list_t **) - (this->data_struct + rules[i].offset)); - iterator_t *iterator; - payload_t *current_proposal; - - iterator = proposals->create_iterator(proposals,TRUE); - while (iterator->iterate(iterator, (void**)¤t_proposal)) - { - u_int32_t before_generate_position_offset; - u_int32_t after_generate_position_offset; - - before_generate_position_offset = get_offset(this); - generate_payload(this, current_proposal); - after_generate_position_offset = get_offset(this); - length_of_sa_payload += (after_generate_position_offset - - before_generate_position_offset); - } - iterator->destroy(iterator); - - int16_val = htons(length_of_sa_payload); - write_bytes_to_buffer_at_offset(this, &int16_val, - sizeof(u_int16_t),payload_length_position_offset); - break; - } - case TRANSFORMS: - { - u_int32_t payload_length_position_offset = - this->last_payload_length_position_offset; - u_int16_t length_of_proposal = - PROPOSAL_SUBSTRUCTURE_HEADER_LENGTH + this->last_spi_size; - u_int16_t int16_val; - linked_list_t *transforms = *((linked_list_t **) - (this->data_struct + rules[i].offset)); - iterator_t *iterator; - payload_t *current_transform; - - iterator = transforms->create_iterator(transforms,TRUE); - while (iterator->iterate(iterator, (void**)¤t_transform)) - { - u_int32_t before_generate_position_offset; - u_int32_t after_generate_position_offset; - - before_generate_position_offset = get_offset(this); - generate_payload(this, current_transform); - after_generate_position_offset = get_offset(this); - - length_of_proposal += (after_generate_position_offset - - before_generate_position_offset); - } - iterator->destroy(iterator); - - int16_val = htons(length_of_proposal); - write_bytes_to_buffer_at_offset(this, &int16_val, - sizeof(u_int16_t), payload_length_position_offset); - break; - } - case TRANSFORM_ATTRIBUTES: - { - u_int32_t transform_length_position_offset = - this->last_payload_length_position_offset; - u_int16_t length_of_transform = - TRANSFORM_SUBSTRUCTURE_HEADER_LENGTH; - u_int16_t int16_val; - linked_list_t *transform_attributes =*((linked_list_t **) - (this->data_struct + rules[i].offset)); - iterator_t *iterator; - payload_t *current_attribute; - - iterator = transform_attributes->create_iterator( - transform_attributes, TRUE); - while (iterator->iterate(iterator, (void**)¤t_attribute)) - { - u_int32_t before_generate_position_offset; - u_int32_t after_generate_position_offset; - - before_generate_position_offset = get_offset(this); - generate_payload(this, current_attribute); - after_generate_position_offset = get_offset(this); - - length_of_transform += (after_generate_position_offset - - before_generate_position_offset); - } - - iterator->destroy(iterator); - - int16_val = htons(length_of_transform); - write_bytes_to_buffer_at_offset(this, &int16_val, - sizeof(u_int16_t),transform_length_position_offset); - break; - } - case CONFIGURATION_ATTRIBUTES: - { - u_int32_t configurations_length_position_offset = - this->last_payload_length_position_offset; - u_int16_t length_of_configurations = CP_PAYLOAD_HEADER_LENGTH; - u_int16_t int16_val; - linked_list_t *configuration_attributes = *((linked_list_t **) - (this->data_struct + rules[i].offset)); - iterator_t *iterator; - payload_t *current_attribute; - - iterator = configuration_attributes->create_iterator( - configuration_attributes,TRUE); - while (iterator->iterate(iterator, (void**)¤t_attribute)) - { - u_int32_t before_generate_position_offset; - u_int32_t after_generate_position_offset; - - before_generate_position_offset = get_offset(this); - generate_payload(this, current_attribute); - after_generate_position_offset = get_offset(this); - - length_of_configurations += after_generate_position_offset - - before_generate_position_offset; - } - - iterator->destroy(iterator); - - int16_val = htons(length_of_configurations); - write_bytes_to_buffer_at_offset(this, &int16_val, - sizeof(u_int16_t),configurations_length_position_offset); - break; - } - case ATTRIBUTE_FORMAT: - { -======= case ENCRYPTED_DATA: case UNKNOWN_DATA: generate_from_chunk(this, rules[i].offset); @@ -847,41 +485,19 @@ METHOD(generator_t, generate_payload, void, break; } case ATTRIBUTE_FORMAT: ->>>>>>> upstream/4.5.1 generate_flag(this, rules[i].offset); /* Attribute format is a flag which is stored in context*/ this->attribute_format = *((bool *)(this->data_struct + rules[i].offset)); break; -<<<<<<< HEAD - } - - case ATTRIBUTE_LENGTH_OR_VALUE: - { - if (this->attribute_format == FALSE) - { - generate_u_int_type(this, U_INT_16, rules[i].offset); - /* this field hold the length of the attribute */ - this->attribute_length = - *((u_int16_t *)(this->data_struct + rules[i].offset)); -======= case ATTRIBUTE_LENGTH_OR_VALUE: if (this->attribute_format) { generate_u_int_type(this, U_INT_16, rules[i].offset); ->>>>>>> upstream/4.5.1 } else { generate_u_int_type(this, U_INT_16, rules[i].offset); -<<<<<<< HEAD - } - break; - } - case ATTRIBUTE_VALUE: - { - if (this->attribute_format == FALSE) -======= /* this field hold the length of the attribute */ this->attribute_length = *((u_int16_t *)(this->data_struct + rules[i].offset)); @@ -890,7 +506,6 @@ METHOD(generator_t, generate_payload, void, case ATTRIBUTE_VALUE: { if (!this->attribute_format) ->>>>>>> upstream/4.5.1 { DBG2(DBG_ENC, "attribute value has not fixed size"); /* the attribute value is generated */ @@ -898,47 +513,6 @@ METHOD(generator_t, generate_payload, void, } break; } -<<<<<<< HEAD - case TRAFFIC_SELECTORS: - { - u_int32_t payload_length_position_offset = - this->last_payload_length_position_offset; - u_int16_t length_of_ts_payload = TS_PAYLOAD_HEADER_LENGTH; - u_int16_t int16_val; - linked_list_t *traffic_selectors = *((linked_list_t **) - (this->data_struct + rules[i].offset)); - iterator_t *iterator; - payload_t *current_tss; - - iterator = traffic_selectors->create_iterator( - traffic_selectors,TRUE); - while (iterator->iterate(iterator, (void **)¤t_tss)) - { - u_int32_t before_generate_position_offset; - u_int32_t after_generate_position_offset; - - before_generate_position_offset = get_offset(this); - generate_payload(this, current_tss); - after_generate_position_offset = get_offset(this); - - length_of_ts_payload += (after_generate_position_offset - - before_generate_position_offset); - } - iterator->destroy(iterator); - - int16_val = htons(length_of_ts_payload); - write_bytes_to_buffer_at_offset(this, &int16_val, - sizeof(u_int16_t),payload_length_position_offset); - break; - } - - case ENCRYPTED_DATA: - { - generate_from_chunk(this, rules[i].offset); - break; - } -======= ->>>>>>> upstream/4.5.1 default: DBG1(DBG_ENC, "field type %N is not supported", encoding_type_names, rules[i].type); diff --git a/src/libcharon/encoding/message.c b/src/libcharon/encoding/message.c index 071424812..214612fdb 100644 --- a/src/libcharon/encoding/message.c +++ b/src/libcharon/encoding/message.c @@ -45,6 +45,16 @@ #define MAX_DELETE_PAYLOADS 20 /** + * Max number of certificate payloads per IKEv2 Message + */ +#define MAX_CERT_PAYLOADS 8 + +/** + * Max number of Vendor ID payloads per IKEv2 Message + */ +#define MAX_VID_PAYLOADS 20 + +/** * A payload rule defines the rules for a payload * in a specific message rule. It defines if and how * many times a payload must/can occur in a message @@ -104,7 +114,7 @@ static payload_rule_t ike_sa_init_i_rules[] = { {SECURITY_ASSOCIATION, 1, 1, FALSE, FALSE}, {KEY_EXCHANGE, 1, 1, FALSE, FALSE}, {NONCE, 1, 1, FALSE, FALSE}, - {VENDOR_ID, 0, 10, FALSE, FALSE}, + {VENDOR_ID, 0, MAX_VID_PAYLOADS, FALSE, FALSE}, }; /** @@ -131,11 +141,8 @@ static payload_rule_t ike_sa_init_r_rules[] = { {SECURITY_ASSOCIATION, 1, 1, FALSE, FALSE}, {KEY_EXCHANGE, 1, 1, FALSE, FALSE}, {NONCE, 1, 1, FALSE, FALSE}, -<<<<<<< HEAD -======= - {CERTIFICATE_REQUEST, 1, 1, FALSE, FALSE}, ->>>>>>> upstream/4.5.1 - {VENDOR_ID, 0, 10, FALSE, FALSE}, + {CERTIFICATE_REQUEST, 0, 1, FALSE, FALSE}, + {VENDOR_ID, 0, MAX_VID_PAYLOADS, FALSE, FALSE}, }; /** @@ -163,7 +170,7 @@ static payload_rule_t ike_auth_i_rules[] = { {EXTENSIBLE_AUTHENTICATION, 0, 1, TRUE, TRUE}, {AUTHENTICATION, 0, 1, TRUE, TRUE}, {ID_INITIATOR, 0, 1, TRUE, FALSE}, - {CERTIFICATE, 0, 4, TRUE, FALSE}, + {CERTIFICATE, 0, MAX_CERT_PAYLOADS, TRUE, FALSE}, {CERTIFICATE_REQUEST, 0, 1, TRUE, FALSE}, {ID_RESPONDER, 0, 1, TRUE, FALSE}, #ifdef ME @@ -176,7 +183,7 @@ static payload_rule_t ike_auth_i_rules[] = { {TRAFFIC_SELECTOR_RESPONDER, 0, 1, TRUE, FALSE}, #endif /* ME */ {CONFIGURATION, 0, 1, TRUE, FALSE}, - {VENDOR_ID, 0, 10, TRUE, FALSE}, + {VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, }; /** @@ -216,13 +223,13 @@ static payload_rule_t ike_auth_r_rules[] = { {NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, TRUE}, {EXTENSIBLE_AUTHENTICATION, 0, 1, TRUE, TRUE}, {AUTHENTICATION, 0, 1, TRUE, TRUE}, - {CERTIFICATE, 0, 4, TRUE, FALSE}, + {CERTIFICATE, 0, MAX_CERT_PAYLOADS, TRUE, FALSE}, {ID_RESPONDER, 0, 1, TRUE, FALSE}, {SECURITY_ASSOCIATION, 0, 1, TRUE, FALSE}, {TRAFFIC_SELECTOR_INITIATOR, 0, 1, TRUE, FALSE}, {TRAFFIC_SELECTOR_RESPONDER, 0, 1, TRUE, FALSE}, {CONFIGURATION, 0, 1, TRUE, FALSE}, - {VENDOR_ID, 0, 10, TRUE, FALSE}, + {VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, }; /** @@ -259,7 +266,7 @@ static payload_rule_t informational_i_rules[] = { {NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, {CONFIGURATION, 0, 1, TRUE, FALSE}, {DELETE, 0, MAX_DELETE_PAYLOADS, TRUE, FALSE}, - {VENDOR_ID, 0, 10, TRUE, FALSE}, + {VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, }; /** @@ -284,7 +291,7 @@ static payload_rule_t informational_r_rules[] = { {NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, {CONFIGURATION, 0, 1, TRUE, FALSE}, {DELETE, 0, MAX_DELETE_PAYLOADS, TRUE, FALSE}, - {VENDOR_ID, 0, 10, TRUE, FALSE}, + {VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, }; /** @@ -313,7 +320,7 @@ static payload_rule_t create_child_sa_i_rules[] = { {TRAFFIC_SELECTOR_INITIATOR, 0, 1, TRUE, FALSE}, {TRAFFIC_SELECTOR_RESPONDER, 0, 1, TRUE, FALSE}, {CONFIGURATION, 0, 1, TRUE, FALSE}, - {VENDOR_ID, 0, 10, TRUE, FALSE}, + {VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, }; /** @@ -346,7 +353,7 @@ static payload_rule_t create_child_sa_r_rules[] = { {TRAFFIC_SELECTOR_INITIATOR, 0, 1, TRUE, FALSE}, {TRAFFIC_SELECTOR_RESPONDER, 0, 1, TRUE, FALSE}, {CONFIGURATION, 0, 1, TRUE, FALSE}, - {VENDOR_ID, 0, 10, TRUE, FALSE}, + {VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, }; /** @@ -375,7 +382,7 @@ static payload_rule_t me_connect_i_rules[] = { /* payload type min max encr suff */ {NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, TRUE}, {ID_PEER, 1, 1, TRUE, FALSE}, - {VENDOR_ID, 0, 10, TRUE, FALSE} + {VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE} }; /** @@ -394,7 +401,7 @@ static payload_order_t me_connect_i_order[] = { static payload_rule_t me_connect_r_rules[] = { /* payload type min max encr suff */ {NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, TRUE}, - {VENDOR_ID, 0, 10, TRUE, FALSE} + {VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE} }; /** @@ -494,8 +501,6 @@ struct private_message_t { bool is_request; /** -<<<<<<< HEAD -======= * Higher version supported? */ bool version_flag; @@ -511,7 +516,6 @@ struct private_message_t { bool sort_disabled; /** ->>>>>>> upstream/4.5.1 * Message ID of this message. */ u_int32_t message_id; @@ -669,20 +673,6 @@ METHOD(message_t, get_request, bool, return this->is_request; } -<<<<<<< HEAD -/** - * Is this message in an encoded form? - */ -static bool is_encoded(private_message_t *this) -{ - chunk_t data = this->packet->get_data(this->packet); - - if (data.ptr == NULL) - { - return FALSE; - } - return TRUE; -======= METHOD(message_t, set_version_flag, void, private_message_t *this) { @@ -712,7 +702,6 @@ METHOD(message_t, is_encoded, bool, private_message_t *this) { return this->packet->get_data(this->packet).ptr != NULL; ->>>>>>> upstream/4.5.1 } METHOD(message_t, add_payload, void, @@ -786,15 +775,12 @@ METHOD(message_t, create_payload_enumerator, enumerator_t*, return this->payloads->create_enumerator(this->payloads); } -<<<<<<< HEAD -======= METHOD(message_t, remove_payload_at, void, private_message_t *this, enumerator_t *enumerator) { this->payloads->remove_at(this->payloads, enumerator); } ->>>>>>> upstream/4.5.1 METHOD(message_t, get_payload, payload_t*, private_message_t *this, payload_type_t type) { @@ -1064,15 +1050,12 @@ static encryption_payload_t* wrap_payloads(private_message_t *this) return encryption; } -<<<<<<< HEAD -======= METHOD(message_t, disable_sort, void, private_message_t *this) { this->sort_disabled = TRUE; } ->>>>>>> upstream/4.5.1 METHOD(message_t, generate, status_t, private_message_t *this, aead_t *aead, packet_t **packet) { @@ -1084,17 +1067,8 @@ METHOD(message_t, generate, status_t, chunk_t chunk; char str[256]; u_int32_t *lenpos; -<<<<<<< HEAD - - if (is_encoded(this)) - { /* already generated, return a new packet clone */ - *packet = this->packet->clone(this->packet); - return SUCCESS; - } -======= bool *reserved; int i; ->>>>>>> upstream/4.5.1 if (this->exchange_type == EXCHANGE_TYPE_UNDEFINED) { @@ -1116,14 +1090,10 @@ METHOD(message_t, generate, status_t, return NOT_SUPPORTED; } -<<<<<<< HEAD - order_payloads(this); -======= if (!this->sort_disabled) { order_payloads(this); } ->>>>>>> upstream/4.5.1 DBG1(DBG_ENC, "generating %s", get_string(this, str, sizeof(str))); @@ -1137,18 +1107,12 @@ METHOD(message_t, generate, status_t, } ike_header = ike_header_create(); -<<<<<<< HEAD - ike_header->set_exchange_type(ike_header, this->exchange_type); - ike_header->set_message_id(ike_header, this->message_id); - ike_header->set_response_flag(ike_header, !this->is_request); -======= ike_header->set_maj_version(ike_header, this->major_version); ike_header->set_min_version(ike_header, this->minor_version); ike_header->set_exchange_type(ike_header, this->exchange_type); ike_header->set_message_id(ike_header, this->message_id); ike_header->set_response_flag(ike_header, !this->is_request); ike_header->set_version_flag(ike_header, this->version_flag); ->>>>>>> upstream/4.5.1 ike_header->set_initiator_flag(ike_header, this->ike_sa_id->is_initiator(this->ike_sa_id)); ike_header->set_initiator_spi(ike_header, @@ -1156,8 +1120,6 @@ METHOD(message_t, generate, status_t, ike_header->set_responder_spi(ike_header, this->ike_sa_id->get_responder_spi(this->ike_sa_id)); -<<<<<<< HEAD -======= for (i = 0; i < countof(this->reserved); i++) { reserved = payload_get_field(&ike_header->payload_interface, @@ -1168,7 +1130,6 @@ METHOD(message_t, generate, status_t, } } ->>>>>>> upstream/4.5.1 generator = generator_create(); /* generate all payloads with proper next type */ @@ -1237,11 +1198,8 @@ METHOD(message_t, parse_header, status_t, { ike_header_t *ike_header; status_t status; -<<<<<<< HEAD -======= bool *reserved; int i; ->>>>>>> upstream/4.5.1 DBG2(DBG_ENC, "parsing header of message"); @@ -1276,9 +1234,6 @@ METHOD(message_t, parse_header, status_t, this->minor_version = ike_header->get_min_version(ike_header); this->first_payload = ike_header->payload_interface.get_next_type( &ike_header->payload_interface); -<<<<<<< HEAD - -======= for (i = 0; i < countof(this->reserved); i++) { reserved = payload_get_field(&ike_header->payload_interface, @@ -1288,7 +1243,6 @@ METHOD(message_t, parse_header, status_t, this->reserved[i] = *reserved; } } ->>>>>>> upstream/4.5.1 DBG2(DBG_ENC, "parsed a %N %s", exchange_type_names, this->exchange_type, this->is_request ? "request" : "response"); @@ -1305,8 +1259,6 @@ METHOD(message_t, parse_header, status_t, } /** -<<<<<<< HEAD -======= * Check if a payload is for a mediation extension connectivity check */ static bool is_connectivity_check(private_message_t *this, payload_t *payload) @@ -1332,7 +1284,6 @@ static bool is_connectivity_check(private_message_t *this, payload_t *payload) } /** ->>>>>>> upstream/4.5.1 * Decrypt payload from the encryption payload */ static status_t decrypt_payloads(private_message_t *this, aead_t *aead) @@ -1403,23 +1354,15 @@ static status_t decrypt_payloads(private_message_t *this, aead_t *aead) } encryption->destroy(encryption); } -<<<<<<< HEAD - if (type != UNKNOWN_PAYLOAD && !was_encrypted) -======= if (payload_is_known(type) && !was_encrypted && !is_connectivity_check(this, payload)) ->>>>>>> upstream/4.5.1 { rule = get_payload_rule(this, type); if (!rule || rule->encrypted) { DBG1(DBG_ENC, "payload type %N was not encrypted", payload_type_names, type); -<<<<<<< HEAD - status = VERIFY_ERROR; -======= status = FAILED; ->>>>>>> upstream/4.5.1 break; } } @@ -1434,10 +1377,7 @@ static status_t decrypt_payloads(private_message_t *this, aead_t *aead) */ static status_t verify(private_message_t *this) { -<<<<<<< HEAD -======= bool complete = FALSE; ->>>>>>> upstream/4.5.1 int i; DBG2(DBG_ENC, "verifying message structure"); @@ -1455,28 +1395,9 @@ static status_t verify(private_message_t *this) while (enumerator->enumerate(enumerator, &payload)) { payload_type_t type; -<<<<<<< HEAD - unknown_payload_t *unknown; - - type = payload->get_type(payload); - if (type == UNKNOWN_PAYLOAD) - { - /* unknown payloads are ignored if they are not critical */ - unknown = (unknown_payload_t*)payload; - if (unknown->is_critical(unknown)) - { - DBG1(DBG_ENC, "%N is not supported, but its critical!", - payload_type_names, type); - enumerator->destroy(enumerator); - return NOT_SUPPORTED; - } - } - else if (type == rule->type) -======= type = payload->get_type(payload); if (type == rule->type) ->>>>>>> upstream/4.5.1 { found++; DBG2(DBG_ENC, "found payload of type %N", @@ -1493,25 +1414,15 @@ static status_t verify(private_message_t *this) } enumerator->destroy(enumerator); -<<<<<<< HEAD - if (found < rule->min_occurence) -======= if (!complete && found < rule->min_occurence) ->>>>>>> upstream/4.5.1 { DBG1(DBG_ENC, "payload of type %N not occured %d times (%d)", payload_type_names, rule->type, rule->min_occurence, found); return VERIFY_ERROR; } -<<<<<<< HEAD - if (rule->sufficient) - { - return SUCCESS; -======= if (found && rule->sufficient) { complete = TRUE; ->>>>>>> upstream/4.5.1 } } return SUCCESS; @@ -1540,11 +1451,7 @@ METHOD(message_t, parse_body, status_t, { DBG1(DBG_ENC, "payload type %N could not be parsed", payload_type_names, type); -<<<<<<< HEAD - return PARSE_ERROR; -======= return this->exchange_type == IKE_SA_INIT ? PARSE_ERROR : FAILED; ->>>>>>> upstream/4.5.1 } DBG2(DBG_ENC, "verifying payload of type %N", payload_type_names, type); @@ -1554,11 +1461,7 @@ METHOD(message_t, parse_body, status_t, DBG1(DBG_ENC, "%N payload verification failed", payload_type_names, type); payload->destroy(payload); -<<<<<<< HEAD - return VERIFY_ERROR; -======= return this->exchange_type == IKE_SA_INIT ? VERIFY_ERROR : FAILED; ->>>>>>> upstream/4.5.1 } DBG2(DBG_ENC, "%N payload verified. Adding to payload list", @@ -1576,22 +1479,11 @@ METHOD(message_t, parse_body, status_t, type = payload->get_next_type(payload); } -<<<<<<< HEAD - if (type == ENCRYPTED) - { - status = decrypt_payloads(this, aead); - if (status != SUCCESS) - { - DBG1(DBG_ENC, "could not decrypt payloads"); - return status; - } -======= status = decrypt_payloads(this, aead); if (status != SUCCESS) { DBG1(DBG_ENC, "could not decrypt payloads"); return status; ->>>>>>> upstream/4.5.1 } status = verify(this); @@ -1639,11 +1531,6 @@ message_t *message_create_from_packet(packet_t *packet) .get_first_payload_type = _get_first_payload_type, .set_request = _set_request, .get_request = _get_request, -<<<<<<< HEAD - .add_payload = _add_payload, - .add_notify = _add_notify, - .generate = _generate, -======= .set_version_flag = _set_version_flag, .get_reserved_header_bit = _get_reserved_header_bit, .set_reserved_header_bit = _set_reserved_header_bit, @@ -1652,16 +1539,12 @@ message_t *message_create_from_packet(packet_t *packet) .disable_sort = _disable_sort, .generate = _generate, .is_encoded = _is_encoded, ->>>>>>> upstream/4.5.1 .set_source = _set_source, .get_source = _get_source, .set_destination = _set_destination, .get_destination = _get_destination, .create_payload_enumerator = _create_payload_enumerator, -<<<<<<< HEAD -======= .remove_payload_at = _remove_payload_at, ->>>>>>> upstream/4.5.1 .get_payload = _get_payload, .get_notify = _get_notify, .parse_header = _parse_header, @@ -1670,11 +1553,8 @@ message_t *message_create_from_packet(packet_t *packet) .get_packet_data = _get_packet_data, .destroy = _destroy, }, -<<<<<<< HEAD -======= .major_version = IKE_MAJOR_VERSION, .minor_version = IKE_MINOR_VERSION, ->>>>>>> upstream/4.5.1 .exchange_type = EXCHANGE_TYPE_UNDEFINED, .is_request = TRUE, .first_payload = NO_PAYLOAD, diff --git a/src/libcharon/encoding/message.h b/src/libcharon/encoding/message.h index dcc9b0577..51197308c 100644 --- a/src/libcharon/encoding/message.h +++ b/src/libcharon/encoding/message.h @@ -154,8 +154,6 @@ struct message_t { bool (*get_request) (message_t *this); /** -<<<<<<< HEAD -======= * Set the version flag in the IKE header. */ void (*set_version_flag)(message_t *this); @@ -176,7 +174,6 @@ struct message_t { void (*set_reserved_header_bit)(message_t *this, u_int nr); /** ->>>>>>> upstream/4.5.1 * Append a payload to the message. * * If the payload must be encrypted is not specified here. Encryption @@ -204,14 +201,11 @@ struct message_t { chunk_t data); /** -<<<<<<< HEAD -======= * Disable automatic payload sorting for this message. */ void (*disable_sort)(message_t *this); /** ->>>>>>> upstream/4.5.1 * Parses header of message. * * Begins parisng of a message created via message_create_from_packet(). @@ -237,11 +231,6 @@ struct message_t { * @param aead aead transform to verify/decrypt message * @return * - SUCCESS if parsing successful -<<<<<<< HEAD - * - NOT_SUPPORTED if ciritcal unknown payloads found - * - NOT_SUPPORTED if message type is not supported! -======= ->>>>>>> upstream/4.5.1 * - PARSE_ERROR if message parsing failed * - VERIFY_ERROR if message verification failed (bad syntax) * - FAILED if integrity check failed @@ -269,8 +258,6 @@ struct message_t { status_t (*generate) (message_t *this, aead_t *aead, packet_t **packet); /** -<<<<<<< HEAD -======= * Check if the message has already been encoded using generate(). * * @return TRUE if message has been encoded @@ -278,7 +265,6 @@ struct message_t { bool (*is_encoded)(message_t *this); /** ->>>>>>> upstream/4.5.1 * Gets the source host informations. * * @warning Returned host_t object is not getting cloned, @@ -326,8 +312,6 @@ struct message_t { enumerator_t * (*create_payload_enumerator) (message_t *this); /** -<<<<<<< HEAD -======= * Remove the payload at the current enumerator position. * * @param enumerator enumerator created by create_payload_enumerator() @@ -335,7 +319,6 @@ struct message_t { void (*remove_payload_at)(message_t *this, enumerator_t *enumerator); /** ->>>>>>> upstream/4.5.1 * Find a payload of a specific type. * * Returns the first occurance. diff --git a/src/libcharon/encoding/parser.c b/src/libcharon/encoding/parser.c index 7a5ec8495..32cefb9e7 100644 --- a/src/libcharon/encoding/parser.c +++ b/src/libcharon/encoding/parser.c @@ -387,15 +387,6 @@ static status_t parse_payload(private_parser_t *this, DBG3(DBG_ENC, "parsing payload from %b", this->byte_pos, this->input_roof - this->byte_pos); -<<<<<<< HEAD - if (pld->get_type(pld) == UNKNOWN_PAYLOAD) - { - DBG1(DBG_ENC, " payload type %d is unknown, handling as %N", - payload_type, payload_type_names, UNKNOWN_PAYLOAD); - } - -======= ->>>>>>> upstream/4.5.1 /* base pointer for output, avoids casting in every rule */ output = pld; @@ -418,10 +409,7 @@ static status_t parse_payload(private_parser_t *this, break; } case U_INT_8: -<<<<<<< HEAD -======= case RESERVED_BYTE: ->>>>>>> upstream/4.5.1 { if (!parse_uint8(this, rule_number, output + rule->offset)) { @@ -440,10 +428,7 @@ static status_t parse_payload(private_parser_t *this, break; } case U_INT_32: -<<<<<<< HEAD -======= case HEADER_LENGTH: ->>>>>>> upstream/4.5.1 { if (!parse_uint32(this, rule_number, output + rule->offset)) { @@ -462,26 +447,6 @@ static status_t parse_payload(private_parser_t *this, break; } case RESERVED_BIT: -<<<<<<< HEAD - { - if (!parse_bit(this, rule_number, NULL)) - { - pld->destroy(pld); - return PARSE_ERROR; - } - break; - } - case RESERVED_BYTE: - { - if (!parse_uint8(this, rule_number, NULL)) - { - pld->destroy(pld); - return PARSE_ERROR; - } - break; - } -======= ->>>>>>> upstream/4.5.1 case FLAG: { if (!parse_bit(this, rule_number, output + rule->offset)) @@ -507,18 +472,6 @@ static status_t parse_payload(private_parser_t *this, } break; } -<<<<<<< HEAD - case HEADER_LENGTH: - { - if (!parse_uint32(this, rule_number, output + rule->offset)) - { - pld->destroy(pld); - return PARSE_ERROR; - } - break; - } -======= ->>>>>>> upstream/4.5.1 case SPI_SIZE: { if (!parse_uint8(this, rule_number, output + rule->offset)) diff --git a/src/libcharon/encoding/payloads/auth_payload.c b/src/libcharon/encoding/payloads/auth_payload.c index 25a57511a..cb44a997c 100644 --- a/src/libcharon/encoding/payloads/auth_payload.c +++ b/src/libcharon/encoding/payloads/auth_payload.c @@ -1,10 +1,6 @@ /* -<<<<<<< HEAD - * Copyright (C) 2005-2006 Martin Willi -======= * Copyright (C) 2005-2010 Martin Willi * Copyright (C) 2010 revosec AG ->>>>>>> upstream/4.5.1 * Copyright (C) 2005 Jan Hutter * Hochschule fuer Technik Rapperswil * @@ -23,10 +19,6 @@ #include <encoding/payloads/encodings.h> -<<<<<<< HEAD - -======= ->>>>>>> upstream/4.5.1 typedef struct private_auth_payload_t private_auth_payload_t; /** @@ -51,8 +43,6 @@ struct private_auth_payload_t { bool critical; /** -<<<<<<< HEAD -======= * Reserved bits */ bool reserved_bit[7]; @@ -63,7 +53,6 @@ struct private_auth_payload_t { u_int8_t reserved_byte[3]; /** ->>>>>>> upstream/4.5.1 * Length of this payload. */ u_int16_t payload_length; @@ -87,29 +76,6 @@ struct private_auth_payload_t { */ encoding_rule_t auth_payload_encodings[] = { /* 1 Byte next payload type, stored in the field next_payload */ -<<<<<<< HEAD - { U_INT_8, offsetof(private_auth_payload_t, next_payload) }, - /* the critical bit */ - { FLAG, offsetof(private_auth_payload_t, critical) }, - /* 7 Bit reserved bits, nowhere stored */ - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - /* Length of the whole payload*/ - { PAYLOAD_LENGTH, offsetof(private_auth_payload_t, payload_length)}, - /* 1 Byte AUTH type*/ - { U_INT_8, offsetof(private_auth_payload_t, auth_method) }, - /* 3 reserved bytes */ - { RESERVED_BYTE, 0 }, - { RESERVED_BYTE, 0 }, - { RESERVED_BYTE, 0 }, - /* some auth data bytes, length is defined in PAYLOAD_LENGTH */ - { AUTH_DATA, offsetof(private_auth_payload_t, auth_data) } -======= { U_INT_8, offsetof(private_auth_payload_t, next_payload) }, /* the critical bit */ { FLAG, offsetof(private_auth_payload_t, critical) }, @@ -131,7 +97,6 @@ encoding_rule_t auth_payload_encodings[] = { { RESERVED_BYTE, offsetof(private_auth_payload_t, reserved_byte[2]) }, /* some auth data bytes, length is defined in PAYLOAD_LENGTH */ { AUTH_DATA, offsetof(private_auth_payload_t, auth_data) } ->>>>>>> upstream/4.5.1 }; /* @@ -148,36 +113,6 @@ encoding_rule_t auth_payload_encodings[] = { +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -<<<<<<< HEAD -/** - * Implementation of payload_t.verify. - */ -static status_t verify(private_auth_payload_t *this) -{ - if (this->auth_method == 0 || - (this->auth_method >= 4 && this->auth_method <= 8) || - (this->auth_method >= 12 && this->auth_method <= 200)) - { - /* reserved IDs */ - return FAILED; - } - return SUCCESS; -} - -/** - * Implementation of auth_payload_t.get_encoding_rules. - */ -static void get_encoding_rules(private_auth_payload_t *this, encoding_rule_t **rules, size_t *rule_count) -{ - *rules = auth_payload_encodings; - *rule_count = sizeof(auth_payload_encodings) / sizeof(encoding_rule_t); -} - -/** - * Implementation of payload_t.get_type. - */ -static payload_type_t get_payload_type(private_auth_payload_t *this) -======= METHOD(payload_t, verify, status_t, private_auth_payload_t *this) { @@ -193,25 +128,10 @@ METHOD(payload_t, get_encoding_rules, void, METHOD(payload_t, get_type, payload_type_t, private_auth_payload_t *this) ->>>>>>> upstream/4.5.1 { return AUTHENTICATION; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_next_type. - */ -static payload_type_t get_next_type(private_auth_payload_t *this) -{ - return (this->next_payload); -} - -/** - * Implementation of payload_t.set_next_type. - */ -static void set_next_type(private_auth_payload_t *this,payload_type_t type) -======= METHOD(payload_t, get_next_type, payload_type_t, private_auth_payload_t *this) { @@ -220,94 +140,22 @@ METHOD(payload_t, get_next_type, payload_type_t, METHOD(payload_t, set_next_type, void, private_auth_payload_t *this, payload_type_t type) ->>>>>>> upstream/4.5.1 { this->next_payload = type; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_length. - */ -static size_t get_length(private_auth_payload_t *this) -======= METHOD(payload_t, get_length, size_t, private_auth_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->payload_length; } -<<<<<<< HEAD -/** - * Implementation of auth_payload_t.set_auth_method. - */ -static void set_auth_method (private_auth_payload_t *this, auth_method_t method) -======= METHOD(auth_payload_t, set_auth_method, void, private_auth_payload_t *this, auth_method_t method) ->>>>>>> upstream/4.5.1 { this->auth_method = method; } -<<<<<<< HEAD -/** - * Implementation of auth_payload_t.get_auth_method. - */ -static auth_method_t get_auth_method (private_auth_payload_t *this) -{ - return (this->auth_method); -} - -/** - * Implementation of auth_payload_t.set_data. - */ -static void set_data (private_auth_payload_t *this, chunk_t data) -{ - if (this->auth_data.ptr != NULL) - { - chunk_free(&(this->auth_data)); - } - this->auth_data.ptr = clalloc(data.ptr,data.len); - this->auth_data.len = data.len; - this->payload_length = AUTH_PAYLOAD_HEADER_LENGTH + this->auth_data.len; -} - -/** - * Implementation of auth_payload_t.get_data. - */ -static chunk_t get_data (private_auth_payload_t *this) -{ - return (this->auth_data); -} - -/** - * Implementation of auth_payload_t.get_data_clone. - */ -static chunk_t get_data_clone (private_auth_payload_t *this) -{ - chunk_t cloned_data; - if (this->auth_data.ptr == NULL) - { - return (this->auth_data); - } - cloned_data.ptr = clalloc(this->auth_data.ptr,this->auth_data.len); - cloned_data.len = this->auth_data.len; - return cloned_data; -} - -/** - * Implementation of payload_t.destroy and auth_payload_t.destroy. - */ -static void destroy(private_auth_payload_t *this) -{ - if (this->auth_data.ptr != NULL) - { - chunk_free(&(this->auth_data)); - } - -======= METHOD(auth_payload_t, get_auth_method, auth_method_t, private_auth_payload_t *this) { @@ -332,7 +180,6 @@ METHOD2(payload_t, auth_payload_t, destroy, void, private_auth_payload_t *this) { free(this->auth_data.ptr); ->>>>>>> upstream/4.5.1 free(this); } @@ -341,34 +188,6 @@ METHOD2(payload_t, auth_payload_t, destroy, void, */ auth_payload_t *auth_payload_create() { -<<<<<<< HEAD - private_auth_payload_t *this = malloc_thing(private_auth_payload_t); - - /* interface functions */ - this->public.payload_interface.verify = (status_t (*) (payload_t *))verify; - this->public.payload_interface.get_encoding_rules = (void (*) (payload_t *, encoding_rule_t **, size_t *) ) get_encoding_rules; - this->public.payload_interface.get_length = (size_t (*) (payload_t *)) get_length; - this->public.payload_interface.get_next_type = (payload_type_t (*) (payload_t *)) get_next_type; - this->public.payload_interface.set_next_type = (void (*) (payload_t *,payload_type_t)) set_next_type; - this->public.payload_interface.get_type = (payload_type_t (*) (payload_t *)) get_payload_type; - this->public.payload_interface.destroy = (void (*) (payload_t *))destroy; - - /* public functions */ - this->public.destroy = (void (*) (auth_payload_t *)) destroy; - this->public.set_auth_method = (void (*) (auth_payload_t *,auth_method_t)) set_auth_method; - this->public.get_auth_method = (auth_method_t (*) (auth_payload_t *)) get_auth_method; - this->public.set_data = (void (*) (auth_payload_t *,chunk_t)) set_data; - this->public.get_data_clone = (chunk_t (*) (auth_payload_t *)) get_data_clone; - this->public.get_data = (chunk_t (*) (auth_payload_t *)) get_data; - - /* private variables */ - this->critical = FALSE; - this->next_payload = NO_PAYLOAD; - this->payload_length =AUTH_PAYLOAD_HEADER_LENGTH; - this->auth_data = chunk_empty; - - return (&(this->public)); -======= private_auth_payload_t *this; INIT(this, @@ -392,5 +211,4 @@ auth_payload_t *auth_payload_create() .payload_length = AUTH_PAYLOAD_HEADER_LENGTH, ); return &this->public; ->>>>>>> upstream/4.5.1 } diff --git a/src/libcharon/encoding/payloads/auth_payload.h b/src/libcharon/encoding/payloads/auth_payload.h index c28fc1e06..e4c4e6ae3 100644 --- a/src/libcharon/encoding/payloads/auth_payload.h +++ b/src/libcharon/encoding/payloads/auth_payload.h @@ -62,35 +62,13 @@ struct auth_payload_t { /** * Set the AUTH data. * -<<<<<<< HEAD - * Data gets cloned. - * - * @param data AUTH data as chunk_t -======= * @param data AUTH data as chunk_t, gets cloned ->>>>>>> upstream/4.5.1 */ void (*set_data) (auth_payload_t *this, chunk_t data); /** * Get the AUTH data. * -<<<<<<< HEAD - * Returned data are a copy of the internal one. - * - * @return AUTH data as chunk_t - */ - chunk_t (*get_data_clone) (auth_payload_t *this); - - /** - * Get the AUTH data. - * - * Returned data are NOT copied - * - * @return AUTH data as chunk_t - */ - chunk_t (*get_data) (auth_payload_t *this); -======= * @return AUTH data as chunk_t, internal data */ chunk_t (*get_data) (auth_payload_t *this); @@ -109,7 +87,6 @@ struct auth_payload_t { * @param nr number of the reserved bit, 0-6 */ void (*set_reserved_bit)(auth_payload_t *this, u_int nr); ->>>>>>> upstream/4.5.1 /** * Destroys an auth_payload_t object. diff --git a/src/libcharon/encoding/payloads/cert_payload.c b/src/libcharon/encoding/payloads/cert_payload.c index 6a28cd658..c42cec680 100644 --- a/src/libcharon/encoding/payloads/cert_payload.c +++ b/src/libcharon/encoding/payloads/cert_payload.c @@ -1,11 +1,7 @@ /* * Copyright (C) 2008 Tobias Brunner -<<<<<<< HEAD - * Copyright (C) 2005-2007 Martin Willi -======= * Copyright (C) 2005-2010 Martin Willi * Copyright (C) 2010 revosec AG ->>>>>>> upstream/4.5.1 * Copyright (C) 2005 Jan Hutter * Hochschule fuer Technik Rapperswil * @@ -48,15 +44,9 @@ typedef struct private_cert_payload_t private_cert_payload_t; /** * Private data of an cert_payload_t object. -<<<<<<< HEAD - * - */ -struct private_cert_payload_t { -======= */ struct private_cert_payload_t { ->>>>>>> upstream/4.5.1 /** * Public cert_payload_t interface. */ @@ -73,14 +63,11 @@ struct private_cert_payload_t { bool critical; /** -<<<<<<< HEAD -======= * reserved bits */ bool reserved[7]; /** ->>>>>>> upstream/4.5.1 * Length of this payload. */ u_int16_t payload_length; @@ -110,19 +97,6 @@ struct private_cert_payload_t { */ encoding_rule_t cert_payload_encodings[] = { /* 1 Byte next payload type, stored in the field next_payload */ -<<<<<<< HEAD - { U_INT_8, offsetof(private_cert_payload_t, next_payload) }, - /* the critical bit */ - { FLAG, offsetof(private_cert_payload_t, critical) }, - /* 7 Bit reserved bits, nowhere stored */ - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, -======= { U_INT_8, offsetof(private_cert_payload_t, next_payload) }, /* the critical bit */ { FLAG, offsetof(private_cert_payload_t, critical) }, @@ -134,17 +108,12 @@ encoding_rule_t cert_payload_encodings[] = { { RESERVED_BIT, offsetof(private_cert_payload_t, reserved[4]) }, { RESERVED_BIT, offsetof(private_cert_payload_t, reserved[5]) }, { RESERVED_BIT, offsetof(private_cert_payload_t, reserved[6]) }, ->>>>>>> upstream/4.5.1 /* Length of the whole payload*/ { PAYLOAD_LENGTH, offsetof(private_cert_payload_t, payload_length)}, /* 1 Byte CERT type*/ { U_INT_8, offsetof(private_cert_payload_t, encoding) }, /* some cert data bytes, length is defined in PAYLOAD_LENGTH */ -<<<<<<< HEAD - { CERT_DATA, offsetof(private_cert_payload_t, data) } -======= { CERT_DATA, offsetof(private_cert_payload_t, data) } ->>>>>>> upstream/4.5.1 }; /* @@ -160,43 +129,23 @@ encoding_rule_t cert_payload_encodings[] = { +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -<<<<<<< HEAD -/** - * Implementation of payload_t.verify. - */ -static status_t verify(private_cert_payload_t *this) -======= METHOD(payload_t, verify, status_t, private_cert_payload_t *this) ->>>>>>> upstream/4.5.1 { if (this->encoding == ENC_X509_HASH_AND_URL || this->encoding == ENC_X509_HASH_AND_URL_BUNDLE) { -<<<<<<< HEAD -======= int i; ->>>>>>> upstream/4.5.1 /* coarse verification of "Hash and URL" encoded certificates */ if (this->data.len <= 20) { DBG1(DBG_ENC, "invalid payload length for hash-and-url (%d), ignore", -<<<<<<< HEAD - this->data.len); - this->invalid_hash_and_url = TRUE; - return SUCCESS; - } - - int i = 20; /* skipping the hash */ - for (; i < this->data.len; ++i) -======= this->data.len); this->invalid_hash_and_url = TRUE; return SUCCESS; } for (i = 20; i < this->data.len; ++i) ->>>>>>> upstream/4.5.1 { if (this->data.ptr[i] == '\0') { @@ -206,47 +155,17 @@ METHOD(payload_t, verify, status_t, else if (!isprint(this->data.ptr[i])) { DBG1(DBG_ENC, "non printable characters in url of hash-and-url" -<<<<<<< HEAD - " encoded certificate payload, ignore"); -======= " encoded certificate payload, ignore"); ->>>>>>> upstream/4.5.1 this->invalid_hash_and_url = TRUE; return SUCCESS; } } -<<<<<<< HEAD - - /* URL is not null terminated, correct that */ - chunk_t data = chunk_alloc(this->data.len + 1); - memcpy(data.ptr, this->data.ptr, this->data.len); - data.ptr[this->data.len] = '\0'; - chunk_free(&this->data); - this->data = data; -======= /* URL is not null terminated, correct that */ this->data = chunk_cat("mc", this->data, chunk_from_chars(0)); ->>>>>>> upstream/4.5.1 } return SUCCESS; } -<<<<<<< HEAD -/** - * Implementation of cert_payload_t.get_encoding_rules. - */ -static void get_encoding_rules(private_cert_payload_t *this, - encoding_rule_t **rules, size_t *rule_count) -{ - *rules = cert_payload_encodings; - *rule_count = sizeof(cert_payload_encodings) / sizeof(encoding_rule_t); -} - -/** - * Implementation of payload_t.get_type. - */ -static payload_type_t get_payload_type(private_cert_payload_t *this) -======= METHOD(payload_t, get_encoding_rules, void, private_cert_payload_t *this, encoding_rule_t **rules, size_t *rule_count) { @@ -256,87 +175,34 @@ METHOD(payload_t, get_encoding_rules, void, METHOD(payload_t, get_type, payload_type_t, private_cert_payload_t *this) ->>>>>>> upstream/4.5.1 { return CERTIFICATE; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_next_type. - */ -static payload_type_t get_next_type(private_cert_payload_t *this) -======= METHOD(payload_t, get_next_type, payload_type_t, private_cert_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->next_payload; } -<<<<<<< HEAD -/** - * Implementation of payload_t.set_next_type. - */ -static void set_next_type(private_cert_payload_t *this,payload_type_t type) -======= METHOD(payload_t, set_next_type, void, private_cert_payload_t *this, payload_type_t type) ->>>>>>> upstream/4.5.1 { this->next_payload = type; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_length. - */ -static size_t get_length(private_cert_payload_t *this) -======= METHOD(payload_t, get_length, size_t, private_cert_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->payload_length; } -<<<<<<< HEAD -/** - * Implementation of cert_payload_t.get_cert_encoding. - */ -static cert_encoding_t get_cert_encoding(private_cert_payload_t *this) -======= METHOD(cert_payload_t, get_cert_encoding, cert_encoding_t, private_cert_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->encoding; } -<<<<<<< HEAD -/** - * Implementation of cert_payload_t.get_cert. - */ -static certificate_t *get_cert(private_cert_payload_t *this) -{ - if (this->encoding != ENC_X509_SIGNATURE) - { - return NULL; - } - return lib->creds->create(lib->creds, CRED_CERTIFICATE, CERT_X509, - BUILD_BLOB_ASN1_DER, this->data, - BUILD_END); -} - -/** - * Implementation of cert_payload_t.get_hash. - */ -static chunk_t get_hash(private_cert_payload_t *this) -{ - chunk_t hash = chunk_empty; - if ((this->encoding != ENC_X509_HASH_AND_URL && - this->encoding != ENC_X509_HASH_AND_URL_BUNDLE) || -======= METHOD(cert_payload_t, get_cert, certificate_t*, private_cert_payload_t *this) { @@ -364,7 +230,6 @@ METHOD(cert_payload_t, get_hash, chunk_t, if ((this->encoding != ENC_X509_HASH_AND_URL && this->encoding != ENC_X509_HASH_AND_URL_BUNDLE) || ->>>>>>> upstream/4.5.1 this->invalid_hash_and_url) { return hash; @@ -374,21 +239,11 @@ METHOD(cert_payload_t, get_hash, chunk_t, return hash; } -<<<<<<< HEAD -/** - * Implementation of cert_payload_t.get_url. - */ -static char *get_url(private_cert_payload_t *this) -{ - if ((this->encoding != ENC_X509_HASH_AND_URL && - this->encoding != ENC_X509_HASH_AND_URL_BUNDLE) || -======= METHOD(cert_payload_t, get_url, char*, private_cert_payload_t *this) { if ((this->encoding != ENC_X509_HASH_AND_URL && this->encoding != ENC_X509_HASH_AND_URL_BUNDLE) || ->>>>>>> upstream/4.5.1 this->invalid_hash_and_url) { return NULL; @@ -396,19 +251,10 @@ METHOD(cert_payload_t, get_url, char*, return (char*)this->data.ptr + 20; } -<<<<<<< HEAD -/** - * Implementation of payload_t.destroy and cert_payload_t.destroy. - */ -static void destroy(private_cert_payload_t *this) -{ - chunk_free(&this->data); -======= METHOD2(payload_t, cert_payload_t, destroy, void, private_cert_payload_t *this) { free(this->data.ptr); ->>>>>>> upstream/4.5.1 free(this); } @@ -417,31 +263,6 @@ METHOD2(payload_t, cert_payload_t, destroy, void, */ cert_payload_t *cert_payload_create() { -<<<<<<< HEAD - private_cert_payload_t *this = malloc_thing(private_cert_payload_t); - - this->public.payload_interface.verify = (status_t (*) (payload_t*))verify; - this->public.payload_interface.get_encoding_rules = (void (*) (payload_t*,encoding_rule_t**, size_t*))get_encoding_rules; - this->public.payload_interface.get_length = (size_t (*) (payload_t*))get_length; - this->public.payload_interface.get_next_type = (payload_type_t (*) (payload_t*))get_next_type; - this->public.payload_interface.set_next_type = (void (*) (payload_t*,payload_type_t))set_next_type; - this->public.payload_interface.get_type = (payload_type_t (*) (payload_t*))get_payload_type; - this->public.payload_interface.destroy = (void (*) (payload_t*))destroy; - - this->public.destroy = (void (*) (cert_payload_t*))destroy; - this->public.get_cert = (certificate_t* (*) (cert_payload_t*))get_cert; - this->public.get_cert_encoding = (cert_encoding_t (*) (cert_payload_t*))get_cert_encoding; - this->public.get_hash = (chunk_t (*) (cert_payload_t*))get_hash; - this->public.get_url = (char* (*) (cert_payload_t*))get_url; - - this->critical = FALSE; - this->next_payload = NO_PAYLOAD; - this->payload_length = CERT_PAYLOAD_HEADER_LENGTH; - this->data = chunk_empty; - this->encoding = 0; - this->invalid_hash_and_url = FALSE; - -======= private_cert_payload_t *this; INIT(this, @@ -464,7 +285,6 @@ cert_payload_t *cert_payload_create() .next_payload = NO_PAYLOAD, .payload_length = CERT_PAYLOAD_HEADER_LENGTH, ); ->>>>>>> upstream/4.5.1 return &this->public; } @@ -509,8 +329,6 @@ cert_payload_t *cert_payload_create_from_hash_and_url(chunk_t hash, char *url) return &this->public; } -<<<<<<< HEAD -======= /* * Described in header */ @@ -523,4 +341,3 @@ cert_payload_t *cert_payload_create_custom(cert_encoding_t type, chunk_t data) this->payload_length = CERT_PAYLOAD_HEADER_LENGTH + this->data.len; return &this->public; } ->>>>>>> upstream/4.5.1 diff --git a/src/libcharon/encoding/payloads/cert_payload.h b/src/libcharon/encoding/payloads/cert_payload.h index 74d2b3cd2..21b503a40 100644 --- a/src/libcharon/encoding/payloads/cert_payload.h +++ b/src/libcharon/encoding/payloads/cert_payload.h @@ -134,8 +134,6 @@ cert_payload_t *cert_payload_create_from_cert(certificate_t *cert); */ cert_payload_t *cert_payload_create_from_hash_and_url(chunk_t hash, char *url); -<<<<<<< HEAD -======= /** * Creates a custom certificate payload using type and associated data. * @@ -145,5 +143,4 @@ cert_payload_t *cert_payload_create_from_hash_and_url(chunk_t hash, char *url); */ cert_payload_t *cert_payload_create_custom(cert_encoding_t type, chunk_t data); ->>>>>>> upstream/4.5.1 #endif /** CERT_PAYLOAD_H_ @}*/ diff --git a/src/libcharon/encoding/payloads/certreq_payload.c b/src/libcharon/encoding/payloads/certreq_payload.c index 0c59fd66d..8e0836f0e 100644 --- a/src/libcharon/encoding/payloads/certreq_payload.c +++ b/src/libcharon/encoding/payloads/certreq_payload.c @@ -1,10 +1,6 @@ /* -<<<<<<< HEAD - * Copyright (C) 2005-2006 Martin Willi -======= * Copyright (C) 2005-2010 Martin Willi * Copyright (C) 2010 revosec AG ->>>>>>> upstream/4.5.1 * Copyright (C) 2005 Jan Hutter * Hochschule fuer Technik Rapperswil * @@ -27,23 +23,13 @@ #include "certreq_payload.h" -<<<<<<< HEAD - -======= ->>>>>>> upstream/4.5.1 typedef struct private_certreq_payload_t private_certreq_payload_t; /** * Private data of an certreq_payload_t object. -<<<<<<< HEAD - * - */ -struct private_certreq_payload_t { -======= */ struct private_certreq_payload_t { ->>>>>>> upstream/4.5.1 /** * Public certreq_payload_t interface. */ @@ -60,14 +46,11 @@ struct private_certreq_payload_t { bool critical; /** -<<<<<<< HEAD -======= * Reserved bits */ bool reserved[7]; /** ->>>>>>> upstream/4.5.1 * Length of this payload. */ u_int16_t payload_length; @@ -88,23 +71,6 @@ struct private_certreq_payload_t { * * The defined offsets are the positions in a object of type * private_certreq_payload_t. -<<<<<<< HEAD - * - */ -encoding_rule_t certreq_payload_encodings[] = { - /* 1 Byte next payload type, stored in the field next_payload */ - { U_INT_8, offsetof(private_certreq_payload_t, next_payload) }, - /* the critical bit */ - { FLAG, offsetof(private_certreq_payload_t, critical) }, - /* 7 Bit reserved bits, nowhere stored */ - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, -======= */ encoding_rule_t certreq_payload_encodings[] = { /* 1 Byte next payload type, stored in the field next_payload */ @@ -119,7 +85,6 @@ encoding_rule_t certreq_payload_encodings[] = { { RESERVED_BIT, offsetof(private_certreq_payload_t, reserved[4]) }, { RESERVED_BIT, offsetof(private_certreq_payload_t, reserved[5]) }, { RESERVED_BIT, offsetof(private_certreq_payload_t, reserved[6]) }, ->>>>>>> upstream/4.5.1 /* Length of the whole payload*/ { PAYLOAD_LENGTH, offsetof(private_certreq_payload_t, payload_length) }, /* 1 Byte CERTREQ type*/ @@ -141,15 +106,8 @@ encoding_rule_t certreq_payload_encodings[] = { +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -<<<<<<< HEAD -/** - * Implementation of payload_t.verify. - */ -static status_t verify(private_certreq_payload_t *this) -======= METHOD(payload_t, verify, status_t, private_certreq_payload_t *this) ->>>>>>> upstream/4.5.1 { if (this->encoding == ENC_X509_SIGNATURE) { @@ -164,21 +122,6 @@ METHOD(payload_t, verify, status_t, return SUCCESS; } -<<<<<<< HEAD -/** - * Implementation of certreq_payload_t.get_encoding_rules. - */ -static void get_encoding_rules(private_certreq_payload_t *this, encoding_rule_t **rules, size_t *rule_count) -{ - *rules = certreq_payload_encodings; - *rule_count = sizeof(certreq_payload_encodings) / sizeof(encoding_rule_t); -} - -/** - * Implementation of payload_t.get_type. - */ -static payload_type_t get_payload_type(private_certreq_payload_t *this) -======= METHOD(payload_t, get_encoding_rules, void, private_certreq_payload_t *this, encoding_rule_t **rules, size_t *rule_count) { @@ -188,25 +131,10 @@ METHOD(payload_t, get_encoding_rules, void, METHOD(payload_t, get_type, payload_type_t, private_certreq_payload_t *this) ->>>>>>> upstream/4.5.1 { return CERTIFICATE_REQUEST; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_next_type. - */ -static payload_type_t get_next_type(private_certreq_payload_t *this) -{ - return (this->next_payload); -} - -/** - * Implementation of payload_t.set_next_type. - */ -static void set_next_type(private_certreq_payload_t *this,payload_type_t type) -======= METHOD(payload_t, get_next_type, payload_type_t, private_certreq_payload_t *this) { @@ -215,33 +143,18 @@ METHOD(payload_t, get_next_type, payload_type_t, METHOD(payload_t, set_next_type, void, private_certreq_payload_t *this, payload_type_t type) ->>>>>>> upstream/4.5.1 { this->next_payload = type; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_length. - */ -static size_t get_length(private_certreq_payload_t *this) -======= METHOD(payload_t, get_length, size_t, private_certreq_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->payload_length; } -<<<<<<< HEAD -/** - * Implementation of certreq_payload_t.add_keyid. - */ -static void add_keyid(private_certreq_payload_t *this, chunk_t keyid) -======= METHOD(certreq_payload_t, add_keyid, void, private_certreq_payload_t *this, chunk_t keyid) ->>>>>>> upstream/4.5.1 { this->data = chunk_cat("mc", this->data, keyid); this->payload_length += keyid.len; @@ -258,15 +171,8 @@ struct keyid_enumerator_t { u_char *pos; }; -<<<<<<< HEAD -/** - * enumerate function for keyid_enumerator - */ -static bool keyid_enumerate(keyid_enumerator_t *this, chunk_t *chunk) -======= METHOD(enumerator_t, keyid_enumerate, bool, keyid_enumerator_t *this, chunk_t *chunk) ->>>>>>> upstream/4.5.1 { if (this->pos == NULL) { @@ -289,25 +195,6 @@ METHOD(enumerator_t, keyid_enumerate, bool, return FALSE; } -<<<<<<< HEAD -/** - * Implementation of certreq_payload_t.create_keyid_enumerator. - */ -static enumerator_t* create_keyid_enumerator(private_certreq_payload_t *this) -{ - keyid_enumerator_t *enumerator = malloc_thing(keyid_enumerator_t); - enumerator->public.enumerate = (void*)keyid_enumerate; - enumerator->public.destroy = (void*)free; - enumerator->full = this->data; - enumerator->pos = NULL; - return &enumerator->public; -} - -/** - * Implementation of certreq_payload_t.get_cert_type. - */ -static certificate_type_t get_cert_type(private_certreq_payload_t *this) -======= METHOD(certreq_payload_t, create_keyid_enumerator, enumerator_t*, private_certreq_payload_t *this) { @@ -325,7 +212,6 @@ METHOD(certreq_payload_t, create_keyid_enumerator, enumerator_t*, METHOD(certreq_payload_t, get_cert_type, certificate_type_t, private_certreq_payload_t *this) ->>>>>>> upstream/4.5.1 { switch (this->encoding) { @@ -336,15 +222,8 @@ METHOD(certreq_payload_t, get_cert_type, certificate_type_t, } } -<<<<<<< HEAD -/** - * Implementation of payload_t.destroy and certreq_payload_t.destroy. - */ -static void destroy(private_certreq_payload_t *this) -======= METHOD2(payload_t, certreq_payload_t, destroy, void, private_certreq_payload_t *this) ->>>>>>> upstream/4.5.1 { chunk_free(&this->data); free(this); @@ -355,32 +234,6 @@ METHOD2(payload_t, certreq_payload_t, destroy, void, */ certreq_payload_t *certreq_payload_create() { -<<<<<<< HEAD - private_certreq_payload_t *this = malloc_thing(private_certreq_payload_t); - - /* interface functions */ - this->public.payload_interface.verify = (status_t (*) (payload_t*))verify; - this->public.payload_interface.get_encoding_rules = (void (*) (payload_t*,encoding_rule_t**,size_t*))get_encoding_rules; - this->public.payload_interface.get_length = (size_t (*) (payload_t*))get_length; - this->public.payload_interface.get_next_type = (payload_type_t (*) (payload_t*))get_next_type; - this->public.payload_interface.set_next_type = (void (*) (payload_t*,payload_type_t))set_next_type; - this->public.payload_interface.get_type = (payload_type_t (*) (payload_t*))get_payload_type; - this->public.payload_interface.destroy = (void (*) (payload_t*))destroy; - - /* public functions */ - this->public.destroy = (void (*) (certreq_payload_t*)) destroy; - this->public.create_keyid_enumerator = (enumerator_t*(*)(certreq_payload_t*))create_keyid_enumerator; - this->public.get_cert_type = (certificate_type_t(*)(certreq_payload_t*))get_cert_type; - this->public.add_keyid = (void(*)(certreq_payload_t*, chunk_t keyid))add_keyid; - - /* private variables */ - this->critical = FALSE; - this->next_payload = NO_PAYLOAD; - this->payload_length = CERTREQ_PAYLOAD_HEADER_LENGTH; - this->data = chunk_empty; - this->encoding = 0; - -======= private_certreq_payload_t *this; INIT(this, @@ -402,7 +255,6 @@ certreq_payload_t *certreq_payload_create() .next_payload = NO_PAYLOAD, .payload_length = CERTREQ_PAYLOAD_HEADER_LENGTH, ); ->>>>>>> upstream/4.5.1 return &this->public; } diff --git a/src/libcharon/encoding/payloads/configuration_attribute.c b/src/libcharon/encoding/payloads/configuration_attribute.c index 1ef8be800..e608497bd 100644 --- a/src/libcharon/encoding/payloads/configuration_attribute.c +++ b/src/libcharon/encoding/payloads/configuration_attribute.c @@ -1,10 +1,6 @@ /* -<<<<<<< HEAD - * Copyright (C) 2005-2009 Martin Willi -======= * Copyright (C) 2005-2010 Martin Willi * Copyright (C) 2010 revosec AG ->>>>>>> upstream/4.5.1 * Copyright (C) 2005 Jan Hutter * Hochschule fuer Technik Rapperswil * @@ -27,37 +23,24 @@ #include <library.h> #include <daemon.h> -<<<<<<< HEAD - -======= ->>>>>>> upstream/4.5.1 typedef struct private_configuration_attribute_t private_configuration_attribute_t; /** * Private data of an configuration_attribute_t object. -<<<<<<< HEAD - * - */ -struct private_configuration_attribute_t { -======= */ struct private_configuration_attribute_t { ->>>>>>> upstream/4.5.1 /** * Public configuration_attribute_t interface. */ configuration_attribute_t public; /** -<<<<<<< HEAD -======= * Reserved bit */ bool reserved; /** ->>>>>>> upstream/4.5.1 * Type of the attribute. */ u_int16_t type; @@ -80,13 +63,8 @@ struct private_configuration_attribute_t { * private_configuration_attribute_t. */ encoding_rule_t configuration_attribute_encodings[] = { -<<<<<<< HEAD - - { RESERVED_BIT, 0 }, -======= /* 1 reserved bit */ { RESERVED_BIT, offsetof(private_configuration_attribute_t, reserved)}, ->>>>>>> upstream/4.5.1 /* type of the attribute as 15 bit unsigned integer */ { ATTRIBUTE_TYPE, offsetof(private_configuration_attribute_t, type) }, /* Length of attribute value */ @@ -107,15 +85,8 @@ encoding_rule_t configuration_attribute_encodings[] = { +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -<<<<<<< HEAD -/** - * Implementation of payload_t.verify. - */ -static status_t verify(private_configuration_attribute_t *this) -======= METHOD(payload_t, verify, status_t, private_configuration_attribute_t *this) ->>>>>>> upstream/4.5.1 { bool failed = FALSE; @@ -183,22 +154,6 @@ METHOD(payload_t, verify, status_t, return SUCCESS; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_encoding_rules. - */ -static void get_encoding_rules(private_configuration_attribute_t *this, - encoding_rule_t **rules, size_t *rule_count) -{ - *rules = configuration_attribute_encodings; - *rule_count = sizeof(configuration_attribute_encodings) / sizeof(encoding_rule_t); -} - -/** - * Implementation of payload_t.get_type. - */ -static payload_type_t get_type(private_configuration_attribute_t *this) -======= METHOD(payload_t, get_encoding_rules, void, private_configuration_attribute_t *this, encoding_rule_t **rules, size_t *rule_count) @@ -209,38 +164,16 @@ METHOD(payload_t, get_encoding_rules, void, METHOD(payload_t, get_type, payload_type_t, private_configuration_attribute_t *this) ->>>>>>> upstream/4.5.1 { return CONFIGURATION_ATTRIBUTE; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_next_type. - */ -static payload_type_t get_next_type(private_configuration_attribute_t *this) -======= METHOD(payload_t, get_next_type, payload_type_t, private_configuration_attribute_t *this) ->>>>>>> upstream/4.5.1 { return NO_PAYLOAD; } -<<<<<<< HEAD -/** - * Implementation of payload_t.set_next_type. - */ -static void set_next_type(private_configuration_attribute_t *this, - payload_type_t type) -{ -} - -/** - * Implementation of configuration_attribute_t.get_length. - */ -static size_t get_length(private_configuration_attribute_t *this) -======= METHOD(payload_t, set_next_type, void, private_configuration_attribute_t *this, payload_type_t type) { @@ -248,47 +181,24 @@ METHOD(payload_t, set_next_type, void, METHOD(payload_t, get_length, size_t, private_configuration_attribute_t *this) ->>>>>>> upstream/4.5.1 { return this->value.len + CONFIGURATION_ATTRIBUTE_HEADER_LENGTH; } -<<<<<<< HEAD -/** - * Implementation of configuration_attribute_t.get_type. - */ -static configuration_attribute_type_t get_configuration_attribute_type( - private_configuration_attribute_t *this) -======= METHOD(configuration_attribute_t, get_cattr_type, configuration_attribute_type_t, private_configuration_attribute_t *this) ->>>>>>> upstream/4.5.1 { return this->type; } -<<<<<<< HEAD -/** - * Implementation of configuration_attribute_t.get_value. - */ -static chunk_t get_value(private_configuration_attribute_t *this) -======= METHOD(configuration_attribute_t, get_value, chunk_t, private_configuration_attribute_t *this) ->>>>>>> upstream/4.5.1 { return this->value; } -<<<<<<< HEAD -/** - * Implementation of configuration_attribute_t.destroy and payload_t.destroy. - */ -static void destroy(private_configuration_attribute_t *this) -======= METHOD2(payload_t, configuration_attribute_t, destroy, void, private_configuration_attribute_t *this) ->>>>>>> upstream/4.5.1 { free(this->value.ptr); free(this); @@ -301,25 +211,6 @@ configuration_attribute_t *configuration_attribute_create() { private_configuration_attribute_t *this; -<<<<<<< HEAD - this = malloc_thing(private_configuration_attribute_t); - this->public.payload_interface.verify = (status_t(*)(payload_t *))verify; - this->public.payload_interface.get_encoding_rules = (void(*)(payload_t *, encoding_rule_t **, size_t *) )get_encoding_rules; - this->public.payload_interface.get_length = (size_t(*)(payload_t *))get_length; - this->public.payload_interface.get_next_type = (payload_type_t(*)(payload_t *))get_next_type; - this->public.payload_interface.set_next_type = (void(*)(payload_t *,payload_type_t))set_next_type; - this->public.payload_interface.get_type = (payload_type_t(*)(payload_t *))get_type; - this->public.payload_interface.destroy = (void(*)(payload_t*))destroy; - - this->public.get_value = (chunk_t(*)(configuration_attribute_t *))get_value; - this->public.get_type = (configuration_attribute_type_t(*)(configuration_attribute_t *))get_configuration_attribute_type; - this->public.destroy = (void (*)(configuration_attribute_t*))destroy; - - this->type = 0; - this->value = chunk_empty; - this->length = 0; - -======= INIT(this, .public = { .payload_interface = { @@ -336,7 +227,6 @@ configuration_attribute_t *configuration_attribute_create() .destroy = _destroy, }, ); ->>>>>>> upstream/4.5.1 return &this->public; } diff --git a/src/libcharon/encoding/payloads/cp_payload.c b/src/libcharon/encoding/payloads/cp_payload.c index d8779d27f..82e9e51b7 100644 --- a/src/libcharon/encoding/payloads/cp_payload.c +++ b/src/libcharon/encoding/payloads/cp_payload.c @@ -1,10 +1,6 @@ /* -<<<<<<< HEAD - * Copyright (C) 2005-2009 Martin Willi -======= * Copyright (C) 2005-2010 Martin Willi * Copyright (C) 2010 revosec AG ->>>>>>> upstream/4.5.1 * Copyright (C) 2005 Jan Hutter * Hochschule fuer Technik Rapperswil * @@ -37,15 +33,9 @@ typedef struct private_cp_payload_t private_cp_payload_t; /** * Private data of an cp_payload_t object. -<<<<<<< HEAD - * - */ -struct private_cp_payload_t { -======= */ struct private_cp_payload_t { ->>>>>>> upstream/4.5.1 /** * Public cp_payload_t interface. */ @@ -62,8 +52,6 @@ struct private_cp_payload_t { bool critical; /** -<<<<<<< HEAD -======= * Reserved bits */ bool reserved_bit[7]; @@ -74,7 +62,6 @@ struct private_cp_payload_t { u_int8_t reserved_byte[3]; /** ->>>>>>> upstream/4.5.1 * Length of this payload. */ u_int16_t payload_length; @@ -95,32 +82,6 @@ struct private_cp_payload_t { * * The defined offsets are the positions in a object of type * private_cp_payload_t. -<<<<<<< HEAD - * - */ -encoding_rule_t cp_payload_encodings[] = { - /* 1 Byte next payload type, stored in the field next_payload */ - { U_INT_8, offsetof(private_cp_payload_t, next_payload) }, - /* the critical bit */ - { FLAG, offsetof(private_cp_payload_t, critical) }, - /* 7 Bit reserved bits, nowhere stored */ - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - /* Length of the whole CP payload*/ - { PAYLOAD_LENGTH, offsetof(private_cp_payload_t, payload_length) }, - /* Proposals are stored in a proposal substructure, - offset points to a linked_list_t pointer */ - { U_INT_8, offsetof(private_cp_payload_t, type) }, - { RESERVED_BYTE,0 }, - { RESERVED_BYTE,0 }, - { RESERVED_BYTE,0 }, - { CONFIGURATION_ATTRIBUTES, offsetof(private_cp_payload_t, attributes) } -======= */ encoding_rule_t cp_payload_encodings[] = { /* 1 Byte next payload type, stored in the field next_payload */ @@ -145,7 +106,6 @@ encoding_rule_t cp_payload_encodings[] = { { RESERVED_BYTE, offsetof(private_cp_payload_t, reserved_byte[1])}, { RESERVED_BYTE, offsetof(private_cp_payload_t, reserved_byte[2])}, { CONFIGURATION_ATTRIBUTES, offsetof(private_cp_payload_t, attributes) } ->>>>>>> upstream/4.5.1 }; /* @@ -162,15 +122,8 @@ encoding_rule_t cp_payload_encodings[] = { +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -<<<<<<< HEAD -/** - * Implementation of payload_t.verify. - */ -static status_t verify(private_cp_payload_t *this) -======= METHOD(payload_t, verify, status_t, private_cp_payload_t *this) ->>>>>>> upstream/4.5.1 { status_t status = SUCCESS; enumerator_t *enumerator; @@ -189,22 +142,6 @@ METHOD(payload_t, verify, status_t, return status; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_encoding_rules. - */ -static void get_encoding_rules(private_cp_payload_t *this, - encoding_rule_t **rules, size_t *rule_count) -{ - *rules = cp_payload_encodings; - *rule_count = sizeof(cp_payload_encodings) / sizeof(encoding_rule_t); -} - -/** - * Implementation of payload_t.get_type. - */ -static payload_type_t get_type(private_cp_payload_t *this) -======= METHOD(payload_t, get_encoding_rules, void, private_cp_payload_t *this, encoding_rule_t **rules, size_t *rule_count) { @@ -214,33 +151,18 @@ METHOD(payload_t, get_encoding_rules, void, METHOD(payload_t, get_type, payload_type_t, private_cp_payload_t *this) ->>>>>>> upstream/4.5.1 { return CONFIGURATION; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_next_type. - */ -static payload_type_t get_next_type(private_cp_payload_t *this) -======= METHOD(payload_t, get_next_type, payload_type_t, private_cp_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->next_payload; } -<<<<<<< HEAD -/** - * Implementation of payload_t.set_next_type. - */ -static void set_next_type(private_cp_payload_t *this,payload_type_t type) -======= METHOD(payload_t, set_next_type, void, private_cp_payload_t *this,payload_type_t type) ->>>>>>> upstream/4.5.1 { this->next_payload = type; } @@ -263,69 +185,33 @@ static void compute_length(private_cp_payload_t *this) enumerator->destroy(enumerator); } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_length. - */ -static size_t get_length(private_cp_payload_t *this) -======= METHOD(payload_t, get_length, size_t, private_cp_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->payload_length; } -<<<<<<< HEAD -/** - * Implementation of cp_payload_t.create_attribute_enumerator. - */ -static enumerator_t *create_attribute_enumerator(private_cp_payload_t *this) -======= METHOD(cp_payload_t, create_attribute_enumerator, enumerator_t*, private_cp_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->attributes->create_enumerator(this->attributes); } -<<<<<<< HEAD -/** - * Implementation of cp_payload_t.add_attribute. - */ -static void add_attribute(private_cp_payload_t *this, - configuration_attribute_t *attribute) -======= METHOD(cp_payload_t, add_attribute, void, private_cp_payload_t *this, configuration_attribute_t *attribute) ->>>>>>> upstream/4.5.1 { this->attributes->insert_last(this->attributes, attribute); compute_length(this); } -<<<<<<< HEAD -/** - * Implementation of cp_payload_t.get_type. - */ -static config_type_t get_config_type(private_cp_payload_t *this) -======= METHOD(cp_payload_t, get_config_type, config_type_t, private_cp_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->type; } -<<<<<<< HEAD -/** - * Implementation of payload_t.destroy and cp_payload_t.destroy. - */ -static void destroy(private_cp_payload_t *this) -======= METHOD2(payload_t, cp_payload_t, destroy, void, private_cp_payload_t *this) ->>>>>>> upstream/4.5.1 { this->attributes->destroy_offset(this->attributes, offsetof(configuration_attribute_t, destroy)); @@ -335,32 +221,6 @@ METHOD2(payload_t, cp_payload_t, destroy, void, /* * Described in header. */ -<<<<<<< HEAD -cp_payload_t *cp_payload_create() -{ - private_cp_payload_t *this = malloc_thing(private_cp_payload_t); - - this->public.payload_interface.verify = (status_t (*) (payload_t *))verify; - this->public.payload_interface.get_encoding_rules = (void (*) (payload_t *, encoding_rule_t **, size_t *) ) get_encoding_rules; - this->public.payload_interface.get_length = (size_t (*) (payload_t *)) get_length; - this->public.payload_interface.get_next_type = (payload_type_t (*) (payload_t *)) get_next_type; - this->public.payload_interface.set_next_type = (void (*) (payload_t *,payload_type_t)) set_next_type; - this->public.payload_interface.get_type = (payload_type_t (*) (payload_t *)) get_type; - this->public.payload_interface.destroy = (void (*) (payload_t *))destroy; - - this->public.create_attribute_enumerator = (enumerator_t*(*)(cp_payload_t *))create_attribute_enumerator; - this->public.add_attribute = (void (*) (cp_payload_t *,configuration_attribute_t*))add_attribute; - this->public.get_type = (config_type_t (*) (cp_payload_t *))get_config_type; - this->public.destroy = (void (*)(cp_payload_t *))destroy; - - /* set default values of the fields */ - this->critical = FALSE; - this->next_payload = NO_PAYLOAD; - this->payload_length = CP_PAYLOAD_HEADER_LENGTH; - this->attributes = linked_list_create(); - this->type = CFG_REQUEST; - -======= cp_payload_t *cp_payload_create_type(config_type_t type) { private_cp_payload_t *this; @@ -386,26 +246,13 @@ cp_payload_t *cp_payload_create_type(config_type_t type) .attributes = linked_list_create(), .type = type, ); ->>>>>>> upstream/4.5.1 return &this->public; } /* * Described in header. */ -<<<<<<< HEAD -cp_payload_t *cp_payload_create_type(config_type_t type) -{ - private_cp_payload_t *this = (private_cp_payload_t*)cp_payload_create(); - - this->type = type; - - return &this->public; -} - -======= cp_payload_t *cp_payload_create() { return cp_payload_create_type(CFG_REQUEST); } ->>>>>>> upstream/4.5.1 diff --git a/src/libcharon/encoding/payloads/delete_payload.c b/src/libcharon/encoding/payloads/delete_payload.c index 4e94ff417..e6ee07d39 100644 --- a/src/libcharon/encoding/payloads/delete_payload.c +++ b/src/libcharon/encoding/payloads/delete_payload.c @@ -43,14 +43,11 @@ struct private_delete_payload_t { bool critical; /** -<<<<<<< HEAD -======= * reserved bits */ bool reserved[7]; /** ->>>>>>> upstream/4.5.1 * Length of this payload. */ u_int16_t payload_length; @@ -87,16 +84,6 @@ encoding_rule_t delete_payload_encodings[] = { { U_INT_8, offsetof(private_delete_payload_t, next_payload) }, /* the critical bit */ { FLAG, offsetof(private_delete_payload_t, critical) }, -<<<<<<< HEAD - /* 7 Bit reserved bits, nowhere stored */ - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, -======= /* 7 Bit reserved bits */ { RESERVED_BIT, offsetof(private_delete_payload_t, reserved[0]) }, { RESERVED_BIT, offsetof(private_delete_payload_t, reserved[1]) }, @@ -105,7 +92,6 @@ encoding_rule_t delete_payload_encodings[] = { { RESERVED_BIT, offsetof(private_delete_payload_t, reserved[4]) }, { RESERVED_BIT, offsetof(private_delete_payload_t, reserved[5]) }, { RESERVED_BIT, offsetof(private_delete_payload_t, reserved[6]) }, ->>>>>>> upstream/4.5.1 /* Length of the whole payload*/ { PAYLOAD_LENGTH, offsetof(private_delete_payload_t, payload_length) }, { U_INT_8, offsetof(private_delete_payload_t, protocol_id) }, diff --git a/src/libcharon/encoding/payloads/eap_payload.c b/src/libcharon/encoding/payloads/eap_payload.c index 8f5c8700a..eafb668b6 100644 --- a/src/libcharon/encoding/payloads/eap_payload.c +++ b/src/libcharon/encoding/payloads/eap_payload.c @@ -43,14 +43,11 @@ struct private_eap_payload_t { bool critical; /** -<<<<<<< HEAD -======= * Reserved bits */ bool reserved[7]; /** ->>>>>>> upstream/4.5.1 * Length of this payload. */ u_int16_t payload_length; @@ -74,15 +71,6 @@ static encoding_rule_t eap_payload_encodings[] = { /* the critical bit */ { FLAG, offsetof(private_eap_payload_t, critical) }, /* 7 Bit reserved bits, nowhere stored */ -<<<<<<< HEAD - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, -======= { RESERVED_BIT, offsetof(private_eap_payload_t, reserved[0]) }, { RESERVED_BIT, offsetof(private_eap_payload_t, reserved[1]) }, { RESERVED_BIT, offsetof(private_eap_payload_t, reserved[2]) }, @@ -90,7 +78,6 @@ static encoding_rule_t eap_payload_encodings[] = { { RESERVED_BIT, offsetof(private_eap_payload_t, reserved[4]) }, { RESERVED_BIT, offsetof(private_eap_payload_t, reserved[5]) }, { RESERVED_BIT, offsetof(private_eap_payload_t, reserved[6]) }, ->>>>>>> upstream/4.5.1 /* Length of the whole payload*/ { PAYLOAD_LENGTH, offsetof(private_eap_payload_t, payload_length) }, /* chunt to data, starting at "code" */ diff --git a/src/libcharon/encoding/payloads/id_payload.c b/src/libcharon/encoding/payloads/id_payload.c index 58250e766..3befadfe2 100644 --- a/src/libcharon/encoding/payloads/id_payload.c +++ b/src/libcharon/encoding/payloads/id_payload.c @@ -1,12 +1,7 @@ /* -<<<<<<< HEAD - * Copyright (C) 2007 Tobias Brunner - * Copyright (C) 2005-2006 Martin Willi -======= * Copyright (C) 2005-2010 Martin Willi * Copyright (C) 2010 revosec AG * Copyright (C) 2007 Tobias Brunner ->>>>>>> upstream/4.5.1 * Copyright (C) 2005 Jan Hutter * * Hochschule fuer Technik Rapperswil @@ -57,8 +52,6 @@ struct private_id_payload_t { bool critical; /** -<<<<<<< HEAD -======= * Reserved bits */ bool reserved_bit[7]; @@ -69,7 +62,6 @@ struct private_id_payload_t { u_int8_t reserved_byte[3]; /** ->>>>>>> upstream/4.5.1 * Length of this payload. */ u_int16_t payload_length; @@ -90,26 +82,12 @@ struct private_id_payload_t { * * The defined offsets are the positions in a object of type * private_id_payload_t. -<<<<<<< HEAD - * -======= ->>>>>>> upstream/4.5.1 */ encoding_rule_t id_payload_encodings[] = { /* 1 Byte next payload type, stored in the field next_payload */ { U_INT_8, offsetof(private_id_payload_t, next_payload) }, /* the critical bit */ { FLAG, offsetof(private_id_payload_t, critical) }, -<<<<<<< HEAD - /* 7 Bit reserved bits, nowhere stored */ - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, -======= /* 7 Bit reserved bits */ { RESERVED_BIT, offsetof(private_id_payload_t, reserved_bit[0]) }, { RESERVED_BIT, offsetof(private_id_payload_t, reserved_bit[1]) }, @@ -118,25 +96,16 @@ encoding_rule_t id_payload_encodings[] = { { RESERVED_BIT, offsetof(private_id_payload_t, reserved_bit[4]) }, { RESERVED_BIT, offsetof(private_id_payload_t, reserved_bit[5]) }, { RESERVED_BIT, offsetof(private_id_payload_t, reserved_bit[6]) }, ->>>>>>> upstream/4.5.1 /* Length of the whole payload*/ { PAYLOAD_LENGTH, offsetof(private_id_payload_t, payload_length) }, /* 1 Byte ID type*/ { U_INT_8, offsetof(private_id_payload_t, id_type) }, /* 3 reserved bytes */ -<<<<<<< HEAD - { RESERVED_BYTE, 0 }, - { RESERVED_BYTE, 0 }, - { RESERVED_BYTE, 0 }, - /* some id data bytes, length is defined in PAYLOAD_LENGTH */ - { ID_DATA, offsetof(private_id_payload_t, id_data) } -======= { RESERVED_BYTE, offsetof(private_id_payload_t, reserved_byte[0])}, { RESERVED_BYTE, offsetof(private_id_payload_t, reserved_byte[1])}, { RESERVED_BYTE, offsetof(private_id_payload_t, reserved_byte[2])}, /* some id data bytes, length is defined in PAYLOAD_LENGTH */ { ID_DATA, offsetof(private_id_payload_t, id_data) } ->>>>>>> upstream/4.5.1 }; /* @@ -153,46 +122,15 @@ encoding_rule_t id_payload_encodings[] = { +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -<<<<<<< HEAD -/** - * Implementation of payload_t.verify. - */ -static status_t verify(private_id_payload_t *this) -{ - if ((this->id_type == 0) || - (this->id_type == 4) || - ((this->id_type >= 6) && (this->id_type <= 8)) || - ((this->id_type >= 12) && (this->id_type <= 200))) -======= METHOD(payload_t, verify, status_t, private_id_payload_t *this) { if (this->id_type == 0 || this->id_type == 4) ->>>>>>> upstream/4.5.1 { /* reserved IDs */ DBG1(DBG_ENC, "received ID with reserved type %d", this->id_type); return FAILED; } -<<<<<<< HEAD - - return SUCCESS; -} - -/** - * Implementation of id_payload_t.get_encoding_rules. - */ -static void get_encoding_rules(private_id_payload_t *this, encoding_rule_t **rules, size_t *rule_count) -{ - *rules = id_payload_encodings; - *rule_count = sizeof(id_payload_encodings) / sizeof(encoding_rule_t); -} - -/** - * Implementation of payload_t.get_type. - */ -static payload_type_t get_payload_type(private_id_payload_t *this) -======= return SUCCESS; } @@ -205,123 +143,28 @@ METHOD(payload_t, get_encoding_rules, void, METHOD(payload_t, get_type, payload_type_t, private_id_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->payload_type; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_next_type. - */ -static payload_type_t get_next_type(private_id_payload_t *this) -======= METHOD(payload_t, get_next_type, payload_type_t, private_id_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->next_payload; } -<<<<<<< HEAD -/** - * Implementation of payload_t.set_next_type. - */ -static void set_next_type(private_id_payload_t *this,payload_type_t type) -======= METHOD(payload_t, set_next_type, void, private_id_payload_t *this, payload_type_t type) ->>>>>>> upstream/4.5.1 { this->next_payload = type; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_length. - */ -static size_t get_length(private_id_payload_t *this) -======= METHOD(payload_t, get_length, size_t, private_id_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->payload_length; } -<<<<<<< HEAD -/** - * Implementation of id_payload_t.set_type. - */ -static void set_id_type (private_id_payload_t *this, id_type_t type) -{ - this->id_type = type; -} - -/** - * Implementation of id_payload_t.get_id_type. - */ -static id_type_t get_id_type (private_id_payload_t *this) -{ - return (this->id_type); -} - -/** - * Implementation of id_payload_t.set_data. - */ -static void set_data (private_id_payload_t *this, chunk_t data) -{ - if (this->id_data.ptr != NULL) - { - chunk_free(&(this->id_data)); - } - this->id_data.ptr = clalloc(data.ptr,data.len); - this->id_data.len = data.len; - this->payload_length = ID_PAYLOAD_HEADER_LENGTH + this->id_data.len; -} - - -/** - * Implementation of id_payload_t.get_data_clone. - */ -static chunk_t get_data (private_id_payload_t *this) -{ - return (this->id_data); -} - -/** - * Implementation of id_payload_t.get_data_clone. - */ -static chunk_t get_data_clone (private_id_payload_t *this) -{ - chunk_t cloned_data; - if (this->id_data.ptr == NULL) - { - return (this->id_data); - } - cloned_data.ptr = clalloc(this->id_data.ptr,this->id_data.len); - cloned_data.len = this->id_data.len; - return cloned_data; -} - -/** - * Implementation of id_payload_t.get_identification. - */ -static identification_t *get_identification (private_id_payload_t *this) -{ - return identification_create_from_encoding(this->id_type,this->id_data); -} - -/** - * Implementation of payload_t.destroy and id_payload_t.destroy. - */ -static void destroy(private_id_payload_t *this) -{ - if (this->id_data.ptr != NULL) - { - chunk_free(&(this->id_data)); - } -======= METHOD(id_payload_t, get_identification, identification_t*, private_id_payload_t *this) { @@ -332,7 +175,6 @@ METHOD2(payload_t, id_payload_t, destroy, void, private_id_payload_t *this) { free(this->id_data.ptr); ->>>>>>> upstream/4.5.1 free(this); } @@ -341,37 +183,6 @@ METHOD2(payload_t, id_payload_t, destroy, void, */ id_payload_t *id_payload_create(payload_type_t payload_type) { -<<<<<<< HEAD - private_id_payload_t *this = malloc_thing(private_id_payload_t); - - /* interface functions */ - this->public.payload_interface.verify = (status_t (*) (payload_t *))verify; - this->public.payload_interface.get_encoding_rules = (void (*) (payload_t *, encoding_rule_t **, size_t *) ) get_encoding_rules; - this->public.payload_interface.get_length = (size_t (*) (payload_t *)) get_length; - this->public.payload_interface.get_next_type = (payload_type_t (*) (payload_t *)) get_next_type; - this->public.payload_interface.set_next_type = (void (*) (payload_t *,payload_type_t)) set_next_type; - this->public.payload_interface.get_type = (payload_type_t (*) (payload_t *)) get_payload_type; - this->public.payload_interface.destroy = (void (*) (payload_t *))destroy; - - /* public functions */ - this->public.destroy = (void (*) (id_payload_t *)) destroy; - this->public.set_id_type = (void (*) (id_payload_t *,id_type_t)) set_id_type; - this->public.get_id_type = (id_type_t (*) (id_payload_t *)) get_id_type; - this->public.set_data = (void (*) (id_payload_t *,chunk_t)) set_data; - this->public.get_data = (chunk_t (*) (id_payload_t *)) get_data; - this->public.get_data_clone = (chunk_t (*) (id_payload_t *)) get_data_clone; - - this->public.get_identification = (identification_t * (*) (id_payload_t *this)) get_identification; - - /* private variables */ - this->critical = FALSE; - this->next_payload = NO_PAYLOAD; - this->payload_length =ID_PAYLOAD_HEADER_LENGTH; - this->id_data = chunk_empty; - this->payload_type = payload_type; - - return (&(this->public)); -======= private_id_payload_t *this; INIT(this, @@ -393,20 +204,11 @@ id_payload_t *id_payload_create(payload_type_t payload_type) .payload_type = payload_type, ); return &this->public; ->>>>>>> upstream/4.5.1 } /* * Described in header. */ -<<<<<<< HEAD -id_payload_t *id_payload_create_from_identification(payload_type_t payload_type, identification_t *identification) -{ - id_payload_t *this= id_payload_create(payload_type); - this->set_data(this,identification->get_encoding(identification)); - this->set_id_type(this,identification->get_type(identification)); - return this; -======= id_payload_t *id_payload_create_from_identification(payload_type_t payload_type, identification_t *id) { @@ -418,5 +220,4 @@ id_payload_t *id_payload_create_from_identification(payload_type_t payload_type, this->payload_length += this->id_data.len; return &this->public; ->>>>>>> upstream/4.5.1 } diff --git a/src/libcharon/encoding/payloads/id_payload.h b/src/libcharon/encoding/payloads/id_payload.h index b5b9c5907..99831f85f 100644 --- a/src/libcharon/encoding/payloads/id_payload.h +++ b/src/libcharon/encoding/payloads/id_payload.h @@ -40,66 +40,15 @@ typedef struct id_payload_t id_payload_t; * The ID payload format is described in RFC section 3.5. */ struct id_payload_t { -<<<<<<< HEAD -======= ->>>>>>> upstream/4.5.1 /** * The payload_t interface. */ payload_t payload_interface; /** -<<<<<<< HEAD - * Set the ID type. - * - * @param type Type of ID - */ - void (*set_id_type) (id_payload_t *this, id_type_t type); - - /** - * Get the ID type. - * - * @return type of the ID - */ - id_type_t (*get_id_type) (id_payload_t *this); - - /** - * Set the ID data. - * - * Data are getting cloned. - * - * @param data ID data as chunk_t - */ - void (*set_data) (id_payload_t *this, chunk_t data); - - /** - * Get the ID data. - * - * Returned data are a copy of the internal one - * - * @return ID data as chunk_t - */ - chunk_t (*get_data_clone) (id_payload_t *this); - - /** - * Get the ID data. - * - * Returned data are NOT copied. - * - * @return ID data as chunk_t - */ - chunk_t (*get_data) (id_payload_t *this); - - /** - * Creates an identification object of this id payload. - * - * Returned object has to get destroyed by the caller. - * -======= * Creates an identification object of this id payload. * ->>>>>>> upstream/4.5.1 * @return identification_t object */ identification_t *(*get_identification) (id_payload_t *this); diff --git a/src/libcharon/encoding/payloads/ike_header.c b/src/libcharon/encoding/payloads/ike_header.c index 1462b346b..80dcee0cb 100644 --- a/src/libcharon/encoding/payloads/ike_header.c +++ b/src/libcharon/encoding/payloads/ike_header.c @@ -84,14 +84,11 @@ struct private_ike_header_t { } flags; /** -<<<<<<< HEAD -======= * Reserved bits of IKE header */ bool reserved[5]; /** ->>>>>>> upstream/4.5.1 * Associated Message-ID. */ u_int32_t message_id; @@ -127,32 +124,6 @@ encoding_rule_t ike_header_encodings[] = { /* 8 Byte SPI, stored in the field initiator_spi */ { IKE_SPI, offsetof(private_ike_header_t, initiator_spi) }, /* 8 Byte SPI, stored in the field responder_spi */ -<<<<<<< HEAD - { IKE_SPI, offsetof(private_ike_header_t, responder_spi) }, - /* 1 Byte next payload type, stored in the field next_payload */ - { U_INT_8, offsetof(private_ike_header_t, next_payload) }, - /* 4 Bit major version, stored in the field maj_version */ - { U_INT_4, offsetof(private_ike_header_t, maj_version) }, - /* 4 Bit minor version, stored in the field min_version */ - { U_INT_4, offsetof(private_ike_header_t, min_version) }, - /* 8 Bit for the exchange type */ - { U_INT_8, offsetof(private_ike_header_t, exchange_type) }, - /* 2 Bit reserved bits, nowhere stored */ - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - /* 3 Bit flags, stored in the fields response, version and initiator */ - { FLAG, offsetof(private_ike_header_t, flags.response) }, - { FLAG, offsetof(private_ike_header_t, flags.version) }, - { FLAG, offsetof(private_ike_header_t, flags.initiator) }, - /* 3 Bit reserved bits, nowhere stored */ - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - /* 4 Byte message id, stored in the field message_id */ - { U_INT_32, offsetof(private_ike_header_t, message_id) }, - /* 4 Byte length fied, stored in the field length */ - { HEADER_LENGTH, offsetof(private_ike_header_t, length) } -======= { IKE_SPI, offsetof(private_ike_header_t, responder_spi) }, /* 1 Byte next payload type, stored in the field next_payload */ { U_INT_8, offsetof(private_ike_header_t, next_payload) }, @@ -177,7 +148,6 @@ encoding_rule_t ike_header_encodings[] = { { U_INT_32, offsetof(private_ike_header_t, message_id) }, /* 4 Byte length fied, stored in the field length */ { HEADER_LENGTH,offsetof(private_ike_header_t, length) }, ->>>>>>> upstream/4.5.1 }; @@ -198,16 +168,8 @@ encoding_rule_t ike_header_encodings[] = { +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -<<<<<<< HEAD - -/** - * Implementation of payload_t.verify. - */ -static status_t verify(private_ike_header_t *this) -======= METHOD(payload_t, verify, status_t, private_ike_header_t *this) ->>>>>>> upstream/4.5.1 { if ((this->exchange_type < IKE_SA_INIT) || ((this->exchange_type > INFORMATIONAL) @@ -219,10 +181,6 @@ METHOD(payload_t, verify, status_t, /* unsupported exchange type */ return FAILED; } -<<<<<<< HEAD - -======= ->>>>>>> upstream/4.5.1 if (this->initiator_spi == 0 #ifdef ME /* we allow zero spi for INFORMATIONAL exchanges, @@ -234,25 +192,6 @@ METHOD(payload_t, verify, status_t, /* initiator spi not set */ return FAILED; } -<<<<<<< HEAD - - /* verification of version is not done in here */ - - return SUCCESS; -} - -/** - * Implementation of payload_t.set_next_type. - */ -static void set_next_type(payload_t *this,payload_type_t type) -{ - ((private_ike_header_t *)this)->next_payload = type; -} -/** - * Implementation of ike_header_t.get_initiator_spi. - */ -static u_int64_t get_initiator_spi(private_ike_header_t *this) -======= return SUCCESS; } @@ -289,69 +228,34 @@ METHOD(payload_t, get_length, size_t, METHOD(ike_header_t, get_initiator_spi, u_int64_t, private_ike_header_t *this) ->>>>>>> upstream/4.5.1 { return this->initiator_spi; } -<<<<<<< HEAD -/** - * Implementation of ike_header_t.set_initiator_spi. - */ -static void set_initiator_spi(private_ike_header_t *this, u_int64_t initiator_spi) -======= METHOD(ike_header_t, set_initiator_spi, void, private_ike_header_t *this, u_int64_t initiator_spi) ->>>>>>> upstream/4.5.1 { this->initiator_spi = initiator_spi; } -<<<<<<< HEAD -/** - * Implementation of ike_header_t.get_responder_spi. - */ -static u_int64_t get_responder_spi(private_ike_header_t *this) -======= METHOD(ike_header_t, get_responder_spi, u_int64_t, private_ike_header_t *this) ->>>>>>> upstream/4.5.1 { return this->responder_spi; } -<<<<<<< HEAD -/** - * Implementation of ike_header_t.set_responder_spi. - */ -static void set_responder_spi(private_ike_header_t *this, u_int64_t responder_spi) -======= METHOD(ike_header_t, set_responder_spi, void, private_ike_header_t *this, u_int64_t responder_spi) ->>>>>>> upstream/4.5.1 { this->responder_spi = responder_spi; } -<<<<<<< HEAD -/** - * Implementation of ike_header_t.get_maj_version. - */ -static u_int8_t get_maj_version(private_ike_header_t *this) -======= METHOD(ike_header_t, get_maj_version, u_int8_t, private_ike_header_t *this) ->>>>>>> upstream/4.5.1 { return this->maj_version; } -<<<<<<< HEAD -/** - * Implementation of ike_header_t.get_min_version. - */ -static u_int8_t get_min_version(private_ike_header_t *this) -======= METHOD(ike_header_t, set_maj_version, void, private_ike_header_t *this, u_int8_t major) { @@ -360,17 +264,10 @@ METHOD(ike_header_t, set_maj_version, void, METHOD(ike_header_t, get_min_version, u_int8_t, private_ike_header_t *this) ->>>>>>> upstream/4.5.1 { return this->min_version; } -<<<<<<< HEAD -/** - * Implementation of ike_header_t.get_response_flag. - */ -static bool get_response_flag(private_ike_header_t *this) -======= METHOD(ike_header_t, set_min_version, void, private_ike_header_t *this, u_int8_t minor) { @@ -379,43 +276,22 @@ METHOD(ike_header_t, set_min_version, void, METHOD(ike_header_t, get_response_flag, bool, private_ike_header_t *this) ->>>>>>> upstream/4.5.1 { return this->flags.response; } -<<<<<<< HEAD -/** - * Implementation of ike_header_t.set_response_flag. - */ -static void set_response_flag(private_ike_header_t *this, bool response) -======= METHOD(ike_header_t, set_response_flag, void, private_ike_header_t *this, bool response) ->>>>>>> upstream/4.5.1 { this->flags.response = response; } -<<<<<<< HEAD -/** - * Implementation of ike_header_t.get_version_flag. - */ -static bool get_version_flag(private_ike_header_t *this) -======= METHOD(ike_header_t, get_version_flag, bool, private_ike_header_t *this) ->>>>>>> upstream/4.5.1 { return this->flags.version; } -<<<<<<< HEAD -/** - * Implementation of ike_header_t.get_initiator_flag. - */ -static bool get_initiator_flag(private_ike_header_t *this) -======= METHOD(ike_header_t, set_version_flag, void, private_ike_header_t *this, bool version) { @@ -424,174 +300,51 @@ METHOD(ike_header_t, set_version_flag, void, METHOD(ike_header_t, get_initiator_flag, bool, private_ike_header_t *this) ->>>>>>> upstream/4.5.1 { return this->flags.initiator; } -<<<<<<< HEAD -/** - * Implementation of ike_header_t.set_initiator_flag. - */ -static void set_initiator_flag(private_ike_header_t *this, bool initiator) -======= METHOD(ike_header_t, set_initiator_flag, void, private_ike_header_t *this, bool initiator) ->>>>>>> upstream/4.5.1 { this->flags.initiator = initiator; } -<<<<<<< HEAD -/** - * Implementation of ike_header_t.get_exchange_type. - */ -static u_int8_t get_exchange_type(private_ike_header_t *this) -======= METHOD(ike_header_t, get_exchange_type, u_int8_t, private_ike_header_t *this) ->>>>>>> upstream/4.5.1 { return this->exchange_type; } -<<<<<<< HEAD -/** - * Implementation of ike_header_t.set_exchange_type. - */ -static void set_exchange_type(private_ike_header_t *this, u_int8_t exchange_type) -======= METHOD(ike_header_t, set_exchange_type, void, private_ike_header_t *this, u_int8_t exchange_type) ->>>>>>> upstream/4.5.1 { this->exchange_type = exchange_type; } -<<<<<<< HEAD -/** - * Implements ike_header_t's get_message_id function. - * See #ike_header_t.get_message_id for description. - */ -static u_int32_t get_message_id(private_ike_header_t *this) -======= METHOD(ike_header_t, get_message_id, u_int32_t, private_ike_header_t *this) ->>>>>>> upstream/4.5.1 { return this->message_id; } -<<<<<<< HEAD -/** - * Implementation of ike_header_t.set_message_id. - */ -static void set_message_id(private_ike_header_t *this, u_int32_t message_id) -======= METHOD(ike_header_t, set_message_id, void, private_ike_header_t *this, u_int32_t message_id) ->>>>>>> upstream/4.5.1 { this->message_id = message_id; } -<<<<<<< HEAD -/** - * Implementation of ike_header_t.destroy and payload_t.destroy. - */ -static void destroy(ike_header_t *this) -======= METHOD2(payload_t, ike_header_t, destroy, void, private_ike_header_t *this) ->>>>>>> upstream/4.5.1 { free(this); } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_encoding_rules. - */ -static void get_encoding_rules(payload_t *this, encoding_rule_t **rules, size_t *rule_count) -{ - *rules = ike_header_encodings; - *rule_count = sizeof(ike_header_encodings) / sizeof(encoding_rule_t); -} - -/** - * Implementation of payload_t.get_type. - */ -static payload_type_t get_type(payload_t *this) -{ - return HEADER; -} - -/** - * Implementation of payload_t.get_next_type. - */ -static payload_type_t get_next_type(payload_t *this) -{ - return (((private_ike_header_t*)this)->next_payload); -} - -/** - * Implementation of payload_t.get_length. - */ -static size_t get_length(payload_t *this) -{ - return (((private_ike_header_t*)this)->length); -} - -======= ->>>>>>> upstream/4.5.1 /* * Described in header. */ ike_header_t *ike_header_create() { -<<<<<<< HEAD - private_ike_header_t *this = malloc_thing(private_ike_header_t); - - this->public.payload_interface.verify = (status_t (*) (payload_t *))verify; - this->public.payload_interface.get_encoding_rules = get_encoding_rules; - this->public.payload_interface.get_length = get_length; - this->public.payload_interface.get_next_type = get_next_type; - this->public.payload_interface.set_next_type = set_next_type; - this->public.payload_interface.get_type = get_type; - this->public.payload_interface.destroy = (void (*) (payload_t *))destroy; - this->public.destroy = destroy; - - this->public.get_initiator_spi = (u_int64_t (*) (ike_header_t*))get_initiator_spi; - this->public.set_initiator_spi = (void (*) (ike_header_t*,u_int64_t))set_initiator_spi; - this->public.get_responder_spi = (u_int64_t (*) (ike_header_t*))get_responder_spi; - this->public.set_responder_spi = (void (*) (ike_header_t *,u_int64_t))set_responder_spi; - this->public.get_maj_version = (u_int8_t (*) (ike_header_t*))get_maj_version; - this->public.get_min_version = (u_int8_t (*) (ike_header_t*))get_min_version; - this->public.get_response_flag = (bool (*) (ike_header_t*))get_response_flag; - this->public.set_response_flag = (void (*) (ike_header_t*,bool))set_response_flag; - this->public.get_version_flag = (bool (*) (ike_header_t*))get_version_flag; - this->public.get_initiator_flag = (bool (*) (ike_header_t*))get_initiator_flag; - this->public.set_initiator_flag = (void (*) (ike_header_t*,bool))set_initiator_flag; - this->public.get_exchange_type = (u_int8_t (*) (ike_header_t*))get_exchange_type; - this->public.set_exchange_type = (void (*) (ike_header_t*,u_int8_t))set_exchange_type; - this->public.get_message_id = (u_int32_t (*) (ike_header_t*))get_message_id; - this->public.set_message_id = (void (*) (ike_header_t*,u_int32_t))set_message_id; - - /* set default values of the fields */ - this->initiator_spi = 0; - this->responder_spi = 0; - this->next_payload = 0; - this->maj_version = IKE_MAJOR_VERSION; - this->min_version = IKE_MINOR_VERSION; - this->exchange_type = EXCHANGE_TYPE_UNDEFINED; - this->flags.initiator = TRUE; - this->flags.version = HIGHER_VERSION_SUPPORTED_FLAG; - this->flags.response = FALSE; - this->message_id = 0; - this->length = IKE_HEADER_LENGTH; - - return (ike_header_t*)this; -======= private_ike_header_t *this; INIT(this, @@ -636,5 +389,4 @@ ike_header_t *ike_header_create() ); return &this->public; ->>>>>>> upstream/4.5.1 } diff --git a/src/libcharon/encoding/payloads/ike_header.h b/src/libcharon/encoding/payloads/ike_header.h index 77e23efb7..f52c852c5 100644 --- a/src/libcharon/encoding/payloads/ike_header.h +++ b/src/libcharon/encoding/payloads/ike_header.h @@ -143,8 +143,6 @@ struct ike_header_t { u_int8_t (*get_maj_version) (ike_header_t *this); /** -<<<<<<< HEAD -======= * Set the major version. * * @param major major version @@ -152,7 +150,6 @@ struct ike_header_t { void (*set_maj_version) (ike_header_t *this, u_int8_t major); /** ->>>>>>> upstream/4.5.1 * Get the minor version. * * @return minor version @@ -160,8 +157,6 @@ struct ike_header_t { u_int8_t (*get_min_version) (ike_header_t *this); /** -<<<<<<< HEAD -======= * Set the minor version. * * @param minor minor version @@ -169,7 +164,6 @@ struct ike_header_t { void (*set_min_version) (ike_header_t *this, u_int8_t minor); /** ->>>>>>> upstream/4.5.1 * Get the response flag. * * @return response flag @@ -182,10 +176,7 @@ struct ike_header_t { * @param response response flag */ void (*set_response_flag) (ike_header_t *this, bool response); -<<<<<<< HEAD -======= ->>>>>>> upstream/4.5.1 /** * Get "higher version supported"-flag. * @@ -194,8 +185,6 @@ struct ike_header_t { bool (*get_version_flag) (ike_header_t *this); /** -<<<<<<< HEAD -======= * Set the "higher version supported"-flag. * * @param version flag value @@ -203,7 +192,6 @@ struct ike_header_t { void (*set_version_flag)(ike_header_t *this, bool version); /** ->>>>>>> upstream/4.5.1 * Get the initiator flag. * * @return initiator flag diff --git a/src/libcharon/encoding/payloads/ke_payload.c b/src/libcharon/encoding/payloads/ke_payload.c index dd239b212..999d73192 100644 --- a/src/libcharon/encoding/payloads/ke_payload.c +++ b/src/libcharon/encoding/payloads/ke_payload.c @@ -1,10 +1,6 @@ /* -<<<<<<< HEAD - * Copyright (C) 2005-2006 Martin Willi -======= * Copyright (C) 2005-2010 Martin Willi * Copyright (C) 2010 revosec AG ->>>>>>> upstream/4.5.1 * Copyright (C) 2005 Jan Hutter * Hochschule fuer Technik Rapperswil * @@ -25,23 +21,13 @@ #include <encoding/payloads/encodings.h> -<<<<<<< HEAD - -======= ->>>>>>> upstream/4.5.1 typedef struct private_ke_payload_t private_ke_payload_t; /** * Private data of an ke_payload_t object. -<<<<<<< HEAD - * - */ -struct private_ke_payload_t { -======= */ struct private_ke_payload_t { ->>>>>>> upstream/4.5.1 /** * Public ke_payload_t interface. */ @@ -58,8 +44,6 @@ struct private_ke_payload_t { bool critical; /** -<<<<<<< HEAD -======= * Reserved bits */ bool reserved_bit[7]; @@ -70,7 +54,6 @@ struct private_ke_payload_t { u_int8_t reserved_byte[2]; /** ->>>>>>> upstream/4.5.1 * Length of this payload. */ u_int16_t payload_length; @@ -91,29 +74,6 @@ struct private_ke_payload_t { * * The defined offsets are the positions in a object of type * private_ke_payload_t. -<<<<<<< HEAD - * - */ -encoding_rule_t ke_payload_encodings[] = { - /* 1 Byte next payload type, stored in the field next_payload */ - { U_INT_8, offsetof(private_ke_payload_t, next_payload) }, - /* the critical bit */ - { FLAG, offsetof(private_ke_payload_t, critical) }, - /* 7 Bit reserved bits, nowhere stored */ - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - /* Length of the whole payload*/ - { PAYLOAD_LENGTH, offsetof(private_ke_payload_t, payload_length) }, - /* DH Group number as 16 bit field*/ - { U_INT_16, offsetof(private_ke_payload_t, dh_group_number) }, - { RESERVED_BYTE, 0 }, - { RESERVED_BYTE, 0 }, -======= */ encoding_rule_t ke_payload_encodings[] = { /* 1 Byte next payload type, stored in the field next_payload */ @@ -135,7 +95,6 @@ encoding_rule_t ke_payload_encodings[] = { /* 2 reserved bytes */ { RESERVED_BYTE, offsetof(private_ke_payload_t, reserved_byte[0])}, { RESERVED_BYTE, offsetof(private_ke_payload_t, reserved_byte[1])}, ->>>>>>> upstream/4.5.1 /* Key Exchange Data is from variable size */ { KEY_EXCHANGE_DATA, offsetof(private_ke_payload_t, key_exchange_data)} }; @@ -154,42 +113,6 @@ encoding_rule_t ke_payload_encodings[] = { +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -<<<<<<< HEAD -/** - * Implementation of payload_t.verify. - */ -static status_t verify(private_ke_payload_t *this) -{ - /* dh group is not verified in here */ - return SUCCESS; -} - -/** - * Implementation of payload_t.destroy. - */ -static void destroy(private_ke_payload_t *this) -{ - if (this->key_exchange_data.ptr != NULL) - { - free(this->key_exchange_data.ptr); - } - free(this); -} - -/** - * Implementation of payload_t.get_encoding_rules. - */ -static void get_encoding_rules(private_ke_payload_t *this, encoding_rule_t **rules, size_t *rule_count) -{ - *rules = ke_payload_encodings; - *rule_count = sizeof(ke_payload_encodings) / sizeof(encoding_rule_t); -} - -/** - * Implementation of payload_t.get_type. - */ -static payload_type_t get_type(private_ke_payload_t *this) -======= METHOD(payload_t, verify, status_t, private_ke_payload_t *this) { @@ -205,25 +128,10 @@ METHOD(payload_t, get_encoding_rules, void, METHOD(payload_t, get_type, payload_type_t, private_ke_payload_t *this) ->>>>>>> upstream/4.5.1 { return KEY_EXCHANGE; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_next_type. - */ -static payload_type_t get_next_type(private_ke_payload_t *this) -{ - return (this->next_payload); -} - -/** - * Implementation of payload_t.set_next_type. - */ -static void set_next_type(private_ke_payload_t *this,payload_type_t type) -======= METHOD(payload_t, get_next_type, payload_type_t, private_ke_payload_t *this) { @@ -232,66 +140,10 @@ METHOD(payload_t, get_next_type, payload_type_t, METHOD(payload_t, set_next_type, void, private_ke_payload_t *this,payload_type_t type) ->>>>>>> upstream/4.5.1 { this->next_payload = type; } -<<<<<<< HEAD -/** - * recompute the length of the payload. - */ -static void compute_length(private_ke_payload_t *this) -{ - size_t length = KE_PAYLOAD_HEADER_LENGTH; - if (this->key_exchange_data.ptr != NULL) - { - length += this->key_exchange_data.len; - } - this->payload_length = length; -} - -/** - * Implementation of payload_t.get_length. - */ -static size_t get_length(private_ke_payload_t *this) -{ - compute_length(this); - return this->payload_length; -} - -/** - * Implementation of ke_payload_t.get_key_exchange_data. - */ -static chunk_t get_key_exchange_data(private_ke_payload_t *this) -{ - return (this->key_exchange_data); -} - -/** - * Implementation of ke_payload_t.set_key_exchange_data. - */ -static void set_key_exchange_data(private_ke_payload_t *this, chunk_t key_exchange_data) -{ - /* destroy existing data first */ - if (this->key_exchange_data.ptr != NULL) - { - /* free existing value */ - free(this->key_exchange_data.ptr); - this->key_exchange_data.ptr = NULL; - this->key_exchange_data.len = 0; - - } - - this->key_exchange_data = chunk_clone(key_exchange_data); - compute_length(this); -} - -/** - * Implementation of ke_payload_t.get_dh_group_number. - */ -static diffie_hellman_group_t get_dh_group_number(private_ke_payload_t *this) -======= METHOD(payload_t, get_length, size_t, private_ke_payload_t *this) { @@ -306,25 +158,15 @@ METHOD(ke_payload_t, get_key_exchange_data, chunk_t, METHOD(ke_payload_t, get_dh_group_number, diffie_hellman_group_t, private_ke_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->dh_group_number; } -<<<<<<< HEAD -/** - * Implementation of ke_payload_t.set_dh_group_number. - */ -static void set_dh_group_number(private_ke_payload_t *this, diffie_hellman_group_t dh_group_number) -{ - this->dh_group_number = dh_group_number; -======= METHOD2(payload_t, ke_payload_t, destroy, void, private_ke_payload_t *this) { free(this->key_exchange_data.ptr); free(this); ->>>>>>> upstream/4.5.1 } /* @@ -332,33 +174,6 @@ METHOD2(payload_t, ke_payload_t, destroy, void, */ ke_payload_t *ke_payload_create() { -<<<<<<< HEAD - private_ke_payload_t *this = malloc_thing(private_ke_payload_t); - - /* interface functions */ - this->public.payload_interface.verify = (status_t (*) (payload_t *))verify; - this->public.payload_interface.get_encoding_rules = (void (*) (payload_t *, encoding_rule_t **, size_t *) ) get_encoding_rules; - this->public.payload_interface.get_length = (size_t (*) (payload_t *)) get_length; - this->public.payload_interface.get_next_type = (payload_type_t (*) (payload_t *)) get_next_type; - this->public.payload_interface.set_next_type = (void (*) (payload_t *,payload_type_t)) set_next_type; - this->public.payload_interface.get_type = (payload_type_t (*) (payload_t *)) get_type; - this->public.payload_interface.destroy = (void (*) (payload_t *))destroy; - - /* public functions */ - this->public.get_key_exchange_data = (chunk_t (*) (ke_payload_t *)) get_key_exchange_data; - this->public.set_key_exchange_data = (void (*) (ke_payload_t *,chunk_t)) set_key_exchange_data; - this->public.get_dh_group_number = (diffie_hellman_group_t (*) (ke_payload_t *)) get_dh_group_number; - this->public.set_dh_group_number =(void (*) (ke_payload_t *,diffie_hellman_group_t)) set_dh_group_number; - this->public.destroy = (void (*) (ke_payload_t *)) destroy; - - /* set default values of the fields */ - this->critical = FALSE; - this->next_payload = NO_PAYLOAD; - this->payload_length = KE_PAYLOAD_HEADER_LENGTH; - this->key_exchange_data = chunk_empty; - this->dh_group_number = MODP_NONE; - -======= private_ke_payload_t *this; INIT(this, @@ -380,7 +195,6 @@ ke_payload_t *ke_payload_create() .payload_length = KE_PAYLOAD_HEADER_LENGTH, .dh_group_number = MODP_NONE, ); ->>>>>>> upstream/4.5.1 return &this->public; } @@ -393,11 +207,7 @@ ke_payload_t *ke_payload_create_from_diffie_hellman(diffie_hellman_t *dh) dh->get_my_public_value(dh, &this->key_exchange_data); this->dh_group_number = dh->get_dh_group(dh); -<<<<<<< HEAD - compute_length(this); -======= this->payload_length = this->key_exchange_data.len + KE_PAYLOAD_HEADER_LENGTH; ->>>>>>> upstream/4.5.1 return &this->public; } diff --git a/src/libcharon/encoding/payloads/ke_payload.h b/src/libcharon/encoding/payloads/ke_payload.h index edf271add..65cc11883 100644 --- a/src/libcharon/encoding/payloads/ke_payload.h +++ b/src/libcharon/encoding/payloads/ke_payload.h @@ -47,33 +47,13 @@ struct ke_payload_t { payload_t payload_interface; /** -<<<<<<< HEAD - * Returns the currently set key exchange data of this KE payload. - * - * @warning Returned data are not copied. - * - * @return chunk_t pointing to the value -======= * Returns the key exchange data of this KE payload. * * @return chunk_t pointing to internal data ->>>>>>> upstream/4.5.1 */ chunk_t (*get_key_exchange_data) (ke_payload_t *this); /** -<<<<<<< HEAD - * Sets the key exchange data of this KE payload. - * - * Value is getting copied. - * - * @param key_exchange_data chunk_t pointing to the value to set - */ - void (*set_key_exchange_data) (ke_payload_t *this, chunk_t key_exchange_data); - - /** -======= ->>>>>>> upstream/4.5.1 * Gets the Diffie-Hellman Group Number of this KE payload. * * @return DH Group Number of this payload @@ -81,17 +61,6 @@ struct ke_payload_t { diffie_hellman_group_t (*get_dh_group_number) (ke_payload_t *this); /** -<<<<<<< HEAD - * Sets the Diffie-Hellman Group Number of this KE payload. - * - * @param dh_group_number DH Group to set - */ - void (*set_dh_group_number) (ke_payload_t *this, - diffie_hellman_group_t dh_group_number); - - /** -======= ->>>>>>> upstream/4.5.1 * Destroys an ke_payload_t object. */ void (*destroy) (ke_payload_t *this); diff --git a/src/libcharon/encoding/payloads/nonce_payload.c b/src/libcharon/encoding/payloads/nonce_payload.c index ccaf60c09..78000b8c6 100644 --- a/src/libcharon/encoding/payloads/nonce_payload.c +++ b/src/libcharon/encoding/payloads/nonce_payload.c @@ -1,10 +1,6 @@ /* -<<<<<<< HEAD - * Copyright (C) 2005-2006 Martin Willi -======= * Copyright (C) 2005-2010 Martin Willi * Copyright (C) 2010 revosec AG ->>>>>>> upstream/4.5.1 * Copyright (C) 2005 Jan Hutter * Hochschule fuer Technik Rapperswil * @@ -19,33 +15,19 @@ * for more details. */ -<<<<<<< HEAD -/* offsetof macro */ -======= ->>>>>>> upstream/4.5.1 #include <stddef.h> #include "nonce_payload.h" #include <encoding/payloads/encodings.h> -<<<<<<< HEAD - -======= ->>>>>>> upstream/4.5.1 typedef struct private_nonce_payload_t private_nonce_payload_t; /** * Private data of an nonce_payload_t object. -<<<<<<< HEAD - * - */ -struct private_nonce_payload_t { -======= */ struct private_nonce_payload_t { ->>>>>>> upstream/4.5.1 /** * Public nonce_payload_t interface. */ @@ -62,14 +44,11 @@ struct private_nonce_payload_t { bool critical; /** -<<<<<<< HEAD -======= * Reserved bits */ bool reserved[7]; /** ->>>>>>> upstream/4.5.1 * Length of this payload. */ u_int16_t payload_length; @@ -85,27 +64,6 @@ struct private_nonce_payload_t { * * The defined offsets are the positions in a object of type * private_nonce_payload_t. -<<<<<<< HEAD - * - */ -encoding_rule_t nonce_payload_encodings[] = { - /* 1 Byte next payload type, stored in the field next_payload */ - { U_INT_8, offsetof(private_nonce_payload_t, next_payload) }, - /* the critical bit */ - { FLAG, offsetof(private_nonce_payload_t, critical) }, - /* 7 Bit reserved bits, nowhere stored */ - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - /* Length of the whole nonce payload*/ - { PAYLOAD_LENGTH, offsetof(private_nonce_payload_t, payload_length) }, - /* some nonce bytes, lenth is defined in PAYLOAD_LENGTH */ - { NONCE_DATA, offsetof(private_nonce_payload_t, nonce) } -======= */ encoding_rule_t nonce_payload_encodings[] = { /* 1 Byte next payload type, stored in the field next_payload */ @@ -124,7 +82,6 @@ encoding_rule_t nonce_payload_encodings[] = { { PAYLOAD_LENGTH, offsetof(private_nonce_payload_t, payload_length) }, /* some nonce bytes, lenth is defined in PAYLOAD_LENGTH */ { NONCE_DATA, offsetof(private_nonce_payload_t, nonce) }, ->>>>>>> upstream/4.5.1 }; /* 1 2 3 @@ -138,57 +95,6 @@ encoding_rule_t nonce_payload_encodings[] = { +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -<<<<<<< HEAD -/** - * Implementation of payload_t.verify. - */ -static status_t verify(private_nonce_payload_t *this) -{ - if ((this->nonce.len < 16) || ((this->nonce.len > 256))) - { - /* nonce length is wrong */ - return FAILED; - } - - return SUCCESS; -} - -/** - * Implementation of nonce_payload_t.set_nonce. - */ -static status_t set_nonce(private_nonce_payload_t *this, chunk_t nonce) -{ - this->nonce.ptr = clalloc(nonce.ptr, nonce.len); - this->nonce.len = nonce.len; - this->payload_length = NONCE_PAYLOAD_HEADER_LENGTH + nonce.len; - return SUCCESS; -} - -/** - * Implementation of nonce_payload_t.get_nonce. - */ -static chunk_t get_nonce(private_nonce_payload_t *this) -{ - chunk_t nonce; - nonce.ptr = clalloc(this->nonce.ptr,this->nonce.len); - nonce.len = this->nonce.len; - return nonce; -} - -/** - * Implementation of nonce_payload_t.get_encoding_rules. - */ -static void get_encoding_rules(private_nonce_payload_t *this, encoding_rule_t **rules, size_t *rule_count) -{ - *rules = nonce_payload_encodings; - *rule_count = sizeof(nonce_payload_encodings) / sizeof(encoding_rule_t); -} - -/** - * Implementation of payload_t.get_type. - */ -static payload_type_t get_type(private_nonce_payload_t *this) -======= METHOD(payload_t, verify, status_t, private_nonce_payload_t *this) { @@ -208,25 +114,10 @@ METHOD(payload_t, get_encoding_rules, void, METHOD(payload_t, get_type, payload_type_t, private_nonce_payload_t *this) ->>>>>>> upstream/4.5.1 { return NONCE; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_next_type. - */ -static payload_type_t get_next_type(private_nonce_payload_t *this) -{ - return (this->next_payload); -} - -/** - * Implementation of payload_t.set_next_type. - */ -static void set_next_type(private_nonce_payload_t *this,payload_type_t type) -======= METHOD(payload_t, get_next_type, payload_type_t, private_nonce_payload_t *this) { @@ -235,40 +126,10 @@ METHOD(payload_t, get_next_type, payload_type_t, METHOD(payload_t, set_next_type, void, private_nonce_payload_t *this, payload_type_t type) ->>>>>>> upstream/4.5.1 { this->next_payload = type; } -<<<<<<< HEAD -/** - * recompute the length of the payload. - */ -static void compute_length(private_nonce_payload_t *this) -{ - this->payload_length = NONCE_PAYLOAD_HEADER_LENGTH + this->nonce.len; -} - -/** - * Implementation of payload_t.get_length. - */ -static size_t get_length(private_nonce_payload_t *this) -{ - compute_length(this); - return this->payload_length; -} - -/** - * Implementation of payload_t.destroy and nonce_payload_t.destroy. - */ -static void destroy(private_nonce_payload_t *this) -{ - if (this->nonce.ptr != NULL) - { - free(this->nonce.ptr); - } - -======= METHOD(payload_t, get_length, size_t, private_nonce_payload_t *this) { @@ -292,7 +153,6 @@ METHOD2(payload_t, nonce_payload_t, destroy, void, private_nonce_payload_t *this) { free(this->nonce.ptr); ->>>>>>> upstream/4.5.1 free(this); } @@ -301,35 +161,6 @@ METHOD2(payload_t, nonce_payload_t, destroy, void, */ nonce_payload_t *nonce_payload_create() { -<<<<<<< HEAD - private_nonce_payload_t *this = malloc_thing(private_nonce_payload_t); - - /* interface functions */ - this->public.payload_interface.verify = (status_t (*) (payload_t *))verify; - this->public.payload_interface.get_encoding_rules = (void (*) (payload_t *, encoding_rule_t **, size_t *) ) get_encoding_rules; - this->public.payload_interface.get_length = (size_t (*) (payload_t *)) get_length; - this->public.payload_interface.get_next_type = (payload_type_t (*) (payload_t *)) get_next_type; - this->public.payload_interface.set_next_type = (void (*) (payload_t *,payload_type_t)) set_next_type; - this->public.payload_interface.get_type = (payload_type_t (*) (payload_t *)) get_type; - this->public.payload_interface.destroy = (void (*) (payload_t *))destroy; - - /* public functions */ - this->public.destroy = (void (*) (nonce_payload_t *)) destroy; - this->public.set_nonce = (void (*) (nonce_payload_t *,chunk_t)) set_nonce; - this->public.get_nonce = (chunk_t (*) (nonce_payload_t *)) get_nonce; - - /* private variables */ - this->critical = FALSE; - this->next_payload = NO_PAYLOAD; - this->payload_length = NONCE_PAYLOAD_HEADER_LENGTH; - this->nonce.ptr = NULL; - this->nonce.len = 0; - - return (&(this->public)); -} - - -======= private_nonce_payload_t *this; INIT(this, @@ -352,4 +183,3 @@ nonce_payload_t *nonce_payload_create() ); return &this->public; } ->>>>>>> upstream/4.5.1 diff --git a/src/libcharon/encoding/payloads/notify_payload.c b/src/libcharon/encoding/payloads/notify_payload.c index 59668bb9d..77f15ec6d 100644 --- a/src/libcharon/encoding/payloads/notify_payload.c +++ b/src/libcharon/encoding/payloads/notify_payload.c @@ -1,14 +1,8 @@ /* -<<<<<<< HEAD - * Copyright (C) 2006-2008 Tobias Brunner - * Copyright (C) 2006 Daniel Roethlisberger - * Copyright (C) 2005-2006 Martin Willi -======= * Copyright (C) 2005-2010 Martin Willi * Copyright (C) 2010 revosec AG * Copyright (C) 2006-2008 Tobias Brunner * Copyright (C) 2006 Daniel Roethlisberger ->>>>>>> upstream/4.5.1 * Copyright (C) 2005 Jan Hutter * Hochschule fuer Technik Rapperswil * @@ -193,15 +187,9 @@ typedef struct private_notify_payload_t private_notify_payload_t; /** * Private data of an notify_payload_t object. -<<<<<<< HEAD - * - */ -struct private_notify_payload_t { -======= */ struct private_notify_payload_t { ->>>>>>> upstream/4.5.1 /** * Public notify_payload_t interface. */ @@ -218,14 +206,11 @@ struct private_notify_payload_t { bool critical; /** -<<<<<<< HEAD -======= * reserved bits */ bool reserved[7]; /** ->>>>>>> upstream/4.5.1 * Length of this payload. */ u_int16_t payload_length; @@ -261,10 +246,6 @@ struct private_notify_payload_t { * * The defined offsets are the positions in a object of type * private_notify_payload_t. -<<<<<<< HEAD - * -======= ->>>>>>> upstream/4.5.1 */ encoding_rule_t notify_payload_encodings[] = { /* 1 Byte next payload type, stored in the field next_payload */ @@ -272,15 +253,6 @@ encoding_rule_t notify_payload_encodings[] = { /* the critical bit */ { FLAG, offsetof(private_notify_payload_t, critical) }, /* 7 Bit reserved bits, nowhere stored */ -<<<<<<< HEAD - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, -======= { RESERVED_BIT, offsetof(private_notify_payload_t, reserved[0]) }, { RESERVED_BIT, offsetof(private_notify_payload_t, reserved[1]) }, { RESERVED_BIT, offsetof(private_notify_payload_t, reserved[2]) }, @@ -288,7 +260,6 @@ encoding_rule_t notify_payload_encodings[] = { { RESERVED_BIT, offsetof(private_notify_payload_t, reserved[4]) }, { RESERVED_BIT, offsetof(private_notify_payload_t, reserved[5]) }, { RESERVED_BIT, offsetof(private_notify_payload_t, reserved[6]) }, ->>>>>>> upstream/4.5.1 /* Length of the whole payload*/ { PAYLOAD_LENGTH, offsetof(private_notify_payload_t, payload_length) }, /* Protocol ID as 8 bit field*/ @@ -296,19 +267,11 @@ encoding_rule_t notify_payload_encodings[] = { /* SPI Size as 8 bit field*/ { SPI_SIZE, offsetof(private_notify_payload_t, spi_size) }, /* Notify message type as 16 bit field*/ -<<<<<<< HEAD - { U_INT_16, offsetof(private_notify_payload_t, notify_type) }, - /* SPI as variable length field*/ - { SPI, offsetof(private_notify_payload_t, spi) }, - /* Key Exchange Data is from variable size */ - { NOTIFICATION_DATA, offsetof(private_notify_payload_t, notification_data) } -======= { U_INT_16, offsetof(private_notify_payload_t, notify_type) }, /* SPI as variable length field*/ { SPI, offsetof(private_notify_payload_t, spi) }, /* Key Exchange Data is from variable size */ { NOTIFICATION_DATA,offsetof(private_notify_payload_t, notification_data) } ->>>>>>> upstream/4.5.1 }; /* @@ -329,15 +292,8 @@ encoding_rule_t notify_payload_encodings[] = { +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -<<<<<<< HEAD -/** - * Implementation of payload_t.verify. - */ -static status_t verify(private_notify_payload_t *this) -======= METHOD(payload_t, verify, status_t, private_notify_payload_t *this) ->>>>>>> upstream/4.5.1 { bool bad_length = FALSE; @@ -451,21 +407,6 @@ METHOD(payload_t, verify, status_t, return SUCCESS; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_encoding_rules. - */ -static void get_encoding_rules(private_notify_payload_t *this, encoding_rule_t **rules, size_t *rule_count) -{ - *rules = notify_payload_encodings; - *rule_count = sizeof(notify_payload_encodings) / sizeof(encoding_rule_t); -} - -/** - * Implementation of payload_t.get_type. - */ -static payload_type_t get_type(private_notify_payload_t *this) -======= METHOD(payload_t, get_encoding_rules, void, private_notify_payload_t *this, encoding_rule_t **rules, size_t *rule_count) { @@ -475,25 +416,10 @@ METHOD(payload_t, get_encoding_rules, void, METHOD(payload_t, get_type, payload_type_t, private_notify_payload_t *this) ->>>>>>> upstream/4.5.1 { return NOTIFY; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_next_type. - */ -static payload_type_t get_next_type(private_notify_payload_t *this) -{ - return (this->next_payload); -} - -/** - * Implementation of payload_t.set_next_type. - */ -static void set_next_type(private_notify_payload_t *this,payload_type_t type) -======= METHOD(payload_t, get_next_type, payload_type_t, private_notify_payload_t *this) { @@ -502,7 +428,6 @@ METHOD(payload_t, get_next_type, payload_type_t, METHOD(payload_t, set_next_type, void, private_notify_payload_t *this, payload_type_t type) ->>>>>>> upstream/4.5.1 { this->next_payload = type; } @@ -513,10 +438,7 @@ METHOD(payload_t, set_next_type, void, static void compute_length (private_notify_payload_t *this) { size_t length = NOTIFY_PAYLOAD_HEADER_LENGTH; -<<<<<<< HEAD -======= ->>>>>>> upstream/4.5.1 if (this->notification_data.ptr != NULL) { length += this->notification_data.len; @@ -528,21 +450,6 @@ static void compute_length (private_notify_payload_t *this) this->payload_length = length; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_length. - */ -static size_t get_length(private_notify_payload_t *this) -{ - compute_length(this); - return this->payload_length; -} - -/** - * Implementation of notify_payload_t.get_protocol_id. - */ -static u_int8_t get_protocol_id(private_notify_payload_t *this) -======= METHOD(payload_t, get_length, size_t, private_notify_payload_t *this) { @@ -551,59 +458,30 @@ METHOD(payload_t, get_length, size_t, METHOD(notify_payload_t, get_protocol_id, u_int8_t, private_notify_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->protocol_id; } -<<<<<<< HEAD -/** - * Implementation of notify_payload_t.set_protocol_id. - */ -static void set_protocol_id(private_notify_payload_t *this, u_int8_t protocol_id) -======= METHOD(notify_payload_t, set_protocol_id, void, private_notify_payload_t *this, u_int8_t protocol_id) ->>>>>>> upstream/4.5.1 { this->protocol_id = protocol_id; } -<<<<<<< HEAD -/** - * Implementation of notify_payload_t.get_notify_type. - */ -static notify_type_t get_notify_type(private_notify_payload_t *this) -======= METHOD(notify_payload_t, get_notify_type, notify_type_t, private_notify_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->notify_type; } -<<<<<<< HEAD -/** - * Implementation of notify_payload_t.set_notify_type. - */ -static void set_notify_type(private_notify_payload_t *this, u_int16_t notify_type) -======= METHOD(notify_payload_t, set_notify_type, void, private_notify_payload_t *this, notify_type_t notify_type) ->>>>>>> upstream/4.5.1 { this->notify_type = notify_type; } -<<<<<<< HEAD -/** - * Implementation of notify_payload_t.get_spi. - */ -static u_int32_t get_spi(private_notify_payload_t *this) -======= METHOD(notify_payload_t, get_spi, u_int32_t, private_notify_payload_t *this) ->>>>>>> upstream/4.5.1 { switch (this->protocol_id) { @@ -619,15 +497,8 @@ METHOD(notify_payload_t, get_spi, u_int32_t, return 0; } -<<<<<<< HEAD -/** - * Implementation of notify_payload_t.set_spi. - */ -static void set_spi(private_notify_payload_t *this, u_int32_t spi) -======= METHOD(notify_payload_t, set_spi, void, private_notify_payload_t *this, u_int32_t spi) ->>>>>>> upstream/4.5.1 { chunk_free(&this->spi); switch (this->protocol_id) @@ -644,39 +515,6 @@ METHOD(notify_payload_t, set_spi, void, compute_length(this); } -<<<<<<< HEAD -/** - * Implementation of notify_payload_t.get_notification_data. - */ -static chunk_t get_notification_data(private_notify_payload_t *this) -{ - return (this->notification_data); -} - -/** - * Implementation of notify_payload_t.set_notification_data. - */ -static status_t set_notification_data(private_notify_payload_t *this, chunk_t notification_data) -{ - chunk_free(&this->notification_data); - if (notification_data.len > 0) - { - this->notification_data = chunk_clone(notification_data); - } - compute_length(this); - return SUCCESS; -} - -/** - * Implementation of notify_payload_t.destroy and notify_payload_t.destroy. - */ -static status_t destroy(private_notify_payload_t *this) -{ - chunk_free(&this->notification_data); - chunk_free(&this->spi); - free(this); - return SUCCESS; -======= METHOD(notify_payload_t, get_notification_data, chunk_t, private_notify_payload_t *this) { @@ -697,7 +535,6 @@ METHOD2(payload_t, notify_payload_t, destroy, void, free(this->notification_data.ptr); free(this->spi.ptr); free(this); ->>>>>>> upstream/4.5.1 } /* @@ -705,42 +542,6 @@ METHOD2(payload_t, notify_payload_t, destroy, void, */ notify_payload_t *notify_payload_create() { -<<<<<<< HEAD - private_notify_payload_t *this = malloc_thing(private_notify_payload_t); - - /* interface functions */ - this->public.payload_interface.verify = (status_t (*) (payload_t *))verify; - this->public.payload_interface.get_encoding_rules = (void (*) (payload_t *, encoding_rule_t **, size_t *) ) get_encoding_rules; - this->public.payload_interface.get_length = (size_t (*) (payload_t *)) get_length; - this->public.payload_interface.get_next_type = (payload_type_t (*) (payload_t *)) get_next_type; - this->public.payload_interface.set_next_type = (void (*) (payload_t *,payload_type_t)) set_next_type; - this->public.payload_interface.get_type = (payload_type_t (*) (payload_t *)) get_type; - this->public.payload_interface.destroy = (void (*) (payload_t *))destroy; - - /* public functions */ - this->public.get_protocol_id = (u_int8_t (*) (notify_payload_t *)) get_protocol_id; - this->public.set_protocol_id = (void (*) (notify_payload_t *,u_int8_t)) set_protocol_id; - this->public.get_notify_type = (notify_type_t (*) (notify_payload_t *)) get_notify_type; - this->public.set_notify_type = (void (*) (notify_payload_t *,notify_type_t)) set_notify_type; - this->public.get_spi = (u_int32_t (*) (notify_payload_t *)) get_spi; - this->public.set_spi = (void (*) (notify_payload_t *,u_int32_t)) set_spi; - this->public.get_notification_data = (chunk_t (*) (notify_payload_t *)) get_notification_data; - this->public.set_notification_data = (void (*) (notify_payload_t *,chunk_t)) set_notification_data; - this->public.destroy = (void (*) (notify_payload_t *)) destroy; - - /* set default values of the fields */ - this->critical = FALSE; - this->next_payload = NO_PAYLOAD; - this->payload_length = NOTIFY_PAYLOAD_HEADER_LENGTH; - this->protocol_id = 0; - this->notify_type = 0; - this->spi.ptr = NULL; - this->spi.len = 0; - this->spi_size = 0; - this->notification_data.ptr = NULL; - this->notification_data.len = 0; - -======= private_notify_payload_t *this; INIT(this, @@ -767,21 +568,12 @@ notify_payload_t *notify_payload_create() .next_payload = NO_PAYLOAD, .payload_length = NOTIFY_PAYLOAD_HEADER_LENGTH, ); ->>>>>>> upstream/4.5.1 return &this->public; } /* * Described in header. */ -<<<<<<< HEAD -notify_payload_t *notify_payload_create_from_protocol_and_type(protocol_id_t protocol_id, notify_type_t notify_type) -{ - notify_payload_t *notify = notify_payload_create(); - - notify->set_notify_type(notify,notify_type); - notify->set_protocol_id(notify,protocol_id); -======= notify_payload_t *notify_payload_create_from_protocol_and_type( protocol_id_t protocol_id, notify_type_t notify_type) { @@ -789,7 +581,6 @@ notify_payload_t *notify_payload_create_from_protocol_and_type( notify->set_notify_type(notify, notify_type); notify->set_protocol_id(notify, protocol_id); ->>>>>>> upstream/4.5.1 return notify; } diff --git a/src/libcharon/encoding/payloads/payload.c b/src/libcharon/encoding/payloads/payload.c index 35d073240..d1e677db7 100644 --- a/src/libcharon/encoding/payloads/payload.c +++ b/src/libcharon/encoding/payloads/payload.c @@ -59,41 +59,23 @@ ENUM_NEXT(payload_type_names, SECURITY_ASSOCIATION, EXTENSIBLE_AUTHENTICATION, N #ifdef ME ENUM_NEXT(payload_type_names, ID_PEER, ID_PEER, EXTENSIBLE_AUTHENTICATION, "ID_PEER"); -<<<<<<< HEAD -ENUM_NEXT(payload_type_names, HEADER, UNKNOWN_PAYLOAD, ID_PEER, -======= ENUM_NEXT(payload_type_names, HEADER, CONFIGURATION_ATTRIBUTE, ID_PEER, ->>>>>>> upstream/4.5.1 "HEADER", "PROPOSAL_SUBSTRUCTURE", "TRANSFORM_SUBSTRUCTURE", "TRANSFORM_ATTRIBUTE", "TRAFFIC_SELECTOR_SUBSTRUCTURE", -<<<<<<< HEAD - "CONFIGURATION_ATTRIBUTE", - "UNKNOWN_PAYLOAD"); -#else -ENUM_NEXT(payload_type_names, HEADER, UNKNOWN_PAYLOAD, EXTENSIBLE_AUTHENTICATION, -======= "CONFIGURATION_ATTRIBUTE"); #else ENUM_NEXT(payload_type_names, HEADER, CONFIGURATION_ATTRIBUTE, EXTENSIBLE_AUTHENTICATION, ->>>>>>> upstream/4.5.1 "HEADER", "PROPOSAL_SUBSTRUCTURE", "TRANSFORM_SUBSTRUCTURE", "TRANSFORM_ATTRIBUTE", "TRAFFIC_SELECTOR_SUBSTRUCTURE", -<<<<<<< HEAD - "CONFIGURATION_ATTRIBUTE", - "UNKNOWN_PAYLOAD"); -#endif /* ME */ -ENUM_END(payload_type_names, UNKNOWN_PAYLOAD); -======= "CONFIGURATION_ATTRIBUTE"); #endif /* ME */ ENUM_END(payload_type_names, CONFIGURATION_ATTRIBUTE); ->>>>>>> upstream/4.5.1 /* short forms of payload names */ ENUM_BEGIN(payload_type_short_names, NO_PAYLOAD, NO_PAYLOAD, @@ -118,41 +100,23 @@ ENUM_NEXT(payload_type_short_names, SECURITY_ASSOCIATION, EXTENSIBLE_AUTHENTICAT #ifdef ME ENUM_NEXT(payload_type_short_names, ID_PEER, ID_PEER, EXTENSIBLE_AUTHENTICATION, "IDp"); -<<<<<<< HEAD -ENUM_NEXT(payload_type_short_names, HEADER, UNKNOWN_PAYLOAD, ID_PEER, -======= ENUM_NEXT(payload_type_short_names, HEADER, CONFIGURATION_ATTRIBUTE, ID_PEER, ->>>>>>> upstream/4.5.1 "HDR", "PROP", "TRANS", "TRANSATTR", "TSSUB", -<<<<<<< HEAD - "CPATTR", - "??"); -#else -ENUM_NEXT(payload_type_short_names, HEADER, UNKNOWN_PAYLOAD, EXTENSIBLE_AUTHENTICATION, -======= "CPATTR"); #else ENUM_NEXT(payload_type_short_names, HEADER, CONFIGURATION_ATTRIBUTE, EXTENSIBLE_AUTHENTICATION, ->>>>>>> upstream/4.5.1 "HDR", "PROP", "TRANS", "TRANSATTR", "TSSUB", -<<<<<<< HEAD - "CPATTR", - "??"); -#endif /* ME */ -ENUM_END(payload_type_short_names, UNKNOWN_PAYLOAD); -======= "CPATTR"); #endif /* ME */ ENUM_END(payload_type_short_names, CONFIGURATION_ATTRIBUTE); ->>>>>>> upstream/4.5.1 /* * see header @@ -210,12 +174,6 @@ payload_t *payload_create(payload_type_t type) case ENCRYPTED: return (payload_t*)encryption_payload_create(); default: -<<<<<<< HEAD - return (payload_t*)unknown_payload_create(); - } -} - -======= return (payload_t*)unknown_payload_create(type); } } @@ -258,4 +216,3 @@ void* payload_get_field(payload_t *payload, encoding_type_t type, u_int skip) } return NULL; } ->>>>>>> upstream/4.5.1 diff --git a/src/libcharon/encoding/payloads/payload.h b/src/libcharon/encoding/payloads/payload.h index 68fbb01c0..0f407ff42 100644 --- a/src/libcharon/encoding/payloads/payload.h +++ b/src/libcharon/encoding/payloads/payload.h @@ -137,11 +137,7 @@ enum payload_type_t{ * This payload type is not sent over wire and just * used internally to handle IKEv2-Header like a payload. */ -<<<<<<< HEAD - HEADER = 140, -======= HEADER = 256, ->>>>>>> upstream/4.5.1 /** * PROPOSAL_SUBSTRUCTURE has a value of PRIVATE USE space. @@ -149,11 +145,7 @@ enum payload_type_t{ * This payload type is not sent over wire and just * used internally to handle a proposal substructure like a payload. */ -<<<<<<< HEAD - PROPOSAL_SUBSTRUCTURE = 141, -======= PROPOSAL_SUBSTRUCTURE = 257, ->>>>>>> upstream/4.5.1 /** * TRANSFORM_SUBSTRUCTURE has a value of PRIVATE USE space. @@ -161,11 +153,7 @@ enum payload_type_t{ * This payload type is not sent over wire and just * used internally to handle a transform substructure like a payload. */ -<<<<<<< HEAD - TRANSFORM_SUBSTRUCTURE = 142, -======= TRANSFORM_SUBSTRUCTURE = 258, ->>>>>>> upstream/4.5.1 /** * TRANSFORM_ATTRIBUTE has a value of PRIVATE USE space. @@ -173,11 +161,7 @@ enum payload_type_t{ * This payload type is not sent over wire and just * used internally to handle a transform attribute like a payload. */ -<<<<<<< HEAD - TRANSFORM_ATTRIBUTE = 143, -======= TRANSFORM_ATTRIBUTE = 259, ->>>>>>> upstream/4.5.1 /** * TRAFFIC_SELECTOR_SUBSTRUCTURE has a value of PRIVATE USE space. @@ -185,11 +169,7 @@ enum payload_type_t{ * This payload type is not sent over wire and just * used internally to handle a transform selector like a payload. */ -<<<<<<< HEAD - TRAFFIC_SELECTOR_SUBSTRUCTURE = 144, -======= TRAFFIC_SELECTOR_SUBSTRUCTURE = 260, ->>>>>>> upstream/4.5.1 /** * CONFIGURATION_ATTRIBUTE has a value of PRIVATE USE space. @@ -197,24 +177,9 @@ enum payload_type_t{ * This payload type is not sent over wire and just * used internally to handle a transform attribute like a payload. */ -<<<<<<< HEAD - CONFIGURATION_ATTRIBUTE = 145, - - /** - * A unknown payload has a value of PRIVATE USE space. - * - * This payload type is not sent over wire and just - * used internally to handle a unknown payload. - */ - UNKNOWN_PAYLOAD = 146, -}; - - -======= CONFIGURATION_ATTRIBUTE = 261, }; ->>>>>>> upstream/4.5.1 /** * enum names for payload_type_t. */ @@ -295,8 +260,6 @@ struct payload_t { */ payload_t *payload_create(payload_type_t type); -<<<<<<< HEAD -======= /** * Check if a specific payload is implemented, or handled as unknown payload. * @@ -315,5 +278,4 @@ bool payload_is_known(payload_type_t type); */ void* payload_get_field(payload_t *payload, encoding_type_t type, u_int skip); ->>>>>>> upstream/4.5.1 #endif /** PAYLOAD_H_ @}*/ diff --git a/src/libcharon/encoding/payloads/proposal_substructure.c b/src/libcharon/encoding/payloads/proposal_substructure.c index 9272d1b63..f39c3b0e6 100644 --- a/src/libcharon/encoding/payloads/proposal_substructure.c +++ b/src/libcharon/encoding/payloads/proposal_substructure.c @@ -47,14 +47,11 @@ struct private_proposal_substructure_t { u_int8_t next_payload; /** -<<<<<<< HEAD -======= * reserved byte */ u_int8_t reserved; /** ->>>>>>> upstream/4.5.1 * Length of this payload. */ u_int16_t proposal_length; @@ -99,13 +96,8 @@ struct private_proposal_substructure_t { encoding_rule_t proposal_substructure_encodings[] = { /* 1 Byte next payload type, stored in the field next_payload */ { U_INT_8, offsetof(private_proposal_substructure_t, next_payload) }, -<<<<<<< HEAD - /* Reserved Byte is skipped */ - { RESERVED_BYTE, 0 }, -======= /* 1 Reserved Byte */ { RESERVED_BYTE, offsetof(private_proposal_substructure_t, reserved) }, ->>>>>>> upstream/4.5.1 /* Length of the whole proposal substructure payload*/ { PAYLOAD_LENGTH, offsetof(private_proposal_substructure_t, proposal_length) }, /* proposal number is a number of 8 bit */ @@ -226,24 +218,6 @@ METHOD(payload_t, set_next_type, void, */ static void compute_length(private_proposal_substructure_t *this) { -<<<<<<< HEAD - iterator_t *iterator; - payload_t *current_transform; - size_t transforms_count = 0; - size_t length = PROPOSAL_SUBSTRUCTURE_HEADER_LENGTH; - - iterator = this->transforms->create_iterator(this->transforms,TRUE); - while (iterator->iterate(iterator, (void**)¤t_transform)) - { - length += current_transform->get_length(current_transform); - transforms_count++; - } - iterator->destroy(iterator); - - length += this->spi.len; - this->transforms_count = transforms_count; - this->proposal_length = length; -======= enumerator_t *enumerator; payload_t *transform; @@ -256,16 +230,11 @@ static void compute_length(private_proposal_substructure_t *this) this->transforms_count++; } enumerator->destroy(enumerator); ->>>>>>> upstream/4.5.1 } METHOD(payload_t, get_length, size_t, private_proposal_substructure_t *this) { -<<<<<<< HEAD - compute_length(this); -======= ->>>>>>> upstream/4.5.1 return this->proposal_length; } @@ -373,39 +342,10 @@ METHOD(proposal_substructure_t, get_proposal, proposal_t*, return proposal; } -<<<<<<< HEAD -METHOD(proposal_substructure_t, clone_, proposal_substructure_t*, - private_proposal_substructure_t *this) -{ - private_proposal_substructure_t *clone; - enumerator_t *enumerator; - transform_substructure_t *current; - - clone = (private_proposal_substructure_t*)proposal_substructure_create(); - clone->next_payload = this->next_payload; - clone->proposal_number = this->proposal_number; - clone->protocol_id = this->protocol_id; - clone->spi_size = this->spi_size; - if (this->spi.ptr != NULL) - { - clone->spi.ptr = clalloc(this->spi.ptr, this->spi.len); - clone->spi.len = this->spi.len; - } - enumerator = this->transforms->create_enumerator(this->transforms); - while (enumerator->enumerate(enumerator, ¤t)) - { - current = current->clone(current); - add_transform_substructure(clone, current); - } - enumerator->destroy(enumerator); - - return &clone->public; -======= METHOD(proposal_substructure_t, create_substructure_enumerator, enumerator_t*, private_proposal_substructure_t *this) { return this->transforms->create_enumerator(this->transforms); ->>>>>>> upstream/4.5.1 } METHOD2(payload_t, proposal_substructure_t, destroy, void, @@ -441,14 +381,6 @@ proposal_substructure_t *proposal_substructure_create() .get_protocol_id = _get_protocol_id, .set_is_last_proposal = _set_is_last_proposal, .get_proposal = _get_proposal, -<<<<<<< HEAD - .set_spi = _set_spi, - .get_spi = _get_spi, - .clone = _clone_, - .destroy = _destroy, - }, - .next_payload = NO_PAYLOAD, -======= .create_substructure_enumerator = _create_substructure_enumerator, .set_spi = _set_spi, .get_spi = _get_spi, @@ -456,7 +388,6 @@ proposal_substructure_t *proposal_substructure_create() }, .next_payload = NO_PAYLOAD, .proposal_length = PROPOSAL_SUBSTRUCTURE_HEADER_LENGTH, ->>>>>>> upstream/4.5.1 .transforms = linked_list_create(), ); @@ -548,10 +479,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposal( } this->proposal_number = proposal->get_number(proposal); this->protocol_id = proposal->get_protocol(proposal); -<<<<<<< HEAD -======= compute_length(this); ->>>>>>> upstream/4.5.1 return &this->public; } diff --git a/src/libcharon/encoding/payloads/proposal_substructure.h b/src/libcharon/encoding/payloads/proposal_substructure.h index a7ad97e1c..d0ba1fd2a 100644 --- a/src/libcharon/encoding/payloads/proposal_substructure.h +++ b/src/libcharon/encoding/payloads/proposal_substructure.h @@ -111,19 +111,11 @@ struct proposal_substructure_t { proposal_t * (*get_proposal) (proposal_substructure_t *this); /** -<<<<<<< HEAD - * Clones an proposal_substructure_t object. - * - * @return cloned object - */ - proposal_substructure_t* (*clone) (proposal_substructure_t *this); -======= * Create an enumerator over transform substructures. * * @return enumerator over transform_substructure_t */ enumerator_t* (*create_substructure_enumerator)(proposal_substructure_t *this); ->>>>>>> upstream/4.5.1 /** * Destroys an proposal_substructure_t object. diff --git a/src/libcharon/encoding/payloads/sa_payload.c b/src/libcharon/encoding/payloads/sa_payload.c index faa19b614..db20d052f 100644 --- a/src/libcharon/encoding/payloads/sa_payload.c +++ b/src/libcharon/encoding/payloads/sa_payload.c @@ -46,14 +46,11 @@ struct private_sa_payload_t { bool critical; /** -<<<<<<< HEAD -======= * Reserved bits */ bool reserved[7]; /** ->>>>>>> upstream/4.5.1 * Length of this payload. */ u_int16_t payload_length; @@ -76,15 +73,6 @@ encoding_rule_t sa_payload_encodings[] = { /* the critical bit */ { FLAG, offsetof(private_sa_payload_t, critical) }, /* 7 Bit reserved bits, nowhere stored */ -<<<<<<< HEAD - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, -======= { RESERVED_BIT, offsetof(private_sa_payload_t, reserved[0]) }, { RESERVED_BIT, offsetof(private_sa_payload_t, reserved[1]) }, { RESERVED_BIT, offsetof(private_sa_payload_t, reserved[2]) }, @@ -92,7 +80,6 @@ encoding_rule_t sa_payload_encodings[] = { { RESERVED_BIT, offsetof(private_sa_payload_t, reserved[4]) }, { RESERVED_BIT, offsetof(private_sa_payload_t, reserved[5]) }, { RESERVED_BIT, offsetof(private_sa_payload_t, reserved[6]) }, ->>>>>>> upstream/4.5.1 /* Length of the whole SA payload*/ { PAYLOAD_LENGTH, offsetof(private_sa_payload_t, payload_length) }, /* Proposals are stored in a proposal substructure, @@ -203,10 +190,6 @@ static void compute_length(private_sa_payload_t *this) METHOD(payload_t, get_length, size_t, private_sa_payload_t *this) { -<<<<<<< HEAD - compute_length(this); -======= ->>>>>>> upstream/4.5.1 return this->payload_length; } @@ -279,15 +262,12 @@ METHOD(sa_payload_t, get_proposals, linked_list_t*, return list; } -<<<<<<< HEAD -======= METHOD(sa_payload_t, create_substructure_enumerator, enumerator_t*, private_sa_payload_t *this) { return this->proposals->create_enumerator(this->proposals); } ->>>>>>> upstream/4.5.1 METHOD2(payload_t, sa_payload_t, destroy, void, private_sa_payload_t *this) { @@ -316,10 +296,7 @@ sa_payload_t *sa_payload_create() }, .add_proposal = _add_proposal, .get_proposals = _get_proposals, -<<<<<<< HEAD -======= .create_substructure_enumerator = _create_substructure_enumerator, ->>>>>>> upstream/4.5.1 .destroy = _destroy, }, .next_payload = NO_PAYLOAD, diff --git a/src/libcharon/encoding/payloads/sa_payload.h b/src/libcharon/encoding/payloads/sa_payload.h index fb0227016..cc8c481c8 100644 --- a/src/libcharon/encoding/payloads/sa_payload.h +++ b/src/libcharon/encoding/payloads/sa_payload.h @@ -61,8 +61,6 @@ struct sa_payload_t { void (*add_proposal) (sa_payload_t *this, proposal_t *proposal); /** -<<<<<<< HEAD -======= * Create an enumerator over all proposal substructures. * * @return enumerator over proposal_substructure_t @@ -70,7 +68,6 @@ struct sa_payload_t { enumerator_t* (*create_substructure_enumerator)(sa_payload_t *this); /** ->>>>>>> upstream/4.5.1 * Destroys an sa_payload_t object. */ void (*destroy) (sa_payload_t *this); diff --git a/src/libcharon/encoding/payloads/traffic_selector_substructure.c b/src/libcharon/encoding/payloads/traffic_selector_substructure.c index f631714a2..df36e4383 100644 --- a/src/libcharon/encoding/payloads/traffic_selector_substructure.c +++ b/src/libcharon/encoding/payloads/traffic_selector_substructure.c @@ -1,10 +1,6 @@ /* -<<<<<<< HEAD - * Copyright (C) 2005-2006 Martin Willi -======= * Copyright (C) 2005-2010 Martin Willi * Copyright (C) 2010 revosec AG ->>>>>>> upstream/4.5.1 * Copyright (C) 2005 Jan Hutter * Hochschule fuer Technik Rapperswil * @@ -24,23 +20,13 @@ #include <encoding/payloads/encodings.h> #include <utils/linked_list.h> -<<<<<<< HEAD - -======= ->>>>>>> upstream/4.5.1 typedef struct private_traffic_selector_substructure_t private_traffic_selector_substructure_t; /** * Private data of an traffic_selector_substructure_t object. -<<<<<<< HEAD - * - */ -struct private_traffic_selector_substructure_t { -======= */ struct private_traffic_selector_substructure_t { ->>>>>>> upstream/4.5.1 /** * Public traffic_selector_substructure_t interface. */ @@ -87,26 +73,6 @@ struct private_traffic_selector_substructure_t { * * The defined offsets are the positions in a object of type * private_traffic_selector_substructure_t. -<<<<<<< HEAD - * - */ -encoding_rule_t traffic_selector_substructure_encodings[] = { - /* 1 Byte next ts type*/ - { TS_TYPE, offsetof(private_traffic_selector_substructure_t, ts_type) }, - /* 1 Byte IP protocol id*/ - { U_INT_8, offsetof(private_traffic_selector_substructure_t, ip_protocol_id) }, - /* Length of the whole payload*/ - { PAYLOAD_LENGTH, offsetof(private_traffic_selector_substructure_t, payload_length) }, - /* 2 Byte start port*/ - { U_INT_16, offsetof(private_traffic_selector_substructure_t, start_port) }, - /* 2 Byte end port*/ - { U_INT_16, offsetof(private_traffic_selector_substructure_t, end_port) }, - /* starting address is either 4 or 16 byte */ - { ADDRESS, offsetof(private_traffic_selector_substructure_t, starting_address) }, - /* ending address is either 4 or 16 byte */ - { ADDRESS, offsetof(private_traffic_selector_substructure_t, ending_address) } - -======= */ encoding_rule_t traffic_selector_substructure_encodings[] = { /* 1 Byte next ts type*/ @@ -123,7 +89,6 @@ encoding_rule_t traffic_selector_substructure_encodings[] = { { ADDRESS, offsetof(private_traffic_selector_substructure_t, starting_address) }, /* ending address is either 4 or 16 byte */ { ADDRESS, offsetof(private_traffic_selector_substructure_t, ending_address) } ->>>>>>> upstream/4.5.1 }; /* @@ -144,15 +109,8 @@ encoding_rule_t traffic_selector_substructure_encodings[] = { +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -<<<<<<< HEAD -/** - * Implementation of payload_t.verify. - */ -static status_t verify(private_traffic_selector_substructure_t *this) -======= METHOD(payload_t, verify, status_t, private_traffic_selector_substructure_t *this) ->>>>>>> upstream/4.5.1 { if (this->start_port > this->end_port) { @@ -190,21 +148,6 @@ METHOD(payload_t, verify, status_t, return SUCCESS; } -<<<<<<< HEAD -/** - * Implementation of traffic_selector_substructure_t.get_encoding_rules. - */ -static void get_encoding_rules(private_traffic_selector_substructure_t *this, encoding_rule_t **rules, size_t *rule_count) -{ - *rules = traffic_selector_substructure_encodings; - *rule_count = sizeof(traffic_selector_substructure_encodings) / sizeof(encoding_rule_t); -} - -/** - * Implementation of payload_t.get_type. - */ -static payload_type_t get_payload_type(private_traffic_selector_substructure_t *this) -======= METHOD(payload_t, get_encoding_rules, void, private_traffic_selector_substructure_t *this, encoding_rule_t **rules, size_t *rule_count) @@ -215,33 +158,10 @@ METHOD(payload_t, get_encoding_rules, void, METHOD(payload_t, get_type, payload_type_t, private_traffic_selector_substructure_t *this) ->>>>>>> upstream/4.5.1 { return TRAFFIC_SELECTOR_SUBSTRUCTURE; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_next_type. - */ -static payload_type_t get_next_type(private_traffic_selector_substructure_t *this) -{ - return 0; -} - -/** - * Implementation of payload_t.set_next_type. - */ -static void set_next_type(private_traffic_selector_substructure_t *this,payload_type_t type) -{ - -} - -/** - * Implementation of payload_t.get_length. - */ -static size_t get_length(private_traffic_selector_substructure_t *this) -======= METHOD(payload_t, get_next_type, payload_type_t, private_traffic_selector_substructure_t *this) { @@ -255,38 +175,10 @@ METHOD(payload_t, set_next_type, void, METHOD(payload_t, get_length, size_t, private_traffic_selector_substructure_t *this) ->>>>>>> upstream/4.5.1 { return this->payload_length; } -<<<<<<< HEAD -/** - * Implementation of traffic_selector_substructure_t.get_traffic_selector. - */ -static traffic_selector_t *get_traffic_selector(private_traffic_selector_substructure_t *this) -{ - traffic_selector_t *ts; - ts = traffic_selector_create_from_bytes(this->ip_protocol_id, this->ts_type, - this->starting_address, this->start_port, - this->ending_address, this->end_port); - return ts; -} - -/** - * recompute length field of the payload - */ -void compute_length(private_traffic_selector_substructure_t *this) -{ - this->payload_length = TRAFFIC_SELECTOR_HEADER_LENGTH + - this->ending_address.len + this->starting_address.len; -} - -/** - * Implementation of payload_t.destroy and traffic_selector_substructure_t.destroy. - */ -static void destroy(private_traffic_selector_substructure_t *this) -======= METHOD(traffic_selector_substructure_t, get_traffic_selector, traffic_selector_t*, private_traffic_selector_substructure_t *this) { @@ -298,7 +190,6 @@ METHOD(traffic_selector_substructure_t, get_traffic_selector, traffic_selector_t METHOD2(payload_t, traffic_selector_substructure_t, destroy, void, private_traffic_selector_substructure_t *this) ->>>>>>> upstream/4.5.1 { free(this->starting_address.ptr); free(this->ending_address.ptr); @@ -310,34 +201,6 @@ METHOD2(payload_t, traffic_selector_substructure_t, destroy, void, */ traffic_selector_substructure_t *traffic_selector_substructure_create() { -<<<<<<< HEAD - private_traffic_selector_substructure_t *this = malloc_thing(private_traffic_selector_substructure_t); - - /* interface functions */ - this->public.payload_interface.verify = (status_t (*) (payload_t *))verify; - this->public.payload_interface.get_encoding_rules = (void (*) (payload_t *, encoding_rule_t **, size_t *) ) get_encoding_rules; - this->public.payload_interface.get_length = (size_t (*) (payload_t *)) get_length; - this->public.payload_interface.get_next_type = (payload_type_t (*) (payload_t *)) get_next_type; - this->public.payload_interface.set_next_type = (void (*) (payload_t *,payload_type_t)) set_next_type; - this->public.payload_interface.get_type = (payload_type_t (*) (payload_t *)) get_payload_type; - this->public.payload_interface.destroy = (void (*) (payload_t *))destroy; - - /* public functions */ - this->public.get_traffic_selector = (traffic_selector_t* (*)(traffic_selector_substructure_t*))get_traffic_selector; - this->public.destroy = (void (*) (traffic_selector_substructure_t *)) destroy; - - /* private variables */ - this->payload_length = TRAFFIC_SELECTOR_HEADER_LENGTH; - this->start_port = 0; - this->end_port = 0; - this->starting_address = chunk_empty; - this->ending_address = chunk_empty; - this->ip_protocol_id = 0; - /* must be set to be valid */ - this->ts_type = TS_IPV4_ADDR_RANGE; - - return (&(this->public)); -======= private_traffic_selector_substructure_t *this; INIT(this, @@ -359,27 +222,11 @@ traffic_selector_substructure_t *traffic_selector_substructure_create() .ts_type = TS_IPV4_ADDR_RANGE, ); return &this->public; ->>>>>>> upstream/4.5.1 } /* * Described in header */ -<<<<<<< HEAD -traffic_selector_substructure_t *traffic_selector_substructure_create_from_traffic_selector(traffic_selector_t *traffic_selector) -{ - private_traffic_selector_substructure_t *this = (private_traffic_selector_substructure_t*)traffic_selector_substructure_create(); - this->ts_type = traffic_selector->get_type(traffic_selector); - this->ip_protocol_id = traffic_selector->get_protocol(traffic_selector); - this->start_port = traffic_selector->get_from_port(traffic_selector); - this->end_port = traffic_selector->get_to_port(traffic_selector); - this->starting_address = chunk_clone(traffic_selector->get_from_address(traffic_selector)); - this->ending_address = chunk_clone(traffic_selector->get_to_address(traffic_selector)); - - compute_length(this); - - return &(this->public); -======= traffic_selector_substructure_t *traffic_selector_substructure_create_from_traffic_selector( traffic_selector_t *ts) { @@ -396,5 +243,4 @@ traffic_selector_substructure_t *traffic_selector_substructure_create_from_traff this->ending_address.len + this->starting_address.len; return &this->public; ->>>>>>> upstream/4.5.1 } diff --git a/src/libcharon/encoding/payloads/transform_attribute.c b/src/libcharon/encoding/payloads/transform_attribute.c index 7332b939b..7d21258b1 100644 --- a/src/libcharon/encoding/payloads/transform_attribute.c +++ b/src/libcharon/encoding/payloads/transform_attribute.c @@ -1,10 +1,6 @@ /* -<<<<<<< HEAD - * Copyright (C) 2005-2006 Martin Willi -======= * Copyright (C) 2005-2010 Martin Willi * Copyright (C) 2010 revosec AG ->>>>>>> upstream/4.5.1 * Copyright (C) 2005 Jan Hutter * Hochschule fuer Technik Rapperswil * @@ -31,15 +27,9 @@ typedef struct private_transform_attribute_t private_transform_attribute_t; /** * Private data of an transform_attribute_t object. -<<<<<<< HEAD - * - */ -struct private_transform_attribute_t { -======= */ struct private_transform_attribute_t { ->>>>>>> upstream/4.5.1 /** * Public transform_attribute_t interface. */ @@ -81,10 +71,6 @@ ENUM_END(transform_attribute_type_name, KEY_LENGTH); * * The defined offsets are the positions in a object of type * private_transform_attribute_t. -<<<<<<< HEAD - * -======= ->>>>>>> upstream/4.5.1 */ encoding_rule_t transform_attribute_encodings[] = { /* Flag defining the format of this payload */ @@ -92,11 +78,7 @@ encoding_rule_t transform_attribute_encodings[] = { /* type of the attribute as 15 bit unsigned integer */ { ATTRIBUTE_TYPE, offsetof(private_transform_attribute_t, attribute_type) }, /* Length or value, depending on the attribute format flag */ -<<<<<<< HEAD - { ATTRIBUTE_LENGTH_OR_VALUE, offsetof(private_transform_attribute_t, attribute_length_or_value) }, -======= { ATTRIBUTE_LENGTH_OR_VALUE,offsetof(private_transform_attribute_t, attribute_length_or_value) }, ->>>>>>> upstream/4.5.1 /* Value of attribute if attribute format flag is zero */ { ATTRIBUTE_VALUE, offsetof(private_transform_attribute_t, attribute_value) } }; @@ -113,34 +95,6 @@ encoding_rule_t transform_attribute_encodings[] = { +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -<<<<<<< HEAD -/** - * Implementation of payload_t.verify. - */ -static status_t verify(private_transform_attribute_t *this) -{ - if (this->attribute_type != KEY_LENGTH) - { - return FAILED; - } - - return SUCCESS; -} - -/** - * Implementation of payload_t.get_encoding_rules. - */ -static void get_encoding_rules(private_transform_attribute_t *this, encoding_rule_t **rules, size_t *rule_count) -{ - *rules = transform_attribute_encodings; - *rule_count = sizeof(transform_attribute_encodings) / sizeof(encoding_rule_t); -} - -/** - * Implementation of payload_t.get_type. - */ -static payload_type_t get_type(private_transform_attribute_t *this) -======= METHOD(payload_t, verify, status_t, private_transform_attribute_t *this) { @@ -157,61 +111,10 @@ METHOD(payload_t, get_encoding_rules, void, METHOD(payload_t, get_type, payload_type_t, private_transform_attribute_t *this) ->>>>>>> upstream/4.5.1 { return TRANSFORM_ATTRIBUTE; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_next_type. - */ -static payload_type_t get_next_type(private_transform_attribute_t *this) -{ - return (NO_PAYLOAD); -} - -/** - * Implementation of payload_t.set_next_type. - */ -static void set_next_type(private_transform_attribute_t *this,payload_type_t type) -{ -} - -/** - * Implementation of transform_attribute_t.get_length. - */ -static size_t get_length(private_transform_attribute_t *this) -{ - if (this->attribute_format == TRUE) - { - /*Attribute size is only 4 byte */ - return 4; - } - return (this->attribute_length_or_value + 4); -} - -/** - * Implementation of transform_attribute_t.set_value_chunk. - */ -static void set_value_chunk(private_transform_attribute_t *this, chunk_t value) -{ - if (this->attribute_value.ptr != NULL) - { - /* free existing value */ - free(this->attribute_value.ptr); - this->attribute_value.ptr = NULL; - this->attribute_value.len = 0; - - } - - if (value.len > 2) - { - this->attribute_value.ptr = clalloc(value.ptr,value.len); - this->attribute_value.len = value.len; - this->attribute_length_or_value = value.len; - /* attribute has not a fixed length */ -======= METHOD(payload_t, get_next_type, payload_type_t, private_transform_attribute_t *this) { @@ -242,58 +145,10 @@ METHOD(transform_attribute_t, set_value_chunk, void, { this->attribute_value = chunk_clone(value); this->attribute_length_or_value = value.len; ->>>>>>> upstream/4.5.1 this->attribute_format = FALSE; } else { -<<<<<<< HEAD - memcpy(&(this->attribute_length_or_value),value.ptr,value.len); - } -} - -/** - * Implementation of transform_attribute_t.set_value. - */ -static void set_value(private_transform_attribute_t *this, u_int16_t value) -{ - if (this->attribute_value.ptr != NULL) - { - /* free existing value */ - free(this->attribute_value.ptr); - this->attribute_value.ptr = NULL; - this->attribute_value.len = 0; - - } - this->attribute_length_or_value = value; -} - -/** - * Implementation of transform_attribute_t.get_value_chunk. - */ -static chunk_t get_value_chunk (private_transform_attribute_t *this) -{ - chunk_t value; - - if (this->attribute_format == FALSE) - { - value.ptr = this->attribute_value.ptr; - value.len = this->attribute_value.len; - } - else - { - value.ptr = (void *) &(this->attribute_length_or_value); - value.len = 2; - } - - return value; -} - -/** - * Implementation of transform_attribute_t.get_value. - */ -static u_int16_t get_value (private_transform_attribute_t *this) -======= memcpy(&this->attribute_length_or_value, value.ptr, value.len); } } @@ -318,55 +173,28 @@ METHOD(transform_attribute_t, get_value_chunk, chunk_t, METHOD(transform_attribute_t, get_value, u_int16_t, private_transform_attribute_t *this) ->>>>>>> upstream/4.5.1 { return this->attribute_length_or_value; } -<<<<<<< HEAD - -/** - * Implementation of transform_attribute_t.set_attribute_type. - */ -static void set_attribute_type (private_transform_attribute_t *this, u_int16_t type) -======= METHOD(transform_attribute_t, set_attribute_type, void, private_transform_attribute_t *this, u_int16_t type) ->>>>>>> upstream/4.5.1 { this->attribute_type = type & 0x7FFF; } -<<<<<<< HEAD -/** - * Implementation of transform_attribute_t.get_attribute_type. - */ -static u_int16_t get_attribute_type (private_transform_attribute_t *this) -======= METHOD(transform_attribute_t, get_attribute_type, u_int16_t, private_transform_attribute_t *this) ->>>>>>> upstream/4.5.1 { return this->attribute_type; } -<<<<<<< HEAD -/** - * Implementation of transform_attribute_t.clone. - */ -static transform_attribute_t * _clone(private_transform_attribute_t *this) -{ - private_transform_attribute_t *new_clone; - - new_clone = (private_transform_attribute_t *) transform_attribute_create(); -======= METHOD(transform_attribute_t, clone_, transform_attribute_t*, private_transform_attribute_t *this) { private_transform_attribute_t *new_clone; new_clone = (private_transform_attribute_t *)transform_attribute_create(); ->>>>>>> upstream/4.5.1 new_clone->attribute_format = this->attribute_format; new_clone->attribute_type = this->attribute_type; @@ -374,24 +202,6 @@ METHOD(transform_attribute_t, clone_, transform_attribute_t*, if (!new_clone->attribute_format) { -<<<<<<< HEAD - new_clone->attribute_value.ptr = clalloc(this->attribute_value.ptr,this->attribute_value.len); - new_clone->attribute_value.len = this->attribute_value.len; - } - - return (transform_attribute_t *) new_clone; -} - -/** - * Implementation of transform_attribute_t.destroy and payload_t.destroy. - */ -static void destroy(private_transform_attribute_t *this) -{ - if (this->attribute_value.ptr != NULL) - { - free(this->attribute_value.ptr); - } -======= new_clone->attribute_value = chunk_clone(this->attribute_value); } return &new_clone->public; @@ -401,7 +211,6 @@ METHOD2(payload_t, transform_attribute_t, destroy, void, private_transform_attribute_t *this) { free(this->attribute_value.ptr); ->>>>>>> upstream/4.5.1 free(this); } @@ -410,37 +219,6 @@ METHOD2(payload_t, transform_attribute_t, destroy, void, */ transform_attribute_t *transform_attribute_create() { -<<<<<<< HEAD - private_transform_attribute_t *this = malloc_thing(private_transform_attribute_t); - - /* payload interface */ - this->public.payload_interface.verify = (status_t (*) (payload_t *))verify; - this->public.payload_interface.get_encoding_rules = (void (*) (payload_t *, encoding_rule_t **, size_t *) ) get_encoding_rules; - this->public.payload_interface.get_length = (size_t (*) (payload_t *)) get_length; - this->public.payload_interface.get_next_type = (payload_type_t (*) (payload_t *)) get_next_type; - this->public.payload_interface.set_next_type = (void (*) (payload_t *,payload_type_t)) set_next_type; - this->public.payload_interface.get_type = (payload_type_t (*) (payload_t *)) get_type; - this->public.payload_interface.destroy = (void (*) (payload_t *))destroy; - - /* public functions */ - this->public.set_value_chunk = (void (*) (transform_attribute_t *,chunk_t)) set_value_chunk; - this->public.set_value = (void (*) (transform_attribute_t *,u_int16_t)) set_value; - this->public.get_value_chunk = (chunk_t (*) (transform_attribute_t *)) get_value_chunk; - this->public.get_value = (u_int16_t (*) (transform_attribute_t *)) get_value; - this->public.set_attribute_type = (void (*) (transform_attribute_t *,u_int16_t type)) set_attribute_type; - this->public.get_attribute_type = (u_int16_t (*) (transform_attribute_t *)) get_attribute_type; - this->public.clone = (transform_attribute_t * (*) (transform_attribute_t *)) _clone; - this->public.destroy = (void (*) (transform_attribute_t *)) destroy; - - /* set default values of the fields */ - this->attribute_format = TRUE; - this->attribute_type = 0; - this->attribute_length_or_value = 0; - this->attribute_value.ptr = NULL; - this->attribute_value.len = 0; - - return (&(this->public)); -======= private_transform_attribute_t *this; INIT(this, @@ -466,7 +244,6 @@ transform_attribute_t *transform_attribute_create() .attribute_format = TRUE, ); return &this->public; ->>>>>>> upstream/4.5.1 } /* @@ -475,12 +252,7 @@ transform_attribute_t *transform_attribute_create() transform_attribute_t *transform_attribute_create_key_length(u_int16_t key_length) { transform_attribute_t *attribute = transform_attribute_create(); -<<<<<<< HEAD - attribute->set_attribute_type(attribute,KEY_LENGTH); - attribute->set_value(attribute,key_length); -======= attribute->set_attribute_type(attribute, KEY_LENGTH); attribute->set_value(attribute, key_length); ->>>>>>> upstream/4.5.1 return attribute; } diff --git a/src/libcharon/encoding/payloads/transform_substructure.c b/src/libcharon/encoding/payloads/transform_substructure.c index fa711a7b5..0428da726 100644 --- a/src/libcharon/encoding/payloads/transform_substructure.c +++ b/src/libcharon/encoding/payloads/transform_substructure.c @@ -1,10 +1,6 @@ /* -<<<<<<< HEAD - * Copyright (C) 2005-2006 Martin Willi -======= * Copyright (C) 2005-2010 Martin Willi * Copyright (C) 2010 revosec AG ->>>>>>> upstream/4.5.1 * Copyright (C) 2005 Jan Hutter * Hochschule fuer Technik Rapperswil * @@ -29,23 +25,13 @@ #include <utils/linked_list.h> #include <daemon.h> -<<<<<<< HEAD - -======= ->>>>>>> upstream/4.5.1 typedef struct private_transform_substructure_t private_transform_substructure_t; /** * Private data of an transform_substructure_t object. -<<<<<<< HEAD - * - */ -struct private_transform_substructure_t { -======= */ struct private_transform_substructure_t { ->>>>>>> upstream/4.5.1 /** * Public transform_substructure_t interface. */ @@ -55,24 +41,16 @@ struct private_transform_substructure_t { * Next payload type. */ u_int8_t next_payload; -<<<<<<< HEAD - -======= /** * Reserved bytes */ u_int8_t reserved[2]; ->>>>>>> upstream/4.5.1 /** * Length of this payload. */ u_int16_t transform_length; -<<<<<<< HEAD - -======= ->>>>>>> upstream/4.5.1 /** * Type of the transform. */ @@ -89,35 +67,11 @@ struct private_transform_substructure_t { linked_list_t *attributes; }; -<<<<<<< HEAD - -======= ->>>>>>> upstream/4.5.1 /** * Encoding rules to parse or generate a Transform substructure. * * The defined offsets are the positions in a object of type * private_transform_substructure_t. -<<<<<<< HEAD - * - */ -encoding_rule_t transform_substructure_encodings[] = { - /* 1 Byte next payload type, stored in the field next_payload */ - { U_INT_8, offsetof(private_transform_substructure_t, next_payload) }, - /* Reserved Byte is skipped */ - { RESERVED_BYTE, 0 }, - /* Length of the whole transform substructure*/ - { PAYLOAD_LENGTH, offsetof(private_transform_substructure_t, transform_length) }, - /* transform type is a number of 8 bit */ - { U_INT_8, offsetof(private_transform_substructure_t, transform_type) }, - /* Reserved Byte is skipped */ - { RESERVED_BYTE, 0 }, - /* tranform ID is a number of 8 bit */ - { U_INT_16, offsetof(private_transform_substructure_t, transform_id) }, - /* Attributes are stored in a transform attribute, - offset points to a linked_list_t pointer */ - { TRANSFORM_ATTRIBUTES, offsetof(private_transform_substructure_t, attributes) } -======= */ encoding_rule_t transform_substructure_encodings[] = { /* 1 Byte next payload type, stored in the field next_payload */ @@ -135,7 +89,6 @@ encoding_rule_t transform_substructure_encodings[] = { /* Attributes are stored in a transform attribute, offset points to a linked_list_t pointer */ { TRANSFORM_ATTRIBUTES, offsetof(private_transform_substructure_t, attributes) } ->>>>>>> upstream/4.5.1 }; /* @@ -152,21 +105,6 @@ encoding_rule_t transform_substructure_encodings[] = { +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -<<<<<<< HEAD - -/** - * Implementation of payload_t.verify. - */ -static status_t verify(private_transform_substructure_t *this) -{ - status_t status = SUCCESS; - iterator_t *iterator; - payload_t *current_attributes; - - if ((this->next_payload != NO_PAYLOAD) && (this->next_payload != 3)) - { - /* must be 0 or 3 */ -======= METHOD(payload_t, verify, status_t, private_transform_substructure_t *this) { @@ -176,7 +114,6 @@ METHOD(payload_t, verify, status_t, if (this->next_payload != NO_PAYLOAD && this->next_payload != 3) { ->>>>>>> upstream/4.5.1 DBG1(DBG_ENC, "inconsistent next payload"); return FAILED; } @@ -197,19 +134,6 @@ METHOD(payload_t, verify, status_t, return FAILED; } } -<<<<<<< HEAD - iterator = this->attributes->create_iterator(this->attributes,TRUE); - - while(iterator->iterate(iterator, (void**)¤t_attributes)) - { - status = current_attributes->verify(current_attributes); - if (status != SUCCESS) - { - DBG1(DBG_ENC, "TRANSFORM_ATTRIBUTE verification failed"); - } - } - iterator->destroy(iterator); -======= enumerator = this->attributes->create_enumerator(this->attributes); while (enumerator->enumerate(enumerator, &attribute)) @@ -222,27 +146,11 @@ METHOD(payload_t, verify, status_t, } } enumerator->destroy(enumerator); ->>>>>>> upstream/4.5.1 /* proposal number is checked in SA payload */ return status; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_encoding_rules. - */ -static void get_encoding_rules(private_transform_substructure_t *this, encoding_rule_t **rules, size_t *rule_count) -{ - *rules = transform_substructure_encodings; - *rule_count = sizeof(transform_substructure_encodings) / sizeof(encoding_rule_t); -} - -/** - * Implementation of payload_t.get_type. - */ -static payload_type_t get_type(private_transform_substructure_t *this) -======= METHOD(payload_t, get_encoding_rules, void, private_transform_substructure_t *this, encoding_rule_t **rules, size_t *rule_count) @@ -253,24 +161,14 @@ METHOD(payload_t, get_encoding_rules, void, METHOD(payload_t, get_type, payload_type_t, private_transform_substructure_t *this) ->>>>>>> upstream/4.5.1 { return TRANSFORM_SUBSTRUCTURE; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_next_type. - */ -static payload_type_t get_next_type(private_transform_substructure_t *this) -{ - return (this->next_payload); -======= METHOD(payload_t, get_next_type, payload_type_t, private_transform_substructure_t *this) { return this->next_payload; ->>>>>>> upstream/4.5.1 } /** @@ -278,83 +176,6 @@ METHOD(payload_t, get_next_type, payload_type_t, */ static void compute_length (private_transform_substructure_t *this) { -<<<<<<< HEAD - iterator_t *iterator; - payload_t *current_attribute; - size_t length = TRANSFORM_SUBSTRUCTURE_HEADER_LENGTH; - - iterator = this->attributes->create_iterator(this->attributes,TRUE); - while (iterator->iterate(iterator, (void**)¤t_attribute)) - { - length += current_attribute->get_length(current_attribute); - } - iterator->destroy(iterator); - - this->transform_length = length; -} - -/** - * Implementation of payload_t.get_length. - */ -static size_t get_length(private_transform_substructure_t *this) -{ - compute_length(this); - return this->transform_length; -} - -/** - * Implementation of transform_substructure_t.create_transform_attribute_iterator. - */ -static iterator_t *create_transform_attribute_iterator (private_transform_substructure_t *this,bool forward) -{ - return this->attributes->create_iterator(this->attributes,forward); -} - -/** - * Implementation of transform_substructure_t.add_transform_attribute. - */ -static void add_transform_attribute (private_transform_substructure_t *this,transform_attribute_t *attribute) -{ - this->attributes->insert_last(this->attributes,(void *) attribute); - compute_length(this); -} - -/** - * Implementation of transform_substructure_t.set_is_last_transform. - */ -static void set_is_last_transform (private_transform_substructure_t *this, bool is_last) -{ - this->next_payload = (is_last) ? 0: TRANSFORM_TYPE_VALUE; -} - -/** - * Implementation of transform_substructure_t.get_is_last_transform. - */ -static bool get_is_last_transform (private_transform_substructure_t *this) -{ - return ((this->next_payload == TRANSFORM_TYPE_VALUE) ? FALSE : TRUE); -} - -/** - * Implementation of payload_t.set_next_type. - */ -static void set_next_type(private_transform_substructure_t *this,payload_type_t type) -{ -} - -/** - * Implementation of transform_substructure_t.set_transform_type. - */ -static void set_transform_type (private_transform_substructure_t *this,u_int8_t type) -{ - this->transform_type = type; -} - -/** - * Implementation of transform_substructure_t.get_transform_type. - */ -static u_int8_t get_transform_type (private_transform_substructure_t *this) -======= enumerator_t *enumerator; payload_t *attribute; @@ -386,87 +207,16 @@ METHOD(payload_t, set_next_type, void, METHOD(transform_substructure_t, get_transform_type, u_int8_t, private_transform_substructure_t *this) ->>>>>>> upstream/4.5.1 { return this->transform_type; } -<<<<<<< HEAD -/** - * Implementation of transform_substructure_t.set_transform_id. - */ -static void set_transform_id (private_transform_substructure_t *this,u_int16_t id) -{ - this->transform_id = id; -} - -/** - * Implementation of transform_substructure_t.get_transform_id. - */ -static u_int16_t get_transform_id (private_transform_substructure_t *this) -======= METHOD(transform_substructure_t, get_transform_id, u_int16_t, private_transform_substructure_t *this) ->>>>>>> upstream/4.5.1 { return this->transform_id; } -<<<<<<< HEAD -/** - * Implementation of transform_substructure_t.clone. - */ -static transform_substructure_t *clone_(private_transform_substructure_t *this) -{ - private_transform_substructure_t *clone; - iterator_t *attributes; - transform_attribute_t *current_attribute; - - clone = (private_transform_substructure_t *) transform_substructure_create(); - clone->next_payload = this->next_payload; - clone->transform_type = this->transform_type; - clone->transform_id = this->transform_id; - - attributes = this->attributes->create_iterator(this->attributes, FALSE); - while (attributes->iterate(attributes, (void**)¤t_attribute)) - { - current_attribute = current_attribute->clone(current_attribute); - clone->public.add_transform_attribute(&clone->public, current_attribute); - } - attributes->destroy(attributes); - - return &clone->public; -} - - -/** - * Implementation of transform_substructure_t.get_key_length. - */ -static status_t get_key_length(private_transform_substructure_t *this, u_int16_t *key_length) -{ - iterator_t *attributes; - transform_attribute_t *current_attribute; - - attributes = this->attributes->create_iterator(this->attributes, TRUE); - while (attributes->iterate(attributes, (void**)¤t_attribute)) - { - if (current_attribute->get_attribute_type(current_attribute) == KEY_LENGTH) - { - *key_length = current_attribute->get_value(current_attribute); - attributes->destroy(attributes); - return SUCCESS; - } - } - attributes->destroy(attributes); - return FAILED; -} - - -/** - * Implementation of transform_substructure_t.destroy and payload_t.destroy. - */ -static void destroy(private_transform_substructure_t *this) -======= METHOD(transform_substructure_t, get_key_length, status_t, private_transform_substructure_t *this, u_int16_t *key_length) { @@ -489,7 +239,6 @@ METHOD(transform_substructure_t, get_key_length, status_t, METHOD2(payload_t, transform_substructure_t, destroy, void, private_transform_substructure_t *this) ->>>>>>> upstream/4.5.1 { this->attributes->destroy_offset(this->attributes, offsetof(transform_attribute_t, destroy)); @@ -501,40 +250,6 @@ METHOD2(payload_t, transform_substructure_t, destroy, void, */ transform_substructure_t *transform_substructure_create() { -<<<<<<< HEAD - private_transform_substructure_t *this = malloc_thing(private_transform_substructure_t); - - /* payload interface */ - this->public.payload_interface.verify = (status_t (*) (payload_t *))verify; - this->public.payload_interface.get_encoding_rules = (void (*) (payload_t *, encoding_rule_t **, size_t *) ) get_encoding_rules; - this->public.payload_interface.get_length = (size_t (*) (payload_t *)) get_length; - this->public.payload_interface.get_next_type = (payload_type_t (*) (payload_t *)) get_next_type; - this->public.payload_interface.set_next_type = (void (*) (payload_t *,payload_type_t)) set_next_type; - this->public.payload_interface.get_type = (payload_type_t (*) (payload_t *)) get_type; - this->public.payload_interface.destroy = (void (*) (payload_t *))destroy; - - /* public functions */ - this->public.create_transform_attribute_iterator = (iterator_t * (*) (transform_substructure_t *,bool)) create_transform_attribute_iterator; - this->public.add_transform_attribute = (void (*) (transform_substructure_t *,transform_attribute_t *)) add_transform_attribute; - this->public.set_is_last_transform = (void (*) (transform_substructure_t *,bool)) set_is_last_transform; - this->public.get_is_last_transform = (bool (*) (transform_substructure_t *)) get_is_last_transform; - this->public.set_transform_type = (void (*) (transform_substructure_t *,u_int8_t)) set_transform_type; - this->public.get_transform_type = (u_int8_t (*) (transform_substructure_t *)) get_transform_type; - this->public.set_transform_id = (void (*) (transform_substructure_t *,u_int16_t)) set_transform_id; - this->public.get_transform_id = (u_int16_t (*) (transform_substructure_t *)) get_transform_id; - this->public.get_key_length = (status_t (*) (transform_substructure_t *,u_int16_t *)) get_key_length; - this->public.clone = (transform_substructure_t* (*) (transform_substructure_t *)) clone_; - this->public.destroy = (void (*) (transform_substructure_t *)) destroy; - - /* set default values of the fields */ - this->next_payload = NO_PAYLOAD; - this->transform_length = TRANSFORM_SUBSTRUCTURE_HEADER_LENGTH; - this->transform_id = 0; - this->transform_type = 0; - this->attributes = linked_list_create(); - - return (&(this->public)); -======= private_transform_substructure_t *this; INIT(this, @@ -559,32 +274,12 @@ transform_substructure_t *transform_substructure_create() .attributes = linked_list_create(), ); return &this->public; ->>>>>>> upstream/4.5.1 } /* * Described in header */ transform_substructure_t *transform_substructure_create_type( -<<<<<<< HEAD - transform_type_t transform_type, - u_int16_t transform_id, u_int16_t key_length) -{ - transform_substructure_t *transform = transform_substructure_create(); - - transform->set_transform_type(transform,transform_type); - transform->set_transform_id(transform,transform_id); - - if (key_length) - { - transform_attribute_t *attribute; - - attribute = transform_attribute_create_key_length(key_length); - transform->add_transform_attribute(transform, attribute); - - } - return transform; -======= transform_type_t type, u_int16_t id, u_int16_t key_length) { private_transform_substructure_t *this; @@ -600,6 +295,5 @@ transform_substructure_t *transform_substructure_create_type( compute_length(this); } return &this->public; ->>>>>>> upstream/4.5.1 } diff --git a/src/libcharon/encoding/payloads/transform_substructure.h b/src/libcharon/encoding/payloads/transform_substructure.h index 2a60b65ba..c961700a4 100644 --- a/src/libcharon/encoding/payloads/transform_substructure.h +++ b/src/libcharon/encoding/payloads/transform_substructure.h @@ -34,10 +34,6 @@ typedef struct transform_substructure_t transform_substructure_t; #include <crypto/crypters/crypter.h> #include <config/proposal.h> -<<<<<<< HEAD - -======= ->>>>>>> upstream/4.5.1 /** * IKEv1 Value for a transform payload. */ @@ -48,42 +44,19 @@ typedef struct transform_substructure_t transform_substructure_t; */ #define TRANSFORM_SUBSTRUCTURE_HEADER_LENGTH 8 -<<<<<<< HEAD - -======= ->>>>>>> upstream/4.5.1 /** * Class representing an IKEv2- TRANSFORM SUBSTRUCTURE. * * The TRANSFORM SUBSTRUCTURE format is described in RFC section 3.3.2. */ struct transform_substructure_t { -<<<<<<< HEAD -======= ->>>>>>> upstream/4.5.1 /** * The payload_t interface. */ payload_t payload_interface; /** -<<<<<<< HEAD - * Creates an iterator of stored transform_attribute_t objects. - * - * When deleting an transform attribute using this iterator, - * the length of this transform substructure has to be refreshed - * by calling get_length(). - * - * @param forward iterator direction (TRUE: front to end) - * @return created iterator_t object. - */ - iterator_t * (*create_transform_attribute_iterator) ( - transform_substructure_t *this, bool forward); - - /** -======= ->>>>>>> upstream/4.5.1 * Adds a transform_attribute_t object to this object. * * @param proposal transform_attribute_t object to add @@ -102,23 +75,6 @@ struct transform_substructure_t { void (*set_is_last_transform) (transform_substructure_t *this, bool is_last); /** -<<<<<<< HEAD - * Checks if this is the last transform. - * - * @return TRUE if this is the last Transform, FALSE otherwise - */ - bool (*get_is_last_transform) (transform_substructure_t *this); - - /** - * Sets transform type of the current transform substructure. - * - * @param type type value to set - */ - void (*set_transform_type) (transform_substructure_t *this, u_int8_t type); - - /** -======= ->>>>>>> upstream/4.5.1 * get transform type of the current transform. * * @return Transform type of current transform substructure. @@ -126,29 +82,14 @@ struct transform_substructure_t { u_int8_t (*get_transform_type) (transform_substructure_t *this); /** -<<<<<<< HEAD - * Sets transform id of the current transform substructure. - * - * @param id transform id to set - */ - void (*set_transform_id) (transform_substructure_t *this, u_int16_t id); - - /** - * get transform id of the current transform. -======= * Get transform id of the current transform. ->>>>>>> upstream/4.5.1 * * @return Transform id of current transform substructure. */ u_int16_t (*get_transform_id) (transform_substructure_t *this); /** -<<<<<<< HEAD - * get transform id of the current transform. -======= * Get transform id of the current transform. ->>>>>>> upstream/4.5.1 * * @param key_length The key length is written to this location * @return @@ -160,16 +101,6 @@ struct transform_substructure_t { u_int16_t *key_length); /** -<<<<<<< HEAD - * Clones an transform_substructure_t object. - * - * @return cloned transform_substructure_t object - */ - transform_substructure_t* (*clone) (transform_substructure_t *this); - - /** -======= ->>>>>>> upstream/4.5.1 * Destroys an transform_substructure_t object. */ void (*destroy) (transform_substructure_t *this); @@ -178,31 +109,13 @@ struct transform_substructure_t { /** * Creates an empty transform_substructure_t object. * -<<<<<<< HEAD - * @return created transform_substructure_t object -======= * @return created transform_substructure_t object ->>>>>>> upstream/4.5.1 */ transform_substructure_t *transform_substructure_create(void); /** * Creates an empty transform_substructure_t object. * -<<<<<<< HEAD - * The key length is used for the transport types ENCRYPTION_ALGORITHM, - * PSEUDO_RANDOM_FUNCTION, INTEGRITY_ALGORITHM. For all - * other transport types the key_length parameter is not used - * - * @param transform_type type of transform to create - * @param transform_id transform id specifying the specific algorithm of a transform type - * @param key_length Key length for key lenght attribute - * @return transform_substructure_t object - */ -transform_substructure_t *transform_substructure_create_type( - transform_type_t transform_type, u_int16_t transform_id, - u_int16_t key_length); -======= * @param type type of transform to create * @param id transform id specifc for the transform type * @param key_length key length for key lenght attribute, 0 to omit @@ -210,6 +123,5 @@ transform_substructure_t *transform_substructure_create_type( */ transform_substructure_t *transform_substructure_create_type( transform_type_t type, u_int16_t id, u_int16_t key_length); ->>>>>>> upstream/4.5.1 #endif /** TRANSFORM_SUBSTRUCTURE_H_ @}*/ diff --git a/src/libcharon/encoding/payloads/ts_payload.c b/src/libcharon/encoding/payloads/ts_payload.c index db01b433f..28f760e40 100644 --- a/src/libcharon/encoding/payloads/ts_payload.c +++ b/src/libcharon/encoding/payloads/ts_payload.c @@ -1,10 +1,6 @@ /* -<<<<<<< HEAD - * Copyright (C) 2005-2006 Martin Willi -======= * Copyright (C) 2005-2010 Martin Willi * Copyright (C) 2010 revosec AG ->>>>>>> upstream/4.5.1 * Copyright (C) 2005 Jan Hutter * Hochschule fuer Technik Rapperswil * @@ -30,15 +26,9 @@ typedef struct private_ts_payload_t private_ts_payload_t; /** * Private data of an ts_payload_t object. -<<<<<<< HEAD - * - */ -struct private_ts_payload_t { -======= */ struct private_ts_payload_t { ->>>>>>> upstream/4.5.1 /** * Public ts_payload_t interface. */ @@ -60,8 +50,6 @@ struct private_ts_payload_t { bool critical; /** -<<<<<<< HEAD -======= * reserved bits */ bool reserved_bit[7]; @@ -72,7 +60,6 @@ struct private_ts_payload_t { bool reserved_byte[3]; /** ->>>>>>> upstream/4.5.1 * Length of this payload. */ u_int16_t payload_length; @@ -80,20 +67,12 @@ struct private_ts_payload_t { /** * Number of traffic selectors */ -<<<<<<< HEAD - u_int8_t number_of_traffic_selectors; -======= u_int8_t ts_num; ->>>>>>> upstream/4.5.1 /** * Contains the traffic selectors of type traffic_selector_substructure_t. */ -<<<<<<< HEAD - linked_list_t *traffic_selectors; -======= linked_list_t *substrs; ->>>>>>> upstream/4.5.1 }; /** @@ -101,33 +80,6 @@ struct private_ts_payload_t { * * The defined offsets are the positions in a object of type * private_ts_payload_t. -<<<<<<< HEAD - * - */ -encoding_rule_t ts_payload_encodings[] = { - /* 1 Byte next payload type, stored in the field next_payload */ - { U_INT_8, offsetof(private_ts_payload_t, next_payload) }, - /* the critical bit */ - { FLAG, offsetof(private_ts_payload_t, critical) }, - /* 7 Bit reserved bits, nowhere stored */ - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - /* Length of the whole payload*/ - { PAYLOAD_LENGTH, offsetof(private_ts_payload_t, payload_length)}, - /* 1 Byte TS type*/ - { U_INT_8, offsetof(private_ts_payload_t, number_of_traffic_selectors) }, - /* 3 reserved bytes */ - { RESERVED_BYTE, 0 }, - { RESERVED_BYTE, 0 }, - { RESERVED_BYTE, 0 }, - /* some ts data bytes, length is defined in PAYLOAD_LENGTH */ - { TRAFFIC_SELECTORS, offsetof(private_ts_payload_t, traffic_selectors) } -======= */ encoding_rule_t ts_payload_encodings[] = { /* 1 Byte next payload type, stored in the field next_payload */ @@ -152,7 +104,6 @@ encoding_rule_t ts_payload_encodings[] = { { RESERVED_BYTE, offsetof(private_ts_payload_t, reserved_byte[2])}, /* some ts data bytes, length is defined in PAYLOAD_LENGTH */ { TRAFFIC_SELECTORS,offsetof(private_ts_payload_t, substrs) } ->>>>>>> upstream/4.5.1 }; /* @@ -169,27 +120,6 @@ encoding_rule_t ts_payload_encodings[] = { +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -<<<<<<< HEAD -/** - * Implementation of payload_t.verify. - */ -static status_t verify(private_ts_payload_t *this) -{ - iterator_t *iterator; - payload_t *current_traffic_selector; - status_t status = SUCCESS; - - if (this->number_of_traffic_selectors != (this->traffic_selectors->get_count(this->traffic_selectors))) - { - /* must be the same */ - return FAILED; - } - - iterator = this->traffic_selectors->create_iterator(this->traffic_selectors,TRUE); - while(iterator->iterate(iterator, (void**)¤t_traffic_selector)) - { - status = current_traffic_selector->verify(current_traffic_selector); -======= METHOD(payload_t, verify, status_t, private_ts_payload_t *this) { @@ -205,36 +135,16 @@ METHOD(payload_t, verify, status_t, while (enumerator->enumerate(enumerator, &substr)) { status = substr->verify(substr); ->>>>>>> upstream/4.5.1 if (status != SUCCESS) { break; } } -<<<<<<< HEAD - iterator->destroy(iterator); -======= enumerator->destroy(enumerator); ->>>>>>> upstream/4.5.1 return status; } -<<<<<<< HEAD -/** - * Implementation of ts_payload_t.get_encoding_rules. - */ -static void get_encoding_rules(private_ts_payload_t *this, encoding_rule_t **rules, size_t *rule_count) -{ - *rules = ts_payload_encodings; - *rule_count = sizeof(ts_payload_encodings) / sizeof(encoding_rule_t); -} - -/** - * Implementation of payload_t.get_type. - */ -static payload_type_t get_payload_type(private_ts_payload_t *this) -======= METHOD(payload_t, get_encoding_rules, void, private_ts_payload_t *this, encoding_rule_t **rules, size_t *rule_count) { @@ -244,32 +154,11 @@ METHOD(payload_t, get_encoding_rules, void, METHOD(payload_t, get_type, payload_type_t, private_ts_payload_t *this) ->>>>>>> upstream/4.5.1 { if (this->is_initiator) { return TRAFFIC_SELECTOR_INITIATOR; } -<<<<<<< HEAD - else - { - return TRAFFIC_SELECTOR_RESPONDER; - } -} - -/** - * Implementation of payload_t.get_next_type. - */ -static payload_type_t get_next_type(private_ts_payload_t *this) -{ - return (this->next_payload); -} - -/** - * Implementation of payload_t.set_next_type. - */ -static void set_next_type(private_ts_payload_t *this,payload_type_t type) -======= return TRAFFIC_SELECTOR_RESPONDER; } @@ -281,7 +170,6 @@ METHOD(payload_t, get_next_type, payload_type_t, METHOD(payload_t, set_next_type, void, private_ts_payload_t *this,payload_type_t type) ->>>>>>> upstream/4.5.1 { this->next_payload = type; } @@ -289,48 +177,6 @@ METHOD(payload_t, set_next_type, void, /** * recompute the length of the payload. */ -<<<<<<< HEAD -static void compute_length (private_ts_payload_t *this) -{ - iterator_t *iterator; - size_t ts_count = 0; - size_t length = TS_PAYLOAD_HEADER_LENGTH; - payload_t *current_traffic_selector; - - iterator = this->traffic_selectors->create_iterator(this->traffic_selectors,TRUE); - while (iterator->iterate(iterator, (void**)¤t_traffic_selector)) - { - length += current_traffic_selector->get_length(current_traffic_selector); - ts_count++; - } - iterator->destroy(iterator); - - this->number_of_traffic_selectors= ts_count; - this->payload_length = length; -} - -/** - * Implementation of payload_t.get_length. - */ -static size_t get_length(private_ts_payload_t *this) -{ - compute_length(this); - return this->payload_length; -} - -/** - * Implementation of ts_payload_t.get_initiator. - */ -static bool get_initiator (private_ts_payload_t *this) -{ - return (this->is_initiator); -} - -/** - * Implementation of ts_payload_t.set_initiator. - */ -static void set_initiator (private_ts_payload_t *this,bool is_initiator) -======= static void compute_length(private_ts_payload_t *this) { enumerator_t *enumerator; @@ -361,58 +207,10 @@ METHOD(ts_payload_t, get_initiator, bool, METHOD(ts_payload_t, set_initiator, void, private_ts_payload_t *this,bool is_initiator) ->>>>>>> upstream/4.5.1 { this->is_initiator = is_initiator; } -<<<<<<< HEAD -/** - * Implementation of ts_payload_t.add_traffic_selector_substructure. - */ -static void add_traffic_selector_substructure (private_ts_payload_t *this,traffic_selector_substructure_t *traffic_selector) -{ - this->traffic_selectors->insert_last(this->traffic_selectors,traffic_selector); - this->number_of_traffic_selectors = this->traffic_selectors->get_count(this->traffic_selectors); -} - -/** - * Implementation of ts_payload_t.create_traffic_selector_substructure_iterator. - */ -static iterator_t * create_traffic_selector_substructure_iterator (private_ts_payload_t *this, bool forward) -{ - return this->traffic_selectors->create_iterator(this->traffic_selectors,forward); -} - -/** - * Implementation of ts_payload_t.get_traffic_selectors. - */ -static linked_list_t *get_traffic_selectors(private_ts_payload_t *this) -{ - traffic_selector_t *ts; - iterator_t *iterator; - traffic_selector_substructure_t *ts_substructure; - linked_list_t *ts_list = linked_list_create(); - - iterator = this->traffic_selectors->create_iterator(this->traffic_selectors, TRUE); - while (iterator->iterate(iterator, (void**)&ts_substructure)) - { - ts = ts_substructure->get_traffic_selector(ts_substructure); - ts_list->insert_last(ts_list, (void*)ts); - } - iterator->destroy(iterator); - - return ts_list; -} - -/** - * Implementation of payload_t.destroy and ts_payload_t.destroy. - */ -static void destroy(private_ts_payload_t *this) -{ - this->traffic_selectors->destroy_offset(this->traffic_selectors, - offsetof(payload_t, destroy)); -======= METHOD(ts_payload_t, get_traffic_selectors, linked_list_t*, private_ts_payload_t *this) { @@ -437,7 +235,6 @@ METHOD2(payload_t, ts_payload_t, destroy, void, private_ts_payload_t *this) { this->substrs->destroy_offset(this->substrs, offsetof(payload_t, destroy)); ->>>>>>> upstream/4.5.1 free(this); } @@ -446,36 +243,6 @@ METHOD2(payload_t, ts_payload_t, destroy, void, */ ts_payload_t *ts_payload_create(bool is_initiator) { -<<<<<<< HEAD - private_ts_payload_t *this = malloc_thing(private_ts_payload_t); - - /* interface functions */ - this->public.payload_interface.verify = (status_t (*) (payload_t *))verify; - this->public.payload_interface.get_encoding_rules = (void (*) (payload_t *, encoding_rule_t **, size_t *) ) get_encoding_rules; - this->public.payload_interface.get_length = (size_t (*) (payload_t *)) get_length; - this->public.payload_interface.get_next_type = (payload_type_t (*) (payload_t *)) get_next_type; - this->public.payload_interface.set_next_type = (void (*) (payload_t *,payload_type_t)) set_next_type; - this->public.payload_interface.get_type = (payload_type_t (*) (payload_t *)) get_payload_type; - this->public.payload_interface.destroy = (void (*) (payload_t *))destroy; - - /* public functions */ - this->public.destroy = (void (*) (ts_payload_t *)) destroy; - this->public.get_initiator = (bool (*) (ts_payload_t *)) get_initiator; - this->public.set_initiator = (void (*) (ts_payload_t *,bool)) set_initiator; - this->public.add_traffic_selector_substructure = (void (*) (ts_payload_t *,traffic_selector_substructure_t *)) add_traffic_selector_substructure; - this->public.create_traffic_selector_substructure_iterator = (iterator_t* (*) (ts_payload_t *,bool)) create_traffic_selector_substructure_iterator; - this->public.get_traffic_selectors = (linked_list_t *(*) (ts_payload_t *)) get_traffic_selectors; - - /* private variables */ - this->critical = FALSE; - this->next_payload = NO_PAYLOAD; - this->payload_length =TS_PAYLOAD_HEADER_LENGTH; - this->is_initiator = is_initiator; - this->number_of_traffic_selectors = 0; - this->traffic_selectors = linked_list_create(); - - return &(this->public); -======= private_ts_payload_t *this; INIT(this, @@ -500,43 +267,21 @@ ts_payload_t *ts_payload_create(bool is_initiator) .substrs = linked_list_create(), ); return &this->public; ->>>>>>> upstream/4.5.1 } /* * Described in header */ -<<<<<<< HEAD -ts_payload_t *ts_payload_create_from_traffic_selectors(bool is_initiator, linked_list_t *traffic_selectors) -{ - iterator_t *iterator; - traffic_selector_t *ts; - traffic_selector_substructure_t *ts_substructure; -======= ts_payload_t *ts_payload_create_from_traffic_selectors(bool is_initiator, linked_list_t *traffic_selectors) { enumerator_t *enumerator; traffic_selector_t *ts; traffic_selector_substructure_t *subst; ->>>>>>> upstream/4.5.1 private_ts_payload_t *this; this = (private_ts_payload_t*)ts_payload_create(is_initiator); -<<<<<<< HEAD - iterator = traffic_selectors->create_iterator(traffic_selectors, TRUE); - while (iterator->iterate(iterator, (void**)&ts)) - { - ts_substructure = traffic_selector_substructure_create_from_traffic_selector(ts); - this->public.add_traffic_selector_substructure(&(this->public), ts_substructure); - } - iterator->destroy(iterator); - - return &(this->public); -} - -======= enumerator = traffic_selectors->create_enumerator(traffic_selectors); while (enumerator->enumerate(enumerator, &ts)) { @@ -548,4 +293,3 @@ ts_payload_t *ts_payload_create_from_traffic_selectors(bool is_initiator, return &this->public; } ->>>>>>> upstream/4.5.1 diff --git a/src/libcharon/encoding/payloads/ts_payload.h b/src/libcharon/encoding/payloads/ts_payload.h index eb39a5c1d..88ca00bc9 100644 --- a/src/libcharon/encoding/payloads/ts_payload.h +++ b/src/libcharon/encoding/payloads/ts_payload.h @@ -19,10 +19,6 @@ * @{ @ingroup payloads */ -<<<<<<< HEAD - -======= ->>>>>>> upstream/4.5.1 #ifndef TS_PAYLOAD_H_ #define TS_PAYLOAD_H_ @@ -39,20 +35,13 @@ typedef struct ts_payload_t ts_payload_t; */ #define TS_PAYLOAD_HEADER_LENGTH 8 -<<<<<<< HEAD - -======= ->>>>>>> upstream/4.5.1 /** * Class representing an IKEv2 TS payload. * * The TS payload format is described in RFC section 3.13. */ struct ts_payload_t { -<<<<<<< HEAD -======= ->>>>>>> upstream/4.5.1 /** * The payload_t interface. */ @@ -77,30 +66,6 @@ struct ts_payload_t { void (*set_initiator) (ts_payload_t *this,bool is_initiator); /** -<<<<<<< HEAD - * Adds a traffic_selector_substructure_t object to this object. - * - * @param traffic_selector traffic_selector_substructure_t object to add - */ - void (*add_traffic_selector_substructure) (ts_payload_t *this, - traffic_selector_substructure_t *traffic_selector); - - /** - * Creates an iterator of stored traffic_selector_substructure_t objects. - * - * When removing an traffic_selector_substructure_t object - * using this iterator, the length of this payload - * has to get refreshed by calling payload_t.get_length! - * - * @param forward iterator direction (TRUE: front to end) - * @return created iterator_t object - */ - iterator_t *(*create_traffic_selector_substructure_iterator) ( - ts_payload_t *this, bool forward); - - /** -======= ->>>>>>> upstream/4.5.1 * Get a list of nested traffic selectors as traffic_selector_t. * * Resulting list and its traffic selectors must be destroyed after usage @@ -118,28 +83,15 @@ struct ts_payload_t { /** * Creates an empty ts_payload_t object. * -<<<<<<< HEAD - * @param is_initiator - * - TRUE if this payload is of type TSi - * - FALSE if this payload is of type TSr - * @return ts_payload_t object -======= * @param is_initiator TRUE for TSi, FALSE for TSr payload type * @return ts_payload_t object ->>>>>>> upstream/4.5.1 */ ts_payload_t *ts_payload_create(bool is_initiator); /** * Creates ts_payload with a list of traffic_selector_t * -<<<<<<< HEAD - * @param is_initiator - * - TRUE if this payload is of type TSi - * - FALSE if this payload is of type TSr -======= * @param is_initiator TRUE for TSi, FALSE for TSr payload type ->>>>>>> upstream/4.5.1 * @param traffic_selectors list of traffic selectors to include * @return ts_payload_t object */ diff --git a/src/libcharon/encoding/payloads/unknown_payload.c b/src/libcharon/encoding/payloads/unknown_payload.c index 2f428ed06..27af338b3 100644 --- a/src/libcharon/encoding/payloads/unknown_payload.c +++ b/src/libcharon/encoding/payloads/unknown_payload.c @@ -18,11 +18,6 @@ #include "unknown_payload.h" -<<<<<<< HEAD - - -======= ->>>>>>> upstream/4.5.1 typedef struct private_unknown_payload_t private_unknown_payload_t; /** @@ -36,14 +31,11 @@ struct private_unknown_payload_t { unknown_payload_t public; /** -<<<<<<< HEAD -======= * Type of this payload */ payload_type_t type; /** ->>>>>>> upstream/4.5.1 * Next payload type. */ u_int8_t next_payload; @@ -54,14 +46,11 @@ struct private_unknown_payload_t { bool critical; /** -<<<<<<< HEAD -======= * Reserved bits */ bool reserved[7]; /** ->>>>>>> upstream/4.5.1 * Length of this payload. */ u_int16_t payload_length; @@ -81,23 +70,6 @@ struct private_unknown_payload_t { */ encoding_rule_t unknown_payload_encodings[] = { /* 1 Byte next payload type, stored in the field next_payload */ -<<<<<<< HEAD - { U_INT_8, offsetof(private_unknown_payload_t, next_payload)}, - /* the critical bit */ - { FLAG, offsetof(private_unknown_payload_t, critical) }, - /* 7 Bit reserved bits, nowhere stored */ - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - /* Length of the whole payload*/ - { PAYLOAD_LENGTH, offsetof(private_unknown_payload_t, payload_length)}, - /* some unknown data bytes, length is defined in PAYLOAD_LENGTH */ - { UNKNOWN_DATA, offsetof(private_unknown_payload_t, data) } -======= { U_INT_8, offsetof(private_unknown_payload_t, next_payload) }, /* the critical bit */ { FLAG, offsetof(private_unknown_payload_t, critical) }, @@ -113,7 +85,6 @@ encoding_rule_t unknown_payload_encodings[] = { { PAYLOAD_LENGTH, offsetof(private_unknown_payload_t, payload_length) }, /* some unknown data bytes, length is defined in PAYLOAD_LENGTH */ { UNKNOWN_DATA, offsetof(private_unknown_payload_t, data) }, ->>>>>>> upstream/4.5.1 }; /* @@ -128,21 +99,6 @@ encoding_rule_t unknown_payload_encodings[] = { +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -<<<<<<< HEAD -/** - * Implementation of payload_t.verify. - */ -static status_t verify(private_unknown_payload_t *this) -{ - /* can't do any checks, so we assume its good */ - return SUCCESS; -} - -/** - * Implementation of payload_t.get_encoding_rules. - */ -static void get_encoding_rules(private_unknown_payload_t *this, encoding_rule_t **rules, size_t *rule_count) -======= METHOD(payload_t, verify, status_t, private_unknown_payload_t *this) { @@ -155,34 +111,11 @@ METHOD(payload_t, verify, status_t, METHOD(payload_t, get_encoding_rules, void, private_unknown_payload_t *this, encoding_rule_t **rules, size_t *rule_count) ->>>>>>> upstream/4.5.1 { *rules = unknown_payload_encodings; *rule_count = sizeof(unknown_payload_encodings) / sizeof(encoding_rule_t); } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_type. - */ -static payload_type_t get_payload_type(private_unknown_payload_t *this) -{ - return UNKNOWN_PAYLOAD; -} - -/** - * Implementation of payload_t.get_next_type. - */ -static payload_type_t get_next_type(private_unknown_payload_t *this) -{ - return (this->next_payload); -} - -/** - * Implementation of payload_t.set_next_type. - */ -static void set_next_type(private_unknown_payload_t *this,payload_type_t type) -======= METHOD(payload_t, get_payload_type, payload_type_t, private_unknown_payload_t *this) { @@ -197,57 +130,22 @@ METHOD(payload_t, get_next_type, payload_type_t, METHOD(payload_t, set_next_type, void, private_unknown_payload_t *this,payload_type_t type) ->>>>>>> upstream/4.5.1 { this->next_payload = type; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_length. - */ -static size_t get_length(private_unknown_payload_t *this) -======= METHOD(payload_t, get_length, size_t, private_unknown_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->payload_length; } -<<<<<<< HEAD -/** - * Implementation of unknown_payload_t.get_data. - */ -static bool is_critical(private_unknown_payload_t *this) -======= METHOD(unknown_payload_t, is_critical, bool, private_unknown_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->critical; } -<<<<<<< HEAD -/** - * Implementation of unknown_payload_t.get_data. - */ -static chunk_t get_data (private_unknown_payload_t *this) -{ - return (this->data); -} - -/** - * Implementation of payload_t.destroy and unknown_payload_t.destroy. - */ -static void destroy(private_unknown_payload_t *this) -{ - if (this->data.ptr != NULL) - { - chunk_free(&(this->data)); - } - -======= METHOD(unknown_payload_t, get_data, chunk_t, private_unknown_payload_t *this) { @@ -258,40 +156,12 @@ METHOD2(payload_t, unknown_payload_t, destroy, void, private_unknown_payload_t *this) { free(this->data.ptr); ->>>>>>> upstream/4.5.1 free(this); } /* * Described in header */ -<<<<<<< HEAD -unknown_payload_t *unknown_payload_create() -{ - private_unknown_payload_t *this = malloc_thing(private_unknown_payload_t); - - /* interface functions */ - this->public.payload_interface.verify = (status_t (*) (payload_t *))verify; - this->public.payload_interface.get_encoding_rules = (void (*) (payload_t *, encoding_rule_t **, size_t *) ) get_encoding_rules; - this->public.payload_interface.get_length = (size_t (*) (payload_t *)) get_length; - this->public.payload_interface.get_next_type = (payload_type_t (*) (payload_t *)) get_next_type; - this->public.payload_interface.set_next_type = (void (*) (payload_t *,payload_type_t)) set_next_type; - this->public.payload_interface.get_type = (payload_type_t (*) (payload_t *)) get_payload_type; - this->public.payload_interface.destroy = (void (*) (payload_t *))destroy; - - /* public functions */ - this->public.destroy = (void (*) (unknown_payload_t *)) destroy; - this->public.is_critical = (bool (*) (unknown_payload_t *)) is_critical; - this->public.get_data = (chunk_t (*) (unknown_payload_t *)) get_data; - - /* private variables */ - this->critical = FALSE; - this->next_payload = NO_PAYLOAD; - this->payload_length = UNKNOWN_PAYLOAD_HEADER_LENGTH; - this->data = chunk_empty; - - return (&(this->public)); -======= unknown_payload_t *unknown_payload_create(payload_type_t type) { private_unknown_payload_t *this; @@ -334,5 +204,4 @@ unknown_payload_t *unknown_payload_create_data(payload_type_t type, this->payload_length = UNKNOWN_PAYLOAD_HEADER_LENGTH + data.len; return &this->public; ->>>>>>> upstream/4.5.1 } diff --git a/src/libcharon/encoding/payloads/unknown_payload.h b/src/libcharon/encoding/payloads/unknown_payload.h index b874f6dc3..5ae85331b 100644 --- a/src/libcharon/encoding/payloads/unknown_payload.h +++ b/src/libcharon/encoding/payloads/unknown_payload.h @@ -70,13 +70,6 @@ struct unknown_payload_t { }; /** -<<<<<<< HEAD - * Creates an empty unknown_payload_t object. - * - * @return unknown_payload_t object - */ -unknown_payload_t *unknown_payload_create(void); -======= * Creates an empty unknown_payload_t. * * @param type of the payload @@ -94,6 +87,5 @@ unknown_payload_t *unknown_payload_create(payload_type_t type); */ unknown_payload_t *unknown_payload_create_data(payload_type_t type, bool critical, chunk_t data); ->>>>>>> upstream/4.5.1 #endif /** UNKNOWN_PAYLOAD_H_ @}*/ diff --git a/src/libcharon/encoding/payloads/vendor_id_payload.c b/src/libcharon/encoding/payloads/vendor_id_payload.c index d2295e4a2..e9e80e989 100644 --- a/src/libcharon/encoding/payloads/vendor_id_payload.c +++ b/src/libcharon/encoding/payloads/vendor_id_payload.c @@ -1,10 +1,6 @@ /* -<<<<<<< HEAD - * Copyright (C) 2005-2009 Martin Willi -======= * Copyright (C) 2005-2010 Martin Willi * Copyright (C) 2010 revosec AG ->>>>>>> upstream/4.5.1 * Copyright (C) 2005 Jan Hutter * Hochschule fuer Technik Rapperswil * @@ -46,14 +42,11 @@ struct private_vendor_id_payload_t { bool critical; /** -<<<<<<< HEAD -======= * Reserved bits */ bool reserved[7]; /** ->>>>>>> upstream/4.5.1 * Length of this payload. */ u_int16_t payload_length; @@ -72,23 +65,6 @@ struct private_vendor_id_payload_t { */ encoding_rule_t vendor_id_payload_encodings[] = { /* 1 Byte next payload type, stored in the field next_payload */ -<<<<<<< HEAD - { U_INT_8, offsetof(private_vendor_id_payload_t, next_payload) }, - /* the critical bit */ - { FLAG, offsetof(private_vendor_id_payload_t, critical) }, - /* 7 Bit reserved bits, nowhere stored */ - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - { RESERVED_BIT, 0 }, - /* Length of the whole payload*/ - { PAYLOAD_LENGTH, offsetof(private_vendor_id_payload_t, payload_length)}, - /* some vendor_id data bytes, length is defined in PAYLOAD_LENGTH */ - { VID_DATA, offsetof(private_vendor_id_payload_t, data) } -======= { U_INT_8, offsetof(private_vendor_id_payload_t, next_payload) }, /* the critical bit */ { FLAG, offsetof(private_vendor_id_payload_t, critical) }, @@ -104,7 +80,6 @@ encoding_rule_t vendor_id_payload_encodings[] = { { PAYLOAD_LENGTH, offsetof(private_vendor_id_payload_t, payload_length)}, /* some vendor_id data bytes, length is defined in PAYLOAD_LENGTH */ { VID_DATA, offsetof(private_vendor_id_payload_t, data) } ->>>>>>> upstream/4.5.1 }; /* @@ -119,35 +94,12 @@ encoding_rule_t vendor_id_payload_encodings[] = { +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -<<<<<<< HEAD -/** - * Implementation of payload_t.verify. - */ -static status_t verify(private_vendor_id_payload_t *this) -======= METHOD(payload_t, verify, status_t, private_vendor_id_payload_t *this) ->>>>>>> upstream/4.5.1 { return SUCCESS; } -<<<<<<< HEAD -/** - * Implementation of vendor_id_payload_t.get_encoding_rules. - */ -static void get_encoding_rules(private_vendor_id_payload_t *this, - encoding_rule_t **rules, size_t *rule_count) -{ - *rules = vendor_id_payload_encodings; - *rule_count = sizeof(vendor_id_payload_encodings) / sizeof(encoding_rule_t); -} - -/** - * Implementation of payload_t.get_type. - */ -static payload_type_t get_payload_type(private_vendor_id_payload_t *this) -======= METHOD(payload_t, get_encoding_rules, void, private_vendor_id_payload_t *this, encoding_rule_t **rules, size_t *rule_count) @@ -158,72 +110,36 @@ METHOD(payload_t, get_encoding_rules, void, METHOD(payload_t, get_type, payload_type_t, private_vendor_id_payload_t *this) ->>>>>>> upstream/4.5.1 { return VENDOR_ID; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_next_type. - */ -static payload_type_t get_next_type(private_vendor_id_payload_t *this) -======= METHOD(payload_t, get_next_type, payload_type_t, private_vendor_id_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->next_payload; } -<<<<<<< HEAD -/** - * Implementation of payload_t.set_next_type. - */ -static void set_next_type(private_vendor_id_payload_t *this,payload_type_t type) -======= METHOD(payload_t, set_next_type, void, private_vendor_id_payload_t *this, payload_type_t type) ->>>>>>> upstream/4.5.1 { this->next_payload = type; } -<<<<<<< HEAD -/** - * Implementation of payload_t.get_length. - */ -static size_t get_length(private_vendor_id_payload_t *this) -======= METHOD(payload_t, get_length, size_t, private_vendor_id_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->payload_length; } -<<<<<<< HEAD -/** - * Implementation of vendor_id_payload_t.get_data. - */ -static chunk_t get_data(private_vendor_id_payload_t *this) -======= METHOD(vendor_id_payload_t, get_data, chunk_t, private_vendor_id_payload_t *this) ->>>>>>> upstream/4.5.1 { return this->data; } -<<<<<<< HEAD -/** - * Implementation of payload_t.destroy and vendor_id_payload_t.destroy. - */ -static void destroy(private_vendor_id_payload_t *this) -======= METHOD2(payload_t, vendor_id_payload_t, destroy, void, private_vendor_id_payload_t *this) ->>>>>>> upstream/4.5.1 { free(this->data.ptr); free(this); @@ -232,26 +148,6 @@ METHOD2(payload_t, vendor_id_payload_t, destroy, void, /* * Described in header */ -<<<<<<< HEAD -vendor_id_payload_t *vendor_id_payload_create() -{ - private_vendor_id_payload_t *this = malloc_thing(private_vendor_id_payload_t); - - this->public.payload_interface.verify = (status_t (*) (payload_t *))verify; - this->public.payload_interface.get_encoding_rules = (void (*) (payload_t *, encoding_rule_t **, size_t *) ) get_encoding_rules; - this->public.payload_interface.get_length = (size_t (*) (payload_t *)) get_length; - this->public.payload_interface.get_next_type = (payload_type_t (*) (payload_t *)) get_next_type; - this->public.payload_interface.set_next_type = (void (*) (payload_t *,payload_type_t)) set_next_type; - this->public.payload_interface.get_type = (payload_type_t (*) (payload_t *)) get_payload_type; - this->public.payload_interface.destroy = (void (*) (payload_t *))destroy; - this->public.get_data = (chunk_t (*) (vendor_id_payload_t *)) get_data; - - this->critical = FALSE; - this->next_payload = NO_PAYLOAD; - this->payload_length = VENDOR_ID_PAYLOAD_HEADER_LENGTH; - this->data = chunk_empty; - -======= vendor_id_payload_t *vendor_id_payload_create_data(chunk_t data) { private_vendor_id_payload_t *this; @@ -274,28 +170,13 @@ vendor_id_payload_t *vendor_id_payload_create_data(chunk_t data) .payload_length = VENDOR_ID_PAYLOAD_HEADER_LENGTH + data.len, .data = data, ); ->>>>>>> upstream/4.5.1 return &this->public; } /* * Described in header */ -<<<<<<< HEAD -vendor_id_payload_t *vendor_id_payload_create_data(chunk_t data) -{ - private_vendor_id_payload_t *this; - - this = (private_vendor_id_payload_t*)vendor_id_payload_create(); - this->payload_length += data.len; - this->data = data; - - return &this->public; -} - -======= vendor_id_payload_t *vendor_id_payload_create() { return vendor_id_payload_create_data(chunk_empty); } ->>>>>>> upstream/4.5.1 diff --git a/src/libcharon/encoding/payloads/vendor_id_payload.h b/src/libcharon/encoding/payloads/vendor_id_payload.h index 45cce985e..4e4e7d8eb 100644 --- a/src/libcharon/encoding/payloads/vendor_id_payload.h +++ b/src/libcharon/encoding/payloads/vendor_id_payload.h @@ -50,14 +50,11 @@ struct vendor_id_payload_t { * @return VID data, pointing to an internal chunk_t */ chunk_t (*get_data)(vendor_id_payload_t *this); -<<<<<<< HEAD -======= /** * Destroy Vendor ID payload. */ void (*destroy)(vendor_id_payload_t *this); ->>>>>>> upstream/4.5.1 }; /** |