summaryrefslogtreecommitdiff
path: root/mcastseed/src/dgrambuf.h
diff options
context:
space:
mode:
Diffstat (limited to 'mcastseed/src/dgrambuf.h')
-rw-r--r--mcastseed/src/dgrambuf.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/mcastseed/src/dgrambuf.h b/mcastseed/src/dgrambuf.h
index fab7649..f405757 100644
--- a/mcastseed/src/dgrambuf.h
+++ b/mcastseed/src/dgrambuf.h
@@ -7,17 +7,31 @@
*/
#include <stdlib.h> /* size_t */
+#define DGRAMBUF_RECV_OVERWRITE 1 << 1
+#define DGRAMBUF_RECV_EINTR 1 << 2
+#define DGRAMBUF_RECV_IOVEC_FULL 1 << 3
+#define DGRAMBUF_RECV_FINALIZE 1 << 4
+#define DGRAMBUF_RECV_FUTURE_DGRAM 1 << 5
+#define DGRAMBUF_RECV_VALID_DGRAM 1 << 6
+
+#define DGRAMBUF_WRITE_PARTIAL 1 << 1
+#define DGRAMBUF_WRITE_EWOULDBLOCK_OR_EINTR 1 << 2
+#define DGRAMBUF_WRITE_IOVEC_FULL 1 << 3
+#define DGRAMBUF_WRITE_SUCCESS 1 << 4
+
typedef struct dgrambuf_t *dgrambuf_t;
dgrambuf_t dgrambuf_new(size_t dgram_slots, size_t dgram_max_size, size_t dgram_header_size, size_t iovec_slots);
void dgrambuf_free(dgrambuf_t *dbuf);
-size_t dgrambuf_free_count(const dgrambuf_t);
-void dgrambuf_set_validate_func(dgrambuf_t dbuf, unsigned int (*func)(unsigned int, void *) );
+size_t dgrambuf_get_free_count(const dgrambuf_t);
+int dgrambuf_everything_was_received(dgrambuf_t dbuf);
+void dgrambuf_set_validate_func(dgrambuf_t dbuf, int (*validate_func)(unsigned int, void *, unsigned int *));
int dgrambuf_have_data_ready_to_write(dgrambuf_t dbuf);
+int dgrambuf_have_received_everything(dgrambuf_t dbuf);
-
-int dgrambuf_recvmmsg(dgrambuf_t dbuf, int sockfd);
-ssize_t dgrambuf_write(dgrambuf_t dbuf, int fd);
+/* Warning : dgrambuf_recvmmsg sets and restore SIGALRM handler if timeout != 0 */
+ssize_t dgrambuf_recvmmsg(dgrambuf_t dbuf, int sockfd, int timeout, int *info);
+ssize_t dgrambuf_write(dgrambuf_t dbuf, int fd, int *info);
#endif /* DGRAMBUF_H */