34 #include <gnutls/gnutls.h>
35 #if GNUTLS_VERSION_MAJOR >= 3
36 #include <gnutls/abstract.h>
40 #include <sys/epoll.h>
42 #if HAVE_NETINET_TCP_H
44 #include <netinet/tcp.h>
52 #define EXTRA_CHECKS MHD_NO
54 #define MHD_MAX(a,b) ((a)<(b)) ? (b) : (a)
55 #define MHD_MIN(a,b) ((a)<(b)) ? (a) : (b)
65 #define MHD_BUF_INC_SIZE 1024
84 #define MHD_PANIC(msg) mhd_panic (mhd_panic_cls, __FILE__, __LINE__, msg)
91 #define MHD_PANIC(msg) mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL)
169 #define MAX_NONCE_LENGTH 129
183 unsigned long int nc;
199 const char *format, ...);
474 #define DEBUG_STATES MHD_NO
493 void *write_to,
size_t max_bytes);
505 const void *write_to,
size_t max_bytes);
827 gnutls_session_t tls_session;
865 typedef void * (*LogCallback)(
void * cls,
1029 void (*custom_error_log) (
void *cls,
const char *fmt, va_list va);
1034 void *custom_error_log_cls;
1102 int listen_socket_in_epoll;
1155 gnutls_priority_t priority_cache;
1161 gnutls_credentials_type_t cred_type;
1166 gnutls_certificate_credentials_t x509_cred;
1171 gnutls_dh_params_t dh_params;
1173 #if GNUTLS_VERSION_MAJOR >= 3
1178 gnutls_certificate_retrieve_function2 *cert_callback;
1184 const char *https_mem_key;
1189 const char *https_mem_cert;
1194 const char *https_mem_trust;
1202 unsigned int num_tls_read_ready;
1206 #ifdef DAUTH_SUPPORT
1211 const char *digest_auth_random;
1221 pthread_mutex_t nnc_lock;
1226 size_t digest_auth_rand_size;
1231 unsigned int nonce_nc_size;
1239 unsigned int fastopen_queue_size;
1245 #define EXTRA_CHECK(a) if (!(a)) abort();
1247 #define EXTRA_CHECK(a)
1259 #define DLL_insert(head,tail,element) do { \
1260 (element)->next = (head); \
1261 (element)->prev = NULL; \
1262 if ((tail) == NULL) \
1265 (head)->prev = element; \
1266 (head) = (element); } while (0)
1278 #define DLL_remove(head,tail,element) do { \
1279 if ((element)->prev == NULL) \
1280 (head) = (element)->next; \
1282 (element)->prev->next = (element)->next; \
1283 if ((element)->next == NULL) \
1284 (tail) = (element)->prev; \
1286 (element)->next->prev = (element)->prev; \
1287 (element)->next = NULL; \
1288 (element)->prev = NULL; } while (0)
1300 #define XDLL_insert(head,tail,element) do { \
1301 (element)->nextX = (head); \
1302 (element)->prevX = NULL; \
1303 if ((tail) == NULL) \
1306 (head)->prevX = element; \
1307 (head) = (element); } while (0)
1319 #define XDLL_remove(head,tail,element) do { \
1320 if ((element)->prevX == NULL) \
1321 (head) = (element)->nextX; \
1323 (element)->prevX->nextX = (element)->nextX; \
1324 if ((element)->nextX == NULL) \
1325 (tail) = (element)->prevX; \
1327 (element)->nextX->prevX = (element)->prevX; \
1328 (element)->nextX = NULL; \
1329 (element)->prevX = NULL; } while (0)
1340 #define EDLL_insert(head,tail,element) do { \
1341 (element)->nextE = (head); \
1342 (element)->prevE = NULL; \
1343 if ((tail) == NULL) \
1346 (head)->prevE = element; \
1347 (head) = (element); } while (0)
1359 #define EDLL_remove(head,tail,element) do { \
1360 if ((element)->prevE == NULL) \
1361 (head) = (element)->nextE; \
1363 (element)->prevE->nextE = (element)->nextE; \
1364 if ((element)->nextE == NULL) \
1365 (tail) = (element)->prevE; \
1367 (element)->nextE->prevE = (element)->prevE; \
1368 (element)->nextE = NULL; \
1369 (element)->prevE = NULL; } while (0)
unsigned int per_ip_connection_limit
void * unescape_callback_cls
pthread_mutex_t per_ip_connection_mutex
ssize_t(* TransmitCallback)(struct MHD_Connection *conn, const void *write_to, size_t max_bytes)
pthread_mutex_t cleanup_connection_mutex
int(* write_handler)(struct MHD_Connection *connection)
enum MHD_CONNECTION_STATE state
int(* idle_handler)(struct MHD_Connection *connection)
uint64_t response_write_position
public interface to libmicrohttpd
enum MHD_ConnectionEventLoopInfo event_loop_info
size_t current_chunk_size
MHD_PanicCallback mhd_panic
size_t MHD_http_unescape(void *cls, struct MHD_Connection *connection, char *val)
MHD_ContentReaderFreeCallback crfc
void(* MHD_ContentReaderFreeCallback)(void *cls)
struct MHD_Response * response
void(* MHD_RequestCompletedCallback)(void *cls, struct MHD_Connection *connection, void **con_cls, enum MHD_RequestTerminationCode toe)
struct MHD_Connection * normal_timeout_tail
void *(* LogCallback)(void *cls, const char *uri, struct MHD_Connection *con)
struct MHD_HTTP_Header * first_header
MHD_AccessHandlerCallback default_handler
size_t current_chunk_offset
uint64_t remaining_upload_size
unsigned int responseCode
void * uri_log_callback_cls
int(* read_handler)(struct MHD_Connection *connection)
struct MHD_Daemon * daemon
struct MHD_Connection * manual_timeout_head
struct MHD_Connection * cleanup_head
struct MHD_Connection * cleanup_tail
struct MHD_Connection * prev
size_t write_buffer_send_offset
struct MHD_Daemon * worker_pool
struct MHD_Connection * nextX
struct MHD_Connection * manual_timeout_tail
size_t continue_message_write_offset
char nonce[MAX_NONCE_LENGTH]
unsigned int worker_pool_size
LogCallback uri_log_callback
unsigned int reference_count
int(* MHD_AcceptPolicyCallback)(void *cls, const struct sockaddr *addr, socklen_t addrlen)
ssize_t(* MHD_ContentReaderCallback)(void *cls, uint64_t pos, char *buf, size_t max)
size_t(* UnescapeCallback)(void *cls, struct MHD_Connection *conn, char *uri)
ssize_t(* ReceiveCallback)(struct MHD_Connection *conn, void *write_to, size_t max_bytes)
struct MHD_Connection * normal_timeout_head
UnescapeCallback unescape_callback
struct MHD_Connection * connections_head
struct MHD_Daemon * master
struct MHD_Connection * next
MHD_AcceptPolicyCallback apc
unsigned int connection_timeout
size_t write_buffer_append_offset
MHD_RequestCompletedCallback notify_completed
struct MHD_Connection * prevX
void * notify_completed_cls
TransmitCallback send_cls
MHD_ContentReaderCallback crc
struct MHD_Connection * suspended_connections_tail
MHD_ConnectionEventLoopInfo
time_t MHD_monotonic_time(void)
void * per_ip_connection_count
int(* MHD_AccessHandlerCallback)(void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls)
size_t read_buffer_offset
void * default_handler_cls
unsigned int connection_timeout
struct MHD_HTTP_Header * headers_received
struct MHD_Connection * connections_tail
struct MHD_HTTP_Header * headers_received_tail
unsigned int max_connections
struct MHD_Connection * suspended_connections_head
void(* MHD_PanicCallback)(void *cls, const char *file, unsigned int line, const char *reason)