microhttpd.h

Go to the documentation of this file.
00001 /*
00002      This file is part of libmicrohttpd
00003      (C) 2006, 2007, 2008, 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
00004 
00005      This library is free software; you can redistribute it and/or
00006      modify it under the terms of the GNU Lesser General Public
00007      License as published by the Free Software Foundation; either
00008      version 2.1 of the License, or (at your option) any later version.
00009 
00010      This library is distributed in the hope that it will be useful,
00011      but WITHOUT ANY WARRANTY; without even the implied warranty of
00012      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013      Lesser General Public License for more details.
00014 
00015      You should have received a copy of the GNU Lesser General Public
00016      License along with this library; if not, write to the Free Software
00017      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 */
00019 
00072 #ifndef MHD_MICROHTTPD_H
00073 #define MHD_MICROHTTPD_H
00074 
00075 #ifdef __cplusplus
00076 extern "C"
00077 {
00078 #if 0                           /* keep Emacsens' auto-indent happy */
00079 }
00080 #endif
00081 #endif
00082 
00083 /* While we generally would like users to use a configure-driven
00084    build process which detects which headers are present and
00085    hence works on any platform, we use "standard" includes here
00086    to build out-of-the-box for beginning users on common systems.
00087 
00088    Once you have a proper build system and go for more exotic 
00089    platforms, you should define MHD_PLATFORM_H in some header that
00090    you always include *before* "microhttpd.h".  Then the following
00091    "standard" includes won't be used (which might be a good
00092    idea, especially on platforms where they do not exist). */
00093 #ifndef MHD_PLATFORM_H
00094 #include <unistd.h>
00095 #include <stdarg.h>
00096 #include <stdint.h>
00097 #ifdef __MINGW32__
00098 #include <ws2tcpip.h>
00099 #else
00100 #include <sys/time.h>
00101 #include <sys/types.h>
00102 #include <sys/socket.h>
00103 #endif
00104 #endif
00105 
00109 #define MHD_VERSION 0x00091600
00110 
00114 #define MHD_YES 1
00115 
00119 #define MHD_NO 0
00120 
00124 #define MHD_INVALID_NONCE -1
00125 
00130 #ifdef UINT64_MAX
00131 #define MHD_SIZE_UNKNOWN UINT64_MAX
00132 #else
00133 #define MHD_SIZE_UNKNOWN  ((uint64_t) -1LL)
00134 #endif
00135 
00136 #ifdef SIZE_MAX
00137 #define MHD_CONTENT_READER_END_OF_STREAM SIZE_MAX
00138 #define MHD_CONTENT_READER_END_WITH_ERROR (SIZE_MAX - 1)
00139 #else
00140 #define MHD_CONTENT_READER_END_OF_STREAM ((size_t) -1LL)
00141 #define MHD_CONTENT_READER_END_WITH_ERROR (((size_t) -1LL) - 1)
00142 #endif
00143 
00149 #ifndef MHD_LONG_LONG
00150 #define MHD_LONG_LONG long long
00151 #endif
00152 #ifndef MHD_LONG_LONG_PRINTF
00153 
00157 #define MHD_LONG_LONG_PRINTF "ll"
00158 #endif
00159 
00160 
00164 #define MHD_HTTP_CONTINUE 100
00165 #define MHD_HTTP_SWITCHING_PROTOCOLS 101
00166 #define MHD_HTTP_PROCESSING 102
00167 
00168 #define MHD_HTTP_OK 200
00169 #define MHD_HTTP_CREATED 201
00170 #define MHD_HTTP_ACCEPTED 202
00171 #define MHD_HTTP_NON_AUTHORITATIVE_INFORMATION 203
00172 #define MHD_HTTP_NO_CONTENT 204
00173 #define MHD_HTTP_RESET_CONTENT 205
00174 #define MHD_HTTP_PARTIAL_CONTENT 206
00175 #define MHD_HTTP_MULTI_STATUS 207
00176 
00177 #define MHD_HTTP_MULTIPLE_CHOICES 300
00178 #define MHD_HTTP_MOVED_PERMANENTLY 301
00179 #define MHD_HTTP_FOUND 302
00180 #define MHD_HTTP_SEE_OTHER 303
00181 #define MHD_HTTP_NOT_MODIFIED 304
00182 #define MHD_HTTP_USE_PROXY 305
00183 #define MHD_HTTP_SWITCH_PROXY 306
00184 #define MHD_HTTP_TEMPORARY_REDIRECT 307
00185 
00186 #define MHD_HTTP_BAD_REQUEST 400
00187 #define MHD_HTTP_UNAUTHORIZED 401
00188 #define MHD_HTTP_PAYMENT_REQUIRED 402
00189 #define MHD_HTTP_FORBIDDEN 403
00190 #define MHD_HTTP_NOT_FOUND 404
00191 #define MHD_HTTP_METHOD_NOT_ALLOWED 405
00192 #define MHD_HTTP_METHOD_NOT_ACCEPTABLE 406
00193 #define MHD_HTTP_PROXY_AUTHENTICATION_REQUIRED 407
00194 #define MHD_HTTP_REQUEST_TIMEOUT 408
00195 #define MHD_HTTP_CONFLICT 409
00196 #define MHD_HTTP_GONE 410
00197 #define MHD_HTTP_LENGTH_REQUIRED 411
00198 #define MHD_HTTP_PRECONDITION_FAILED 412
00199 #define MHD_HTTP_REQUEST_ENTITY_TOO_LARGE 413
00200 #define MHD_HTTP_REQUEST_URI_TOO_LONG 414
00201 #define MHD_HTTP_UNSUPPORTED_MEDIA_TYPE 415
00202 #define MHD_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE 416
00203 #define MHD_HTTP_EXPECTATION_FAILED 417
00204 #define MHD_HTTP_UNPROCESSABLE_ENTITY 422
00205 #define MHD_HTTP_LOCKED 423
00206 #define MHD_HTTP_FAILED_DEPENDENCY 424
00207 #define MHD_HTTP_UNORDERED_COLLECTION 425
00208 #define MHD_HTTP_UPGRADE_REQUIRED 426
00209 #define MHD_HTTP_NO_RESPONSE 444
00210 #define MHD_HTTP_RETRY_WITH 449
00211 #define MHD_HTTP_BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS 450
00212 #define MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS 451
00213 
00214 #define MHD_HTTP_INTERNAL_SERVER_ERROR 500
00215 #define MHD_HTTP_NOT_IMPLEMENTED 501
00216 #define MHD_HTTP_BAD_GATEWAY 502
00217 #define MHD_HTTP_SERVICE_UNAVAILABLE 503
00218 #define MHD_HTTP_GATEWAY_TIMEOUT 504
00219 #define MHD_HTTP_HTTP_VERSION_NOT_SUPPORTED 505
00220 #define MHD_HTTP_VARIANT_ALSO_NEGOTIATES 506
00221 #define MHD_HTTP_INSUFFICIENT_STORAGE 507
00222 #define MHD_HTTP_BANDWIDTH_LIMIT_EXCEEDED 509
00223 #define MHD_HTTP_NOT_EXTENDED 510
00224 
00230 #define MHD_ICY_FLAG ((uint32_t)(1 << 31))
00231 
00232 /* See also: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html */
00233 #define MHD_HTTP_HEADER_ACCEPT "Accept"
00234 #define MHD_HTTP_HEADER_ACCEPT_CHARSET "Accept-Charset"
00235 #define MHD_HTTP_HEADER_ACCEPT_ENCODING "Accept-Encoding"
00236 #define MHD_HTTP_HEADER_ACCEPT_LANGUAGE "Accept-Language"
00237 #define MHD_HTTP_HEADER_ACCEPT_RANGES "Accept-Ranges"
00238 #define MHD_HTTP_HEADER_AGE "Age"
00239 #define MHD_HTTP_HEADER_ALLOW "Allow"
00240 #define MHD_HTTP_HEADER_AUTHORIZATION "Authorization"
00241 #define MHD_HTTP_HEADER_CACHE_CONTROL "Cache-Control"
00242 #define MHD_HTTP_HEADER_CONNECTION "Connection"
00243 #define MHD_HTTP_HEADER_CONTENT_ENCODING "Content-Encoding"
00244 #define MHD_HTTP_HEADER_CONTENT_LANGUAGE "Content-Language"
00245 #define MHD_HTTP_HEADER_CONTENT_LENGTH "Content-Length"
00246 #define MHD_HTTP_HEADER_CONTENT_LOCATION "Content-Location"
00247 #define MHD_HTTP_HEADER_CONTENT_MD5 "Content-MD5"
00248 #define MHD_HTTP_HEADER_CONTENT_RANGE "Content-Range"
00249 #define MHD_HTTP_HEADER_CONTENT_TYPE "Content-Type"
00250 #define MHD_HTTP_HEADER_COOKIE "Cookie"
00251 #define MHD_HTTP_HEADER_DATE "Date"
00252 #define MHD_HTTP_HEADER_ETAG "ETag"
00253 #define MHD_HTTP_HEADER_EXPECT "Expect"
00254 #define MHD_HTTP_HEADER_EXPIRES "Expires"
00255 #define MHD_HTTP_HEADER_FROM "From"
00256 #define MHD_HTTP_HEADER_HOST "Host"
00257 #define MHD_HTTP_HEADER_IF_MATCH "If-Match"
00258 #define MHD_HTTP_HEADER_IF_MODIFIED_SINCE "If-Modified-Since"
00259 #define MHD_HTTP_HEADER_IF_NONE_MATCH "If-None-Match"
00260 #define MHD_HTTP_HEADER_IF_RANGE "If-Range"
00261 #define MHD_HTTP_HEADER_IF_UNMODIFIED_SINCE "If-Unmodified-Since"
00262 #define MHD_HTTP_HEADER_LAST_MODIFIED "Last-Modified"
00263 #define MHD_HTTP_HEADER_LOCATION "Location"
00264 #define MHD_HTTP_HEADER_MAX_FORWARDS "Max-Forwards"
00265 #define MHD_HTTP_HEADER_PRAGMA "Pragma"
00266 #define MHD_HTTP_HEADER_PROXY_AUTHENTICATE "Proxy-Authenticate"
00267 #define MHD_HTTP_HEADER_PROXY_AUTHORIZATION "Proxy-Authorization"
00268 #define MHD_HTTP_HEADER_RANGE "Range"
00269 #define MHD_HTTP_HEADER_REFERER "Referer"
00270 #define MHD_HTTP_HEADER_RETRY_AFTER "Retry-After"
00271 #define MHD_HTTP_HEADER_SERVER "Server"
00272 #define MHD_HTTP_HEADER_SET_COOKIE "Set-Cookie"
00273 #define MHD_HTTP_HEADER_SET_COOKIE2 "Set-Cookie2"
00274 #define MHD_HTTP_HEADER_TE "TE"
00275 #define MHD_HTTP_HEADER_TRAILER "Trailer"
00276 #define MHD_HTTP_HEADER_TRANSFER_ENCODING "Transfer-Encoding"
00277 #define MHD_HTTP_HEADER_UPGRADE "Upgrade"
00278 #define MHD_HTTP_HEADER_USER_AGENT "User-Agent"
00279 #define MHD_HTTP_HEADER_VARY "Vary"
00280 #define MHD_HTTP_HEADER_VIA "Via"
00281 #define MHD_HTTP_HEADER_WARNING "Warning"
00282 #define MHD_HTTP_HEADER_WWW_AUTHENTICATE "WWW-Authenticate"
00283 
00288 #define MHD_HTTP_VERSION_1_0 "HTTP/1.0"
00289 #define MHD_HTTP_VERSION_1_1 "HTTP/1.1"
00290 
00294 #define MHD_HTTP_METHOD_CONNECT "CONNECT"
00295 #define MHD_HTTP_METHOD_DELETE "DELETE"
00296 #define MHD_HTTP_METHOD_GET "GET"
00297 #define MHD_HTTP_METHOD_HEAD "HEAD"
00298 #define MHD_HTTP_METHOD_OPTIONS "OPTIONS"
00299 #define MHD_HTTP_METHOD_POST "POST"
00300 #define MHD_HTTP_METHOD_PUT "PUT"
00301 #define MHD_HTTP_METHOD_TRACE "TRACE"
00302 
00307 #define MHD_HTTP_POST_ENCODING_FORM_URLENCODED "application/x-www-form-urlencoded"
00308 #define MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA "multipart/form-data"
00309 
00320 enum MHD_FLAG
00321 {
00325   MHD_NO_FLAG = 0,
00326 
00332   MHD_USE_DEBUG = 1,
00333 
00337   MHD_USE_SSL = 2,
00338 
00342   MHD_USE_THREAD_PER_CONNECTION = 4,
00343 
00347   MHD_USE_SELECT_INTERNALLY = 8,
00348 
00353   MHD_USE_IPv6 = 16,
00354 
00364   MHD_USE_PEDANTIC_CHECKS = 32,
00365 
00369   MHD_USE_POLL = 64,
00370 
00377   MHD_SUPPRESS_DATE_NO_CLOCK = 128,
00378 
00386   MHD_USE_NO_LISTEN_SOCKET = 256
00387 
00388 };
00389 
00390 
00394 enum MHD_OPTION
00395 {
00396 
00401   MHD_OPTION_END = 0,
00402 
00407   MHD_OPTION_CONNECTION_MEMORY_LIMIT = 1,
00408 
00413   MHD_OPTION_CONNECTION_LIMIT = 2,
00414 
00420   MHD_OPTION_CONNECTION_TIMEOUT = 3,
00421 
00434   MHD_OPTION_NOTIFY_COMPLETED = 4,
00435 
00446   MHD_OPTION_PER_IP_CONNECTION_LIMIT = 5,
00447 
00453   MHD_OPTION_SOCK_ADDR = 6,
00454 
00476   MHD_OPTION_URI_LOG_CALLBACK = 7,
00477 
00484   MHD_OPTION_HTTPS_MEM_KEY = 8,
00485 
00492   MHD_OPTION_HTTPS_MEM_CERT = 9,
00493 
00499   MHD_OPTION_HTTPS_CRED_TYPE = 10,
00500 
00505   MHD_OPTION_HTTPS_PRIORITIES = 11,
00506 
00513   MHD_OPTION_LISTEN_SOCKET = 12,
00514 
00527   MHD_OPTION_EXTERNAL_LOGGER = 13,
00528 
00537   MHD_OPTION_THREAD_POOL_SIZE = 14,
00538 
00558   MHD_OPTION_ARRAY = 15,
00559 
00578   MHD_OPTION_UNESCAPE_CALLBACK = 16,
00579 
00589   MHD_OPTION_DIGEST_AUTH_RANDOM = 17,
00590 
00596   MHD_OPTION_NONCE_NC_SIZE = 18,
00597 
00602   MHD_OPTION_THREAD_STACK_SIZE = 19,
00603 
00609   MHD_OPTION_HTTPS_MEM_TRUST =20
00610 };
00611 
00612 
00616 struct MHD_OptionItem
00617 {
00622   enum MHD_OPTION option;
00623 
00629   intptr_t value;
00630 
00635   void *ptr_value;
00636 
00637 };
00638 
00639 
00644 enum MHD_ValueKind
00645 {
00646 
00650   MHD_RESPONSE_HEADER_KIND = 0,
00651 
00655   MHD_HEADER_KIND = 1,
00656 
00661   MHD_COOKIE_KIND = 2,
00662 
00671   MHD_POSTDATA_KIND = 4,
00672 
00676   MHD_GET_ARGUMENT_KIND = 8,
00677 
00681   MHD_FOOTER_KIND = 16
00682 };
00683 
00684 
00689 enum MHD_RequestTerminationCode
00690 {
00691 
00695   MHD_REQUEST_TERMINATED_COMPLETED_OK = 0,
00696 
00702   MHD_REQUEST_TERMINATED_WITH_ERROR = 1,
00703 
00709   MHD_REQUEST_TERMINATED_TIMEOUT_REACHED = 2,
00710 
00715   MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN = 3,
00716 
00724   MHD_REQUEST_TERMINATED_READ_ERROR = 4
00725 
00726 };
00727 
00728 
00733 enum MHD_ConnectionInfoType
00734 {
00739   MHD_CONNECTION_INFO_CIPHER_ALGO,
00740 
00745   MHD_CONNECTION_INFO_PROTOCOL,
00746 
00753   MHD_CONNECTION_INFO_CLIENT_ADDRESS,
00754 
00758   MHD_CONNECTION_INFO_GNUTLS_SESSION,
00759 
00766   MHD_CONNECTION_INFO_GNUTLS_CLIENT_CERT,
00767 
00771   MHD_CONNECTION_INFO_DAEMON
00772 
00773 };
00774 
00775 
00780 enum MHD_DaemonInfoType
00781 {
00788   MHD_DAEMON_INFO_KEY_SIZE,
00789 
00796   MHD_DAEMON_INFO_MAC_KEY_SIZE,
00797 
00802   MHD_DAEMON_INFO_LISTEN_FD
00803 };
00804 
00805 
00809 struct MHD_Daemon;
00810 
00817 struct MHD_Connection;
00818 
00822 struct MHD_Response;
00823 
00827 struct MHD_PostProcessor;
00828 
00829 
00839 typedef 
00840   void (*MHD_PanicCallback) (void *cls,
00841                              const char *file,
00842                              unsigned int line,
00843                              const char *reason);
00844 
00852 typedef int
00853   (*MHD_AcceptPolicyCallback) (void *cls,
00854                                const struct sockaddr * addr,
00855                                socklen_t addrlen);
00856 
00857 
00893 typedef int
00894   (*MHD_AccessHandlerCallback) (void *cls,
00895                                 struct MHD_Connection * connection,
00896                                 const char *url,
00897                                 const char *method,
00898                                 const char *version,
00899                                 const char *upload_data,
00900                                 size_t *upload_data_size,
00901                                 void **con_cls);
00902 
00903 
00915 typedef void
00916   (*MHD_RequestCompletedCallback) (void *cls,
00917                                    struct MHD_Connection * connection,
00918                                    void **con_cls,
00919                                    enum MHD_RequestTerminationCode toe);
00920 
00921 
00932 typedef int
00933   (*MHD_KeyValueIterator) (void *cls,
00934                            enum MHD_ValueKind kind,
00935                            const char *key, const char *value);
00936 
00937 
00985 typedef ssize_t
00986   (*MHD_ContentReaderCallback) (void *cls,
00987                                 uint64_t pos,
00988                                 char *buf,
00989                                 size_t max);
00990 
00991 
00998 typedef void 
00999   (*MHD_ContentReaderFreeCallback) (void *cls);
01000 
01001 
01021 typedef int
01022   (*MHD_PostDataIterator) (void *cls,
01023                            enum MHD_ValueKind kind,
01024                            const char *key,
01025                            const char *filename,
01026                            const char *content_type,
01027                            const char *transfer_encoding,
01028                            const char *data, 
01029                            uint64_t off, 
01030                            size_t size);
01031 
01032 /* **************** Daemon handling functions ***************** */
01033 
01050 struct MHD_Daemon *
01051 MHD_start_daemon_va (unsigned int options,
01052                      uint16_t port,
01053                      MHD_AcceptPolicyCallback apc, void *apc_cls,
01054                      MHD_AccessHandlerCallback dh, void *dh_cls, 
01055                      va_list ap);
01056 
01057 
01073 struct MHD_Daemon *
01074 MHD_start_daemon (unsigned int flags,
01075                   uint16_t port,
01076                   MHD_AcceptPolicyCallback apc, void *apc_cls,
01077                   MHD_AccessHandlerCallback dh, void *dh_cls, 
01078                   ...);
01079 
01080 
01086 void 
01087 MHD_stop_daemon (struct MHD_Daemon *daemon);
01088 
01089 
01111 int 
01112 MHD_add_connection (struct MHD_Daemon *daemon, 
01113                     int client_socket,
01114                     const struct sockaddr *addr,
01115                     socklen_t addrlen);
01116 
01117 
01131 int
01132 MHD_get_fdset (struct MHD_Daemon *daemon,
01133                fd_set *read_fd_set,
01134                fd_set *write_fd_set, 
01135                fd_set *except_fd_set, 
01136                int *max_fd);
01137 
01138 
01152 int MHD_get_timeout (struct MHD_Daemon *daemon, 
01153                      unsigned MHD_LONG_LONG *timeout);
01154 
01155 
01167 int 
01168 MHD_run (struct MHD_Daemon *daemon);
01169 
01170 
01171 /* **************** Connection handling functions ***************** */
01172 
01183 int
01184 MHD_get_connection_values (struct MHD_Connection *connection,
01185                            enum MHD_ValueKind kind,
01186                            MHD_KeyValueIterator iterator, void *iterator_cls);
01187 
01188 
01218 int
01219 MHD_set_connection_value (struct MHD_Connection *connection,
01220                           enum MHD_ValueKind kind,
01221                           const char *key, 
01222                           const char *value);
01223 
01224 
01240 void 
01241 MHD_set_panic_func (MHD_PanicCallback cb, void *cls);
01242 
01243 
01253 const char *
01254 MHD_lookup_connection_value (struct MHD_Connection *connection,
01255                              enum MHD_ValueKind kind,
01256                              const char *key);
01257 
01258 
01269 int
01270 MHD_queue_response (struct MHD_Connection *connection,
01271                     unsigned int status_code, 
01272                     struct MHD_Response *response);
01273 
01274 
01275 /* **************** Response manipulation functions ***************** */
01276 
01292 struct MHD_Response *
01293 MHD_create_response_from_callback (uint64_t size,
01294                                    size_t block_size,
01295                                    MHD_ContentReaderCallback crc, void *crc_cls,
01296                                    MHD_ContentReaderFreeCallback crfc);
01297 
01298 
01312 struct MHD_Response *
01313 MHD_create_response_from_data (size_t size,
01314                                void *data,
01315                                int must_free,
01316                                int must_copy);
01317 
01318 
01323 enum MHD_ResponseMemoryMode {
01324 
01330   MHD_RESPMEM_PERSISTENT,
01331 
01337   MHD_RESPMEM_MUST_FREE,
01338 
01345   MHD_RESPMEM_MUST_COPY
01346 
01347 };
01348 
01349 
01359 struct MHD_Response *
01360 MHD_create_response_from_buffer (size_t size,
01361                                  void *buffer,
01362                                  enum MHD_ResponseMemoryMode mode);
01363 
01364 
01375 struct MHD_Response *
01376 MHD_create_response_from_fd (size_t size,
01377                              int fd);
01378 
01379 
01395 struct MHD_Response *
01396 MHD_create_response_from_fd_at_offset (size_t size,
01397                                        int fd,
01398                                        off_t offset);
01399 
01400 
01424 typedef void (*MHD_UpgradeHandler)(void *cls,
01425                                    struct MHD_Connection *connection,
01426                                    void **con_cls,
01427                                    int upgrade_socket);
01428 
01429 #if 0
01430 
01459 struct MHD_Response *
01460 MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler,
01461                                  void *upgrade_handler_cls);
01462 #endif
01463 
01472 void MHD_destroy_response (struct MHD_Response *response);
01473 
01474 
01484 int
01485 MHD_add_response_header (struct MHD_Response *response,
01486                          const char *header, const char *content);
01487 
01488 
01497 int
01498 MHD_add_response_footer (struct MHD_Response *response,
01499                          const char *footer, const char *content);
01500 
01501 
01510 int
01511 MHD_del_response_header (struct MHD_Response *response,
01512                          const char *header, const char *content);
01513 
01523 int
01524 MHD_get_response_headers (struct MHD_Response *response,
01525                           MHD_KeyValueIterator iterator, void *iterator_cls);
01526 
01527 
01535 const char *MHD_get_response_header (struct MHD_Response *response,
01536                                      const char *key);
01537 
01538 
01539 /* ********************** PostProcessor functions ********************** */
01540 
01564 struct MHD_PostProcessor *
01565 MHD_create_post_processor (struct MHD_Connection *connection,
01566                            size_t buffer_size,
01567                            MHD_PostDataIterator iter, void *cls);
01568 
01583 int
01584 MHD_post_process (struct MHD_PostProcessor *pp,
01585                   const char *post_data, size_t post_data_len);
01586 
01596 int 
01597 MHD_destroy_post_processor (struct MHD_PostProcessor *pp);
01598 
01599 
01600 /* ********************* Digest Authentication functions *************** */
01601 
01602 
01607 #define MHD_INVALID_NONCE -1
01608 
01609 
01617 char *
01618 MHD_digest_auth_get_username (struct MHD_Connection *connection);
01619 
01620 
01633 int
01634 MHD_digest_auth_check (struct MHD_Connection *connection,
01635                        const char *realm,
01636                        const char *username,
01637                        const char *password,
01638                        unsigned int nonce_timeout);
01639 
01640 
01654 int
01655 MHD_queue_auth_fail_response (struct MHD_Connection *connection,
01656                               const char *realm,
01657                               const char *opaque,
01658                               struct MHD_Response *response,
01659                               int signal_stale);
01660 
01661 
01670 char *
01671 MHD_basic_auth_get_username_password (struct MHD_Connection *connection,
01672                                       char** password);
01673 
01681 int
01682 MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection,
01683                                     const char *realm,
01684                                     struct MHD_Response *response);
01685 
01686 /* ********************** generic query functions ********************** */
01687 
01691 union MHD_ConnectionInfo
01692 {
01693 
01697   int /* enum gnutls_cipher_algorithm */ cipher_algorithm;
01698 
01702   int /* enum gnutls_protocol */ protocol;
01703 
01707   void * /* gnutls_session_t */ tls_session;
01708 
01712   void * /* gnutls_x509_crt_t */ client_cert;
01713 
01717   struct sockaddr *client_addr;
01718 
01723   struct MHD_Daemon *daemon;
01724 };
01725 
01735 const union MHD_ConnectionInfo *
01736 MHD_get_connection_info (struct MHD_Connection *connection,
01737                          enum MHD_ConnectionInfoType infoType, 
01738                          ...);
01739 
01740 
01745 enum MHD_CONNECTION_OPTION
01746 {
01747 
01753   MHD_CONNECTION_OPTION_TIMEOUT
01754 
01755 };
01756 
01757 
01766 int 
01767 MHD_set_connection_option (struct MHD_Connection *connection,
01768                            enum MHD_CONNECTION_OPTION option,
01769                            ...);
01770                            
01771 
01775 union MHD_DaemonInfo
01776 {
01780   size_t key_size;
01781 
01785   size_t mac_key_size;
01786 
01790   int listen_fd;
01791 };
01792 
01803 const union MHD_DaemonInfo *
01804 MHD_get_daemon_info (struct MHD_Daemon *daemon,
01805                      enum MHD_DaemonInfoType infoType, 
01806                      ...);
01807 
01808 
01814 const char* 
01815 MHD_get_version (void);
01816 
01817 #if 0                           /* keep Emacsens' auto-indent happy */
01818 {
01819 #endif
01820 #ifdef __cplusplus
01821 }
01822 #endif
01823 
01824 #endif

Generated on Thu Sep 27 17:55:14 2012 for GNU libmicrohttpd by  doxygen 1.4.7