From 03283349a9ca4989c44e5eb6e632716c4c4b050f Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Thu, 1 Dec 2005 17:38:06 +0000 Subject: - creation of ts payloads using ts --- .../payloads/traffic_selector_substructure.h | 51 ++++++++++------------ 1 file changed, 22 insertions(+), 29 deletions(-) (limited to 'Source/charon/encoding/payloads/traffic_selector_substructure.h') diff --git a/Source/charon/encoding/payloads/traffic_selector_substructure.h b/Source/charon/encoding/payloads/traffic_selector_substructure.h index 43e697415..0c95cb95b 100644 --- a/Source/charon/encoding/payloads/traffic_selector_substructure.h +++ b/Source/charon/encoding/payloads/traffic_selector_substructure.h @@ -27,6 +27,7 @@ #include #include #include +#include /** * Length of a TRAFFIC SELECTOR SUBSTRUCTURE without start and end address. @@ -35,35 +36,6 @@ */ #define TRAFFIC_SELECTOR_HEADER_LENGTH 8 - -typedef enum ts_type_t ts_type_t; - -/** - * Traffic selector Types. - * - * @ingroup payloads - */ -enum ts_type_t { - /* - * A range of IPv4 addresses, represented by two four (4) octet - * values. The first value is the beginning IPv4 address - * (inclusive) and the second value is the ending IPv4 address - * (inclusive). All addresses falling between the two specified - * addresses are considered to be within the list. - */ - TS_IPV4_ADDR_RANGE = 7, - /* - * A range of IPv6 addresses, represented by two sixteen (16) - * octet values. The first value is the beginning IPv6 address - * (inclusive) and the second value is the ending IPv6 address - * (inclusive). All addresses falling between the two specified - * addresses are considered to be within the list. - */ - TS_IPV6_ADDR_RANGE = 8 -}; - -extern mapping_t ts_type_m[]; - typedef struct traffic_selector_substructure_t traffic_selector_substructure_t; /** @@ -152,6 +124,16 @@ struct traffic_selector_substructure_t { */ void (*set_end_host) (traffic_selector_substructure_t *this,host_t *end_host); + /** + * @brief Get a traffic_selector_t from this substructure. + * + * @warning traffic_selector_t must be destroyed after usage. + * + * @param this calling traffic_selector_substructure_t object + * @return contained traffic_selector_t + */ + traffic_selector_t *(*get_traffic_selector) (traffic_selector_substructure_t *this); + /** * @brief Destroys an traffic_selector_substructure_t object. * @@ -171,5 +153,16 @@ struct traffic_selector_substructure_t { */ traffic_selector_substructure_t *traffic_selector_substructure_create(); +/** + * @brief Creates an initialized traffif selector substructure using + * the values from a traffic_selector_t. + * + * @param traffic_selector traffic_selector_t to use for initialization + * @return created traffic_selector_substructure_t object + * + * @ingroup payloads + */ +traffic_selector_substructure_t *traffic_selector_substructure_create_from_traffic_selector(traffic_selector_t *traffic_selector); + #endif //TRAFFIC_SELECTOR_SUBSTRUCTURE_H_ -- cgit v1.2.3