libwebsockets
Lightweight C library for HTML5 websockets
lws-secure-streams-client.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  lws_context_standalone
 

Macros

#define lwsl_sspc(_h, _fil, ...)
 
#define lwsl_hexdump_sspc(_h, _fil, _buf, _len)
 
#define lwsl_sspc_err(_w, ...)   do {} while(0)
 
#define lwsl_sspc_warn(_w, ...)   do {} while(0)
 
#define lwsl_sspc_notice(_w, ...)   do {} while(0)
 
#define lwsl_sspc_info(_w, ...)   do {} while(0)
 
#define lwsl_sspc_debug(_w, ...)   do {} while(0)
 
#define lwsl_sspc_parser(_w, ...)   do {} while(0)
 
#define lwsl_sspc_header(_w, ...)   do {} while(0)
 
#define lwsl_sspc_ext(_w, ...)   do {} while(0)
 
#define lwsl_sspc_client(_w, ...)   do {} while(0)
 
#define lwsl_sspc_latency(_w, ...)   do {} while(0)
 
#define lwsl_sspc_thread(_w, ...)   do {} while(0)
 
#define lwsl_sspc_user(_w, ...)   do {} while(0)
 
#define lwsl_hexdump_sspc_err(_v, ...)   lwsl_hexdump_sspc(_v, LLL_ERR, __VA_ARGS__)
 
#define lwsl_hexdump_sspc_warn(_v, ...)   lwsl_hexdump_sspc(_v, LLL_WARN, __VA_ARGS__)
 
#define lwsl_hexdump_sspc_notice(_v, ...)   lwsl_hexdump_sspc(_v, LLL_NOTICE, __VA_ARGS__)
 
#define lwsl_hexdump_sspc_info(_v, ...)   lwsl_hexdump_sspc(_v, LLL_INFO, __VA_ARGS__)
 
#define lwsl_hexdump_sspc_debug(_v, ...)   lwsl_hexdump_sspc(_v, LLL_DEBUG, __VA_ARGS__)
 

Functions

LWS_VISIBLE LWS_EXTERN void lws_log_prepend_sspc (struct lws_log_cx *cx, void *obj, char **p, char *e)
 
LWS_VISIBLE LWS_EXTERN struct lws_log_cxlwsl_sspc_get_cx (struct lws_sspc_handle *ss)
 
LWS_VISIBLE LWS_EXTERN int lws_sspc_create (struct lws_context *context, int tsi, const lws_ss_info_t *ssi, void *opaque_user_data, struct lws_sspc_handle **ppss, void *reserved, const char **ppayload_fmt)
 
LWS_VISIBLE LWS_EXTERN void lws_sspc_destroy (struct lws_sspc_handle **ppss)
 
LWS_VISIBLE LWS_EXTERN lws_ss_state_return_t lws_sspc_request_tx (struct lws_sspc_handle *pss)
 
LWS_VISIBLE LWS_EXTERN lws_ss_state_return_t lws_sspc_request_tx_len (struct lws_sspc_handle *h, unsigned long len)
 
LWS_VISIBLE LWS_EXTERN lws_ss_state_return_t lws_sspc_client_connect (struct lws_sspc_handle *h)
 
LWS_VISIBLE LWS_EXTERN int lws_sspc_proxy_create (struct lws_context *context)
 
LWS_VISIBLE LWS_EXTERN struct lws_context * lws_sspc_get_context (struct lws_sspc_handle *h)
 
LWS_VISIBLE LWS_EXTERN const char * lws_sspc_rideshare (struct lws_sspc_handle *h)
 
: metadata name from the policy

lws_sspc_set_metadata() - allow user to bind external data to defined ss metadata

\h: secure streams handle

\value: pointer to user-managed data to bind to name \len: length of the user-managed data in value

Binds user-managed data to the named metadata item from the ss policy. If present, the metadata item is handled in a protocol-specific way using the associated policy information. For example, in the policy

    "\"metadata\":"         "["
    "{\"uptag\":"  "\"X-Upload-Tag:\"},"
    "{\"ctype\":"  "\"Content-Type:\"},"
    "{\"xctype\":" "\"X-Content-Type:\"}"
 "],"

when the policy is using h1 is interpreted to add h1 headers of the given name with the value of the metadata on the left.

Return 0 if OK, or nonzero if failed.

LWS_VISIBLE LWS_EXTERN int lws_sspc_set_metadata (struct lws_sspc_handle *h, const char *name, const void *value, size_t len)
 
LWS_VISIBLE LWS_EXTERN int lws_sspc_get_metadata (struct lws_sspc_handle *h, const char *name, const void **value, size_t *len)
 
LWS_VISIBLE LWS_EXTERN int lws_sspc_add_peer_tx_credit (struct lws_sspc_handle *h, int32_t add)
 
LWS_VISIBLE LWS_EXTERN int lws_sspc_get_est_peer_tx_credit (struct lws_sspc_handle *h)
 
LWS_VISIBLE LWS_EXTERN void lws_sspc_start_timeout (struct lws_sspc_handle *h, unsigned int timeout_ms)
 
LWS_VISIBLE LWS_EXTERN void lws_sspc_cancel_timeout (struct lws_sspc_handle *h)
 
LWS_VISIBLE LWS_EXTERN void * lws_sspc_to_user_object (struct lws_sspc_handle *h)
 
LWS_VISIBLE LWS_EXTERN void lws_sspc_change_handlers (struct lws_sspc_handle *h, lws_sscb_rx rx, lws_sscb_tx tx, lws_sscb_state state)
 
LWS_VISIBLE LWS_EXTERN void lws_sspc_server_ack (struct lws_sspc_handle *h, int nack)
 
LWS_VISIBLE LWS_EXTERN const char * lws_sspc_tag (struct lws_sspc_handle *h)
 

Data Structure Documentation

◆ lws_context_standalone

struct lws_context_standalone

Definition at line 190 of file lws-secure-streams-client.h.

+ Collaboration diagram for lws_context_standalone:
Data Fields
lws_txp_path_client_t txp_cpath
lws_dll2_owner_t ss_client_owner
uint32_t ssidx

Macro Definition Documentation

◆ lwsl_sspc

#define lwsl_sspc (   _h,
  _fil,
  ... 
)
Value:
_fil, __func__, __VA_ARGS__)
LWS_VISIBLE LWS_EXTERN void _lws_log_cx(lws_log_cx_t *cx, lws_log_prepend_cx_t prep, void *obj, int filter, const char *_fun, const char *format,...) LWS_FORMAT(6)
LWS_VISIBLE LWS_EXTERN struct lws_log_cx * lwsl_sspc_get_cx(struct lws_sspc_handle *ss)
LWS_VISIBLE LWS_EXTERN void lws_log_prepend_sspc(struct lws_log_cx *cx, void *obj, char **p, char *e)

Definition at line 87 of file lws-secure-streams-client.h.

◆ lwsl_hexdump_sspc

#define lwsl_hexdump_sspc (   _h,
  _fil,
  _buf,
  _len 
)
Value:
_h, _fil, _buf, _len)
LWS_VISIBLE LWS_EXTERN void lwsl_hexdump_level_cx(lws_log_cx_t *cx, lws_log_prepend_cx_t prep, void *obj, int hexdump_level, const void *vbuf, size_t len)

Definition at line 91 of file lws-secure-streams-client.h.

◆ lwsl_sspc_err

#define lwsl_sspc_err (   _w,
  ... 
)    do {} while(0)

Definition at line 103 of file lws-secure-streams-client.h.

◆ lwsl_sspc_warn

#define lwsl_sspc_warn (   _w,
  ... 
)    do {} while(0)

Definition at line 109 of file lws-secure-streams-client.h.

◆ lwsl_sspc_notice

#define lwsl_sspc_notice (   _w,
  ... 
)    do {} while(0)

Definition at line 115 of file lws-secure-streams-client.h.

◆ lwsl_sspc_info

#define lwsl_sspc_info (   _w,
  ... 
)    do {} while(0)

Definition at line 121 of file lws-secure-streams-client.h.

◆ lwsl_sspc_debug

#define lwsl_sspc_debug (   _w,
  ... 
)    do {} while(0)

Definition at line 127 of file lws-secure-streams-client.h.

◆ lwsl_sspc_parser

#define lwsl_sspc_parser (   _w,
  ... 
)    do {} while(0)

Definition at line 133 of file lws-secure-streams-client.h.

◆ lwsl_sspc_header

#define lwsl_sspc_header (   _w,
  ... 
)    do {} while(0)

Definition at line 139 of file lws-secure-streams-client.h.

◆ lwsl_sspc_ext

#define lwsl_sspc_ext (   _w,
  ... 
)    do {} while(0)

Definition at line 145 of file lws-secure-streams-client.h.

◆ lwsl_sspc_client

#define lwsl_sspc_client (   _w,
  ... 
)    do {} while(0)

Definition at line 151 of file lws-secure-streams-client.h.

◆ lwsl_sspc_latency

#define lwsl_sspc_latency (   _w,
  ... 
)    do {} while(0)

Definition at line 157 of file lws-secure-streams-client.h.

◆ lwsl_sspc_thread

#define lwsl_sspc_thread (   _w,
  ... 
)    do {} while(0)

Definition at line 163 of file lws-secure-streams-client.h.

◆ lwsl_sspc_user

#define lwsl_sspc_user (   _w,
  ... 
)    do {} while(0)

Definition at line 169 of file lws-secure-streams-client.h.

◆ lwsl_hexdump_sspc_err

#define lwsl_hexdump_sspc_err (   _v,
  ... 
)    lwsl_hexdump_sspc(_v, LLL_ERR, __VA_ARGS__)

Definition at line 172 of file lws-secure-streams-client.h.

◆ lwsl_hexdump_sspc_warn

#define lwsl_hexdump_sspc_warn (   _v,
  ... 
)    lwsl_hexdump_sspc(_v, LLL_WARN, __VA_ARGS__)

Definition at line 173 of file lws-secure-streams-client.h.

◆ lwsl_hexdump_sspc_notice

#define lwsl_hexdump_sspc_notice (   _v,
  ... 
)    lwsl_hexdump_sspc(_v, LLL_NOTICE, __VA_ARGS__)

Definition at line 174 of file lws-secure-streams-client.h.

◆ lwsl_hexdump_sspc_info

#define lwsl_hexdump_sspc_info (   _v,
  ... 
)    lwsl_hexdump_sspc(_v, LLL_INFO, __VA_ARGS__)

Definition at line 175 of file lws-secure-streams-client.h.

◆ lwsl_hexdump_sspc_debug

#define lwsl_hexdump_sspc_debug (   _v,
  ... 
)    lwsl_hexdump_sspc(_v, LLL_DEBUG, __VA_ARGS__)

Definition at line 176 of file lws-secure-streams-client.h.

Function Documentation

◆ lws_log_prepend_sspc()

LWS_VISIBLE LWS_EXTERN void lws_log_prepend_sspc ( struct lws_log_cx cx,
void *  obj,
char **  p,
char *  e 
)

◆ lwsl_sspc_get_cx()

LWS_VISIBLE LWS_EXTERN struct lws_log_cx * lwsl_sspc_get_cx ( struct lws_sspc_handle *  ss)

◆ lws_sspc_create()

LWS_VISIBLE LWS_EXTERN int lws_sspc_create ( struct lws_context *  context,
int  tsi,
const lws_ss_info_t ssi,
void *  opaque_user_data,
struct lws_sspc_handle **  ppss,
void *  reserved,
const char **  ppayload_fmt 
)

◆ lws_sspc_destroy()

LWS_VISIBLE LWS_EXTERN void lws_sspc_destroy ( struct lws_sspc_handle **  ppss)

lws_sspc_destroy() - Destroy secure stream

Parameters
ppsspointer to lws_ss_t pointer to be destroyed

Destroys the lws_ss_t pointed to by *ppss, and sets *ppss to NULL.

◆ lws_sspc_request_tx()

LWS_VISIBLE LWS_EXTERN lws_ss_state_return_t lws_sspc_request_tx ( struct lws_sspc_handle *  pss)

lws_sspc_request_tx() - Schedule stream for tx

Parameters
psspointer to lws_ss_t representing stream that wants to transmit

Schedules a write on the stream represented by pss. When it's possible to write on this stream, the *tx callback will occur with an empty buffer for the stream owner to fill in.

◆ lws_sspc_request_tx_len()

LWS_VISIBLE LWS_EXTERN lws_ss_state_return_t lws_sspc_request_tx_len ( struct lws_sspc_handle *  h,
unsigned long  len 
)

lws_sspc_request_tx_len() - Schedule stream for tx with length hint

Parameters
hpointer to handle representing stream that wants to transmit
lenthe length of the write in bytes

Schedules a write on the stream represented by pss. When it's possible to write on this stream, the *tx callback will occur with an empty buffer for the stream owner to fill in.

This api variant should be used when it's possible the payload will go out over h1 with x-web-form-urlencoded or similar Content-Type.

The serialized, sspc type api actually serializes and forwards the length hint to its upstream proxy, where it's available for use to produce the internet-capable protocol framing.

◆ lws_sspc_client_connect()

LWS_VISIBLE LWS_EXTERN lws_ss_state_return_t lws_sspc_client_connect ( struct lws_sspc_handle *  h)

lws_sspc_client_connect() - Attempt the client connect

Parameters
hsecure streams handle

Starts the connection process for the secure stream. Returns 0.

◆ lws_sspc_proxy_create()

LWS_VISIBLE LWS_EXTERN int lws_sspc_proxy_create ( struct lws_context *  context)

lws_sspc_proxy_create() - Start a unix domain socket proxy for Secure Streams

Parameters
contextlws_context

Creates a vhost that listens on an abstract namespace unix domain socket at address "proxy.ss.lws". Client connections to this proxy to Secure Streams

◆ lws_sspc_get_context()

LWS_VISIBLE LWS_EXTERN struct lws_context * lws_sspc_get_context ( struct lws_sspc_handle *  h)

lws_ss_get_context() - convenience helper to recover the lws context

\h: secure streams handle

Returns the lws context. Dispenses with the need to pass a copy of it into your secure streams handler.

◆ lws_sspc_rideshare()

LWS_VISIBLE LWS_EXTERN const char * lws_sspc_rideshare ( struct lws_sspc_handle *  h)

◆ lws_sspc_set_metadata()

LWS_VISIBLE LWS_EXTERN int lws_sspc_set_metadata ( struct lws_sspc_handle *  h,
const char *  name,
const void *  value,
size_t  len 
)

◆ lws_sspc_get_metadata()

LWS_VISIBLE LWS_EXTERN int lws_sspc_get_metadata ( struct lws_sspc_handle *  h,
const char *  name,
const void **  value,
size_t *  len 
)

◆ lws_sspc_add_peer_tx_credit()

LWS_VISIBLE LWS_EXTERN int lws_sspc_add_peer_tx_credit ( struct lws_sspc_handle *  h,
int32_t  add 
)

◆ lws_sspc_get_est_peer_tx_credit()

LWS_VISIBLE LWS_EXTERN int lws_sspc_get_est_peer_tx_credit ( struct lws_sspc_handle *  h)

◆ lws_sspc_start_timeout()

LWS_VISIBLE LWS_EXTERN void lws_sspc_start_timeout ( struct lws_sspc_handle *  h,
unsigned int  timeout_ms 
)

◆ lws_sspc_cancel_timeout()

LWS_VISIBLE LWS_EXTERN void lws_sspc_cancel_timeout ( struct lws_sspc_handle *  h)

◆ lws_sspc_to_user_object()

LWS_VISIBLE LWS_EXTERN void * lws_sspc_to_user_object ( struct lws_sspc_handle *  h)

◆ lws_sspc_change_handlers()

LWS_VISIBLE LWS_EXTERN void lws_sspc_change_handlers ( struct lws_sspc_handle *  h,
lws_sscb_rx  rx,
lws_sscb_tx  tx,
lws_sscb_state  state 
)

◆ lws_sspc_server_ack()

LWS_VISIBLE LWS_EXTERN void lws_sspc_server_ack ( struct lws_sspc_handle *  h,
int  nack 
)

◆ lws_sspc_tag()

LWS_VISIBLE LWS_EXTERN const char * lws_sspc_tag ( struct lws_sspc_handle *  h)

lws_sspc_tag() - get the sspc log tag

Parameters
hthe sspc handle

Returns the sspc log tag, to assist in logging traceability