From 947ea6222dad1ef04595c34273e9231395aef443 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Thu, 7 Jun 2018 23:48:20 -0700 Subject: IGMP improvements - Enable/Disable an interface for IGMP - improve logging - refactor common code - no orphaned timers - IGMP state changes in main thread only - Large groups split over multiple state-change reports - SSM range configuration API. - more tests Change-Id: If5674f1044e7e97274a711f47807c9ba689d7b9a Signed-off-by: Neale Ranns --- src/vppinfra/vec.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/vppinfra/vec.h') diff --git a/src/vppinfra/vec.h b/src/vppinfra/vec.h index f233ae1c48f..1b0378fe063 100644 --- a/src/vppinfra/vec.h +++ b/src/vppinfra/vec.h @@ -953,6 +953,27 @@ do { \ _v(i); \ }) +/** \brief Search a vector for the index of the entry that matches. + + @param v1 Pointer to a vector + @param v2 Pointer to entry to match + @param fn Comparison function !0 => match + @return index of match or ~0 +*/ +#define vec_search_with_function(v,E,fn) \ +({ \ + word _v(i) = 0; \ + while (_v(i) < vec_len(v)) \ + { \ + if (0 != fn(&(v)[_v(i)], (E))) \ + break; \ + _v(i)++; \ + } \ + if (_v(i) == vec_len(v)) \ + _v(i) = ~0; \ + _v(i); \ +}) + /** \brief Sort a vector using the supplied element comparison function @param vec vector to sort -- cgit 1.2.3-korg