libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws-misc.h
Go to the documentation of this file.
1/*
2 * libwebsockets - small server side websockets and web server implementation
3 *
4 * Copyright (C) 2010 - 2021 Andy Green <andy@warmcat.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 */
24
25#if defined(LWS_WITH_SPAWN)
26
27#if defined(WIN32) || defined(_WIN32)
28#else
29#include <sys/wait.h>
30#include <sys/times.h>
31#endif
32#endif
33
34#if defined(__OpenBSD__)
35#include <sys/siginfo.h>
36#endif
37
44
45struct lws_buflist;
46
58lws_buflist_append_segment(struct lws_buflist **head, const uint8_t *buf,
59 size_t len);
60
73lws_buflist_append_segment_take_ownership(struct lws_buflist **head, uint8_t *buf, size_t len);
74
86lws_buflist_next_segment_len(struct lws_buflist **head, uint8_t **buf);
87
104lws_buflist_use_segment(struct lws_buflist **head, size_t len);
105
114lws_buflist_total_len(struct lws_buflist **head);
115
128lws_buflist_linear_copy(struct lws_buflist **head, size_t ofs, uint8_t *buf,
129 size_t len);
130
148lws_buflist_linear_use(struct lws_buflist **head, uint8_t *buf, size_t len);
149
173lws_buflist_fragment_use(struct lws_buflist **head, uint8_t *buf,
174 size_t len, char *frag_first, char *frag_fin);
175
185lws_buflist_destroy_all_segments(struct lws_buflist **head);
186
198lws_buflist_describe(struct lws_buflist **head, void *id, const char *reason);
199
213lws_buflist_get_frag_start_or_NULL(struct lws_buflist **head);
214
222LWS_VISIBLE LWS_EXTERN uint32_t
223lws_crc32(uint32_t crc, const void *buf, size_t len);
224
225
226
227struct lws_wsmsg_info;
228
229typedef void (*lws_wsmsg_transfer_cb)(struct lws_wsmsg_info *info);
230
231typedef struct lws_wsmsg_info {
232 struct lws_buflist **head_upstream; /* the upstream buflist */
233 struct lws_buflist **private_heads; /* the private reassembly heads */
234 int private_source_idx; /* which index to use in private_heads */
235 lws_wsmsg_transfer_cb optional_cb; /* optional transfer callback */
236 void *opaque; /* optional opaque pointer */
237 const uint8_t *buf; /* array to add */
238 size_t len; /* length of bytes in array */
239 unsigned int ss_flags; /* SS flags for SOM / EOM */
241
274
275/*
276 * lws_wsmsg_destroy() - free all allocations in private buflists
277 *
278 * \param private_heads: the private buflists
279 * \param count_private_heads: the number of private buflists
280 */
282lws_wsmsg_destroy(struct lws_buflist *private_heads[], size_t count_private_heads);
283
284
285
286/*
287 * Optional helpers for closely-managed stream flow control. These are useful
288 * when there is no memory for large rx buffers and instead tx credit is being
289 * used to regulate the server sending data.
290 *
291 * When combined with stateful consumption-on-demand, this can be very effective
292 * at managing data flows through restricted circumstances. These helpers
293 * implement a golden implementation that can be bound to a stream in its priv
294 * data.
295 *
296 * The helper is sophisticated enough to contain a buflist to manage overflows
297 * on heap and preferentially drain it. RX goes through heap to guarantee the
298 * consumer can exit cleanly at any time.
299 */
300
301enum {
302 LWSDLOFLOW_STATE_READ, /* default, we want input */
303 LWSDLOFLOW_STATE_READ_COMPLETED, /* we do not need further rx, every-
304 * thing is locally buffered or used */
305 LWSDLOFLOW_STATE_READ_FAILED, /* operation has fatal error */
306};
307
308struct lws_ss_handle;
309
310typedef struct lws_flow {
312
313 struct lws_ss_handle *h;
314 struct lws_buflist *bl;
315
316 const uint8_t *data;
317 size_t len; /* bytes left in data */
318 uint32_t blseglen; /* bytes issued */
319 int32_t window;
320
321 uint8_t state;
323
333
344
354#define lws_ptr_diff(head, tail) \
355 ((int)((char *)(head) - (char *)(tail)))
356
357#define lws_ptr_diff_size_t(head, tail) \
358 ((size_t)(ssize_t)((char *)(head) - (char *)(tail)))
359
372lws_snprintf(char *str, size_t size, const char *format, ...) LWS_FORMAT(3);
373
385lws_strncpy(char *dest, const char *src, size_t size);
386
387/*
388 * Variation where we want to use the smaller of two lengths, useful when the
389 * source string is not NUL terminated
390 */
391#define lws_strnncpy(dest, src, size1, destsize) \
392 lws_strncpy(dest, src, (size_t)(size1 + 1) < (size_t)(destsize) ? \
393 (size_t)(size1 + 1) : (size_t)(destsize))
394
408LWS_VISIBLE LWS_EXTERN const char *
409lws_nstrstr(const char *buf, size_t len, const char *name, size_t nl);
410
433LWS_VISIBLE LWS_EXTERN const char *
434lws_json_simple_find(const char *buf, size_t len, const char *name, size_t *alen);
435
454lws_json_simple_strcmp(const char *buf, size_t len, const char *name, const char *comp);
455
474lws_hex_len_to_byte_array(const char *h, size_t hlen, uint8_t *dest, int max);
475
493lws_hex_to_byte_array(const char *h, uint8_t *dest, int max);
494
507lws_hex_from_byte_array(const uint8_t *src, size_t slen, char *dest, size_t len);
508
523lws_hex_random(struct lws_context *context, char *dest, size_t len);
524
525/*
526 * lws_timingsafe_bcmp(): constant time memcmp
527 *
528 * \param a: first buffer
529 * \param b: second buffer
530 * \param len: count of bytes to compare
531 *
532 * Return 0 if the two buffers are the same, else nonzero.
533 *
534 * Always compares all of the buffer before returning, so it can't be used as
535 * a timing oracle.
536 */
537
539lws_timingsafe_bcmp(const void *a, const void *b, uint32_t len);
540
552lws_get_random(struct lws_context *context, void *buf, size_t len);
561lws_daemonize(const char *_lock_path);
569
577lws_wsi_user(struct lws *wsi);
578
586lws_wsi_tsi(struct lws *wsi);
587
599lws_set_wsi_user(struct lws *wsi, void *user);
600
626lws_parse_uri(char *p, const char **prot, const char **ads, int *port,
627 const char **path) LWS_WARN_DEPRECATED;
628
629typedef struct lws_parse_uri {
630 const char *scheme;
631 const char *host;
632 const char *path;
633 uint16_t port;
636
654lws_parse_uri_create(const char *uri);
655
666
668 const char *sw;
669 const char *doc;
670};
671
673lws_switches_print_help(const char *prog, const struct lws_switches *switches, size_t count);
674
675
698LWS_VISIBLE LWS_EXTERN const char *
699lws_cmdline_option(int argc, const char **argv, const char *val);
700
727LWS_VISIBLE LWS_EXTERN const char *
728lws_cmdline_options(int argc, const char * const *argv, const char *val, const char *last);
729
758
759LWS_VISIBLE LWS_EXTERN const char *
760lws_cmdline_options_cx(const struct lws_context *cx, const char *val, const char *last);
761
786LWS_VISIBLE LWS_EXTERN const char *
787lws_cmdline_option_cx(const struct lws_context *cx, const char *val);
788
797LWS_VISIBLE LWS_EXTERN const char *
798lws_cmdline_option_cx_argv0(const struct lws_context *cx);
799
813lws_cmdline_option_handle_builtin(int argc, const char **argv,
814 struct lws_context_creation_info *info);
815
825lws_parse_iso8601(const char *ads);
826
830LWS_VISIBLE LWS_EXTERN unsigned long
832
838
849lws_get_context(const struct lws *wsi);
850
861lws_get_vhost_listen_port(struct lws_vhost *vhost);
862
873lws_get_count_threads(struct lws_context *context);
874
883lws_get_parent(const struct lws *wsi);
884
892lws_get_child(const struct lws *wsi);
893
907lws_get_effective_uid_gid(struct lws_context *context, uid_t *uid, gid_t *gid);
908
916LWS_VISIBLE LWS_EXTERN const struct lws_udp * LWS_WARN_UNUSED_RESULT
917lws_get_udp(const struct lws *wsi);
918
920lws_get_opaque_parent_data(const struct lws *wsi);
921
923lws_set_opaque_parent_data(struct lws *wsi, void *data);
924
926lws_get_opaque_user_data(const struct lws *wsi);
927
929lws_set_opaque_user_data(struct lws *wsi, void *data);
930
933
936
938lws_get_close_length(struct lws *wsi);
939
940LWS_VISIBLE LWS_EXTERN unsigned char *
941lws_get_close_payload(struct lws *wsi);
942
954struct lws *lws_get_network_wsi(struct lws *wsi);
955
964lws_set_allocator(void *(*realloc)(void *ptr, size_t size, const char *reason));
965
966enum {
967 /*
968 * Flags for enable and disable rxflow with reason bitmap and with
969 * backwards-compatible single bool
970 */
974
981
982};
983
1004lws_rx_flow_control(struct lws *wsi, int enable);
1005
1016lws_rx_flow_allow_all_protocol(const struct lws_context *context,
1017 const struct lws_protocols *protocol);
1018
1042
1043#if defined(LWS_WITH_DIR)
1044
1045typedef enum {
1046 LDOT_UNKNOWN,
1047 LDOT_FILE,
1048 LDOT_DIR,
1049 LDOT_LINK,
1050 LDOT_FIFO,
1051 LDOTT_SOCKET,
1052 LDOT_CHAR,
1053 LDOT_BLOCK
1054} lws_dir_obj_type_t;
1055
1056struct lws_dir_entry {
1057 const char *name;
1058 lws_dir_obj_type_t type;
1059};
1060
1061typedef int
1062lws_dir_callback_function(const char *dirpath, void *user,
1063 struct lws_dir_entry *lde);
1064
1065struct lws_dir_info {
1066 const char *dirpath;
1067 void *user;
1068 lws_dir_callback_function *cb;
1069 unsigned char do_toplevel_cb:1;
1070};
1071
1094lws_dir(const char *dirpath, void *user, lws_dir_callback_function cb);
1095
1114lws_dir_via_info(struct lws_dir_info *info);
1115
1116
1129lws_dir_rm_rf_cb(const char *dirpath, void *user, struct lws_dir_entry *lde);
1130
1131
1137
1138typedef struct lws_dir_du {
1139 uint64_t size_in_bytes;
1140 uint32_t count_files;
1141} lws_dir_du_t;
1142
1156lws_dir_du_cb(const char *dirpath, void *user, struct lws_dir_entry *lde);
1157
1158
1159/*
1160 * We pass every file in the base dir through a filter, and call back on the
1161 * ones that match. Directories are ignored.
1162 *
1163 * The original path filter string may look like, eg, "sai-*.deb" or "*.txt"
1164 */
1165
1166typedef int (*lws_dir_glob_cb_t)(void *data, const char *path);
1167
1168typedef struct lws_dir_glob {
1169 const char *filter;
1170 lws_dir_glob_cb_t cb;
1171 void *user;
1172} lws_dir_glob_t;
1173
1189lws_dir_glob_cb(const char *dirpath, void *user, struct lws_dir_entry *lde);
1190
1191#endif
1192
1209
1217lws_get_tsi(struct lws *wsi);
1218
1226lws_is_ssl(struct lws *wsi);
1233lws_is_cgi(struct lws *wsi);
1234
1250lws_tls_jit_trust_blob_queury_skid(const void *_blob, size_t blen,
1251 const uint8_t *skid, size_t skid_len,
1252 const uint8_t **prpder, size_t *prder_len);
1253
1265lws_open(const char *__file, int __oflag, ...);
1266
1267struct lws_wifi_scan { /* generic wlan scan item */
1269 char ssid[32];
1270 int32_t rssi; /* divide by .count to get db */
1271 uint8_t bssid[6];
1272 uint8_t count;
1273 uint8_t channel;
1274 uint8_t authmode;
1275};
1276
1277#if defined(LWS_WITH_TLS) && !defined(LWS_WITH_MBEDTLS) && !defined(LWS_WITH_BEARSSL)
1285lws_get_ssl(struct lws *wsi);
1286#endif
1287
1289lws_explicit_bzero(void *p, size_t len);
1290
1291typedef struct lws_humanize_unit {
1292 const char *name; /* array ends with NULL name */
1293 uint64_t factor;
1295
1299
1300#if defined(_DEBUG)
1302lws_assert_fourcc(uint32_t fourcc, uint32_t expected);
1303#else
1304#define lws_assert_fourcc(_a, _b) do { } while (0);
1305#endif
1306
1330
1332lws_humanize(char *buf, size_t len, uint64_t value,
1333 const lws_humanize_unit_t *schema);
1334
1336lws_humanize_pad(char *p, size_t len, uint64_t v,
1337 const lws_humanize_unit_t *schema);
1338
1340lws_ser_wu16be(uint8_t *b, uint16_t u);
1341
1343lws_ser_wu32be(uint8_t *b, uint32_t u32);
1344
1346lws_ser_wu64be(uint8_t *b, uint64_t u64);
1347
1348LWS_VISIBLE LWS_EXTERN uint16_t
1349lws_ser_ru16be(const uint8_t *b);
1350
1351LWS_VISIBLE LWS_EXTERN uint32_t
1352lws_ser_ru32be(const uint8_t *b);
1353
1354LWS_VISIBLE LWS_EXTERN uint64_t
1355lws_ser_ru64be(const uint8_t *b);
1356
1358lws_vbi_encode(uint64_t value, void *buf);
1359
1361lws_vbi_decode(const void *buf, uint64_t *value, size_t len);
1362
1364
1365#if defined(LWS_WITH_SPAWN)
1366
1367/* opaque internal struct */
1368struct lws_spawn_piped;
1369
1370#if defined(WIN32)
1371struct _lws_siginfo_t {
1372 int retcode;
1373};
1374typedef struct _lws_siginfo_t siginfo_t;
1375#endif
1376
1383typedef struct lws_spawn_resource_us {
1384 uint64_t us_cpu_user;
1385 uint64_t us_cpu_sys;
1386
1387 uint64_t peak_mem_rss;
1388 uint64_t peak_mem_virt;
1389} lws_spawn_resource_us_t;
1390
1391typedef void (*lsp_cb_t)(void *opaque, const lws_spawn_resource_us_t *res,
1392 siginfo_t *si, int we_killed_him);
1393
1394
1414struct lws_spawn_piped_info {
1415 struct lws_dll2_owner *owner;
1416 struct lws_vhost *vh;
1417 struct lws *opt_parent;
1418
1419 const char * const *exec_array;
1420 const char **env_array;
1421 const char *protocol_name;
1422 const char *chroot_path;
1423 const char *wd;
1424
1425 struct lws_spawn_piped **plsp;
1426
1427 void *opaque;
1428
1429 lsp_cb_t reap_cb;
1430
1431 lws_spawn_resource_us_t *res;
1432
1433 lws_usec_t timeout_us;
1434 int max_log_lines;
1435 int tsi;
1436
1437 const struct lws_role_ops *ops; /* NULL is raw file */
1438
1439 uint8_t disable_ctrlc;
1440 uint8_t pty_mode;
1441
1442 const char *cgroup_name_suffix;
1443 int *p_cgroup_ret;
1444};
1445
1467LWS_VISIBLE LWS_EXTERN struct lws_spawn_piped *
1468lws_spawn_piped(const struct lws_spawn_piped_info *lspi);
1469
1470/*
1471 * lws_spawn_piped_kill_child_process() - attempt to kill child process
1472 *
1473 * \p lsp: child object to kill
1474 *
1475 * Attempts to signal the child process in \p lsp to terminate.
1476 */
1478lws_spawn_piped_kill_child_process(struct lws_spawn_piped *lsp);
1479
1488lws_spawn_get_stdwsi_open_count(struct lws_spawn_piped *lsp);
1489
1506lws_spawn_stdwsi_closed(struct lws_spawn_piped *lsp, struct lws *wsi);
1507
1508/*
1509 * lws_spawn_closedown_stdwsis() - forcibly close the spawner side of stdwsi pipes
1510 *
1511 * \p lsp: the spawn object
1512 *
1513 * Closes the spawner side of all the stdwsi for an lsp that are still open.
1514 */
1516lws_spawn_closedown_stdwsis(struct lws_spawn_piped *lsp);
1517
1529lws_spawn_get_stdfd(struct lws *wsi);
1530
1541lws_spawn_get_fd_stdxxx(struct lws_spawn_piped *lsp, int std_idx);
1542
1561lws_spawn_prepare_self_cgroup(const char *user, const char *group);
1562
1575lws_spawn_get_self_cgroup(char *cgroup, size_t max);
1576
1577#endif
1578
1580 const char *layers_path; /* where layers live */
1581 const char *overlay_path; /* where overlay instantiations live */
1582
1583 char mp[256]; /* mountpoint path */
1584 char ovname[64]; /* unique name for mount instance */
1585 char distro[64]; /* unique name for layer source */
1586
1587#if defined(__linux__)
1588 const char *layers[4]; /* distro layers, like "base", "env" */
1589#endif
1590};
1591
1627
1642
1643#define LWS_MINILEX_FAIL -1
1644#define LWS_MINILEX_CONTINUE 0
1645#define LWS_MINILEX_MATCH 1
1646
1674lws_minilex_parse(const uint8_t *lex, int16_t *ps, const uint8_t c,
1675 int *match);
1676
1677/*
1678 * Reports the number of significant bits (from the left) that is needed to
1679 * represent u. So if u is 0x80, result is 8.
1680 */
1681
1682LWS_VISIBLE LWS_EXTERN unsigned int
1683lws_sigbits(uintptr_t u);
1684
1695lws_wol(struct lws_context *ctx, const char *ip_or_NULL, uint8_t *mac_6_bytes);
struct lws_dll2 lws_dll2_t
uint32_t blseglen
Definition lws-misc.h:318
int private_source_idx
Definition lws-misc.h:234
uint16_t port
Definition lws-misc.h:633
const uint8_t * data
Definition lws-misc.h:316
char ssid[32]
Definition lws-misc.h:1269
struct lws_buflist ** head_upstream
Definition lws-misc.h:232
const char * path
Definition lws-misc.h:632
size_t len
Definition lws-misc.h:317
struct lws_ss_handle * h
Definition lws-misc.h:313
uint8_t state
Definition lws-misc.h:321
struct lws_buflist * bl
Definition lws-misc.h:314
uint8_t channel
Definition lws-misc.h:1273
int32_t window
Definition lws-misc.h:319
const char * scheme
Definition lws-misc.h:630
const char * doc
Definition lws-misc.h:669
uint8_t authmode
Definition lws-misc.h:1274
unsigned int ss_flags
Definition lws-misc.h:239
uint8_t count
Definition lws-misc.h:1272
const uint8_t * buf
Definition lws-misc.h:237
struct lws_buflist ** private_heads
Definition lws-misc.h:233
struct lws_wifi_scan * next
Definition lws-misc.h:1268
lws_dll2_t list
Definition lws-misc.h:311
const char * name
Definition lws-misc.h:1292
lws_wsmsg_transfer_cb optional_cb
Definition lws-misc.h:235
void * opaque
Definition lws-misc.h:236
const char * sw
Definition lws-misc.h:668
uint8_t bssid[6]
Definition lws-misc.h:1271
const char * host
Definition lws-misc.h:631
int32_t rssi
Definition lws-misc.h:1270
LWS_VISIBLE LWS_EXTERN int lws_wsmsg_append(lws_wsmsg_info_t *info)
LWS_VISIBLE LWS_EXTERN void lws_cmdline_option_handle_builtin(int argc, const char **argv, struct lws_context_creation_info *info)
LWS_VISIBLE LWS_EXTERN int lws_hex_to_byte_array(const char *h, uint8_t *dest, int max)
LWS_VISIBLE LWS_EXTERN const char * lws_cmdline_option_cx(const struct lws_context *cx, const char *val)
LWS_VISIBLE LWS_EXTERN void * lws_buflist_get_frag_start_or_NULL(struct lws_buflist **head)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_parse_uri(char *p, const char **prot, const char **ads, int *port, const char **path) LWS_WARN_DEPRECATED
LWS_VISIBLE LWS_EXTERN void lws_switches_print_help(const char *prog, const struct lws_switches *switches, size_t count)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_buflist_append_segment_take_ownership(struct lws_buflist **head, uint8_t *buf, size_t len)
LWS_VISIBLE LWS_EXTERN void lws_buflist_describe(struct lws_buflist **head, void *id, const char *reason)
LWS_VISIBLE LWS_EXTERN int lws_open(const char *__file, int __oflag,...)
LWS_VISIBLE LWS_EXTERN int lws_wsi_tsi(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN uint16_t lws_ser_ru16be(const uint8_t *b)
LWS_VISIBLE LWS_EXTERN lws_usec_t lws_now_usecs(void)
LWS_VISIBLE LWS_EXTERN void lws_explicit_bzero(void *p, size_t len)
LWS_VISIBLE LWS_EXTERN const struct lws_udp *LWS_WARN_UNUSED_RESULT lws_get_udp(const struct lws *wsi)
LWS_VISIBLE LWS_EXTERN_FOR_DATA const lws_humanize_unit_t humanize_schema_si_bytes[7]
Definition lws-misc.h:1297
LWS_VISIBLE LWS_EXTERN struct lws * lws_get_network_wsi(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN int lws_snprintf(char *str, size_t size, const char *format,...) LWS_FORMAT(3)
LWS_VISIBLE LWS_EXTERN void lws_get_effective_uid_gid(struct lws_context *context, uid_t *uid, gid_t *gid)
void(* lws_wsmsg_transfer_cb)(struct lws_wsmsg_info *info)
Definition lws-misc.h:229
LWS_VISIBLE LWS_EXTERN int lws_is_ssl(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN const char * lws_cmdline_option(int argc, const char **argv, const char *val)
LWS_VISIBLE LWS_EXTERN_FOR_DATA const lws_humanize_unit_t humanize_schema_si[7]
Definition lws-misc.h:1296
LWS_VISIBLE LWS_EXTERN void lws_clear_child_pending_on_writable(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN unsigned long lws_now_secs(void)
LWS_VISIBLE LWS_EXTERN void lws_wsmsg_destroy(struct lws_buflist *private_heads[], size_t count_private_heads)
LWS_VISIBLE LWS_EXTERN size_t lws_get_random(struct lws_context *context, void *buf, size_t len)
LWS_VISIBLE LWS_EXTERN const char * lws_cmdline_options(int argc, const char *const *argv, const char *val, const char *last)
LWS_VISIBLE LWS_EXTERN int lws_buflist_linear_copy(struct lws_buflist **head, size_t ofs, uint8_t *buf, size_t len)
LWS_VISIBLE LWS_EXTERN int lws_is_cgi(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN unsigned char * lws_get_close_payload(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN uint32_t lws_crc32(uint32_t crc, const void *buf, size_t len)
LWS_VISIBLE LWS_EXTERN int lws_hex_len_to_byte_array(const char *h, size_t hlen, uint8_t *dest, int max)
LWS_VISIBLE LWS_EXTERN const char * lws_json_simple_find(const char *buf, size_t len, const char *name, size_t *alen)
struct lws_parse_uri lws_parse_uri_t
LWS_VISIBLE LWS_EXTERN void lws_rx_flow_allow_all_protocol(const struct lws_context *context, const struct lws_protocols *protocol)
LWS_VISIBLE LWS_EXTERN size_t lws_buflist_next_segment_len(struct lws_buflist **head, uint8_t **buf)
size_t lws_get_allocated_heap(void)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_get_count_threads(struct lws_context *context)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_get_vhost_listen_port(struct lws_vhost *vhost)
LWS_VISIBLE LWS_EXTERN struct lws_context *LWS_WARN_UNUSED_RESULT lws_get_context(const struct lws *wsi)
LWS_VISIBLE LWS_EXTERN size_t lws_remaining_packet_payload(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN int lws_humanize(char *buf, size_t len, uint64_t value, const lws_humanize_unit_t *schema)
LWS_VISIBLE LWS_EXTERN void lws_set_opaque_user_data(struct lws *wsi, void *data)
#define lws_assert_fourcc(_a, _b)
Definition lws-misc.h:1304
LWS_VISIBLE LWS_EXTERN struct lws *LWS_WARN_UNUSED_RESULT lws_get_child(const struct lws *wsi)
LWS_VISIBLE LWS_EXTERN uint32_t lws_ser_ru32be(const uint8_t *b)
LWS_VISIBLE LWS_EXTERN size_t lws_buflist_total_len(struct lws_buflist **head)
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_flow_feed(lws_flow_t *flow)
LWS_VISIBLE LWS_EXTERN void lws_ser_wu16be(uint8_t *b, uint16_t u)
LWS_VISIBLE LWS_EXTERN void lws_set_wsi_user(struct lws *wsi, void *user)
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_flow_req(lws_flow_t *flow)
struct lws_wsmsg_info lws_wsmsg_info_t
LWS_VISIBLE LWS_EXTERN size_t lws_buflist_use_segment(struct lws_buflist **head, size_t len)
struct lws_flow lws_flow_t
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_buflist_append_segment(struct lws_buflist **head, const uint8_t *buf, size_t len)
LWS_VISIBLE LWS_EXTERN const char * lws_cmdline_option_cx_argv0(const struct lws_context *cx)
LWS_VISIBLE LWS_EXTERN const char * lws_nstrstr(const char *buf, size_t len, const char *name, size_t nl)
LWS_VISIBLE LWS_EXTERN int lws_get_child_pending_on_writable(const struct lws *wsi)
LWS_VISIBLE LWS_EXTERN int lws_get_close_length(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN int lws_tls_jit_trust_blob_queury_skid(const void *_blob, size_t blen, const uint8_t *skid, size_t skid_len, const uint8_t **prpder, size_t *prder_len)
LWS_VISIBLE LWS_EXTERN void lws_set_opaque_parent_data(struct lws *wsi, void *data)
LWS_VISIBLE LWS_EXTERN const char * lws_cmdline_options_cx(const struct lws_context *cx, const char *val, const char *last)
LWS_VISIBLE LWS_EXTERN int lws_json_simple_strcmp(const char *buf, size_t len, const char *name, const char *comp)
LWS_VISIBLE LWS_EXTERN const char *LWS_WARN_UNUSED_RESULT lws_get_library_version(void)
LWS_VISIBLE LWS_EXTERN int lws_vbi_encode(uint64_t value, void *buf)
LWS_VISIBLE LWS_EXTERN uint64_t lws_ser_ru64be(const uint8_t *b)
LWS_VISIBLE LWS_EXTERN int lws_humanize_pad(char *p, size_t len, uint64_t v, const lws_humanize_unit_t *schema)
LWS_VISIBLE LWS_EXTERN int lws_get_tsi(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN int lws_buflist_linear_use(struct lws_buflist **head, uint8_t *buf, size_t len)
LWS_VISIBLE LWS_EXTERN int lws_vbi_decode(const void *buf, uint64_t *value, size_t len)
LWS_VISIBLE LWS_EXTERN void lws_ser_wu64be(uint8_t *b, uint64_t u64)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_daemonize(const char *_lock_path)
LWS_VISIBLE LWS_EXTERN void lws_hex_from_byte_array(const uint8_t *src, size_t slen, char *dest, size_t len)
LWS_VISIBLE LWS_EXTERN void lws_ser_wu32be(uint8_t *b, uint32_t u32)
LWS_VISIBLE LWS_EXTERN void * lws_get_opaque_parent_data(const struct lws *wsi)
LWS_VISIBLE LWS_EXTERN void lws_set_allocator(void *(*realloc)(void *ptr, size_t size, const char *reason))
LWS_VISIBLE LWS_EXTERN int lws_buflist_fragment_use(struct lws_buflist **head, uint8_t *buf, size_t len, char *frag_first, char *frag_fin)
LWS_VISIBLE LWS_EXTERN int lws_rx_flow_control(struct lws *wsi, int enable)
LWS_VISIBLE LWS_EXTERN int lws_timingsafe_bcmp(const void *a, const void *b, uint32_t len)
LWS_VISIBLE LWS_EXTERN void * lws_get_opaque_user_data(const struct lws *wsi)
LWS_VISIBLE LWS_EXTERN_FOR_DATA const lws_humanize_unit_t humanize_schema_us[8]
Definition lws-misc.h:1298
LWS_VISIBLE LWS_EXTERN lws_parse_uri_t *LWS_WARN_UNUSED_RESULT lws_parse_uri_create(const char *uri)
LWS_VISIBLE LWS_EXTERN void * lws_wsi_user(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN char * lws_strncpy(char *dest, const char *src, size_t size)
LWS_VISIBLE LWS_EXTERN void lws_parse_uri_destroy(lws_parse_uri_t **pcuri)
struct lws_humanize_unit lws_humanize_unit_t
LWS_VISIBLE LWS_EXTERN lws_usec_t lws_parse_iso8601(const char *ads)
LWS_VISIBLE LWS_EXTERN int lws_hex_random(struct lws_context *context, char *dest, size_t len)
LWS_VISIBLE LWS_EXTERN void lws_buflist_destroy_all_segments(struct lws_buflist **head)
LWS_VISIBLE LWS_EXTERN struct lws *LWS_WARN_UNUSED_RESULT lws_get_parent(const struct lws *wsi)
@ LWS_RXFLOW_REASON_APPLIES_DISABLE
Definition lws-misc.h:979
@ LWS_RXFLOW_REASON_APPLIES
Definition lws-misc.h:975
@ LWS_RXFLOW_REASON_USER_BOOL
Definition lws-misc.h:971
@ LWS_RXFLOW_REASON_APPLIES_ENABLE_BIT
Definition lws-misc.h:976
@ LWS_RXFLOW_REASON_APPLIES_ENABLE
Definition lws-misc.h:977
@ LWS_RXFLOW_REASON_FLAG_PROCESS_NOW
Definition lws-misc.h:980
@ LWS_RXFLOW_REASON_HTTP_RXBUFFER
Definition lws-misc.h:972
@ LWS_RXFLOW_REASON_H2_PPS_PENDING
Definition lws-misc.h:973
@ LWSDLOFLOW_STATE_READ
Definition lws-misc.h:302
@ LWSDLOFLOW_STATE_READ_COMPLETED
Definition lws-misc.h:303
@ LWSDLOFLOW_STATE_READ_FAILED
Definition lws-misc.h:305
#define LWS_EXTERN_FOR_DATA
#define LWS_WARN_DEPRECATED
#define LWS_FORMAT(string_index)
#define LWS_EXTERN
int64_t lws_usec_t
lws_stateful_ret_t
#define LWS_WARN_UNUSED_RESULT
#define LWS_VISIBLE
LWS_VISIBLE LWS_EXTERN int lws_fsmount_mount(struct lws_fsmount *fsm)
char mp[256]
Definition lws-misc.h:1583
LWS_VISIBLE LWS_EXTERN int lws_fsmount_unmount(struct lws_fsmount *fsm)
char ovname[64]
Definition lws-misc.h:1584
char distro[64]
Definition lws-misc.h:1585
LWS_VISIBLE LWS_EXTERN unsigned int lws_sigbits(uintptr_t u)
LWS_VISIBLE LWS_EXTERN int lws_minilex_parse(const uint8_t *lex, int16_t *ps, const uint8_t c, int *match)
const char * overlay_path
Definition lws-misc.h:1581
const char * layers_path
Definition lws-misc.h:1580
LWS_VISIBLE LWS_EXTERN int lws_wol(struct lws_context *ctx, const char *ip_or_NULL, uint8_t *mac_6_bytes)