1 /* 2 * libwebsockets - small server side websockets and web server implementation 3 * 4 * Copyright (C) 2010 - 2021 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, unsigned 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 uint16_t evlib_size_ctx; 65 uint16_t evlib_size_pt; 66 uint16_t evlib_size_vh; 67 uint16_t evlib_size_wsi; 68 }; 69