migrate_job() finds a matching child_cfg

This commit is contained in:
Andreas Steffen
2008-11-03 02:05:41 +00:00
parent bd354bee5f
commit ef6d339c09
7 changed files with 310 additions and 23 deletions
+26
View File
@@ -336,6 +336,31 @@ static linked_list_t* get_traffic_selectors(private_child_cfg_t *this, bool loca
return result;
}
/**
* Implementation of child_cfg_t.equal_traffic_selectors.
*/
bool equal_traffic_selectors(private_child_cfg_t *this, bool local, traffic_selector_t *ts)
{
linked_list_t *list;
enumerator_t *enumerator;
traffic_selector_t *other_ts;
bool result;
list = (local) ? this->my_ts : this->other_ts;
if (list->get_count(list) != 1)
{
return FALSE;
}
enumerator = list->create_enumerator(list);
enumerator->enumerate(enumerator, &other_ts);
result = ts->equals(ts, other_ts);
enumerator->destroy(enumerator);
return result;
}
/**
* Implementation of child_cfg_t.get_updown.
*/
@@ -462,6 +487,7 @@ child_cfg_t *child_cfg_create(char *name, u_int32_t lifetime,
this->public.get_name = (char* (*) (child_cfg_t*))get_name;
this->public.add_traffic_selector = (void (*)(child_cfg_t*,bool,traffic_selector_t*))add_traffic_selector;
this->public.get_traffic_selectors = (linked_list_t*(*)(child_cfg_t*,bool,linked_list_t*,host_t*))get_traffic_selectors;
this->public.equal_traffic_selectors = (bool (*)(child_cfg_t*,bool,traffic_selector_t*))equal_traffic_selectors;
this->public.add_proposal = (void (*) (child_cfg_t*,proposal_t*))add_proposal;
this->public.get_proposals = (linked_list_t* (*) (child_cfg_t*,bool))get_proposals;
this->public.select_proposal = (proposal_t* (*) (child_cfg_t*,linked_list_t*,bool))select_proposal;
+10
View File
@@ -153,6 +153,16 @@ struct child_cfg_t {
linked_list_t *supplied,
host_t *host);
/**
* Checks the [single] traffic selectors for equality
*
* @param local TRUE for TS on local side, FALSE for remote
* @param ts single traffic selector to compare with
* @return TRUE if TS are equal, FALSE otherwise
*/
bool (*equal_traffic_selectors)(child_cfg_t *this, bool local,
traffic_selector_t *ts);
/**
* Get the updown script to run for the CHILD_SA.
*