cwist
Modern C web framework with libttak runtime
Loading...
Searching...
No Matches
async.h
Go to the documentation of this file.
1
42#ifndef __CWIST_NET_HTTP_ASYNC_H__
43#define __CWIST_NET_HTTP_ASYNC_H__
44
45#include <cwist/net/http/http.h>
46#include <stdbool.h>
47#include <stddef.h>
48#include <stdint.h>
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54typedef struct cwist_async cwist_async;
55
73
88
96
102
109void cwist_async_set_timeout(cwist_async *a, uint64_t ms);
110
117bool cwist_async_respond(cwist_async *a, cwist_http_status_t status, const char *content_type,
118 const void *body, size_t len);
119
130
135
140
141#ifdef __cplusplus
142}
143#endif
144
145#endif /* __CWIST_NET_HTTP_ASYNC_H__ */
void cwist_async_dispatch_ack(cwist_async *a)
Internal: on the dispatch thread, after all middleware has unwound. Call exactly once; do not touch t...
Definition async.c:167
bool cwist_async_respond_with(cwist_async *a, cwist_http_response *res)
Complete the exchange with a caller-built response. On success the framework takes ownership of res (...
Definition async.c:359
cwist_async * cwist_async_retain(cwist_async *a)
Retain a live handle for a producer that may outlive completion. Must be called while the caller alre...
Definition async.c:154
bool cwist_async_respond(cwist_async *a, cwist_http_status_t status, const char *content_type, const void *body, size_t len)
Complete the exchange with a simple body response. Thread-safe and one-shot: the first of respond/res...
Definition async.c:340
void cwist_async_set_timeout(cwist_async *a, uint64_t ms)
Answer with a 504 Gateway Timeout if the exchange is still pending after ms milliseconds....
Definition async.c:328
bool cwist_async_abort(cwist_async *a, cwist_http_status_t status)
Complete the exchange with an error status and close the connection.
Definition async.c:370
void cwist_async_wait_dispatched(cwist_async *a)
Wait until dispatch has acknowledged the handoff of a.
Definition async.c:185
cwist_async * cwist_async_defer(cwist_http_request *req, cwist_http_response *res)
Defer the response for the current request.
Definition async.c:103
void cwist_async_release(cwist_async *a)
Release a reference acquired with cwist_async_retain(). Does not complete or abort the exchange....
Definition async.c:159
struct cwist_async cwist_async
Definition async.h:54
cwist_http_status_t
Definition http.h:27
HTTP Protocol Definitions and Helpers.
HTTP Response Object. Supports standard string body or Zero-Copy pointer body.
Definition http.h:82