|
KEEL 1.0.0
Minimal C11 HTTP client/server library built on epoll/kqueue/io_uring/poll
|
#include <connection.h>

Data Fields | |
| int | fd |
| KlConnState | state |
| KlAllocator * | alloc |
| char * | read_buf |
| size_t | read_len |
| size_t | read_cap |
| size_t | max_header_size |
| KlRequest | req |
| KlResponse | res |
| KlParser * | parser |
| size_t | hdr_sent |
| KlRoute * | route |
| KlParam | params [KL_MAX_PARAMS] |
| int | num_params |
| int | route_result |
| uint64_t | last_active_ms |
| uint64_t | request_start_ms |
| uint64_t | body_start_ms |
| KlChunkedDecoder | chunked_dec |
| KlTls * | tls |
| int | tls_want |
| KlWsServerConn * | ws |
| KlH2ServerConn * | h2 |
| KlH2ServerConfig * | h2_config |
| KlRouter * | router |
| size_t | max_body_size |
| struct KlAsyncOp * | async_op |
| uint64_t | suspend_start_ms |
| KlFileIO * | file_io |
| int | file_io_phase |
| size_t | file_io_len |
| size_t | file_io_sent |
| void(* | access_log )(const KlRequest *req, int status, size_t body_bytes, double duration_ms, void *user_data) |
| void * | access_log_data |
| struct KlConn * | next_free |
| int KlConn::fd |
Socket file descriptor
| KlConnState KlConn::state |
Connection state
| KlAllocator* KlConn::alloc |
Allocator (set once on pool init)
| char* KlConn::read_buf |
Read buffer
| size_t KlConn::read_len |
Bytes in read buffer
| size_t KlConn::read_cap |
Read buffer capacity
| size_t KlConn::max_header_size |
Max header size (from KlConfig)
| KlRequest KlConn::req |
Current request
| KlResponse KlConn::res |
Current response
| KlParser* KlConn::parser |
HTTP parser
| size_t KlConn::hdr_sent |
Header bytes sent
| KlRoute* KlConn::route |
Matched route (set after HEADERS_OK)
| KlParam KlConn::params[KL_MAX_PARAMS] |
Extracted route parameters
| int KlConn::num_params |
Number of route parameters
| int KlConn::route_result |
Router match result (200/404/405)
| uint64_t KlConn::last_active_ms |
Monotonic clock, updated on every I/O
| uint64_t KlConn::request_start_ms |
Stamped at processing start for access log
| uint64_t KlConn::body_start_ms |
Stamped when entering READING_BODY
| KlChunkedDecoder KlConn::chunked_dec |
Chunked decoder (reused per-request)
| KlTls* KlConn::tls |
TLS session (NULL for plaintext)
| int KlConn::tls_want |
KL_EVENT_READ or KL_EVENT_WRITE during handshake
| KlWsServerConn* KlConn::ws |
WebSocket state (NULL until upgrade)
| KlH2ServerConn* KlConn::h2 |
HTTP/2 state (NULL until upgrade)
| KlH2ServerConfig* KlConn::h2_config |
HTTP/2 config (set once at pool init)
| KlRouter* KlConn::router |
Back-pointer to server router
| size_t KlConn::max_body_size |
Discard-path body limit (from KlConfig)
| struct KlAsyncOp* KlConn::async_op |
Active async op (non-NULL when SUSPENDED)
| uint64_t KlConn::suspend_start_ms |
Monotonic time when suspended
| KlFileIO* KlConn::file_io |
Async file I/O (set once at pool init)
| int KlConn::file_io_phase |
FILE_IO_IDLE/READING/WRITING/CANCELLING
| size_t KlConn::file_io_len |
Bytes from last async read
| size_t KlConn::file_io_sent |
Bytes written to socket so far
| void(* KlConn::access_log) (const KlRequest *req, int status, size_t body_bytes, double duration_ms, void *user_data) |
Access log callback (set once at pool init)
| void* KlConn::access_log_data |
Opaque data for access_log callback
| struct KlConn* KlConn::next_free |
Free list linkage