libwebsockets
Lightweight C library for HTML5 websockets
class="ui-resizable-handle">
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
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
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;
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
918lws_plat_user_to_uid(const char *username, uid_t *puid);
919
929lws_plat_group_to_gid(const char *groupname, gid_t *pgid);
930
938LWS_VISIBLE LWS_EXTERN const struct lws_udp * LWS_WARN_UNUSED_RESULT
939lws_get_udp(const struct lws *wsi);
940
942lws_get_opaque_parent_data(const struct lws *wsi);
943
945lws_set_opaque_parent_data(struct lws *wsi, void *data);
946
948lws_get_opaque_user_data(const struct lws *wsi);
949
951lws_set_opaque_user_data(struct lws *wsi, void *data);
952
955
958
960lws_get_close_length(struct lws *wsi);
961
962LWS_VISIBLE LWS_EXTERN unsigned char *
963lws_get_close_payload(struct lws *wsi);
964
976struct lws *lws_get_network_wsi(struct lws *wsi);
977
986lws_set_allocator(void *(*realloc)(void *ptr, size_t size, const char *reason));
987
988enum {
989 /*
990 * Flags for enable and disable rxflow with reason bitmap and with
991 * backwards-compatible single bool
992 */
996
1003
1004};
1005
1026lws_rx_flow_control(struct lws *wsi, int enable);
1027
1038lws_rx_flow_allow_all_protocol(const struct lws_context *context,
1039 const struct lws_protocols *protocol);
1040
1064
1065#if defined(LWS_WITH_DIR)
1066
1067typedef enum {
1068 LDOT_UNKNOWN,
1069 LDOT_FILE,
1070 LDOT_DIR,
1071 LDOT_LINK,
1072 LDOT_FIFO,
1073 LDOTT_SOCKET,
1074 LDOT_CHAR,
1075 LDOT_BLOCK
1076} lws_dir_obj_type_t;
1077
1078struct lws_dir_entry {
1079 const char *name;
1080 lws_dir_obj_type_t type;
1081};
1082
1083typedef int
1084lws_dir_callback_function(const char *dirpath, void *user,
1085 struct lws_dir_entry *lde);
1086
1087struct lws_dir_info {
1088 const char *dirpath;
1089 void *user;
1090 lws_dir_callback_function *cb;
1091 unsigned char do_toplevel_cb:1;
1092};
1093
1116lws_dir(const char *dirpath, void *user, lws_dir_callback_function cb);
1117
1136lws_dir_via_info(struct lws_dir_info *info);
1137
1138
1151lws_dir_rm_rf_cb(const char *dirpath, void *user, struct lws_dir_entry *lde);
1152
1153
1159
1160typedef struct lws_dir_du {
1161 uint64_t size_in_bytes;
1162 uint32_t count_files;
1163} lws_dir_du_t;
1164
1178lws_dir_du_cb(const char *dirpath, void *user, struct lws_dir_entry *lde);
1179
1180
1181/*
1182 * We pass every file in the base dir through a filter, and call back on the
1183 * ones that match. Directories are ignored.
1184 *
1185 * The original path filter string may look like, eg, "sai-*.deb" or "*.txt"
1186 */
1187
1188typedef int (*lws_dir_glob_cb_t)(void *data, const char *path);
1189
1190typedef struct lws_dir_glob {
1191 const char *filter;
1192 lws_dir_glob_cb_t cb;
1193 void *user;
1194} lws_dir_glob_t;
1195
1211lws_dir_glob_cb(const char *dirpath, void *user, struct lws_dir_entry *lde);
1212
1213#endif
1214
1231
1239lws_get_tsi(struct lws *wsi);
1240
1248lws_is_ssl(struct lws *wsi);
1255lws_is_cgi(struct lws *wsi);
1256
1272lws_tls_jit_trust_blob_queury_skid(const void *_blob, size_t blen,
1273 const uint8_t *skid, size_t skid_len,
1274 const uint8_t **prpder, size_t *prder_len);
1275
1287lws_open(const char *__file, int __oflag, ...);
1288
1289struct lws_wifi_scan { /* generic wlan scan item */
1291 char ssid[32];
1292 int32_t rssi; /* divide by .count to get db */
1297};
1298
1299#if defined(LWS_WITH_TLS) && !defined(LWS_WITH_MBEDTLS) && !defined(LWS_WITH_BEARSSL)
1307lws_get_ssl(struct lws *wsi);
1308#endif
1309
1311lws_explicit_bzero(void *p, size_t len);
1312
1313typedef struct lws_humanize_unit {
1314 const char *name; /* array ends with NULL name */
1315 uint64_t factor;
1317
1321
1322#if defined(_DEBUG)
1324lws_assert_fourcc(uint32_t fourcc, uint32_t expected);
1325#else
1326#define lws_assert_fourcc(_a, _b) do { } while (0);
1327#endif
1328
1352
1354lws_humanize(char *buf, size_t len, uint64_t value,
1355 const lws_humanize_unit_t *schema);
1356
1358lws_humanize_pad(char *p, size_t len, uint64_t v,
1359 const lws_humanize_unit_t *schema);
1360
1363
1366
1368lws_ser_wu64be(uint8_t *b, uint64_t u64);
1369
1372
1375
1376LWS_VISIBLE LWS_EXTERN uint64_t
1378
1380lws_vbi_encode(uint64_t value, void *buf);
1381
1383lws_vbi_decode(const void *buf, uint64_t *value, size_t len);
1384
1386
1387#if defined(LWS_WITH_SPAWN)
1388
1389/* opaque internal struct */
1390struct lws_spawn_piped;
1391
1392#if defined(WIN32)
1393struct _lws_siginfo_t {
1394 int retcode;
1395};
1396typedef struct _lws_siginfo_t siginfo_t;
1397#endif
1398
1405typedef struct lws_spawn_resource_us {
1406 uint64_t us_cpu_user;
1407 uint64_t us_cpu_sys;
1408
1409 uint64_t peak_mem_rss;
1410 uint64_t peak_mem_virt;
1411} lws_spawn_resource_us_t;
1412
1413typedef void (*lsp_cb_t)(void *opaque, const lws_spawn_resource_us_t *res,
1414 siginfo_t *si, int we_killed_him);
1415
1416
1436struct lws_spawn_piped_info {
1437 struct lws_dll2_owner *owner;
1438 struct lws_vhost *vh;
1439 struct lws *opt_parent;
1440
1441 const char * const *exec_array;
1442 const char **env_array;
1443 const char *protocol_name;
1444 const char *chroot_path;
1445 const char *wd;
1446
1447 struct lws_spawn_piped **plsp;
1448
1449 void *opaque;
1450
1451 lsp_cb_t reap_cb;
1452
1453 lws_spawn_resource_us_t *res;
1454
1455 lws_usec_t timeout_us;
1456 int max_log_lines;
1457 int tsi;
1458
1459 const struct lws_role_ops *ops; /* NULL is raw file */
1460
1461 uint8_t disable_ctrlc;
1462 uint8_t pty_mode;
1463
1464 const char *cgroup_name_suffix;
1465 int *p_cgroup_ret;
1466};
1467
1489LWS_VISIBLE LWS_EXTERN struct lws_spawn_piped *
1490lws_spawn_piped(const struct lws_spawn_piped_info *lspi);
1491
1492/*
1493 * lws_spawn_piped_kill_child_process() - attempt to kill child process
1494 *
1495 * \p lsp: child object to kill
1496 *
1497 * Attempts to signal the child process in \p lsp to terminate.
1498 */
1500lws_spawn_piped_kill_child_process(struct lws_spawn_piped *lsp);
1501
1510lws_spawn_get_stdwsi_open_count(struct lws_spawn_piped *lsp);
1511
1528lws_spawn_stdwsi_closed(struct lws_spawn_piped *lsp, struct lws *wsi);
1529
1530/*
1531 * lws_spawn_closedown_stdwsis() - forcibly close the spawner side of stdwsi pipes
1532 *
1533 * \p lsp: the spawn object
1534 *
1535 * Closes the spawner side of all the stdwsi for an lsp that are still open.
1536 */
1538lws_spawn_closedown_stdwsis(struct lws_spawn_piped *lsp);
1539
1551lws_spawn_get_stdfd(struct lws *wsi);
1552
1563lws_spawn_get_fd_stdxxx(struct lws_spawn_piped *lsp, int std_idx);
1564
1583lws_spawn_prepare_self_cgroup(const char *user, const char *group);
1584
1597lws_spawn_get_self_cgroup(char *cgroup, size_t max);
1598
1599#endif
1600
1602 const char *layers_path; /* where layers live */
1603 const char *overlay_path; /* where overlay instantiations live */
1604
1605 char mp[256]; /* mountpoint path */
1606 char ovname[64]; /* unique name for mount instance */
1607 char distro[64]; /* unique name for layer source */
1608
1609#if defined(__linux__)
1610 const char *layers[4]; /* distro layers, like "base", "env" */
1611#endif
1612};
1613
1649
1664
1665#define LWS_MINILEX_FAIL -1
1666#define LWS_MINILEX_CONTINUE 0
1667#define LWS_MINILEX_MATCH 1
1668
1696lws_minilex_parse(const uint8_t *lex, int16_t *ps, const uint8_t c,
1697 int *match);
1698
1699/*
1700 * Reports the number of significant bits (from the left) that is needed to
1701 * represent u. So if u is 0x80, result is 8.
1702 */
1703
1704LWS_VISIBLE LWS_EXTERN unsigned int
1705lws_sigbits(uintptr_t u);
1706
1717lws_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:1291
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:1295
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:1296
unsigned int ss_flags
Definition lws-misc.h:239
uint8_t count
Definition lws-misc.h:1294
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:1290
lws_dll2_t list
Definition lws-misc.h:311
const char * name
Definition lws-misc.h:1314
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:1293
const char * host
Definition lws-misc.h:631
int32_t rssi
Definition lws-misc.h:1292
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:1319
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:1318
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:1326
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_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:1320
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:1001
@ LWS_RXFLOW_REASON_APPLIES
Definition lws-misc.h:997
@ LWS_RXFLOW_REASON_USER_BOOL
Definition lws-misc.h:993
@ LWS_RXFLOW_REASON_APPLIES_ENABLE_BIT
Definition lws-misc.h:998
@ LWS_RXFLOW_REASON_APPLIES_ENABLE
Definition lws-misc.h:999
@ LWS_RXFLOW_REASON_FLAG_PROCESS_NOW
Definition lws-misc.h:1002
@ LWS_RXFLOW_REASON_HTTP_RXBUFFER
Definition lws-misc.h:994
@ LWS_RXFLOW_REASON_H2_PPS_PENDING
Definition lws-misc.h:995
@ 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
unsigned short uint16_t
unsigned int uint32_t
#define LWS_WARN_DEPRECATED
#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:1605
LWS_VISIBLE LWS_EXTERN int lws_fsmount_unmount(struct lws_fsmount *fsm)
char ovname[64]
Definition lws-misc.h:1606
char distro[64]
Definition lws-misc.h:1607
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:1603
const char * layers_path
Definition lws-misc.h:1602
LWS_VISIBLE LWS_EXTERN int lws_wol(struct lws_context *ctx, const char *ip_or_NULL, uint8_t *mac_6_bytes)