- proposal setup implementation begun

This commit is contained in:
Martin Willi
2006-02-22 16:14:40 +00:00
parent 0a373aec33
commit a527a426d6
18 changed files with 739 additions and 427 deletions
+25 -22
View File
@@ -279,8 +279,8 @@ static void load_default_config (private_configuration_manager_t *this)
sa_config_t *sa_config_a, *sa_config_b;
traffic_selector_t *ts;
init_config_a = init_config_create("192.168.0.2","192.168.0.3",IKEV2_UDP_PORT,IKEV2_UDP_PORT);
init_config_b = init_config_create("192.168.0.3","192.168.0.2",IKEV2_UDP_PORT,IKEV2_UDP_PORT);
init_config_a = init_config_create("192.168.0.1","192.168.0.2",IKEV2_UDP_PORT,IKEV2_UDP_PORT);
init_config_b = init_config_create("192.168.0.2","192.168.0.1",IKEV2_UDP_PORT,IKEV2_UDP_PORT);
/* IKE proposals for alice */
proposal = proposal_create(1);
@@ -301,23 +301,26 @@ static void load_default_config (private_configuration_manager_t *this)
proposal->add_algorithm(proposal, IKE, DIFFIE_HELLMAN_GROUP, MODP_2048_BIT, 0);
init_config_b->add_proposal(init_config_b, proposal);
sa_config_a = sa_config_create(ID_IPV4_ADDR, "192.168.0.2",
ID_IPV4_ADDR, "192.168.0.3",
sa_config_a = sa_config_create(ID_IPV4_ADDR, "192.168.0.1",
ID_IPV4_ADDR, "192.168.0.2",
RSA_DIGITAL_SIGNATURE,
30000);
sa_config_b = sa_config_create(ID_IPV4_ADDR, "192.168.0.3",
ID_IPV4_ADDR, "192.168.0.2",
sa_config_b = sa_config_create(ID_IPV4_ADDR, "192.168.0.2",
ID_IPV4_ADDR, "192.168.0.1",
RSA_DIGITAL_SIGNATURE,
30000);
/* traffic selectors */
ts = traffic_selector_create_from_string(1, TS_IPV4_ADDR_RANGE, "0.0.0.0", 0, "255.255.255.255", 65535);
sa_config_a->add_traffic_selector_initiator(sa_config_a,ts);
sa_config_a->add_traffic_selector_responder(sa_config_a,ts);
sa_config_b->add_traffic_selector_initiator(sa_config_b,ts);
sa_config_b->add_traffic_selector_responder(sa_config_b,ts);
ts->destroy(ts);
ts = traffic_selector_create_from_string(1, TS_IPV4_ADDR_RANGE, "10.1.0.0", 0, "10.1.255.255", 65535);
sa_config_a->add_my_traffic_selector(sa_config_a,ts);
ts = traffic_selector_create_from_string(1, TS_IPV4_ADDR_RANGE, "10.2.0.0", 0, "10.2.255.255", 65535);
sa_config_a->add_other_traffic_selector(sa_config_a,ts);
ts = traffic_selector_create_from_string(1, TS_IPV4_ADDR_RANGE, "10.2.0.0", 0, "10.2.255.255", 65535);
sa_config_b->add_my_traffic_selector(sa_config_b,ts);
ts = traffic_selector_create_from_string(1, TS_IPV4_ADDR_RANGE, "10.1.0.0", 0, "10.1.255.255", 65535);
sa_config_b->add_other_traffic_selector(sa_config_b,ts);
/* child proposal for alice */
proposal = proposal_create(1);
@@ -329,12 +332,11 @@ static void load_default_config (private_configuration_manager_t *this)
// proposal->add_algorithm(proposal, AH, EXTENDED_SEQUENCE_NUMBERS, NO_EXT_SEQ_NUMBERS, 0);
proposal->add_algorithm(proposal, ESP, ENCRYPTION_ALGORITHM, ENCR_AES_CBC, 16);
proposal->add_algorithm(proposal, ESP, ENCRYPTION_ALGORITHM, ENCR_3DES, 0);
proposal->add_algorithm(proposal, ESP, INTEGRITY_ALGORITHM, AUTH_HMAC_SHA1_96, 0);
proposal->add_algorithm(proposal, ESP, INTEGRITY_ALGORITHM, AUTH_HMAC_MD5_96, 0);
proposal->add_algorithm(proposal, ESP, DIFFIE_HELLMAN_GROUP, MODP_2048_BIT, 0);
proposal->add_algorithm(proposal, ESP, DIFFIE_HELLMAN_GROUP, MODP_1024_BIT, 0);
proposal->add_algorithm(proposal, ESP, EXTENDED_SEQUENCE_NUMBERS, NO_EXT_SEQ_NUMBERS, 0);
// proposal->add_algorithm(proposal, ESP, DIFFIE_HELLMAN_GROUP, MODP_2048_BIT, 0);
// proposal->add_algorithm(proposal, ESP, DIFFIE_HELLMAN_GROUP, MODP_1024_BIT, 0);
// proposal->add_algorithm(proposal, ESP, EXTENDED_SEQUENCE_NUMBERS, NO_EXT_SEQ_NUMBERS, 0);
sa_config_a->add_proposal(sa_config_a, proposal);
@@ -347,10 +349,11 @@ static void load_default_config (private_configuration_manager_t *this)
// proposal->add_algorithm(proposal, AH, DIFFIE_HELLMAN_GROUP, MODP_1024_BIT, 0);
// proposal->add_algorithm(proposal, AH, EXTENDED_SEQUENCE_NUMBERS, NO_EXT_SEQ_NUMBERS, 0);
proposal->add_algorithm(proposal, ESP, ENCRYPTION_ALGORITHM, ENCR_3DES, 0);
proposal->add_algorithm(proposal, ESP, ENCRYPTION_ALGORITHM, ENCR_AES_CBC, 16);
proposal->add_algorithm(proposal, ESP, INTEGRITY_ALGORITHM, AUTH_HMAC_SHA1_96, 0);
proposal->add_algorithm(proposal, ESP, DIFFIE_HELLMAN_GROUP, MODP_1024_BIT, 0);
proposal->add_algorithm(proposal, ESP, EXTENDED_SEQUENCE_NUMBERS, NO_EXT_SEQ_NUMBERS, 0);
// proposal->add_algorithm(proposal, ESP, DIFFIE_HELLMAN_GROUP, MODP_1024_BIT, 0);
// proposal->add_algorithm(proposal, ESP, EXTENDED_SEQUENCE_NUMBERS, NO_EXT_SEQ_NUMBERS, 0);
sa_config_b->add_proposal(sa_config_b, proposal);
@@ -363,10 +366,10 @@ static void load_default_config (private_configuration_manager_t *this)
//this->add_new_preshared_secret(this,ID_IPV4_ADDR, "192.168.1.2","verschluesselt");
this->add_new_rsa_public_key(this,ID_IPV4_ADDR, "192.168.0.2", public_key_1, 256);
this->add_new_rsa_public_key(this,ID_IPV4_ADDR, "192.168.0.3", public_key_2, 256);
this->add_new_rsa_private_key(this,ID_IPV4_ADDR, "192.168.0.2", private_key_1, 1024);
this->add_new_rsa_private_key(this,ID_IPV4_ADDR, "192.168.0.3", private_key_2, 1024);
this->add_new_rsa_public_key(this,ID_IPV4_ADDR, "192.168.0.1", public_key_1, 256);
this->add_new_rsa_public_key(this,ID_IPV4_ADDR, "192.168.0.2", public_key_2, 256);
this->add_new_rsa_private_key(this,ID_IPV4_ADDR, "192.168.0.1", private_key_1, 1024);
this->add_new_rsa_private_key(this,ID_IPV4_ADDR, "192.168.0.2", private_key_2, 1024);
}
/**
+11 -3
View File
@@ -120,8 +120,12 @@ struct algorithm_t {
typedef struct proposal_t proposal_t;
/**
* @brief Stores a proposal for a child SA.
* @brief Stores a set of algorithms used for an SA.
*
* A proposal stores algorithms for a specific
* protocol. It can store algorithms for more than
* one protocol (e.g. AH and ESP). Then the proposal
* means both protocols must be used.
* A proposal may contain more than one algorithm
* of the same kind. ONE of them can be selected.
*
@@ -140,8 +144,8 @@ struct proposal_t {
* The algorithms are stored by priority, first added
* is the most preferred.
* Key size is only needed for encryption algorithms
* with variable key size (such as AES), or integrity
* algorithms.
* with variable key size (such as AES). Must be set
* to zero if key size is not specified.
* The alg parameter accepts encryption_algorithm_t,
* integrity_algorithm_t, dh_group_number_t and
* extended_sequence_numbers_t.
@@ -243,6 +247,10 @@ struct proposal_t {
/**
* @brief Create a child proposal for AH and/or ESP.
*
* Since the order of multiple proposals is important for
* key derivation, we must assign them numbers as they
* appear in the raw payload. Numbering starts at 1.
*
* @param number number of the proposal, as in the payload
* @return proposal_t object
*
+59 -86
View File
@@ -65,24 +65,19 @@ struct private_sa_config_t {
linked_list_t *proposals;
/**
* list for traffic selectors for initiator site
* list for traffic selectors for my site
*/
linked_list_t *ts_initiator;
linked_list_t *my_ts;
/**
* list for traffic selectors for responder site
* list for traffic selectors for others site
*/
linked_list_t *ts_responder;
/**
* get_traffic_selectors for both
*/
size_t (*get_traffic_selectors) (private_sa_config_t *,linked_list_t*,traffic_selector_t**[]);
linked_list_t *other_ts;
/**
* select_traffic_selectors for both
*/
size_t (*select_traffic_selectors) (private_sa_config_t *,linked_list_t*,traffic_selector_t*[],size_t,traffic_selector_t**[]);
linked_list_t *(*select_traffic_selectors) (private_sa_config_t *,linked_list_t*,linked_list_t*);
};
/**
@@ -118,91 +113,72 @@ static u_int32_t get_ike_sa_lifetime (private_sa_config_t *this)
}
/**
* Implementation of sa_config_t.get_traffic_selectors_initiator
* Implementation of sa_config_t.get_my_traffic_selectors
*/
static size_t get_traffic_selectors_initiator(private_sa_config_t *this, traffic_selector_t **traffic_selectors[])
static linked_list_t *get_my_traffic_selectors(private_sa_config_t *this)
{
return this->get_traffic_selectors(this, this->ts_initiator, traffic_selectors);
return this->my_ts;
}
/**
* Implementation of sa_config_t.get_traffic_selectors_responder
* Implementation of sa_config_t.get_other_traffic_selectors
*/
static size_t get_traffic_selectors_responder(private_sa_config_t *this, traffic_selector_t **traffic_selectors[])
static linked_list_t *get_other_traffic_selectors(private_sa_config_t *this, traffic_selector_t **traffic_selectors[])
{
return this->get_traffic_selectors(this, this->ts_responder, traffic_selectors);
return this->other_ts;
}
/**
* Implementation of private_sa_config_t.get_traffic_selectors
* Implementation of private_sa_config_t.select_my_traffic_selectors
*/
static size_t get_traffic_selectors(private_sa_config_t *this, linked_list_t *ts_list, traffic_selector_t **traffic_selectors[])
static linked_list_t *select_my_traffic_selectors(private_sa_config_t *this, linked_list_t *supplied)
{
iterator_t *iterator;
traffic_selector_t *current_ts;
int counter = 0;
*traffic_selectors = allocator_alloc(sizeof(traffic_selector_t*) * ts_list->get_count(ts_list));
/* copy all ts from the list in an array */
iterator = ts_list->create_iterator(ts_list, TRUE);
while (iterator->has_next(iterator))
{
iterator->current(iterator, (void**)&current_ts);
*((*traffic_selectors) + counter) = current_ts->clone(current_ts);
counter++;
}
iterator->destroy(iterator);
return counter;
return this->select_traffic_selectors(this, this->my_ts, supplied);
}
/**
* Implementation of private_sa_config_t.select_traffic_selectors_initiator
* Implementation of private_sa_config_t.select_other_traffic_selectors
*/
static size_t select_traffic_selectors_initiator(private_sa_config_t *this,traffic_selector_t *supplied[], size_t count, traffic_selector_t **selected[])
static linked_list_t *select_other_traffic_selectors(private_sa_config_t *this, linked_list_t *supplied)
{
return this->select_traffic_selectors(this, this->ts_initiator, supplied, count, selected);
}
/**
* Implementation of private_sa_config_t.select_traffic_selectors_responder
*/
static size_t select_traffic_selectors_responder(private_sa_config_t *this,traffic_selector_t *supplied[], size_t count, traffic_selector_t **selected[])
{
return this->select_traffic_selectors(this, this->ts_responder, supplied, count, selected);
return this->select_traffic_selectors(this, this->other_ts, supplied);
}
/**
* Implementation of private_sa_config_t.select_traffic_selectors
*/
static size_t select_traffic_selectors(private_sa_config_t *this, linked_list_t *ts_list, traffic_selector_t *supplied[], size_t count, traffic_selector_t **selected[])
static linked_list_t *select_traffic_selectors(private_sa_config_t *this, linked_list_t *stored, linked_list_t *supplied)
{
iterator_t *iterator;
traffic_selector_t *current_ts;
int i, counter = 0;
*selected = allocator_alloc(sizeof(traffic_selector_t*) * ts_list->get_count(ts_list));
iterator_t *supplied_iter, *stored_iter;
traffic_selector_t *supplied_ts, *stored_ts, *selected_ts;
linked_list_t *selected = linked_list_create();
/* iterate over all stored proposals */
iterator = ts_list->create_iterator(ts_list, TRUE);
while (iterator->has_next(iterator))
stored_iter = stored->create_iterator(stored, TRUE);
supplied_iter = supplied->create_iterator(supplied, TRUE);
/* iterate over all stored selectors */
while (stored_iter->has_next(stored_iter))
{
iterator->current(iterator, (void**)&current_ts);
for (i = 0; i < count; i++)
stored_iter->current(stored_iter, (void**)&stored_ts);
supplied_iter->reset(supplied_iter);
/* iterate over all supplied traffic selectors */
while (supplied_iter->has_next(supplied_iter))
{
traffic_selector_t *new_ts;
/* compare it */
new_ts = current_ts->get_subset(current_ts, supplied[i]);
/* match ? */
if (new_ts)
supplied_iter->current(supplied_iter, (void**)&supplied_ts);
selected_ts = stored_ts->get_subset(stored_ts, supplied_ts);
if (selected_ts)
{
*((*selected) + counter) = new_ts;
counter++;
/* got a match, add to list */
selected->insert_last(selected, (void*)selected_ts);
}
}
}
iterator->destroy(iterator);
stored_iter->destroy(stored_iter);
supplied_iter->destroy(supplied_iter);
/* free unused space */
*selected = allocator_realloc(*selected, sizeof(traffic_selector_t) * counter);
return counter;
return selected;
}
/**
@@ -252,21 +228,19 @@ static proposal_t *select_proposal(private_sa_config_t *this, linked_list_t *pro
}
/**
* Implementation of sa_config_t.add_traffic_selector_initiator
* Implementation of sa_config_t.add_my_traffic_selector
*/
static void add_traffic_selector_initiator(private_sa_config_t *this, traffic_selector_t *traffic_selector)
static void add_my_traffic_selector(private_sa_config_t *this, traffic_selector_t *traffic_selector)
{
/* clone ts, and add*/
this->ts_initiator->insert_last(this->ts_initiator, (void*)traffic_selector->clone(traffic_selector));
this->my_ts->insert_last(this->my_ts, (void*)traffic_selector);
}
/**
* Implementation of sa_config_t.add_traffic_selector_responder
* Implementation of sa_config_t.add_other_traffic_selector
*/
static void add_traffic_selector_responder(private_sa_config_t *this, traffic_selector_t *traffic_selector)
static void add_other_traffic_selector(private_sa_config_t *this, traffic_selector_t *traffic_selector)
{
/* clone ts, and add*/
this->ts_responder->insert_last(this->ts_responder, (void*)traffic_selector->clone(traffic_selector));
this->other_ts->insert_last(this->other_ts, (void*)traffic_selector);
}
/**
@@ -294,18 +268,18 @@ static status_t destroy(private_sa_config_t *this)
this->proposals->destroy(this->proposals);
/* delete traffic selectors */
while(this->ts_initiator->remove_last(this->ts_initiator, (void**)&traffic_selector) == SUCCESS)
while(this->my_ts->remove_last(this->my_ts, (void**)&traffic_selector) == SUCCESS)
{
traffic_selector->destroy(traffic_selector);
}
this->ts_initiator->destroy(this->ts_initiator);
this->my_ts->destroy(this->my_ts);
/* delete traffic selectors */
while(this->ts_responder->remove_last(this->ts_responder, (void**)&traffic_selector) == SUCCESS)
while(this->other_ts->remove_last(this->other_ts, (void**)&traffic_selector) == SUCCESS)
{
traffic_selector->destroy(traffic_selector);
}
this->ts_responder->destroy(this->ts_responder);
this->other_ts->destroy(this->other_ts);
/* delete ids */
this->my_id->destroy(this->my_id);
@@ -327,14 +301,14 @@ sa_config_t *sa_config_create(id_type_t my_id_type, char *my_id, id_type_t other
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_ike_sa_lifetime = (u_int32_t(*)(sa_config_t*))get_ike_sa_lifetime;
this->public.get_traffic_selectors_initiator = (size_t(*)(sa_config_t*,traffic_selector_t**[]))get_traffic_selectors_initiator;
this->public.select_traffic_selectors_initiator = (size_t(*)(sa_config_t*,traffic_selector_t*[],size_t,traffic_selector_t**[]))select_traffic_selectors_initiator;
this->public.get_traffic_selectors_responder = (size_t(*)(sa_config_t*,traffic_selector_t**[]))get_traffic_selectors_responder;
this->public.select_traffic_selectors_responder = (size_t(*)(sa_config_t*,traffic_selector_t*[],size_t,traffic_selector_t**[]))select_traffic_selectors_responder;
this->public.get_my_traffic_selectors = (linked_list_t*(*)(sa_config_t*))get_my_traffic_selectors;
this->public.select_my_traffic_selectors = (linked_list_t*(*)(sa_config_t*,linked_list_t*))select_my_traffic_selectors;
this->public.get_other_traffic_selectors = (linked_list_t*(*)(sa_config_t*))get_other_traffic_selectors;
this->public.select_other_traffic_selectors = (linked_list_t*(*)(sa_config_t*,linked_list_t*))select_other_traffic_selectors;
this->public.get_proposals = (linked_list_t*(*)(sa_config_t*))get_proposals;
this->public.select_proposal = (proposal_t*(*)(sa_config_t*,linked_list_t*))select_proposal;
this->public.add_traffic_selector_initiator = (void(*)(sa_config_t*,traffic_selector_t*))add_traffic_selector_initiator;
this->public.add_traffic_selector_responder = (void(*)(sa_config_t*,traffic_selector_t*))add_traffic_selector_responder;
this->public.add_my_traffic_selector = (void(*)(sa_config_t*,traffic_selector_t*))add_my_traffic_selector;
this->public.add_other_traffic_selector = (void(*)(sa_config_t*,traffic_selector_t*))add_other_traffic_selector;
this->public.add_proposal = (void(*)(sa_config_t*,proposal_t*))add_proposal;
this->public.destroy = (void(*)(sa_config_t*))destroy;
@@ -355,10 +329,9 @@ sa_config_t *sa_config_create(id_type_t my_id_type, char *my_id, id_type_t other
/* init private members*/
this->select_traffic_selectors = select_traffic_selectors;
this->get_traffic_selectors = get_traffic_selectors;
this->proposals = linked_list_create();
this->ts_initiator = linked_list_create();
this->ts_responder = linked_list_create();
this->my_ts = linked_list_create();
this->other_ts = linked_list_create();
this->auth_method = auth_method;
this->ike_sa_lifetime = ike_sa_lifetime;
+26 -46
View File
@@ -89,69 +89,49 @@ struct sa_config_t {
u_int32_t (*get_ike_sa_lifetime) (sa_config_t *this);
/**
* @brief Get configured traffic selectors for initiator site.
* @brief Get configured traffic selectors for our site.
*
* Returns a pointer to an allocated array, in which
* pointers to traffic selectors are stored.
*
* @warning Resulting pointer array must be freed!
* @warning Traffic selectors in array must be destroyed!
* Returns a list with all traffic selectors for the local
* site. List and items MUST NOT be freed nor modified.
*
* @param this calling object
* @param[out] traffic_selectors pointer where traffic selectors will be allocated
* @return number of returned traffic selectors
* @return list with traffic selectors
*/
size_t (*get_traffic_selectors_initiator) (sa_config_t *this, traffic_selector_t **traffic_selectors[]);
linked_list_t *(*get_my_traffic_selectors) (sa_config_t *this);
/**
* @brief Get configured traffic selectors for responder site.
* @brief Get configured traffic selectors for others site.
*
* Returns a pointer to an allocated array, in which
* pointers to traffic selectors are stored.
*
* @warning Resulting pointer array must be freed!
* @warning Traffic selectors in array must be destroyed!
* Returns a list with all traffic selectors for the remote
* site. List and items MUST NOT be freed nor modified.
*
* @param this calling object
* @param[out] traffic_selectors pointer where traffic selectors will be allocated
* @return number of returned traffic selectors
* @return list with traffic selectors
*/
size_t (*get_traffic_selectors_responder) (sa_config_t *this, traffic_selector_t **traffic_selectors[]);
linked_list_t *(*get_other_traffic_selectors) (sa_config_t *this);
/**
* @brief Select traffic selectors from a supplied list for initiator.
* @brief Select traffic selectors from a supplied list for local site.
*
* Returns a pointer to an allocated array, in which
* pointers to traffic selectors are stored.
*
* @warning Resulting pointer array must be freed!
* @warning Traffic selectors in array must be destroyed!
* Resulted list and traffic selectors must be destroyed after usage.
*
* @param this calling object
* @param supplied pointer to an array of ts to select from.
* @param count number of ts stored at supplied
* @param[out] traffic_selectors pointer where selected traffic selectors will be allocated
* @return number of selected traffic selectors
* @param supplied linked list with traffic selectors
* @return list containing the selected traffic selectors
*/
size_t (*select_traffic_selectors_initiator) (sa_config_t *this, traffic_selector_t *supplied[], size_t count, traffic_selector_t **selected[]);
linked_list_t *(*select_my_traffic_selectors) (sa_config_t *this, linked_list_t *supplied);
/**
* @brief Select traffic selectors from a supplied list for responder.
* @brief Select traffic selectors from a supplied list for remote site.
*
* Returns a pointer to an allocated array, in which
* pointers to traffic selectors are stored.
*
* @warning Resulting pointer array must be freed!
* @warning Traffic selectors in array must be destroyed!
* Resulted list and traffic selectors must be destroyed after usage.
*
* @param this calling object
* @param supplied pointer to an array of ts to select from.
* @param count number of ts stored at supplied
* @param[out] traffic_selectors pointer where selected traffic selectors will be allocated
* @return number of selected traffic selectors
* @param supplied linked list with traffic selectors
* @return list containing the selected traffic selectors
*/
size_t (*select_traffic_selectors_responder) (sa_config_t *this, traffic_selector_t *supplied[], size_t count, traffic_selector_t **selected[]);
linked_list_t *(*select_other_traffic_selectors) (sa_config_t *this, linked_list_t *supplied);
/**
* @brief Get the list of internally stored proposals.
@@ -177,28 +157,28 @@ struct sa_config_t {
proposal_t *(*select_proposal) (sa_config_t *this, linked_list_t *proposals);
/**
* @brief Add a traffic selector to the list for initiator.
* @brief Add a traffic selector to the list for local site.
*
* Added proposal will be cloned.
* After add, proposal is owned by sa_config.
*
* @warning Do not add while other threads are reading.
*
* @param this calling object
* @param traffic_selector traffic_selector to add
*/
void (*add_traffic_selector_initiator) (sa_config_t *this, traffic_selector_t *traffic_selector);
void (*add_my_traffic_selector) (sa_config_t *this, traffic_selector_t *traffic_selector);
/**
* @brief Add a traffic selector to the list for responder.
* @brief Add a traffic selector to the list for remote site.
*
* Added proposal will be cloned.
* After add, proposal is owned by sa_config.
*
* @warning Do not add while other threads are reading.
*
* @param this calling object
* @param traffic_selector traffic_selector to add
*/
void (*add_traffic_selector_responder) (sa_config_t *this, traffic_selector_t *traffic_selector);
void (*add_other_traffic_selector) (sa_config_t *this, traffic_selector_t *traffic_selector);
/**
* @brief Add a proposal to the list.
+3 -11
View File
@@ -53,22 +53,14 @@ struct private_traffic_selector_t {
* begin of address range
*/
union {
struct {
u_int32_t from_addr_ipv4;
};
struct {
};
u_int32_t from_addr_ipv4;
};
/**
* end of address range
*/
union {
struct {
u_int32_t to_addr_ipv4;
};
struct {
};
u_int32_t to_addr_ipv4;
};
/**
@@ -334,7 +326,7 @@ static private_traffic_selector_t *traffic_selector_create(u_int8_t protocol, ts
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.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;
+6 -3
View File
@@ -24,6 +24,7 @@
#define _TRAFFIC_SELECTOR_H_
#include <types.h>
#include <network/host.h>
typedef enum ts_type_t ts_type_t;
@@ -33,7 +34,8 @@ typedef enum ts_type_t ts_type_t;
* @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
@@ -41,7 +43,8 @@ enum ts_type_t {
* 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
@@ -75,7 +78,7 @@ struct traffic_selector_t {
/**
* @brief Compare two traffic selectors, and create a new one
* which is the largest subset of bouth (subnet & port).
* which is the largest subset of both (subnet & port).
*
* Resulting traffic_selector is newly created and must be destroyed.
*