diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-08-26 20:19:29 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-08-26 20:19:29 +0000 |
commit | a0dcd1ab1b234bbdfb5e2d4c92e48c7ea949cc6c (patch) | |
tree | e9ef24cb9866b2562aa086738e66676cc96725db | |
parent | cd030ca9cae26ecc21a916fb8e51a26bf3a7f9c4 (diff) | |
download | libmicrohttpd-a0dcd1ab1b234bbdfb5e2d4c92e48c7ea949cc6c.tar.gz libmicrohttpd-a0dcd1ab1b234bbdfb5e2d4c92e48c7ea949cc6c.zip |
-indentation, ideas for upgrade API
-rw-r--r-- | src/include/microhttpd.h | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index baff3974..eef50c70 100644 --- a/src/include/microhttpd.h +++ b/src/include/microhttpd.h | |||
@@ -685,7 +685,10 @@ enum MHD_FLAG | |||
685 | * @param ap arguments to @a fm | 685 | * @param ap arguments to @a fm |
686 | * @ingroup logging | 686 | * @ingroup logging |
687 | */ | 687 | */ |
688 | typedef void (*MHD_LogCallback)(void *cls, const char *fm, va_list ap); | 688 | typedef void |
689 | (*MHD_LogCallback)(void *cls, | ||
690 | const char *fm, | ||
691 | va_list ap); | ||
689 | 692 | ||
690 | 693 | ||
691 | /** | 694 | /** |
@@ -2232,9 +2235,6 @@ enum MHD_UpgradeAction | |||
2232 | * Close the socket, the application is done with it. | 2235 | * Close the socket, the application is done with it. |
2233 | * | 2236 | * |
2234 | * Takes no extra arguments. | 2237 | * Takes no extra arguments. |
2235 | * | ||
2236 | * NOTE: it is unclear if we want to have this in the | ||
2237 | * "final" API, this is all just ideas. | ||
2238 | */ | 2238 | */ |
2239 | MHD_UPGRADE_ACTION_CLOSE = 0, | 2239 | MHD_UPGRADE_ACTION_CLOSE = 0, |
2240 | 2240 | ||
@@ -2245,7 +2245,7 @@ enum MHD_UpgradeAction | |||
2245 | * Takes no extra arguments. | 2245 | * Takes no extra arguments. |
2246 | * | 2246 | * |
2247 | * NOTE: it is unclear if we want to have this in the | 2247 | * NOTE: it is unclear if we want to have this in the |
2248 | * "final" API, this is all just ideas. | 2248 | * "final" API, this is just an idea right now. |
2249 | */ | 2249 | */ |
2250 | MHD_UPGRADE_ACTION_CORK | 2250 | MHD_UPGRADE_ACTION_CORK |
2251 | 2251 | ||
@@ -2253,20 +2253,30 @@ enum MHD_UpgradeAction | |||
2253 | 2253 | ||
2254 | 2254 | ||
2255 | /** | 2255 | /** |
2256 | * Handle given to the application to manage special | ||
2257 | * actions relating to MHD responses that "upgrade" | ||
2258 | * the HTTP protocol (i.e. to WebSockets). | ||
2259 | */ | ||
2260 | struct MHD_UpgradeResponseHandle; | ||
2261 | |||
2262 | |||
2263 | /** | ||
2256 | * This connection-specific callback is provided by MHD to | 2264 | * This connection-specific callback is provided by MHD to |
2257 | * applications (unusual) during the #MHD_UpgradeHandler. | 2265 | * applications (unusual) during the #MHD_UpgradeHandler. |
2258 | * It allows applications to perform 'special' actions on | 2266 | * It allows applications to perform 'special' actions on |
2259 | * the underlying socket from the upgrade. | 2267 | * the underlying socket from the upgrade. |
2260 | * | 2268 | * |
2261 | * @param cls the closure (from `upgrade_action_cls`) | 2269 | * @param urh the handle identifying the connection to perform |
2270 | * the upgrade @a action on. | ||
2262 | * @param action which action should be performed | 2271 | * @param action which action should be performed |
2263 | * @param ... arguments to the action (depends on the action) | 2272 | * @param ... arguments to the action (depends on the action) |
2264 | * @return #MHD_NO on error, #MHD_YES on success | 2273 | * @return #MHD_NO on error, #MHD_YES on success |
2265 | */ | 2274 | */ |
2266 | typedef int | 2275 | _MHD_EXTERN int |
2267 | (*MHD_UpgradeActionCallback)(void *cls, | 2276 | MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, |
2268 | enum MHD_UpgradeAction action, | 2277 | enum MHD_UpgradeAction action, |
2269 | ...); | 2278 | ...); |
2279 | |||
2270 | 2280 | ||
2271 | /** | 2281 | /** |
2272 | * Function called after a protocol "upgrade" response was sent | 2282 | * Function called after a protocol "upgrade" response was sent |
@@ -2297,7 +2307,7 @@ typedef int | |||
2297 | * of this function should never block (as it will still be called | 2307 | * of this function should never block (as it will still be called |
2298 | * from within the main event loop). | 2308 | * from within the main event loop). |
2299 | * | 2309 | * |
2300 | * @param cls closure | 2310 | * @param cls closure, whatever was given to #MHD_create_response_for_upgrade(). |
2301 | * @param connection original HTTP connection handle, | 2311 | * @param connection original HTTP connection handle, |
2302 | * giving the function a last chance | 2312 | * giving the function a last chance |
2303 | * to inspect the original HTTP request | 2313 | * to inspect the original HTTP request |
@@ -2307,18 +2317,15 @@ typedef int | |||
2307 | * operations (TCP-specific setsockopt(), getsockopt(), etc.) | 2317 | * operations (TCP-specific setsockopt(), getsockopt(), etc.) |
2308 | * may not work as expected (as the socket could be from a | 2318 | * may not work as expected (as the socket could be from a |
2309 | * socketpair() or a TCP-loopback) | 2319 | * socketpair() or a TCP-loopback) |
2310 | * @param upgrade_action function that can be used to perform actions | 2320 | * @param urh argument for #MHD_upgrade_action()s on this @a connection. |
2311 | * on the @a sock (like those that cannot be done explicitly). | 2321 | * Applications must eventually use this callback to perform the |
2312 | * Applications must use this callback to perform the | ||
2313 | * close() action on the @a sock. | 2322 | * close() action on the @a sock. |
2314 | * @param upgrade_action_cls closure that must be passed to @a upgrade_action | ||
2315 | */ | 2323 | */ |
2316 | typedef void | 2324 | typedef void |
2317 | (*MHD_UpgradeHandler)(void *cls, | 2325 | (*MHD_UpgradeHandler)(void *cls, |
2318 | struct MHD_Connection *connection, | 2326 | struct MHD_Connection *connection, |
2319 | MHD_SOCKET sock, | 2327 | MHD_SOCKET sock, |
2320 | MHD_UpgradeActionCallback upgrade_action, | 2328 | struct MHD_UpgradeResponseHandle *urh); |
2321 | void *upgrade_action_cls); | ||
2322 | 2329 | ||
2323 | 2330 | ||
2324 | /** | 2331 | /** |
@@ -2350,7 +2357,7 @@ typedef void | |||
2350 | * @param upgrade_handler_cls closure for @a upgrade_handler | 2357 | * @param upgrade_handler_cls closure for @a upgrade_handler |
2351 | * @return NULL on error (i.e. invalid arguments, out of memory) | 2358 | * @return NULL on error (i.e. invalid arguments, out of memory) |
2352 | */ | 2359 | */ |
2353 | struct MHD_Response * | 2360 | _MHD_EXTERN struct MHD_Response * |
2354 | MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, | 2361 | MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, |
2355 | void *upgrade_handler_cls); | 2362 | void *upgrade_handler_cls); |
2356 | #endif | 2363 | #endif |