aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-10-29 11:34:28 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-10-29 11:34:28 +0300
commit22300a5257849092ad9e2addceccaa0e99392c19 (patch)
tree46e80c747e33ba7f16c99cc1542b97c797956296
parentb5fd82df3f06cd27973ac19e7fbd00a63ebb381b (diff)
downloadlibmicrohttpd-22300a5257849092ad9e2addceccaa0e99392c19.tar.gz
libmicrohttpd-22300a5257849092ad9e2addceccaa0e99392c19.zip
microhttpd.h: doxy clarifications
"external select" -> "external sockets polling" and related clarifications
-rw-r--r--src/include/microhttpd.h73
1 files changed, 38 insertions, 35 deletions
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 4267f33d..af19c0fa 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -1118,6 +1118,7 @@ enum MHD_FLAG
1118 * be used. 1118 * be used.
1119 * This flag is set explicitly by #MHD_USE_POLL_INTERNAL_THREAD and 1119 * This flag is set explicitly by #MHD_USE_POLL_INTERNAL_THREAD and
1120 * by #MHD_USE_EPOLL_INTERNAL_THREAD. 1120 * by #MHD_USE_EPOLL_INTERNAL_THREAD.
1121 * When this flag is not set, MHD run in "external" polling mode.
1121 */ 1122 */
1122 MHD_USE_INTERNAL_POLLING_THREAD = 8, 1123 MHD_USE_INTERNAL_POLLING_THREAD = 8,
1123 1124
@@ -1157,11 +1158,12 @@ enum MHD_FLAG
1157#endif /* 0 */ 1158#endif /* 0 */
1158 1159
1159 /** 1160 /**
1160 * Use `poll()` instead of `select()`. This allows sockets with `fd >= 1161 * Use `poll()` instead of `select()` for polling sockets.
1161 * FD_SETSIZE`. This option is not compatible with using an 1162 * This allows sockets with `fd >= FD_SETSIZE`.
1162 * 'external' polling mode (as there is no API to get the file 1163 * This option is not compatible with an "external" polling mode
1163 * descriptors for the external poll() from MHD) and must also not 1164 * (as there is no API to get the file descriptors for the external
1164 * be used in combination with #MHD_USE_EPOLL. 1165 * poll() from MHD) and must also not be used in combination
1166 * with #MHD_USE_EPOLL.
1165 * @sa ::MHD_FEATURE_POLL, #MHD_USE_POLL_INTERNAL_THREAD 1167 * @sa ::MHD_FEATURE_POLL, #MHD_USE_POLL_INTERNAL_THREAD
1166 */ 1168 */
1167 MHD_USE_POLL = 64, 1169 MHD_USE_POLL = 64,
@@ -1226,7 +1228,7 @@ enum MHD_FLAG
1226#endif /* 0 */ 1228#endif /* 0 */
1227 1229
1228 /** 1230 /**
1229 * Run using an internal thread (or thread pool) doing `epoll()`. 1231 * Run using an internal thread (or thread pool) doing `epoll` polling.
1230 * This option is only available on certain platforms; using the option on 1232 * This option is only available on certain platforms; using the option on
1231 * platform without `epoll` support will cause #MHD_start_daemon to fail. 1233 * platform without `epoll` support will cause #MHD_start_daemon to fail.
1232 * @sa ::MHD_FEATURE_EPOLL, #MHD_USE_EPOLL, #MHD_USE_INTERNAL_POLLING_THREAD 1234 * @sa ::MHD_FEATURE_EPOLL, #MHD_USE_EPOLL, #MHD_USE_INTERNAL_POLLING_THREAD
@@ -1254,7 +1256,7 @@ enum MHD_FLAG
1254 /** 1256 /**
1255 * Use inter-thread communication channel. 1257 * Use inter-thread communication channel.
1256 * #MHD_USE_ITC can be used with #MHD_USE_INTERNAL_POLLING_THREAD 1258 * #MHD_USE_ITC can be used with #MHD_USE_INTERNAL_POLLING_THREAD
1257 * and is ignored with any "external" mode. 1259 * and is ignored with any "external" sockets polling.
1258 * It's required for use of #MHD_quiesce_daemon 1260 * It's required for use of #MHD_quiesce_daemon
1259 * or #MHD_add_connection. 1261 * or #MHD_add_connection.
1260 * This option is enforced by #MHD_ALLOW_SUSPEND_RESUME or 1262 * This option is enforced by #MHD_ALLOW_SUSPEND_RESUME or
@@ -2157,7 +2159,8 @@ enum MHD_DaemonInfoType
2157 MHD_DAEMON_INFO_LISTEN_FD, 2159 MHD_DAEMON_INFO_LISTEN_FD,
2158 2160
2159 /** 2161 /**
2160 * Request the file descriptor for the external epoll. 2162 * Request the file descriptor for the "external" sockets polling
2163 * when 'epoll' mode is used.
2161 * No extra arguments should be passed. 2164 * No extra arguments should be passed.
2162 * 2165 *
2163 * Waiting on epoll FD must not block longer than value 2166 * Waiting on epoll FD must not block longer than value
@@ -2173,7 +2176,7 @@ enum MHD_DaemonInfoType
2173 /** 2176 /**
2174 * Request the number of current connections handled by the daemon. 2177 * Request the number of current connections handled by the daemon.
2175 * No extra arguments should be passed. 2178 * No extra arguments should be passed.
2176 * Note: when using MHD in external polling mode, this type of request 2179 * Note: when using MHD in "external" polling mode, this type of request
2177 * could be used only when #MHD_run()/#MHD_run_from_select is not 2180 * could be used only when #MHD_run()/#MHD_run_from_select is not
2178 * working in other thread at the same time. 2181 * working in other thread at the same time.
2179 */ 2182 */
@@ -2372,9 +2375,10 @@ typedef enum MHD_Result
2372 2375
2373 2376
2374/** 2377/**
2375 * Callback used by libmicrohttpd in order to obtain content. The 2378 * Callback used by libmicrohttpd in order to obtain content.
2376 * callback is to copy at most @a max bytes of content into @a buf. The 2379 *
2377 * total number of bytes that has been placed into @a buf should be 2380 * The callback is to copy at most @a max bytes of content into @a buf.
2381 * The total number of bytes that has been placed into @a buf should be
2378 * returned. 2382 * returned.
2379 * 2383 *
2380 * Note that returning zero will cause libmicrohttpd to try again. 2384 * Note that returning zero will cause libmicrohttpd to try again.
@@ -2393,10 +2397,10 @@ typedef enum MHD_Result
2393 * @param buf where to copy the data 2397 * @param buf where to copy the data
2394 * @param max maximum number of bytes to copy to @a buf (size of @a buf) 2398 * @param max maximum number of bytes to copy to @a buf (size of @a buf)
2395 * @return number of bytes written to @a buf; 2399 * @return number of bytes written to @a buf;
2396 * 0 is legal unless we are running in internal select mode (since 2400 * 0 is legal unless MHD is started in "internal" sockets polling mode
2397 * this would cause busy-waiting); 0 in external select mode 2401 * (since this would cause busy-waiting); 0 in "external" sockets
2398 * will cause this function to be called again once the external 2402 * polling mode will cause this function to be called again once
2399 * select calls MHD again; 2403 * any MHD_run*() function is called;
2400 * #MHD_CONTENT_READER_END_OF_STREAM (-1) for the regular 2404 * #MHD_CONTENT_READER_END_OF_STREAM (-1) for the regular
2401 * end of transmission (with chunked encoding, MHD will then 2405 * end of transmission (with chunked encoding, MHD will then
2402 * terminate the chunk and send any HTTP footers that might be 2406 * terminate the chunk and send any HTTP footers that might be
@@ -2529,7 +2533,7 @@ MHD_start_daemon (unsigned int flags,
2529 * clients to continue processing, but stops accepting new 2533 * clients to continue processing, but stops accepting new
2530 * connections. Note that the caller is responsible for closing the 2534 * connections. Note that the caller is responsible for closing the
2531 * returned socket; however, if MHD is run using threads (anything but 2535 * returned socket; however, if MHD is run using threads (anything but
2532 * external select mode), it must not be closed until AFTER 2536 * "external" sockets polling mode), it must not be closed until AFTER
2533 * #MHD_stop_daemon has been called (as it is theoretically possible 2537 * #MHD_stop_daemon has been called (as it is theoretically possible
2534 * that an existing thread is still using it). 2538 * that an existing thread is still using it).
2535 * 2539 *
@@ -2564,9 +2568,8 @@ MHD_stop_daemon (struct MHD_Daemon *daemon);
2564 * for example if your HTTP server is behind NAT and needs to connect 2568 * for example if your HTTP server is behind NAT and needs to connect
2565 * out to the HTTP client, or if you are building a proxy. 2569 * out to the HTTP client, or if you are building a proxy.
2566 * 2570 *
2567 * If you use this API in conjunction with a internal select or a 2571 * If you use this API in conjunction with an "internal" socket polling,
2568 * thread pool, you must set the option 2572 * you must set the option #MHD_USE_ITC to ensure that the freshly added
2569 * #MHD_USE_ITC to ensure that the freshly added
2570 * connection is immediately processed by MHD. 2573 * connection is immediately processed by MHD.
2571 * 2574 *
2572 * The given client socket will be managed (and closed!) by MHD after 2575 * The given client socket will be managed (and closed!) by MHD after
@@ -2599,7 +2602,7 @@ MHD_add_connection (struct MHD_Daemon *daemon,
2599 * to be platform's default. 2602 * to be platform's default.
2600 * 2603 *
2601 * This function should only be called in when MHD is configured to 2604 * This function should only be called in when MHD is configured to
2602 * use external select with 'select()' or with 'epoll'. 2605 * use "external" sockets polling with 'select()' or with 'epoll'.
2603 * In the latter case, it will only add the single 'epoll' file 2606 * In the latter case, it will only add the single 'epoll' file
2604 * descriptor used by MHD to the sets. 2607 * descriptor used by MHD to the sets.
2605 * It's necessary to use #MHD_get_timeout() to get maximum timeout 2608 * It's necessary to use #MHD_get_timeout() to get maximum timeout
@@ -2640,7 +2643,7 @@ MHD_get_fdset (struct MHD_Daemon *daemon,
2640 * larger/smaller than platform's default fd_sets. 2643 * larger/smaller than platform's default fd_sets.
2641 * 2644 *
2642 * This function should only be called in when MHD is configured to 2645 * This function should only be called in when MHD is configured to
2643 * use external select with 'select()' or with 'epoll'. 2646 * use "external" sockets polling with 'select()' or with 'epoll'.
2644 * In the latter case, it will only add the single 'epoll' file 2647 * In the latter case, it will only add the single 'epoll' file
2645 * descriptor used by MHD to the sets. 2648 * descriptor used by MHD to the sets.
2646 * It's necessary to use #MHD_get_timeout() to get maximum timeout 2649 * It's necessary to use #MHD_get_timeout() to get maximum timeout
@@ -2681,7 +2684,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
2681 * determined by current value of FD_SETSIZE. 2684 * determined by current value of FD_SETSIZE.
2682 * 2685 *
2683 * This function should only be called in when MHD is configured to 2686 * This function should only be called in when MHD is configured to
2684 * use external select with 'select()' or with 'epoll'. 2687 * use "external" sockets polling with 'select()' or with 'epoll'.
2685 * In the latter case, it will only add the single 'epoll' file 2688 * In the latter case, it will only add the single 'epoll' file
2686 * descriptor used by MHD to the sets. 2689 * descriptor used by MHD to the sets.
2687 * It's necessary to use #MHD_get_timeout() to get maximum timeout 2690 * It's necessary to use #MHD_get_timeout() to get maximum timeout
@@ -2716,14 +2719,14 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
2716 * function (`select()`, `poll()` or epoll) should at most block, not the 2719 * function (`select()`, `poll()` or epoll) should at most block, not the
2717 * timeout value set for connections. 2720 * timeout value set for connections.
2718 * 2721 *
2719 * Any external polling function must be called with the timeout value 2722 * Any "external" sockets polling function must be called with the timeout
2720 * provided by this function. Smaller timeout values can be used for polling 2723 * value provided by this function. Smaller timeout values can be used for
2721 * function if it is required for any reason, but using larger timeout value 2724 * polling function if it is required for any reason, but using larger
2722 * or no timeout (indefinite timeout) when this function return #MHD_YES 2725 * timeout value or no timeout (indefinite timeout) when this function
2723 * will break MHD processing logic and result in "hung" connections with 2726 * return #MHD_YES will break MHD processing logic and result in "hung"
2724 * data pending in network buffers and other problems. 2727 * connections with data pending in network buffers and other problems.
2725 * 2728 *
2726 * It is important to always use this function when external polling is 2729 * It is important to always use this function when "external" polling is
2727 * used. If this function returns #MHD_YES then #MHD_run() (or 2730 * used. If this function returns #MHD_YES then #MHD_run() (or
2728 * #MHD_run_from_select()) must be called right after return from polling 2731 * #MHD_run_from_select()) must be called right after return from polling
2729 * function, regardless of the states of MHD fds. 2732 * function, regardless of the states of MHD fds.
@@ -2790,7 +2793,7 @@ MHD_run (struct MHD_Daemon *daemon);
2790 * This function calls MHD_get_timeout() internally and use returned value as 2793 * This function calls MHD_get_timeout() internally and use returned value as
2791 * maximum wait time if it less than value of @a millisec parameter. 2794 * maximum wait time if it less than value of @a millisec parameter.
2792 * 2795 *
2793 * It is expected that the external socket polling function is not used in 2796 * It is expected that the "external" socket polling function is not used in
2794 * conjunction with this function unless the @a millisec is set to zero. 2797 * conjunction with this function unless the @a millisec is set to zero.
2795 * 2798 *
2796 * @param daemon the daemon to run 2799 * @param daemon the daemon to run
@@ -3057,9 +3060,9 @@ MHD_queue_response (struct MHD_Connection *connection,
3057 * Suspend handling of network data for a given connection. This can 3060 * Suspend handling of network data for a given connection. This can
3058 * be used to dequeue a connection from MHD's event loop for a while. 3061 * be used to dequeue a connection from MHD's event loop for a while.
3059 * 3062 *
3060 * If you use this API in conjunction with a internal select or a 3063 * If you use this API in conjunction with an "internal" socket polling,
3061 * thread pool, you must set the option #MHD_USE_ITC to 3064 * you must set the option #MHD_USE_ITC to ensure that a resumed
3062 * ensure that a resumed connection is immediately processed by MHD. 3065 * connection is immediately processed by MHD.
3063 * 3066 *
3064 * Suspended connections continue to count against the total number of 3067 * Suspended connections continue to count against the total number of
3065 * connections allowed (per daemon, as well as per IP, if such limits 3068 * connections allowed (per daemon, as well as per IP, if such limits
@@ -3088,7 +3091,7 @@ MHD_suspend_connection (struct MHD_Connection *connection);
3088 * function on a connection that was not previously suspended will 3091 * function on a connection that was not previously suspended will
3089 * result in undefined behavior. 3092 * result in undefined behavior.
3090 * 3093 *
3091 * If you are using this function in ``external'' select mode, you must 3094 * If you are using this function in "external" sockets polling mode, you must
3092 * make sure to run #MHD_run() and #MHD_get_timeout() afterwards (before 3095 * make sure to run #MHD_run() and #MHD_get_timeout() afterwards (before
3093 * again calling #MHD_get_fdset()), as otherwise the change may not be 3096 * again calling #MHD_get_fdset()), as otherwise the change may not be
3094 * reflected in the set returned by #MHD_get_fdset() and you may end up 3097 * reflected in the set returned by #MHD_get_fdset() and you may end up