libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws-tls-sessions.h File Reference

#include <lws-tls-sessions.h>

Go to the source code of this file.

Data Structures

struct  lws_tls_session_dump

Macros

#define LWS_SESSION_TAG_LEN   96

Typedefs

typedef int(* lws_tls_sess_cb_t) (struct lws_context *cx, struct lws_tls_session_dump *info)

Enumerations

enum  { LWS_TLS_SESSION_DUMP_F_QUIC = (1 << 0) }

Functions

LWS_VISIBLE LWS_EXTERN int lws_tls_session_dump_save_flags (struct lws_vhost *vh, const char *host, uint16_t port, unsigned int flags, lws_tls_sess_cb_t cb_save, void *opq)
LWS_VISIBLE LWS_EXTERN int lws_tls_session_dump_load_flags (struct lws_vhost *vh, const char *host, uint16_t port, unsigned int flags, lws_tls_sess_cb_t cb_load, void *opq)
LWS_VISIBLE LWS_EXTERN int lws_tls_session_dump_save (struct lws_vhost *vh, const char *host, uint16_t port, lws_tls_sess_cb_t cb_save, void *opq)
LWS_VISIBLE LWS_EXTERN int lws_tls_session_dump_load (struct lws_vhost *vh, const char *host, uint16_t port, lws_tls_sess_cb_t cb_load, void *opq)

Data Structure Documentation

◆ lws_tls_session_dump

struct lws_tls_session_dump

Definition at line 34 of file lws-tls-sessions.h.

Collaboration diagram for lws_tls_session_dump:
Data Fields
char tag[LWS_SESSION_TAG_LEN]
void * blob
void * opaque
size_t blob_len

Macro Definition Documentation

◆ LWS_SESSION_TAG_LEN

#define LWS_SESSION_TAG_LEN   96

Definition at line 32 of file lws-tls-sessions.h.

Typedef Documentation

◆ lws_tls_sess_cb_t

typedef int(* lws_tls_sess_cb_t) (struct lws_context *cx, struct lws_tls_session_dump *info)

Definition at line 42 of file lws-tls-sessions.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
LWS_TLS_SESSION_DUMP_F_QUIC 

the session is the one made by, and offered to, quic connections to the host and port. They are cached apart from tls over tcp's: the client sends 0-RTT data under the session it resumes, and a ticket from one transport carries the wrong alpn and transport parameters for the other

Definition at line 48 of file lws-tls-sessions.h.

48 {
55};
@ LWS_TLS_SESSION_DUMP_F_QUIC

Function Documentation

◆ lws_tls_session_dump_save_flags()

LWS_VISIBLE LWS_EXTERN int lws_tls_session_dump_save_flags ( struct lws_vhost * vh,
const char * host,
uint16_t port,
unsigned int flags,
lws_tls_sess_cb_t cb_save,
void * opq )

lws_tls_session_dump_save_flags() - serialize a tls session via a callback

Parameters
vhthe vhost whose client session cache to look in
hostthe name of the host the session relates to
portthe port the session connects to on the host
flags0, or LWS_TLS_SESSION_DUMP_F_QUIC for the quic session
cb_savethe callback to perform the saving of the session blob
opqan opaque pointer passed into the callback

If a session matching the vhost/host/port and transport exists in the vhost's session cache, serialize it via the provided callback.

Only sessions of connections that fully validated the server are visible here: those of connections with relaxed cert checks are kept apart in the cache and never saved or loaded.

opq is passed to the callback without being used by lws at all.

Returns 0 if the session was found and the callback accepted it.

References LWS_EXTERN, and LWS_VISIBLE.

◆ lws_tls_session_dump_load_flags()

LWS_VISIBLE LWS_EXTERN int lws_tls_session_dump_load_flags ( struct lws_vhost * vh,
const char * host,
uint16_t port,
unsigned int flags,
lws_tls_sess_cb_t cb_load,
void * opq )

lws_tls_session_dump_load_flags() - deserialize a tls session via a callback

Parameters
vhthe vhost whose client session cache to load into
hostthe name of the host the session relates to
portthe port the session connects to on the host
flags0, or LWS_TLS_SESSION_DUMP_F_QUIC for a quic session
cb_loadthe callback to retreive the session blob from
opqan opaque pointer passed into the callback

Try to preload a session described by the vhost / host / port and transport into the client session cache, from the given callback. It is only offered to connections over that transport that fully validate the server. With LWS_TLS_SESSION_DUMP_F_QUIC, a client that opts into it sends 0-RTT data under the loaded session, so it must only be given what lws_tls_session_dump_save_flags() saved with the same flag.

opq is passed to the callback without being used by lws at all.

References LWS_EXTERN, and LWS_VISIBLE.

◆ lws_tls_session_dump_save()

LWS_VISIBLE LWS_EXTERN int lws_tls_session_dump_save ( struct lws_vhost * vh,
const char * host,
uint16_t port,
lws_tls_sess_cb_t cb_save,
void * opq )

lws_tls_session_dump_save() - serialize a tls over tcp session

As lws_tls_session_dump_save_flags() with flags 0

References LWS_EXTERN, and LWS_VISIBLE.

◆ lws_tls_session_dump_load()

LWS_VISIBLE LWS_EXTERN int lws_tls_session_dump_load ( struct lws_vhost * vh,
const char * host,
uint16_t port,
lws_tls_sess_cb_t cb_load,
void * opq )

lws_tls_session_dump_load() - deserialize a tls over tcp session

As lws_tls_session_dump_load_flags() with flags 0