|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
The route table: where a request goes. More...
Go to the source code of this file.
Classes | |
| struct | HttpRoute |
| Internal route entry stored in the routing table. More... | |
| struct | HttpRouteNs |
| Dispatch table. Addressed by offset, so the layout is asserted below. More... | |
Typedefs | |
| typedef struct HttpRoute | HttpRoute |
| Internal route entry stored in the routing table. | |
| typedef struct HttpRouteCtx | HttpRouteCtx |
| The table's storage. Declared, never defined here: the layout stays in route.c. | |
Enumerations | |
| enum | HttpRouteType { ROUTE_HTTP } |
| Discriminates between HTTP, WebSocket, and SSE route entries. More... | |
Functions | |
| PROTOCORE_NS_LAYOUT (HttpRouteNs, add, count, at, reset) | |
| 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_routes_count (uint8_t *work) |
| Entries currently registered. | |
| HttpRoute * | protocore_http_routes_at (uint8_t *work, uint8_t i) |
| Entry i, or NULL if i is past the end. | |
| void | protocore_http_routes_reset (uint8_t *work) |
| Empty the table. For tests: a case that does not reset matches . | |
| uint8_t * | protocore_http_route_span (void) |
| The bytes every entry here runs out of: the one route table. | |
Variables | |
| PROTOCORE_NS HttpRouteNs HttpRoutes | PROTOCORE_UNUSED |
| Module namespace. | |
The route table: where a request goes.
A row names a path pattern, a method, a handler, and the ws / sse / mount / credential id the request needs. Every one of those is HTTP, so the table sits under the HTTP root rather than at the network layer, which routes datagrams.
The module exports one symbol, HttpRoutes. Everything in route.c has internal linkage.
work is bytes the CALLER holds. This module reads none of them: it carries nothing between calls, so there is no state to keep and nothing to wipe. The parameter is there so a caller drives every namespace the same way.
Definition in file http_route.h.
Internal route entry stored in the routing table.
Populated by on(), on_ws(), or on_sse(). Application code does not interact with this struct directly.
| typedef struct HttpRouteCtx HttpRouteCtx |
The table's storage. Declared, never defined here: the layout stays in route.c.
Definition at line 96 of file http_route.h.
| enum HttpRouteType |
Discriminates between HTTP, WebSocket, and SSE route entries.
| Enumerator | |
|---|---|
| ROUTE_HTTP | Standard HTTP request/response. |
Definition at line 32 of file http_route.h.
| PROTOCORE_NS_LAYOUT | ( | HttpRouteNs | , |
| add | , | ||
| count | , | ||
| at | , | ||
| reset | |||
| ) |
| HttpRoute * protocore_http_routes_add | ( | uint8_t * | work | ) |
Take the next free entry, zeroed and ready to fill, or NULL when .
| work | PROTOCORE_HTTP_ROUTES_BORROW bytes the caller took. Not held past the call. |
| uint8_t protocore_http_routes_count | ( | uint8_t * | work | ) |
Entries currently registered.
| work | PROTOCORE_HTTP_ROUTES_BORROW bytes the caller took. Not held past the call. |
| HttpRoute * protocore_http_routes_at | ( | uint8_t * | work, |
| uint8_t | i | ||
| ) |
Entry i, or NULL if i is past the end.
| work | PROTOCORE_HTTP_ROUTES_BORROW bytes the caller took. Not held past the call. |
| i | I |
| void protocore_http_routes_reset | ( | uint8_t * | work | ) |
Empty the table. For tests: a case that does not reset matches .
| work | PROTOCORE_HTTP_ROUTES_BORROW bytes the caller took. Not held past the call. |
| uint8_t * protocore_http_route_span | ( | void | ) |
The bytes every entry here runs out of: the one route table.
Stated beside the namespace rather than on it: an entry takes a borrow, and this is where that borrow comes from. Every registrar and every reader drives the same table, so the bytes belong to this module rather than to any one caller. Taken once from the end of the secure pool, which no mark and no release walks, so the table lasts the life of the program.
| PROTOCORE_NS HttpRouteNs HttpRoutes PROTOCORE_UNUSED |
Module namespace.
Definition at line 146 of file http_route.h.