libwebsockets
Lightweight C library for HTML5 websockets
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 
45 struct lws_buflist;
46 
58 lws_buflist_append_segment(struct lws_buflist **head, const uint8_t *buf,
59  size_t len);
71 lws_buflist_next_segment_len(struct lws_buflist **head, uint8_t **buf);
72 
89 lws_buflist_use_segment(struct lws_buflist **head, size_t len);
90 
99 lws_buflist_total_len(struct lws_buflist **head);
100 
113 lws_buflist_linear_copy(struct lws_buflist **head, size_t ofs, uint8_t *buf,
114  size_t len);
115 
133 lws_buflist_linear_use(struct lws_buflist **head, uint8_t *buf, size_t len);
134 
154 lws_buflist_fragment_use(struct lws_buflist **head, uint8_t *buf,
155  size_t len, char *frag_first, char *frag_fin);
156 
166 lws_buflist_destroy_all_segments(struct lws_buflist **head);
167 
179 lws_buflist_describe(struct lws_buflist **head, void *id, const char *reason);
180 
181 
182 /*
183  * Optional helpers for closely-managed stream flow control. These are useful
184  * when there is no memory for large rx buffers and instead tx credit is being
185  * used to regulate the server sending data.
186  *
187  * When combined with stateful consumption-on-demand, this can be very effective
188  * at managing data flows through restricted circumstances. These helpers
189  * implement a golden implementation that can be bound to a stream in its priv
190  * data.
191  *
192  * The helper is sophisticated enough to contain a buflist to manage overflows
193  * on heap and preferentially drain it. RX goes through heap to guarantee the
194  * consumer can exit cleanly at any time.
195  */
196 
197 enum {
198  LWSDLOFLOW_STATE_READ, /* default, we want input */
199  LWSDLOFLOW_STATE_READ_COMPLETED, /* we do not need further rx, every-
200  * thing is locally buffered or used */
201  LWSDLOFLOW_STATE_READ_FAILED, /* operation has fatal error */
202 };
203 
204 struct lws_ss_handle;
205 
206 typedef struct lws_flow {
208 
209  struct lws_ss_handle *h;
210  struct lws_buflist *bl;
211 
212  const uint8_t *data;
213  size_t len; /* bytes left in data */
214  uint32_t blseglen; /* bytes issued */
215  int32_t window;
216 
219 
229 
240 
250 #define lws_ptr_diff(head, tail) \
251  ((int)((char *)(head) - (char *)(tail)))
252 
253 #define lws_ptr_diff_size_t(head, tail) \
254  ((size_t)(ssize_t)((char *)(head) - (char *)(tail)))
255 
268 lws_snprintf(char *str, size_t size, const char *format, ...) LWS_FORMAT(3);
269 
280 LWS_VISIBLE LWS_EXTERN char *
281 lws_strncpy(char *dest, const char *src, size_t size);
282 
283 /*
284  * Variation where we want to use the smaller of two lengths, useful when the
285  * source string is not NUL terminated
286  */
287 #define lws_strnncpy(dest, src, size1, destsize) \
288  lws_strncpy(dest, src, (size_t)(size1 + 1) < (size_t)(destsize) ? \
289  (size_t)(size1 + 1) : (size_t)(destsize))
290 
304 LWS_VISIBLE LWS_EXTERN const char *
305 lws_nstrstr(const char *buf, size_t len, const char *name, size_t nl);
306 
329 LWS_VISIBLE LWS_EXTERN const char *
330 lws_json_simple_find(const char *buf, size_t len, const char *name, size_t *alen);
331 
350 lws_json_simple_strcmp(const char *buf, size_t len, const char *name, const char *comp);
351 
370 lws_hex_len_to_byte_array(const char *h, size_t hlen, uint8_t *dest, int max);
371 
389 lws_hex_to_byte_array(const char *h, uint8_t *dest, int max);
390 
403 lws_hex_from_byte_array(const uint8_t *src, size_t slen, char *dest, size_t len);
404 
419 lws_hex_random(struct lws_context *context, char *dest, size_t len);
420 
421 /*
422  * lws_timingsafe_bcmp(): constant time memcmp
423  *
424  * \param a: first buffer
425  * \param b: second buffer
426  * \param len: count of bytes to compare
427  *
428  * Return 0 if the two buffers are the same, else nonzero.
429  *
430  * Always compares all of the buffer before returning, so it can't be used as
431  * a timing oracle.
432  */
433 
435 lws_timingsafe_bcmp(const void *a, const void *b, uint32_t len);
436 
447 LWS_VISIBLE LWS_EXTERN size_t
448 lws_get_random(struct lws_context *context, void *buf, size_t len);
457 lws_daemonize(const char *_lock_path);
465 
472 LWS_VISIBLE LWS_EXTERN void *
473 lws_wsi_user(struct lws *wsi);
474 
482 lws_wsi_tsi(struct lws *wsi);
483 
495 lws_set_wsi_user(struct lws *wsi, void *user);
496 
520 lws_parse_uri(char *p, const char **prot, const char **ads, int *port,
521  const char **path);
539 LWS_VISIBLE LWS_EXTERN const char *
540 lws_cmdline_option(int argc, const char **argv, const char *val);
541 
555 lws_cmdline_option_handle_builtin(int argc, const char **argv,
556  struct lws_context_creation_info *info);
557 
561 LWS_VISIBLE LWS_EXTERN unsigned long
563 
569 
579 LWS_VISIBLE LWS_EXTERN struct lws_context * LWS_WARN_UNUSED_RESULT
580 lws_get_context(const struct lws *wsi);
581 
592 lws_get_vhost_listen_port(struct lws_vhost *vhost);
593 
604 lws_get_count_threads(struct lws_context *context);
605 
614 lws_get_parent(const struct lws *wsi);
615 
623 lws_get_child(const struct lws *wsi);
624 
638 lws_get_effective_uid_gid(struct lws_context *context, uid_t *uid, gid_t *gid);
639 
647 LWS_VISIBLE LWS_EXTERN const struct lws_udp * LWS_WARN_UNUSED_RESULT
648 lws_get_udp(const struct lws *wsi);
649 
650 LWS_VISIBLE LWS_EXTERN void *
651 lws_get_opaque_parent_data(const struct lws *wsi);
652 
654 lws_set_opaque_parent_data(struct lws *wsi, void *data);
655 
656 LWS_VISIBLE LWS_EXTERN void *
657 lws_get_opaque_user_data(const struct lws *wsi);
658 
660 lws_set_opaque_user_data(struct lws *wsi, void *data);
661 
663 lws_get_child_pending_on_writable(const struct lws *wsi);
664 
667 
669 lws_get_close_length(struct lws *wsi);
670 
671 LWS_VISIBLE LWS_EXTERN unsigned char *
672 lws_get_close_payload(struct lws *wsi);
673 
685 struct lws *lws_get_network_wsi(struct lws *wsi);
686 
695 lws_set_allocator(void *(*realloc)(void *ptr, size_t size, const char *reason));
696 
697 enum {
698  /*
699  * Flags for enable and disable rxflow with reason bitmap and with
700  * backwards-compatible single bool
701  */
705 
712 
713 };
714 
735 lws_rx_flow_control(struct lws *wsi, int enable);
736 
747 lws_rx_flow_allow_all_protocol(const struct lws_context *context,
748  const struct lws_protocols *protocol);
749 
771 LWS_VISIBLE LWS_EXTERN size_t
773 
774 #if defined(LWS_WITH_DIR)
775 
776 typedef enum {
777  LDOT_UNKNOWN,
778  LDOT_FILE,
779  LDOT_DIR,
780  LDOT_LINK,
781  LDOT_FIFO,
782  LDOTT_SOCKET,
783  LDOT_CHAR,
784  LDOT_BLOCK
785 } lws_dir_obj_type_t;
786 
787 struct lws_dir_entry {
788  const char *name;
789  lws_dir_obj_type_t type;
790 };
791 
792 typedef int
793 lws_dir_callback_function(const char *dirpath, void *user,
794  struct lws_dir_entry *lde);
795 
809 lws_dir(const char *dirpath, void *user, lws_dir_callback_function cb);
810 
823 lws_dir_rm_rf_cb(const char *dirpath, void *user, struct lws_dir_entry *lde);
824 
825 /*
826  * We pass every file in the base dir through a filter, and call back on the
827  * ones that match. Directories are ignored.
828  *
829  * The original path filter string may look like, eg, "sai-*.deb" or "*.txt"
830  */
831 
832 typedef int (*lws_dir_glob_cb_t)(void *data, const char *path);
833 
834 typedef struct lws_dir_glob {
835  const char *filter;
836  lws_dir_glob_cb_t cb;
837  void *user;
838 } lws_dir_glob_t;
839 
855 lws_dir_glob_cb(const char *dirpath, void *user, struct lws_dir_entry *lde);
856 
857 #endif
858 
875 
883 lws_get_tsi(struct lws *wsi);
884 
892 lws_is_ssl(struct lws *wsi);
899 lws_is_cgi(struct lws *wsi);
900 
916 lws_tls_jit_trust_blob_queury_skid(const void *_blob, size_t blen,
917  const uint8_t *skid, size_t skid_len,
918  const uint8_t **prpder, size_t *prder_len);
919 
931 lws_open(const char *__file, int __oflag, ...);
932 
933 struct lws_wifi_scan { /* generic wlan scan item */
935  char ssid[32];
936  int32_t rssi; /* divide by .count to get db */
941 };
942 
943 #if defined(LWS_WITH_TLS) && !defined(LWS_WITH_MBEDTLS)
951 lws_get_ssl(struct lws *wsi);
952 #endif
953 
955 lws_explicit_bzero(void *p, size_t len);
956 
957 typedef struct lws_humanize_unit {
958  const char *name; /* array ends with NULL name */
959  uint64_t factor;
961 
965 
966 #if defined(_DEBUG)
967 void
968 lws_assert_fourcc(uint32_t fourcc, uint32_t expected);
969 #else
970 #define lws_assert_fourcc(_a, _b) do { } while (0);
971 #endif
972 
995 lws_humanize(char *buf, size_t len, uint64_t value,
996  const lws_humanize_unit_t *schema);
997 
1000 
1003 
1005 lws_ser_wu64be(uint8_t *b, uint64_t u64);
1006 
1009 
1012 
1013 LWS_VISIBLE LWS_EXTERN uint64_t
1015 
1017 lws_vbi_encode(uint64_t value, void *buf);
1018 
1020 lws_vbi_decode(const void *buf, uint64_t *value, size_t len);
1021 
1023 
1024 #if defined(LWS_WITH_SPAWN)
1025 
1026 /* opaque internal struct */
1027 struct lws_spawn_piped;
1028 
1029 #if defined(WIN32)
1030 struct _lws_siginfo_t {
1031  int retcode;
1032 };
1033 typedef struct _lws_siginfo_t siginfo_t;
1034 #endif
1035 
1036 typedef void (*lsp_cb_t)(void *opaque, lws_usec_t *accounting, siginfo_t *si,
1037  int we_killed_him);
1038 
1039 
1057 struct lws_spawn_piped_info {
1058  struct lws_dll2_owner *owner;
1059  struct lws_vhost *vh;
1060  struct lws *opt_parent;
1061 
1062  const char * const *exec_array;
1063  const char **env_array;
1064  const char *protocol_name;
1065  const char *chroot_path;
1066  const char *wd;
1067 
1068  struct lws_spawn_piped **plsp;
1069 
1070  void *opaque;
1071 
1072  lsp_cb_t reap_cb;
1073 
1074  lws_usec_t timeout_us;
1075  int max_log_lines;
1076  int tsi;
1077 
1078  const struct lws_role_ops *ops; /* NULL is raw file */
1079 
1080  uint8_t disable_ctrlc;
1081 };
1082 
1104 LWS_VISIBLE LWS_EXTERN struct lws_spawn_piped *
1105 lws_spawn_piped(const struct lws_spawn_piped_info *lspi);
1106 
1107 /*
1108  * lws_spawn_piped_kill_child_process() - attempt to kill child process
1109  *
1110  * \p lsp: child object to kill
1111  *
1112  * Attempts to signal the child process in \p lsp to terminate.
1113  */
1115 lws_spawn_piped_kill_child_process(struct lws_spawn_piped *lsp);
1116 
1131 lws_spawn_stdwsi_closed(struct lws_spawn_piped *lsp, struct lws *wsi);
1132 
1144 lws_spawn_get_stdfd(struct lws *wsi);
1145 
1146 #endif
1147 
1148 struct lws_fsmount {
1149  const char *layers_path; /* where layers live */
1150  const char *overlay_path; /* where overlay instantiations live */
1151 
1152  char mp[256]; /* mountpoint path */
1153  char ovname[64]; /* unique name for mount instance */
1154  char distro[64]; /* unique name for layer source */
1155 
1156 #if defined(__linux__)
1157  const char *layers[4]; /* distro layers, like "base", "env" */
1158 #endif
1159 };
1160 
1196 
1211 
1212 #define LWS_MINILEX_FAIL -1
1213 #define LWS_MINILEX_CONTINUE 0
1214 #define LWS_MINILEX_MATCH 1
1215 
1243 lws_minilex_parse(const uint8_t *lex, int16_t *ps, const uint8_t c,
1244  int *match);
1245 
1246 /*
1247  * Reports the number of significant bits (from the left) that is needed to
1248  * represent u. So if u is 0x80, result is 8.
1249  */
1250 
1251 LWS_VISIBLE LWS_EXTERN unsigned int
1252 lws_sigbits(uintptr_t u);
1253 
1264 lws_wol(struct lws_context *ctx, const char *ip_or_NULL, uint8_t *mac_6_bytes);
uint32_t blseglen
Definition: lws-misc.h:214
uint64_t factor
Definition: lws-misc.h:959
const uint8_t * data
Definition: lws-misc.h:212
char ssid[32]
Definition: lws-misc.h:935
size_t len
Definition: lws-misc.h:213
struct lws_ss_handle * h
Definition: lws-misc.h:209
uint8_t state
Definition: lws-misc.h:217
struct lws_buflist * bl
Definition: lws-misc.h:210
uint8_t channel
Definition: lws-misc.h:939
int32_t window
Definition: lws-misc.h:215
uint8_t authmode
Definition: lws-misc.h:940
uint8_t count
Definition: lws-misc.h:938
struct lws_wifi_scan * next
Definition: lws-misc.h:934
lws_dll2_t list
Definition: lws-misc.h:207
const char * name
Definition: lws-misc.h:958
uint8_t bssid[6]
Definition: lws-misc.h:937
int32_t rssi
Definition: lws-misc.h:936
LWS_VISIBLE LWS_EXTERN void * lws_get_opaque_user_data(const struct lws *wsi)
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 struct lws_context *LWS_WARN_UNUSED_RESULT lws_get_context(const struct lws *wsi)
LWS_VISIBLE const lws_humanize_unit_t humanize_schema_si_bytes[7]
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 const char * lws_nstrstr(const char *buf, size_t len, const char *name, size_t nl)
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 int LWS_WARN_UNUSED_RESULT lws_parse_uri(char *p, const char **prot, const char **ads, int *port, const char **path)
LWS_VISIBLE LWS_EXTERN int lws_snprintf(char *str, size_t size, const char *format,...) LWS_FORMAT(3)
LWS_VISIBLE LWS_EXTERN char * lws_strncpy(char *dest, const char *src, size_t size)
LWS_VISIBLE LWS_EXTERN void lws_get_effective_uid_gid(struct lws_context *context, uid_t *uid, gid_t *gid)
LWS_VISIBLE LWS_EXTERN int lws_is_ssl(struct lws *wsi)
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 size_t lws_get_random(struct lws_context *context, void *buf, size_t len)
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 int lws_hex_len_to_byte_array(const char *h, size_t hlen, uint8_t *dest, int max)
LWS_VISIBLE LWS_EXTERN const struct lws_udp *LWS_WARN_UNUSED_RESULT lws_get_udp(const struct lws *wsi)
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 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:970
LWS_VISIBLE LWS_EXTERN uint32_t lws_ser_ru32be(const uint8_t *b)
LWS_VISIBLE LWS_EXTERN const char * lws_cmdline_option(int argc, const char **argv, const char *val)
LWS_VISIBLE LWS_EXTERN size_t lws_buflist_total_len(struct lws_buflist **head)
LWS_VISIBLE LWS_EXTERN struct lws *LWS_WARN_UNUSED_RESULT lws_get_parent(const struct lws *wsi)
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)
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_get_opaque_parent_data(const struct lws *wsi)
LWS_VISIBLE const lws_humanize_unit_t humanize_schema_us[8]
LWS_VISIBLE LWS_EXTERN struct lws * lws_get_network_wsi(struct lws *wsi)
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 void * lws_wsi_user(struct lws *wsi)
LWS_VISIBLE const lws_humanize_unit_t humanize_schema_si[7]
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 int lws_json_simple_strcmp(const char *buf, size_t len, const char *name, const char *comp)
LWS_VISIBLE LWS_EXTERN unsigned char * lws_get_close_payload(struct lws *wsi)
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_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 const char *LWS_WARN_UNUSED_RESULT lws_get_library_version(void)
LWS_VISIBLE LWS_EXTERN struct lws *LWS_WARN_UNUSED_RESULT lws_get_child(const struct lws *wsi)
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 const char * lws_json_simple_find(const char *buf, size_t len, const char *name, size_t *alen)
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_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)
struct lws_humanize_unit lws_humanize_unit_t
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_RXFLOW_REASON_APPLIES_DISABLE
Definition: lws-misc.h:710
@ LWS_RXFLOW_REASON_APPLIES
Definition: lws-misc.h:706
@ LWS_RXFLOW_REASON_USER_BOOL
Definition: lws-misc.h:702
@ LWS_RXFLOW_REASON_APPLIES_ENABLE_BIT
Definition: lws-misc.h:707
@ LWS_RXFLOW_REASON_APPLIES_ENABLE
Definition: lws-misc.h:708
@ LWS_RXFLOW_REASON_FLAG_PROCESS_NOW
Definition: lws-misc.h:711
@ LWS_RXFLOW_REASON_HTTP_RXBUFFER
Definition: lws-misc.h:703
@ LWS_RXFLOW_REASON_H2_PPS_PENDING
Definition: lws-misc.h:704
@ LWSDLOFLOW_STATE_READ
Definition: lws-misc.h:198
@ LWSDLOFLOW_STATE_READ_COMPLETED
Definition: lws-misc.h:199
@ LWSDLOFLOW_STATE_READ_FAILED
Definition: lws-misc.h:201
unsigned short uint16_t
unsigned int uint32_t
#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
LWS_VISIBLE LWS_EXTERN int lws_fsmount_mount(struct lws_fsmount *fsm)
char mp[256]
Definition: lws-misc.h:1152
LWS_VISIBLE LWS_EXTERN int lws_fsmount_unmount(struct lws_fsmount *fsm)
char ovname[64]
Definition: lws-misc.h:1153
char distro[64]
Definition: lws-misc.h:1154
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:1150
const char * layers_path
Definition: lws-misc.h:1149
LWS_VISIBLE LWS_EXTERN int lws_wol(struct lws_context *ctx, const char *ip_or_NULL, uint8_t *mac_6_bytes)