Imported Upstream version 3.2
[platform/upstream/libwebsockets.git] / lib / plat / esp32 / esp32-fds.c
1 /*
2  * libwebsockets - lib/plat/lws-plat-esp32.c
3  *
4  * Copyright (C) 2010-2017 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
22 #include "core/private.h"
23
24 void
25 lws_plat_insert_socket_into_fds(struct lws_context *context, struct lws *wsi)
26 {
27         struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
28
29         pt->fds[pt->fds_count++].revents = 0;
30 }
31
32 void
33 lws_plat_delete_socket_from_fds(struct lws_context *context,
34                                                 struct lws *wsi, int m)
35 {
36         struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
37
38         pt->fds_count--;
39 }
40
41 int
42 lws_plat_change_pollfd(struct lws_context *context,
43                       struct lws *wsi, struct lws_pollfd *pfd)
44 {
45         return 0;
46 }
47
48 int
49 insert_wsi(const struct lws_context *context, struct lws *wsi)
50 {
51     assert(context->lws_lookup[wsi->desc.sockfd -
52                                lws_plat_socket_offset()] == 0);
53
54     context->lws_lookup[wsi->desc.sockfd - \
55                       lws_plat_socket_offset()] = wsi;
56
57     return 0;
58 }