aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-06-25 14:05:12 +0000
committerng0 <ng0@n0.is>2019-06-25 14:05:12 +0000
commitee0942b2e0ea1683d9329f45cc81b193908672ec (patch)
treef1d8f7b19929c973245edb80f266252c777545b0
parent9af4a482e857fd14b10a1bc52e71d971d9f081a7 (diff)
downloadlibmicrohttpd-ee0942b2e0ea1683d9329f45cc81b193908672ec.tar.gz
libmicrohttpd-ee0942b2e0ea1683d9329f45cc81b193908672ec.zip
iAdd headerfile for mhd_send.
-rw-r--r--src/microhttpd/Makefile.am2
-rw-r--r--src/microhttpd/mhd_send.c26
-rw-r--r--src/microhttpd/mhd_send.h70
3 files changed, 72 insertions, 26 deletions
diff --git a/src/microhttpd/Makefile.am b/src/microhttpd/Makefile.am
index 452e8971..7a484371 100644
--- a/src/microhttpd/Makefile.am
+++ b/src/microhttpd/Makefile.am
@@ -62,7 +62,7 @@ libmicrohttpd_la_SOURCES = \
62 mhd_limits.h mhd_byteorder.h \ 62 mhd_limits.h mhd_byteorder.h \
63 sysfdsetsize.c sysfdsetsize.h \ 63 sysfdsetsize.c sysfdsetsize.h \
64 mhd_str.c mhd_str.h \ 64 mhd_str.c mhd_str.h \
65 mhd_send.c \ 65 mhd_send.h mhd_send.c \
66 mhd_assert.h \ 66 mhd_assert.h \
67 mhd_sockets.c mhd_sockets.h \ 67 mhd_sockets.c mhd_sockets.h \
68 mhd_itc.c mhd_itc.h mhd_itc_types.h \ 68 mhd_itc.c mhd_itc.h mhd_itc_types.h \
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index c3724cba..50013c13 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -29,14 +29,7 @@
29// are used. 29// are used.
30// TODO: sendfile() wrappers. 30// TODO: sendfile() wrappers.
31 31
32#include "platform.h" 32#include "mhd_send.h"
33#include "internal.h"
34
35#ifdef HAVE_STDBOOL_H
36#include <stdbool.h>
37#endif
38#include <errno.h>
39
40 33
41// NOTE: TCP_CORK == TCP_NOPUSH in FreeBSD. 34// NOTE: TCP_CORK == TCP_NOPUSH in FreeBSD.
42// TCP_CORK is Linux. 35// TCP_CORK is Linux.
@@ -47,23 +40,6 @@
47// the linked library needs a different setsockopt usage: 40// the linked library needs a different setsockopt usage:
48// https://stackoverflow.com/questions/48670299/setsockopt-usage-in-linux-and-solaris-invalid-argument-in-solaris 41// https://stackoverflow.com/questions/48670299/setsockopt-usage-in-linux-and-solaris-invalid-argument-in-solaris
49 42
50enum MHD_SendSocketOptions
51{
52 /* definitely no corking (use NODELAY, or explicitly disable cork) */
53 MHD_SSO_NO_CORK = 0,
54 /* should enable corking (use MSG_MORE, or explicitly enable cork) */
55 MHD_SSO_MAY_CORK = 1,
56 /*
57 * consider tcpi_snd_mss and consider not corking for the header
58 * part if the size of the header is close to the MSS.
59 * Only used if we are NOT doing 100 Continue and are still
60 * sending the header (provided in full as the buffer to
61 * MHD_send_on_connection_ or as the header to
62 * MHD_send_on_connection2_).
63 */
64 MHD_SSO_HDR_CORK = 2
65};
66
67/* 43/*
68 * https://svnweb.freebsd.org/base/head/sys/netinet/tcp_usrreq.c?view=markup&pathrev=346360 44 * https://svnweb.freebsd.org/base/head/sys/netinet/tcp_usrreq.c?view=markup&pathrev=346360
69 * Approximately in 2007 work began to make TCP_NOPUSH in FreeBSD 45 * Approximately in 2007 work began to make TCP_NOPUSH in FreeBSD
diff --git a/src/microhttpd/mhd_send.h b/src/microhttpd/mhd_send.h
new file mode 100644
index 00000000..2ff39a05
--- /dev/null
+++ b/src/microhttpd/mhd_send.h
@@ -0,0 +1,70 @@
1/*
2 This file is part of libmicrohttpd
3 Copyright (C) 2019 ng0
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19*/
20
21/**
22 * @file mhd_send.h
23 * @brief Implementation of send() wrappers.
24 * @author ng0
25 */
26
27#ifndef MHD_SEND_H
28#define MHD_SEND_H
29
30#include "platform.h"
31#include "internal.h"
32
33#if defined(HAVE_STDBOOL_H)
34#include <stdbool.h>
35#endif /* HAVE_STDBOOL_H */
36
37#include <errno.h>
38
39enum MHD_SendSocketOptions
40{
41 /* definitely no corking (use NODELAY, or explicitly disable cork) */
42 MHD_SSO_NO_CORK = 0,
43 /* should enable corking (use MSG_MORE, or explicitly enable cork) */
44 MHD_SSO_MAY_CORK = 1,
45 /*
46 * consider tcpi_snd_mss and consider not corking for the header
47 * part if the size of the header is close to the MSS.
48 * Only used if we are NOT doing 100 Continue and are still
49 * sending the header (provided in full as the buffer to
50 * MHD_send_on_connection_ or as the header to
51 * MHD_send_on_connection2_).
52 */
53 MHD_SSO_HDR_CORK = 2
54};
55
56
57ssize_t
58MHD_send_on_connection_ (struct MHD_Connection *connection,
59 const char *buffer,
60 size_t buffer_size,
61 enum MHD_SendSocketOptions options);
62
63ssize_t
64MHD_send_on_connection2_ (struct MHD_Connection *connection,
65 const char *header,
66 size_t header_size,
67 const char *buffer,
68 size_t buffer_size);
69
70#endif /* MHD_SEND_H */