aboutsummaryrefslogtreecommitdiff
path: root/src/nng.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-01-29 13:27:52 -0800
committerGarrett D'Amore <garrett@damore.org>2018-01-29 13:27:52 -0800
commit5914e40c2ff7fcf346c90705785f3fb7650a9fdc (patch)
treed769f4110a76679df0ffcf2b4e953bb9b9f3687d /src/nng.h
parente32022c8085fc6b05ed690f9b4b49536d8df13b1 (diff)
downloadnng-5914e40c2ff7fcf346c90705785f3fb7650a9fdc.tar.gz
nng-5914e40c2ff7fcf346c90705785f3fb7650a9fdc.tar.bz2
nng-5914e40c2ff7fcf346c90705785f3fb7650a9fdc.zip
Expose scatter/gather I/O vectors; we will use for HTTP API.
Diffstat (limited to 'src/nng.h')
-rw-r--r--src/nng.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nng.h b/src/nng.h
index a25cb25c..24689f96 100644
--- a/src/nng.h
+++ b/src/nng.h
@@ -53,6 +53,12 @@ typedef struct nng_snapshot nng_snapshot;
typedef struct nng_stat nng_stat;
typedef struct nng_aio nng_aio;
+// Scatter/gather I/O.
+typedef struct nng_iov {
+ void * iov_buf;
+ size_t iov_len;
+} nng_iov;
+
// Some definitions for durations used with timeouts.
#define NNG_DURATION_INFINITE (-1)
#define NNG_DURATION_DEFAULT (-2)
@@ -298,6 +304,12 @@ NNG_DECL nng_msg *nng_aio_get_msg(nng_aio *);
// that any socket specific timeout should be used.
NNG_DECL void nng_aio_set_timeout(nng_aio *, nng_duration);
+// nng_aio_set_iov sets a scatter/gather vector on the aio. The iov array
+// itself is copied. Data members (the memory regions referenced) *may* be
+// copied as well, depending on the operation. This operation is guaranteed
+// to succeed if n <= 4, otherwise it may fail due to NNG_ENOMEM.
+NNG_DECL int nng_aio_set_iov(nng_aio *, int, nng_iov *);
+
// Message API.
NNG_DECL int nng_msg_alloc(nng_msg **, size_t);
NNG_DECL void nng_msg_free(nng_msg *);