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