diff options
Diffstat (limited to 'src/microhttpd/mhd_send.h')
-rw-r--r-- | src/microhttpd/mhd_send.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/src/microhttpd/mhd_send.h b/src/microhttpd/mhd_send.h new file mode 100644 index 00000000..a766c8c0 --- /dev/null +++ b/src/microhttpd/mhd_send.h | |||
@@ -0,0 +1,97 @@ | |||
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 | #if defined(HAVE_STDBOOL_H) | ||
33 | #include <stdbool.h> | ||
34 | #endif /* HAVE_STDBOOL_H */ | ||
35 | #include <errno.h> | ||
36 | #include "mhd_sockets.h" | ||
37 | #include "connection.h" | ||
38 | #include "connection_https.h" | ||
39 | |||
40 | #ifdef MHD_LINUX_SOLARIS_SENDFILE | ||
41 | #include <sys/sendfile.h> | ||
42 | #endif /* MHD_LINUX_SOLARIS_SENDFILE */ | ||
43 | #if defined(HAVE_FREEBSD_SENDFILE) || defined(HAVE_DARWIN_SENDFILE) | ||
44 | #include <sys/types.h> | ||
45 | #include <sys/socket.h> | ||
46 | #include <sys/uio.h> | ||
47 | #endif /* HAVE_FREEBSD_SENDFILE || HAVE_DARWIN_SENDFILE */ | ||
48 | |||
49 | #ifdef HAVE_SYS_PARAM_H | ||
50 | /* For FreeBSD version identification */ | ||
51 | #include <sys/param.h> | ||
52 | #endif /* HAVE_SYS_PARAM_H */ | ||
53 | |||
54 | /** | ||
55 | * The enumeration of send socket options. | ||
56 | */ | ||
57 | enum MHD_SendSocketOptions | ||
58 | { | ||
59 | /** | ||
60 | * definitely no corking (use NODELAY, or explicitly disable cork) | ||
61 | */ | ||
62 | MHD_SSO_NO_CORK = 0, | ||
63 | /** | ||
64 | * should enable corking (use MSG_MORE, or explicitly enable cork) | ||
65 | */ | ||
66 | MHD_SSO_MAY_CORK = 1, | ||
67 | /** | ||
68 | * consider tcpi_snd_mss and consider not corking for the header | ||
69 | * part if the size of the header is close to the MSS. | ||
70 | * Only used if we are NOT doing 100 Continue and are still | ||
71 | * sending the header (provided in full as the buffer to | ||
72 | * MHD_send_on_connection_ or as the header to | ||
73 | * MHD_send_on_connection2_). | ||
74 | */ | ||
75 | MHD_SSO_HDR_CORK = 2 | ||
76 | }; | ||
77 | |||
78 | |||
79 | ssize_t | ||
80 | MHD_send_on_connection_ (struct MHD_Connection *connection, | ||
81 | const char *buffer, | ||
82 | size_t buffer_size, | ||
83 | enum MHD_SendSocketOptions options); | ||
84 | |||
85 | ssize_t | ||
86 | MHD_send_on_connection2_ (struct MHD_Connection *connection, | ||
87 | const char *header, | ||
88 | size_t header_size, | ||
89 | const char *buffer, | ||
90 | size_t buffer_size); | ||
91 | |||
92 | #if defined(_MHD_HAVE_SENDFILE) | ||
93 | ssize_t | ||
94 | MHD_send_sendfile_ (struct MHD_Connection *connection); | ||
95 | #endif | ||
96 | |||
97 | #endif /* MHD_SEND_H */ | ||