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