From fb769aeaff23e79e4167823ef2923a7d61807718 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 4 Aug 2016 21:31:36 +0200 Subject: Add libcoopgamma_skip_message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libcoopgamma.c | 13 +++++++++++++ src/libcoopgamma.h | 8 ++++++++ 2 files changed, 21 insertions(+) (limited to 'src') diff --git a/src/libcoopgamma.c b/src/libcoopgamma.c index fbdef21..c4f13ab 100644 --- a/src/libcoopgamma.c +++ b/src/libcoopgamma.c @@ -1741,6 +1741,19 @@ static char* next_payload(libcoopgamma_context_t* restrict ctx, size_t* n) } +/** + * Tell the library that you will not be parsing a receive message + * + * @param ctx The state of the library, must be connected + */ +void libcoopgamma_skip_message(libcoopgamma_context_t* restrict ctx) +{ + size_t _n; + while (*next_header(ctx)); + (void) next_payload(ctx, &_n); +} + + /** * Check whether the server sent an error, if so copy it to `ctx` * diff --git a/src/libcoopgamma.h b/src/libcoopgamma.h index f670afa..1022f1e 100644 --- a/src/libcoopgamma.h +++ b/src/libcoopgamma.h @@ -1465,6 +1465,14 @@ LIBCOOPGAMMA_GCC_ONLY(__attribute__((__nonnull__(1, 4), __leaf__))) int libcoopgamma_synchronise(libcoopgamma_context_t* restrict, libcoopgamma_async_context_t* restrict, size_t, size_t* restrict); +/** + * Tell the library that you will not be parsing a receive message + * + * @param ctx The state of the library, must be connected + */ +LIBCOOPGAMMA_GCC_ONLY(__attribute__((__nonnull__))) +void libcoopgamma_skip_message(libcoopgamma_context_t* restrict); + /** * List all available CRTC:s, send request part -- cgit v1.2.3-70-g09d2