Fix License in spec
[platform/upstream/libwebsockets.git] / lib / plat / esp32 / private-lib-plat-esp32.h
1 /*
2  * libwebsockets - small server side websockets and web server implementation
3  *
4  * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
5  *
6  *  This library is free software; you can redistribute it and/or
7  *  modify it under the terms of the GNU Lesser General Public
8  *  License as published by the Free Software Foundation:
9  *  version 2.1 of the License.
10  *
11  *  This library is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  *  Lesser General Public License for more details.
15  *
16  *  You should have received a copy of the GNU Lesser General Public
17  *  License along with this library; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  *  MA  02110-1301  USA
20  *
21  * Included from lib/private-lib-core.h if LWS_WITH_ESP32
22  */
23
24 #define MSG_NOSIGNAL 0
25 #define SOMAXCONN 3
26
27 #if defined(LWS_AMAZON_RTOS)
28  int
29  open(const char *path, int oflag, ...);
30 #else
31  #include <fcntl.h>
32 #endif
33
34  #include <strings.h>
35  #include <unistd.h>
36  #include <sys/stat.h>
37  #include <sys/types.h>
38  #include <sys/time.h>
39  #include <netdb.h>
40
41  #ifndef __cplusplus
42   #include <errno.h>
43  #endif
44  #include <netdb.h>
45  #include <signal.h>
46 #if defined(LWS_AMAZON_RTOS)
47 const char *
48 gai_strerror(int);
49 #else
50  #include <sys/socket.h>
51 #endif
52
53 #if defined(LWS_AMAZON_RTOS)
54  #include "FreeRTOS.h"
55  #include "timers.h"
56  #include <esp_attr.h>
57 #else
58  #include "freertos/timers.h"
59  #include <esp_attr.h>
60  #include <esp_system.h>
61  #include <esp_task_wdt.h>
62 #endif
63
64 #include "lwip/apps/sntp.h"
65
66 #include <lwip/sockets.h>
67
68  #if defined(LWS_BUILTIN_GETIFADDRS)
69   #include "./misc/getifaddrs.h"
70  #endif
71
72  #define LWS_ERRNO errno
73  #define LWS_EAGAIN EAGAIN
74  #define LWS_EALREADY EALREADY
75  #define LWS_EINPROGRESS EINPROGRESS
76  #define LWS_EINTR EINTR
77  #define LWS_EISCONN EISCONN
78  #define LWS_ENOTCONN ENOTCONN
79  #define LWS_EWOULDBLOCK EWOULDBLOCK
80  #define LWS_EADDRINUSE EADDRINUSE
81
82  #define lws_set_blocking_send(wsi)
83
84  #ifndef LWS_NO_FORK
85   #ifdef LWS_HAVE_SYS_PRCTL_H
86    #include <sys/prctl.h>
87   #endif
88  #endif
89
90 #define compatible_close(x) close(x)
91 #define lws_plat_socket_offset() LWIP_SOCKET_OFFSET
92 #define wsi_from_fd(A,B)  A->lws_lookup[B - lws_plat_socket_offset()]
93
94 struct lws_context;
95 struct lws;
96
97 int
98 insert_wsi(const struct lws_context *context, struct lws *wsi);
99
100 #define delete_from_fd(A,B) A->lws_lookup[B - lws_plat_socket_offset()] = 0
101