diff options
Diffstat (limited to 'src/include/microhttpd.h')
-rw-r--r-- | src/include/microhttpd.h | 536 |
1 files changed, 344 insertions, 192 deletions
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index 433c40eb..2798c50a 100644 --- a/src/include/microhttpd.h +++ b/src/include/microhttpd.h | |||
@@ -28,7 +28,7 @@ | |||
28 | * errors (you can only enable or disable logging to stderr). Also, | 28 | * errors (you can only enable or disable logging to stderr). Also, |
29 | * it may not support all of the HTTP features directly, where | 29 | * it may not support all of the HTTP features directly, where |
30 | * applicable, portions of HTTP may have to be handled by clients of | 30 | * applicable, portions of HTTP may have to be handled by clients of |
31 | * the library.<p> | 31 | * the library. |
32 | * | 32 | * |
33 | * The library is supposed to handle everything that it must handle | 33 | * The library is supposed to handle everything that it must handle |
34 | * (because the API would not allow clients to do this), such as basic | 34 | * (because the API would not allow clients to do this), such as basic |
@@ -38,14 +38,14 @@ | |||
38 | * the response and not the body, even if the client supplied a body. | 38 | * the response and not the body, even if the client supplied a body. |
39 | * The library also understands headers that control connection | 39 | * The library also understands headers that control connection |
40 | * management (specifically, "Connection: close" and "Expect: 100 | 40 | * management (specifically, "Connection: close" and "Expect: 100 |
41 | * continue" are understood and handled automatically).<p> | 41 | * continue" are understood and handled automatically). |
42 | * | 42 | * |
43 | * MHD understands POST data and is able to decode certain formats | 43 | * MHD understands POST data and is able to decode certain formats |
44 | * (at the moment only "application/x-www-form-urlencoded" and | 44 | * (at the moment only "application/x-www-form-urlencoded" and |
45 | * "mulitpart/formdata"). Unsupported encodings and large POST | 45 | * "mulitpart/formdata"). Unsupported encodings and large POST |
46 | * submissions may require the application to manually process | 46 | * submissions may require the application to manually process |
47 | * the stream, which is provided to the main application (and thus can be | 47 | * the stream, which is provided to the main application (and thus can be |
48 | * processed, just not conveniently by MHD).<p> | 48 | * processed, just not conveniently by MHD). |
49 | * | 49 | * |
50 | * The header file defines various constants used by the HTTP protocol. | 50 | * The header file defines various constants used by the HTTP protocol. |
51 | * This does not mean that MHD actually interprets all of these | 51 | * This does not mean that MHD actually interprets all of these |
@@ -53,11 +53,11 @@ | |||
53 | * for users of the library. MHD does not verify that transmitted | 53 | * for users of the library. MHD does not verify that transmitted |
54 | * HTTP headers are part of the standard specification; users of the | 54 | * HTTP headers are part of the standard specification; users of the |
55 | * library are free to define their own extensions of the HTTP | 55 | * library are free to define their own extensions of the HTTP |
56 | * standard and use those with MHD.<p> | 56 | * standard and use those with MHD. |
57 | * | 57 | * |
58 | * All functions are guaranteed to be completely reentrant and | 58 | * All functions are guaranteed to be completely reentrant and |
59 | * thread-safe (with the exception of 'MHD_set_connection_value', | 59 | * thread-safe (with the exception of #MHD_set_connection_value, |
60 | * which must only be used in a particular context).<p> | 60 | * which must only be used in a particular context). |
61 | * | 61 | * |
62 | * NEW: Before including "microhttpd.h" you should add the necessary | 62 | * NEW: Before including "microhttpd.h" you should add the necessary |
63 | * includes to define the "uint64_t", "size_t", "fd_set", "socklen_t" | 63 | * includes to define the "uint64_t", "size_t", "fd_set", "socklen_t" |
@@ -67,6 +67,16 @@ | |||
67 | * should also have a line with "#define MHD_PLATFORM_H" which will | 67 | * should also have a line with "#define MHD_PLATFORM_H" which will |
68 | * prevent this header from trying (and, depending on your platform, | 68 | * prevent this header from trying (and, depending on your platform, |
69 | * failing) to include the right headers. | 69 | * failing) to include the right headers. |
70 | * | ||
71 | * @defgroup tls HTTPS/SSL/TLS control | ||
72 | * @defgroup event event-loop control | ||
73 | * @defgroup response generation of responses | ||
74 | * @defgroup request handling of requests | ||
75 | * @defgroup authentication HTTP authentication | ||
76 | * @defgroup logging logging and error handling | ||
77 | * @defgroup networking general networking | ||
78 | * @defgroup specialized misc. specialized functions | ||
79 | * @defgroup limits configuring resource limitations | ||
70 | */ | 80 | */ |
71 | 81 | ||
72 | #ifndef MHD_MICROHTTPD_H | 82 | #ifndef MHD_MICROHTTPD_H |
@@ -167,7 +177,8 @@ extern "C" | |||
167 | 177 | ||
168 | 178 | ||
169 | /** | 179 | /** |
170 | * HTTP response codes. | 180 | * @defgroup httpcode HTTP response codes. |
181 | * @{ | ||
171 | */ | 182 | */ |
172 | #define MHD_HTTP_CONTINUE 100 | 183 | #define MHD_HTTP_CONTINUE 100 |
173 | #define MHD_HTTP_SWITCHING_PROTOCOLS 101 | 184 | #define MHD_HTTP_SWITCHING_PROTOCOLS 101 |
@@ -230,13 +241,20 @@ extern "C" | |||
230 | #define MHD_HTTP_BANDWIDTH_LIMIT_EXCEEDED 509 | 241 | #define MHD_HTTP_BANDWIDTH_LIMIT_EXCEEDED 509 |
231 | #define MHD_HTTP_NOT_EXTENDED 510 | 242 | #define MHD_HTTP_NOT_EXTENDED 510 |
232 | 243 | ||
244 | /** @} */ /* end of group httpcode */ | ||
245 | |||
233 | /** | 246 | /** |
234 | * Flag to be "OR"ed with MHD_HTTP status code for | 247 | * Flag to be "OR"ed with MHD_HTTP status code for |
235 | * SHOUTcast. This will cause the response to begin | 248 | * SHOUTcast. This will cause the response to begin |
236 | * with the SHOUTcast "ICY" line instad of "HTTP". | 249 | * with the SHOUTcast "ICY" line instad of "HTTP". |
250 | * @ingroup specialized | ||
237 | */ | 251 | */ |
238 | #define MHD_ICY_FLAG ((uint32_t)(1 << 31)) | 252 | #define MHD_ICY_FLAG ((uint32_t)(1 << 31)) |
239 | 253 | ||
254 | /** | ||
255 | * @defgroup headers HTTP headers | ||
256 | * @{ | ||
257 | */ | ||
240 | /* See also: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html */ | 258 | /* See also: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html */ |
241 | #define MHD_HTTP_HEADER_ACCEPT "Accept" | 259 | #define MHD_HTTP_HEADER_ACCEPT "Accept" |
242 | #define MHD_HTTP_HEADER_ACCEPT_CHARSET "Accept-Charset" | 260 | #define MHD_HTTP_HEADER_ACCEPT_CHARSET "Accept-Charset" |
@@ -290,15 +308,21 @@ extern "C" | |||
290 | #define MHD_HTTP_HEADER_WARNING "Warning" | 308 | #define MHD_HTTP_HEADER_WARNING "Warning" |
291 | #define MHD_HTTP_HEADER_WWW_AUTHENTICATE "WWW-Authenticate" | 309 | #define MHD_HTTP_HEADER_WWW_AUTHENTICATE "WWW-Authenticate" |
292 | 310 | ||
311 | /** @} */ /* end of group headers */ | ||
312 | |||
293 | /** | 313 | /** |
294 | * HTTP versions (used to match against the first line of the | 314 | * @defgroup versions HTTP versions (used to match against the first line of the |
295 | * HTTP header as well as in the response code). | 315 | * HTTP header as well as in the response code). |
316 | * @{ | ||
296 | */ | 317 | */ |
297 | #define MHD_HTTP_VERSION_1_0 "HTTP/1.0" | 318 | #define MHD_HTTP_VERSION_1_0 "HTTP/1.0" |
298 | #define MHD_HTTP_VERSION_1_1 "HTTP/1.1" | 319 | #define MHD_HTTP_VERSION_1_1 "HTTP/1.1" |
299 | 320 | ||
321 | /** @} */ /* end of group versions */ | ||
322 | |||
300 | /** | 323 | /** |
301 | * HTTP methods | 324 | * @defgroup methods HTTP methods |
325 | * @{ | ||
302 | */ | 326 | */ |
303 | #define MHD_HTTP_METHOD_CONNECT "CONNECT" | 327 | #define MHD_HTTP_METHOD_CONNECT "CONNECT" |
304 | #define MHD_HTTP_METHOD_DELETE "DELETE" | 328 | #define MHD_HTTP_METHOD_DELETE "DELETE" |
@@ -309,18 +333,23 @@ extern "C" | |||
309 | #define MHD_HTTP_METHOD_PUT "PUT" | 333 | #define MHD_HTTP_METHOD_PUT "PUT" |
310 | #define MHD_HTTP_METHOD_TRACE "TRACE" | 334 | #define MHD_HTTP_METHOD_TRACE "TRACE" |
311 | 335 | ||
336 | /** @} */ /* end of group methods */ | ||
337 | |||
312 | /** | 338 | /** |
313 | * HTTP POST encodings, see also | 339 | * @defgroup postenc HTTP POST encodings, see also |
314 | * http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4 | 340 | * http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4 |
341 | * @{ | ||
315 | */ | 342 | */ |
316 | #define MHD_HTTP_POST_ENCODING_FORM_URLENCODED "application/x-www-form-urlencoded" | 343 | #define MHD_HTTP_POST_ENCODING_FORM_URLENCODED "application/x-www-form-urlencoded" |
317 | #define MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA "multipart/form-data" | 344 | #define MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA "multipart/form-data" |
318 | 345 | ||
346 | /** @} */ /* end of group postenc */ | ||
347 | |||
319 | /** | 348 | /** |
320 | * Options for the MHD daemon. Note that if neither | 349 | * Options for the MHD daemon. Note that if neither |
321 | * MHD_USE_THREAD_PER_CONNECTION nor MHD_USE_SELECT_INTERNALLY is | 350 | * #MHD_USE_THREAD_PER_CONNECTION nor #MHD_USE_SELECT_INTERNALLY is |
322 | * used, the client wants control over the process and will call the | 351 | * used, the client wants control over the process and will call the |
323 | * appropriate microhttpd callbacks.<p> | 352 | * appropriate microhttpd callbacks. |
324 | * | 353 | * |
325 | * Starting the daemon may also fail if a particular option is not | 354 | * Starting the daemon may also fail if a particular option is not |
326 | * implemented or not supported on the target platform (i.e. no | 355 | * implemented or not supported on the target platform (i.e. no |
@@ -337,55 +366,63 @@ enum MHD_FLAG | |||
337 | * Run in debug mode. If this flag is used, the | 366 | * Run in debug mode. If this flag is used, the |
338 | * library should print error messages and warnings | 367 | * library should print error messages and warnings |
339 | * to stderr. | 368 | * to stderr. |
369 | * @ingroup logging | ||
340 | */ | 370 | */ |
341 | MHD_USE_DEBUG = 1, | 371 | MHD_USE_DEBUG = 1, |
342 | 372 | ||
343 | /** | 373 | /** |
344 | * Run in https mode. | 374 | * Run in HTTPS mode. |
375 | * @ingroup tls | ||
345 | */ | 376 | */ |
346 | MHD_USE_SSL = 2, | 377 | MHD_USE_SSL = 2, |
347 | 378 | ||
348 | /** | 379 | /** |
349 | * Run using one thread per connection. | 380 | * Run using one thread per connection. |
381 | * @ingroup event | ||
350 | */ | 382 | */ |
351 | MHD_USE_THREAD_PER_CONNECTION = 4, | 383 | MHD_USE_THREAD_PER_CONNECTION = 4, |
352 | 384 | ||
353 | /** | 385 | /** |
354 | * Run using an internal thread (or thread pool) doing SELECT. | 386 | * Run using an internal thread (or thread pool) doing select(). |
387 | * @ingroup event | ||
355 | */ | 388 | */ |
356 | MHD_USE_SELECT_INTERNALLY = 8, | 389 | MHD_USE_SELECT_INTERNALLY = 8, |
357 | 390 | ||
358 | /** | 391 | /** |
359 | * Run using the IPv6 protocol (otherwise, MHD will just support | 392 | * Run using the IPv6 protocol (otherwise, MHD will just support |
360 | * IPv4). If you want MHD to support IPv4 and IPv6 using a single | 393 | * IPv4). If you want MHD to support IPv4 and IPv6 using a single |
361 | * socket, pass MHD_USE_DUAL_STACK, otherwise, if you only pass | 394 | * socket, pass #MHD_USE_DUAL_STACK, otherwise, if you only pass |
362 | * this option, MHD will try to bind to IPv6-only (resulting in | 395 | * this option, MHD will try to bind to IPv6-only (resulting in |
363 | * no IPv4 support). | 396 | * no IPv4 support). |
397 | * @ingroup networking | ||
364 | */ | 398 | */ |
365 | MHD_USE_IPv6 = 16, | 399 | MHD_USE_IPv6 = 16, |
366 | 400 | ||
367 | /** | 401 | /** |
368 | * Be pedantic about the protocol (as opposed to as tolerant as | 402 | * Be pedantic about the protocol (as opposed to as tolerant as |
369 | * possible). Specifically, at the moment, this flag causes MHD to | 403 | * possible). Specifically, at the moment, this flag causes MHD to |
370 | * reject http 1.1 connections without a "Host" header. This is | 404 | * reject HTTP 1.1 connections without a "Host" header. This is |
371 | * required by the standard, but of course in violation of the "be | 405 | * required by the standard, but of course in violation of the "be |
372 | * as liberal as possible in what you accept" norm. It is | 406 | * as liberal as possible in what you accept" norm. It is |
373 | * recommended to turn this ON if you are testing clients against | 407 | * recommended to turn this ON if you are testing clients against |
374 | * MHD, and OFF in production. | 408 | * MHD, and OFF in production. |
409 | * @ingroup logging | ||
375 | */ | 410 | */ |
376 | MHD_USE_PEDANTIC_CHECKS = 32, | 411 | MHD_USE_PEDANTIC_CHECKS = 32, |
377 | 412 | ||
378 | /** | 413 | /** |
379 | * Use poll instead of select. This allows sockets with fd >= | 414 | * Use poll instead of select. This allows sockets with fd >= |
380 | * FD_SETSIZE. This option is not compatible with using an | 415 | * FD_SETSIZE. This option is not compatible with using an |
381 | * 'external' select mode (as there is no API to get the file | 416 | * 'external' select() mode (as there is no API to get the file |
382 | * descriptors for the external select from MHD) and must also not | 417 | * descriptors for the external select from MHD) and must also not |
383 | * be used in combination with MHD_USE_EPOLL_LINUX_ONLY. | 418 | * be used in combination with #MHD_USE_EPOLL_LINUX_ONLY. |
419 | * @ingroup event | ||
384 | */ | 420 | */ |
385 | MHD_USE_POLL = 64, | 421 | MHD_USE_POLL = 64, |
386 | 422 | ||
387 | /** | 423 | /** |
388 | * Run using an internal thread (or thread pool) doing POLL. | 424 | * Run using an internal thread (or thread pool) doing poll(). |
425 | * @ingroup event | ||
389 | */ | 426 | */ |
390 | MHD_USE_POLL_INTERNALLY = MHD_USE_SELECT_INTERNALLY | MHD_USE_POLL, | 427 | MHD_USE_POLL_INTERNALLY = MHD_USE_SELECT_INTERNALLY | MHD_USE_POLL, |
391 | 428 | ||
@@ -394,60 +431,67 @@ enum MHD_FLAG | |||
394 | * This option should ONLY be used on systems that do not have a clock | 431 | * This option should ONLY be used on systems that do not have a clock |
395 | * and that DO provide other mechanisms for cache control. See also | 432 | * and that DO provide other mechanisms for cache control. See also |
396 | * RFC 2616, section 14.18 (exception 3). | 433 | * RFC 2616, section 14.18 (exception 3). |
434 | * @ingroup specialized | ||
397 | */ | 435 | */ |
398 | MHD_SUPPRESS_DATE_NO_CLOCK = 128, | 436 | MHD_SUPPRESS_DATE_NO_CLOCK = 128, |
399 | 437 | ||
400 | /** | 438 | /** |
401 | * Run without a listen socket. This option only makes sense if | 439 | * Run without a listen socket. This option only makes sense if |
402 | * 'MHD_add_connection' is to be used exclusively to connect HTTP | 440 | * #MHD_add_connection is to be used exclusively to connect HTTP |
403 | * clients to the HTTP server. This option is incompatible with | 441 | * clients to the HTTP server. This option is incompatible with |
404 | * using a thread pool; if it is used, 'MHD_OPTION_THREAD_POOL_SIZE' | 442 | * using a thread pool; if it is used, #MHD_OPTION_THREAD_POOL_SIZE |
405 | * is ignored. | 443 | * is ignored. |
444 | * @ingroup specialized | ||
406 | */ | 445 | */ |
407 | MHD_USE_NO_LISTEN_SOCKET = 256, | 446 | MHD_USE_NO_LISTEN_SOCKET = 256, |
408 | 447 | ||
409 | /** | 448 | /** |
410 | * Use 'epoll' instead of 'select' or 'poll' for the event loop. | 449 | * Use epoll() instead of select() or poll() for the event loop. |
411 | * This option is only available on Linux; using the option on | 450 | * This option is only available on Linux; using the option on |
412 | * non-Linux systems will cause 'MHD_start_daemon' to fail. | 451 | * non-Linux systems will cause #MHD_start_daemon to fail. |
452 | * @ingroup event | ||
413 | */ | 453 | */ |
414 | MHD_USE_EPOLL_LINUX_ONLY = 512, | 454 | MHD_USE_EPOLL_LINUX_ONLY = 512, |
415 | 455 | ||
416 | /** | 456 | /** |
417 | * Run using an internal thread (or thread pool) doing EPOLL. | 457 | * Run using an internal thread (or thread pool) doing epoll(). |
418 | * This option is only available on Linux; using the option on | 458 | * This option is only available on Linux; using the option on |
419 | * non-Linux systems will cause 'MHD_start_daemon' to fail. | 459 | * non-Linux systems will cause #MHD_start_daemon to fail. |
460 | * @ingroup event | ||
420 | */ | 461 | */ |
421 | MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY = MHD_USE_SELECT_INTERNALLY | MHD_USE_EPOLL_LINUX_ONLY, | 462 | MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY = MHD_USE_SELECT_INTERNALLY | MHD_USE_EPOLL_LINUX_ONLY, |
422 | 463 | ||
423 | /** | 464 | /** |
424 | * Force MHD to use a signal pipe to notify the event loop (of | 465 | * Force MHD to use a signal pipe to notify the event loop (of |
425 | * threads) of our shutdown. This is required if an appliction uses | 466 | * threads) of our shutdown. This is required if an appliction uses |
426 | * 'MHD_USE_INTERNAL_SELECT' or 'MHD_USE_THREAD_PER_CONNECTION' and | 467 | * #MHD_USE_INTERNAL_SELECT or #MHD_USE_THREAD_PER_CONNECTION and |
427 | * then performs 'MHD_quiesce_daemon' (which eliminates our ability | 468 | * then performs #MHD_quiesce_daemon (which eliminates our ability |
428 | * to signal termination via the listen socket). In these modes, | 469 | * to signal termination via the listen socket). In these modes, |
429 | * 'MHD_quiesce_daemon' will fail if this option was not set. Also, | 470 | * #MHD_quiesce_daemon will fail if this option was not set. Also, |
430 | * use of this option is automatic (as in, you do not even have to | 471 | * use of this option is automatic (as in, you do not even have to |
431 | * specify it), if 'MHD_USE_NO_LISTEN_SOCKET' is specified. In | 472 | * specify it), if #MHD_USE_NO_LISTEN_SOCKET is specified. In |
432 | * "external" select mode, this option is always simply ignored. | 473 | * "external" select() mode, this option is always simply ignored. |
433 | * On W32 a pair of sockets is used instead of a pipe. | 474 | * On W32 a pair of sockets is used instead of a pipe. |
434 | * | 475 | * |
435 | * You must also use this option if you use internal select mode | 476 | * You must also use this option if you use internal select mode |
436 | * or a thread pool in conjunction with 'MHD_add_connection'. | 477 | * or a thread pool in conjunction with #MHD_add_connection. |
478 | * @ingroup event | ||
437 | */ | 479 | */ |
438 | MHD_USE_PIPE_FOR_SHUTDOWN = 1024, | 480 | MHD_USE_PIPE_FOR_SHUTDOWN = 1024, |
439 | 481 | ||
440 | /** | 482 | /** |
441 | * Use a single socket for IPv4 and IPv6. | 483 | * Use a single socket for IPv4 and IPv6. |
484 | * @ingroup networking | ||
442 | */ | 485 | */ |
443 | MHD_USE_DUAL_STACK = MHD_USE_IPv6 | 2048, | 486 | MHD_USE_DUAL_STACK = MHD_USE_IPv6 | 2048, |
444 | 487 | ||
445 | /** | 488 | /** |
446 | * Enable EPOLL turbo. Disables certain calls to 'shutdown' | 489 | * Enable epoll() turbo. Disables certain calls to shutdown() |
447 | * and enables aggressive non-blocking optimisitc reads. | 490 | * and enables aggressive non-blocking optimisitc reads. |
448 | * Most effects only happen with MHD_USE_EPOLL_LINUX_ONLY. | 491 | * Most effects only happen with #MHD_USE_EPOLL_LINUX_ONLY. |
449 | * Enalbed always on W32 as winsock doesn't properly behave | 492 | * Enalbed always on W32 as winsock does not properly behave |
450 | * with shutdown and this then fixes potential problems. | 493 | * with shutdown() and this then fixes potential problems. |
494 | * @ingroup event | ||
451 | */ | 495 | */ |
452 | MHD_USE_EPOLL_TURBO = 4096 | 496 | MHD_USE_EPOLL_TURBO = 4096 |
453 | 497 | ||
@@ -458,14 +502,15 @@ enum MHD_FLAG | |||
458 | * Type of a callback function used for logging by MHD. | 502 | * Type of a callback function used for logging by MHD. |
459 | * | 503 | * |
460 | * @param cls closure | 504 | * @param cls closure |
461 | * @param fm format string (printf-style) | 505 | * @param fm format string (printf()-style) |
462 | * @param ap arguments to 'fm' | 506 | * @param ap arguments to @a fm |
507 | * @ingroup logging | ||
463 | */ | 508 | */ |
464 | typedef void (*MHD_LogCallback)(void *cls, const char *fm, va_list ap); | 509 | typedef void (*MHD_LogCallback)(void *cls, const char *fm, va_list ap); |
465 | 510 | ||
466 | 511 | ||
467 | /** | 512 | /** |
468 | * MHD options. Passed in the varargs portion of MHD_start_daemon. | 513 | * MHD options. Passed in the varargs portion of #MHD_start_daemon. |
469 | */ | 514 | */ |
470 | enum MHD_OPTION | 515 | enum MHD_OPTION |
471 | { | 516 | { |
@@ -478,16 +523,18 @@ enum MHD_OPTION | |||
478 | 523 | ||
479 | /** | 524 | /** |
480 | * Maximum memory size per connection (followed by a size_t). | 525 | * Maximum memory size per connection (followed by a size_t). |
481 | * Default is 32 kb (MHD_POOL_SIZE_DEFAULT). | 526 | * Default is 32 kb (#MHD_POOL_SIZE_DEFAULT). |
482 | * Values above 128k are unlikely to result in much benefit, as half | 527 | * Values above 128k are unlikely to result in much benefit, as half |
483 | * of the memory will be typically used for IO, and TCP buffers are | 528 | * of the memory will be typically used for IO, and TCP buffers are |
484 | * unlikely to support window sizes above 64k on most systems. | 529 | * unlikely to support window sizes above 64k on most systems. |
530 | * @ingroup limits | ||
485 | */ | 531 | */ |
486 | MHD_OPTION_CONNECTION_MEMORY_LIMIT = 1, | 532 | MHD_OPTION_CONNECTION_MEMORY_LIMIT = 1, |
487 | 533 | ||
488 | /** | 534 | /** |
489 | * Maximum number of concurrent connections to | 535 | * Maximum number of concurrent connections to |
490 | * accept (followed by an unsigned int). | 536 | * accept (followed by an unsigned int). |
537 | * @ingroup limits | ||
491 | */ | 538 | */ |
492 | MHD_OPTION_CONNECTION_LIMIT = 2, | 539 | MHD_OPTION_CONNECTION_LIMIT = 2, |
493 | 540 | ||
@@ -495,6 +542,7 @@ enum MHD_OPTION | |||
495 | * After how many seconds of inactivity should a | 542 | * After how many seconds of inactivity should a |
496 | * connection automatically be timed out? (followed | 543 | * connection automatically be timed out? (followed |
497 | * by an unsigned int; use zero for no timeout). | 544 | * by an unsigned int; use zero for no timeout). |
545 | * @ingroup limits | ||
498 | */ | 546 | */ |
499 | MHD_OPTION_CONNECTION_TIMEOUT = 3, | 547 | MHD_OPTION_CONNECTION_TIMEOUT = 3, |
500 | 548 | ||
@@ -503,12 +551,13 @@ enum MHD_OPTION | |||
503 | * been completed (this can be used for application-specific clean | 551 | * been completed (this can be used for application-specific clean |
504 | * up). Requests that have never been presented to the application | 552 | * up). Requests that have never been presented to the application |
505 | * (via MHD_AccessHandlerCallback) will not result in | 553 | * (via MHD_AccessHandlerCallback) will not result in |
506 | * notifications.<p> | 554 | * notifications. |
507 | * | 555 | * |
508 | * This option should be followed by TWO pointers. First a pointer | 556 | * This option should be followed by TWO pointers. First a pointer |
509 | * to a function of type "MHD_RequestCompletedCallback" and second a | 557 | * to a function of type "MHD_RequestCompletedCallback" and second a |
510 | * pointer to a closure to pass to the request completed callback. | 558 | * pointer to a closure to pass to the request completed callback. |
511 | * The second pointer maybe NULL. | 559 | * The second pointer maybe NULL. |
560 | * @ingroup request | ||
512 | */ | 561 | */ |
513 | MHD_OPTION_NOTIFY_COMPLETED = 4, | 562 | MHD_OPTION_NOTIFY_COMPLETED = 4, |
514 | 563 | ||
@@ -521,13 +570,15 @@ enum MHD_OPTION | |||
521 | * should be followed by an "unsigned int". The default is | 570 | * should be followed by an "unsigned int". The default is |
522 | * zero, which means no limit on the number of connections | 571 | * zero, which means no limit on the number of connections |
523 | * from the same IP address. | 572 | * from the same IP address. |
573 | * @ingroup limits | ||
524 | */ | 574 | */ |
525 | MHD_OPTION_PER_IP_CONNECTION_LIMIT = 5, | 575 | MHD_OPTION_PER_IP_CONNECTION_LIMIT = 5, |
526 | 576 | ||
527 | /** | 577 | /** |
528 | * Bind daemon to the supplied sockaddr. this option should be followed by a | 578 | * Bind daemon to the supplied sockaddr. this option should be followed by a |
529 | * 'struct sockaddr *'. If 'MHD_USE_IPv6' is specified, the 'struct sockaddr*' | 579 | * 'struct sockaddr *'. If #MHD_USE_IPv6 is specified, the 'struct sockaddr*' |
530 | * should point to a 'struct sockaddr_in6', otherwise to a 'struct sockaddr_in'. | 580 | * should point to a 'struct sockaddr_in6', otherwise to a 'struct sockaddr_in'. |
581 | * @ingroup networking | ||
531 | */ | 582 | */ |
532 | MHD_OPTION_SOCK_ADDR = 6, | 583 | MHD_OPTION_SOCK_ADDR = 6, |
533 | 584 | ||
@@ -539,7 +590,7 @@ enum MHD_OPTION | |||
539 | * logging. This option should be followed by two arguments, the first | 590 | * logging. This option should be followed by two arguments, the first |
540 | * one must be of the form | 591 | * one must be of the form |
541 | * <pre> | 592 | * <pre> |
542 | * void * my_logger(void * cls, const char * uri) | 593 | * void * my_logger(void *cls, const char *uri) |
543 | * </pre> | 594 | * </pre> |
544 | * where the return value will be passed as | 595 | * where the return value will be passed as |
545 | * (*con_cls) in calls to the MHD_AccessHandlerCallback | 596 | * (*con_cls) in calls to the MHD_AccessHandlerCallback |
@@ -547,26 +598,29 @@ enum MHD_OPTION | |||
547 | * value of NULL has no special significance (however, | 598 | * value of NULL has no special significance (however, |
548 | * note that if you return non-NULL, you can no longer | 599 | * note that if you return non-NULL, you can no longer |
549 | * rely on the first call to the access handler having | 600 | * rely on the first call to the access handler having |
550 | * NULL == *con_cls on entry;) | 601 | * `NULL == *con_cls` on entry;) |
551 | * "cls" will be set to the second argument following | 602 | * "cls" will be set to the second argument following |
552 | * MHD_OPTION_URI_LOG_CALLBACK. Finally, uri will | 603 | * #MHD_OPTION_URI_LOG_CALLBACK. Finally, uri will |
553 | * be the 0-terminated URI of the request. | 604 | * be the 0-terminated URI of the request. |
605 | * @ingroup logging | ||
554 | */ | 606 | */ |
555 | MHD_OPTION_URI_LOG_CALLBACK = 7, | 607 | MHD_OPTION_URI_LOG_CALLBACK = 7, |
556 | 608 | ||
557 | /** | 609 | /** |
558 | * Memory pointer for the private key (key.pem) to be used by the | 610 | * Memory pointer for the private key (key.pem) to be used by the |
559 | * HTTPS daemon. This option should be followed by an | 611 | * HTTPS daemon. This option should be followed by an |
560 | * "const char*" argument. | 612 | * "const char *" argument. |
561 | * This should be used in conjunction with 'MHD_OPTION_HTTPS_MEM_CERT'. | 613 | * This should be used in conjunction with #MHD_OPTION_HTTPS_MEM_CERT. |
614 | * @ingroup tls | ||
562 | */ | 615 | */ |
563 | MHD_OPTION_HTTPS_MEM_KEY = 8, | 616 | MHD_OPTION_HTTPS_MEM_KEY = 8, |
564 | 617 | ||
565 | /** | 618 | /** |
566 | * Memory pointer for the certificate (cert.pem) to be used by the | 619 | * Memory pointer for the certificate (cert.pem) to be used by the |
567 | * HTTPS daemon. This option should be followed by an | 620 | * HTTPS daemon. This option should be followed by an |
568 | * "const char*" argument. | 621 | * "const char *" argument. |
569 | * This should be used in conjunction with 'MHD_OPTION_HTTPS_MEM_KEY'. | 622 | * This should be used in conjunction with #MHD_OPTION_HTTPS_MEM_KEY. |
623 | * @ingroup tls | ||
570 | */ | 624 | */ |
571 | MHD_OPTION_HTTPS_MEM_CERT = 9, | 625 | MHD_OPTION_HTTPS_MEM_CERT = 9, |
572 | 626 | ||
@@ -574,12 +628,14 @@ enum MHD_OPTION | |||
574 | * Daemon credentials type. | 628 | * Daemon credentials type. |
575 | * Followed by an argument of type | 629 | * Followed by an argument of type |
576 | * "gnutls_credentials_type_t". | 630 | * "gnutls_credentials_type_t". |
631 | * @ingroup tls | ||
577 | */ | 632 | */ |
578 | MHD_OPTION_HTTPS_CRED_TYPE = 10, | 633 | MHD_OPTION_HTTPS_CRED_TYPE = 10, |
579 | 634 | ||
580 | /** | 635 | /** |
581 | * Memory pointer to a "const char*" specifying the | 636 | * Memory pointer to a "const char *" specifying the |
582 | * cipher algorithm (default: "NORMAL"). | 637 | * cipher algorithm (default: "NORMAL"). |
638 | * @ingroup tls | ||
583 | */ | 639 | */ |
584 | MHD_OPTION_HTTPS_PRIORITIES = 11, | 640 | MHD_OPTION_HTTPS_PRIORITIES = 11, |
585 | 641 | ||
@@ -588,6 +644,7 @@ enum MHD_OPTION | |||
588 | * option is used, MHD will not open its own listen socket(s). The | 644 | * option is used, MHD will not open its own listen socket(s). The |
589 | * argument passed must be of type "int" and refer to an | 645 | * argument passed must be of type "int" and refer to an |
590 | * existing socket that has been bound to a port and is listening. | 646 | * existing socket that has been bound to a port and is listening. |
647 | * @ingroup specialized | ||
591 | */ | 648 | */ |
592 | MHD_OPTION_LISTEN_SOCKET = 12, | 649 | MHD_OPTION_LISTEN_SOCKET = 12, |
593 | 650 | ||
@@ -595,14 +652,15 @@ enum MHD_OPTION | |||
595 | * Use the given function for logging error messages. | 652 | * Use the given function for logging error messages. |
596 | * This option must be followed by two arguments; the | 653 | * This option must be followed by two arguments; the |
597 | * first must be a pointer to a function | 654 | * first must be a pointer to a function |
598 | * of type "void fun(void * arg, const char * fmt, va_list ap)" | 655 | * of type `void fun (void *arg, const char *fmt, va_list ap)` |
599 | * (also known as MHD_LogCallback) | 656 | * (also known as MHD_LogCallback) |
600 | * and the second a pointer "void*" which will | 657 | * and the second a pointer "void *" which will |
601 | * be passed as the "arg" argument to "fun". | 658 | * be passed as the "arg" argument to "fun". |
602 | * <p> | 659 | * <p> |
603 | * Note that MHD will not generate any log messages | 660 | * Note that MHD will not generate any log messages |
604 | * if it was compiled without the "--enable-messages" | 661 | * if it was compiled without the "--enable-messages" |
605 | * flag being set. | 662 | * flag being set. |
663 | * @ingroup logging | ||
606 | */ | 664 | */ |
607 | MHD_OPTION_EXTERNAL_LOGGER = 13, | 665 | MHD_OPTION_EXTERNAL_LOGGER = 13, |
608 | 666 | ||
@@ -610,16 +668,17 @@ enum MHD_OPTION | |||
610 | * Number (unsigned int) of threads in thread pool. Enable | 668 | * Number (unsigned int) of threads in thread pool. Enable |
611 | * thread pooling by setting this value to to something | 669 | * thread pooling by setting this value to to something |
612 | * greater than 1. Currently, thread model must be | 670 | * greater than 1. Currently, thread model must be |
613 | * MHD_USE_SELECT_INTERNALLY if thread pooling is enabled | 671 | * #MHD_USE_SELECT_INTERNALLY if thread pooling is enabled |
614 | * (MHD_start_daemon returns NULL for an unsupported thread | 672 | * (#MHD_start_daemon returns NULL for an unsupported thread |
615 | * model). | 673 | * model). |
674 | * @ingroup event | ||
616 | */ | 675 | */ |
617 | MHD_OPTION_THREAD_POOL_SIZE = 14, | 676 | MHD_OPTION_THREAD_POOL_SIZE = 14, |
618 | 677 | ||
619 | /** | 678 | /** |
620 | * Additional options given in an array of "struct MHD_OptionItem". | 679 | * Additional options given in an array of "struct MHD_OptionItem". |
621 | * The array must be terminated with an entry '{MHD_OPTION_END, 0, NULL}'. | 680 | * The array must be terminated with an entry '{MHD_OPTION_END, 0, NULL}'. |
622 | * An example for code using MHD_OPTION_ARRAY is: | 681 | * An example for code using #MHD_OPTION_ARRAY is: |
623 | * <code> | 682 | * <code> |
624 | * struct MHD_OptionItem ops[] = { | 683 | * struct MHD_OptionItem ops[] = { |
625 | * { MHD_OPTION_CONNECTION_LIMIT, 100, NULL }, | 684 | * { MHD_OPTION_CONNECTION_LIMIT, 100, NULL }, |
@@ -634,6 +693,7 @@ enum MHD_OPTION | |||
634 | * second member of the struct MHD_OptionItem is ignored. | 693 | * second member of the struct MHD_OptionItem is ignored. |
635 | * For options that expect two pointer arguments, the first | 694 | * For options that expect two pointer arguments, the first |
636 | * argument must be cast to 'intptr_t'. | 695 | * argument must be cast to 'intptr_t'. |
696 | * @ingroup specialized | ||
637 | */ | 697 | */ |
638 | MHD_OPTION_ARRAY = 15, | 698 | MHD_OPTION_ARRAY = 15, |
639 | 699 | ||
@@ -646,14 +706,15 @@ enum MHD_OPTION | |||
646 | * This option should be followed by two arguments, the first | 706 | * This option should be followed by two arguments, the first |
647 | * one must be of the form | 707 | * one must be of the form |
648 | * <pre> | 708 | * <pre> |
649 | * size_t my_unescaper(void * cls, struct MHD_Connection *c, char *s) | 709 | * size_t my_unescaper(void *cls, struct MHD_Connection *c, char *s) |
650 | * </pre> | 710 | * </pre> |
651 | * where the return value must be "strlen(s)" and | 711 | * where the return value must be "strlen(s)" and |
652 | * "s" should be updated. Note that the unescape function | 712 | * "s" should be updated. Note that the unescape function |
653 | * must not lengthen "s" (the result must be shorter than | 713 | * must not lengthen "s" (the result must be shorter than |
654 | * the input and still be 0-terminated). | 714 | * the input and still be 0-terminated). |
655 | * "cls" will be set to the second argument following | 715 | * "cls" will be set to the second argument following |
656 | * MHD_OPTION_UNESCAPE_CALLBACK. | 716 | * #MHD_OPTION_UNESCAPE_CALLBACK. |
717 | * @ingroup specialized | ||
657 | */ | 718 | */ |
658 | MHD_OPTION_UNESCAPE_CALLBACK = 16, | 719 | MHD_OPTION_UNESCAPE_CALLBACK = 16, |
659 | 720 | ||
@@ -665,6 +726,7 @@ enum MHD_OPTION | |||
665 | * Note that the application must ensure that the buffer of the | 726 | * Note that the application must ensure that the buffer of the |
666 | * second argument remains allocated and unmodified while the | 727 | * second argument remains allocated and unmodified while the |
667 | * deamon is running. | 728 | * deamon is running. |
729 | * @ingroup auth | ||
668 | */ | 730 | */ |
669 | MHD_OPTION_DIGEST_AUTH_RANDOM = 17, | 731 | MHD_OPTION_DIGEST_AUTH_RANDOM = 17, |
670 | 732 | ||
@@ -672,12 +734,14 @@ enum MHD_OPTION | |||
672 | * Size of the internal array holding the map of the nonce and | 734 | * Size of the internal array holding the map of the nonce and |
673 | * the nonce counter. This option should be followed by a "unsigend int" | 735 | * the nonce counter. This option should be followed by a "unsigend int" |
674 | * argument. | 736 | * argument. |
737 | * @ingroup auth | ||
675 | */ | 738 | */ |
676 | MHD_OPTION_NONCE_NC_SIZE = 18, | 739 | MHD_OPTION_NONCE_NC_SIZE = 18, |
677 | 740 | ||
678 | /** | 741 | /** |
679 | * Desired size of the stack for threads created by MHD. Followed | 742 | * Desired size of the stack for threads created by MHD. Followed |
680 | * by an argument of type 'size_t'. Use 0 for system 'default'. | 743 | * by an argument of type 'size_t'. Use 0 for system 'default'. |
744 | * @ingroup event | ||
681 | */ | 745 | */ |
682 | MHD_OPTION_THREAD_STACK_SIZE = 19, | 746 | MHD_OPTION_THREAD_STACK_SIZE = 19, |
683 | 747 | ||
@@ -685,24 +749,27 @@ enum MHD_OPTION | |||
685 | * Memory pointer for the certificate (ca.pem) to be used by the | 749 | * Memory pointer for the certificate (ca.pem) to be used by the |
686 | * HTTPS daemon for client authentification. | 750 | * HTTPS daemon for client authentification. |
687 | * This option should be followed by a "const char*" argument. | 751 | * This option should be followed by a "const char*" argument. |
752 | * @ingroup tls | ||
688 | */ | 753 | */ |
689 | MHD_OPTION_HTTPS_MEM_TRUST = 20, | 754 | MHD_OPTION_HTTPS_MEM_TRUST = 20, |
690 | 755 | ||
691 | /** | 756 | /** |
692 | * Increment to use for growing the read buffer (followed by a | 757 | * Increment to use for growing the read buffer (followed by a |
693 | * size_t). Must fit within MHD_OPTION_CONNECTION_MEMORY_LIMIT. | 758 | * size_t). Must fit within #MHD_OPTION_CONNECTION_MEMORY_LIMIT. |
759 | * @ingroup limits | ||
694 | */ | 760 | */ |
695 | MHD_OPTION_CONNECTION_MEMORY_INCREMENT = 21 | 761 | MHD_OPTION_CONNECTION_MEMORY_INCREMENT = 21 |
696 | }; | 762 | }; |
697 | 763 | ||
698 | 764 | ||
699 | /** | 765 | /** |
700 | * Entry in an MHD_OPTION_ARRAY. | 766 | * Entry in an #MHD_OPTION_ARRAY. |
767 | * @ingroup specialized | ||
701 | */ | 768 | */ |
702 | struct MHD_OptionItem | 769 | struct MHD_OptionItem |
703 | { | 770 | { |
704 | /** | 771 | /** |
705 | * Which option is being given. Use MHD_OPTION_END | 772 | * Which option is being given. Use #MHD_OPTION_END |
706 | * to terminate the array. | 773 | * to terminate the array. |
707 | */ | 774 | */ |
708 | enum MHD_OPTION option; | 775 | enum MHD_OPTION option; |
@@ -726,23 +793,27 @@ struct MHD_OptionItem | |||
726 | /** | 793 | /** |
727 | * The MHD_ValueKind specifies the source of | 794 | * The MHD_ValueKind specifies the source of |
728 | * the key-value pairs in the HTTP protocol. | 795 | * the key-value pairs in the HTTP protocol. |
796 | * @ingroup request | ||
729 | */ | 797 | */ |
730 | enum MHD_ValueKind | 798 | enum MHD_ValueKind |
731 | { | 799 | { |
732 | 800 | ||
733 | /** | 801 | /** |
734 | * Response header | 802 | * Response header |
803 | * @ingroup response | ||
735 | */ | 804 | */ |
736 | MHD_RESPONSE_HEADER_KIND = 0, | 805 | MHD_RESPONSE_HEADER_KIND = 0, |
737 | 806 | ||
738 | /** | 807 | /** |
739 | * HTTP header. | 808 | * HTTP header. |
809 | * @ingroup request | ||
740 | */ | 810 | */ |
741 | MHD_HEADER_KIND = 1, | 811 | MHD_HEADER_KIND = 1, |
742 | 812 | ||
743 | /** | 813 | /** |
744 | * Cookies. Note that the original HTTP header containing | 814 | * Cookies. Note that the original HTTP header containing |
745 | * the cookie(s) will still be available and intact. | 815 | * the cookie(s) will still be available and intact. |
816 | * @ingroup request | ||
746 | */ | 817 | */ |
747 | MHD_COOKIE_KIND = 2, | 818 | MHD_COOKIE_KIND = 2, |
748 | 819 | ||
@@ -753,16 +824,19 @@ enum MHD_ValueKind | |||
753 | * memory pool. Note that in that case, the upload data | 824 | * memory pool. Note that in that case, the upload data |
754 | * given to the MHD_AccessHandlerCallback will be | 825 | * given to the MHD_AccessHandlerCallback will be |
755 | * empty (since it has already been processed). | 826 | * empty (since it has already been processed). |
827 | * @ingroup request | ||
756 | */ | 828 | */ |
757 | MHD_POSTDATA_KIND = 4, | 829 | MHD_POSTDATA_KIND = 4, |
758 | 830 | ||
759 | /** | 831 | /** |
760 | * GET (URI) arguments. | 832 | * GET (URI) arguments. |
833 | * @ingroup request | ||
761 | */ | 834 | */ |
762 | MHD_GET_ARGUMENT_KIND = 8, | 835 | MHD_GET_ARGUMENT_KIND = 8, |
763 | 836 | ||
764 | /** | 837 | /** |
765 | * HTTP footer (only for http 1.1 chunked encodings). | 838 | * HTTP footer (only for http 1.1 chunked encodings). |
839 | * @ingroup request | ||
766 | */ | 840 | */ |
767 | MHD_FOOTER_KIND = 16 | 841 | MHD_FOOTER_KIND = 16 |
768 | }; | 842 | }; |
@@ -771,12 +845,14 @@ enum MHD_ValueKind | |||
771 | /** | 845 | /** |
772 | * The MHD_RequestTerminationCode specifies reasons | 846 | * The MHD_RequestTerminationCode specifies reasons |
773 | * why a request has been terminated (or completed). | 847 | * why a request has been terminated (or completed). |
848 | * @ingroup request | ||
774 | */ | 849 | */ |
775 | enum MHD_RequestTerminationCode | 850 | enum MHD_RequestTerminationCode |
776 | { | 851 | { |
777 | 852 | ||
778 | /** | 853 | /** |
779 | * We finished sending the response. | 854 | * We finished sending the response. |
855 | * @ingroup request | ||
780 | */ | 856 | */ |
781 | MHD_REQUEST_TERMINATED_COMPLETED_OK = 0, | 857 | MHD_REQUEST_TERMINATED_COMPLETED_OK = 0, |
782 | 858 | ||
@@ -784,28 +860,32 @@ enum MHD_RequestTerminationCode | |||
784 | * Error handling the connection (resources | 860 | * Error handling the connection (resources |
785 | * exhausted, other side closed connection, | 861 | * exhausted, other side closed connection, |
786 | * application error accepting request, etc.) | 862 | * application error accepting request, etc.) |
863 | * @ingroup request | ||
787 | */ | 864 | */ |
788 | MHD_REQUEST_TERMINATED_WITH_ERROR = 1, | 865 | MHD_REQUEST_TERMINATED_WITH_ERROR = 1, |
789 | 866 | ||
790 | /** | 867 | /** |
791 | * No activity on the connection for the number | 868 | * No activity on the connection for the number |
792 | * of seconds specified using | 869 | * of seconds specified using |
793 | * MHD_OPTION_CONNECTION_TIMEOUT. | 870 | * #MHD_OPTION_CONNECTION_TIMEOUT. |
871 | * @ingroup request | ||
794 | */ | 872 | */ |
795 | MHD_REQUEST_TERMINATED_TIMEOUT_REACHED = 2, | 873 | MHD_REQUEST_TERMINATED_TIMEOUT_REACHED = 2, |
796 | 874 | ||
797 | /** | 875 | /** |
798 | * We had to close the session since MHD was being | 876 | * We had to close the session since MHD was being |
799 | * shut down. | 877 | * shut down. |
878 | * @ingroup request | ||
800 | */ | 879 | */ |
801 | MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN = 3, | 880 | MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN = 3, |
802 | 881 | ||
803 | /** | 882 | /** |
804 | * We tried to read additional data, but the other side closed the | 883 | * We tried to read additional data, but the other side closed the |
805 | * connection. This error is similar to | 884 | * connection. This error is similar to |
806 | * MHD_REQUEST_TERMINATED_WITH_ERROR, but specific to the case where | 885 | * #MHD_REQUEST_TERMINATED_WITH_ERROR, but specific to the case where |
807 | * the connection died because the other side did not send expected | 886 | * the connection died because the other side did not send expected |
808 | * data. | 887 | * data. |
888 | * @ingroup request | ||
809 | */ | 889 | */ |
810 | MHD_REQUEST_TERMINATED_READ_ERROR = 4 | 890 | MHD_REQUEST_TERMINATED_READ_ERROR = 4 |
811 | 891 | ||
@@ -815,18 +895,21 @@ enum MHD_RequestTerminationCode | |||
815 | /** | 895 | /** |
816 | * Values of this enum are used to specify what | 896 | * Values of this enum are used to specify what |
817 | * information about a connection is desired. | 897 | * information about a connection is desired. |
898 | * @ingroup request | ||
818 | */ | 899 | */ |
819 | enum MHD_ConnectionInfoType | 900 | enum MHD_ConnectionInfoType |
820 | { | 901 | { |
821 | /** | 902 | /** |
822 | * What cipher algorithm is being used. | 903 | * What cipher algorithm is being used. |
823 | * Takes no extra arguments. | 904 | * Takes no extra arguments. |
905 | * @ingroup request | ||
824 | */ | 906 | */ |
825 | MHD_CONNECTION_INFO_CIPHER_ALGO, | 907 | MHD_CONNECTION_INFO_CIPHER_ALGO, |
826 | 908 | ||
827 | /** | 909 | /** |
828 | * | 910 | * |
829 | * Takes no extra arguments. | 911 | * Takes no extra arguments. |
912 | * @ingroup request | ||
830 | */ | 913 | */ |
831 | MHD_CONNECTION_INFO_PROTOCOL, | 914 | MHD_CONNECTION_INFO_PROTOCOL, |
832 | 915 | ||
@@ -835,16 +918,18 @@ enum MHD_ConnectionInfoType | |||
835 | * Returns essentially a "struct sockaddr **" (since the API returns | 918 | * Returns essentially a "struct sockaddr **" (since the API returns |
836 | * a "union MHD_ConnectionInfo *" and that union contains a "struct | 919 | * a "union MHD_ConnectionInfo *" and that union contains a "struct |
837 | * sockaddr *"). | 920 | * sockaddr *"). |
921 | * @ingroup request | ||
838 | */ | 922 | */ |
839 | MHD_CONNECTION_INFO_CLIENT_ADDRESS, | 923 | MHD_CONNECTION_INFO_CLIENT_ADDRESS, |
840 | 924 | ||
841 | /** | 925 | /** |
842 | * Get the GNUTLS session handle. | 926 | * Get the gnuTLS session handle. |
927 | * @ingroup request | ||
843 | */ | 928 | */ |
844 | MHD_CONNECTION_INFO_GNUTLS_SESSION, | 929 | MHD_CONNECTION_INFO_GNUTLS_SESSION, |
845 | 930 | ||
846 | /** | 931 | /** |
847 | * Get the GNUTLS client certificate handle. Dysfunctional (never | 932 | * Get the gnuTLS client certificate handle. Dysfunctional (never |
848 | * implemented, deprecated). Use MHD_CONNECTION_INFO_GNUTLS_SESSION | 933 | * implemented, deprecated). Use MHD_CONNECTION_INFO_GNUTLS_SESSION |
849 | * to get the gnutls_session_t and then call | 934 | * to get the gnutls_session_t and then call |
850 | * gnutls_certificate_get_peers(). | 935 | * gnutls_certificate_get_peers(). |
@@ -853,13 +938,14 @@ enum MHD_ConnectionInfoType | |||
853 | 938 | ||
854 | /** | 939 | /** |
855 | * Get the 'struct MHD_Daemon' responsible for managing this connection. | 940 | * Get the 'struct MHD_Daemon' responsible for managing this connection. |
941 | * @ingroup request | ||
856 | */ | 942 | */ |
857 | MHD_CONNECTION_INFO_DAEMON, | 943 | MHD_CONNECTION_INFO_DAEMON, |
858 | 944 | ||
859 | |||
860 | /** | 945 | /** |
861 | * Request the file descriptor for the listening socket. | 946 | * Request the file descriptor for the listening socket. |
862 | * No extra arguments should be passed. | 947 | * No extra arguments should be passed. |
948 | * @ingroup request | ||
863 | */ | 949 | */ |
864 | MHD_CONNECTION_INFO_CONNECTION_FD | 950 | MHD_CONNECTION_INFO_CONNECTION_FD |
865 | 951 | ||
@@ -893,12 +979,14 @@ enum MHD_DaemonInfoType | |||
893 | /** | 979 | /** |
894 | * Request the file descriptor for the listening socket. | 980 | * Request the file descriptor for the listening socket. |
895 | * No extra arguments should be passed. | 981 | * No extra arguments should be passed. |
982 | * @ingroup networking | ||
896 | */ | 983 | */ |
897 | MHD_DAEMON_INFO_LISTEN_FD, | 984 | MHD_DAEMON_INFO_LISTEN_FD, |
898 | 985 | ||
899 | /** | 986 | /** |
900 | * Request the file descriptor for the external epoll. | 987 | * Request the file descriptor for the external epoll. |
901 | * No extra arguments should be passed. | 988 | * No extra arguments should be passed. |
989 | * @ingroup event | ||
902 | */ | 990 | */ |
903 | MHD_DAEMON_INFO_EPOLL_FD_LINUX_ONLY | 991 | MHD_DAEMON_INFO_EPOLL_FD_LINUX_ONLY |
904 | }; | 992 | }; |
@@ -906,6 +994,7 @@ enum MHD_DaemonInfoType | |||
906 | 994 | ||
907 | /** | 995 | /** |
908 | * Handle for the daemon (listening on a socket for HTTP traffic). | 996 | * Handle for the daemon (listening on a socket for HTTP traffic). |
997 | * @ingroup event | ||
909 | */ | 998 | */ |
910 | struct MHD_Daemon; | 999 | struct MHD_Daemon; |
911 | 1000 | ||
@@ -914,16 +1003,19 @@ struct MHD_Daemon; | |||
914 | * requests can be run over the same connection. However, MHD will | 1003 | * requests can be run over the same connection. However, MHD will |
915 | * only show one request per TCP connection to the client at any given | 1004 | * only show one request per TCP connection to the client at any given |
916 | * time. | 1005 | * time. |
1006 | * @ingroup request | ||
917 | */ | 1007 | */ |
918 | struct MHD_Connection; | 1008 | struct MHD_Connection; |
919 | 1009 | ||
920 | /** | 1010 | /** |
921 | * Handle for a response. | 1011 | * Handle for a response. |
1012 | * @ingroup response | ||
922 | */ | 1013 | */ |
923 | struct MHD_Response; | 1014 | struct MHD_Response; |
924 | 1015 | ||
925 | /** | 1016 | /** |
926 | * Handle for POST processing. | 1017 | * Handle for POST processing. |
1018 | * @ingroup response | ||
927 | */ | 1019 | */ |
928 | struct MHD_PostProcessor; | 1020 | struct MHD_PostProcessor; |
929 | 1021 | ||
@@ -936,6 +1028,7 @@ struct MHD_PostProcessor; | |||
936 | * @param file where the error occured | 1028 | * @param file where the error occured |
937 | * @param line where the error occured | 1029 | * @param line where the error occured |
938 | * @param reason error detail, may be NULL | 1030 | * @param reason error detail, may be NULL |
1031 | * @ingroup logging | ||
939 | */ | 1032 | */ |
940 | typedef | 1033 | typedef |
941 | void (*MHD_PanicCallback) (void *cls, | 1034 | void (*MHD_PanicCallback) (void *cls, |
@@ -947,8 +1040,8 @@ typedef | |||
947 | * Allow or deny a client to connect. | 1040 | * Allow or deny a client to connect. |
948 | * | 1041 | * |
949 | * @param addr address information from the client | 1042 | * @param addr address information from the client |
950 | * @param addrlen length of the address information | 1043 | * @param addrlen length of @a addr |
951 | * @return MHD_YES if connection is allowed, MHD_NO if not | 1044 | * @return #MHD_YES if connection is allowed, #MHD_NO if not |
952 | */ | 1045 | */ |
953 | typedef int | 1046 | typedef int |
954 | (*MHD_AcceptPolicyCallback) (void *cls, | 1047 | (*MHD_AcceptPolicyCallback) (void *cls, |
@@ -973,9 +1066,9 @@ typedef int | |||
973 | * given in upload_data and is instead available as | 1066 | * given in upload_data and is instead available as |
974 | * part of MHD_get_connection_values; very large POST | 1067 | * part of MHD_get_connection_values; very large POST |
975 | * data *will* be made available incrementally in | 1068 | * data *will* be made available incrementally in |
976 | * upload_data) | 1069 | * @a upload_data) |
977 | * @param upload_data_size set initially to the size of the | 1070 | * @param upload_data_size set initially to the size of the |
978 | * upload_data provided; the method must update this | 1071 | * @a upload_data provided; the method must update this |
979 | * value to the number of bytes NOT processed; | 1072 | * value to the number of bytes NOT processed; |
980 | * @param con_cls pointer that the callback can set to some | 1073 | * @param con_cls pointer that the callback can set to some |
981 | * address and that will be preserved by MHD for future | 1074 | * address and that will be preserved by MHD for future |
@@ -985,15 +1078,15 @@ typedef int | |||
985 | * to easily associate some request-specific state. | 1078 | * to easily associate some request-specific state. |
986 | * If necessary, this state can be cleaned up in the | 1079 | * If necessary, this state can be cleaned up in the |
987 | * global "MHD_RequestCompleted" callback (which | 1080 | * global "MHD_RequestCompleted" callback (which |
988 | * can be set with the MHD_OPTION_NOTIFY_COMPLETED). | 1081 | * can be set with the #MHD_OPTION_NOTIFY_COMPLETED). |
989 | * Initially, <tt>*con_cls</tt> will be NULL. | 1082 | * Initially, <tt>*con_cls</tt> will be NULL. |
990 | * @return MHS_YES if the connection was handled successfully, | 1083 | * @return #MHS_YES if the connection was handled successfully, |
991 | * MHS_NO if the socket must be closed due to a serios | 1084 | * #MHS_NO if the socket must be closed due to a serios |
992 | * error while handling the request | 1085 | * error while handling the request |
993 | */ | 1086 | */ |
994 | typedef int | 1087 | typedef int |
995 | (*MHD_AccessHandlerCallback) (void *cls, | 1088 | (*MHD_AccessHandlerCallback) (void *cls, |
996 | struct MHD_Connection * connection, | 1089 | struct MHD_Connection *connection, |
997 | const char *url, | 1090 | const char *url, |
998 | const char *method, | 1091 | const char *method, |
999 | const char *version, | 1092 | const char *version, |
@@ -1011,7 +1104,8 @@ typedef int | |||
1011 | * @param con_cls value as set by the last call to | 1104 | * @param con_cls value as set by the last call to |
1012 | * the MHD_AccessHandlerCallback | 1105 | * the MHD_AccessHandlerCallback |
1013 | * @param toe reason for request termination | 1106 | * @param toe reason for request termination |
1014 | * @see MHD_OPTION_NOTIFY_COMPLETED | 1107 | * @see #MHD_OPTION_NOTIFY_COMPLETED |
1108 | * @ingroup request | ||
1015 | */ | 1109 | */ |
1016 | typedef void | 1110 | typedef void |
1017 | (*MHD_RequestCompletedCallback) (void *cls, | 1111 | (*MHD_RequestCompletedCallback) (void *cls, |
@@ -1027,8 +1121,9 @@ typedef void | |||
1027 | * also to iterate over the headers that have been | 1121 | * also to iterate over the headers that have been |
1028 | * added to a response. | 1122 | * added to a response. |
1029 | * | 1123 | * |
1030 | * @return MHD_YES to continue iterating, | 1124 | * @return #MHD_YES to continue iterating, |
1031 | * MHD_NO to abort the iteration | 1125 | * #MHD_NO to abort the iteration |
1126 | * @ingroup request | ||
1032 | */ | 1127 | */ |
1033 | typedef int | 1128 | typedef int |
1034 | (*MHD_KeyValueIterator) (void *cls, | 1129 | (*MHD_KeyValueIterator) (void *cls, |
@@ -1038,14 +1133,14 @@ typedef int | |||
1038 | 1133 | ||
1039 | /** | 1134 | /** |
1040 | * Callback used by libmicrohttpd in order to obtain content. The | 1135 | * Callback used by libmicrohttpd in order to obtain content. The |
1041 | * callback is to copy at most "max" bytes of content into "buf". The | 1136 | * callback is to copy at most @a max bytes of content into @a buf. The |
1042 | * total number of bytes that has been placed into "buf" should be | 1137 | * total number of bytes that has been placed into @a buf should be |
1043 | * returned.<p> | 1138 | * returned.<p> |
1044 | * | 1139 | * |
1045 | * Note that returning zero will cause libmicrohttpd to try again, | 1140 | * Note that returning zero will cause libmicrohttpd to try again, |
1046 | * either "immediately" if in multi-threaded mode (in which case the | 1141 | * either "immediately" if in multi-threaded mode (in which case the |
1047 | * callback may want to do blocking operations) or in the next round | 1142 | * callback may want to do blocking operations) or in the next round |
1048 | * if MHD_run is used. Returning 0 for a daemon that runs in internal | 1143 | * if #MHD_run is used. Returning 0 for a daemon that runs in internal |
1049 | * select mode is an error (since it would result in busy waiting) and | 1144 | * select mode is an error (since it would result in busy waiting) and |
1050 | * will cause the program to be aborted (abort()). | 1145 | * will cause the program to be aborted (abort()). |
1051 | * | 1146 | * |
@@ -1059,28 +1154,28 @@ typedef int | |||
1059 | * the sum of all non-negative return values | 1154 | * the sum of all non-negative return values |
1060 | * obtained from the content reader so far. | 1155 | * obtained from the content reader so far. |
1061 | * @param buf where to copy the data | 1156 | * @param buf where to copy the data |
1062 | * @param max maximum number of bytes to copy to buf (size of buf) | 1157 | * @param max maximum number of bytes to copy to @a buf (size of @a buf) |
1063 | * @return number of bytes written to 'buf'; | 1158 | * @return number of bytes written to @a buf; |
1064 | * 0 is legal unless we are running in internal select mode (since | 1159 | * 0 is legal unless we are running in internal select mode (since |
1065 | * this would cause busy-waiting); 0 in external select mode | 1160 | * this would cause busy-waiting); 0 in external select mode |
1066 | * will cause this function to be called again once the external | 1161 | * will cause this function to be called again once the external |
1067 | * select calls MHD again; | 1162 | * select calls MHD again; |
1068 | * MHD_CONTENT_READER_END_OF_STREAM (-1) for the regular | 1163 | * #MHD_CONTENT_READER_END_OF_STREAM (-1) for the regular |
1069 | * end of transmission (with chunked encoding, MHD will then | 1164 | * end of transmission (with chunked encoding, MHD will then |
1070 | * terminate the chunk and send any HTTP footers that might be | 1165 | * terminate the chunk and send any HTTP footers that might be |
1071 | * present; without chunked encoding and given an unknown | 1166 | * present; without chunked encoding and given an unknown |
1072 | * response size, MHD will simply close the connection; note | 1167 | * response size, MHD will simply close the connection; note |
1073 | * that while returning END_OF_STREAM is not technically | 1168 | * that while returning #MHD_CONTENT_READER_END_OF_STREAM is not technically |
1074 | * legal if a response size was specified, MHD accepts this | 1169 | * legal if a response size was specified, MHD accepts this |
1075 | * and treats it just as MHD_CONTENT_READER_END_WITH_ERROR; | 1170 | * and treats it just as #MHD_CONTENT_READER_END_WITH_ERROR; |
1076 | * MHD_CONTENT_READER_END_WITH_ERROR (-2) to indicate a server | 1171 | * #MHD_CONTENT_READER_END_WITH_ERROR (-2) to indicate a server |
1077 | * error generating the response; this will cause MHD to simply | 1172 | * error generating the response; this will cause MHD to simply |
1078 | * close the connection immediately. If a response size was | 1173 | * close the connection immediately. If a response size was |
1079 | * given or if chunked encoding is in use, this will indicate | 1174 | * given or if chunked encoding is in use, this will indicate |
1080 | * an error to the client. Note, however, that if the client | 1175 | * an error to the client. Note, however, that if the client |
1081 | * does not know a response size and chunked encoding is not in | 1176 | * does not know a response size and chunked encoding is not in |
1082 | * use, then clients will not be able to tell the difference between | 1177 | * use, then clients will not be able to tell the difference between |
1083 | * MHD_CONTENT_READER_END_WITH_ERROR and MHD_CONTENT_READER_END_OF_STREAM. | 1178 | * #MHD_CONTENT_READER_END_WITH_ERROR and #MHD_CONTENT_READER_END_OF_STREAM. |
1084 | * This is not a limitation of MHD but rather of the HTTP protocol. | 1179 | * This is not a limitation of MHD but rather of the HTTP protocol. |
1085 | */ | 1180 | */ |
1086 | typedef ssize_t | 1181 | typedef ssize_t |
@@ -1095,6 +1190,9 @@ typedef ssize_t | |||
1095 | * are done with a content reader. It should | 1190 | * are done with a content reader. It should |
1096 | * be used to free resources associated with the | 1191 | * be used to free resources associated with the |
1097 | * content reader. | 1192 | * content reader. |
1193 | * | ||
1194 | * @param cls closure | ||
1195 | * @ingroup response | ||
1098 | */ | 1196 | */ |
1099 | typedef void | 1197 | typedef void |
1100 | (*MHD_ContentReaderFreeCallback) (void *cls); | 1198 | (*MHD_ContentReaderFreeCallback) (void *cls); |
@@ -1107,17 +1205,17 @@ typedef void | |||
1107 | * POST data. | 1205 | * POST data. |
1108 | * | 1206 | * |
1109 | * @param cls user-specified closure | 1207 | * @param cls user-specified closure |
1110 | * @param kind type of the value, always MHD_POSTDATA_KIND when called from MHD | 1208 | * @param kind type of the value, always #MHD_POSTDATA_KIND when called from MHD |
1111 | * @param key 0-terminated key for the value | 1209 | * @param key 0-terminated key for the value |
1112 | * @param filename name of the uploaded file, NULL if not known | 1210 | * @param filename name of the uploaded file, NULL if not known |
1113 | * @param content_type mime-type of the data, NULL if not known | 1211 | * @param content_type mime-type of the data, NULL if not known |
1114 | * @param transfer_encoding encoding of the data, NULL if not known | 1212 | * @param transfer_encoding encoding of the data, NULL if not known |
1115 | * @param data pointer to size bytes of data at the | 1213 | * @param data pointer to @a size bytes of data at the |
1116 | * specified offset | 1214 | * specified offset |
1117 | * @param off offset of data in the overall value | 1215 | * @param off offset of data in the overall value |
1118 | * @param size number of bytes in data available | 1216 | * @param size number of bytes in @a data available |
1119 | * @return MHD_YES to continue iterating, | 1217 | * @return #MHD_YES to continue iterating, |
1120 | * MHD_NO to abort the iteration | 1218 | * #MHD_NO to abort the iteration |
1121 | */ | 1219 | */ |
1122 | typedef int | 1220 | typedef int |
1123 | (*MHD_PostDataIterator) (void *cls, | 1221 | (*MHD_PostDataIterator) (void *cls, |
@@ -1143,10 +1241,11 @@ typedef int | |||
1143 | * accepted | 1241 | * accepted |
1144 | * @param apc_cls extra argument to apc | 1242 | * @param apc_cls extra argument to apc |
1145 | * @param dh handler called for all requests (repeatedly) | 1243 | * @param dh handler called for all requests (repeatedly) |
1146 | * @param dh_cls extra argument to dh | 1244 | * @param dh_cls extra argument to @a dh |
1147 | * @param ap list of options (type-value pairs, | 1245 | * @param ap list of options (type-value pairs, |
1148 | * terminated with MHD_OPTION_END). | 1246 | * terminated with #MHD_OPTION_END). |
1149 | * @return NULL on error, handle to daemon on success | 1247 | * @return NULL on error, handle to daemon on success |
1248 | * @ingroup event | ||
1150 | */ | 1249 | */ |
1151 | struct MHD_Daemon * | 1250 | struct MHD_Daemon * |
1152 | MHD_start_daemon_va (unsigned int flags, | 1251 | MHD_start_daemon_va (unsigned int flags, |
@@ -1158,7 +1257,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
1158 | 1257 | ||
1159 | /** | 1258 | /** |
1160 | * Start a webserver on the given port. Variadic version of | 1259 | * Start a webserver on the given port. Variadic version of |
1161 | * MHD_start_daemon_va. | 1260 | * #MHD_start_daemon_va. |
1162 | * | 1261 | * |
1163 | * @param flags combination of MHD_FLAG values | 1262 | * @param flags combination of MHD_FLAG values |
1164 | * @param port port to bind to | 1263 | * @param port port to bind to |
@@ -1168,8 +1267,9 @@ MHD_start_daemon_va (unsigned int flags, | |||
1168 | * accepted | 1267 | * accepted |
1169 | * @param apc_cls extra argument to apc | 1268 | * @param apc_cls extra argument to apc |
1170 | * @param dh handler called for all requests (repeatedly) | 1269 | * @param dh handler called for all requests (repeatedly) |
1171 | * @param dh_cls extra argument to dh | 1270 | * @param dh_cls extra argument to @a dh |
1172 | * @return NULL on error, handle to daemon on success | 1271 | * @return NULL on error, handle to daemon on success |
1272 | * @ingroup event | ||
1173 | */ | 1273 | */ |
1174 | struct MHD_Daemon * | 1274 | struct MHD_Daemon * |
1175 | MHD_start_daemon (unsigned int flags, | 1275 | MHD_start_daemon (unsigned int flags, |
@@ -1185,17 +1285,18 @@ MHD_start_daemon (unsigned int flags, | |||
1185 | * connections. Note that the caller is responsible for closing the | 1285 | * connections. Note that the caller is responsible for closing the |
1186 | * returned socket; however, if MHD is run using threads (anything but | 1286 | * returned socket; however, if MHD is run using threads (anything but |
1187 | * external select mode), it must not be closed until AFTER | 1287 | * external select mode), it must not be closed until AFTER |
1188 | * "MHD_stop_daemon" has been called (as it is theoretically possible | 1288 | * #MHD_stop_daemon has been called (as it is theoretically possible |
1189 | * that an existing thread is still using it). | 1289 | * that an existing thread is still using it). |
1190 | * | 1290 | * |
1191 | * Note that some thread modes require the caller to have passed | 1291 | * Note that some thread modes require the caller to have passed |
1192 | * MHD_USE_PIPE_FOR_SHUTDOWN when using this API. If this daemon is | 1292 | * #MHD_USE_PIPE_FOR_SHUTDOWN when using this API. If this daemon is |
1193 | * in one of those modes and this option was not given to | 1293 | * in one of those modes and this option was not given to |
1194 | * 'MHD_start_daemon', this function will return -1. | 1294 | * #MHD_start_daemon, this function will return -1. |
1195 | * | 1295 | * |
1196 | * @param daemon daemon to stop accepting new connections for | 1296 | * @param daemon daemon to stop accepting new connections for |
1197 | * @return old listen socket on success, -1 if the daemon was | 1297 | * @return old listen socket on success, -1 if the daemon was |
1198 | * already not listening anymore | 1298 | * already not listening anymore |
1299 | * @ingroup specialized | ||
1199 | */ | 1300 | */ |
1200 | int | 1301 | int |
1201 | MHD_quiesce_daemon (struct MHD_Daemon *daemon); | 1302 | MHD_quiesce_daemon (struct MHD_Daemon *daemon); |
@@ -1205,6 +1306,7 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon); | |||
1205 | * Shutdown an http daemon. | 1306 | * Shutdown an http daemon. |
1206 | * | 1307 | * |
1207 | * @param daemon daemon to stop | 1308 | * @param daemon daemon to stop |
1309 | * @ingroup event | ||
1208 | */ | 1310 | */ |
1209 | void | 1311 | void |
1210 | MHD_stop_daemon (struct MHD_Daemon *daemon); | 1312 | MHD_stop_daemon (struct MHD_Daemon *daemon); |
@@ -1219,7 +1321,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon); | |||
1219 | * | 1321 | * |
1220 | * If you use this API in conjunction with a internal select or a | 1322 | * If you use this API in conjunction with a internal select or a |
1221 | * thread pool, you must set the option | 1323 | * thread pool, you must set the option |
1222 | * @code{MHD_USE_PIPE_FOR_SHUTDOWN} to ensure that the freshly added | 1324 | * #MHD_USE_PIPE_FOR_SHUTDOWN to ensure that the freshly added |
1223 | * connection is immediately processed by MHD. | 1325 | * connection is immediately processed by MHD. |
1224 | * | 1326 | * |
1225 | * The given client socket will be managed (and closed!) by MHD after | 1327 | * The given client socket will be managed (and closed!) by MHD after |
@@ -1230,11 +1332,12 @@ MHD_stop_daemon (struct MHD_Daemon *daemon); | |||
1230 | * @param client_socket socket to manage (MHD will expect | 1332 | * @param client_socket socket to manage (MHD will expect |
1231 | * to receive an HTTP request from this socket next). | 1333 | * to receive an HTTP request from this socket next). |
1232 | * @param addr IP address of the client | 1334 | * @param addr IP address of the client |
1233 | * @param addrlen number of bytes in addr | 1335 | * @param addrlen number of bytes in @a addr |
1234 | * @return MHD_YES on success, MHD_NO if this daemon could | 1336 | * @return #MHD_YES on success, #MHD_NO if this daemon could |
1235 | * not handle the connection (i.e. malloc failed, etc). | 1337 | * not handle the connection (i.e. malloc() failed, etc). |
1236 | * The socket will be closed in any case; 'errno' is | 1338 | * The socket will be closed in any case; @code{errno} is |
1237 | * set to indicate further details about the error. | 1339 | * set to indicate further details about the error. |
1340 | * @ingroup specialized | ||
1238 | */ | 1341 | */ |
1239 | int | 1342 | int |
1240 | MHD_add_connection (struct MHD_Daemon *daemon, | 1343 | MHD_add_connection (struct MHD_Daemon *daemon, |
@@ -1252,9 +1355,10 @@ MHD_add_connection (struct MHD_Daemon *daemon, | |||
1252 | * @param except_fd_set except set | 1355 | * @param except_fd_set except set |
1253 | * @param max_fd increased to largest FD added (if larger | 1356 | * @param max_fd increased to largest FD added (if larger |
1254 | * than existing value); can be NULL | 1357 | * than existing value); can be NULL |
1255 | * @return MHD_YES on success, MHD_NO if this | 1358 | * @return #MHD_YES on success, #MHD_NO if this |
1256 | * daemon was not started with the right | 1359 | * daemon was not started with the right |
1257 | * options for this call. | 1360 | * options for this call. |
1361 | * @ingroup event | ||
1258 | */ | 1362 | */ |
1259 | int | 1363 | int |
1260 | MHD_get_fdset (struct MHD_Daemon *daemon, | 1364 | MHD_get_fdset (struct MHD_Daemon *daemon, |
@@ -1265,40 +1369,41 @@ MHD_get_fdset (struct MHD_Daemon *daemon, | |||
1265 | 1369 | ||
1266 | 1370 | ||
1267 | /** | 1371 | /** |
1268 | * Obtain timeout value for select for this daemon (only needed if | 1372 | * Obtain timeout value for select() for this daemon (only needed if |
1269 | * connection timeout is used). The returned value is how long select | 1373 | * connection timeout is used). The returned value is how long |
1270 | * should at most block, not the timeout value set for connections. | 1374 | * select() or poll() should at most block, not the timeout value set |
1271 | * This function MUST NOT be called if MHD is running with | 1375 | * for connections. This function MUST NOT be called if MHD is |
1272 | * "MHD_USE_THREAD_PER_CONNECTION". | 1376 | * running with #MHD_USE_THREAD_PER_CONNECTION. |
1273 | * | 1377 | * |
1274 | * @param daemon daemon to query for timeout | 1378 | * @param daemon daemon to query for timeout |
1275 | * @param timeout set to the timeout (in milliseconds) | 1379 | * @param timeout set to the timeout (in milliseconds) |
1276 | * @return MHD_YES on success, MHD_NO if timeouts are | 1380 | * @return #MHD_YES on success, #MHD_NO if timeouts are |
1277 | * not used (or no connections exist that would | 1381 | * not used (or no connections exist that would |
1278 | * necessiate the use of a timeout right now). | 1382 | * necessiate the use of a timeout right now). |
1383 | * @ingroup event | ||
1279 | */ | 1384 | */ |
1280 | int MHD_get_timeout (struct MHD_Daemon *daemon, | 1385 | int MHD_get_timeout (struct MHD_Daemon *daemon, |
1281 | MHD_UNSIGNED_LONG_LONG *timeout); | 1386 | MHD_UNSIGNED_LONG_LONG *timeout); |
1282 | 1387 | ||
1283 | 1388 | ||
1284 | /** | 1389 | /** |
1285 | * Run webserver operations (without blocking unless | 1390 | * Run webserver operations (without blocking unless in client |
1286 | * in client callbacks). This method should be called | 1391 | * callbacks). This method should be called by clients in combination |
1287 | * by clients in combination with MHD_get_fdset | 1392 | * with #MHD_get_fdset if the client-controlled select method is used. |
1288 | * if the client-controlled select method is used. | ||
1289 | * | 1393 | * |
1290 | * This function is a convenience method, which is useful if the | 1394 | * This function is a convenience method, which is useful if the |
1291 | * fd_sets from "MHD_get_fdset" were not directly passed to 'select'; | 1395 | * fd_sets from #MHD_get_fdset were not directly passed to select(); |
1292 | * with this function, MHD will internally do the appropriate 'select' | 1396 | * with this function, MHD will internally do the appropriate select() |
1293 | * call itself again. While it is always safe to call 'MHD_run' (in | 1397 | * call itself again. While it is always safe to call #MHD_run (in |
1294 | * external select mode), you should call 'MHD_run_from_select' if | 1398 | * external select mode), you should call #MHD_run_from_select if |
1295 | * performance is important (as it saves an expensive call to | 1399 | * performance is important (as it saves an expensive call to |
1296 | * 'select'). | 1400 | * select()). |
1297 | * | 1401 | * |
1298 | * @param daemon daemon to run | 1402 | * @param daemon daemon to run |
1299 | * @return MHD_YES on success, MHD_NO if this | 1403 | * @return #MHD_YES on success, #MHD_NO if this |
1300 | * daemon was not started with the right | 1404 | * daemon was not started with the right |
1301 | * options for this call. | 1405 | * options for this call. |
1406 | * @ingroup event | ||
1302 | */ | 1407 | */ |
1303 | int | 1408 | int |
1304 | MHD_run (struct MHD_Daemon *daemon); | 1409 | MHD_run (struct MHD_Daemon *daemon); |
@@ -1306,21 +1411,21 @@ MHD_run (struct MHD_Daemon *daemon); | |||
1306 | 1411 | ||
1307 | /** | 1412 | /** |
1308 | * Run webserver operations. This method should be called by clients | 1413 | * Run webserver operations. This method should be called by clients |
1309 | * in combination with MHD_get_fdset if the client-controlled select | 1414 | * in combination with #MHD_get_fdset if the client-controlled select |
1310 | * method is used. | 1415 | * method is used. |
1311 | * | 1416 | * |
1312 | * You can use this function instead of "MHD_run" if you called | 1417 | * You can use this function instead of #MHD_run if you called |
1313 | * 'select' on the result from "MHD_get_fdset". File descriptors in | 1418 | * select() on the result from #MHD_get_fdset. File descriptors in |
1314 | * the sets that are not controlled by MHD will be ignored. Calling | 1419 | * the sets that are not controlled by MHD will be ignored. Calling |
1315 | * this function instead of "MHD_run" is more efficient as MHD will | 1420 | * this function instead of #MHD_run is more efficient as MHD will |
1316 | * not have to call 'select' again to determine which operations are | 1421 | * not have to call select() again to determine which operations are |
1317 | * ready. | 1422 | * ready. |
1318 | * | 1423 | * |
1319 | * @param daemon daemon to run select loop for | 1424 | * @param daemon daemon to run select loop for |
1320 | * @param read_fd_set read set | 1425 | * @param read_fd_set read set |
1321 | * @param write_fd_set write set | 1426 | * @param write_fd_set write set |
1322 | * @param except_fd_set except set (not used, can be NULL) | 1427 | * @param except_fd_set except set (not used, can be NULL) |
1323 | * @return MHD_NO on serious errors, MHD_YES on success | 1428 | * @return #MHD_NO on serious errors, #MHD_YES on success |
1324 | */ | 1429 | */ |
1325 | int | 1430 | int |
1326 | MHD_run_from_select (struct MHD_Daemon *daemon, | 1431 | MHD_run_from_select (struct MHD_Daemon *daemon, |
@@ -1340,8 +1445,9 @@ MHD_run_from_select (struct MHD_Daemon *daemon, | |||
1340 | * @param kind types of values to iterate over | 1445 | * @param kind types of values to iterate over |
1341 | * @param iterator callback to call on each header; | 1446 | * @param iterator callback to call on each header; |
1342 | * maybe NULL (then just count headers) | 1447 | * maybe NULL (then just count headers) |
1343 | * @param iterator_cls extra argument to iterator | 1448 | * @param iterator_cls extra argument to @a iterator |
1344 | * @return number of entries iterated over | 1449 | * @return number of entries iterated over |
1450 | * @ingroup request | ||
1345 | */ | 1451 | */ |
1346 | int | 1452 | int |
1347 | MHD_get_connection_values (struct MHD_Connection *connection, | 1453 | MHD_get_connection_values (struct MHD_Connection *connection, |
@@ -1350,33 +1456,29 @@ MHD_get_connection_values (struct MHD_Connection *connection, | |||
1350 | 1456 | ||
1351 | 1457 | ||
1352 | /** | 1458 | /** |
1353 | * This function can be used to add an entry to | 1459 | * This function can be used to add an entry to the HTTP headers of a |
1354 | * the HTTP headers of a connection (so that the | 1460 | * connection (so that the #MHD_get_connection_values function will |
1355 | * MHD_get_connection_values function will return | 1461 | * return them -- and the MHD PostProcessor will also see them). This |
1356 | * them -- and the MHD PostProcessor will also | 1462 | * maybe required in certain situations (see Mantis #1399) where |
1357 | * see them). This maybe required in certain | 1463 | * (broken) HTTP implementations fail to supply values needed by the |
1358 | * situations (see Mantis #1399) where (broken) | 1464 | * post processor (or other parts of the application). |
1359 | * HTTP implementations fail to supply values needed | 1465 | * |
1360 | * by the post processor (or other parts of the | 1466 | * This function MUST only be called from within the |
1361 | * application). | 1467 | * MHD_AccessHandlerCallback (otherwise, access maybe improperly |
1362 | * <p> | 1468 | * synchronized). Furthermore, the client must guarantee that the key |
1363 | * This function MUST only be called from within | 1469 | * and value arguments are 0-terminated strings that are NOT freed |
1364 | * the MHD_AccessHandlerCallback (otherwise, access | 1470 | * until the connection is closed. (The easiest way to do this is by |
1365 | * maybe improperly synchronized). Furthermore, | 1471 | * passing only arguments to permanently allocated strings.). |
1366 | * the client must guarantee that the key and | ||
1367 | * value arguments are 0-terminated strings that | ||
1368 | * are NOT freed until the connection is closed. | ||
1369 | * (The easiest way to do this is by passing only | ||
1370 | * arguments to permanently allocated strings.). | ||
1371 | * | 1472 | * |
1372 | * @param connection the connection for which a | 1473 | * @param connection the connection for which a |
1373 | * value should be set | 1474 | * value should be set |
1374 | * @param kind kind of the value | 1475 | * @param kind kind of the value |
1375 | * @param key key for the value | 1476 | * @param key key for the value |
1376 | * @param value the value itself | 1477 | * @param value the value itself |
1377 | * @return MHD_NO if the operation could not be | 1478 | * @return #MHD_NO if the operation could not be |
1378 | * performed due to insufficient memory; | 1479 | * performed due to insufficient memory; |
1379 | * MHD_YES on success | 1480 | * #MHD_YES on success |
1481 | * @ingroup request | ||
1380 | */ | 1482 | */ |
1381 | int | 1483 | int |
1382 | MHD_set_connection_value (struct MHD_Connection *connection, | 1484 | MHD_set_connection_value (struct MHD_Connection *connection, |
@@ -1386,19 +1488,20 @@ MHD_set_connection_value (struct MHD_Connection *connection, | |||
1386 | 1488 | ||
1387 | 1489 | ||
1388 | /** | 1490 | /** |
1389 | * Sets the global error handler to a different implementation. "cb" | 1491 | * Sets the global error handler to a different implementation. @a cb |
1390 | * will only be called in the case of typically fatal, serious | 1492 | * will only be called in the case of typically fatal, serious |
1391 | * internal consistency issues. These issues should only arise in the | 1493 | * internal consistency issues. These issues should only arise in the |
1392 | * case of serious memory corruption or similar problems with the | 1494 | * case of serious memory corruption or similar problems with the |
1393 | * architecture. While "cb" is allowed to return and MHD will then | 1495 | * architecture. While @a cb is allowed to return and MHD will then |
1394 | * try to continue, this is never safe. | 1496 | * try to continue, this is never safe. |
1395 | * | 1497 | * |
1396 | * The default implementation that is used if no panic function is set | 1498 | * The default implementation that is used if no panic function is set |
1397 | * simply prints an error message and calls "abort". Alternative | 1499 | * simply prints an error message and calls abort(). Alternative |
1398 | * implementations might call "exit" or other similar functions. | 1500 | * implementations might call exit() or other similar functions. |
1399 | * | 1501 | * |
1400 | * @param cb new error handler | 1502 | * @param cb new error handler |
1401 | * @param cls passed to error handler | 1503 | * @param cls passed to @a cb |
1504 | * @ingroup logging | ||
1402 | */ | 1505 | */ |
1403 | void | 1506 | void |
1404 | MHD_set_panic_func (MHD_PanicCallback cb, void *cls); | 1507 | MHD_set_panic_func (MHD_PanicCallback cb, void *cls); |
@@ -1412,6 +1515,7 @@ MHD_set_panic_func (MHD_PanicCallback cb, void *cls); | |||
1412 | * @param kind what kind of value are we looking for | 1515 | * @param kind what kind of value are we looking for |
1413 | * @param key the header to look for, NULL to lookup 'trailing' value without a key | 1516 | * @param key the header to look for, NULL to lookup 'trailing' value without a key |
1414 | * @return NULL if no such item was found | 1517 | * @return NULL if no such item was found |
1518 | * @ingroup request | ||
1415 | */ | 1519 | */ |
1416 | const char * | 1520 | const char * |
1417 | MHD_lookup_connection_value (struct MHD_Connection *connection, | 1521 | MHD_lookup_connection_value (struct MHD_Connection *connection, |
@@ -1426,8 +1530,9 @@ MHD_lookup_connection_value (struct MHD_Connection *connection, | |||
1426 | * @param connection the connection identifying the client | 1530 | * @param connection the connection identifying the client |
1427 | * @param status_code HTTP status code (i.e. 200 for OK) | 1531 | * @param status_code HTTP status code (i.e. 200 for OK) |
1428 | * @param response response to transmit | 1532 | * @param response response to transmit |
1429 | * @return MHD_NO on error (i.e. reply already sent), | 1533 | * @return #MHD_NO on error (i.e. reply already sent), |
1430 | * MHD_YES on success or if message has been queued | 1534 | * #MHD_YES on success or if message has been queued |
1535 | * @ingroup response | ||
1431 | */ | 1536 | */ |
1432 | int | 1537 | int |
1433 | MHD_queue_response (struct MHD_Connection *connection, | 1538 | MHD_queue_response (struct MHD_Connection *connection, |
@@ -1441,16 +1546,17 @@ MHD_queue_response (struct MHD_Connection *connection, | |||
1441 | * Create a response object. The response object can be extended with | 1546 | * Create a response object. The response object can be extended with |
1442 | * header information and then be used any number of times. | 1547 | * header information and then be used any number of times. |
1443 | * | 1548 | * |
1444 | * @param size size of the data portion of the response, MHD_SIZE_UNKNOWN for unknown | 1549 | * @param size size of the data portion of the response, #MHD_SIZE_UNKNOWN for unknown |
1445 | * @param block_size preferred block size for querying crc (advisory only, | 1550 | * @param block_size preferred block size for querying crc (advisory only, |
1446 | * MHD may still call crc using smaller chunks); this | 1551 | * MHD may still call @a crc using smaller chunks); this |
1447 | * is essentially the buffer size used for IO, clients | 1552 | * is essentially the buffer size used for IO, clients |
1448 | * should pick a value that is appropriate for IO and | 1553 | * should pick a value that is appropriate for IO and |
1449 | * memory performance requirements | 1554 | * memory performance requirements |
1450 | * @param crc callback to use to obtain response data | 1555 | * @param crc callback to use to obtain response data |
1451 | * @param crc_cls extra argument to crc | 1556 | * @param crc_cls extra argument to @a crc |
1452 | * @param crfc callback to call to free crc_cls resources | 1557 | * @param crfc callback to call to free @a crc_cls resources |
1453 | * @return NULL on error (i.e. invalid arguments, out of memory) | 1558 | * @return NULL on error (i.e. invalid arguments, out of memory) |
1559 | * @ingroup response | ||
1454 | */ | 1560 | */ |
1455 | struct MHD_Response * | 1561 | struct MHD_Response * |
1456 | MHD_create_response_from_callback (uint64_t size, | 1562 | MHD_create_response_from_callback (uint64_t size, |
@@ -1463,14 +1569,15 @@ MHD_create_response_from_callback (uint64_t size, | |||
1463 | * Create a response object. The response object can be extended with | 1569 | * Create a response object. The response object can be extended with |
1464 | * header information and then be used any number of times. | 1570 | * header information and then be used any number of times. |
1465 | * | 1571 | * |
1466 | * @param size size of the data portion of the response | 1572 | * @param size size of the @a data portion of the response |
1467 | * @param data the data itself | 1573 | * @param data the data itself |
1468 | * @param must_free libmicrohttpd should free data when done | 1574 | * @param must_free libmicrohttpd should free data when done |
1469 | * @param must_copy libmicrohttpd must make a copy of data | 1575 | * @param must_copy libmicrohttpd must make a copy of @a data |
1470 | * right away, the data maybe released anytime after | 1576 | * right away, the data maybe released anytime after |
1471 | * this call returns | 1577 | * this call returns |
1472 | * @return NULL on error (i.e. invalid arguments, out of memory) | 1578 | * @return NULL on error (i.e. invalid arguments, out of memory) |
1473 | * @deprecated use MHD_create_response_from_buffer instead | 1579 | * @deprecated use #MHD_create_response_from_buffer instead |
1580 | * @ingroup response | ||
1474 | */ | 1581 | */ |
1475 | struct MHD_Response * | 1582 | struct MHD_Response * |
1476 | MHD_create_response_from_data (size_t size, | 1583 | MHD_create_response_from_data (size_t size, |
@@ -1482,28 +1589,33 @@ MHD_create_response_from_data (size_t size, | |||
1482 | /** | 1589 | /** |
1483 | * Specification for how MHD should treat the memory buffer | 1590 | * Specification for how MHD should treat the memory buffer |
1484 | * given for the response. | 1591 | * given for the response. |
1592 | * @ingroup response | ||
1485 | */ | 1593 | */ |
1486 | enum MHD_ResponseMemoryMode { | 1594 | enum MHD_ResponseMemoryMode |
1595 | { | ||
1487 | 1596 | ||
1488 | /** | 1597 | /** |
1489 | * Buffer is a persistent (static/global) buffer that won't change | 1598 | * Buffer is a persistent (static/global) buffer that won't change |
1490 | * for at least the lifetime of the response, MHD should just use | 1599 | * for at least the lifetime of the response, MHD should just use |
1491 | * it, not free it, not copy it, just keep an alias to it. | 1600 | * it, not free it, not copy it, just keep an alias to it. |
1601 | * @ingroup response | ||
1492 | */ | 1602 | */ |
1493 | MHD_RESPMEM_PERSISTENT, | 1603 | MHD_RESPMEM_PERSISTENT, |
1494 | 1604 | ||
1495 | /** | 1605 | /** |
1496 | * Buffer is heap-allocated with 'malloc' (or equivalent) and | 1606 | * Buffer is heap-allocated with malloc() (or equivalent) and |
1497 | * should be freed by MHD after processing the response has | 1607 | * should be freed by MHD after processing the response has |
1498 | * concluded (response reference counter reaches zero). | 1608 | * concluded (response reference counter reaches zero). |
1609 | * @ingroup response | ||
1499 | */ | 1610 | */ |
1500 | MHD_RESPMEM_MUST_FREE, | 1611 | MHD_RESPMEM_MUST_FREE, |
1501 | 1612 | ||
1502 | /** | 1613 | /** |
1503 | * Buffer is in transient memory, but not on the heap (for example, | 1614 | * Buffer is in transient memory, but not on the heap (for example, |
1504 | * on the stack or non-malloc allocated) and only valid during the | 1615 | * on the stack or non-malloc allocated) and only valid during the |
1505 | * call to 'MHD_create_response_from_buffer'. MHD must make its | 1616 | * call to #MHD_create_response_from_buffer. MHD must make its |
1506 | * own private copy of the data for processing. | 1617 | * own private copy of the data for processing. |
1618 | * @ingroup response | ||
1507 | */ | 1619 | */ |
1508 | MHD_RESPMEM_MUST_COPY | 1620 | MHD_RESPMEM_MUST_COPY |
1509 | 1621 | ||
@@ -1518,6 +1630,7 @@ enum MHD_ResponseMemoryMode { | |||
1518 | * @param buffer size bytes containing the response's data portion | 1630 | * @param buffer size bytes containing the response's data portion |
1519 | * @param mode flags for buffer management | 1631 | * @param mode flags for buffer management |
1520 | * @return NULL on error (i.e. invalid arguments, out of memory) | 1632 | * @return NULL on error (i.e. invalid arguments, out of memory) |
1633 | * @ingroup response | ||
1521 | */ | 1634 | */ |
1522 | struct MHD_Response * | 1635 | struct MHD_Response * |
1523 | MHD_create_response_from_buffer (size_t size, | 1636 | MHD_create_response_from_buffer (size_t size, |
@@ -1534,6 +1647,7 @@ MHD_create_response_from_buffer (size_t size, | |||
1534 | * data; will be closed when response is destroyed; | 1647 | * data; will be closed when response is destroyed; |
1535 | * fd should be in 'blocking' mode | 1648 | * fd should be in 'blocking' mode |
1536 | * @return NULL on error (i.e. invalid arguments, out of memory) | 1649 | * @return NULL on error (i.e. invalid arguments, out of memory) |
1650 | * @ingroup response | ||
1537 | */ | 1651 | */ |
1538 | struct MHD_Response * | 1652 | struct MHD_Response * |
1539 | MHD_create_response_from_fd (size_t size, | 1653 | MHD_create_response_from_fd (size_t size, |
@@ -1554,6 +1668,7 @@ MHD_create_response_from_fd (size_t size, | |||
1554 | * also has to be compiled using the same options! Read | 1668 | * also has to be compiled using the same options! Read |
1555 | * the MHD manual for more details. | 1669 | * the MHD manual for more details. |
1556 | * @return NULL on error (i.e. invalid arguments, out of memory) | 1670 | * @return NULL on error (i.e. invalid arguments, out of memory) |
1671 | * @ingroup response | ||
1557 | */ | 1672 | */ |
1558 | struct MHD_Response * | 1673 | struct MHD_Response * |
1559 | MHD_create_response_from_fd_at_offset (size_t size, | 1674 | MHD_create_response_from_fd_at_offset (size_t size, |
@@ -1702,8 +1817,10 @@ MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, | |||
1702 | * necessarily be freed immediatley. | 1817 | * necessarily be freed immediatley. |
1703 | * | 1818 | * |
1704 | * @param response response to destroy | 1819 | * @param response response to destroy |
1820 | * @ingroup response | ||
1705 | */ | 1821 | */ |
1706 | void MHD_destroy_response (struct MHD_Response *response); | 1822 | void |
1823 | MHD_destroy_response (struct MHD_Response *response); | ||
1707 | 1824 | ||
1708 | 1825 | ||
1709 | /** | 1826 | /** |
@@ -1712,8 +1829,9 @@ void MHD_destroy_response (struct MHD_Response *response); | |||
1712 | * @param response response to add a header to | 1829 | * @param response response to add a header to |
1713 | * @param header the header to add | 1830 | * @param header the header to add |
1714 | * @param content value to add | 1831 | * @param content value to add |
1715 | * @return MHD_NO on error (i.e. invalid header or content format), | 1832 | * @return #MHD_NO on error (i.e. invalid header or content format), |
1716 | * or out of memory | 1833 | * or out of memory |
1834 | * @ingroup response | ||
1717 | */ | 1835 | */ |
1718 | int | 1836 | int |
1719 | MHD_add_response_header (struct MHD_Response *response, | 1837 | MHD_add_response_header (struct MHD_Response *response, |
@@ -1726,7 +1844,8 @@ MHD_add_response_header (struct MHD_Response *response, | |||
1726 | * @param response response to remove a header from | 1844 | * @param response response to remove a header from |
1727 | * @param footer the footer to delete | 1845 | * @param footer the footer to delete |
1728 | * @param content value to delete | 1846 | * @param content value to delete |
1729 | * @return MHD_NO on error (i.e. invalid footer or content format). | 1847 | * @return #MHD_NO on error (i.e. invalid footer or content format). |
1848 | * @ingroup response | ||
1730 | */ | 1849 | */ |
1731 | int | 1850 | int |
1732 | MHD_add_response_footer (struct MHD_Response *response, | 1851 | MHD_add_response_footer (struct MHD_Response *response, |
@@ -1739,7 +1858,8 @@ MHD_add_response_footer (struct MHD_Response *response, | |||
1739 | * @param response response to remove a header from | 1858 | * @param response response to remove a header from |
1740 | * @param header the header to delete | 1859 | * @param header the header to delete |
1741 | * @param content value to delete | 1860 | * @param content value to delete |
1742 | * @return MHD_NO on error (no such header known) | 1861 | * @return #MHD_NO on error (no such header known) |
1862 | * @ingroup response | ||
1743 | */ | 1863 | */ |
1744 | int | 1864 | int |
1745 | MHD_del_response_header (struct MHD_Response *response, | 1865 | MHD_del_response_header (struct MHD_Response *response, |
@@ -1752,8 +1872,9 @@ MHD_del_response_header (struct MHD_Response *response, | |||
1752 | * @param response response to query | 1872 | * @param response response to query |
1753 | * @param iterator callback to call on each header; | 1873 | * @param iterator callback to call on each header; |
1754 | * maybe NULL (then just count headers) | 1874 | * maybe NULL (then just count headers) |
1755 | * @param iterator_cls extra argument to iterator | 1875 | * @param iterator_cls extra argument to @a iterator |
1756 | * @return number of entries iterated over | 1876 | * @return number of entries iterated over |
1877 | * @ingroup response | ||
1757 | */ | 1878 | */ |
1758 | int | 1879 | int |
1759 | MHD_get_response_headers (struct MHD_Response *response, | 1880 | MHD_get_response_headers (struct MHD_Response *response, |
@@ -1766,9 +1887,11 @@ MHD_get_response_headers (struct MHD_Response *response, | |||
1766 | * @param response response to query | 1887 | * @param response response to query |
1767 | * @param key which header to get | 1888 | * @param key which header to get |
1768 | * @return NULL if header does not exist | 1889 | * @return NULL if header does not exist |
1890 | * @ingroup response | ||
1769 | */ | 1891 | */ |
1770 | const char *MHD_get_response_header (struct MHD_Response *response, | 1892 | const char * |
1771 | const char *key); | 1893 | MHD_get_response_header (struct MHD_Response *response, |
1894 | const char *key); | ||
1772 | 1895 | ||
1773 | 1896 | ||
1774 | /* ********************** PostProcessor functions ********************** */ | 1897 | /* ********************** PostProcessor functions ********************** */ |
@@ -1779,7 +1902,7 @@ const char *MHD_get_response_header (struct MHD_Response *response, | |||
1779 | * A PostProcessor can be used to (incrementally) parse the data | 1902 | * A PostProcessor can be used to (incrementally) parse the data |
1780 | * portion of a POST request. Note that some buggy browsers fail to | 1903 | * portion of a POST request. Note that some buggy browsers fail to |
1781 | * set the encoding type. If you want to support those, you may have | 1904 | * set the encoding type. If you want to support those, you may have |
1782 | * to call 'MHD_set_connection_value' with the proper encoding type | 1905 | * to call #MHD_set_connection_value with the proper encoding type |
1783 | * before creating a post processor (if no supported encoding type is | 1906 | * before creating a post processor (if no supported encoding type is |
1784 | * set, this function will fail). | 1907 | * set, this function will fail). |
1785 | * | 1908 | * |
@@ -1793,41 +1916,44 @@ const char *MHD_get_response_header (struct MHD_Response *response, | |||
1793 | * performance, use 32 or 64k (i.e. 65536). | 1916 | * performance, use 32 or 64k (i.e. 65536). |
1794 | * @param iter iterator to be called with the parsed data, | 1917 | * @param iter iterator to be called with the parsed data, |
1795 | * Must NOT be NULL. | 1918 | * Must NOT be NULL. |
1796 | * @param iter_cls first argument to iter | 1919 | * @param iter_cls first argument to @a iter |
1797 | * @return NULL on error (out of memory, unsupported encoding), | 1920 | * @return NULL on error (out of memory, unsupported encoding), |
1798 | * otherwise a PP handle | 1921 | * otherwise a PP handle |
1922 | * @ingroup request | ||
1799 | */ | 1923 | */ |
1800 | struct MHD_PostProcessor * | 1924 | struct MHD_PostProcessor * |
1801 | MHD_create_post_processor (struct MHD_Connection *connection, | 1925 | MHD_create_post_processor (struct MHD_Connection *connection, |
1802 | size_t buffer_size, | 1926 | size_t buffer_size, |
1803 | MHD_PostDataIterator iter, void *iter_cls); | 1927 | MHD_PostDataIterator iter, void *iter_cls); |
1804 | 1928 | ||
1929 | |||
1805 | /** | 1930 | /** |
1806 | * Parse and process POST data. | 1931 | * Parse and process POST data. Call this function when POST data is |
1807 | * Call this function when POST data is available | 1932 | * available (usually during an MHD_AccessHandlerCallback) with the |
1808 | * (usually during an MHD_AccessHandlerCallback) | 1933 | * upload_data and upload_data_size. Whenever possible, this will |
1809 | * with the upload_data and upload_data_size. | 1934 | * then cause calls to the MHD_IncrementalKeyValueIterator. |
1810 | * Whenever possible, this will then cause calls | ||
1811 | * to the MHD_IncrementalKeyValueIterator. | ||
1812 | * | 1935 | * |
1813 | * @param pp the post processor | 1936 | * @param pp the post processor |
1814 | * @param post_data post_data_len bytes of POST data | 1937 | * @param post_data @a post_data_len bytes of POST data |
1815 | * @param post_data_len length of post_data | 1938 | * @param post_data_len length of @a post_data |
1816 | * @return MHD_YES on success, MHD_NO on error | 1939 | * @return #MHD_YES on success, #MHD_NO on error |
1817 | * (out-of-memory, iterator aborted, parse error) | 1940 | * (out-of-memory, iterator aborted, parse error) |
1941 | * @ingroup request | ||
1818 | */ | 1942 | */ |
1819 | int | 1943 | int |
1820 | MHD_post_process (struct MHD_PostProcessor *pp, | 1944 | MHD_post_process (struct MHD_PostProcessor *pp, |
1821 | const char *post_data, size_t post_data_len); | 1945 | const char *post_data, size_t post_data_len); |
1822 | 1946 | ||
1947 | |||
1823 | /** | 1948 | /** |
1824 | * Release PostProcessor resources. | 1949 | * Release PostProcessor resources. |
1825 | * | 1950 | * |
1826 | * @param pp the PostProcessor to destroy | 1951 | * @param pp the PostProcessor to destroy |
1827 | * @return MHD_YES if processing completed nicely, | 1952 | * @return #MHD_YES if processing completed nicely, |
1828 | * MHD_NO if there were spurious characters / formatting | 1953 | * #MHD_NO if there were spurious characters / formatting |
1829 | * problems; it is common to ignore the return | 1954 | * problems; it is common to ignore the return |
1830 | * value of this function | 1955 | * value of this function |
1956 | * @ingroup request | ||
1831 | */ | 1957 | */ |
1832 | int | 1958 | int |
1833 | MHD_destroy_post_processor (struct MHD_PostProcessor *pp); | 1959 | MHD_destroy_post_processor (struct MHD_PostProcessor *pp); |
@@ -1839,6 +1965,7 @@ MHD_destroy_post_processor (struct MHD_PostProcessor *pp); | |||
1839 | /** | 1965 | /** |
1840 | * Constant to indicate that the nonce of the provided | 1966 | * Constant to indicate that the nonce of the provided |
1841 | * authentication code was wrong. | 1967 | * authentication code was wrong. |
1968 | * @ingroup authentication | ||
1842 | */ | 1969 | */ |
1843 | #define MHD_INVALID_NONCE -1 | 1970 | #define MHD_INVALID_NONCE -1 |
1844 | 1971 | ||
@@ -1849,6 +1976,7 @@ MHD_destroy_post_processor (struct MHD_PostProcessor *pp); | |||
1849 | * @param connection The MHD connection structure | 1976 | * @param connection The MHD connection structure |
1850 | * @return NULL if no username could be found, a pointer | 1977 | * @return NULL if no username could be found, a pointer |
1851 | * to the username if found | 1978 | * to the username if found |
1979 | * @ingroup authentication | ||
1852 | */ | 1980 | */ |
1853 | char * | 1981 | char * |
1854 | MHD_digest_auth_get_username (struct MHD_Connection *connection); | 1982 | MHD_digest_auth_get_username (struct MHD_Connection *connection); |
@@ -1863,8 +1991,9 @@ MHD_digest_auth_get_username (struct MHD_Connection *connection); | |||
1863 | * @param password The password used in the authentication | 1991 | * @param password The password used in the authentication |
1864 | * @param nonce_timeout The amount of time for a nonce to be | 1992 | * @param nonce_timeout The amount of time for a nonce to be |
1865 | * invalid in seconds | 1993 | * invalid in seconds |
1866 | * @return MHD_YES if authenticated, MHD_NO if not, | 1994 | * @return #MHD_YES if authenticated, #MHD_NO if not, |
1867 | * MHD_INVALID_NONCE if nonce is invalid | 1995 | * #MHD_INVALID_NONCE if nonce is invalid |
1996 | * @ingroup authentication | ||
1868 | */ | 1997 | */ |
1869 | int | 1998 | int |
1870 | MHD_digest_auth_check (struct MHD_Connection *connection, | 1999 | MHD_digest_auth_check (struct MHD_Connection *connection, |
@@ -1883,9 +2012,10 @@ MHD_digest_auth_check (struct MHD_Connection *connection, | |||
1883 | * @param response reply to send; should contain the "access denied" | 2012 | * @param response reply to send; should contain the "access denied" |
1884 | * body; note that this function will set the "WWW Authenticate" | 2013 | * body; note that this function will set the "WWW Authenticate" |
1885 | * header and that the caller should not do this | 2014 | * header and that the caller should not do this |
1886 | * @param signal_stale MHD_YES if the nonce is invalid to add | 2015 | * @param signal_stale #MHD_YES if the nonce is invalid to add |
1887 | * 'stale=true' to the authentication header | 2016 | * 'stale=true' to the authentication header |
1888 | * @return MHD_YES on success, MHD_NO otherwise | 2017 | * @return #MHD_YES on success, #MHD_NO otherwise |
2018 | * @ingroup authentication | ||
1889 | */ | 2019 | */ |
1890 | int | 2020 | int |
1891 | MHD_queue_auth_fail_response (struct MHD_Connection *connection, | 2021 | MHD_queue_auth_fail_response (struct MHD_Connection *connection, |
@@ -1902,6 +2032,7 @@ MHD_queue_auth_fail_response (struct MHD_Connection *connection, | |||
1902 | * @param password a pointer for the password | 2032 | * @param password a pointer for the password |
1903 | * @return NULL if no username could be found, a pointer | 2033 | * @return NULL if no username could be found, a pointer |
1904 | * to the username if found | 2034 | * to the username if found |
2035 | * @ingroup authentication | ||
1905 | */ | 2036 | */ |
1906 | char * | 2037 | char * |
1907 | MHD_basic_auth_get_username_password (struct MHD_Connection *connection, | 2038 | MHD_basic_auth_get_username_password (struct MHD_Connection *connection, |
@@ -1916,7 +2047,8 @@ MHD_basic_auth_get_username_password (struct MHD_Connection *connection, | |||
1916 | * @param connection The MHD connection structure | 2047 | * @param connection The MHD connection structure |
1917 | * @param realm the realm presented to the client | 2048 | * @param realm the realm presented to the client |
1918 | * @param response response object to modify and queue | 2049 | * @param response response object to modify and queue |
1919 | * @return MHD_YES on success, MHD_NO otherwise | 2050 | * @return #MHD_YES on success, #MHD_NO otherwise |
2051 | * @ingroup authentication | ||
1920 | */ | 2052 | */ |
1921 | int | 2053 | int |
1922 | MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection, | 2054 | MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection, |
@@ -1933,41 +2065,49 @@ union MHD_ConnectionInfo | |||
1933 | 2065 | ||
1934 | /** | 2066 | /** |
1935 | * Cipher algorithm used, of type "enum gnutls_cipher_algorithm". | 2067 | * Cipher algorithm used, of type "enum gnutls_cipher_algorithm". |
2068 | * @ingroup tls | ||
1936 | */ | 2069 | */ |
1937 | int /* enum gnutls_cipher_algorithm */ cipher_algorithm; | 2070 | int /* enum gnutls_cipher_algorithm */ cipher_algorithm; |
1938 | 2071 | ||
1939 | /** | 2072 | /** |
1940 | * Protocol used, of type "enum gnutls_protocol". | 2073 | * Protocol used, of type "enum gnutls_protocol". |
2074 | * @ingroup tls | ||
1941 | */ | 2075 | */ |
1942 | int /* enum gnutls_protocol */ protocol; | 2076 | int /* enum gnutls_protocol */ protocol; |
1943 | 2077 | ||
1944 | /** | 2078 | /** |
1945 | * Connect socket | 2079 | * Connect socket |
2080 | * @ingroup networking | ||
1946 | */ | 2081 | */ |
1947 | int connect_fd; | 2082 | int connect_fd; |
1948 | 2083 | ||
1949 | /** | 2084 | /** |
1950 | * GNUtls session handle, of type "gnutls_session_t". | 2085 | * GNUtls session handle, of type "gnutls_session_t". |
2086 | * @ingroup tls | ||
1951 | */ | 2087 | */ |
1952 | void * /* gnutls_session_t */ tls_session; | 2088 | void * /* gnutls_session_t */ tls_session; |
1953 | 2089 | ||
1954 | /** | 2090 | /** |
1955 | * GNUtls client certificate handle, of type "gnutls_x509_crt_t". | 2091 | * GNUtls client certificate handle, of type "gnutls_x509_crt_t". |
2092 | * @ingroup tls | ||
1956 | */ | 2093 | */ |
1957 | void * /* gnutls_x509_crt_t */ client_cert; | 2094 | void * /* gnutls_x509_crt_t */ client_cert; |
1958 | 2095 | ||
1959 | /** | 2096 | /** |
1960 | * Address information for the client. | 2097 | * Address information for the client. |
2098 | * @ingroup networking | ||
1961 | */ | 2099 | */ |
1962 | struct sockaddr *client_addr; | 2100 | struct sockaddr *client_addr; |
1963 | 2101 | ||
1964 | /** | 2102 | /** |
1965 | * Which daemon manages this connection (useful in case there are many | 2103 | * Which daemon manages this connection (useful in case there are many |
1966 | * daemons running). | 2104 | * daemons running). |
2105 | * @ingroup specialized | ||
1967 | */ | 2106 | */ |
1968 | struct MHD_Daemon *daemon; | 2107 | struct MHD_Daemon *daemon; |
1969 | }; | 2108 | }; |
1970 | 2109 | ||
2110 | |||
1971 | /** | 2111 | /** |
1972 | * Obtain information about the given connection. | 2112 | * Obtain information about the given connection. |
1973 | * | 2113 | * |
@@ -1976,6 +2116,7 @@ union MHD_ConnectionInfo | |||
1976 | * @param ... depends on infoType | 2116 | * @param ... depends on infoType |
1977 | * @return NULL if this information is not available | 2117 | * @return NULL if this information is not available |
1978 | * (or if the infoType is unknown) | 2118 | * (or if the infoType is unknown) |
2119 | * @ingroup specialized | ||
1979 | */ | 2120 | */ |
1980 | const union MHD_ConnectionInfo * | 2121 | const union MHD_ConnectionInfo * |
1981 | MHD_get_connection_info (struct MHD_Connection *connection, | 2122 | MHD_get_connection_info (struct MHD_Connection *connection, |
@@ -1984,8 +2125,9 @@ MHD_get_connection_info (struct MHD_Connection *connection, | |||
1984 | 2125 | ||
1985 | 2126 | ||
1986 | /** | 2127 | /** |
1987 | * MHD connection options. Given to 'MHD_set_connection_option' to | 2128 | * MHD connection options. Given to #MHD_set_connection_option to |
1988 | * set custom options for a particular connection. | 2129 | * set custom options for a particular connection. |
2130 | * @ingroup specialized | ||
1989 | */ | 2131 | */ |
1990 | enum MHD_CONNECTION_OPTION | 2132 | enum MHD_CONNECTION_OPTION |
1991 | { | 2133 | { |
@@ -1994,6 +2136,7 @@ enum MHD_CONNECTION_OPTION | |||
1994 | * Set a custom timeout for the given connection. Specified | 2136 | * Set a custom timeout for the given connection. Specified |
1995 | * as the number of seconds, given as an 'unsigned int'. Use | 2137 | * as the number of seconds, given as an 'unsigned int'. Use |
1996 | * zero for no timeout. | 2138 | * zero for no timeout. |
2139 | * @ingroup limits | ||
1997 | */ | 2140 | */ |
1998 | MHD_CONNECTION_OPTION_TIMEOUT | 2141 | MHD_CONNECTION_OPTION_TIMEOUT |
1999 | 2142 | ||
@@ -2006,7 +2149,8 @@ enum MHD_CONNECTION_OPTION | |||
2006 | * @param connection connection to modify | 2149 | * @param connection connection to modify |
2007 | * @param option option to set | 2150 | * @param option option to set |
2008 | * @param ... arguments to the option, depending on the option type | 2151 | * @param ... arguments to the option, depending on the option type |
2009 | * @return MHD_YES on success, MHD_NO if setting the option failed | 2152 | * @return #MHD_YES on success, #MHD_NO if setting the option failed |
2153 | * @ingroup specialized | ||
2010 | */ | 2154 | */ |
2011 | int | 2155 | int |
2012 | MHD_set_connection_option (struct MHD_Connection *connection, | 2156 | MHD_set_connection_option (struct MHD_Connection *connection, |
@@ -2016,25 +2160,30 @@ MHD_set_connection_option (struct MHD_Connection *connection, | |||
2016 | 2160 | ||
2017 | /** | 2161 | /** |
2018 | * Information about an MHD daemon. | 2162 | * Information about an MHD daemon. |
2163 | * @ingroup specialized | ||
2019 | */ | 2164 | */ |
2020 | union MHD_DaemonInfo | 2165 | union MHD_DaemonInfo |
2021 | { | 2166 | { |
2022 | /** | 2167 | /** |
2023 | * Size of the key (unit??) | 2168 | * Size of the key (unit??) |
2169 | * @ingroup tls | ||
2024 | */ | 2170 | */ |
2025 | size_t key_size; | 2171 | size_t key_size; |
2026 | 2172 | ||
2027 | /** | 2173 | /** |
2028 | * Size of the mac key (unit??) | 2174 | * Size of the mac key (unit??) |
2175 | * @ingroup tls | ||
2029 | */ | 2176 | */ |
2030 | size_t mac_key_size; | 2177 | size_t mac_key_size; |
2031 | 2178 | ||
2032 | /** | 2179 | /** |
2033 | * Listen socket file descriptor | 2180 | * Listen socket file descriptor |
2181 | * @ingroup networking | ||
2034 | */ | 2182 | */ |
2035 | int listen_fd; | 2183 | int listen_fd; |
2036 | }; | 2184 | }; |
2037 | 2185 | ||
2186 | |||
2038 | /** | 2187 | /** |
2039 | * Obtain information about the given daemon | 2188 | * Obtain information about the given daemon |
2040 | * (not fully implemented!). | 2189 | * (not fully implemented!). |
@@ -2044,6 +2193,7 @@ union MHD_DaemonInfo | |||
2044 | * @param ... depends on infoType | 2193 | * @param ... depends on infoType |
2045 | * @return NULL if this information is not available | 2194 | * @return NULL if this information is not available |
2046 | * (or if the infoType is unknown) | 2195 | * (or if the infoType is unknown) |
2196 | * @ingroup specialized | ||
2047 | */ | 2197 | */ |
2048 | const union MHD_DaemonInfo * | 2198 | const union MHD_DaemonInfo * |
2049 | MHD_get_daemon_info (struct MHD_Daemon *daemon, | 2199 | MHD_get_daemon_info (struct MHD_Daemon *daemon, |
@@ -2055,10 +2205,12 @@ MHD_get_daemon_info (struct MHD_Daemon *daemon, | |||
2055 | * Obtain the version of this library | 2205 | * Obtain the version of this library |
2056 | * | 2206 | * |
2057 | * @return static version string, e.g. "0.9.9" | 2207 | * @return static version string, e.g. "0.9.9" |
2208 | * @ingroup specialized | ||
2058 | */ | 2209 | */ |
2059 | const char* | 2210 | const char* |
2060 | MHD_get_version (void); | 2211 | MHD_get_version (void); |
2061 | 2212 | ||
2213 | |||
2062 | #if 0 /* keep Emacsens' auto-indent happy */ | 2214 | #if 0 /* keep Emacsens' auto-indent happy */ |
2063 | { | 2215 | { |
2064 | #endif | 2216 | #endif |