aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.in2
-rw-r--r--doc/man/libcoopgamma_skip_message.330
-rw-r--r--doc/man/libcoopgamma_synchronise.31
-rw-r--r--src/libcoopgamma.c13
-rw-r--r--src/libcoopgamma.h8
5 files changed, 53 insertions, 1 deletions
diff --git a/Makefile.in b/Makefile.in
index 79feb2e..9ad73ba 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -56,7 +56,7 @@ _MAN_3 = $(foreach T,$(__TYPES),$(foreach F,destroy initialise marshal unmarshal
$(foreach P,$(__PROTOCOLS),$(foreach F,recv send sync,libcoopgamma_$(P)_$(F))) \
libcoopgamma_connect libcoopgamma_flush libcoopgamma_get_method_and_site \
libcoopgamma_get_methods libcoopgamma_get_pid_file libcoopgamma_get_socket_file \
- libcoopgamma_set_nonblocking libcoopgamma_synchronise
+ libcoopgamma_set_nonblocking libcoopgamma_synchronise libcoopgamma_skip_message
_MAN_7 = libcoopgamma
# Used by mk/copy.mk
diff --git a/doc/man/libcoopgamma_skip_message.3 b/doc/man/libcoopgamma_skip_message.3
new file mode 100644
index 0000000..13eb6cc
--- /dev/null
+++ b/doc/man/libcoopgamma_skip_message.3
@@ -0,0 +1,30 @@
+.TH LIBCOOPGAMMA_SKIP_MESSAGE 3 LIBCOOPGAMMA
+.SH "NAME"
+libcoopgamma_skip_message - Skip a received message
+.SH "SYNOPSIS"
+.nf
+#include <libcoopgamma.h>
+
+void libcoopgamma_skip_message(libcoopgamma_context_t *restrict \fIctx\fP);
+.fi
+.P
+Link with
+.IR -lcoopgamma .
+.SH "DESCRIPTION"
+The
+.BR libcoopgamma_skip_message ()
+function is used to tell the library that you
+are not interested in a message recieved for
+.IR ctx .
+This can be the case if
+.BR libcoopgamma_synchronise (3)
+selected an asynchronous call context that
+is inactive.
+.SH "SEE ALSO"
+.BR libcoopgamma_flush (3),
+.BR libcoopgamma_set_nonblocking (3),
+.BR libcoopgamma_synchronise (3),
+.BR libcoopgamma_get_crtcs_sync (3),
+.BR libcoopgamma_get_gamma_info_sync (3),
+.BR libcoopgamma_get_gamma_sync (3),
+.BR libcoopgamma_set_gamma_sync (3)
diff --git a/doc/man/libcoopgamma_synchronise.3 b/doc/man/libcoopgamma_synchronise.3
index d466778..70d2f63 100644
--- a/doc/man/libcoopgamma_synchronise.3
+++ b/doc/man/libcoopgamma_synchronise.3
@@ -87,6 +87,7 @@ first contexts in
.SH "SEE ALSO"
.BR libcoopgamma_flush (3),
.BR libcoopgamma_set_nonblocking (3),
+.BR libcoopgamma_skip_message (3),
.BR libcoopgamma_get_crtcs_recv (3),
.BR libcoopgamma_get_gamma_info_recv (3),
.BR libcoopgamma_get_gamma_recv (3),
diff --git a/src/libcoopgamma.c b/src/libcoopgamma.c
index fbdef21..c4f13ab 100644
--- a/src/libcoopgamma.c
+++ b/src/libcoopgamma.c
@@ -1742,6 +1742,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`
*
* This function will also reports EBADMSG if the message ID
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