KEEL 1.0.0
Minimal C11 HTTP client/server library built on epoll/kqueue/io_uring/poll
Loading...
Searching...
No Matches
Data Fields
KlConn Struct Reference

#include <connection.h>

Collaboration diagram for KlConn:
Collaboration graph
[legend]

Data Fields

int fd
 
KlConnState state
 
KlAllocatoralloc
 
char * read_buf
 
size_t read_len
 
size_t read_cap
 
size_t max_header_size
 
KlRequest req
 
KlResponse res
 
KlParserparser
 
size_t hdr_sent
 
KlRouteroute
 
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
 
KlTlstls
 
int tls_want
 
KlWsServerConnws
 
KlH2ServerConnh2
 
KlH2ServerConfigh2_config
 
KlRouterrouter
 
size_t max_body_size
 
struct KlAsyncOpasync_op
 
uint64_t suspend_start_ms
 
KlFileIOfile_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 KlConnnext_free
 

Field Documentation

◆ fd

int KlConn::fd

Socket file descriptor

◆ state

KlConnState KlConn::state

Connection state

◆ alloc

KlAllocator* KlConn::alloc

Allocator (set once on pool init)

◆ read_buf

char* KlConn::read_buf

Read buffer

◆ read_len

size_t KlConn::read_len

Bytes in read buffer

◆ read_cap

size_t KlConn::read_cap

Read buffer capacity

◆ max_header_size

size_t KlConn::max_header_size

Max header size (from KlConfig)

◆ req

KlRequest KlConn::req

Current request

◆ res

KlResponse KlConn::res

Current response

◆ parser

KlParser* KlConn::parser

HTTP parser

◆ hdr_sent

size_t KlConn::hdr_sent

Header bytes sent

◆ route

KlRoute* KlConn::route

Matched route (set after HEADERS_OK)

◆ params

KlParam KlConn::params[KL_MAX_PARAMS]

Extracted route parameters

◆ num_params

int KlConn::num_params

Number of route parameters

◆ route_result

int KlConn::route_result

Router match result (200/404/405)

◆ last_active_ms

uint64_t KlConn::last_active_ms

Monotonic clock, updated on every I/O

◆ request_start_ms

uint64_t KlConn::request_start_ms

Stamped at processing start for access log

◆ body_start_ms

uint64_t KlConn::body_start_ms

Stamped when entering READING_BODY

◆ chunked_dec

KlChunkedDecoder KlConn::chunked_dec

Chunked decoder (reused per-request)

◆ tls

KlTls* KlConn::tls

TLS session (NULL for plaintext)

◆ tls_want

int KlConn::tls_want

KL_EVENT_READ or KL_EVENT_WRITE during handshake

◆ ws

KlWsServerConn* KlConn::ws

WebSocket state (NULL until upgrade)

◆ h2

KlH2ServerConn* KlConn::h2

HTTP/2 state (NULL until upgrade)

◆ h2_config

KlH2ServerConfig* KlConn::h2_config

HTTP/2 config (set once at pool init)

◆ router

KlRouter* KlConn::router

Back-pointer to server router

◆ max_body_size

size_t KlConn::max_body_size

Discard-path body limit (from KlConfig)

◆ async_op

struct KlAsyncOp* KlConn::async_op

Active async op (non-NULL when SUSPENDED)

◆ suspend_start_ms

uint64_t KlConn::suspend_start_ms

Monotonic time when suspended

◆ file_io

KlFileIO* KlConn::file_io

Async file I/O (set once at pool init)

◆ file_io_phase

int KlConn::file_io_phase

FILE_IO_IDLE/READING/WRITING/CANCELLING

◆ file_io_len

size_t KlConn::file_io_len

Bytes from last async read

◆ file_io_sent

size_t KlConn::file_io_sent

Bytes written to socket so far

◆ access_log

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)

◆ access_log_data

void* KlConn::access_log_data

Opaque data for access_log callback

◆ next_free

struct KlConn* KlConn::next_free

Free list linkage


The documentation for this struct was generated from the following file: