aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/internal.h')
-rw-r--r--src/microhttpd/internal.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index f3c4cb1e..ba71d1eb 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -343,6 +343,57 @@ struct MHD_HTTP_Header
343}; 343};
344 344
345 345
346#if defined(MHD_WINSOCK_SOCKETS)
347/**
348 * Internally used I/O vector type for use with winsock.
349 * Binary matches system "WSABUF".
350 */
351typedef struct _MHD_W32_iovec
352{
353 unsigned long iov_len;
354 char *iov_base;
355} MHD_iovec_;
356#define MHD_IOV_ELMN_MAX_SIZE ULONG_MAX
357#elif defined(HAVE_SENDMSG) || defined(HAVE_WRITEV)
358/**
359 * Internally used I/O vector type for use when writev or sendmsg
360 * is available. Matches system "struct iovec".
361 */
362typedef struct iovec MHD_iovec_;
363#define MHD_IOV_ELMN_MAX_SIZE SIZE_MAX
364#else
365/**
366 * Internally used I/O vector type for use when writev or sendmsg
367 * is not available.
368 */
369typedef struct MHD_IoVec MHD_iovec_;
370#define MHD_IOV_ELMN_MAX_SIZE SIZE_MAX
371#endif
372
373
374struct MHD_iovec_track_
375{
376 /**
377 * The copy of array of iovec elements.
378 * The copy of elements are updated during sending.
379 * The number of elements is not changed during lifetime.
380 */
381 MHD_iovec_ *iov;
382
383 /**
384 * The number of elements in @iov.
385 * This value is not changed during lifetime.
386 */
387 size_t cnt;
388
389 /**
390 * The number of sent elements.
391 * At the same time, it is the index of the next (or current) element
392 * to send.
393 */
394 size_t sent;
395};
396
346/** 397/**
347 * Representation of a response. 398 * Representation of a response.
348 */ 399 */
@@ -450,6 +501,15 @@ struct MHD_Response
450 */ 501 */
451 bool is_pipe; 502 bool is_pipe;
452 503
504 /**
505 * I/O vector used with MHD_create_response_from_iovec.
506 */
507 MHD_iovec_ *data_iov;
508
509 /**
510 * Number of elements in data_iov.
511 */
512 size_t data_iovcnt;
453}; 513};
454 514
455 515
@@ -873,6 +933,15 @@ struct MHD_Connection
873 */ 933 */
874 uint64_t response_write_position; 934 uint64_t response_write_position;
875 935
936 /**
937 * The copy of iov response.
938 * Valid if iovec response is used.
939 * Updated during send.
940 * Members are allocated in the pool.
941 */
942 struct MHD_iovec_track_ resp_iov;
943
944
876#if defined(_MHD_HAVE_SENDFILE) 945#if defined(_MHD_HAVE_SENDFILE)
877 enum MHD_resp_sender_ 946 enum MHD_resp_sender_
878 { 947 {