aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/encoding/payloads/proposal_substructure.c
diff options
context:
space:
mode:
authorJan Hutter <jhutter@hsr.ch>2005-11-28 15:20:51 +0000
committerJan Hutter <jhutter@hsr.ch>2005-11-28 15:20:51 +0000
commitb9d9f18874d2cf4de3c9cffeaac716df71a31e99 (patch)
tree648efac49c2eae47d6344f224d74a651d11b73dd /Source/charon/encoding/payloads/proposal_substructure.c
parent61068e9152c93365887d7b137c49e34ecb05cc29 (diff)
downloadstrongswan-b9d9f18874d2cf4de3c9cffeaac716df71a31e99.tar.bz2
strongswan-b9d9f18874d2cf4de3c9cffeaac716df71a31e99.tar.xz
- added compution of all needed keys and also creation of needed
transform objects
Diffstat (limited to 'Source/charon/encoding/payloads/proposal_substructure.c')
-rw-r--r--Source/charon/encoding/payloads/proposal_substructure.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/Source/charon/encoding/payloads/proposal_substructure.c b/Source/charon/encoding/payloads/proposal_substructure.c
index ab575d425..b16fb9a85 100644
--- a/Source/charon/encoding/payloads/proposal_substructure.c
+++ b/Source/charon/encoding/payloads/proposal_substructure.c
@@ -327,6 +327,41 @@ static chunk_t get_spi (private_proposal_substructure_t *this)
return spi;
}
+static status_t get_info_for_transform_type (private_proposal_substructure_t *this,transform_type_t type, u_int16_t *transform_id, u_int16_t *key_length)
+{
+ iterator_t *iterator;
+ status_t status;
+ u_int16_t found_transform_id;
+ u_int16_t found_key_length;
+
+ status = this->transforms->create_iterator(this->transforms,&iterator,TRUE);
+ if (status != SUCCESS)
+ {
+ return status;
+ }
+ while (iterator->has_next(iterator))
+ {
+ transform_substructure_t *current_transform;
+ status = iterator->current(iterator,(void **) &current_transform);
+ if (status != SUCCESS)
+ {
+ break;
+ }
+ if (current_transform->get_transform_type(current_transform) == type)
+ {
+ /* now get data for specific type */
+ found_transform_id = current_transform->get_transform_id(current_transform);
+ status = current_transform->get_key_length(current_transform,&found_key_length);
+ *transform_id = found_transform_id;
+ *key_length = found_key_length;
+ iterator->destroy(iterator);
+ return status;
+ }
+ }
+ iterator->destroy(iterator);
+ return FAILED;
+}
+
/**
* Implements private_proposal_substructure_t's compute_length function.
* See #private_proposal_substructure_s.compute_length for description.
@@ -483,11 +518,13 @@ proposal_substructure_t *proposal_substructure_create()
this->public.get_proposal_number = (u_int8_t (*) (proposal_substructure_t *)) get_proposal_number;
this->public.set_protocol_id = (status_t (*) (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_spi = (status_t (*) (proposal_substructure_t *,chunk_t))set_spi;
this->public.get_spi = (chunk_t (*) (proposal_substructure_t *)) get_spi;
this->public.clone = (status_t (*) (proposal_substructure_t *, proposal_substructure_t **)) clone;
this->public.destroy = (status_t (*) (proposal_substructure_t *)) destroy;
+
/* private functions */
this->compute_length = compute_length;