4#ifndef PROTOCORE_HTTP_ROUTE_H
5#define PROTOCORE_HTTP_ROUTE_H
35#if PROTOCORE_ENABLE_WEBSOCKET
38#if PROTOCORE_ENABLE_SSE
41#if PROTOCORE_ENABLE_FILE_SERVING
44#if PROTOCORE_ENABLE_WEBDAV
62#if PROTOCORE_ENABLE_WEBSOCKET
69#if PROTOCORE_ENABLE_SSE
75#if PROTOCORE_ENABLE_FILE_SERVING
81#if PROTOCORE_ENABLE_AUTH
102 uint8_t (*count)(uint8_t *);
104 void (*reset)(uint8_t *);
enum PROTO_ENUM_PACKED protocore_if_kind
What an interface is, and the filter that selects one.
#define MAX_PATH_LEN
Maximum URL path length (including leading /).
The HTTP root: the parts of the protocol that do not belong to one version.
HttpMethod
The request methods a route binds to.
void(* Handler)(uint8_t slot_id, HttpReq *request)
A route's request handler.
PROTOCORE_NS HttpRouteNs HttpRoutes PROTOCORE_UNUSED
Module namespace.
HttpRoute * protocore_http_routes_at(uint8_t *work, uint8_t i)
Entry i, or NULL if i is past the end.
uint8_t protocore_http_routes_count(uint8_t *work)
Entries currently registered.
void protocore_http_routes_reset(uint8_t *work)
Empty the table. For tests: a case that does not reset matches .
struct HttpRouteCtx HttpRouteCtx
The table's storage. Declared, never defined here: the layout stays in route.c.
HttpRoute * protocore_http_routes_add(uint8_t *work)
Take the next free entry, zeroed and ready to fill, or NULL when .
uint8_t * protocore_http_route_span(void)
The bytes every entry here runs out of: the one route table.
HttpRouteType
Discriminates between HTTP, WebSocket, and SSE route entries.
@ ROUTE_HTTP
Standard HTTP request/response.
#define PROTOCORE_NS_LAYOUT(T,...)
Pin every dispatch slot of a table that is nothing but function pointers.
#define PROTOCORE_NS
Storage for a dispatch table. The const is load bearing.
Dispatch table. Addressed by offset, so the layout is asserted below.
HttpRoute *(* add)(uint8_t *)
Internal route entry stored in the routing table.
HttpMethod method
HTTP method (ROUTE_HTTP only).
Handler callback
HTTP handler (ROUTE_HTTP only).
protocore_if_kind iface_filter
Interface gate; PROTOCORE_IF_ANY (0) = match any interface.
HttpRouteType type
HTTP, WS, or SSE.
proto_bool is_wildcard
true when path ends with *.
proto_bool is_regex
true when the path is a regex (see on_regex()).
char path[MAX_PATH_LEN]
Null-terminated path pattern.
proto_bool is_active
false for unused table slots.
proto_bool is_param
true when the path contains a :name segment.
#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