aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/vec.h
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-06-07 23:48:20 -0700
committerFlorin Coras <florin.coras@gmail.com>2018-07-09 21:10:53 +0000
commit947ea6222dad1ef04595c34273e9231395aef443 (patch)
tree8990854b2901ff8cc2241b9abfc99b0b4b54d517 /src/vppinfra/vec.h
parentdd47ecadcf63772a6037a1bb3715772d80e87f51 (diff)
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 <nranns@cisco.com>
Diffstat (limited to 'src/vppinfra/vec.h')
-rw-r--r--src/vppinfra/vec.h21
1 files changed, 21 insertions, 0 deletions
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