aboutsummaryrefslogtreecommitdiff
path: root/src/include/microhttpd.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/microhttpd.h')
-rw-r--r--src/include/microhttpd.h82
1 files changed, 80 insertions, 2 deletions
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index d09c66a9..3a46c085 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -84,7 +84,7 @@ extern "C"
84/** 84/**
85 * Current version of the library. 85 * Current version of the library.
86 */ 86 */
87#define MHD_VERSION 0x00000003 87#define MHD_VERSION 0x00000004
88 88
89/** 89/**
90 * MHD-internal return codes. 90 * MHD-internal return codes.
@@ -319,6 +319,20 @@ enum MHD_OPTION
319 */ 319 */
320 MHD_OPTION_CONNECTION_TIMEOUT = 3, 320 MHD_OPTION_CONNECTION_TIMEOUT = 3,
321 321
322 /**
323 * Register a function that should be called whenever a request has
324 * been completed (this can be used for application-specific clean
325 * up). Requests that have never been presented to the application
326 * (via MHD_AccessHandlerCallback) will not result in
327 * notifications.<p>
328 *
329 * This option should be followed by TWO pointers. First a pointer
330 * to a function of type "MHD_RequestCompletedCallback" and second a
331 * pointer to a closure to pass to the request completed callback.
332 * The second pointer maybe NULL.
333 */
334 MHD_OPTION_NOTIFY_COMPLETED = 4,
335
322}; 336};
323 337
324/** 338/**
@@ -362,6 +376,40 @@ enum MHD_ValueKind
362}; 376};
363 377
364/** 378/**
379 * The MHD_RequestTerminationCode specifies reasons
380 * why a request has been terminated (or completed).
381 */
382enum MHD_RequestTerminationCode
383{
384
385 /**
386 * We finished sending the response.
387 */
388 MHD_REQUEST_TERMINATED_COMPLETED_OK = 0,
389
390 /**
391 * Error handling the connection (resources
392 * exhausted, other side closed connection,
393 * application error accepting request, etc.)
394 */
395 MHD_REQUEST_TERMINATED_WITH_ERROR = 1,
396
397 /**
398 * No activity on the connection for the number
399 * of seconds specified using
400 * MHD_OPTION_CONNECTION_TIMEOUT.
401 */
402 MHD_REQUEST_TERMINATED_TIMEOUT_REACHED = 2,
403
404 /**
405 * We had to close the session since MHD was being
406 * shut down.
407 */
408 MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN = 3,
409
410};
411
412/**
365 * Handle for the daemon (listening on a socket for HTTP traffic). 413 * Handle for the daemon (listening on a socket for HTTP traffic).
366 */ 414 */
367struct MHD_Daemon; 415struct MHD_Daemon;
@@ -398,6 +446,8 @@ typedef int
398 * callbacks to provide content to give back to the client and return 446 * callbacks to provide content to give back to the client and return
399 * an HTTP status code (i.e. 200 for OK, 404, etc.). 447 * an HTTP status code (i.e. 200 for OK, 404, etc.).
400 * 448 *
449 * @param cls argument given together with the function
450 * pointer when the handler was registered with MHD
401 * @param url the requested url 451 * @param url the requested url
402 * @param method the HTTP method used ("GET", "PUT", etc.) 452 * @param method the HTTP method used ("GET", "PUT", etc.)
403 * @param version the HTTP version string (i.e. "HTTP/1.1") 453 * @param version the HTTP version string (i.e. "HTTP/1.1")
@@ -411,6 +461,16 @@ typedef int
411 * @param upload_data_size set initially to the size of the 461 * @param upload_data_size set initially to the size of the
412 * upload_data provided; the method must update this 462 * upload_data provided; the method must update this
413 * value to the number of bytes NOT processed; 463 * value to the number of bytes NOT processed;
464 * @param con_cls pointer that the callback can set to some
465 * address and that will be preserved by MHD for future
466 * calls for this request; since the access handler may
467 * be called many times (i.e., for a PUT/POST operation
468 * with plenty of upload data) this allows the application
469 * to easily associate some request-specific state.
470 * If necessary, this state can be cleaned up in the
471 * global "MHD_RequestCompleted" callback (which
472 * can be set with the MHD_OPTION_NOTIFY_COMPLETED).
473 * Initially, <tt>*con_cls</tt> will be NULL.
414 * @return MHS_YES if the connection was handled successfully, 474 * @return MHS_YES if the connection was handled successfully,
415 * MHS_NO if the socket must be closed due to a serios 475 * MHS_NO if the socket must be closed due to a serios
416 * error while handling the request 476 * error while handling the request
@@ -422,7 +482,25 @@ typedef int
422 const char *method, 482 const char *method,
423 const char *version, 483 const char *version,
424 const char *upload_data, 484 const char *upload_data,
425 unsigned int *upload_data_size); 485 unsigned int *upload_data_size,
486 void ** con_cls);
487
488/**
489 * Signature of the callback used by MHD to notify the
490 * application about completed requests.
491 *
492 * @param cls client-defined closure
493 * @param connection connection handle
494 * @param con_cls value as set by the last call to
495 * the MHD_AccessHandlerCallback
496 * @param toe reason for request termination
497 * @see MHD_OPTION_NOTIFY_COMPLETED
498 */
499typedef void
500 (*MHD_RequestCompletedCallback) (void *cls,
501 struct MHD_Connection * connection,
502 void ** con_cls,
503 enum MHD_RequestTerminationCode toe);
426 504
427/** 505/**
428 * Iterator over key-value pairs. This iterator 506 * Iterator over key-value pairs. This iterator