--- libmicrohttpd-0.4.0pre1/src/include/microhttpd.h 2008-11-16 18:12:32.000000000 -0500 +++ libmicrohttpd-0.4.0/src/include/microhttpd.h 2009-02-06 00:38:43.000000000 -0500 @@ -1,6 +1,6 @@ /* This file is part of libmicrohttpd - (C) 2006, 2007, 2008 Christian Grothoff (and other contributing authors) + (C) 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -59,9 +59,9 @@ * thread-safe (with the exception of 'MHD_set_connection_value', * which must only be used in a particular context).
* - * NEW: Before including "microhttpd.h" you should add the - * necessary includes to define the "size_t", "fd_set", "socklen_t" and - * "struct sockaddr" data types (which headers are needed may + * NEW: Before including "microhttpd.h" you should add the necessary + * includes to define the "uint64_t", "size_t", "fd_set", "socklen_t" + * and "struct sockaddr" data types (which headers are needed may * depend on your platform; for possible suggestions consult * "platform.h" in the MHD distribution). * @@ -81,7 +81,7 @@ /** * Current version of the library. */ -#define MHD_VERSION 0x00040000 +#define MHD_VERSION 0x00040001 /** * MHD-internal return codes. @@ -297,8 +297,8 @@ MHD_OPTION_END = 0, /** - * Maximum memory size per connection (followed by an - * unsigned int). + * Maximum memory size per connection (followed by a + * size_t). */ MHD_OPTION_CONNECTION_MEMORY_LIMIT = 1, @@ -377,7 +377,7 @@ * "const char*" argument. * This should be used in conjunction with 'MHD_OPTION_HTTPS_MEM_CERT'. */ - MHD_OPTION_HTTPS_MEM_KEY = 9, + MHD_OPTION_HTTPS_MEM_KEY = 8, /** * Memory pointer for the certificate (cert.pem) to be used by the @@ -385,14 +385,14 @@ * "const char*" argument. * This should be used in conjunction with 'MHD_OPTION_HTTPS_MEM_KEY'. */ - MHD_OPTION_HTTPS_MEM_CERT = 10, + MHD_OPTION_HTTPS_MEM_CERT = 9, /** - * Daemon credentials type. + * Daemon credentials type. * This option should be followed by one of the values listed in * "enum MHD_GNUTLS_CredentialsType". */ - MHD_OPTION_CRED_TYPE = 11, + MHD_OPTION_CRED_TYPE = 10, /** * SSL/TLS protocol version. @@ -402,7 +402,7 @@ * protocol versions to this server should support. Unsupported * requests will be droped by the server. */ - MHD_OPTION_PROTOCOL_VERSION = 12, + MHD_OPTION_PROTOCOL_VERSION = 11, /** * Memory pointer to a zero (MHD_GNUTLS_CIPHER_UNKNOWN) @@ -410,38 +410,22 @@ * representing the cipher priority order to which the HTTPS * daemon should adhere. */ - MHD_OPTION_CIPHER_ALGORITHM = 13, + MHD_OPTION_CIPHER_ALGORITHM = 12, /** - * Memory pointer to a zero (MHD_GNUTLS_KX_UNKNOWN) - * terminated (const) array of 'MHD_GNUTLS_KeyExchangeAlgorithm' representing the - * key exchange algorithm priority order to which the HTTPS daemon should adhere. + * Use the given function for logging error messages. + * This option must be followed by two arguments; the + * first must be a pointer to a function + * of type "void fun(void * arg, const char * fmt, va_list ap)" + * and the second a pointer "void*" which will + * be passed as the "arg" argument to "fun". + *
+ * Note that MHD will not generate any log messages + * if it was compiled without the "--enable-messages" + * flag being set. */ - MHD_OPTION_KX_PRIORITY = 14, + MHD_OPTION_EXTERNAL_LOGGER = 13 - /** - * Indicate which type of certificate this server will use, - * followed by a value of type 'enum MHD_GNUTLS_CertificateType'. - */ - MHD_OPTION_CERT_TYPE = 15, - - /** - * Specify the mac algorithm used by server. - * The argument should be of type "enum MHD_GNUTLS_MacAlgorithm" - */ - MHD_OPTION_MAC_ALGO = 16, - - /** - * Compression algorithm used by server. Should be followed by an - * option of type 'enum MHD_GNUTLS_CompressionMethod'. - */ - MHD_OPTION_TLS_COMP_ALGO = 17, - - /** - * This value is used to indicate the end of the - * list of vararg options. - */ - MHD_HTTPS_OPTION_END = -1 }; /** @@ -518,7 +502,7 @@ * We had to close the session since MHD was being * shut down. */ - MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN = 3, + MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN = 3 }; @@ -534,80 +518,7 @@ MHD_GNUTLS_CIPHER_ARCFOUR_128, MHD_GNUTLS_CIPHER_3DES_CBC, MHD_GNUTLS_CIPHER_AES_128_CBC, - MHD_GNUTLS_CIPHER_AES_256_CBC, - MHD_GNUTLS_CIPHER_ARCFOUR_40, - MHD_GNUTLS_CIPHER_RC2_40_CBC = 90, - MHD_GNUTLS_CIPHER_DES_CBC -}; - -/** - * List of key exchange algorithms. - * Note that not all listed algorithms are necessarily - * supported by all builds of MHD. - */ -enum MHD_GNUTLS_KeyExchangeAlgorithm -{ - MHD_GNUTLS_KX_UNKNOWN = 0, - MHD_GNUTLS_KX_RSA = 1, - MHD_GNUTLS_KX_DHE_DSS, - MHD_GNUTLS_KX_DHE_RSA, - MHD_GNUTLS_KX_SRP, - MHD_GNUTLS_KX_RSA_EXPORT, - MHD_GNUTLS_KX_SRP_RSA, - MHD_GNUTLS_KX_SRP_DSS -}; - -/** - * Server credentials type (note that not all types - * maybe supported by all MHD builds). - */ -enum MHD_GNUTLS_CredentialsType -{ - /** - * We have a x.509 certificate. - */ - MHD_GNUTLS_CRD_CERTIFICATE = 1, - -}; - -/** - * Enumeration of possible cryptographic - * hash functions (for MAC and Digest operations). - * Note that not all listed algorithms are necessarily - * supported by all builds of MHD. - */ -enum MHD_GNUTLS_HashAlgorithm -{ - MHD_GNUTLS_MAC_UNKNOWN = 0, - MHD_GNUTLS_MAC_NULL = 1, - MHD_GNUTLS_MAC_MD5, - MHD_GNUTLS_MAC_SHA1, - MHD_GNUTLS_MAC_SHA256 -#if 0 - /* unsupported */ - MHD_GNUTLS_MAC_SHA384, - MHD_GNUTLS_MAC_SHA512 -#endif -}; - -/** - * List of compression methods. - * Note that not all listed algorithms are necessarily - * supported by all builds of MHD. - */ -enum MHD_GNUTLS_CompressionMethod -{ - MHD_GNUTLS_COMP_UNKNOWN = 0, - - /** - * No compression. - */ - MHD_GNUTLS_COMP_NULL = 1, - - /** - * gzip compression. - */ - MHD_GNUTLS_COMP_DEFLATE + MHD_GNUTLS_CIPHER_AES_256_CBC }; /** @@ -626,30 +537,6 @@ }; /** - * Types of certificates. - */ -enum MHD_GNUTLS_CertificateType -{ - MHD_GNUTLS_CRT_UNKNOWN = 0, - MHD_GNUTLS_CRT_X509 = 1 -}; - -/** - * List of public key algorithms. - * Note that not all listed algorithms are necessarily - * supported by all builds of MHD. - */ -enum MHD_GNUTLS_PublicKeyAlgorithm -{ - MHD_GNUTLS_PK_UNKNOWN = 0, - MHD_GNUTLS_PK_RSA = 1 -#if 0 - /* unsupported */ - MHD_GNUTLS_PK_DSA -#endif -}; - -/** * Values of this enum are used to specify what * information about a connection is desired. */ @@ -662,40 +549,16 @@ MHD_CONNECTION_INFO_CIPHER_ALGO, /** - * What key exchange algorithm is being used. - * Takes no extra arguments. - */ - MHD_CONNECTION_INFO_KX_ALGO, - - /** - * - * Takes no extra arguments. - */ - MHD_CONNECTION_INFO_CREDENTIALS_TYPE, - - /** - * - * Takes no extra arguments. - */ - MHD_CONNECTION_INFO_MAC_ALGO, - - /** - * What compression method is being used. - * Takes no extra arguments. - */ - MHD_CONNECTION_INFO_COMPRESSION_METHOD, - - /** * * Takes no extra arguments. */ MHD_CONNECTION_INFO_PROTOCOL, /** - * - * Takes no extra arguments. + * Obtain IP address of the client. + * Takes no extra arguments. */ - MHD_CONNECTION_INFO_CERT_TYPE + MHD_CONNECTION_INFO_CLIENT_ADDRESS }; /** @@ -800,7 +663,7 @@ const char *method, const char *version, const char *upload_data, - unsigned int *upload_data_size, + size_t *upload_data_size, void **con_cls); /** @@ -868,7 +731,10 @@ * requests using the same TCP connection). */ typedef int - (*MHD_ContentReaderCallback) (void *cls, size_t pos, char *buf, int max); + (*MHD_ContentReaderCallback) (void *cls, + uint64_t pos, + char *buf, + int max); /** * This method is called by libmicrohttpd if we @@ -904,7 +770,7 @@ const char *filename, const char *content_type, const char *transfer_encoding, - const char *data, size_t off, size_t size); + const char *data, uint64_t off, size_t size); /* **************** Daemon handling functions ***************** */ @@ -1074,7 +940,7 @@ /** * Queue a response to be transmitted to the client (as soon as - * possible). + * possible but after MHD_AccessHandlerCallback returns). * * @param connection the connection identifying the client * @param status_code HTTP status code (i.e. 200 for OK) @@ -1104,9 +970,8 @@ * @param crfc callback to call to free crc_cls resources * @return NULL on error (i.e. invalid arguments, out of memory) */ -struct MHD_Response *MHD_create_response_from_callback (size_t size, - unsigned int - block_size, +struct MHD_Response *MHD_create_response_from_callback (uint64_t size, + size_t block_size, MHD_ContentReaderCallback crc, void *crc_cls, MHD_ContentReaderFreeCallback @@ -1216,7 +1081,7 @@ */ struct MHD_PostProcessor *MHD_create_post_processor (struct MHD_Connection *connection, - unsigned int buffer_size, + size_t buffer_size, MHD_PostDataIterator iter, void *cls); @@ -1236,7 +1101,7 @@ */ int MHD_post_process (struct MHD_PostProcessor *pp, - const char *post_data, unsigned int post_data_len); + const char *post_data, size_t post_data_len); /** * Release PostProcessor resources. @@ -1260,13 +1125,11 @@ union MHD_ConnectionInfo { enum MHD_GNUTLS_CipherAlgorithm cipher_algorithm; - enum MHD_GNUTLS_KeyExchangeAlgorithm kx_algorithm; - enum MHD_GNUTLS_CredentialsType credentials_type; - enum MHD_GNUTLS_HashAlgorithm mac_algorithm; - enum MHD_GNUTLS_CompressionMethod compression_method; enum MHD_GNUTLS_Protocol protocol; - enum MHD_GNUTLS_CertificateType certificate_type; - enum MHD_GNUTLS_PublicKeyAlgorithm pk_algorithm; + /** + * Address information for the client. + */ + struct sockaddr_in * client_addr; }; /**