From 5914e40c2ff7fcf346c90705785f3fb7650a9fdc Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 29 Jan 2018 13:27:52 -0800 Subject: Expose scatter/gather I/O vectors; we will use for HTTP API. --- src/nng.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/nng.h') 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 *); -- cgit v1.2.3-70-g09d2