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_ensure_user_space(struct lws *wsi);
723
731lws_wsi_tsi(struct lws *wsi);
732
744lws_set_wsi_user(struct lws *wsi, void *user);
745
771lws_parse_uri(char *p, const char **prot, const char **ads, int *port,
772 const char **path) LWS_WARN_DEPRECATED;
773
774typedef struct lws_parse_uri {
775 const char *scheme;
776 const char *host;
777 const char *path;
781
799lws_parse_uri_create(const char *uri);
800
811
813 const char *sw;
814 const char *doc;
815};
816
818lws_switches_print_help(const char *prog, const struct lws_switches *switches, size_t count);
819
820
843LWS_VISIBLE LWS_EXTERN const char *
844lws_cmdline_option(int argc, const char **argv, const char *val);
845
872LWS_VISIBLE LWS_EXTERN const char *
873lws_cmdline_options(int argc, const char * const *argv, const char *val, const char *last);
874
903
904LWS_VISIBLE LWS_EXTERN const char *
905lws_cmdline_options_cx(const struct lws_context *cx, const char *val, const char *last);
906
931LWS_VISIBLE LWS_EXTERN const char *
932lws_cmdline_option_cx(const struct lws_context *cx, const char *val);
933
942LWS_VISIBLE LWS_EXTERN const char *
943lws_cmdline_option_cx_argv0(const struct lws_context *cx);
944
958lws_cmdline_option_handle_builtin(int argc, const char **argv,
959 struct lws_context_creation_info *info);
960
970lws_parse_iso8601(const char *ads);
971
975LWS_VISIBLE LWS_EXTERN unsigned long
977
983
994lws_get_context(const struct lws *wsi);
995
1006lws_get_vhost_listen_port(struct lws_vhost *vhost);
1007
1018lws_get_count_threads(struct lws_context *context);
1019
1028lws_get_parent(const struct lws *wsi);
1029
1037lws_get_child(const struct lws *wsi);
1038
1052lws_get_effective_uid_gid(struct lws_context *context, uid_t *uid, gid_t *gid);
1053
1063lws_plat_user_to_uid(const char *username, uid_t *puid);
1064
1074lws_plat_group_to_gid(const char *groupname, gid_t *pgid);
1075
1083LWS_VISIBLE LWS_EXTERN const struct lws_udp * LWS_WARN_UNUSED_RESULT
1084lws_get_udp(const struct lws *wsi);
1085
1087lws_get_opaque_parent_data(const struct lws *wsi);
1088
1090lws_set_opaque_parent_data(struct lws *wsi, void *data);
1091
1093lws_get_opaque_user_data(const struct lws *wsi);
1094
1096lws_set_opaque_user_data(struct lws *wsi, void *data);
1097
1100
1103
1105lws_get_close_length(struct lws *wsi);
1106
1107LWS_VISIBLE LWS_EXTERN unsigned char *
1108lws_get_close_payload(struct lws *wsi);
1109
1121struct lws *lws_get_network_wsi(struct lws *wsi);
1122
1131lws_set_allocator(void *(*realloc)(void *ptr, size_t size, const char *reason));
1132
1133enum {
1134 /*
1135 * Flags for enable and disable rxflow with reason bitmap and with
1136 * backwards-compatible single bool
1137 */
1141
1148
1149};
1150
1171lws_rx_flow_control(struct lws *wsi, int enable);
1172
1183lws_rx_flow_allow_all_protocol(const struct lws_context *context,
1184 const struct lws_protocols *protocol);
1185
1209
1210#if defined(LWS_WITH_DIR)
1211
1212typedef enum {
1213 LDOT_UNKNOWN,
1214 LDOT_FILE,
1215 LDOT_DIR,
1216 LDOT_LINK,
1217 LDOT_FIFO,
1218 LDOTT_SOCKET,
1219 LDOT_CHAR,
1220 LDOT_BLOCK
1221} lws_dir_obj_type_t;
1222
1223struct lws_dir_entry {
1224 const char *name;
1225 lws_dir_obj_type_t type;
1226};
1227
1228typedef int
1229lws_dir_callback_function(const char *dirpath, void *user,
1230 struct lws_dir_entry *lde);
1231
1232struct lws_dir_info {
1233 const char *dirpath;
1234 void *user;
1235 lws_dir_callback_function *cb;
1236 unsigned char do_toplevel_cb:1;
1237};
1238
1261lws_dir(const char *dirpath, void *user, lws_dir_callback_function cb);
1262
1281lws_dir_via_info(struct lws_dir_info *info);
1282
1283
1296lws_dir_rm_rf_cb(const char *dirpath, void *user, struct lws_dir_entry *lde);
1297
1298
1304
1305typedef struct lws_dir_du {
1306 uint64_t size_in_bytes;
1307 uint32_t count_files;
1308} lws_dir_du_t;
1309
1323lws_dir_du_cb(const char *dirpath, void *user, struct lws_dir_entry *lde);
1324
1325
1326/*
1327 * We pass every file in the base dir through a filter, and call back on the
1328 * ones that match. Directories are ignored.
1329 *
1330 * The original path filter string may look like, eg, "sai-*.deb" or "*.txt"
1331 */
1332
1333typedef int (*lws_dir_glob_cb_t)(void *data, const char *path);
1334
1335typedef struct lws_dir_glob {
1336 const char *filter;
1337 lws_dir_glob_cb_t cb;
1338 void *user;
1339} lws_dir_glob_t;
1340
1356lws_dir_glob_cb(const char *dirpath, void *user, struct lws_dir_entry *lde);
1357
1358#endif
1359
1376
1384lws_get_tsi(struct lws *wsi);
1385
1393lws_is_ssl(struct lws *wsi);
1400lws_is_cgi(struct lws *wsi);
1401
1417lws_tls_jit_trust_blob_queury_skid(const void *_blob, size_t blen,
1418 const uint8_t *skid, size_t skid_len,
1419 const uint8_t **prpder, size_t *prder_len);
1420
1432lws_open(const char *__file, int __oflag, ...);
1433
1434struct lws_wifi_scan { /* generic wlan scan item */
1436 char ssid[32];
1437 int32_t rssi; /* divide by .count to get db */
1442};
1443
1444#if defined(LWS_WITH_TLS) && !defined(LWS_WITH_MBEDTLS) && !defined(LWS_WITH_BEARSSL)
1452lws_get_ssl(struct lws *wsi);
1453#endif
1454
1456lws_explicit_bzero(void *p, size_t len);
1457
1458typedef struct lws_humanize_unit {
1459 const char *name; /* array ends with NULL name */
1460 uint64_t factor;
1462
1466
1467#if defined(_DEBUG)
1469lws_assert_fourcc(uint32_t fourcc, uint32_t expected);
1470#else
1471#define lws_assert_fourcc(_a, _b) do { } while (0);
1472#endif
1473
1497
1499lws_humanize(char *buf, size_t len, uint64_t value,
1500 const lws_humanize_unit_t *schema);
1501
1503lws_humanize_pad(char *p, size_t len, uint64_t v,
1504 const lws_humanize_unit_t *schema);
1505
1508
1511
1513lws_ser_wu64be(uint8_t *b, uint64_t u64);
1514
1517
1520
1521LWS_VISIBLE LWS_EXTERN uint64_t
1523
1525lws_vbi_encode(uint64_t value, void *buf);
1526
1528lws_vbi_decode(const void *buf, uint64_t *value, size_t len);
1529
1531
1532#if defined(LWS_WITH_SPAWN)
1533
1534/* opaque internal struct */
1535struct lws_spawn_piped;
1536
1537#if defined(WIN32)
1538struct _lws_siginfo_t {
1539 int retcode;
1540};
1541typedef struct _lws_siginfo_t siginfo_t;
1542#endif
1543
1550typedef struct lws_spawn_resource_us {
1551 uint64_t us_cpu_user;
1552 uint64_t us_cpu_sys;
1553
1554 uint64_t peak_mem_rss;
1555 uint64_t peak_mem_virt;
1556} lws_spawn_resource_us_t;
1557
1558typedef void (*lsp_cb_t)(void *opaque, const lws_spawn_resource_us_t *res,
1559 siginfo_t *si, int we_killed_him);
1560
1561
1581struct lws_spawn_piped_info {
1582 struct lws_dll2_owner *owner;
1583 struct lws_vhost *vh;
1584 struct lws *opt_parent;
1585
1586 const char * const *exec_array;
1587 const char **env_array;
1588 const char *protocol_name;
1589 const char *chroot_path;
1590 const char *wd;
1591
1592 struct lws_spawn_piped **plsp;
1593
1594 void *opaque;
1595
1596 lsp_cb_t reap_cb;
1597
1598 lws_spawn_resource_us_t *res;
1599
1600 lws_usec_t timeout_us;
1601 int max_log_lines;
1602 int tsi;
1603
1604 const struct lws_role_ops *ops; /* NULL is raw file */
1605
1606 uint8_t disable_ctrlc;
1607 uint8_t pty_mode;
1608
1609 const char *cgroup_name_suffix;
1610 int *p_cgroup_ret;
1611};
1612
1634LWS_VISIBLE LWS_EXTERN struct lws_spawn_piped *
1635lws_spawn_piped(const struct lws_spawn_piped_info *lspi);
1636
1637/*
1638 * lws_spawn_piped_kill_child_process() - attempt to kill child process
1639 *
1640 * \p lsp: child object to kill
1641 *
1642 * Attempts to signal the child process in \p lsp to terminate.
1643 */
1645lws_spawn_piped_kill_child_process(struct lws_spawn_piped *lsp);
1646
1655lws_spawn_get_stdwsi_open_count(struct lws_spawn_piped *lsp);
1656
1673lws_spawn_stdwsi_closed(struct lws_spawn_piped *lsp, struct lws *wsi);
1674
1675/*
1676 * lws_spawn_closedown_stdwsis() - forcibly close the spawner side of stdwsi pipes
1677 *
1678 * \p lsp: the spawn object
1679 *
1680 * Closes the spawner side of all the stdwsi for an lsp that are still open.
1681 */
1683lws_spawn_closedown_stdwsis(struct lws_spawn_piped *lsp);
1684
1696lws_spawn_get_stdfd(struct lws *wsi);
1697
1708lws_spawn_get_fd_stdxxx(struct lws_spawn_piped *lsp, int std_idx);
1709
1728lws_spawn_prepare_self_cgroup(const char *user, const char *group);
1729
1742lws_spawn_get_self_cgroup(char *cgroup, size_t max);
1743
1744#endif
1745
1747 const char *layers_path; /* where layers live */
1748 const char *overlay_path; /* where overlay instantiations live */
1749
1750 char mp[256]; /* mountpoint path */
1751 char ovname[64]; /* unique name for mount instance */
1752 char distro[64]; /* unique name for layer source */
1753
1754#if defined(__linux__)
1755 const char *layers[4]; /* distro layers, like "base", "env" */
1756#endif
1757};
1758
1794
1809
1810#define LWS_MINILEX_FAIL -1
1811#define LWS_MINILEX_CONTINUE 0
1812#define LWS_MINILEX_MATCH 1
1813
1841lws_minilex_parse(const uint8_t *lex, int16_t *ps, const uint8_t c,
1842 int *match);
1843
1844/*
1845 * Reports the number of significant bits (from the left) that is needed to
1846 * represent u. So if u is 0x80, result is 8.
1847 */
1848
1849LWS_VISIBLE LWS_EXTERN unsigned int
1850lws_sigbits(uintptr_t u);
1851
1862lws_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:778
const uint8_t * data
Definition lws-misc.h:452
char ssid[32]
Definition lws-misc.h:1436
struct lws_buflist ** head_upstream
Definition lws-misc.h:368
const char * path
Definition lws-misc.h:777
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:1440
int32_t window
Definition lws-misc.h:455
const char * scheme
Definition lws-misc.h:775
const char * doc
Definition lws-misc.h:814
uint8_t authmode
Definition lws-misc.h:1441
unsigned int ss_flags
Definition lws-misc.h:375
uint8_t count
Definition lws-misc.h:1439
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:1435
lws_dll2_t list
Definition lws-misc.h:447
const char * name
Definition lws-misc.h:1459
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:813
uint8_t bssid[6]
Definition lws-misc.h:1438
const char * host
Definition lws-misc.h:776
int32_t rssi
Definition lws-misc.h:1437
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_ensure_user_space(struct lws *wsi)
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:1464
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:1463
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:1471
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:1465
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:1146
@ LWS_RXFLOW_REASON_APPLIES
Definition lws-misc.h:1142
@ LWS_RXFLOW_REASON_USER_BOOL
Definition lws-misc.h:1138
@ LWS_RXFLOW_REASON_APPLIES_ENABLE_BIT
Definition lws-misc.h:1143
@ LWS_RXFLOW_REASON_APPLIES_ENABLE
Definition lws-misc.h:1144
@ LWS_RXFLOW_REASON_FLAG_PROCESS_NOW
Definition lws-misc.h:1147
@ LWS_RXFLOW_REASON_HTTP_RXBUFFER
Definition lws-misc.h:1139
@ LWS_RXFLOW_REASON_H2_PPS_PENDING
Definition lws-misc.h:1140
@ 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:1750
LWS_VISIBLE LWS_EXTERN int lws_fsmount_unmount(struct lws_fsmount *fsm)
char ovname[64]
Definition lws-misc.h:1751
char distro[64]
Definition lws-misc.h:1752
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:1748
const char * layers_path
Definition lws-misc.h:1747
LWS_VISIBLE LWS_EXTERN int lws_wol(struct lws_context *ctx, const char *ip_or_NULL, uint8_t *mac_6_bytes)