diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2017-05-05 11:28:51 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2017-05-05 11:28:51 +0200 |
commit | 604f3d64764270c052cfb43081ec522237bbdb75 (patch) | |
tree | b3db80e35399412693c7a986b3021435b2914fe4 /draft/mcastseed/src/dgrambuf.h | |
parent | f7f175cb29192682f3ece9479f24a40672a3d74d (diff) | |
download | eficast-604f3d64764270c052cfb43081ec522237bbdb75.tar.gz eficast-604f3d64764270c052cfb43081ec522237bbdb75.tar.bz2 eficast-604f3d64764270c052cfb43081ec522237bbdb75.zip |
Massive add for all draft stuff to keep it in sync
Diffstat (limited to 'draft/mcastseed/src/dgrambuf.h')
-rw-r--r-- | draft/mcastseed/src/dgrambuf.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/draft/mcastseed/src/dgrambuf.h b/draft/mcastseed/src/dgrambuf.h new file mode 100644 index 0000000..a83647b --- /dev/null +++ b/draft/mcastseed/src/dgrambuf.h @@ -0,0 +1,41 @@ +#ifndef DGRAMBUF_H +#define DGRAMBUF_H +/* + * dgrambuf.c - C datagrams buffer. + * + * Copyright 2016 by Ludovic Pouzenc <ludovic@pouzenc.fr> + */ +#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_DUPLICATE_DGRAM 1 << 6 +#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 *); + +void dgrambuf_set_validate_func(dgrambuf_t dbuf, int (*validate_func)(unsigned int, void *, unsigned int *)); + +size_t dgrambuf_get_free_count(const dgrambuf_t); +size_t dgrambuf_get_used_count(const dgrambuf_t); +int dgrambuf_have_data_ready_to_write(const dgrambuf_t); +int dgrambuf_have_received_everything(const dgrambuf_t); + +int dgrambuf_stats(dgrambuf_t dbuf, char **allocated_string); + +/* 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 */ |