- creation of ts payloads using ts
This commit is contained in:
@@ -96,7 +96,7 @@ static auth_method_t get_auth_method(private_sa_config_t *this)
|
||||
/**
|
||||
* implements sa_config_t.get_traffic_selectors
|
||||
*/
|
||||
static size_t get_traffic_selectors(private_sa_config_t *this, traffic_selector_t ***traffic_selectors)
|
||||
static size_t get_traffic_selectors(private_sa_config_t *this, traffic_selector_t **traffic_selectors[])
|
||||
{
|
||||
iterator_t *iterator;
|
||||
traffic_selector_t *current_ts;
|
||||
@@ -118,7 +118,7 @@ static size_t get_traffic_selectors(private_sa_config_t *this, traffic_selector_
|
||||
/**
|
||||
* implements sa_config_t.select_traffic_selectors
|
||||
*/
|
||||
static size_t select_traffic_selectors(private_sa_config_t *this, traffic_selector_t **supplied, size_t count, traffic_selector_t ***selected)
|
||||
static size_t select_traffic_selectors(private_sa_config_t *this, traffic_selector_t *supplied[], size_t count, traffic_selector_t **selected[])
|
||||
{
|
||||
iterator_t *iterator;
|
||||
traffic_selector_t *current_ts;
|
||||
@@ -307,8 +307,8 @@ sa_config_t *sa_config_create(id_type_t my_id_type, char *my_id, id_type_t other
|
||||
this->public.get_my_id = (identification_t*(*)(sa_config_t*))get_my_id;
|
||||
this->public.get_other_id = (identification_t*(*)(sa_config_t*))get_other_id;
|
||||
this->public.get_auth_method = (auth_method_t(*)(sa_config_t*))get_auth_method;
|
||||
this->public.get_traffic_selectors = (size_t(*)(sa_config_t*,traffic_selector_t***))get_traffic_selectors;
|
||||
this->public.select_traffic_selectors = (size_t(*)(sa_config_t*,traffic_selector_t**,size_t,traffic_selector_t***))select_traffic_selectors;
|
||||
this->public.get_traffic_selectors = (size_t(*)(sa_config_t*,traffic_selector_t**[]))get_traffic_selectors;
|
||||
this->public.select_traffic_selectors = (size_t(*)(sa_config_t*,traffic_selector_t*[],size_t,traffic_selector_t**[]))select_traffic_selectors;
|
||||
this->public.get_proposals = (size_t(*)(sa_config_t*,u_int8_t[4],u_int8_t[4],child_proposal_t**))get_proposals;
|
||||
this->public.select_proposal = (child_proposal_t*(*)(sa_config_t*,u_int8_t[4],u_int8_t[4],child_proposal_t*,size_t))select_proposal;
|
||||
this->public.add_traffic_selector = (void(*)(sa_config_t*,traffic_selector_t*))add_traffic_selector;
|
||||
|
||||
@@ -125,7 +125,7 @@ struct sa_config_t {
|
||||
* @param[out]traffic_selectors pointer where traffic selectors will be allocated
|
||||
* @return number of returned traffic selectors
|
||||
*/
|
||||
size_t (*get_traffic_selectors) (sa_config_t *this, traffic_selector_t ***traffic_selectors);
|
||||
size_t (*get_traffic_selectors) (sa_config_t *this, traffic_selector_t **traffic_selectors[]);
|
||||
|
||||
/**
|
||||
* @brief Select traffic selectors from a supplied list.
|
||||
@@ -142,7 +142,7 @@ struct sa_config_t {
|
||||
* @param[out]traffic_selectors pointer where selected traffic selectors will be allocated
|
||||
* @return number of selected traffic selectors
|
||||
*/
|
||||
size_t (*select_traffic_selectors) (sa_config_t *this, traffic_selector_t **supplied, size_t count, traffic_selector_t ***selected);
|
||||
size_t (*select_traffic_selectors) (sa_config_t *this, traffic_selector_t *supplied[], size_t count, traffic_selector_t **selected[]);
|
||||
|
||||
/**
|
||||
* @brief Get the list of proposals for this config.
|
||||
@@ -153,7 +153,7 @@ struct sa_config_t {
|
||||
* @param[out]traffic_selectors pointer where proposals will be allocated
|
||||
* @return number of allocated proposals
|
||||
*/
|
||||
size_t (*get_proposals) (sa_config_t *this, u_int8_t ah_spi[4], u_int8_t esp_spi[4], child_proposal_t **proposals);
|
||||
size_t (*get_proposals) (sa_config_t *this, u_int8_t ah_spi[4], u_int8_t esp_spi[4], child_proposal_t *proposals[]);
|
||||
|
||||
/**
|
||||
* @brief Select a proposal from a supplied list
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <utils/linked_list.h>
|
||||
#include <utils/allocator.h>
|
||||
#include <utils/identification.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
typedef struct private_traffic_selector_t private_traffic_selector_t;
|
||||
|
||||
@@ -197,6 +198,22 @@ static u_int16_t get_to_port(private_traffic_selector_t *this)
|
||||
return this->to_port;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements traffic_selector_t.get_type.
|
||||
*/
|
||||
static ts_type_t get_type(private_traffic_selector_t *this)
|
||||
{
|
||||
return this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements traffic_selector_t.get_protocol.
|
||||
*/
|
||||
static u_int8_t get_protocol(private_traffic_selector_t *this)
|
||||
{
|
||||
return this->protocol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements traffic_selector_t.clone.
|
||||
*/
|
||||
@@ -316,6 +333,8 @@ static private_traffic_selector_t *traffic_selector_create(u_int8_t protocol, ts
|
||||
this->public.get_to_address = (chunk_t(*)(traffic_selector_t*))get_to_address;
|
||||
this->public.get_from_port = (u_int16_t(*)(traffic_selector_t*))get_from_port;
|
||||
this->public.get_to_port = (u_int16_t(*)(traffic_selector_t*))get_to_port;
|
||||
this->public.get_type = (ts_type_t(*)(traffic_selector_t*))get_type;
|
||||
this->public.get_protocol = (u_int8_t(*)(traffic_selector_t*))get_protocol;
|
||||
this->public.clone = (traffic_selector_t*(*)(traffic_selector_t*))clone;
|
||||
this->public.destroy = (void(*)(traffic_selector_t*))destroy;
|
||||
|
||||
|
||||
@@ -24,7 +24,37 @@
|
||||
#define _TRAFFIC_SELECTOR_H_
|
||||
|
||||
#include <types.h>
|
||||
#include <encoding/payloads/traffic_selector_substructure.h>
|
||||
|
||||
typedef enum ts_type_t ts_type_t;
|
||||
|
||||
/**
|
||||
* Traffic selector Types.
|
||||
*
|
||||
* @ingroup config
|
||||
*/
|
||||
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
|
||||
};
|
||||
|
||||
/**
|
||||
* string mappings for ts_type_t
|
||||
*/
|
||||
extern mapping_t ts_type_m[];
|
||||
|
||||
|
||||
typedef struct traffic_selector_t traffic_selector_t;
|
||||
@@ -109,6 +139,22 @@ struct traffic_selector_t {
|
||||
*/
|
||||
u_int16_t (*get_to_port) (traffic_selector_t *this);
|
||||
|
||||
/**
|
||||
* @brief Get the type of the traffic selector.
|
||||
*
|
||||
* @param this calling obect
|
||||
* @return ts_type_t specifying the type
|
||||
*/
|
||||
ts_type_t (*get_type) (traffic_selector_t *this);
|
||||
|
||||
/**
|
||||
* @brief Get the protocol id of this ts.
|
||||
*
|
||||
* @param this calling obect
|
||||
* @return protocol id
|
||||
*/
|
||||
u_int8_t (*get_protocol) (traffic_selector_t *this);
|
||||
|
||||
/**
|
||||
* @brief Destroys the ts object
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user