X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvlib%2Fbuffer.h;h=18e2437d775541641732367e88771d4ae10f40b9;hb=816f437d943688f67d61fb6b9708eff59432b2ee;hp=69c8c7ccb093f2131baf5f1cd0060116494acde2;hpb=afc47aa36f44d3f865c6e1e48f41eded366a85ac;p=vpp.git 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.