diff options
Diffstat (limited to 'Source/charon/encoding/payloads/proposal_substructure.h')
-rw-r--r-- | Source/charon/encoding/payloads/proposal_substructure.h | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/Source/charon/encoding/payloads/proposal_substructure.h b/Source/charon/encoding/payloads/proposal_substructure.h index 5380d1c65..afa58516b 100644 --- a/Source/charon/encoding/payloads/proposal_substructure.h +++ b/Source/charon/encoding/payloads/proposal_substructure.h @@ -26,6 +26,7 @@ #include <types.h> #include <encoding/payloads/payload.h> #include <encoding/payloads/transform_substructure.h> +#include <config/child_proposal.h> #include <utils/linked_list.h> @@ -37,27 +38,6 @@ #define PROPOSAL_SUBSTRUCTURE_HEADER_LENGTH 8 -typedef enum protocol_id_t protocol_id_t; - -/** - * Protocol ID of a proposal. - * - * @ingroup payloads - */ -enum protocol_id_t { - UNDEFINED_PROTOCOL_ID = 201, - IKE = 1, - AH = 2, - ESP = 3, -}; - -/** - * String mappings for protocol_id_t. - * - * @ingroup payloads - */ -extern mapping_t protocol_id_m[]; - typedef struct proposal_substructure_t proposal_substructure_t; /** @@ -218,5 +198,22 @@ struct proposal_substructure_t { */ proposal_substructure_t *proposal_substructure_create(); +/** + * @brief Creates a proposal substructure from a child_proposal. + * + * Since a child proposal may contain data for both AH and ESP, + * the protocol must be specified. If the proposal does not contain + * data for proto, NULL is returned. Call twice, once with AH, once + * with ESP, with the same proposal to build the two substructures + * for it. + * + * @param proposal proposal to build a substruct out of it + * @param proto for which protocol the substructure should be built + * @return proposal_substructure_t object, or NULL + * + * @ingroup payloads + */ +proposal_substructure_t *proposal_substructure_create_from_child_proposal(child_proposal_t *proposal, protocol_id_t proto); + #endif /*PROPOSAL_SUBSTRUCTURE_H_*/ |