1 /* 2 * libwebsockets - small server side websockets and web server implementation 3 * 4 * Copyright (C) 2010 - 2020 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 * These are exports needed by event lib plugins. 25 * 26 * You should consider these opaque for normal user code. 27 */ 28 29 LWS_VISIBLE LWS_EXTERN void * 30 lws_realloc(void *ptr, size_t size, const char *reason); 31 32 LWS_VISIBLE LWS_EXTERN void 33 lws_vhost_destroy1(struct lws_vhost *vh); 34 35 LWS_VISIBLE LWS_EXTERN void 36 lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason, 37 const char *caller); 38 39 struct lws_context_per_thread; 40 LWS_VISIBLE LWS_EXTERN void 41 lws_service_do_ripe_rxflow(struct lws_context_per_thread *pt); 42 43 #if !defined(wsi_from_fd) && !defined(WIN32) && !defined(_WIN32) 44 struct lws_context; 45 LWS_VISIBLE LWS_EXTERN struct lws * 46 wsi_from_fd(const struct lws_context *context, int fd); 47 #endif 48 49 LWS_VISIBLE LWS_EXTERN int 50 _lws_plat_service_forced_tsi(struct lws_context *context, int tsi); 51 52 LWS_VISIBLE LWS_EXTERN void 53 lws_context_destroy2(struct lws_context *context); 54 55 LWS_VISIBLE LWS_EXTERN void 56 lws_destroy_event_pipe(struct lws *wsi); 57 58 LWS_VISIBLE LWS_EXTERN void 59 __lws_close_free_wsi_final(struct lws *wsi); 60 61 #if LWS_MAX_SMP > 1 62 63 struct lws_mutex_refcount { 64 pthread_mutex_t lock; 65 pthread_t lock_owner; 66 const char *last_lock_reason; 67 char lock_depth; 68 char metadata; 69 }; 70 71 LWS_VISIBLE LWS_EXTERN void 72 lws_mutex_refcount_assert_held(struct lws_mutex_refcount *mr); 73 74 LWS_VISIBLE LWS_EXTERN void 75 lws_mutex_refcount_init(struct lws_mutex_refcount *mr); 76 77 LWS_VISIBLE LWS_EXTERN void 78 lws_mutex_refcount_destroy(struct lws_mutex_refcount *mr); 79 80 LWS_VISIBLE LWS_EXTERN void 81 lws_mutex_refcount_lock(struct lws_mutex_refcount *mr, const char *reason); 82 83 LWS_VISIBLE LWS_EXTERN void 84 lws_mutex_refcount_unlock(struct lws_mutex_refcount *mr); 85 86 #endif 87