|
Csilk 0.2.1
A lightweight, high-performance C HTTP web framework
|
Internal layout of csilk_ctx_s — the central per-request data structure. More...


Go to the source code of this file.
Data Structures | |
| struct | csilk_method_handler_t |
| Method-specific handler mapping with OpenAPI metadata and permission info. More... | |
| struct | csilk_storage_item_t |
| A single key-value item in the context's custom storage linked list. More... | |
| struct | csilk_ctx_t |
| Main Request Context — holds all state for the current HTTP request/response cycle. More... | |
Functions | |
| void | _csilk_ctx_init (csilk_ctx_t *c, struct csilk_server_s *s, void *client) |
| Internal context initialiser. | |
Internal layout of csilk_ctx_s — the central per-request data structure.
This header defines the actual memory layout of the request context struct. It is included ONLY by internal framework code (src/core/). External handlers receive an opaque csilk_ctx_t* and interact through the public API in csilk.h.
The context is the single most important data structure in csilk. It is created per-connection, reused across keep-alive requests via csilk_ctx_cleanup(), and carries:
| struct csilk_method_handler_s |
Method-specific handler mapping with OpenAPI metadata and permission info.
Each entry in this linked list represents one HTTP method + handler chain registered at a specific route path. In addition to the handler function array, it carries optional metadata used by:

| Data Fields | ||
|---|---|---|
| const char * | description |
Detailed description of the operation. |
| csilk_handler_t * | handlers |
NULL-terminated array of handler function pointers for this method. |
| const char * | input_type |
Registered type name for request body binding (optional, used by csilk_bind_reflect()). |
| char * | method |
HTTP method string (e.g., "GET", "POST"). |
| struct csilk_method_handler_s * | next |
Next method handler in this node's linked list. |
| const char * | output_type |
Registered type name for response generation (optional, used by csilk_json_reflect()). |
| char * | path |
Metadata for OpenAPI spec generation URL path pattern (e.g., "/users/:id"). |
| const char * | perm_required |
Permission metadata for interface-level access control Permission required for this route (e.g., "read", "write"), or NULL if no check. |
| const char * | perm_resource |
Resource pattern for permission check (e.g., "users:*"), or NULL. |
| const char * | summary |
Short summary of the operation. |
| struct csilk_storage_item_t |
A single key-value item in the context's custom storage linked list.
Items are allocated from the request arena and form a singly-linked list accessible via csilk_set()/csilk_get(). When a storage driver is set on the context, it takes precedence over this simple linked list.
| void _csilk_ctx_init | ( | csilk_ctx_t * | c, |
| struct csilk_server_s * | s, | ||
| void * | client | ||
| ) |
Internal context initialiser.
Internal context initialiser.
Sets up default values for all fields. Should be called for both static (embedded in client) and dynamic (H2 stream) contexts.
| c | The context to initialize. |
| s | The owning server instance. |
| client | The underlying connection object (csilk_client_t*). |