private-lib-event-libs.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * libwebsockets - small server side websockets and web server implementation
  3. *
  4. * Copyright (C) 2010 - 2019 Andy Green <[email protected]>
  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. enum lws_event_lib_ops_flags {
  27. LELOF_ISPOLL = (1 >> 0),
  28. LELOF_DESTROY_FINAL = (1 >> 1),
  29. };
  30. struct lws_event_loop_ops {
  31. const char *name;
  32. /* event loop-specific context init during context creation */
  33. int (*init_context)(struct lws_context *context,
  34. const struct lws_context_creation_info *info);
  35. /* called during lws_destroy_context */
  36. int (*destroy_context1)(struct lws_context *context);
  37. /* called during lws_destroy_context2 */
  38. int (*destroy_context2)(struct lws_context *context);
  39. /* init vhost listening wsi */
  40. int (*init_vhost_listen_wsi)(struct lws *wsi);
  41. /* init the event loop for a pt */
  42. int (*init_pt)(struct lws_context *context, void *_loop, int tsi);
  43. /* called at end of first phase of close_free_wsi() */
  44. int (*wsi_logical_close)(struct lws *wsi);
  45. /* return nonzero if client connect not allowed */
  46. int (*check_client_connect_ok)(struct lws *wsi);
  47. /* close handle manually */
  48. void (*close_handle_manually)(struct lws *wsi);
  49. /* event loop accept processing */
  50. int (*sock_accept)(struct lws *wsi);
  51. /* control wsi active events */
  52. void (*io)(struct lws *wsi, int flags);
  53. /* run the event loop for a pt */
  54. void (*run_pt)(struct lws_context *context, int tsi);
  55. /* called before pt is destroyed */
  56. void (*destroy_pt)(struct lws_context *context, int tsi);
  57. /* called just before wsi is freed */
  58. void (*destroy_wsi)(struct lws *wsi);
  59. uint8_t flags;
  60. uint16_t evlib_size_ctx;
  61. uint16_t evlib_size_pt;
  62. uint16_t evlib_size_vh;
  63. uint16_t evlib_size_wsi;
  64. };