Removed obsolete clone mehtod from proposal_substructure
[strongswan.git] / src / libcharon / encoding / payloads / proposal_substructure.c
index 985b032..bc0f4f5 100644 (file)
@@ -234,7 +234,6 @@ static void compute_length(private_proposal_substructure_t *this)
 METHOD(payload_t, get_length, size_t,
        private_proposal_substructure_t *this)
 {
-       compute_length(this);
        return this->proposal_length;
 }
 
@@ -342,34 +341,6 @@ METHOD(proposal_substructure_t, get_proposal, proposal_t*,
        return proposal;
 }
 
-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, &current))
-       {
-               current = current->clone(current);
-               add_transform_substructure(clone, current);
-       }
-       enumerator->destroy(enumerator);
-
-       return &clone->public;
-}
-
 METHOD2(payload_t, proposal_substructure_t, destroy, void,
        private_proposal_substructure_t *this)
 {
@@ -405,10 +376,10 @@ proposal_substructure_t *proposal_substructure_create()
                        .get_proposal = _get_proposal,
                        .set_spi = _set_spi,
                        .get_spi = _get_spi,
-                       .clone = _clone_,
                        .destroy = _destroy,
                },
                .next_payload = NO_PAYLOAD,
+               .proposal_length = PROPOSAL_SUBSTRUCTURE_HEADER_LENGTH,
                .transforms = linked_list_create(),
        );
 
@@ -500,6 +471,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposal(
        }
        this->proposal_number = proposal->get_number(proposal);
        this->protocol_id = proposal->get_protocol(proposal);
+       compute_length(this);
 
        return &this->public;
 }