• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  *  This is included from private-lib-core.h
25  */
26 
27 enum lws_event_lib_ops_flags {
28 	LELOF_ISPOLL				= (1 >> 0),
29 	LELOF_DESTROY_FINAL			= (1 >> 1),
30 };
31 
32 struct lws_event_loop_ops {
33 	const char *name;
34 	/* event loop-specific context init during context creation */
35 	int (*init_context)(struct lws_context *context,
36 			    const struct lws_context_creation_info *info);
37 	/* called during lws_destroy_context */
38 	int (*destroy_context1)(struct lws_context *context);
39 	/* called during lws_destroy_context2 */
40 	int (*destroy_context2)(struct lws_context *context);
41 	/* init vhost listening wsi */
42 	int (*init_vhost_listen_wsi)(struct lws *wsi);
43 	/* init the event loop for a pt */
44 	int (*init_pt)(struct lws_context *context, void *_loop, int tsi);
45 	/* called at end of first phase of close_free_wsi()  */
46 	int (*wsi_logical_close)(struct lws *wsi);
47 	/* return nonzero if client connect not allowed  */
48 	int (*check_client_connect_ok)(struct lws *wsi);
49 	/* close handle manually  */
50 	void (*close_handle_manually)(struct lws *wsi);
51 	/* event loop accept processing  */
52 	int (*sock_accept)(struct lws *wsi);
53 	/* control wsi active events  */
54 	void (*io)(struct lws *wsi, int flags);
55 	/* run the event loop for a pt */
56 	void (*run_pt)(struct lws_context *context, int tsi);
57 	/* called before pt is destroyed */
58 	void (*destroy_pt)(struct lws_context *context, int tsi);
59 	/* called just before wsi is freed  */
60 	void (*destroy_wsi)(struct lws *wsi);
61 
62 	uint8_t	flags;
63 };
64 
65 /* bring in event libs private declarations */
66 
67 #if defined(LWS_WITH_POLL)
68 #include "private-lib-event-libs-poll.h"
69 #endif
70 
71 #if defined(LWS_WITH_LIBUV)
72 #include "private-lib-event-libs-libuv.h"
73 #endif
74 
75 #if defined(LWS_WITH_LIBEVENT)
76 #include "private-lib-event-libs-libevent.h"
77 #endif
78 
79 #if defined(LWS_WITH_GLIB)
80 #include "private-lib-event-libs-glib.h"
81 #endif
82 
83 #if defined(LWS_WITH_LIBEV)
84 #include "private-lib-event-libs-libev.h"
85 #endif
86 
87