child-sa: replace get_traffic_selectors() with create_ts_enumerator()

Not directly returning a linked list allows us to change the internals of
the CHILD_SA transparently.
This commit is contained in:
Martin Willi
2013-07-17 17:20:18 +02:00
parent 6207fadb6c
commit 553bb78730
12 changed files with 124 additions and 78 deletions
+8 -4
View File
@@ -331,10 +331,14 @@ METHOD(child_sa_t, set_proposal, void,
this->proposal = proposal->clone(proposal);
}
METHOD(child_sa_t, get_traffic_selectors, linked_list_t*,
private_child_sa_t *this, bool local)
METHOD(child_sa_t, create_ts_enumerator, enumerator_t*,
private_child_sa_t *this, bool local)
{
return local ? this->my_ts : this->other_ts;
if (local)
{
return this->my_ts->create_enumerator(this->my_ts);
}
return this->other_ts->create_enumerator(this->other_ts);
}
typedef struct policy_enumerator_t policy_enumerator_t;
@@ -1117,7 +1121,7 @@ child_sa_t * child_sa_create(host_t *me, host_t* other,
.install = _install,
.update = _update,
.add_policies = _add_policies,
.get_traffic_selectors = _get_traffic_selectors,
.create_ts_enumerator = _create_ts_enumerator,
.create_policy_enumerator = _create_policy_enumerator,
.destroy = _destroy,
},