aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-04-08 22:59:05 +0200
committerChristian Grothoff <christian@grothoff.org>2020-04-08 22:59:05 +0200
commit6347f514aa2388e774d5bf356df8046864e5f73c (patch)
tree98cebf52cce627341d62620255f0ffe0ed36365d /src/include
parent6702e6202368720d7a381669c03eedc318f225ca (diff)
downloadlibmicrohttpd-6347f514aa2388e774d5bf356df8046864e5f73c.tar.gz
libmicrohttpd-6347f514aa2388e774d5bf356df8046864e5f73c.zip
introduce 'enum MHD_Result'
Diffstat (limited to 'src/include')
-rw-r--r--src/include/microhttpd.h134
1 files changed, 71 insertions, 63 deletions
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 109afa5b..f0daa3df 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of libmicrohttpd 2 This file is part of libmicrohttpd
3 Copyright (C) 2006--2019 Christian Grothoff (and other contributing authors) 3 Copyright (C) 2006--2020 Christian Grothoff (and other contributing authors)
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public 6 modify it under the terms of the GNU Lesser General Public
@@ -135,14 +135,22 @@ typedef intptr_t ssize_t;
135#define MHD_VERSION 0x00097001 135#define MHD_VERSION 0x00097001
136 136
137/** 137/**
138 * MHD-internal return code for "YES". 138 * Operational results from MHD calls.
139 */ 139 */
140#define MHD_YES 1 140enum MHD_Result
141{
142 /**
143 * MHD result code for "NO".
144 */
145 MHD_NO = 0,
146
147 /**
148 * MHD result code for "YES".
149 */
150 MHD_YES = 1
151
152};
141 153
142/**
143 * MHD-internal return code for "NO".
144 */
145#define MHD_NO 0
146 154
147/** 155/**
148 * MHD digest auth internal code for an invalid nonce. 156 * MHD digest auth internal code for an invalid nonce.
@@ -2118,10 +2126,10 @@ typedef void
2118 * @param addrlen length of @a addr 2126 * @param addrlen length of @a addr
2119 * @return #MHD_YES if connection is allowed, #MHD_NO if not 2127 * @return #MHD_YES if connection is allowed, #MHD_NO if not
2120 */ 2128 */
2121typedef int 2129typedef enum MHD_Result
2122(*MHD_AcceptPolicyCallback) (void *cls, 2130(*MHD_AcceptPolicyCallback)(void *cls,
2123 const struct sockaddr *addr, 2131 const struct sockaddr *addr,
2124 socklen_t addrlen); 2132 socklen_t addrlen);
2125 2133
2126 2134
2127/** 2135/**
@@ -2163,15 +2171,15 @@ typedef int
2163 * #MHD_NO if the socket must be closed due to a serios 2171 * #MHD_NO if the socket must be closed due to a serios
2164 * error while handling the request 2172 * error while handling the request
2165 */ 2173 */
2166typedef int 2174typedef enum MHD_Result
2167(*MHD_AccessHandlerCallback) (void *cls, 2175(*MHD_AccessHandlerCallback)(void *cls,
2168 struct MHD_Connection *connection, 2176 struct MHD_Connection *connection,
2169 const char *url, 2177 const char *url,
2170 const char *method, 2178 const char *method,
2171 const char *version, 2179 const char *version,
2172 const char *upload_data, 2180 const char *upload_data,
2173 size_t *upload_data_size, 2181 size_t *upload_data_size,
2174 void **con_cls); 2182 void **con_cls);
2175 2183
2176 2184
2177/** 2185/**
@@ -2234,11 +2242,11 @@ typedef void
2234 * #MHD_NO to abort the iteration 2242 * #MHD_NO to abort the iteration
2235 * @ingroup request 2243 * @ingroup request
2236 */ 2244 */
2237typedef int 2245typedef enum MHD_Result
2238(*MHD_KeyValueIterator) (void *cls, 2246(*MHD_KeyValueIterator)(void *cls,
2239 enum MHD_ValueKind kind, 2247 enum MHD_ValueKind kind,
2240 const char *key, 2248 const char *key,
2241 const char *value); 2249 const char *value);
2242 2250
2243 2251
2244/** 2252/**
@@ -2259,13 +2267,13 @@ typedef int
2259 * #MHD_NO to abort the iteration 2267 * #MHD_NO to abort the iteration
2260 * @ingroup request 2268 * @ingroup request
2261 */ 2269 */
2262typedef int 2270typedef enum MHD_Result
2263(*MHD_KeyValueIteratorN) (void *cls, 2271(*MHD_KeyValueIteratorN)(void *cls,
2264 enum MHD_ValueKind kind, 2272 enum MHD_ValueKind kind,
2265 const char *key, 2273 const char *key,
2266 size_t key_size, 2274 size_t key_size,
2267 const char *value, 2275 const char *value,
2268 size_t value_size); 2276 size_t value_size);
2269 2277
2270 2278
2271/** 2279/**
@@ -2351,16 +2359,16 @@ typedef void
2351 * @return #MHD_YES to continue iterating, 2359 * @return #MHD_YES to continue iterating,
2352 * #MHD_NO to abort the iteration 2360 * #MHD_NO to abort the iteration
2353 */ 2361 */
2354typedef int 2362typedef enum MHD_Result
2355(*MHD_PostDataIterator) (void *cls, 2363(*MHD_PostDataIterator)(void *cls,
2356 enum MHD_ValueKind kind, 2364 enum MHD_ValueKind kind,
2357 const char *key, 2365 const char *key,
2358 const char *filename, 2366 const char *filename,
2359 const char *content_type, 2367 const char *content_type,
2360 const char *transfer_encoding, 2368 const char *transfer_encoding,
2361 const char *data, 2369 const char *data,
2362 uint64_t off, 2370 uint64_t off,
2363 size_t size); 2371 size_t size);
2364 2372
2365/* **************** Daemon handling functions ***************** */ 2373/* **************** Daemon handling functions ***************** */
2366 2374
@@ -2481,7 +2489,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon);
2481 * set to indicate further details about the error. 2489 * set to indicate further details about the error.
2482 * @ingroup specialized 2490 * @ingroup specialized
2483 */ 2491 */
2484_MHD_EXTERN int 2492_MHD_EXTERN enum MHD_Result
2485MHD_add_connection (struct MHD_Daemon *daemon, 2493MHD_add_connection (struct MHD_Daemon *daemon,
2486 MHD_socket client_socket, 2494 MHD_socket client_socket,
2487 const struct sockaddr *addr, 2495 const struct sockaddr *addr,
@@ -2517,7 +2525,7 @@ MHD_add_connection (struct MHD_Daemon *daemon,
2517 * fit fd_set. 2525 * fit fd_set.
2518 * @ingroup event 2526 * @ingroup event
2519 */ 2527 */
2520_MHD_EXTERN int 2528_MHD_EXTERN enum MHD_Result
2521MHD_get_fdset (struct MHD_Daemon *daemon, 2529MHD_get_fdset (struct MHD_Daemon *daemon,
2522 fd_set *read_fd_set, 2530 fd_set *read_fd_set,
2523 fd_set *write_fd_set, 2531 fd_set *write_fd_set,
@@ -2557,7 +2565,7 @@ MHD_get_fdset (struct MHD_Daemon *daemon,
2557 * fit fd_set. 2565 * fit fd_set.
2558 * @ingroup event 2566 * @ingroup event
2559 */ 2567 */
2560_MHD_EXTERN int 2568_MHD_EXTERN enum MHD_Result
2561MHD_get_fdset2 (struct MHD_Daemon *daemon, 2569MHD_get_fdset2 (struct MHD_Daemon *daemon,
2562 fd_set *read_fd_set, 2570 fd_set *read_fd_set,
2563 fd_set *write_fd_set, 2571 fd_set *write_fd_set,
@@ -2613,7 +2621,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
2613 * necessitate the use of a timeout right now). 2621 * necessitate the use of a timeout right now).
2614 * @ingroup event 2622 * @ingroup event
2615 */ 2623 */
2616_MHD_EXTERN int 2624_MHD_EXTERN enum MHD_Result
2617MHD_get_timeout (struct MHD_Daemon *daemon, 2625MHD_get_timeout (struct MHD_Daemon *daemon,
2618 MHD_UNSIGNED_LONG_LONG *timeout); 2626 MHD_UNSIGNED_LONG_LONG *timeout);
2619 2627
@@ -2638,7 +2646,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
2638 * options for this call. 2646 * options for this call.
2639 * @ingroup event 2647 * @ingroup event
2640 */ 2648 */
2641_MHD_EXTERN int 2649_MHD_EXTERN enum MHD_Result
2642MHD_run (struct MHD_Daemon *daemon); 2650MHD_run (struct MHD_Daemon *daemon);
2643 2651
2644 2652
@@ -2664,7 +2672,7 @@ MHD_run (struct MHD_Daemon *daemon);
2664 * @return #MHD_NO on serious errors, #MHD_YES on success 2672 * @return #MHD_NO on serious errors, #MHD_YES on success
2665 * @ingroup event 2673 * @ingroup event
2666 */ 2674 */
2667_MHD_EXTERN int 2675_MHD_EXTERN enum MHD_Result
2668MHD_run_from_select (struct MHD_Daemon *daemon, 2676MHD_run_from_select (struct MHD_Daemon *daemon,
2669 const fd_set *read_fd_set, 2677 const fd_set *read_fd_set,
2670 const fd_set *write_fd_set, 2678 const fd_set *write_fd_set,
@@ -2737,7 +2745,7 @@ MHD_get_connection_values_n (struct MHD_Connection *connection,
2737 * #MHD_YES on success 2745 * #MHD_YES on success
2738 * @ingroup request 2746 * @ingroup request
2739 */ 2747 */
2740_MHD_EXTERN int 2748_MHD_EXTERN enum MHD_Result
2741MHD_set_connection_value (struct MHD_Connection *connection, 2749MHD_set_connection_value (struct MHD_Connection *connection,
2742 enum MHD_ValueKind kind, 2750 enum MHD_ValueKind kind,
2743 const char *key, 2751 const char *key,
@@ -2769,7 +2777,7 @@ MHD_set_connection_value (struct MHD_Connection *connection,
2769 * #MHD_YES on success 2777 * #MHD_YES on success
2770 * @ingroup request 2778 * @ingroup request
2771 */ 2779 */
2772int 2780_MHD_EXTERN enum MHD_Result
2773MHD_set_connection_value_n (struct MHD_Connection *connection, 2781MHD_set_connection_value_n (struct MHD_Connection *connection,
2774 enum MHD_ValueKind kind, 2782 enum MHD_ValueKind kind,
2775 const char *key, 2783 const char *key,
@@ -2846,7 +2854,7 @@ MHD_lookup_connection_value (struct MHD_Connection *connection,
2846 * #MHD_NO otherwise. 2854 * #MHD_NO otherwise.
2847 * @ingroup request 2855 * @ingroup request
2848 */ 2856 */
2849_MHD_EXTERN int 2857_MHD_EXTERN enum MHD_Result
2850MHD_lookup_connection_value_n (struct MHD_Connection *connection, 2858MHD_lookup_connection_value_n (struct MHD_Connection *connection,
2851 enum MHD_ValueKind kind, 2859 enum MHD_ValueKind kind,
2852 const char *key, 2860 const char *key,
@@ -2866,7 +2874,7 @@ MHD_lookup_connection_value_n (struct MHD_Connection *connection,
2866 * #MHD_YES on success or if message has been queued 2874 * #MHD_YES on success or if message has been queued
2867 * @ingroup response 2875 * @ingroup response
2868 */ 2876 */
2869_MHD_EXTERN int 2877_MHD_EXTERN enum MHD_Result
2870MHD_queue_response (struct MHD_Connection *connection, 2878MHD_queue_response (struct MHD_Connection *connection,
2871 unsigned int status_code, 2879 unsigned int status_code,
2872 struct MHD_Response *response); 2880 struct MHD_Response *response);
@@ -2980,7 +2988,7 @@ enum MHD_ResponseOptions
2980 * @param ... #MHD_RO_END terminated list of options 2988 * @param ... #MHD_RO_END terminated list of options
2981 * @return #MHD_YES on success, #MHD_NO on error 2989 * @return #MHD_YES on success, #MHD_NO on error
2982 */ 2990 */
2983_MHD_EXTERN int 2991_MHD_EXTERN enum MHD_Result
2984MHD_set_response_options (struct MHD_Response *response, 2992MHD_set_response_options (struct MHD_Response *response,
2985 enum MHD_ResponseFlags flags, 2993 enum MHD_ResponseFlags flags,
2986 ...); 2994 ...);
@@ -3239,7 +3247,7 @@ struct MHD_UpgradeResponseHandle;
3239 * @param ... arguments to the action (depends on the action) 3247 * @param ... arguments to the action (depends on the action)
3240 * @return #MHD_NO on error, #MHD_YES on success 3248 * @return #MHD_NO on error, #MHD_YES on success
3241 */ 3249 */
3242_MHD_EXTERN int 3250_MHD_EXTERN enum MHD_Result
3243MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, 3251MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
3244 enum MHD_UpgradeAction action, 3252 enum MHD_UpgradeAction action,
3245 ...); 3253 ...);
@@ -3359,7 +3367,7 @@ MHD_destroy_response (struct MHD_Response *response);
3359 * or out of memory 3367 * or out of memory
3360 * @ingroup response 3368 * @ingroup response
3361 */ 3369 */
3362_MHD_EXTERN int 3370_MHD_EXTERN enum MHD_Result
3363MHD_add_response_header (struct MHD_Response *response, 3371MHD_add_response_header (struct MHD_Response *response,
3364 const char *header, 3372 const char *header,
3365 const char *content); 3373 const char *content);
@@ -3374,7 +3382,7 @@ MHD_add_response_header (struct MHD_Response *response,
3374 * @return #MHD_NO on error (i.e. invalid footer or content format). 3382 * @return #MHD_NO on error (i.e. invalid footer or content format).
3375 * @ingroup response 3383 * @ingroup response
3376 */ 3384 */
3377_MHD_EXTERN int 3385_MHD_EXTERN enum MHD_Result
3378MHD_add_response_footer (struct MHD_Response *response, 3386MHD_add_response_footer (struct MHD_Response *response,
3379 const char *footer, 3387 const char *footer,
3380 const char *content); 3388 const char *content);
@@ -3389,7 +3397,7 @@ MHD_add_response_footer (struct MHD_Response *response,
3389 * @return #MHD_NO on error (no such header known) 3397 * @return #MHD_NO on error (no such header known)
3390 * @ingroup response 3398 * @ingroup response
3391 */ 3399 */
3392_MHD_EXTERN int 3400_MHD_EXTERN enum MHD_Result
3393MHD_del_response_header (struct MHD_Response *response, 3401MHD_del_response_header (struct MHD_Response *response,
3394 const char *header, 3402 const char *header,
3395 const char *content); 3403 const char *content);
@@ -3470,7 +3478,7 @@ MHD_create_post_processor (struct MHD_Connection *connection,
3470 * (out-of-memory, iterator aborted, parse error) 3478 * (out-of-memory, iterator aborted, parse error)
3471 * @ingroup request 3479 * @ingroup request
3472 */ 3480 */
3473_MHD_EXTERN int 3481_MHD_EXTERN enum MHD_Result
3474MHD_post_process (struct MHD_PostProcessor *pp, 3482MHD_post_process (struct MHD_PostProcessor *pp,
3475 const char *post_data, size_t post_data_len); 3483 const char *post_data, size_t post_data_len);
3476 3484
@@ -3485,7 +3493,7 @@ MHD_post_process (struct MHD_PostProcessor *pp,
3485 * value of this function 3493 * value of this function
3486 * @ingroup request 3494 * @ingroup request
3487 */ 3495 */
3488_MHD_EXTERN int 3496_MHD_EXTERN enum MHD_Result
3489MHD_destroy_post_processor (struct MHD_PostProcessor *pp); 3497MHD_destroy_post_processor (struct MHD_PostProcessor *pp);
3490 3498
3491 3499
@@ -3665,7 +3673,7 @@ MHD_digest_auth_check_digest (struct MHD_Connection *connection,
3665 * @return #MHD_YES on success, #MHD_NO otherwise 3673 * @return #MHD_YES on success, #MHD_NO otherwise
3666 * @ingroup authentication 3674 * @ingroup authentication
3667 */ 3675 */
3668_MHD_EXTERN int 3676_MHD_EXTERN enum MHD_Result
3669MHD_queue_auth_fail_response2 (struct MHD_Connection *connection, 3677MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
3670 const char *realm, 3678 const char *realm,
3671 const char *opaque, 3679 const char *opaque,
@@ -3691,7 +3699,7 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
3691 * @ingroup authentication 3699 * @ingroup authentication
3692 * @deprecated use MHD_queue_auth_fail_response2() 3700 * @deprecated use MHD_queue_auth_fail_response2()
3693 */ 3701 */
3694_MHD_EXTERN int 3702_MHD_EXTERN enum MHD_Result
3695MHD_queue_auth_fail_response (struct MHD_Connection *connection, 3703MHD_queue_auth_fail_response (struct MHD_Connection *connection,
3696 const char *realm, 3704 const char *realm,
3697 const char *opaque, 3705 const char *opaque,
@@ -3777,7 +3785,7 @@ enum MHD_CONNECTION_OPTION
3777 * @return #MHD_YES on success, #MHD_NO if setting the option failed 3785 * @return #MHD_YES on success, #MHD_NO if setting the option failed
3778 * @ingroup specialized 3786 * @ingroup specialized
3779 */ 3787 */
3780_MHD_EXTERN int 3788_MHD_EXTERN enum MHD_Result
3781MHD_set_connection_option (struct MHD_Connection *connection, 3789MHD_set_connection_option (struct MHD_Connection *connection,
3782 enum MHD_CONNECTION_OPTION option, 3790 enum MHD_CONNECTION_OPTION option,
3783 ...); 3791 ...);
@@ -4042,7 +4050,7 @@ enum MHD_FEATURE
4042 * feature is not supported or feature is unknown. 4050 * feature is not supported or feature is unknown.
4043 * @ingroup specialized 4051 * @ingroup specialized
4044 */ 4052 */
4045_MHD_EXTERN int 4053_MHD_EXTERN enum MHD_Result
4046MHD_is_feature_supported (enum MHD_FEATURE feature); 4054MHD_is_feature_supported (enum MHD_FEATURE feature);
4047 4055
4048 4056