libwebsockets
Lightweight C library for HTML5 websockets
lws_context_creation_info Struct Reference

#include <libwebsockets.h>

Data Fields

int port
 
const char * iface
 
const struct lws_protocolsprotocols
 
const struct lws_extensionextensions
 
const struct lws_token_limitstoken_limits
 
const char * ssl_private_key_password
 
const char * ssl_cert_filepath
 
const char * ssl_private_key_filepath
 
const char * ssl_ca_filepath
 
const char * ssl_cipher_list
 
const char * http_proxy_address
 
unsigned int http_proxy_port
 
int gid
 
int uid
 
unsigned int options
 
void * user
 
int ka_time
 
int ka_probes
 
int ka_interval
 
SSL_CTXprovided_client_ssl_ctx
 
void * provided_client_ssl_ctx
 
short max_http_header_data
 
short max_http_header_pool
 
unsigned int count_threads
 
unsigned int fd_limit_per_thread
 
unsigned int timeout_secs
 
const char * ecdh_curve
 
const char * vhost_name
 
const char *const * plugin_dirs
 
const struct lws_protocol_vhost_optionspvo
 
int keepalive_timeout
 
const char * log_filepath
 
const struct lws_http_mountmounts
 
const char * server_string
 
unsigned int pt_serv_buf_size
 
unsigned int max_http_header_data2
 
long ssl_options_set
 
long ssl_options_clear
 
unsigned short ws_ping_pong_interval
 
const struct lws_protocol_vhost_optionsheaders
 
void * _unused [8]
 

Detailed Description

struct lws_context_creation_info - parameters to create context and /or vhost with

This is also used to create vhosts.... if LWS_SERVER_OPTION_EXPLICIT_VHOSTS is not given, then for backwards compatibility one vhost is created at context-creation time using the info from this struct.

If LWS_SERVER_OPTION_EXPLICIT_VHOSTS is given, then no vhosts are created at the same time as the context, they are expected to be created afterwards.

Field Documentation

◆ _unused

void* lws_context_creation_info::_unused[8]

dummy

◆ count_threads

unsigned int lws_context_creation_info::count_threads

CONTEXT: how many contexts to create in an array, 0 = 1

◆ ecdh_curve

const char* lws_context_creation_info::ecdh_curve

VHOST: if NULL, defaults to initializing server with "prime256v1"

◆ extensions

const struct lws_extension* lws_context_creation_info::extensions

VHOST: NULL or array of lws_extension structs listing the extensions this context supports.

◆ fd_limit_per_thread

unsigned int lws_context_creation_info::fd_limit_per_thread

CONTEXT: nonzero means restrict each service thread to this many fds, 0 means the default which is divide the process fd limit by the number of threads.

◆ gid

int lws_context_creation_info::gid

CONTEXT: group id to change to after setting listen socket, or -1.

◆ headers

const struct lws_protocol_vhost_options* lws_context_creation_info::headers

VHOST: pointer to optional linked list of per-vhost canned headers that are added to server responses

◆ http_proxy_address

const char* lws_context_creation_info::http_proxy_address

VHOST: If non-NULL, attempts to proxy via the given address. If proxy auth is required, use format "username:password\@server:port"

◆ http_proxy_port

unsigned int lws_context_creation_info::http_proxy_port

VHOST: If http_proxy_address was non-NULL, uses this port

◆ iface

const char* lws_context_creation_info::iface

VHOST: NULL to bind the listen socket to all interfaces, or the interface name, eg, "eth2" If options specifies LWS_SERVER_OPTION_UNIX_SOCK, this member is the pathname of a UNIX domain socket. you can use the UNIX domain sockets in abstract namespace, by prepending an at symbol to the socket name.

◆ ka_interval

int lws_context_creation_info::ka_interval

CONTEXT: if ka_time was nonzero, how long to wait before each ka_probes attempt

◆ ka_probes

int lws_context_creation_info::ka_probes

CONTEXT: if ka_time was nonzero, after the timeout expires how many times to try to get a response from the peer before giving up and killing the connection

◆ ka_time

int lws_context_creation_info::ka_time

CONTEXT: 0 for no TCP keepalive, otherwise apply this keepalive timeout to all libwebsocket sockets, client or server

◆ keepalive_timeout

int lws_context_creation_info::keepalive_timeout

VHOST: (default = 0 = 60s) seconds to allow remote client to hold on to an idle HTTP/1.1 connection

◆ log_filepath

const char* lws_context_creation_info::log_filepath

VHOST: filepath to append logs to... this is opened before any dropping of initial privileges

◆ max_http_header_data

short lws_context_creation_info::max_http_header_data

CONTEXT: The max amount of header payload that can be handled in an http request (unrecognized header payload is dropped)

◆ max_http_header_data2

unsigned int lws_context_creation_info::max_http_header_data2

CONTEXT: if max_http_header_data is 0 and this is nonzero, this will be used in place of the default. It's like this for compatibility with the original short version, this is unsigned int length.

◆ max_http_header_pool

short lws_context_creation_info::max_http_header_pool

CONTEXT: The max number of connections with http headers that can be processed simultaneously (the corresponding memory is allocated for the lifetime of the context). If the pool is busy new incoming connections must wait for accept until one becomes free.

◆ mounts

const struct lws_http_mount* lws_context_creation_info::mounts

VHOST: optional linked list of mounts for this vhost

◆ options

unsigned int lws_context_creation_info::options

VHOST + CONTEXT: 0, or LWS_SERVER_OPTION_... bitfields

◆ plugin_dirs

const char* const* lws_context_creation_info::plugin_dirs

CONTEXT: NULL, or NULL-terminated array of directories to scan for lws protocol plugins at context creation time

◆ port

int lws_context_creation_info::port

VHOST: Port to listen on... you can use CONTEXT_PORT_NO_LISTEN to suppress listening on any port, that's what you want if you are not running a websocket server at all but just using it as a client

◆ protocols

const struct lws_protocols* lws_context_creation_info::protocols

VHOST: Array of structures listing supported protocols and a protocol- specific callback for each one. The list is ended with an entry that has a NULL callback pointer.

◆ provided_client_ssl_ctx [1/2]

SSL_CTX* lws_context_creation_info::provided_client_ssl_ctx

CONTEXT: If non-null, swap out libwebsockets ssl implementation for the one provided by provided_ssl_ctx. Libwebsockets no longer is responsible for freeing the context if this option is selected.

◆ provided_client_ssl_ctx [2/2]

void* lws_context_creation_info::provided_client_ssl_ctx

dummy if ssl disabled

◆ pt_serv_buf_size

unsigned int lws_context_creation_info::pt_serv_buf_size

CONTEXT: 0 = default of 4096. This buffer is used by various service related features including file serving, it defines the max chunk of file that can be sent at once. At the risk of lws having to buffer failed large sends, it can be increased to, eg, 128KiB to improve throughput.

◆ pvo

const struct lws_protocol_vhost_options* lws_context_creation_info::pvo

VHOST: pointer to optional linked list of per-vhost options made accessible to protocols

◆ server_string

const char* lws_context_creation_info::server_string

CONTEXT: string used in HTTP headers to identify server software, if NULL, "libwebsockets".

◆ ssl_ca_filepath

const char* lws_context_creation_info::ssl_ca_filepath

VHOST: CA certificate filepath or NULL

◆ ssl_cert_filepath

const char* lws_context_creation_info::ssl_cert_filepath

VHOST: If libwebsockets was compiled to use ssl, and you want to listen using SSL, set to the filepath to fetch the server cert from, otherwise NULL for unencrypted

◆ ssl_cipher_list

const char* lws_context_creation_info::ssl_cipher_list

VHOST: List of valid ciphers to use (eg, "RC4-MD5:RC4-SHA:AES128-SHA:AES256-SHA:HIGH:!DSS:!aNULL" or you can leave it as NULL to get "DEFAULT"

◆ ssl_options_clear

long lws_context_creation_info::ssl_options_clear

VHOST: Any bits set here will be cleared as SSL options

◆ ssl_options_set

long lws_context_creation_info::ssl_options_set

VHOST: Any bits set here will be set as SSL options

◆ ssl_private_key_filepath

const char* lws_context_creation_info::ssl_private_key_filepath

VHOST: filepath to private key if wanting SSL mode; if this is set to NULL but sll_cert_filepath is set, the OPENSSL_CONTEXT_REQUIRES_PRIVATE_KEY callback is called to allow setting of the private key directly via openSSL library calls

◆ ssl_private_key_password

const char* lws_context_creation_info::ssl_private_key_password

VHOST: NULL or the passphrase needed for the private key

◆ timeout_secs

unsigned int lws_context_creation_info::timeout_secs

VHOST: various processes involving network roundtrips in the library are protected from hanging forever by timeouts. If nonzero, this member lets you set the timeout used in seconds. Otherwise a default timeout is used.

◆ token_limits

const struct lws_token_limits* lws_context_creation_info::token_limits

CONTEXT: NULL or struct lws_token_limits pointer which is initialized with a token length limit for each possible WSI_TOKEN_

◆ uid

int lws_context_creation_info::uid

CONTEXT: user id to change to after setting listen socket, or -1.

◆ user

void* lws_context_creation_info::user

CONTEXT: optional user pointer that can be recovered via the context pointer using lws_context_user

◆ vhost_name

const char* lws_context_creation_info::vhost_name

VHOST: name of vhost, must match external DNS name used to access the site, like "warmcat.com" as it's used to match Host: header and / or SNI name for SSL.

◆ ws_ping_pong_interval

unsigned short lws_context_creation_info::ws_ping_pong_interval

CONTEXT: 0 for none, else interval in seconds between sending PINGs on idle websocket connections. When the PING is sent, the PONG must come within the normal timeout_secs timeout period or the connection will be dropped. Any RX or TX traffic on the connection restarts the interval timer, so a connection which always sends or receives something at intervals less than the interval given here will never send PINGs / expect PONGs. Conversely as soon as the ws connection is established, an idle connection will do the PING / PONG roundtrip as soon as ws_ping_pong_interval seconds has passed without traffic


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