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