return FALSE;
}
+/**
+ * Check if all given traffic selectors are contained in any of the traffic
+ * selectors in the given list.
+ */
+static bool is_ts_list_match(traffic_selector_list_t *to_check, array_t *list)
+{
+ enumerator_t *enumerator;
+ traffic_selector_t *ts;
+ bool matched = TRUE;
+
+ enumerator = to_check->create_enumerator(to_check);
+ while (enumerator->enumerate(enumerator, &ts))
+ {
+ if (!is_ts_match(ts, list))
+ {
+ matched = FALSE;
+ break;
+ }
+ }
+ enumerator->destroy(enumerator);
+ return matched;
+}
+
/*
* Described in header
*/
is_ts_match(src, this->my_ts) &&
is_ts_match(dst, this->other_ts);
}
+
+/*
+ * Described in header
+ */
+bool child_sa_ts_lists_match(child_sa_t *child, traffic_selector_list_t *src,
+ traffic_selector_list_t *dst)
+{
+ private_child_sa_t *this = (private_child_sa_t*)child;
+
+ return src && dst &&
+ is_ts_list_match(src, this->my_ts) &&
+ is_ts_list_match(dst, this->other_ts);
+}
bool child_sa_ts_match(child_sa_t *this, traffic_selector_t *src,
traffic_selector_t *dst);
+/**
+ * Check if the given lists of source and destination traffic selectors (e.g.
+ * from a previous SA) match the negotiated local and remote traffic
+ * selectors of this child SA.
+ *
+ * @param this CHILD_SA to check traffic selectors against
+ * @param src source traffic selector list
+ * @param dst destination traffic selector list
+ * @return TRUE if all traffic selectors match
+ */
+bool child_sa_ts_lists_match(child_sa_t *this, traffic_selector_list_t *src,
+ traffic_selector_list_t *dst);
+
#endif /** CHILD_SA_H_ @}*/