X-Git-Url: https://git.strongswan.org/?p=strongswan.git;a=blobdiff_plain;f=Source%2Fcharon%2Fencoding%2Fpayloads%2Ftraffic_selector_substructure.h;h=0c95cb95bc504c44195cce57142a5ebcdea0a0b3;hp=43e6974150309d77de4e27ca04278872c68d1636;hb=03283349a9ca4989c44e5eb6e632716c4c4b050f;hpb=a9428251cd1e6fc579204199ca09cbe55a8f2865 diff --git a/Source/charon/encoding/payloads/traffic_selector_substructure.h b/Source/charon/encoding/payloads/traffic_selector_substructure.h index 43e6974..0c95cb9 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; /** @@ -153,6 +125,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. * * @param this traffic_selector_substructure_t object to destroy @@ -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_