14#ifndef PROTOCORE_HTTP_H
15#define PROTOCORE_HTTP_H
98#if PROTOCORE_ENABLE_EDGE_CACHE
104#if PROTOCORE_ENABLE_EDGE_CACHE
114 void (*
const status_text)(uint8_t *work);
115 void (*
const parse_method)(uint8_t *work);
116 void (*
const method_name)(uint8_t *work);
117 void (*
const path_matches)(uint8_t *work);
118 void (*
const match_path_params)(uint8_t *work);
119 void (*
const req_is_head)(uint8_t *work);
120 void (*
const allow_append)(uint8_t *work);
121 void (*
const match_and_execute)(uint8_t *work);
122 void (*
const set_not_found)(uint8_t *work);
123 void (*
const poll_slot)(uint8_t *work);
124 void (*
const reset)(uint8_t *work);
125 void (*
const set_edge_poll)(uint8_t *work);
147static const HttpNs Http __attribute__((unused)) = {
void protocore_http_path_matches(uint8_t *work)
void protocore_http_match_path_params(uint8_t *work)
void protocore_http_set_not_found(uint8_t *work)
void protocore_http_poll_slot(uint8_t *work)
HttpMethod
The request methods a route binds to.
@ HTTP_PUT
Idempotent replace.
@ HTTP_DELETE
Idempotent delete.
@ HTTP_GET
Safe, idempotent read.
@ HTTP_METHOD_UNKNOWN
Unrecognized method token, answered 501.
@ HTTP_OPTIONS
Capability query / CORS preflight.
@ HTTP_POST
Non-idempotent create / action.
@ HTTP_HEAD
Same as GET but no response body.
@ HTTP_PATCH
Partial update.
uint8_t * protocore_http_span(void)
The PROTOCORE_HTTP_BORROW bytes this module's state lives in.
void(* Handler)(uint8_t slot_id, HttpReq *request)
A route's request handler.
void protocore_http_method_name(uint8_t *work)
void protocore_http_allow_append(uint8_t *work)
void protocore_http_req_is_head(uint8_t *work)
void protocore_http_match_and_execute(uint8_t *work)
void protocore_http_parse_method(uint8_t *work)
HttpVars HttpV
The operands and the outcome.
void protocore_http_reset(uint8_t *work)
void protocore_http_set_edge_poll(uint8_t *work)
void protocore_http_status_text(uint8_t *work)
RFC 9110 sec 10.2.1 Allow: the comma-separated list an append builds.
char * buf
where the list is built
size_t cap
how much room it has
RFC 9110 sec 9: a method, held either as the enum or as its token.
HttpMethod method
the method a name lookup names
const char * token
a method token, or the one an Allow list appends
void(*const status_text)(uint8_t *work)
RFC 9110 sec 7.1 request target: the route pattern, and the path tested against it.
const char * route
the route path a match tests
const char * path
the request path a match tests against
proto_bool is_wildcard
that route ends in a trailing star
HttpReq * req
the request a param capture writes into
HttpRouteArgs route_args
the target a route is matched against
int code
the status code a lookup names
HttpMethodArgs method_args
a method, as an enum or as a token
HttpAllowArgs allow
the Allow list an append builds
uint8_t slot
the connection every call names
Handler cb
the handler a request runs when no route matched
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
_Bool proto_bool
The truth value.
#define PROTOCORE_END_DECLS