KEEL 1.0.0
Minimal C11 HTTP client/server library built on epoll/kqueue/io_uring/poll
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
h2_server.h File Reference

Server-side HTTP/2 API. More...

#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
#include <keel/h2.h>
#include <keel/request.h>
#include <keel/response.h>
#include <keel/body_reader.h>
#include <keel/router.h>
Include dependency graph for h2_server.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  KlH2ServerCallbacks
 
struct  KlH2ServerSession
 
struct  KlH2ServerConfig
 
struct  KlH2ServerStream
 
struct  KlH2ServerConn
 

Typedefs

typedef struct KlH2ServerSession KlH2ServerSession
 
typedef struct KlH2ServerCallbacks KlH2ServerCallbacks
 
typedef struct KlH2ServerStream KlH2ServerStream
 
typedef struct KlH2ServerConn KlH2ServerConn
 
typedef struct KlConn KlConn
 
typedef KlH2ServerSession *(* KlH2ServerSessionFactory) (KlAllocator *alloc, KlH2ServerCallbacks *callbacks, void *user_data)
 Factory for creating server-side HTTP/2 sessions.
 
typedef struct KlH2ServerConfig KlH2ServerConfig
 

Functions

int kl_h2_server_upgrade (KlConn *c, KlRouter *router, KlH2ServerConfig *cfg, const char *leftover, size_t leftover_len)
 Upgrade a connection to HTTP/2 (direct h2c).
 
int kl_h2_server_upgrade_from_h1 (KlConn *c, KlRouter *router, KlH2ServerConfig *cfg, const char *leftover, size_t leftover_len)
 Upgrade a connection to HTTP/2 from an HTTP/1.1 Upgrade request.
 
int kl_h2_server_on_readable (KlConn *c)
 Handle readable event on an HTTP/2 connection.
 
int kl_h2_server_on_writable (KlConn *c)
 Handle writable event on an HTTP/2 connection.
 
void kl_h2_server_drain_shutdown (KlConn *c)
 Initiate graceful GOAWAY drain on an HTTP/2 connection.
 
void kl_h2_server_cleanup (KlConn *c)
 Clean up all HTTP/2 state for a connection.
 

Detailed Description

Server-side HTTP/2 API.

Server-side HTTP/2 types and functions. Shared protocol constants (max streams, window size) live in h2.h.

Typedef Documentation

◆ KlH2ServerSession

◆ KlH2ServerCallbacks

◆ KlH2ServerStream

◆ KlH2ServerConn

◆ KlConn

typedef struct KlConn KlConn

◆ KlH2ServerSessionFactory

typedef KlH2ServerSession *(* KlH2ServerSessionFactory) (KlAllocator *alloc, KlH2ServerCallbacks *callbacks, void *user_data)

Factory for creating server-side HTTP/2 sessions.

◆ KlH2ServerConfig

Function Documentation

◆ kl_h2_server_upgrade()

int kl_h2_server_upgrade ( KlConn c,
KlRouter router,
KlH2ServerConfig cfg,
const char *  leftover,
size_t  leftover_len 
)

Upgrade a connection to HTTP/2 (direct h2c).

◆ kl_h2_server_upgrade_from_h1()

int kl_h2_server_upgrade_from_h1 ( KlConn c,
KlRouter router,
KlH2ServerConfig cfg,
const char *  leftover,
size_t  leftover_len 
)

Upgrade a connection to HTTP/2 from an HTTP/1.1 Upgrade request.

◆ kl_h2_server_on_readable()

int kl_h2_server_on_readable ( KlConn c)

Handle readable event on an HTTP/2 connection.

◆ kl_h2_server_on_writable()

int kl_h2_server_on_writable ( KlConn c)

Handle writable event on an HTTP/2 connection.

◆ kl_h2_server_drain_shutdown()

void kl_h2_server_drain_shutdown ( KlConn c)

Initiate graceful GOAWAY drain on an HTTP/2 connection.

◆ kl_h2_server_cleanup()

void kl_h2_server_cleanup ( KlConn c)

Clean up all HTTP/2 state for a connection.