microhttpd.h File Reference

public interface to libmicrohttpd More...

#include <sys/types.h>
#include <sys/select.h>
#include <sys/socket.h>

Include dependency graph for microhttpd.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define MHD_VERSION   0x00030000
#define MHD_YES   1
#define MHD_NO   0
#define MHD_HTTP_CONTINUE   100
#define MHD_HTTP_SWITCHING_PROTOCOLS   101
#define MHD_HTTP_PROCESSING   102
#define MHD_HTTP_OK   200
#define MHD_HTTP_CREATED   201
#define MHD_HTTP_ACCEPTED   202
#define MHD_HTTP_NON_AUTHORITATIVE_INFORMATION   203
#define MHD_HTTP_NO_CONTENT   204
#define MHD_HTTP_RESET_CONTENT   205
#define MHD_HTTP_PARTIAL_CONTENT   206
#define MHD_HTTP_MULTI_STATUS   207
#define MHD_HTTP_MULTIPLE_CHOICES   300
#define MHD_HTTP_MOVED_PERMANENTLY   301
#define MHD_HTTP_FOUND   302
#define MHD_HTTP_SEE_OTHER   303
#define MHD_HTTP_NOT_MODIFIED   304
#define MHD_HTTP_USE_PROXY   305
#define MHD_HTTP_SWITCH_PROXY   306
#define MHD_HTTP_TEMPORARY_REDIRECT   307
#define MHD_HTTP_BAD_REQUEST   400
#define MHD_HTTP_UNAUTHORIZED   401
#define MHD_HTTP_PAYMENT_REQUIRED   402
#define MHD_HTTP_FORBIDDEN   403
#define MHD_HTTP_NOT_FOUND   404
#define MHD_HTTP_METHOD_NOT_ALLOWED   405
#define MHD_HTTP_METHOD_NOT_ACCEPTABLE   406
#define MHD_HTTP_PROXY_AUTHENTICATION_REQUIRED   407
#define MHD_HTTP_REQUEST_TIMEOUT   408
#define MHD_HTTP_CONFLICT   409
#define MHD_HTTP_GONE   410
#define MHD_HTTP_LENGTH_REQUIRED   411
#define MHD_HTTP_PRECONDITION_FAILED   412
#define MHD_HTTP_REQUEST_ENTITY_TOO_LARGE   413
#define MHD_HTTP_REQUEST_URI_TOO_LONG   414
#define MHD_HTTP_UNSUPPORTED_MEDIA_TYPE   415
#define MHD_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE   416
#define MHD_HTTP_EXPECTATION_FAILED   417
#define MHD_HTTP_UNPROCESSABLE_ENTITY   422
#define MHD_HTTP_LOCKED   423
#define MHD_HTTP_FAILED_DEPENDENCY   424
#define MHD_HTTP_UNORDERED_COLLECTION   425
#define MHD_HTTP_UPGRADE_REQUIRED   426
#define MHD_HTTP_RETRY_WITH   449
#define MHD_HTTP_INTERNAL_SERVER_ERROR   500
#define MHD_HTTP_NOT_IMPLEMENTED   501
#define MHD_HTTP_BAD_GATEWAY   502
#define MHD_HTTP_SERVICE_UNAVAILABLE   503
#define MHD_HTTP_GATEWAY_TIMEOUT   504
#define MHD_HTTP_HTTP_VERSION_NOT_SUPPORTED   505
#define MHD_HTTP_VARIANT_ALSO_NEGOTIATES   506
#define MHD_HTTP_INSUFFICIENT_STORAGE   507
#define MHD_HTTP_BANDWIDTH_LIMIT_EXCEEDED   509
#define MHD_HTTP_NOT_EXTENDED   510
#define MHD_HTTP_HEADER_ACCEPT   "Accept"
#define MHD_HTTP_HEADER_ACCEPT_CHARSET   "Accept-Charset"
#define MHD_HTTP_HEADER_ACCEPT_ENCODING   "Accept-Encoding"
#define MHD_HTTP_HEADER_ACCEPT_LANGUAGE   "Accept-Language"
#define MHD_HTTP_HEADER_ACCEPT_RANGES   "Accept-Ranges"
#define MHD_HTTP_HEADER_AGE   "Age"
#define MHD_HTTP_HEADER_ALLOW   "Allow"
#define MHD_HTTP_HEADER_AUTHORIZATION   "Authorization"
#define MHD_HTTP_HEADER_CACHE_CONTROL   "Cache-Control"
#define MHD_HTTP_HEADER_CONNECTION   "Connection"
#define MHD_HTTP_HEADER_CONTENT_ENCODING   "Content-Encoding"
#define MHD_HTTP_HEADER_CONTENT_LANGUAGE   "Content-Language"
#define MHD_HTTP_HEADER_CONTENT_LENGTH   "Content-Length"
#define MHD_HTTP_HEADER_CONTENT_LOCATION   "Content-Location"
#define MHD_HTTP_HEADER_CONTENT_MD5   "Content-MD5"
#define MHD_HTTP_HEADER_CONTENT_RANGE   "Content-Range"
#define MHD_HTTP_HEADER_CONTENT_TYPE   "Content-Type"
#define MHD_HTTP_HEADER_DATE   "Date"
#define MHD_HTTP_HEADER_ETAG   "ETag"
#define MHD_HTTP_HEADER_EXPECT   "Expect"
#define MHD_HTTP_HEADER_EXPIRES   "Expires"
#define MHD_HTTP_HEADER_FROM   "From"
#define MHD_HTTP_HEADER_HOST   "Host"
#define MHD_HTTP_HEADER_IF_MATCH   "If-Match"
#define MHD_HTTP_HEADER_IF_MODIFIED_SINCE   "If-Modified-Since"
#define MHD_HTTP_HEADER_IF_NONE_MATCH   "If-None-Match"
#define MHD_HTTP_HEADER_IF_RANGE   "If-Range"
#define MHD_HTTP_HEADER_IF_UNMODIFIED_SINCE   "If-Unmodified-Since"
#define MHD_HTTP_HEADER_LAST_MODIFIED   "Last-Modified"
#define MHD_HTTP_HEADER_LOCATION   "Location"
#define MHD_HTTP_HEADER_MAX_FORWARDS   "Max-Forwards"
#define MHD_HTTP_HEADER_PRAGMA   "Pragma"
#define MHD_HTTP_HEADER_PROXY_AUTHENTICATE   "Proxy-Authenticate"
#define MHD_HTTP_HEADER_PROXY_AUTHORIZATION   "Proxy-Authorization"
#define MHD_HTTP_HEADER_RANGE   "Range"
#define MHD_HTTP_HEADER_REFERER   "Referer"
#define MHD_HTTP_HEADER_RETRY_AFTER   "Retry-After"
#define MHD_HTTP_HEADER_SERVER   "Server"
#define MHD_HTTP_HEADER_TE   "TE"
#define MHD_HTTP_HEADER_TRAILER   "Trailer"
#define MHD_HTTP_HEADER_TRANSFER_ENCODING   "Transfer-Encoding"
#define MHD_HTTP_HEADER_UPGRADE   "Upgrade"
#define MHD_HTTP_HEADER_USER_AGENT   "User-Agent"
#define MHD_HTTP_HEADER_VARY   "Vary"
#define MHD_HTTP_HEADER_VIA   "Via"
#define MHD_HTTP_HEADER_WARNING   "Warning"
#define MHD_HTTP_HEADER_WWW_AUTHENTICATE   "WWW-Authenticate"
#define MHD_HTTP_VERSION_1_0   "HTTP/1.0"
#define MHD_HTTP_VERSION_1_1   "HTTP/1.1"
#define MHD_HTTP_METHOD_CONNECT   "CONNECT"
#define MHD_HTTP_METHOD_DELETE   "DELETE"
#define MHD_HTTP_METHOD_GET   "GET"
#define MHD_HTTP_METHOD_HEAD   "HEAD"
#define MHD_HTTP_METHOD_OPTIONS   "OPTIONS"
#define MHD_HTTP_METHOD_POST   "POST"
#define MHD_HTTP_METHOD_PUT   "PUT"
#define MHD_HTTP_METHOD_TRACE   "TRACE"
#define MHD_HTTP_POST_ENCODING_FORM_URLENCODED   "application/x-www-form-urlencoded"
#define MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA   "multipart/form-data"

Typedefs

typedef int(* MHD_AcceptPolicyCallback )(void *cls, const struct sockaddr *addr, socklen_t addrlen)
typedef int(* MHD_AccessHandlerCallback )(void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, unsigned int *upload_data_size, void **con_cls)
typedef void(* MHD_RequestCompletedCallback )(void *cls, struct MHD_Connection *connection, void **con_cls, enum MHD_RequestTerminationCode toe)
typedef int(* MHD_KeyValueIterator )(void *cls, enum MHD_ValueKind kind, const char *key, const char *value)
typedef int(* MHD_ContentReaderCallback )(void *cls, size_t pos, char *buf, int max)
typedef void(* MHD_ContentReaderFreeCallback )(void *cls)
typedef int(* MHD_PostDataIterator )(void *cls, enum MHD_ValueKind kind, const char *key, const char *filename, const char *content_type, const char *transfer_encoding, const char *data, size_t off, size_t size)

Enumerations

enum  MHD_FLAG {
  MHD_NO_FLAG = 0, MHD_USE_DEBUG = 1, MHD_USE_SSL = 2, MHD_USE_THREAD_PER_CONNECTION = 4,
  MHD_USE_SELECT_INTERNALLY = 8, MHD_USE_IPv6 = 16, MHD_USE_PEDANTIC_CHECKS = 32
}
enum  MHD_OPTION {
  MHD_OPTION_END = 0, MHD_OPTION_CONNECTION_MEMORY_LIMIT = 1, MHD_OPTION_CONNECTION_LIMIT = 2, MHD_OPTION_CONNECTION_TIMEOUT = 3,
  MHD_OPTION_NOTIFY_COMPLETED = 4, MHD_OPTION_PER_IP_CONNECTION_LIMIT = 5
}
enum  MHD_ValueKind {
  MHD_RESPONSE_HEADER_KIND = 0, MHD_HEADER_KIND = 1, MHD_COOKIE_KIND = 2, MHD_POSTDATA_KIND = 4,
  MHD_GET_ARGUMENT_KIND = 8, MHD_FOOTER_KIND = 16
}
enum  MHD_RequestTerminationCode { MHD_REQUEST_TERMINATED_COMPLETED_OK = 0, MHD_REQUEST_TERMINATED_WITH_ERROR = 1, MHD_REQUEST_TERMINATED_TIMEOUT_REACHED = 2, MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN = 3 }

Functions

struct MHD_DaemonMHD_start_daemon (unsigned int flags, unsigned short port, MHD_AcceptPolicyCallback apc, void *apc_cls, MHD_AccessHandlerCallback dh, void *dh_cls,...)
void MHD_stop_daemon (struct MHD_Daemon *daemon)
int MHD_get_fdset (struct MHD_Daemon *daemon, fd_set *read_fd_set, fd_set *write_fd_set, fd_set *except_fd_set, int *max_fd)
int MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout)
int MHD_run (struct MHD_Daemon *daemon)
int MHD_get_connection_values (struct MHD_Connection *connection, enum MHD_ValueKind kind, MHD_KeyValueIterator iterator, void *iterator_cls)
const char * MHD_lookup_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key)
int MHD_queue_response (struct MHD_Connection *connection, unsigned int status_code, struct MHD_Response *response)
struct MHD_ResponseMHD_create_response_from_callback (size_t size, unsigned int block_size, MHD_ContentReaderCallback crc, void *crc_cls, MHD_ContentReaderFreeCallback crfc)
struct MHD_ResponseMHD_create_response_from_data (size_t size, void *data, int must_free, int must_copy)
void MHD_destroy_response (struct MHD_Response *response)
int MHD_add_response_header (struct MHD_Response *response, const char *header, const char *content)
int MHD_del_response_header (struct MHD_Response *response, const char *header, const char *content)
int MHD_get_response_headers (struct MHD_Response *response, MHD_KeyValueIterator iterator, void *iterator_cls)
const char * MHD_get_response_header (struct MHD_Response *response, const char *key)
struct MHD_PostProcessor * MHD_create_post_processor (struct MHD_Connection *connection, unsigned int buffer_size, MHD_PostDataIterator iter, void *cls)
int MHD_post_process (struct MHD_PostProcessor *pp, const char *post_data, unsigned int post_data_len)
int MHD_destroy_post_processor (struct MHD_PostProcessor *pp)


Detailed Description

public interface to libmicrohttpd

Author:
Christian Grothoff

Chris GauthierDickey

All symbols defined in this header start with MHD. MHD is a small HTTP daemon library. As such, it does not have any API for logging errors (you can only enable or disable logging to stderr). Also, it may not support all of the HTTP features directly, where applicable, portions of HTTP may have to be handled by clients of the library.

The library is supposed to handle everything that it must handle (because the API would not allow clients to do this), such as basic connection management; however, detailed interpretations of headers -- such as range requests -- and HTTP methods are left to clients. The library does understand HEAD and will only send the headers of the response and not the body, even if the client supplied a body. The library also understands headers that control connection management (specifically, "Connection: close" and "Expect: 100 continue" are understood and handled automatically).

MHD understands POST data and is able to decode certain formats (at the moment only "application/x-www-form-urlencoded") if the entire data fits into the allowed amount of memory for the connection. Unsupported encodings and large POST submissions are provided as a stream to the main application (and thus can be processed, just not conveniently by MHD).

The header file defines various constants used by the HTTP protocol. This does not mean that MHD actually interprets all of these values. The provided constants are exported as a convenience for users of the library. MHD does not verify that transmitted HTTP headers are part of the standard specification; users of the library are free to define their own extensions of the HTTP standard and use those with MHD.

All functions are guaranteed to be completely reentrant and thread-safe.

TODO:

Definition in file microhttpd.h.


Define Documentation

#define MHD_HTTP_ACCEPTED   202

Definition at line 105 of file microhttpd.h.

#define MHD_HTTP_BAD_GATEWAY   502

Definition at line 148 of file microhttpd.h.

#define MHD_HTTP_BAD_REQUEST   400

#define MHD_HTTP_BANDWIDTH_LIMIT_EXCEEDED   509

Definition at line 154 of file microhttpd.h.

#define MHD_HTTP_CONFLICT   409

Definition at line 130 of file microhttpd.h.

#define MHD_HTTP_CONTINUE   100

HTTP response codes.

Definition at line 99 of file microhttpd.h.

#define MHD_HTTP_CREATED   201

Definition at line 104 of file microhttpd.h.

#define MHD_HTTP_EXPECTATION_FAILED   417

Definition at line 138 of file microhttpd.h.

#define MHD_HTTP_FAILED_DEPENDENCY   424

Definition at line 141 of file microhttpd.h.

#define MHD_HTTP_FORBIDDEN   403

Definition at line 124 of file microhttpd.h.

#define MHD_HTTP_FOUND   302

Definition at line 114 of file microhttpd.h.

#define MHD_HTTP_GATEWAY_TIMEOUT   504

Definition at line 150 of file microhttpd.h.

#define MHD_HTTP_GONE   410

Definition at line 131 of file microhttpd.h.

#define MHD_HTTP_HEADER_ACCEPT   "Accept"

Definition at line 158 of file microhttpd.h.

#define MHD_HTTP_HEADER_ACCEPT_CHARSET   "Accept-Charset"

Definition at line 159 of file microhttpd.h.

#define MHD_HTTP_HEADER_ACCEPT_ENCODING   "Accept-Encoding"

Definition at line 160 of file microhttpd.h.

#define MHD_HTTP_HEADER_ACCEPT_LANGUAGE   "Accept-Language"

Definition at line 161 of file microhttpd.h.

#define MHD_HTTP_HEADER_ACCEPT_RANGES   "Accept-Ranges"

Definition at line 162 of file microhttpd.h.

#define MHD_HTTP_HEADER_AGE   "Age"

Definition at line 163 of file microhttpd.h.

#define MHD_HTTP_HEADER_ALLOW   "Allow"

Definition at line 164 of file microhttpd.h.

#define MHD_HTTP_HEADER_AUTHORIZATION   "Authorization"

Definition at line 165 of file microhttpd.h.

#define MHD_HTTP_HEADER_CACHE_CONTROL   "Cache-Control"

Definition at line 166 of file microhttpd.h.

#define MHD_HTTP_HEADER_CONNECTION   "Connection"

Definition at line 167 of file microhttpd.h.

Referenced by add_extra_headers(), and MHD_connection_handle_idle().

#define MHD_HTTP_HEADER_CONTENT_ENCODING   "Content-Encoding"

Definition at line 168 of file microhttpd.h.

#define MHD_HTTP_HEADER_CONTENT_LANGUAGE   "Content-Language"

Definition at line 169 of file microhttpd.h.

#define MHD_HTTP_HEADER_CONTENT_LENGTH   "Content-Length"

Definition at line 170 of file microhttpd.h.

Referenced by add_extra_headers(), and parse_connection_headers().

#define MHD_HTTP_HEADER_CONTENT_LOCATION   "Content-Location"

Definition at line 171 of file microhttpd.h.

#define MHD_HTTP_HEADER_CONTENT_MD5   "Content-MD5"

Definition at line 172 of file microhttpd.h.

#define MHD_HTTP_HEADER_CONTENT_RANGE   "Content-Range"

Definition at line 173 of file microhttpd.h.

#define MHD_HTTP_HEADER_CONTENT_TYPE   "Content-Type"

Definition at line 174 of file microhttpd.h.

Referenced by MHD_create_post_processor(), and test_simple_large().

#define MHD_HTTP_HEADER_DATE   "Date"

Definition at line 175 of file microhttpd.h.

Referenced by build_header_response().

#define MHD_HTTP_HEADER_ETAG   "ETag"

Definition at line 176 of file microhttpd.h.

#define MHD_HTTP_HEADER_EXPECT   "Expect"

Definition at line 177 of file microhttpd.h.

Referenced by need_100_continue().

#define MHD_HTTP_HEADER_EXPIRES   "Expires"

Definition at line 178 of file microhttpd.h.

#define MHD_HTTP_HEADER_FROM   "From"

Definition at line 179 of file microhttpd.h.

#define MHD_HTTP_HEADER_HOST   "Host"

Definition at line 180 of file microhttpd.h.

Referenced by parse_connection_headers().

#define MHD_HTTP_HEADER_IF_MATCH   "If-Match"

Definition at line 181 of file microhttpd.h.

#define MHD_HTTP_HEADER_IF_MODIFIED_SINCE   "If-Modified-Since"

Definition at line 182 of file microhttpd.h.

#define MHD_HTTP_HEADER_IF_NONE_MATCH   "If-None-Match"

Definition at line 183 of file microhttpd.h.

#define MHD_HTTP_HEADER_IF_RANGE   "If-Range"

Definition at line 184 of file microhttpd.h.

#define MHD_HTTP_HEADER_IF_UNMODIFIED_SINCE   "If-Unmodified-Since"

Definition at line 185 of file microhttpd.h.

#define MHD_HTTP_HEADER_LAST_MODIFIED   "Last-Modified"

Definition at line 186 of file microhttpd.h.

#define MHD_HTTP_HEADER_LOCATION   "Location"

Definition at line 187 of file microhttpd.h.

#define MHD_HTTP_HEADER_MAX_FORWARDS   "Max-Forwards"

Definition at line 188 of file microhttpd.h.

#define MHD_HTTP_HEADER_PRAGMA   "Pragma"

Definition at line 189 of file microhttpd.h.

#define MHD_HTTP_HEADER_PROXY_AUTHENTICATE   "Proxy-Authenticate"

Definition at line 190 of file microhttpd.h.

#define MHD_HTTP_HEADER_PROXY_AUTHORIZATION   "Proxy-Authorization"

Definition at line 191 of file microhttpd.h.

#define MHD_HTTP_HEADER_RANGE   "Range"

Definition at line 192 of file microhttpd.h.

#define MHD_HTTP_HEADER_REFERER   "Referer"

Definition at line 193 of file microhttpd.h.

#define MHD_HTTP_HEADER_RETRY_AFTER   "Retry-After"

Definition at line 194 of file microhttpd.h.

#define MHD_HTTP_HEADER_SERVER   "Server"

Definition at line 195 of file microhttpd.h.

#define MHD_HTTP_HEADER_TE   "TE"

Definition at line 196 of file microhttpd.h.

#define MHD_HTTP_HEADER_TRAILER   "Trailer"

Definition at line 197 of file microhttpd.h.

#define MHD_HTTP_HEADER_TRANSFER_ENCODING   "Transfer-Encoding"

Definition at line 198 of file microhttpd.h.

Referenced by add_extra_headers(), and parse_connection_headers().

#define MHD_HTTP_HEADER_UPGRADE   "Upgrade"

Definition at line 199 of file microhttpd.h.

#define MHD_HTTP_HEADER_USER_AGENT   "User-Agent"

Definition at line 200 of file microhttpd.h.

#define MHD_HTTP_HEADER_VARY   "Vary"

Definition at line 201 of file microhttpd.h.

#define MHD_HTTP_HEADER_VIA   "Via"

Definition at line 202 of file microhttpd.h.

#define MHD_HTTP_HEADER_WARNING   "Warning"

Definition at line 203 of file microhttpd.h.

#define MHD_HTTP_HEADER_WWW_AUTHENTICATE   "WWW-Authenticate"

Definition at line 204 of file microhttpd.h.

#define MHD_HTTP_HTTP_VERSION_NOT_SUPPORTED   505

Definition at line 151 of file microhttpd.h.

#define MHD_HTTP_INSUFFICIENT_STORAGE   507

Definition at line 153 of file microhttpd.h.

#define MHD_HTTP_INTERNAL_SERVER_ERROR   500

Definition at line 146 of file microhttpd.h.

Referenced by MHD_connection_get_fdset().

#define MHD_HTTP_LENGTH_REQUIRED   411

Definition at line 132 of file microhttpd.h.

#define MHD_HTTP_LOCKED   423

Definition at line 140 of file microhttpd.h.

#define MHD_HTTP_METHOD_CONNECT   "CONNECT"

HTTP methods

Definition at line 216 of file microhttpd.h.

#define MHD_HTTP_METHOD_DELETE   "DELETE"

Definition at line 217 of file microhttpd.h.

#define MHD_HTTP_METHOD_GET   "GET"

Definition at line 218 of file microhttpd.h.

#define MHD_HTTP_METHOD_HEAD   "HEAD"

Definition at line 219 of file microhttpd.h.

Referenced by MHD_queue_response().

#define MHD_HTTP_METHOD_NOT_ACCEPTABLE   406

Definition at line 127 of file microhttpd.h.

#define MHD_HTTP_METHOD_NOT_ALLOWED   405

Definition at line 126 of file microhttpd.h.

#define MHD_HTTP_METHOD_OPTIONS   "OPTIONS"

Definition at line 220 of file microhttpd.h.

#define MHD_HTTP_METHOD_POST   "POST"

Definition at line 221 of file microhttpd.h.

#define MHD_HTTP_METHOD_PUT   "PUT"

Definition at line 222 of file microhttpd.h.

#define MHD_HTTP_METHOD_TRACE   "TRACE"

Definition at line 223 of file microhttpd.h.

#define MHD_HTTP_MOVED_PERMANENTLY   301

Definition at line 113 of file microhttpd.h.

#define MHD_HTTP_MULTI_STATUS   207

Definition at line 110 of file microhttpd.h.

#define MHD_HTTP_MULTIPLE_CHOICES   300

Definition at line 112 of file microhttpd.h.

#define MHD_HTTP_NO_CONTENT   204

Definition at line 107 of file microhttpd.h.

#define MHD_HTTP_NON_AUTHORITATIVE_INFORMATION   203

Definition at line 106 of file microhttpd.h.

#define MHD_HTTP_NOT_EXTENDED   510

Definition at line 155 of file microhttpd.h.

#define MHD_HTTP_NOT_FOUND   404

Definition at line 125 of file microhttpd.h.

#define MHD_HTTP_NOT_IMPLEMENTED   501

Definition at line 147 of file microhttpd.h.

#define MHD_HTTP_NOT_MODIFIED   304

Definition at line 116 of file microhttpd.h.

#define MHD_HTTP_OK   200

Definition at line 103 of file microhttpd.h.

#define MHD_HTTP_PARTIAL_CONTENT   206

Definition at line 109 of file microhttpd.h.

#define MHD_HTTP_PAYMENT_REQUIRED   402

Definition at line 123 of file microhttpd.h.

#define MHD_HTTP_POST_ENCODING_FORM_URLENCODED   "application/x-www-form-urlencoded"

#define MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA   "multipart/form-data"

Definition at line 230 of file microhttpd.h.

Referenced by MHD_create_post_processor(), and MHD_post_process().

#define MHD_HTTP_PRECONDITION_FAILED   412

Definition at line 133 of file microhttpd.h.

#define MHD_HTTP_PROCESSING   102

Definition at line 101 of file microhttpd.h.

#define MHD_HTTP_PROXY_AUTHENTICATION_REQUIRED   407

Definition at line 128 of file microhttpd.h.

#define MHD_HTTP_REQUEST_ENTITY_TOO_LARGE   413

#define MHD_HTTP_REQUEST_TIMEOUT   408

Definition at line 129 of file microhttpd.h.

#define MHD_HTTP_REQUEST_URI_TOO_LONG   414

Definition at line 135 of file microhttpd.h.

Referenced by get_next_header_line(), and MHD_connection_get_fdset().

#define MHD_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE   416

Definition at line 137 of file microhttpd.h.

#define MHD_HTTP_RESET_CONTENT   205

Definition at line 108 of file microhttpd.h.

#define MHD_HTTP_RETRY_WITH   449

Definition at line 144 of file microhttpd.h.

#define MHD_HTTP_SEE_OTHER   303

Definition at line 115 of file microhttpd.h.

#define MHD_HTTP_SERVICE_UNAVAILABLE   503

Definition at line 149 of file microhttpd.h.

#define MHD_HTTP_SWITCH_PROXY   306

Definition at line 118 of file microhttpd.h.

#define MHD_HTTP_SWITCHING_PROTOCOLS   101

Definition at line 100 of file microhttpd.h.

#define MHD_HTTP_TEMPORARY_REDIRECT   307

Definition at line 119 of file microhttpd.h.

#define MHD_HTTP_UNAUTHORIZED   401

Definition at line 122 of file microhttpd.h.

#define MHD_HTTP_UNORDERED_COLLECTION   425

Definition at line 142 of file microhttpd.h.

#define MHD_HTTP_UNPROCESSABLE_ENTITY   422

Definition at line 139 of file microhttpd.h.

#define MHD_HTTP_UNSUPPORTED_MEDIA_TYPE   415

Definition at line 136 of file microhttpd.h.

#define MHD_HTTP_UPGRADE_REQUIRED   426

Definition at line 143 of file microhttpd.h.

#define MHD_HTTP_USE_PROXY   305

Definition at line 117 of file microhttpd.h.

#define MHD_HTTP_VARIANT_ALSO_NEGOTIATES   506

Definition at line 152 of file microhttpd.h.

#define MHD_HTTP_VERSION_1_0   "HTTP/1.0"

HTTP versions (used to match against the first line of the HTTP header as well as in the response code).

Definition at line 210 of file microhttpd.h.

#define MHD_HTTP_VERSION_1_1   "HTTP/1.1"

#define MHD_NO   0

#define MHD_VERSION   0x00030000

Current version of the library.

Definition at line 87 of file microhttpd.h.

#define MHD_YES   1


Typedef Documentation

typedef int(* MHD_AcceptPolicyCallback)(void *cls, const struct sockaddr *addr, socklen_t addrlen)

Allow or deny a client to connect.

Parameters:
addr address information from the client
addrlen length of the address information
Returns:
MHD_YES if connection is allowed, MHD_NO if not

Definition at line 461 of file microhttpd.h.

typedef int(* MHD_AccessHandlerCallback)(void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, unsigned int *upload_data_size, void **con_cls)

A client has requested the given url using the given method ("GET", "PUT", "DELETE", "POST", etc). The callback must call MHS callbacks to provide content to give back to the client and return an HTTP status code (i.e. 200 for OK, 404, etc.).

Parameters:
cls argument given together with the function pointer when the handler was registered with MHD
url the requested url
method the HTTP method used ("GET", "PUT", etc.)
version the HTTP version string (i.e. "HTTP/1.1")
upload_data the data being uploaded (excluding HEADERS, for a POST that fits into memory and that is encoded with a supported encoding, the POST data will NOT be given in upload_data and is instead available as part of MHD_get_connection_values; very large POST data *will* be made available incrementally in upload_data)
upload_data_size set initially to the size of the upload_data provided; the method must update this value to the number of bytes NOT processed;
con_cls pointer that the callback can set to some address and that will be preserved by MHD for future calls for this request; since the access handler may be called many times (i.e., for a PUT/POST operation with plenty of upload data) this allows the application to easily associate some request-specific state. If necessary, this state can be cleaned up in the global "MHD_RequestCompleted" callback (which can be set with the MHD_OPTION_NOTIFY_COMPLETED). Initially, *con_cls will be NULL.
Returns:
MHS_YES if the connection was handled successfully, MHS_NO if the socket must be closed due to a serios error while handling the request

Definition at line 501 of file microhttpd.h.

typedef int(* MHD_ContentReaderCallback)(void *cls, size_t pos, char *buf, int max)

Callback used by libmicrohttpd in order to obtain content. The callback is to copy at most "max" bytes of content into "buf". The total number of bytes that has been placed into "buf" should be returned.

Note that returning zero will cause libmicrohttpd to try again, either "immediately" if in multi-threaded mode (in which case the callback may want to do blocking operations) or in the next round if MHD_run is used. Returning 0 for a daemon that runs in internal select mode is an error (since it would result in busy waiting) and will cause the program to be aborted (abort()).

Parameters:
cls extra argument to the callback
pos position in the datastream to access; note that if an MHD_Response object is re-used, it is possible for the same content reader to be queried multiple times for the same data; however, if an MHD_Response is not re-used, libmicrohttpd guarantees that "pos" will be the sum of all non-negative return values obtained from the content reader so far.
Returns:
-1 for the end of transmission (or on error); if a content transfer size was pre-set and the callback has provided fewer than that amount of data, MHD will close the connection with the client; if no content size was specified and this is an http 1.1 connection using chunked encoding, MHD will interpret "-1" as the normal end of the transfer (possibly allowing the client to perform additional requests using the same TCP connection).

Definition at line 575 of file microhttpd.h.

typedef void(* MHD_ContentReaderFreeCallback)(void *cls)

This method is called by libmicrohttpd if we are done with a content reader. It should be used to free resources associated with the content reader.

Definition at line 583 of file microhttpd.h.

typedef int(* MHD_KeyValueIterator)(void *cls, enum MHD_ValueKind kind, const char *key, const char *value)

Iterator over key-value pairs. This iterator can be used to iterate over all of the cookies, headers, or POST-data fields of a request, and also to iterate over the headers that have been added to a response.

Returns:
MHD_YES to continue iterating, MHD_NO to abort the iteration

Definition at line 538 of file microhttpd.h.

typedef int(* MHD_PostDataIterator)(void *cls, enum MHD_ValueKind kind, const char *key, const char *filename, const char *content_type, const char *transfer_encoding, const char *data, size_t off, size_t size)

Iterator over key-value pairs where the value maybe made available in increments and/or may not be zero-terminated. Used for processing POST data.

Parameters:
cls user-specified closure
kind type of the value
key 0-terminated key for the value
filename name of the uploaded file, NULL if not known
content_type mime-type of the data, NULL if not known
transfer_encoding encoding of the data, NULL if not known
data pointer to size bytes of data at the specified offset
off offset of data in the overall value
size number of bytes in data available
Returns:
MHD_YES to continue iterating, MHD_NO to abort the iteration

Definition at line 605 of file microhttpd.h.

typedef void(* MHD_RequestCompletedCallback)(void *cls, struct MHD_Connection *connection, void **con_cls, enum MHD_RequestTerminationCode toe)

Signature of the callback used by MHD to notify the application about completed requests.

Parameters:
cls client-defined closure
connection connection handle
con_cls value as set by the last call to the MHD_AccessHandlerCallback
toe reason for request termination
See also:
MHD_OPTION_NOTIFY_COMPLETED

Definition at line 522 of file microhttpd.h.


Enumeration Type Documentation

enum MHD_FLAG

Options for the MHD daemon. Note that if neither MHD_USER_THREAD_PER_CONNECTION nor MHD_USE_SELECT_INTERNALLY are used, the client wants control over the process and will call the appropriate microhttpd callbacks.

Starting the daemon may also fail if a particular option is not implemented or not supported on the target platform (i.e. no support for SSL, threads or IPv6).

Enumerator:
MHD_NO_FLAG  No options selected.
MHD_USE_DEBUG  Run in debug mode. If this flag is used, the library should print error messages and warnings to stderr.
MHD_USE_SSL  Run in https mode.
MHD_USE_THREAD_PER_CONNECTION  Run using one thread per connection.
MHD_USE_SELECT_INTERNALLY  Run using an internal thread doing SELECT.
MHD_USE_IPv6  Run using the IPv6 protocol (otherwise, MHD will just support IPv4).
MHD_USE_PEDANTIC_CHECKS  Be pedantic about the protocol (as opposed to as tolerant as possible). Specifically, at the moment, this flag causes MHD to reject http 1.1 connections without a "Host" header. This is required by the standard, but of course in violation of the "be as liberal as possible in what you accept" norm. It is recommended to turn this ON if you are testing clients against MHD, and OFF in production.

Definition at line 242 of file microhttpd.h.

enum MHD_OPTION

MHD options. Passed in the varargs portion of MHD_start_daemon.

Enumerator:
MHD_OPTION_END  No more options / last option. This is used to terminate the VARARGs list.
MHD_OPTION_CONNECTION_MEMORY_LIMIT  Maximum memory size per connection (followed by an unsigned int).
MHD_OPTION_CONNECTION_LIMIT  Maximum number of concurrenct connections to accept (followed by an unsigned int).
MHD_OPTION_CONNECTION_TIMEOUT  After how many seconds of inactivity should a connection automatically be timed out? (followed by an unsigned int; use zero for no timeout).
MHD_OPTION_NOTIFY_COMPLETED  Register a function that should be called whenever a request has been completed (this can be used for application-specific clean up). Requests that have never been presented to the application (via MHD_AccessHandlerCallback) will not result in notifications.

This option should be followed by TWO pointers. First a pointer to a function of type "MHD_RequestCompletedCallback" and second a pointer to a closure to pass to the request completed callback. The second pointer maybe NULL.

MHD_OPTION_PER_IP_CONNECTION_LIMIT  Limit on the number of (concurrent) connections made to the server from the same IP address. Can be used to prevent one IP from taking over all of the allowed connections. If the same IP tries to establish more than the specified number of connections, they will be immediately rejected. The option should be followed by an "unsigned int". The default is zero, which means no limit on the number of connections from the same IP address.

Definition at line 294 of file microhttpd.h.

The MHD_RequestTerminationCode specifies reasons why a request has been terminated (or completed).

Enumerator:
MHD_REQUEST_TERMINATED_COMPLETED_OK  We finished sending the response.
MHD_REQUEST_TERMINATED_WITH_ERROR  Error handling the connection (resources exhausted, other side closed connection, application error accepting request, etc.)
MHD_REQUEST_TERMINATED_TIMEOUT_REACHED  No activity on the connection for the number of seconds specified using MHD_OPTION_CONNECTION_TIMEOUT.
MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN  We had to close the session since MHD was being shut down.

Definition at line 399 of file microhttpd.h.

The MHD_ValueKind specifies the source of the key-value pairs in the HTTP protocol.

Enumerator:
MHD_RESPONSE_HEADER_KIND  Response header
MHD_HEADER_KIND  HTTP header.
MHD_COOKIE_KIND  Cookies. Note that the original HTTP header containing the cookie(s) will still be available and intact.
MHD_POSTDATA_KIND  POST data. This is available only if a content encoding supported by MHD is used (currently only URL encoding), and only if the posted content fits within the available memory pool. Note that in that case, the upload data given to the MHD_AccessHandlerCallback will be empty (since it has already been processed).
MHD_GET_ARGUMENT_KIND  GET (URI) arguments.
MHD_FOOTER_KIND  HTTP footer (only for http 1.1 chunked encodings).

Definition at line 354 of file microhttpd.h.


Function Documentation

int MHD_add_response_header ( struct MHD_Response response,
const char *  header,
const char *  content 
)

Add a header line to the response.

Returns:
MHD_NO on error (i.e. invalid header or content format).

Definition at line 36 of file response.c.

References MHD_Response::first_header, MHD_HTTP_Header::header, MHD_HTTP_Header::kind, MHD_HEADER_KIND, MHD_NO, MHD_YES, MHD_HTTP_Header::next, and MHD_HTTP_Header::value.

Referenced by add_extra_headers().

Here is the caller graph for this function:

struct MHD_PostProcessor* MHD_create_post_processor ( struct MHD_Connection connection,
unsigned int  buffer_size,
MHD_PostDataIterator  ikvi,
void *  cls 
) [read]

Create a PostProcessor.

A PostProcessor can be used to (incrementally) parse the data portion of a POST request.

Parameters:
connection the connection on which the POST is happening (used to determine the POST format)
buffer_size maximum number of bytes to use for internal buffering (used only for the parsing, specifically the parsing of the keys). A tiny value (256-1024) should be sufficient. Do NOT use a value smaller than 256.
iter iterator to be called with the parsed data, Must NOT be NULL.
cls first argument to ikvi
Returns:
NULL on error (out of memory, unsupported encoding), otherwise a PP handle
Create a PostProcessor.

A PostProcessor can be used to (incrementally) parse the data portion of a POST request.

Parameters:
connection the connection on which the POST is happening (used to determine the POST format)
buffer_size maximum number of bytes to use for internal buffering (used only for the parsing, specifically the parsing of the keys). A tiny value (256-1024) should be sufficient. Do NOT use 0.
ikvi iterator to be called with the parsed data
cls first argument to ikvi
Returns:
NULL on error (out of memory, unsupported encoding), otherwise a PP handle

Definition at line 249 of file postprocessor.c.

References MHD_HEADER_KIND, MHD_HTTP_HEADER_CONTENT_TYPE, MHD_HTTP_POST_ENCODING_FORM_URLENCODED, MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA, MHD_lookup_connection_value(), PP_Init, and RN_Inactive.

Referenced by test_simple_large().

Here is the call graph for this function:

Here is the caller graph for this function:

struct MHD_Response* MHD_create_response_from_callback ( size_t  size,
unsigned int  block_size,
MHD_ContentReaderCallback  crc,
void *  crc_cls,
MHD_ContentReaderFreeCallback  crfc 
) [read]

Create a response object. The response object can be extended with header information and then be used any number of times.

Parameters:
size size of the data portion of the response, -1 for unknown
block_size preferred block size for querying crc (advisory only, MHD may still call crc using smaller chunks); this is essentially the buffer size used for IO, clients should pick a value that is appropriate for IO and memory performance requirements
crc callback to use to obtain response data
crc_cls extra argument to crc
crfc callback to call to free crc_cls resources
Returns:
NULL on error (i.e. invalid arguments, out of memory)

Definition at line 178 of file response.c.

References MHD_Response::crc, MHD_Response::crc_cls, MHD_Response::crfc, MHD_Response::data, MHD_Response::data_buffer_size, MHD_BUF_INC_SIZE, MHD_Response::mutex, MHD_Response::reference_count, and MHD_Response::total_size.

struct MHD_Response* MHD_create_response_from_data ( size_t  size,
void *  data,
int  must_free,
int  must_copy 
) [read]

Create a response object. The response object can be extended with header information and then be used any number of times.

Parameters:
size size of the data portion of the response
data the data itself
must_free libmicrohttpd should free data when done
must_copy libmicrohttpd must make a copy of data right away, the data maybe released anytime after this call returns
Returns:
NULL on error (i.e. invalid arguments, out of memory)

Definition at line 220 of file response.c.

References MHD_Response::crc, MHD_Response::crc_cls, MHD_Response::crfc, MHD_Response::data, MHD_Response::data_size, MHD_Response::mutex, MHD_Response::reference_count, and MHD_Response::total_size.

Referenced by parse_connection_headers(), and transmit_error_response().

Here is the caller graph for this function:

int MHD_del_response_header ( struct MHD_Response response,
const char *  header,
const char *  content 
)

Delete a header line from the response.

Returns:
MHD_NO on error (no such header known)

Definition at line 80 of file response.c.

References MHD_Response::first_header, MHD_HTTP_Header::header, MHD_NO, MHD_YES, MHD_HTTP_Header::next, and MHD_HTTP_Header::value.

int MHD_destroy_post_processor ( struct MHD_PostProcessor *  pp  ) 

Release PostProcessor resources.

Returns:
MHD_YES if processing completed nicely, MHD_NO if there were spurious characters / formatting problems; it is common to ignore the return value of this function
Release PostProcessor resources.

Definition at line 1023 of file postprocessor.c.

References free_unmarked(), MHD_NO, MHD_YES, NE_none, and PP_Done.

Referenced by test_simple_large().

Here is the call graph for this function:

Here is the caller graph for this function:

void MHD_destroy_response ( struct MHD_Response response  ) 

Destroy a response object and associated resources. Note that libmicrohttpd may keep some of the resources around if the response is still in the queue for some clients, so the memory may not necessarily be freed immediatley.

Definition at line 266 of file response.c.

References MHD_Response::crc_cls, MHD_Response::crfc, MHD_Response::first_header, MHD_HTTP_Header::header, MHD_Response::mutex, MHD_HTTP_Header::next, MHD_Response::reference_count, and MHD_HTTP_Header::value.

Referenced by MHD_cleanup_connections(), MHD_connection_handle_idle(), parse_connection_headers(), and transmit_error_response().

Here is the caller graph for this function:

int MHD_get_connection_values ( struct MHD_Connection connection,
enum MHD_ValueKind  kind,
MHD_KeyValueIterator  iterator,
void *  iterator_cls 
)

Get all of the headers from the request.

Parameters:
iterator callback to call on each header; maybe NULL (then just count headers)
iterator_cls extra argument to iterator
Returns:
number of entries iterated over

Definition at line 130 of file connection.c.

References MHD_HTTP_Header::header, MHD_Connection::headers_received, MHD_HTTP_Header::kind, MHD_YES, MHD_HTTP_Header::next, and MHD_HTTP_Header::value.

int MHD_get_fdset ( struct MHD_Daemon daemon,
fd_set *  read_fd_set,
fd_set *  write_fd_set,
fd_set *  except_fd_set,
int *  max_fd 
)

Obtain the select sets for this daemon.

Returns:
MHD_YES on success, MHD_NO if this daemon was not started with the right options for this call.

Definition at line 64 of file daemon.c.

References MHD_Daemon::connections, MHD_connection_get_fdset(), MHD_NO, MHD_USE_THREAD_PER_CONNECTION, MHD_YES, MHD_Connection::next, MHD_Daemon::options, MHD_Daemon::shutdown, and MHD_Daemon::socket_fd.

Referenced by MHD_select().

Here is the call graph for this function:

Here is the caller graph for this function:

const char* MHD_get_response_header ( struct MHD_Response response,
const char *  key 
)

Get a particular header from the response.

Parameters:
key which header to get
Returns:
NULL if header does not exist

Definition at line 145 of file response.c.

References MHD_Response::first_header, MHD_HTTP_Header::header, MHD_HTTP_Header::next, and MHD_HTTP_Header::value.

Referenced by add_extra_headers(), and build_header_response().

Here is the caller graph for this function:

int MHD_get_response_headers ( struct MHD_Response response,
MHD_KeyValueIterator  iterator,
void *  iterator_cls 
)

Get all of the headers added to a response.

Parameters:
iterator callback to call on each header; maybe NULL (then just count headers)
iterator_cls extra argument to iterator
Returns:
number of entries iterated over

Definition at line 119 of file response.c.

References MHD_Response::first_header, MHD_HTTP_Header::header, MHD_HTTP_Header::kind, MHD_YES, MHD_HTTP_Header::next, and MHD_HTTP_Header::value.

int MHD_get_timeout ( struct MHD_Daemon daemon,
unsigned long long *  timeout 
)

Obtain timeout value for select for this daemon (only needed if connection timeout is used). The returned value is how long select should at most block, not the timeout value set for connections.

Parameters:
timeout set to the timeout (in milliseconds)
Returns:
MHD_YES on success, MHD_NO if timeouts are not used (or no connections exist that would necessiate the use of a timeout right now).

Definition at line 377 of file daemon.c.

References MHD_Daemon::connection_timeout, MHD_Daemon::connections, MHD_Connection::last_activity, MHD_NO, MHD_YES, and MHD_Connection::next.

Referenced by MHD_select().

Here is the caller graph for this function:

const char* MHD_lookup_connection_value ( struct MHD_Connection connection,
enum MHD_ValueKind  kind,
const char *  key 
)

Get a particular header value. If multiple values match the kind, return any one of them.

Parameters:
key the header to look for
Returns:
NULL if no such item was found

Definition at line 164 of file connection.c.

References MHD_HTTP_Header::header, MHD_Connection::headers_received, MHD_HTTP_Header::kind, MHD_HTTP_Header::next, and MHD_HTTP_Header::value.

Referenced by MHD_connection_handle_idle(), MHD_create_post_processor(), need_100_continue(), parse_connection_headers(), and parse_cookie_header().

Here is the caller graph for this function:

int MHD_post_process ( struct MHD_PostProcessor *  pp,
const char *  post_data,
unsigned int  post_data_len 
)

Parse and process POST data. Call this function when POST data is available (usually during an MHD_AccessHandlerCallback) with the upload_data and upload_data_size. Whenever possible, this will then cause calls to the MHD_IncrementalKeyValueIterator.

Parameters:
pp the post processor
post_data post_data_len bytes of POST data
post_data_len length of post_data
Returns:
MHD_YES on success, MHD_NO on error (out-of-memory, iterator aborted, parse error)

Definition at line 1002 of file postprocessor.c.

References MHD_HTTP_POST_ENCODING_FORM_URLENCODED, MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA, MHD_NO, MHD_YES, post_process_multipart(), and post_process_urlencoded().

Referenced by test_simple_large().

Here is the call graph for this function:

Here is the caller graph for this function:

int MHD_queue_response ( struct MHD_Connection connection,
unsigned int  status_code,
struct MHD_Response response 
)

Queue a response to be transmitted to the client (as soon as possible).

Parameters:
connection the connection identifying the client
status_code HTTP status code (i.e. 200 for OK)
response response to transmit
Returns:
MHD_NO on error (i.e. reply already sent), MHD_YES on success or if message has been queued

Definition at line 192 of file connection.c.

References MHD_Connection::have_chunked_response, MHD_Connection::method, MHD_CONNECTION_FOOTERS_RECEIVED, MHD_CONNECTION_HEADERS_PROCESSED, MHD_HTTP_METHOD_HEAD, MHD_HTTP_VERSION_1_1, MHD_increment_response_rc(), MHD_NO, MHD_YES, MHD_Connection::read_closed, MHD_Connection::response, MHD_Connection::response_write_position, MHD_Connection::responseCode, SHUTDOWN, MHD_Connection::socket_fd, MHD_Connection::state, MHD_Response::total_size, and MHD_Connection::version.

Referenced by parse_connection_headers(), and transmit_error_response().

Here is the call graph for this function:

Here is the caller graph for this function:

int MHD_run ( struct MHD_Daemon daemon  ) 

Run webserver operations (without blocking unless in client callbacks). This method should be called by clients in combination with MHD_get_fdset if the client-controlled select method is used.

Returns:
MHD_YES on success, MHD_NO if this daemon was not started with the right options for this call.

Definition at line 519 of file daemon.c.

References MHD_cleanup_connections(), MHD_NO, MHD_select(), MHD_USE_SELECT_INTERNALLY, MHD_USE_THREAD_PER_CONNECTION, MHD_YES, MHD_Daemon::options, and MHD_Daemon::shutdown.

Here is the call graph for this function:

struct MHD_Daemon* MHD_start_daemon ( unsigned int  options,
unsigned short  port,
MHD_AcceptPolicyCallback  apc,
void *  apc_cls,
MHD_AccessHandlerCallback  dh,
void *  dh_cls,
  ... 
) [read]

Start a webserver on the given port.

Parameters:
flags combination of MHD_FLAG values
port port to bind to
apc callback to call to check which clients will be allowed to connect; you can pass NULL in which case connections from any IP will be accepted
apc_cls extra argument to apc
dh handler called for all requests (repeatedly)
dh_cls extra argument to dh
... list of options (type-value pairs, terminated with MHD_OPTION_END).
Returns:
NULL on error, handle to daemon on success
Start a webserver on the given port.

Parameters:
port port to bind to
apc callback to call to check which clients will be allowed to connect
apc_cls extra argument to apc
dh default handler for all URIs
dh_cls extra argument to dh
Returns:
NULL on error, handle to daemon on success

Definition at line 560 of file daemon.c.

References MHD_Daemon::apc, MHD_Daemon::apc_cls, BIND, CLOSE, MHD_Daemon::connection_timeout, MHD_Daemon::default_handler, MHD_Daemon::default_handler_cls, LISTEN, MHD_Daemon::max_connections, MHD_MAX_CONNECTIONS_DEFAULT, MHD_OPTION_CONNECTION_LIMIT, MHD_OPTION_CONNECTION_MEMORY_LIMIT, MHD_OPTION_CONNECTION_TIMEOUT, MHD_OPTION_END, MHD_OPTION_NOTIFY_COMPLETED, MHD_OPTION_PER_IP_CONNECTION_LIMIT, MHD_POOL_SIZE_DEFAULT, MHD_select_thread(), MHD_USE_DEBUG, MHD_USE_IPv6, MHD_USE_SELECT_INTERNALLY, MHD_USE_SSL, MHD_USE_THREAD_PER_CONNECTION, MHD_Daemon::notify_completed, MHD_Daemon::notify_completed_cls, MHD_Daemon::options, MHD_Daemon::per_ip_connection_limit, MHD_Daemon::pid, MHD_Daemon::pool_size, MHD_Daemon::port, SETSOCKOPT, SOCKET, MHD_Daemon::socket_fd, and STRERROR.

Here is the call graph for this function:

void MHD_stop_daemon ( struct MHD_Daemon daemon  ) 


Generated on Fri Oct 3 15:58:18 2008 for GNU libmicrohttpd by  doxygen 1.5.6