libwebsockets
Lightweight C library for HTML5 websockets
libwebsockets.h
Go to the documentation of this file.
1 /*
2  * libwebsockets - small server side websockets and web server implementation
3  *
4  * Copyright (C) 2010 - 2019 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 /** @file */
26 
27 #ifndef LIBWEBSOCKET_H_3060898B846849FF9F88F5DB59B5950C
28 #define LIBWEBSOCKET_H_3060898B846849FF9F88F5DB59B5950C
29 
30 #ifdef __cplusplus
31 #include <cstddef>
32 #include <cstdarg>
33 
34 extern "C" {
35 #else
36 #include <stdarg.h>
37 #endif
38 
39 #include "lws_config.h"
40 
41 #if defined(LWS_HAVE_SYS_TYPES_H) && !defined(LWS_PLAT_BAREMETAL)
42 #include <sys/types.h>
43 #endif
44 
45 #include <stddef.h>
46 #include <string.h>
47 #include <stdlib.h>
48 
49 
50 #if defined(LWS_SUPPRESS_DEPRECATED_API_WARNINGS)
51 #define OPENSSL_USE_DEPRECATED
52 #endif
53 
54 /* place for one-shot opaque forward references */
55 
56 typedef struct lws_context * lws_ctx_t;
57 struct lws_dsh;
58 
59 /*
60  * CARE: everything using cmake defines needs to be below here
61  */
62 
63 #define LWS_US_PER_SEC ((lws_usec_t)1000000)
64 #define LWS_MS_PER_SEC ((lws_usec_t)1000)
65 #define LWS_US_PER_MS ((lws_usec_t)1000)
66 #define LWS_NS_PER_US ((lws_usec_t)1000)
67 
68 #define LWS_KI (1024)
69 #define LWS_MI (LWS_KI * 1024)
70 #define LWS_GI (LWS_MI * 1024)
71 #define LWS_TI ((uint64_t)LWS_GI * 1024)
72 #define LWS_PI ((uint64_t)LWS_TI * 1024)
73 
74 #define LWS_US_TO_MS(x) ((x + (LWS_US_PER_MS / 2)) / LWS_US_PER_MS)
75 
76 #define LWS_FOURCC(a, b, c, d) ((a << 24) | (b << 16) | (c << 8) | d)
77 
78 #if defined(LWS_HAS_INTPTR_T)
79 #include <stdint.h>
80 #define lws_intptr_t intptr_t
81 #else
82 typedef unsigned long long lws_intptr_t;
83 #endif
84 
85 #if defined(WIN32) || defined(_WIN32)
86 #ifndef WIN32_LEAN_AND_MEAN
87 #define WIN32_LEAN_AND_MEAN
88 #endif
89 
90 #include <winsock2.h>
91 #include <ws2tcpip.h>
92 #include <stddef.h>
93 #include <basetsd.h>
94 #include <io.h>
95 #ifndef _WIN32_WCE
96 #include <fcntl.h>
97 #else
98 #define _O_RDONLY 0x0000
99 #define O_RDONLY _O_RDONLY
100 #endif
101 
102 typedef int uid_t;
103 typedef int gid_t;
104 typedef unsigned short sa_family_t;
105 #if !defined(LWS_HAVE_SUSECONDS_T)
106 typedef unsigned int useconds_t;
107 typedef int suseconds_t;
108 #endif
109 
110 #define LWS_INLINE __inline
111 #define LWS_VISIBLE
112 #define LWS_WARN_UNUSED_RESULT
113 #define LWS_WARN_DEPRECATED
114 #define LWS_FORMAT(string_index)
115 
116 #if !defined(LWS_EXTERN) && defined(LWS_BUILDING_SHARED)
117 #ifdef LWS_DLL
118 #ifdef LWS_INTERNAL
119 #define LWS_EXTERN extern __declspec(dllexport)
120 #else
121 #define LWS_EXTERN extern __declspec(dllimport)
122 #endif
123 #endif
124 #endif
125 
126 #if !defined(LWS_INTERNAL) && !defined(LWS_EXTERN)
127 #define LWS_EXTERN
128 #define LWS_VISIBLE
129 #endif
130 
131 #if !defined(LWS_EXTERN)
132 #define LWS_EXTERN
133 #endif
134 
135 #define LWS_INVALID_FILE INVALID_HANDLE_VALUE
136 #define LWS_SOCK_INVALID (INVALID_SOCKET)
137 #define LWS_O_RDONLY _O_RDONLY
138 #define LWS_O_WRONLY _O_WRONLY
139 #define LWS_O_CREAT _O_CREAT
140 #define LWS_O_TRUNC _O_TRUNC
141 
142 #ifndef __func__
143 #define __func__ __FUNCTION__
144 #endif
145 
146 #else /* NOT WIN32 */
147 #include <unistd.h>
148 
149 #if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
150 #include <sys/capability.h>
151 #endif
152 
153 #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__QNX__) || defined(__OpenBSD__)
154 #include <sys/socket.h>
155 #include <netinet/in.h>
156 #endif
157 
158 #define LWS_INLINE inline
159 #define LWS_O_RDONLY O_RDONLY
160 #define LWS_O_WRONLY O_WRONLY
161 #define LWS_O_CREAT O_CREAT
162 #define LWS_O_TRUNC O_TRUNC
163 
164 #if !defined(LWS_PLAT_OPTEE) && !defined(OPTEE_TA) && !defined(LWS_PLAT_FREERTOS) && !defined(LWS_PLAT_BAREMETAL)
165 #include <poll.h>
166 #include <netdb.h>
167 #define LWS_INVALID_FILE -1
168 #define LWS_SOCK_INVALID (-1)
169 #else
170 #define getdtablesize() (30)
171 #if defined(LWS_PLAT_FREERTOS)
172 #define LWS_INVALID_FILE NULL
173 #define LWS_SOCK_INVALID (-1)
174 #else
175 #define LWS_INVALID_FILE NULL
176 #define LWS_SOCK_INVALID (-1)
177 #endif
178 #endif
179 
180 #if defined(__FreeBSD__)
181 #include <sys/signal.h>
182 #endif
183 #if defined(__GNUC__)
184 
185 /* warn_unused_result attribute only supported by GCC 3.4 or later */
186 #if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
187 #define LWS_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
188 #else
189 #define LWS_WARN_UNUSED_RESULT
190 #endif
191 
192 #if defined(LWS_BUILDING_SHARED)
193 /* this is only set when we're building lws itself shared */
194 #define LWS_VISIBLE __attribute__((visibility("default")))
195 #define LWS_EXTERN extern
196 
197 #else /* not shared */
198 #if defined(WIN32) || defined(_WIN32) || defined(__MINGW32__)
199 #define LWS_VISIBLE
200 #define LWS_EXTERN extern
201 #else
202 /*
203  * If we explicitly say hidden here, symbols exist as T but
204  * cannot be imported at link-time.
205  */
206 #define LWS_VISIBLE
207 #define LWS_EXTERN
208 #endif
209 
210 #endif /* not shared */
211 
212 #define LWS_WARN_DEPRECATED __attribute__ ((deprecated))
213 #undef printf
214 #define LWS_FORMAT(string_index) __attribute__ ((format(printf, string_index, string_index+1)))
215 #else /* not GNUC */
216 
217 #define LWS_VISIBLE
218 #define LWS_WARN_UNUSED_RESULT
219 #define LWS_WARN_DEPRECATED
220 #define LWS_FORMAT(string_index)
221 #if !defined(LWS_EXTERN)
222 #define LWS_EXTERN extern
223 #endif
224 #endif
225 
226 
227 #if defined(__ANDROID__)
228 #include <netinet/in.h>
229 #include <unistd.h>
230 #endif
231 #endif
232 
233 #ifdef _WIN32
234 #define random rand
235 #else
236 #if !defined(LWS_PLAT_OPTEE)
237 #include <sys/time.h>
238 #include <unistd.h>
239 #endif
240 #endif
241 
242 #if defined(LWS_WITH_LIBUV_INTERNAL)
243 #include <uv.h>
244 
245 #ifdef LWS_HAVE_UV_VERSION_H
246 #include <uv-version.h>
247 #endif
248 
249 #ifdef LWS_HAVE_NEW_UV_VERSION_H
250 #include <uv/version.h>
251 #endif
252 #endif
253 
254 #if defined(LWS_WITH_TLS)
255 
256 #ifdef USE_WOLFSSL
257 #ifdef USE_OLD_CYASSL
258 #ifdef _WIN32
259 /*
260  * Include user-controlled settings for windows from
261  * <wolfssl-root>/IDE/WIN/user_settings.h
262  */
263 #include <IDE/WIN/user_settings.h>
264 #include <cyassl/ctaocrypt/settings.h>
265 #else
266 #include <cyassl/options.h>
267 #endif
268 #include <cyassl/openssl/ssl.h>
269 #include <cyassl/error-ssl.h>
270 
271 #else
272 #ifdef _WIN32
273 /*
274  * Include user-controlled settings for windows from
275  * <wolfssl-root>/IDE/WIN/user_settings.h
276  */
277 #include <IDE/WIN/user_settings.h>
278 #include <wolfssl/wolfcrypt/settings.h>
279 #else
280 #include <wolfssl/options.h>
281 #endif
282 #include <wolfssl/openssl/ssl.h>
283 #include <wolfssl/error-ssl.h>
284 #endif /* not USE_OLD_CYASSL */
285 #else
286 #if defined(LWS_WITH_MBEDTLS)
287 #if defined(LWS_PLAT_FREERTOS)
288 /* this filepath is passed to us but without quotes or <> */
289 #if !defined(LWS_AMAZON_RTOS)
290 /* AMAZON RTOS has its own setting via MTK_MBEDTLS_CONFIG_FILE */
291 #undef MBEDTLS_CONFIG_FILE
292 #define MBEDTLS_CONFIG_FILE <mbedtls/esp_config.h>
293 #endif
294 #endif
295 #if defined(LWS_WITH_TLS)
296 #include <mbedtls/ssl.h>
297 #include <mbedtls/entropy.h>
298 #include <mbedtls/ctr_drbg.h>
299 #include <mbedtls/version.h>
300 
301 #if !defined(MBEDTLS_PRIVATE)
302 #define MBEDTLS_PRIVATE(_q) _q
303 #endif
304 
305 #if (MBEDTLS_VERSION_MAJOR == 3) && (MBEDTLS_VERSION_MINOR == 0)
306 #define MBEDTLS_PRIVATE_V30_ONLY(_q) MBEDTLS_PRIVATE(_q)
307 #else
308 #define MBEDTLS_PRIVATE_V30_ONLY(_q) _q
309 #endif
310 
311 #endif
312 #else
313 #include <openssl/ssl.h>
314 #if !defined(LWS_WITH_MBEDTLS)
315 #include <openssl/err.h>
316 #endif
317 #endif
318 #endif /* not USE_WOLFSSL */
319 #endif
320 
321 /*
322  * Helpers for pthread mutex in user code... if lws is built for
323  * multiple service threads, these resolve to pthread mutex
324  * operations. In the case LWS_MAX_SMP is 1 (the default), they
325  * are all NOPs and no pthread type or api is referenced.
326  */
327 
328 #if LWS_MAX_SMP > 1
329 
330 #include <pthread.h>
331 
332 #define lws_pthread_mutex(name) pthread_mutex_t name;
333 
334 static LWS_INLINE void
335 lws_pthread_mutex_init(pthread_mutex_t *lock)
336 {
337  pthread_mutex_init(lock, NULL);
338 }
339 
340 static LWS_INLINE void
341 lws_pthread_mutex_destroy(pthread_mutex_t *lock)
342 {
343  pthread_mutex_destroy(lock);
344 }
345 
346 static LWS_INLINE void
347 lws_pthread_mutex_lock(pthread_mutex_t *lock)
348 {
349  pthread_mutex_lock(lock);
350 }
351 
352 static LWS_INLINE void
353 lws_pthread_mutex_unlock(pthread_mutex_t *lock)
354 {
355  pthread_mutex_unlock(lock);
356 }
357 
358 #else
359 #define lws_pthread_mutex(name)
360 #define lws_pthread_mutex_init(_a)
361 #define lws_pthread_mutex_destroy(_a)
362 #define lws_pthread_mutex_lock(_a)
363 #define lws_pthread_mutex_unlock(_a)
364 #endif
365 
366 
367 #define CONTEXT_PORT_NO_LISTEN -1
368 #define CONTEXT_PORT_NO_LISTEN_SERVER -2
369 
370 #include <libwebsockets/lws-logs.h>
371 
372 
373 #include <stddef.h>
374 
375 #ifndef lws_container_of
376 #define lws_container_of(P,T,M) ((T *)((char *)(P) - offsetof(T, M)))
377 #endif
378 #define LWS_ALIGN_TO(x, bou) x += ((bou) - ((x) % (bou))) % (bou)
379 
380 struct lws;
381 
382 /* api change list for user code to test against */
383 
384 #define LWS_FEATURE_SERVE_HTTP_FILE_HAS_OTHER_HEADERS_ARG
385 
386 /* the struct lws_protocols has the id field present */
387 #define LWS_FEATURE_PROTOCOLS_HAS_ID_FIELD
388 
389 /* you can call lws_get_peer_write_allowance */
390 #define LWS_FEATURE_PROTOCOLS_HAS_PEER_WRITE_ALLOWANCE
391 
392 /* extra parameter introduced in 917f43ab821 */
393 #define LWS_FEATURE_SERVE_HTTP_FILE_HAS_OTHER_HEADERS_LEN
394 
395 /* File operations stuff exists */
396 #define LWS_FEATURE_FOPS
397 
398 /* Mounts have extra no_cache member */
399 #define LWS_FEATURE_MOUNT_NO_CACHE
400 
401 
402 #if defined(_WIN32)
403 #if !defined(LWS_WIN32_HANDLE_TYPES)
404 typedef SOCKET lws_sockfd_type;
405 #if defined(__MINGW32__)
406 typedef int lws_filefd_type;
407 #else
408 typedef HANDLE lws_filefd_type;
409 #endif
410 #endif
411 
412 
413 #define lws_pollfd pollfd
414 #define LWS_POLLHUP (POLLHUP)
415 #define LWS_POLLIN (POLLRDNORM | POLLRDBAND)
416 #define LWS_POLLOUT (POLLWRNORM)
417 
418 #else
419 
420 
421 #if defined(LWS_PLAT_FREERTOS)
422 #include <libwebsockets/lws-freertos.h>
423 #else
424 typedef int lws_sockfd_type;
425 typedef int lws_filefd_type;
426 #endif
427 
428 #if defined(LWS_PLAT_OPTEE)
429 #include <time.h>
430 struct timeval {
431  time_t tv_sec;
432  unsigned int tv_usec;
433 };
434 #if defined(LWS_WITH_NETWORK)
435 // #include <poll.h>
436 #define lws_pollfd pollfd
437 
438 struct timezone;
439 
440 int gettimeofday(struct timeval *tv, struct timezone *tz);
441 
442  /* Internet address. */
443  struct in_addr {
444  uint32_t s_addr; /* address in network byte order */
445  };
446 
447 typedef unsigned short sa_family_t;
448 typedef unsigned short in_port_t;
449 typedef uint32_t socklen_t;
450 
451 #include <libwebsockets/lws-optee.h>
452 
453 #if !defined(TEE_SE_READER_NAME_MAX)
454  struct addrinfo {
455  int ai_flags;
456  int ai_family;
457  int ai_socktype;
458  int ai_protocol;
459  socklen_t ai_addrlen;
460  struct sockaddr *ai_addr;
461  char *ai_canonname;
462  struct addrinfo *ai_next;
463  };
464 #endif
465 
466 ssize_t recv(int sockfd, void *buf, size_t len, int flags);
467 ssize_t send(int sockfd, const void *buf, size_t len, int flags);
468 ssize_t read(int fd, void *buf, size_t count);
469 int getsockopt(int sockfd, int level, int optname,
470  void *optval, socklen_t *optlen);
471  int setsockopt(int sockfd, int level, int optname,
472  const void *optval, socklen_t optlen);
473 int connect(int sockfd, const struct sockaddr *addr,
474  socklen_t addrlen);
475 
476 extern int errno;
477 
478 uint16_t ntohs(uint16_t netshort);
479 uint16_t htons(uint16_t hostshort);
480 
481 int bind(int sockfd, const struct sockaddr *addr,
482  socklen_t addrlen);
483 
484 
485 #define MSG_NOSIGNAL 0x4000
486 #define EAGAIN 11
487 #define EINTR 4
488 #define EWOULDBLOCK EAGAIN
489 #define EADDRINUSE 98
490 #define INADDR_ANY 0
491 #define AF_INET 2
492 #define SHUT_WR 1
493 #define AF_UNSPEC 0
494 #define PF_UNSPEC 0
495 #define SOCK_STREAM 1
496 #define SOCK_DGRAM 2
497 # define AI_PASSIVE 0x0001
498 #define IPPROTO_UDP 17
499 #define SOL_SOCKET 1
500 #define SO_SNDBUF 7
501 #define EISCONN 106
502 #define EALREADY 114
503 #define EINPROGRESS 115
504 int shutdown(int sockfd, int how);
505 int close(int fd);
506 int atoi(const char *nptr);
507 long long atoll(const char *nptr);
508 
509 int socket(int domain, int type, int protocol);
510  int getaddrinfo(const char *node, const char *service,
511  const struct addrinfo *hints,
512  struct addrinfo **res);
513 
514  void freeaddrinfo(struct addrinfo *res);
515 
516 #if !defined(TEE_SE_READER_NAME_MAX)
517 struct lws_pollfd
518 {
519  int fd; /* File descriptor to poll. */
520  short int events; /* Types of events poller cares about. */
521  short int revents; /* Types of events that actually occurred. */
522 };
523 #endif
524 
525 int poll(struct pollfd *fds, int nfds, int timeout);
526 
527 #define LWS_POLLHUP (0x18)
528 #define LWS_POLLIN (1)
529 #define LWS_POLLOUT (4)
530 #else
531 struct lws_pollfd;
532 struct sockaddr_in;
533 #endif
534 #else
535 #define lws_pollfd pollfd
536 #define LWS_POLLHUP (POLLHUP | POLLERR)
537 #define LWS_POLLIN (POLLIN)
538 #define LWS_POLLOUT (POLLOUT)
539 #endif
540 #endif
541 
542 
543 #if (defined(WIN32) || defined(_WIN32)) && !defined(__MINGW32__)
544 /* ... */
545 #define ssize_t SSIZE_T
546 #endif
547 
548 #if defined(WIN32) && defined(LWS_HAVE__STAT32I64)
549 #include <sys/types.h>
550 #include <sys/stat.h>
551 #endif
552 
553 #if defined(LWS_HAVE_STDINT_H)
554 #include <stdint.h>
555 #else
556 #if defined(WIN32) || defined(_WIN32)
557 /* !!! >:-[ */
558 typedef __int64 int64_t;
559 typedef unsigned __int64 uint64_t;
560 typedef __int32 int32_t;
561 typedef unsigned __int32 uint32_t;
562 typedef __int16 int16_t;
563 typedef unsigned __int16 uint16_t;
564 typedef unsigned __int8 uint8_t;
565 #else
566 typedef unsigned int uint32_t;
567 typedef unsigned short uint16_t;
568 typedef unsigned char uint8_t;
569 #endif
570 #endif
571 
572 typedef int64_t lws_usec_t;
573 typedef unsigned long long lws_filepos_t;
574 typedef long long lws_fileofs_t;
575 typedef uint32_t lws_fop_flags_t;
576 
577 #define lws_concat_temp(_t, _l) (_t + sizeof(_t) - _l)
578 #define lws_concat_used(_t, _l) (sizeof(_t) - _l)
579 
580 /** struct lws_pollargs - argument structure for all external poll related calls
581  * passed in via 'in' */
582 struct lws_pollargs {
583  lws_sockfd_type fd; /**< applicable socket descriptor */
584  int events; /**< the new event mask */
585  int prev_events; /**< the previous event mask */
586 };
587 
588 #if !defined(LWS_SIZEOFPTR)
589 #define LWS_SIZEOFPTR ((int)sizeof (void *))
590 #endif
591 
592 #if defined(__x86_64__)
593 #define _LWS_PAD_SIZE 16 /* Intel recommended for best performance */
594 #else
595 #define _LWS_PAD_SIZE LWS_SIZEOFPTR /* Size of a pointer on the target arch */
596 #endif
597 #define _LWS_PAD(n) (((n) % _LWS_PAD_SIZE) ?
598  ((n) + (_LWS_PAD_SIZE - ((n) % _LWS_PAD_SIZE))) : (n))
599 /* last 2 is for lws-meta */
600 #define LWS_PRE _LWS_PAD(4 + 10 + 2)
601 /* used prior to 1.7 and retained for backward compatibility */
602 #define LWS_SEND_BUFFER_PRE_PADDING LWS_PRE
603 #define LWS_SEND_BUFFER_POST_PADDING 0
604 
605 
606 
607 struct lws_extension; /* needed even with ws exts disabled for create context */
608 struct lws_token_limits;
609 struct lws_protocols;
610 struct lws_context;
611 struct lws_tokens;
612 struct lws_vhost;
613 struct lws;
614 
615 /* Generic stateful operation return codes */
616 
617 typedef enum {
619  LWS_SRET_WANT_INPUT = (1 << 16),
620  LWS_SRET_WANT_OUTPUT = (1 << 17),
621  LWS_SRET_FATAL = (1 << 18),
624  LWS_SRET_AWAIT_RETRY = (1 << 21),
625  LWS_SRET_YIELD = (1 << 22), /* return to the event loop and continue */
626 } lws_stateful_ret_t;
627 
628 typedef struct lws_fixed3232 {
629  int32_t whole; /* signed 32-bit int */
630  int32_t frac; /* signed frac proportion from 0 to (100M - 1) */
631 } lws_fx_t;
632 
633 #define LWS_FX_FRACTION_MSD 100000000
634 #define lws_neg(a) (a->whole < 0 || a->frac < 0)
635 #define lws_fx_set(a, x, y) { a.whole = x; a.frac = x < 0 ? -y : y; }
636 #define lws_fix64(a) (((int64_t)a->whole << 32) +
637  (((1ll << 32) * (a->frac < 0 ? -a->frac : a->frac)) / LWS_FX_FRACTION_MSD))
638 #define lws_fix64_abs(a)
639  ((((int64_t)(a->whole < 0 ? (-a->whole) : a->whole) << 32) +
640  (((1ll << 32) * (a->frac < 0 ? -a->frac : a->frac)) / LWS_FX_FRACTION_MSD)))
641 
642 #define lws_fix3232(a, a64) { a->whole = (int32_t)(a64 >> 32);
643  a->frac = (int32_t)((100000000 * (a64 & 0xffffffff)) >> 32); }
644 
645 LWS_VISIBLE LWS_EXTERN const lws_fx_t *
646 lws_fx_add(lws_fx_t *r, const lws_fx_t *a, const lws_fx_t *b);
647 
648 LWS_VISIBLE LWS_EXTERN const lws_fx_t *
649 lws_fx_sub(lws_fx_t *r, const lws_fx_t *a, const lws_fx_t *b);
650 
651 LWS_VISIBLE LWS_EXTERN const lws_fx_t *
652 lws_fx_mul(lws_fx_t *r, const lws_fx_t *a, const lws_fx_t *b);
653 
654 LWS_VISIBLE LWS_EXTERN const lws_fx_t *
655 lws_fx_div(lws_fx_t *r, const lws_fx_t *a, const lws_fx_t *b);
656 
657 LWS_VISIBLE LWS_EXTERN const lws_fx_t *
658 lws_fx_sqrt(lws_fx_t *r, const lws_fx_t *a);
659 
661 lws_fx_comp(const lws_fx_t *a, const lws_fx_t *b);
662 
664 lws_fx_roundup(const lws_fx_t *a);
665 
667 lws_fx_rounddown(const lws_fx_t *a);
668 
669 LWS_VISIBLE LWS_EXTERN const char *
670 lws_fx_string(const lws_fx_t *a, char *buf, size_t size);
671 
672 #include <libwebsockets/lws-dll2.h>
673 #include <libwebsockets/lws-map.h>
674 
675 #include <libwebsockets/lws-fault-injection.h>
676 #include <libwebsockets/lws-backtrace.h>
677 #include <libwebsockets/lws-timeout-timer.h>
678 #include <libwebsockets/lws-cache-ttl.h>
679 #if defined(LWS_WITH_SYS_SMD)
680 #include <libwebsockets/lws-smd.h>
681 #endif
682 #include <libwebsockets/lws-state.h>
683 #include <libwebsockets/lws-retry.h>
684 #if defined(LWS_WITH_NETWORK)
685 #include <libwebsockets/lws-adopt.h>
686 #include <libwebsockets/lws-network-helper.h>
687 #include <libwebsockets/lws-metrics.h>
688 #endif
689 
690 #include <libwebsockets/lws-ota.h>
691 #include <libwebsockets/lws-system.h>
692 #if defined(LWS_WITH_NETWORK)
693 #include <libwebsockets/lws-ws-close.h>
694 #include <libwebsockets/lws-callbacks.h>
695 #include <libwebsockets/lws-ws-state.h>
696 #include <libwebsockets/lws-ws-ext.h>
697 #include <libwebsockets/lws-protocols-plugins.h>
698 #endif
699 #include <libwebsockets/lws-context-vhost.h>
700 
701 #if defined(LWS_WITH_NETWORK)
702 #if defined(LWS_WITH_CONMON)
703 #include <libwebsockets/lws-conmon.h>
704 #endif
705 
706 #if defined(LWS_ROLE_MQTT)
707 #include <libwebsockets/lws-mqtt.h>
708 #endif
709 #include <libwebsockets/lws-client.h>
710 #include <libwebsockets/lws-http.h>
711 #include <libwebsockets/lws-spa.h>
712 #endif
713 #include <libwebsockets/lws-purify.h>
714 #include <libwebsockets/lws-misc.h>
715 #include <libwebsockets/lws-dsh.h>
716 #if defined(LWS_WITH_NETWORK)
717 #include <libwebsockets/lws-service.h>
718 #include <libwebsockets/lws-write.h>
719 #include <libwebsockets/lws-writeable.h>
720 #endif
721 #include <libwebsockets/lws-ring.h>
722 #include <libwebsockets/lws-sha1-base64.h>
723 #include <libwebsockets/lws-x509.h>
724 #if defined(LWS_WITH_NETWORK)
725 #include <libwebsockets/lws-cgi.h>
726 #endif
727 #if defined(LWS_WITH_FILE_OPS)
728 #include <libwebsockets/lws-vfs.h>
729 #endif
730 #include <libwebsockets/lws-gencrypto.h>
731 
732 #include <libwebsockets/lws-lejp.h>
733 #include <libwebsockets/lws-lecp.h>
734 #include <libwebsockets/lws-cose.h>
735 #include <libwebsockets/lws-struct.h>
736 #include <libwebsockets/lws-threadpool.h>
737 #include <libwebsockets/lws-tokenize.h>
738 #include <libwebsockets/lws-lwsac.h>
739 #include <libwebsockets/lws-fts.h>
740 #include <libwebsockets/lws-diskcache.h>
741 #include <libwebsockets/lws-secure-streams.h>
742 #include <libwebsockets/lws-secure-streams-serialization.h>
743 #include <libwebsockets/lws-secure-streams-policy.h>
744 #include <libwebsockets/lws-secure-streams-client.h>
745 #include <libwebsockets/lws-secure-streams-transport-proxy.h>
746 #include <libwebsockets/lws-jrpc.h>
747 
748 #include <libwebsockets/lws-async-dns.h>
749 
750 #if defined(LWS_WITH_TLS)
751 
752 #include <libwebsockets/lws-tls-sessions.h>
753 
754 #if defined(LWS_WITH_MBEDTLS)
755 #include <mbedtls/md5.h>
756 #include <mbedtls/sha1.h>
757 #include <mbedtls/sha256.h>
758 #include <mbedtls/sha512.h>
759 #endif
760 
761 #include <libwebsockets/lws-genhash.h>
762 #include <libwebsockets/lws-genrsa.h>
763 #include <libwebsockets/lws-genaes.h>
764 #include <libwebsockets/lws-genec.h>
765 
766 #include <libwebsockets/lws-jwk.h>
767 #include <libwebsockets/lws-jose.h>
768 #include <libwebsockets/lws-jws.h>
769 #include <libwebsockets/lws-jwe.h>
770 
771 #endif
772 
773 #if defined(LWS_WITH_NETWORK)
774 #include <libwebsockets/lws-eventlib-exports.h>
775 #endif
776 #include <libwebsockets/lws-i2c.h>
777 #include <libwebsockets/lws-spi.h>
778 #if defined(LWS_ESP_PLATFORM)
779 #include <libwebsockets/lws-esp32-spi.h>
780 #endif
781 #include <libwebsockets/lws-gpio.h>
782 #include <libwebsockets/lws-bb-i2c.h>
783 #include <libwebsockets/lws-bb-spi.h>
784 #include <libwebsockets/lws-button.h>
785 #include <libwebsockets/lws-led.h>
786 #include <libwebsockets/lws-pwm.h>
787 #include <libwebsockets/lws-upng.h>
788 #include <libwebsockets/lws-jpeg.h>
789 #include <libwebsockets/lws-display.h>
790 #include <libwebsockets/lws-dlo.h>
791 #include <libwebsockets/lws-ssd1306-i2c.h>
792 #include <libwebsockets/lws-ili9341-spi.h>
793 #include <libwebsockets/lws-spd1656-spi.h>
794 #include <libwebsockets/lws-uc8176-spi.h>
795 #include <libwebsockets/lws-ssd1675b-spi.h>
796 #include <libwebsockets/lws-settings.h>
797 #if defined(LWS_WITH_NETWORK)
798 #include <libwebsockets/lws-netdev.h>
799 #endif
800 
801 #ifdef __cplusplus
802 }
803 #endif
804 
805 #endif