86 #ifndef MHD_MICROHTTPD_H
87 #define MHD_MICROHTTPD_H
107 #ifndef MHD_PLATFORM_H
112 #include <ws2tcpip.h>
114 #include <sys/time.h>
115 #include <sys/types.h>
116 #include <sys/socket.h>
124 #define MHD_VERSION 0x00093300
139 #define MHD_INVALID_NONCE -1
146 #define MHD_SIZE_UNKNOWN UINT64_MAX
148 #define MHD_SIZE_UNKNOWN ((uint64_t) -1LL)
152 #define MHD_CONTENT_READER_END_OF_STREAM SIZE_MAX
153 #define MHD_CONTENT_READER_END_WITH_ERROR (SIZE_MAX - 1)
155 #define MHD_CONTENT_READER_END_OF_STREAM ((size_t) -1LL)
156 #define MHD_CONTENT_READER_END_WITH_ERROR (((size_t) -1LL) - 1)
164 #ifndef MHD_LONG_LONG
168 #define MHD_LONG_LONG long long
169 #define MHD_UNSIGNED_LONG_LONG unsigned long long
175 #ifndef MHD_LONG_LONG_PRINTF
179 #define MHD_LONG_LONG_PRINTF "ll"
180 #define MHD_UNSIGNED_LONG_LONG_PRINTF "%llu"
189 #define MHD_HTTP_CONTINUE 100
190 #define MHD_HTTP_SWITCHING_PROTOCOLS 101
191 #define MHD_HTTP_PROCESSING 102
193 #define MHD_HTTP_OK 200
194 #define MHD_HTTP_CREATED 201
195 #define MHD_HTTP_ACCEPTED 202
196 #define MHD_HTTP_NON_AUTHORITATIVE_INFORMATION 203
197 #define MHD_HTTP_NO_CONTENT 204
198 #define MHD_HTTP_RESET_CONTENT 205
199 #define MHD_HTTP_PARTIAL_CONTENT 206
200 #define MHD_HTTP_MULTI_STATUS 207
202 #define MHD_HTTP_MULTIPLE_CHOICES 300
203 #define MHD_HTTP_MOVED_PERMANENTLY 301
204 #define MHD_HTTP_FOUND 302
205 #define MHD_HTTP_SEE_OTHER 303
206 #define MHD_HTTP_NOT_MODIFIED 304
207 #define MHD_HTTP_USE_PROXY 305
208 #define MHD_HTTP_SWITCH_PROXY 306
209 #define MHD_HTTP_TEMPORARY_REDIRECT 307
211 #define MHD_HTTP_BAD_REQUEST 400
212 #define MHD_HTTP_UNAUTHORIZED 401
213 #define MHD_HTTP_PAYMENT_REQUIRED 402
214 #define MHD_HTTP_FORBIDDEN 403
215 #define MHD_HTTP_NOT_FOUND 404
216 #define MHD_HTTP_METHOD_NOT_ALLOWED 405
217 #define MHD_HTTP_METHOD_NOT_ACCEPTABLE 406
218 #define MHD_HTTP_PROXY_AUTHENTICATION_REQUIRED 407
219 #define MHD_HTTP_REQUEST_TIMEOUT 408
220 #define MHD_HTTP_CONFLICT 409
221 #define MHD_HTTP_GONE 410
222 #define MHD_HTTP_LENGTH_REQUIRED 411
223 #define MHD_HTTP_PRECONDITION_FAILED 412
224 #define MHD_HTTP_REQUEST_ENTITY_TOO_LARGE 413
225 #define MHD_HTTP_REQUEST_URI_TOO_LONG 414
226 #define MHD_HTTP_UNSUPPORTED_MEDIA_TYPE 415
227 #define MHD_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE 416
228 #define MHD_HTTP_EXPECTATION_FAILED 417
229 #define MHD_HTTP_UNPROCESSABLE_ENTITY 422
230 #define MHD_HTTP_LOCKED 423
231 #define MHD_HTTP_FAILED_DEPENDENCY 424
232 #define MHD_HTTP_UNORDERED_COLLECTION 425
233 #define MHD_HTTP_UPGRADE_REQUIRED 426
234 #define MHD_HTTP_NO_RESPONSE 444
235 #define MHD_HTTP_RETRY_WITH 449
236 #define MHD_HTTP_BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS 450
237 #define MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS 451
239 #define MHD_HTTP_INTERNAL_SERVER_ERROR 500
240 #define MHD_HTTP_NOT_IMPLEMENTED 501
241 #define MHD_HTTP_BAD_GATEWAY 502
242 #define MHD_HTTP_SERVICE_UNAVAILABLE 503
243 #define MHD_HTTP_GATEWAY_TIMEOUT 504
244 #define MHD_HTTP_HTTP_VERSION_NOT_SUPPORTED 505
245 #define MHD_HTTP_VARIANT_ALSO_NEGOTIATES 506
246 #define MHD_HTTP_INSUFFICIENT_STORAGE 507
247 #define MHD_HTTP_BANDWIDTH_LIMIT_EXCEEDED 509
248 #define MHD_HTTP_NOT_EXTENDED 510
258 #define MHD_ICY_FLAG ((uint32_t)(1 << 31))
266 #define MHD_HTTP_HEADER_ACCEPT "Accept"
267 #define MHD_HTTP_HEADER_ACCEPT_CHARSET "Accept-Charset"
268 #define MHD_HTTP_HEADER_ACCEPT_ENCODING "Accept-Encoding"
269 #define MHD_HTTP_HEADER_ACCEPT_LANGUAGE "Accept-Language"
270 #define MHD_HTTP_HEADER_ACCEPT_RANGES "Accept-Ranges"
271 #define MHD_HTTP_HEADER_AGE "Age"
272 #define MHD_HTTP_HEADER_ALLOW "Allow"
273 #define MHD_HTTP_HEADER_AUTHORIZATION "Authorization"
274 #define MHD_HTTP_HEADER_CACHE_CONTROL "Cache-Control"
275 #define MHD_HTTP_HEADER_CONNECTION "Connection"
276 #define MHD_HTTP_HEADER_CONTENT_ENCODING "Content-Encoding"
277 #define MHD_HTTP_HEADER_CONTENT_LANGUAGE "Content-Language"
278 #define MHD_HTTP_HEADER_CONTENT_LENGTH "Content-Length"
279 #define MHD_HTTP_HEADER_CONTENT_LOCATION "Content-Location"
280 #define MHD_HTTP_HEADER_CONTENT_MD5 "Content-MD5"
281 #define MHD_HTTP_HEADER_CONTENT_RANGE "Content-Range"
282 #define MHD_HTTP_HEADER_CONTENT_TYPE "Content-Type"
283 #define MHD_HTTP_HEADER_COOKIE "Cookie"
284 #define MHD_HTTP_HEADER_DATE "Date"
285 #define MHD_HTTP_HEADER_ETAG "ETag"
286 #define MHD_HTTP_HEADER_EXPECT "Expect"
287 #define MHD_HTTP_HEADER_EXPIRES "Expires"
288 #define MHD_HTTP_HEADER_FROM "From"
289 #define MHD_HTTP_HEADER_HOST "Host"
290 #define MHD_HTTP_HEADER_IF_MATCH "If-Match"
291 #define MHD_HTTP_HEADER_IF_MODIFIED_SINCE "If-Modified-Since"
292 #define MHD_HTTP_HEADER_IF_NONE_MATCH "If-None-Match"
293 #define MHD_HTTP_HEADER_IF_RANGE "If-Range"
294 #define MHD_HTTP_HEADER_IF_UNMODIFIED_SINCE "If-Unmodified-Since"
295 #define MHD_HTTP_HEADER_LAST_MODIFIED "Last-Modified"
296 #define MHD_HTTP_HEADER_LOCATION "Location"
297 #define MHD_HTTP_HEADER_MAX_FORWARDS "Max-Forwards"
298 #define MHD_HTTP_HEADER_PRAGMA "Pragma"
299 #define MHD_HTTP_HEADER_PROXY_AUTHENTICATE "Proxy-Authenticate"
300 #define MHD_HTTP_HEADER_PROXY_AUTHORIZATION "Proxy-Authorization"
301 #define MHD_HTTP_HEADER_RANGE "Range"
303 #define MHD_HTTP_HEADER_REFERER "Referer"
304 #define MHD_HTTP_HEADER_RETRY_AFTER "Retry-After"
305 #define MHD_HTTP_HEADER_SERVER "Server"
306 #define MHD_HTTP_HEADER_SET_COOKIE "Set-Cookie"
307 #define MHD_HTTP_HEADER_SET_COOKIE2 "Set-Cookie2"
308 #define MHD_HTTP_HEADER_TE "TE"
309 #define MHD_HTTP_HEADER_TRAILER "Trailer"
310 #define MHD_HTTP_HEADER_TRANSFER_ENCODING "Transfer-Encoding"
311 #define MHD_HTTP_HEADER_UPGRADE "Upgrade"
312 #define MHD_HTTP_HEADER_USER_AGENT "User-Agent"
313 #define MHD_HTTP_HEADER_VARY "Vary"
314 #define MHD_HTTP_HEADER_VIA "Via"
315 #define MHD_HTTP_HEADER_WARNING "Warning"
316 #define MHD_HTTP_HEADER_WWW_AUTHENTICATE "WWW-Authenticate"
317 #define MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN "Access-Control-Allow-Origin"
327 #define MHD_HTTP_VERSION_1_0 "HTTP/1.0"
328 #define MHD_HTTP_VERSION_1_1 "HTTP/1.1"
337 #define MHD_HTTP_METHOD_CONNECT "CONNECT"
338 #define MHD_HTTP_METHOD_DELETE "DELETE"
339 #define MHD_HTTP_METHOD_GET "GET"
340 #define MHD_HTTP_METHOD_HEAD "HEAD"
341 #define MHD_HTTP_METHOD_OPTIONS "OPTIONS"
342 #define MHD_HTTP_METHOD_POST "POST"
343 #define MHD_HTTP_METHOD_PUT "PUT"
344 #define MHD_HTTP_METHOD_TRACE "TRACE"
353 #define MHD_HTTP_POST_ENCODING_FORM_URLENCODED "application/x-www-form-urlencoded"
354 #define MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA "multipart/form-data"
385 struct MHD_PostProcessor;
1076 const char *reason);
1087 const struct sockaddr *addr,
1136 const char *upload_data,
1137 size_t *upload_data_size,
1174 const char *key,
const char *value);
1264 const char *filename,
1265 const char *content_type,
1266 const char *transfer_encoding,
1387 const struct sockaddr *addr,
1407 fd_set *read_fd_set,
1408 fd_set *write_fd_set,
1409 fd_set *except_fd_set,
1476 const fd_set *read_fd_set,
1477 const fd_set *write_fd_set,
1478 const fd_set *except_fd_set);
1583 unsigned int status_code,
1772 enum MHD_UpgradeEventMask
1779 MHD_UPGRADE_EVENT_TERMINATE = 0,
1785 MHD_UPGRADE_EVENT_READ = 1,
1791 MHD_UPGRADE_EVENT_WRITE = 2,
1800 MHD_UPGRADE_EVENT_EXTERNAL = 4,
1809 MHD_UPGRADE_EVENT_CORK = 8
1857 typedef enum MHD_UpgradeEventMask (*MHD_UpgradeHandler)(
void *cls,
1860 size_t *data_in_size,
1861 const char *data_in,
1862 size_t *data_out_size,
1896 MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler,
1897 void *upgrade_handler_cls);
1926 const char *content);
1941 const char *content);
1956 const char *content);
2014 struct MHD_PostProcessor *
2035 const char *post_data,
size_t post_data_len);
2060 #define MHD_INVALID_NONCE -1
2091 const char *username,
2092 const char *password,
2093 unsigned int nonce_timeout);
int(* MHD_KeyValueIterator)(void *cls, enum MHD_ValueKind kind, const char *key, const char *value)
struct MHD_Daemon * MHD_start_daemon_va(unsigned int flags, uint16_t port, MHD_AcceptPolicyCallback apc, void *apc_cls, MHD_AccessHandlerCallback dh, void *dh_cls, va_list ap)
struct MHD_Response * MHD_create_response_from_callback(uint64_t size, size_t block_size, MHD_ContentReaderCallback crc, void *crc_cls, MHD_ContentReaderFreeCallback crfc)
const char * MHD_get_version(void)
const char * MHD_lookup_connection_value(struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key)
union MHD_DaemonInfo * MHD_get_daemon_info(struct MHD_Daemon *daemon, enum MHD_DaemonInfoType info_type,...)
int MHD_add_response_header(struct MHD_Response *response, const char *header, const char *content)
MHD_ContentReaderFreeCallback crfc
int MHD_get_timeout(struct MHD_Daemon *daemon, MHD_UNSIGNED_LONG_LONG *timeout)
void MHD_resume_connection(struct MHD_Connection *connection)
void(* MHD_ContentReaderFreeCallback)(void *cls)
struct MHD_Response * MHD_create_response_from_fd_at_offset(size_t size, int fd, off_t offset)
int MHD_queue_basic_auth_fail_response(struct MHD_Connection *connection, const char *realm, struct MHD_Response *response)
void(* MHD_RequestCompletedCallback)(void *cls, struct MHD_Connection *connection, void **con_cls, enum MHD_RequestTerminationCode toe)
MHD_RequestTerminationCode
int(* MHD_PostDataIterator)(void *cls, enum MHD_ValueKind kind, const char *key, const char *filename, const char *content_type, const char *transfer_encoding, const char *data, uint64_t off, size_t size)
int MHD_destroy_post_processor(struct MHD_PostProcessor *pp)
int MHD_digest_auth_check(struct MHD_Connection *connection, const char *realm, const char *username, const char *password, unsigned int nonce_timeout)
struct MHD_Daemon * MHD_start_daemon(unsigned int flags, uint16_t port, MHD_AcceptPolicyCallback apc, void *apc_cls, MHD_AccessHandlerCallback dh, void *dh_cls,...)
void MHD_set_panic_func(MHD_PanicCallback cb, void *cls)
#define MHD_UNSIGNED_LONG_LONG
struct MHD_PostProcessor * MHD_create_post_processor(struct MHD_Connection *connection, size_t buffer_size, MHD_PostDataIterator iter, void *iter_cls)
char * MHD_basic_auth_get_username_password(struct MHD_Connection *connection, char **password)
union MHD_ConnectionInfo * MHD_get_connection_info(struct MHD_Connection *connection, enum MHD_ConnectionInfoType info_type,...)
void MHD_stop_daemon(struct MHD_Daemon *daemon)
int MHD_queue_auth_fail_response(struct MHD_Connection *connection, const char *realm, const char *opaque, struct MHD_Response *response, int signal_stale)
int MHD_add_response_footer(struct MHD_Response *response, const char *footer, const char *content)
int MHD_run_from_select(struct MHD_Daemon *daemon, const fd_set *read_fd_set, const fd_set *write_fd_set, const fd_set *except_fd_set)
char * MHD_digest_auth_get_username(struct MHD_Connection *connection)
void MHD_destroy_response(struct MHD_Response *response)
int(* MHD_AcceptPolicyCallback)(void *cls, const struct sockaddr *addr, socklen_t addrlen)
int MHD_set_connection_option(struct MHD_Connection *connection, enum MHD_CONNECTION_OPTION option,...)
ssize_t(* MHD_ContentReaderCallback)(void *cls, uint64_t pos, char *buf, size_t max)
struct MHD_Daemon * daemon
int MHD_post_process(struct MHD_PostProcessor *pp, const char *post_data, size_t post_data_len)
struct MHD_Response * MHD_create_response_from_fd(size_t size, int fd)
int MHD_queue_response(struct MHD_Connection *connection, unsigned int status_code, struct MHD_Response *response)
int MHD_quiesce_daemon(struct MHD_Daemon *daemon)
struct MHD_Response * MHD_create_response_from_buffer(size_t size, void *buffer, enum MHD_ResponseMemoryMode mode)
MHD_AcceptPolicyCallback apc
int MHD_get_connection_values(struct MHD_Connection *connection, enum MHD_ValueKind kind, MHD_KeyValueIterator iterator, void *iterator_cls)
int MHD_run(struct MHD_Daemon *daemon)
int MHD_get_fdset(struct MHD_Daemon *daemon, fd_set *read_fd_set, fd_set *write_fd_set, fd_set *except_fd_set, int *max_fd)
MHD_ContentReaderCallback crc
struct sockaddr * client_addr
int(* MHD_AccessHandlerCallback)(void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls)
int MHD_add_connection(struct MHD_Daemon *daemon, int client_socket, const struct sockaddr *addr, socklen_t addrlen)
int MHD_del_response_header(struct MHD_Response *response, const char *header, const char *content)
struct MHD_Response * MHD_create_response_from_data(size_t size, void *data, int must_free, int must_copy)
void MHD_suspend_connection(struct MHD_Connection *connection)
const char * MHD_get_response_header(struct MHD_Response *response, const char *key)
int MHD_set_connection_value(struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, const char *value)
MHD_FLAG
Flags for the struct MHD_Daemon.
int MHD_get_response_headers(struct MHD_Response *response, MHD_KeyValueIterator iterator, void *iterator_cls)
void(* MHD_LogCallback)(void *cls, const char *fm, va_list ap)
void(* MHD_PanicCallback)(void *cls, const char *file, unsigned int line, const char *reason)