X-Git-Url: https://git.strongswan.org/?p=strongswan.git;a=blobdiff_plain;f=Source%2Fcharon%2Fencoding%2Fpayloads%2Fproposal_substructure.c;h=05b375ef926db33e9dfe06ccd4dac2ed9d57ce1e;hp=354eedb9e274760618e762a4ae3e6daf28bb3541;hb=b737e9d9e8e44b360509cfab36d22170f54af334;hpb=d45ec1dedfa06155c344f5cce0ac7b2ec331c825 diff --git a/Source/charon/encoding/payloads/proposal_substructure.c b/Source/charon/encoding/payloads/proposal_substructure.c index 354eedb..05b375e 100644 --- a/Source/charon/encoding/payloads/proposal_substructure.c +++ b/Source/charon/encoding/payloads/proposal_substructure.c @@ -144,7 +144,7 @@ static status_t verify(private_proposal_substructure_t *this) status_t status = SUCCESS; iterator_t *iterator; - if ((this->next_payload != NO_PAYLOAD) && (this->next_payload != PROPOSAL_SUBSTRUCTURE)) + if ((this->next_payload != NO_PAYLOAD) && (this->next_payload != 2)) { /* must be 0 or 2 */ return FAILED; @@ -251,6 +251,15 @@ static void add_transform_substructure (private_proposal_substructure_t *this,tr } /** + * Implementation of proposal_substructure_t.proposal_substructure_t. + */ +static void set_is_last_proposal (private_proposal_substructure_t *this, bool is_last) +{ + this->next_payload = (is_last) ? 0: PROPOSAL_TYPE_VALUE; +} + + +/** * Implementation of proposal_substructure_t.set_proposal_number. */ static void set_proposal_number(private_proposal_substructure_t *this,u_int8_t proposal_number) @@ -374,6 +383,22 @@ static void compute_length (private_proposal_substructure_t *this) } /** + * Implementation of proposal_substructure_t.get_transform_count. + */ +static size_t get_transform_count (private_proposal_substructure_t *this) +{ + return this->transforms->get_count(this->transforms); +} + +/** + * Implementation of proposal_substructure_t.get_spi_size. + */ +static size_t get_spi_size (private_proposal_substructure_t *this) +{ + return this->spi.len; +} + +/** * Implementation of proposal_substructure_t.clone. */ static private_proposal_substructure_t* clone(private_proposal_substructure_t *this) @@ -464,8 +489,12 @@ proposal_substructure_t *proposal_substructure_create() this->public.set_protocol_id = (void (*) (proposal_substructure_t *,u_int8_t))set_protocol_id; this->public.get_protocol_id = (u_int8_t (*) (proposal_substructure_t *)) get_protocol_id; this->public.get_info_for_transform_type = (status_t (*) (proposal_substructure_t *,transform_type_t,u_int16_t *, u_int16_t *))get_info_for_transform_type; + this->public.set_is_last_proposal = (void (*) (proposal_substructure_t *,bool)) set_is_last_proposal; + this->public.set_spi = (void (*) (proposal_substructure_t *,chunk_t))set_spi; this->public.get_spi = (chunk_t (*) (proposal_substructure_t *)) get_spi; + this->public.get_transform_count = (size_t (*) (proposal_substructure_t *)) get_transform_count; + this->public.get_spi_size = (size_t (*) (proposal_substructure_t *)) get_spi_size; this->public.clone = (proposal_substructure_t * (*) (proposal_substructure_t *)) clone; this->public.destroy = (void (*) (proposal_substructure_t *)) destroy;