cwist
Modern C web framework with libttak runtime
Loading...
Searching...
No Matches
cwist_http2_stream_hooks Struct Reference

#include <http2.h>

Public Attributes

void *(* on_conn_open )(void *user_ctx)
 
void(* on_conn_close )(void *conn_ctx)
 
void *(* on_headers )(void *conn_ctx, cwist_http_request *req, cwist_h2_stream *stream)
 
int(* on_data )(void *conn_ctx, void *stream_ctx, const unsigned char *data, size_t len, int end_stream)
 
void(* on_cancel )(void *conn_ctx, void *stream_ctx)
 
int(* on_poll )(void *conn_ctx, void *stream_ctx)
 
uint64_t(* next_deadline_ms )(void *conn_ctx)
 
void(* on_close )(void *conn_ctx, void *stream_ctx)
 

Detailed Description

Optional per-connection hooks that let a higher layer (gRPC) take over individual streams: inbound DATA is delivered incrementally instead of being buffered, and the stream emits its own response frames.

Definition at line 36 of file http2.h.

Member Data Documentation

◆ next_deadline_ms

uint64_t(* cwist_http2_stream_hooks::next_deadline_ms) (void *conn_ctx)

Nearest deadline (monotonic ms) across taken streams; 0 = none. Bounds the dispatcher's socket wait so deadlines fire on time.

Definition at line 56 of file http2.h.

Referenced by cwist_http2_serve_connection_ex().

◆ on_cancel

void(* cwist_http2_stream_hooks::on_cancel) (void *conn_ctx, void *stream_ctx)

Peer sent RST_STREAM (cancellation).

Definition at line 50 of file http2.h.

Referenced by cwist_http2_serve_connection_ex().

◆ on_close

void(* cwist_http2_stream_hooks::on_close) (void *conn_ctx, void *stream_ctx)

Stream teardown; release the ctx returned by on_headers.

Definition at line 58 of file http2.h.

◆ on_conn_close

void(* cwist_http2_stream_hooks::on_conn_close) (void *conn_ctx)

Definition at line 40 of file http2.h.

◆ on_conn_open

void *(* cwist_http2_stream_hooks::on_conn_open) (void *user_ctx)

Called once per connection; the result backs every other callback. May be NULL, in which case user_ctx is used as the hook context.

Definition at line 39 of file http2.h.

Referenced by cwist_http2_serve_connection_ex().

◆ on_data

int(* cwist_http2_stream_hooks::on_data) (void *conn_ctx, void *stream_ctx, const unsigned char *data, size_t len, int end_stream)

Feed an inbound DATA payload; end_stream marks the client's final frame. Return non-zero to tear the stream down.

Definition at line 47 of file http2.h.

Referenced by cwist_http2_serve_connection_ex().

◆ on_headers

void *(* cwist_http2_stream_hooks::on_headers) (void *conn_ctx, cwist_http_request *req, cwist_h2_stream *stream)

Called when a request header block completes. Return non-NULL to take over the stream (incremental DATA delivery, custom response); NULL keeps the default buffered dispatch.

Definition at line 44 of file http2.h.

◆ on_poll

int(* cwist_http2_stream_hooks::on_poll) (void *conn_ctx, void *stream_ctx)

Called on every dispatcher iteration; enforce deadlines here. Return non-zero when the stream is finished and may be torn down.

Definition at line 53 of file http2.h.

Referenced by cwist_http2_serve_connection_ex().


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