libwebsockets
Lightweight C library for HTML5 websockets
|
Go to the source code of this file.
Data Structures | |
struct | lws_system_ops |
Macros | |
#define | LWSSYSGAUTH_HEX (1 << 0) |
Typedefs | |
typedef struct lws_system_blob | lws_system_blob_t |
typedef void(* | lws_attach_cb_t) (struct lws_context *context, int tsi, void *opaque) |
typedef struct lws_system_ops | lws_system_ops_t |
struct lws_system_ops |
Definition at line 174 of file lws-system.h.
Data Fields | ||
---|---|---|
int(*)(void) | reboot | |
int(*)(lws_usec_t us) | set_clock | |
int(*)(struct lws_context *context, int tsi, lws_attach_cb_t cb, lws_system_states_t state, void *opaque, struct lws_attach_item **get) | attach |
if If It's done like this so (*attach) can perform system-specific locking outside of lws core, for both getting and adding items the same so it is thread-safe. A non-threadsafe helper __lws_system_attach() is provided to do the actual work inside the system-specific locking. |
int(*)(struct lws_context *context) | captive_portal_detect_request |
Check if we can go out on the internet cleanly, or if we are being redirected or intercepted by a captive portal. Start the check that proceeds asynchronously, and report the results by calling lws_captive_portal_detect_result() api |
int(*)(struct lws_context *cx, const uint8_t *skid, size_t skid_len, void *got_opaque) | jit_trust_query |
user defined trust store search, if we do trust a cert with SKID matching skid / skid_len, then it should get hold of the DER for the matching root CA and call lws_tls_jit_trust_got_cert_cb(..., got_opaque) before cleaning up and returning. The DER should be destroyed if in heap before returning. |
int(*)(struct lws_context *cx, const char *buf, size_t len) | stdin_rx |
anything from stdin turns up here, eg, echo -n 123 | ./myapp will cause this to be called with buf = "123" and len=3. If stdin closes before the event loop terminates, we will be called with buf = NULL and len = 0 and nothing further, since stdin will be closed. This is very handy for passing secrets into your app that will not be visible to others via the commandline and with solid behaviours whenever the stdin source closes. |
uint32_t | wake_latency_us |
time taken for this device to wake from suspend, in us |
#define LWSSYSGAUTH_HEX (1 << 0) |
Definition at line 253 of file lws-system.h.
typedef struct lws_system_blob lws_system_blob_t |
Definition at line 63 of file lws-system.h.
typedef void(* lws_attach_cb_t) (struct lws_context *context, int tsi, void *opaque) |
Definition at line 166 of file lws-system.h.
typedef struct lws_system_ops lws_system_ops_t |
Definition at line 33 of file lws-system.h.
enum lws_system_states_t |
Definition at line 105 of file lws-system.h.
enum lws_cpd_result_t |
Enumerator | |
---|---|
LWS_CPD_UNKNOWN | |
LWS_CPD_INTERNET_OK | |
LWS_CPD_CAPTIVE_PORTAL | |
LWS_CPD_NO_INTERNET |
Definition at line 158 of file lws-system.h.
anonymous enum |
Definition at line 318 of file lws-system.h.
LWS_EXTERN LWS_VISIBLE void lws_system_blob_direct_set | ( | lws_system_blob_t * | b, |
const uint8_t * | ptr, | ||
size_t | len ) |
References LWS_EXTERN, and LWS_VISIBLE.
LWS_EXTERN LWS_VISIBLE void lws_system_blob_heap_empty | ( | lws_system_blob_t * | b | ) |
References LWS_EXTERN, and LWS_VISIBLE.
LWS_EXTERN LWS_VISIBLE int lws_system_blob_heap_append | ( | lws_system_blob_t * | b, |
const uint8_t * | ptr, | ||
size_t | len ) |
References LWS_EXTERN, and LWS_VISIBLE.
LWS_EXTERN LWS_VISIBLE size_t lws_system_blob_get_size | ( | lws_system_blob_t * | b | ) |
References LWS_EXTERN, and LWS_VISIBLE.
LWS_EXTERN LWS_VISIBLE int lws_system_blob_get_single_ptr | ( | lws_system_blob_t * | b, |
const uint8_t ** | ptr ) |
References LWS_EXTERN, and LWS_VISIBLE.
LWS_EXTERN LWS_VISIBLE int lws_system_blob_get | ( | lws_system_blob_t * | b, |
uint8_t * | ptr, | ||
size_t * | len, | ||
size_t | ofs ) |
References LWS_EXTERN, and LWS_VISIBLE.
LWS_EXTERN LWS_VISIBLE void lws_system_blob_destroy | ( | lws_system_blob_t * | b | ) |
References LWS_EXTERN, and LWS_VISIBLE.
LWS_EXTERN LWS_VISIBLE lws_system_blob_t * lws_system_get_blob | ( | struct lws_context * | context, |
lws_system_blob_item_t | type, | ||
int | idx ) |
LWS_EXTERN LWS_VISIBLE int lws_tls_jit_trust_got_cert_cb | ( | struct lws_context * | cx, |
void * | got_opaque, | ||
const uint8_t * | skid, | ||
size_t | skid_len, | ||
const uint8_t * | der, | ||
size_t | der_len ) |
LWS_EXTERN LWS_VISIBLE const lws_system_ops_t * lws_system_get_ops | ( | struct lws_context * | context | ) |
lws_system_get_ops() - get ahold of the system ops struct from the context
context | the lws_context |
Returns the system ops struct. It may return NULL and if not, anything in there may be NULL.
References LWS_EXTERN, and LWS_VISIBLE.
LWS_EXTERN LWS_VISIBLE int __lws_system_attach | ( | struct lws_context * | context, |
int | tsi, | ||
lws_attach_cb_t | cb, | ||
lws_system_states_t | state, | ||
void * | opaque, | ||
struct lws_attach_item ** | get ) |
__lws_system_attach() - get and set items on context attach list
context | context to get or set attach items to |
tsi | thread service index (normally 0) |
cb | callback to call from context event loop thread |
state | the lws_system state we have to be in or have passed through |
opaque | optional pointer to user specific info given to callback |
get | NULL, or pointer to pointer to take detached tail item on exit |
This allows other threads to enqueue callback requests to happen from a pt's event loop thread safely. The callback gets the context pointer and a user opaque pointer that can be optionally given when the item is added to the attach list.
This api is the no-locking core function for getting and setting items on the pt's attach list. The lws_system operation (*attach) is the actual api that user and internal code calls for this feature, it should perform system-specific locking, call this helper, release the locking and then return the result. This api is public only so it can be used in the locked implementation of (*attach).
If get is NULL, then the call adds to the head of the pt attach list using cb, state, and opaque; if get is non-NULL, then *get is set to the first waiting attached item that meets the state criteria and that item is removed from the list.
This is a non-threadsafe helper only designed to be called from implementations of struct lws_system's (*attach) operation where system- specific locking has been applied around it, making it threadsafe.