diff options
Diffstat (limited to 'src/vlib')
-rw-r--r-- | src/vlib/buffer.h | 12 |
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. |