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
57
58#define LWS_BUFLIST_OOM_LIMIT (2 * 1024 * 1024)
59
61lws_buflist_append_segment(struct lws_buflist **head, const uint8_t *buf,
62 size_t len);
63
76lws_buflist_append_segment_take_ownership(struct lws_buflist **head, uint8_t *buf, size_t len);
77
89lws_buflist_next_segment_len(struct lws_buflist **head, uint8_t **buf);
90
107lws_buflist_use_segment(struct lws_buflist **head, size_t len);
108
117lws_buflist_total_len(struct lws_buflist **head);
118
131lws_buflist_linear_copy(struct lws_buflist **head, size_t ofs, uint8_t *buf,
132 size_t len);
133
151lws_buflist_linear_use(struct lws_buflist **head, uint8_t *buf, size_t len);
152
176lws_buflist_fragment_use(struct lws_buflist **head, uint8_t *buf,
177 size_t len, char *frag_first, char *frag_fin);
178
188lws_buflist_destroy_all_segments(struct lws_buflist **head);
189
201lws_buflist_describe(struct lws_buflist **head, void *id, const char *reason);
202
216lws_buflist_get_frag_start_or_NULL(struct lws_buflist **head);
217
218
219/* --- lws_buflist2 (doubly-linked) --- */
220
226
227struct lws_buflist2;
228
241 size_t len);
242
256
269
287
295static LWS_INLINE size_t
296lws_buflist2_total_len(struct lws_buflist2_owner *owner) { return owner->total_len; }
297
322 size_t len, char *frag_first, char *frag_fin);
323
333
348
349
350
359lws_crc32(uint32_t crc, const void *buf, size_t len);
360
361
362
363struct lws_wsmsg_info;
364
365typedef void (*lws_wsmsg_transfer_cb)(struct lws_wsmsg_info *info);
366
367typedef struct lws_wsmsg_info {
368 struct lws_buflist **head_upstream; /* the upstream buflist */
369 struct lws_buflist **private_heads; /* the private reassembly heads */
370 int private_source_idx; /* which index to use in private_heads */
371 lws_wsmsg_transfer_cb optional_cb; /* optional transfer callback */
372 void *opaque; /* optional opaque pointer */
373 const uint8_t *buf; /* array to add */
374 size_t len; /* length of bytes in array */
375 unsigned int ss_flags; /* SS flags for SOM / EOM */
377
410
411/*
412 * lws_wsmsg_destroy() - free all allocations in private buflists
413 *
414 * \param private_heads: the private buflists
415 * \param count_private_heads: the number of private buflists
416 */
418lws_wsmsg_destroy(struct lws_buflist *private_heads[], size_t count_private_heads);
419
420
421
422/*
423 * Optional helpers for closely-managed stream flow control. These are useful
424 * when there is no memory for large rx buffers and instead tx credit is being
425 * used to regulate the server sending data.
426 *
427 * When combined with stateful consumption-on-demand, this can be very effective
428 * at managing data flows through restricted circumstances. These helpers
429 * implement a golden implementation that can be bound to a stream in its priv
430 * data.
431 *
432 * The helper is sophisticated enough to contain a buflist to manage overflows
433 * on heap and preferentially drain it. RX goes through heap to guarantee the
434 * consumer can exit cleanly at any time.
435 */
436
437enum {
438 LWSDLOFLOW_STATE_READ, /* default, we want input */
439 LWSDLOFLOW_STATE_READ_COMPLETED, /* we do not need further rx, every-
440 * thing is locally buffered or used */
441 LWSDLOFLOW_STATE_READ_FAILED, /* operation has fatal error */
442};
443
444struct lws_ss_handle;
445
446typedef struct lws_flow {
448
449 struct lws_ss_handle *h;
450 struct lws_buflist *bl;
451
452 const uint8_t *data;
453 size_t len; /* bytes left in data */
454 uint32_t blseglen; /* bytes issued */
455 int32_t window;
456
459
469
480
490#define lws_ptr_diff(head, tail) \
491 ((int)((char *)(head) - (char *)(tail)))
492
493#define lws_ptr_diff_size_t(head, tail) \
494 ((size_t)(ssize_t)((char *)(head) - (char *)(tail)))
495
508lws_snprintf(char *str, size_t size, const char *format, ...) LWS_FORMAT(3);
509
521lws_strncpy(char *dest, const char *src, size_t size);
522
523/*
524 * Variation where we want to use the smaller of two lengths, useful when the
525 * source string is not NUL terminated
526 */
527#define lws_strnncpy(dest, src, size1, destsize) \
528 lws_strncpy(dest, src, (size_t)(size1 + 1) < (size_t)(destsize) ? \
529 (size_t)(size1 + 1) : (size_t)(destsize))
530
544LWS_VISIBLE LWS_EXTERN const char *
545lws_nstrstr(const char *buf, size_t len, const char *name, size_t nl);
546
569LWS_VISIBLE LWS_EXTERN const char *
570lws_json_simple_find(const char *buf, size_t len, const char *name, size_t *alen);
571
590lws_json_simple_strcmp(const char *buf, size_t len, const char *name, const char *comp);
591
610lws_hex_len_to_byte_array(const char *h, size_t hlen, uint8_t *dest, int max);
611
629lws_hex_to_byte_array(const char *h, uint8_t *dest, int max);
630
643lws_hex_from_byte_array(const uint8_t *src, size_t slen, char *dest, size_t len);
644
659lws_hex_random(struct lws_context *context, char *dest, size_t len);
660
661/*
662 * lws_timingsafe_bcmp(): constant time memcmp
663 *
664 * \param a: first buffer
665 * \param b: second buffer
666 * \param len: count of bytes to compare
667 *
668 * Return 0 if the two buffers are the same, else nonzero.
669 *
670 * Always compares all of the buffer before returning, so it can't be used as
671 * a timing oracle.
672 */
673
675lws_timingsafe_bcmp(const void *a, const void *b, uint32_t len);
676
688lws_get_random(struct lws_context *context, void *buf, size_t len);
697lws_daemonize(const char *_lock_path);
705
713lws_wsi_user(struct lws *wsi);
714
722lws_wsi_tsi(struct lws *wsi);
723
735lws_set_wsi_user(struct lws *wsi, void *user);
736
762lws_parse_uri(char *p, const char **prot, const char **ads, int *port,
763 const char **path) LWS_WARN_DEPRECATED;
764
765typedef struct lws_parse_uri {
766 const char *scheme;
767 const char *host;
768 const char *path;
772
790lws_parse_uri_create(const char *uri);
791
802
804 const char *sw;
805 const char *doc;
806};
807
809lws_switches_print_help(const char *prog, const struct lws_switches *switches, size_t count);
810
811
834LWS_VISIBLE LWS_EXTERN const char *
835lws_cmdline_option(int argc, const char **argv, const char *val);
836
863LWS_VISIBLE LWS_EXTERN const char *
864lws_cmdline_options(int argc, const char * const *argv, const char *val, const char *last);
865
894
895LWS_VISIBLE LWS_EXTERN const char *
896lws_cmdline_options_cx(const struct lws_context *cx, const char *val, const char *last);
897
922LWS_VISIBLE LWS_EXTERN const char *
923lws_cmdline_option_cx(const struct lws_context *cx, const char *val);
924
933LWS_VISIBLE LWS_EXTERN const char *
934lws_cmdline_option_cx_argv0(const struct lws_context *cx);
935
949lws_cmdline_option_handle_builtin(int argc, const char **argv,
950 struct lws_context_creation_info *info);
951
961lws_parse_iso8601(const char *ads);
962
966LWS_VISIBLE LWS_EXTERN unsigned long
968
974
985lws_get_context(const struct lws *wsi);
986
997lws_get_vhost_listen_port(struct lws_vhost *vhost);
998
1009lws_get_count_threads(struct lws_context *context);
1010
1019lws_get_parent(const struct lws *wsi);
1020
1028lws_get_child(const struct lws *wsi);
1029
1043lws_get_effective_uid_gid(struct lws_context *context, uid_t *uid, gid_t *gid);
1044
1054lws_plat_user_to_uid(const char *username, uid_t *puid);
1055
1065lws_plat_group_to_gid(const char *groupname, gid_t *pgid);
1066
1074LWS_VISIBLE LWS_EXTERN const struct lws_udp * LWS_WARN_UNUSED_RESULT
1075lws_get_udp(const struct lws *wsi);
1076
1078lws_get_opaque_parent_data(const struct lws *wsi);
1079
1081lws_set_opaque_parent_data(struct lws *wsi, void *data);
1082
1084lws_get_opaque_user_data(const struct lws *wsi);
1085
1087lws_set_opaque_user_data(struct lws *wsi, void *data);
1088
1091
1094
1096lws_get_close_length(struct lws *wsi);
1097
1098LWS_VISIBLE LWS_EXTERN unsigned char *
1099lws_get_close_payload(struct lws *wsi);
1100
1112struct lws *lws_get_network_wsi(struct lws *wsi);
1113
1122lws_set_allocator(void *(*realloc)(void *ptr, size_t size, const char *reason));
1123
1124enum {
1125 /*
1126 * Flags for enable and disable rxflow with reason bitmap and with
1127 * backwards-compatible single bool
1128 */
1132
1139
1140};
1141
1162lws_rx_flow_control(struct lws *wsi, int enable);
1163
1174lws_rx_flow_allow_all_protocol(const struct lws_context *context,
1175 const struct lws_protocols *protocol);
1176
1200
1201#if defined(LWS_WITH_DIR)
1202
1203typedef enum {
1204 LDOT_UNKNOWN,
1205 LDOT_FILE,
1206 LDOT_DIR,
1207 LDOT_LINK,
1208 LDOT_FIFO,
1209 LDOTT_SOCKET,
1210 LDOT_CHAR,
1211 LDOT_BLOCK
1212} lws_dir_obj_type_t;
1213
1214struct lws_dir_entry {
1215 const char *name;
1216 lws_dir_obj_type_t type;
1217};
1218
1219typedef int
1220lws_dir_callback_function(const char *dirpath, void *user,
1221 struct lws_dir_entry *lde);
1222
1223struct lws_dir_info {
1224 const char *dirpath;
1225 void *user;
1226 lws_dir_callback_function *cb;
1227 unsigned char do_toplevel_cb:1;
1228};
1229
1252lws_dir(const char *dirpath, void *user, lws_dir_callback_function cb);
1253
1272lws_dir_via_info(struct lws_dir_info *info);
1273
1274
1287lws_dir_rm_rf_cb(const char *dirpath, void *user, struct lws_dir_entry *lde);
1288
1289
1295
1296typedef struct lws_dir_du {
1297 uint64_t size_in_bytes;
1298 uint32_t count_files;
1299} lws_dir_du_t;
1300
1314lws_dir_du_cb(const char *dirpath, void *user, struct lws_dir_entry *lde);
1315
1316
1317/*
1318 * We pass every file in the base dir through a filter, and call back on the
1319 * ones that match. Directories are ignored.
1320 *
1321 * The original path filter string may look like, eg, "sai-*.deb" or "*.txt"
1322 */
1323
1324typedef int (*lws_dir_glob_cb_t)(void *data, const char *path);
1325
1326typedef struct lws_dir_glob {
1327 const char *filter;
1328 lws_dir_glob_cb_t cb;
1329 void *user;
1330} lws_dir_glob_t;
1331
1347lws_dir_glob_cb(const char *dirpath, void *user, struct lws_dir_entry *lde);
1348
1349#endif
1350
1367
1375lws_get_tsi(struct lws *wsi);
1376
1384lws_is_ssl(struct lws *wsi);
1391lws_is_cgi(struct lws *wsi);
1392
1408lws_tls_jit_trust_blob_queury_skid(const void *_blob, size_t blen,
1409 const uint8_t *skid, size_t skid_len,
1410 const uint8_t **prpder, size_t *prder_len);
1411
1423lws_open(const char *__file, int __oflag, ...);
1424
1425struct lws_wifi_scan { /* generic wlan scan item */
1427 char ssid[32];
1428 int32_t rssi; /* divide by .count to get db */
1433};
1434
1435#if defined(LWS_WITH_TLS) && !defined(LWS_WITH_MBEDTLS) && !defined(LWS_WITH_BEARSSL)
1443lws_get_ssl(struct lws *wsi);
1444#endif
1445
1447lws_explicit_bzero(void *p, size_t len);
1448
1449typedef struct lws_humanize_unit {
1450 const char *name; /* array ends with NULL name */
1451 uint64_t factor;
1453
1457
1458#if defined(_DEBUG)
1460lws_assert_fourcc(uint32_t fourcc, uint32_t expected);
1461#else
1462#define lws_assert_fourcc(_a, _b) do { } while (0);
1463#endif
1464
1488
1490lws_humanize(char *buf, size_t len, uint64_t value,
1491 const lws_humanize_unit_t *schema);
1492
1494lws_humanize_pad(char *p, size_t len, uint64_t v,
1495 const lws_humanize_unit_t *schema);
1496
1499
1502
1504lws_ser_wu64be(uint8_t *b, uint64_t u64);
1505
1508
1511
1512LWS_VISIBLE LWS_EXTERN uint64_t
1514
1516lws_vbi_encode(uint64_t value, void *buf);
1517
1519lws_vbi_decode(const void *buf, uint64_t *value, size_t len);
1520
1522
1523#if defined(LWS_WITH_SPAWN)
1524
1525/* opaque internal struct */
1526struct lws_spawn_piped;
1527
1528#if defined(WIN32)
1529struct _lws_siginfo_t {
1530 int retcode;
1531};
1532typedef struct _lws_siginfo_t siginfo_t;
1533#endif
1534
1541typedef struct lws_spawn_resource_us {
1542 uint64_t us_cpu_user;
1543 uint64_t us_cpu_sys;
1544
1545 uint64_t peak_mem_rss;
1546 uint64_t peak_mem_virt;
1547} lws_spawn_resource_us_t;
1548
1549typedef void (*lsp_cb_t)(void *opaque, const lws_spawn_resource_us_t *res,
1550 siginfo_t *si, int we_killed_him);
1551
1552
1572struct lws_spawn_piped_info {
1573 struct lws_dll2_owner *owner;
1574 struct lws_vhost *vh;
1575 struct lws *opt_parent;
1576
1577 const char * const *exec_array;
1578 const char **env_array;
1579 const char *protocol_name;
1580 const char *chroot_path;
1581 const char *wd;
1582
1583 struct lws_spawn_piped **plsp;
1584
1585 void *opaque;
1586
1587 lsp_cb_t reap_cb;
1588
1589 lws_spawn_resource_us_t *res;
1590
1591 lws_usec_t timeout_us;
1592 int max_log_lines;
1593 int tsi;
1594
1595 const struct lws_role_ops *ops; /* NULL is raw file */
1596
1597 uint8_t disable_ctrlc;
1598 uint8_t pty_mode;
1599
1600 const char *cgroup_name_suffix;
1601 int *p_cgroup_ret;
1602};
1603
1625LWS_VISIBLE LWS_EXTERN struct lws_spawn_piped *
1626lws_spawn_piped(const struct lws_spawn_piped_info *lspi);
1627
1628/*
1629 * lws_spawn_piped_kill_child_process() - attempt to kill child process
1630 *
1631 * \p lsp: child object to kill
1632 *
1633 * Attempts to signal the child process in \p lsp to terminate.
1634 */
1636lws_spawn_piped_kill_child_process(struct lws_spawn_piped *lsp);
1637
1646lws_spawn_get_stdwsi_open_count(struct lws_spawn_piped *lsp);
1647
1664lws_spawn_stdwsi_closed(struct lws_spawn_piped *lsp, struct lws *wsi);
1665
1666/*
1667 * lws_spawn_closedown_stdwsis() - forcibly close the spawner side of stdwsi pipes
1668 *
1669 * \p lsp: the spawn object
1670 *
1671 * Closes the spawner side of all the stdwsi for an lsp that are still open.
1672 */
1674lws_spawn_closedown_stdwsis(struct lws_spawn_piped *lsp);
1675
1687lws_spawn_get_stdfd(struct lws *wsi);
1688
1699lws_spawn_get_fd_stdxxx(struct lws_spawn_piped *lsp, int std_idx);
1700
1719lws_spawn_prepare_self_cgroup(const char *user, const char *group);
1720
1733lws_spawn_get_self_cgroup(char *cgroup, size_t max);
1734
1735#endif
1736
1738 const char *layers_path; /* where layers live */
1739 const char *overlay_path; /* where overlay instantiations live */
1740
1741 char mp[256]; /* mountpoint path */
1742 char ovname[64]; /* unique name for mount instance */
1743 char distro[64]; /* unique name for layer source */
1744
1745#if defined(__linux__)
1746 const char *layers[4]; /* distro layers, like "base", "env" */
1747#endif
1748};
1749
1785
1800
1801#define LWS_MINILEX_FAIL -1
1802#define LWS_MINILEX_CONTINUE 0
1803#define LWS_MINILEX_MATCH 1
1804
1832lws_minilex_parse(const uint8_t *lex, int16_t *ps, const uint8_t c,
1833 int *match);
1834
1835/*
1836 * Reports the number of significant bits (from the left) that is needed to
1837 * represent u. So if u is 0x80, result is 8.
1838 */
1839
1840LWS_VISIBLE LWS_EXTERN unsigned int
1841lws_sigbits(uintptr_t u);
1842
1853lws_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:454
int private_source_idx
Definition lws-misc.h:370
uint16_t port
Definition lws-misc.h:769
const uint8_t * data
Definition lws-misc.h:452
char ssid[32]
Definition lws-misc.h:1427
struct lws_buflist ** head_upstream
Definition lws-misc.h:368
const char * path
Definition lws-misc.h:768
size_t len
Definition lws-misc.h:453
struct lws_ss_handle * h
Definition lws-misc.h:449
uint8_t state
Definition lws-misc.h:457
struct lws_buflist * bl
Definition lws-misc.h:450
uint8_t channel
Definition lws-misc.h:1431
int32_t window
Definition lws-misc.h:455
const char * scheme
Definition lws-misc.h:766
const char * doc
Definition lws-misc.h:805
uint8_t authmode
Definition lws-misc.h:1432
unsigned int ss_flags
Definition lws-misc.h:375
uint8_t count
Definition lws-misc.h:1430
const uint8_t * buf
Definition lws-misc.h:373
struct lws_dll2_owner owner
Definition lws-misc.h:222
struct lws_buflist ** private_heads
Definition lws-misc.h:369
struct lws_wifi_scan * next
Definition lws-misc.h:1426
lws_dll2_t list
Definition lws-misc.h:447
const char * name
Definition lws-misc.h:1450
lws_wsmsg_transfer_cb optional_cb
Definition lws-misc.h:371
void * opaque
Definition lws-misc.h:372
const char * sw
Definition lws-misc.h:804
uint8_t bssid[6]
Definition lws-misc.h:1429
const char * host
Definition lws-misc.h:767
int32_t rssi
Definition lws-misc.h:1428
LWS_VISIBLE LWS_EXTERN void lws_buflist2_destroy_all_segments(struct lws_buflist2_owner *owner)
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 size_t lws_buflist2_next_segment_len(struct lws_buflist2_owner *owner, uint8_t **buf)
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:1455
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:365
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:1454
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:1462
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 int LWS_WARN_UNUSED_RESULT lws_buflist2_append_segment_take_ownership(struct lws_buflist2_owner *owner, uint8_t *buf, size_t len)
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 void * lws_buflist2_get_frag_start_or_NULL(struct lws_buflist2_owner *owner)
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 size_t lws_buflist2_use_segment(struct lws_buflist2_owner *owner, size_t len)
LWS_VISIBLE LWS_EXTERN int lws_rx_flow_control(struct lws *wsi, int enable)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_buflist2_append_segment(struct lws_buflist2_owner *owner, const uint8_t *buf, size_t len)
LWS_VISIBLE LWS_EXTERN int lws_plat_group_to_gid(const char *groupname, gid_t *pgid)
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 int lws_plat_user_to_uid(const char *username, uid_t *puid)
LWS_VISIBLE LWS_EXTERN_FOR_DATA const lws_humanize_unit_t humanize_schema_us[8]
Definition lws-misc.h:1456
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 int lws_buflist2_fragment_use(struct lws_buflist2_owner *owner, uint8_t *buf, size_t len, char *frag_first, char *frag_fin)
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:1137
@ LWS_RXFLOW_REASON_APPLIES
Definition lws-misc.h:1133
@ LWS_RXFLOW_REASON_USER_BOOL
Definition lws-misc.h:1129
@ LWS_RXFLOW_REASON_APPLIES_ENABLE_BIT
Definition lws-misc.h:1134
@ LWS_RXFLOW_REASON_APPLIES_ENABLE
Definition lws-misc.h:1135
@ LWS_RXFLOW_REASON_FLAG_PROCESS_NOW
Definition lws-misc.h:1138
@ LWS_RXFLOW_REASON_HTTP_RXBUFFER
Definition lws-misc.h:1130
@ LWS_RXFLOW_REASON_H2_PPS_PENDING
Definition lws-misc.h:1131
@ LWSDLOFLOW_STATE_READ
Definition lws-misc.h:438
@ LWSDLOFLOW_STATE_READ_COMPLETED
Definition lws-misc.h:439
@ LWSDLOFLOW_STATE_READ_FAILED
Definition lws-misc.h:441
#define LWS_EXTERN_FOR_DATA
unsigned short uint16_t
unsigned int uint32_t
#define LWS_WARN_DEPRECATED
#define LWS_INLINE
#define LWS_FORMAT(string_index)
#define LWS_EXTERN
int64_t lws_usec_t
unsigned char uint8_t
lws_stateful_ret_t
#define LWS_WARN_UNUSED_RESULT
#define LWS_VISIBLE
int lws_filefd_type
LWS_VISIBLE LWS_EXTERN int lws_fsmount_mount(struct lws_fsmount *fsm)
char mp[256]
Definition lws-misc.h:1741
LWS_VISIBLE LWS_EXTERN int lws_fsmount_unmount(struct lws_fsmount *fsm)
char ovname[64]
Definition lws-misc.h:1742
char distro[64]
Definition lws-misc.h:1743
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:1739
const char * layers_path
Definition lws-misc.h:1738
LWS_VISIBLE LWS_EXTERN int lws_wol(struct lws_context *ctx, const char *ip_or_NULL, uint8_t *mac_6_bytes)