aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2017-04-26 16:09:06 +0200
committerFlorin Coras <florin.coras@gmail.com>2017-05-03 15:19:23 +0000
commit816f437d943688f67d61fb6b9708eff59432b2ee (patch)
tree565bddb5ad81b00eae739c4438ecb67042dd4218 /src/vlib
parentafc47aa36f44d3f865c6e1e48f41eded366a85ac (diff)
Fix vnet unit tests
Change-Id: Ibe55e4399c6b78d83268d7c49ed498cab7bfdb43 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/buffer.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/vlib/buffer.h b/src/vlib/buffer.h
index 69c8c7ccb09..18e2437d775 100644
--- a/src/vlib/buffer.h
+++ b/src/vlib/buffer.h
@@ -205,6 +205,18 @@ vlib_buffer_advance (vlib_buffer_t * b, word l)
b->current_length -= l;
}
+/** \brief Check if there is enough space in buffer to advance
+
+ @param b - (vlib_buffer_t *) pointer to the buffer
+ @param l - (word) size to check
+ @return - 0 if there is less space than 'l' in buffer
+*/
+always_inline u8
+vlib_buffer_has_space (vlib_buffer_t * b, word l)
+{
+ return b->current_length >= l;
+}
+
/** \brief Reset current header & length to state they were in when
packet was received.