libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws-service.h
Go to the documentation of this file.
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
33
67lws_service(struct lws_context *context, int timeout_ms);
68
80lws_service_tsi(struct lws_context *context, int timeout_ms, int tsi);
81
91lws_cancel_service_pt(struct lws *wsi);
92
106lws_cancel_service(struct lws_context *context);
107
126lws_service_wake_fd(struct lws_context *context, int tsi);
127
145lws_service_work_outstanding(struct lws_context *context);
146
174lws_service_fd(struct lws_context *context, struct lws_pollfd *pollfd);
175
186lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd,
187 int tsi);
188
207lws_service_adjust_timeout(struct lws_context *context, int timeout_ms, int tsi);
208
234lws_service_set_now(struct lws_context *context, int tsi, lws_usec_t now_us,
235 time_t now_wall);
236
237/* Backwards compatibility */
238#define lws_plat_service_tsi lws_service_tsi
239
241lws_handle_POLLOUT_event(struct lws *wsi, struct lws_pollfd *pollfd);
242
244
252#if defined(LWS_WITH_LIBUV) && defined(UV_ERRNO_MAP)
253
254/*
255 * Any direct libuv allocations in lws protocol handlers must participate in the
256 * lws reference counting scheme. Two apis are provided:
257 *
258 * - lws_libuv_static_refcount_add(handle, context, tsi) to mark the handle with
259 * a pointer to the context and increment the global uv object counter
260 *
261 * - lws_libuv_static_refcount_del() which should be used as the close callback
262 * for your own libuv objects declared in the protocol scope.
263 *
264 * Using the apis allows lws to detach itself from a libuv loop completely
265 * cleanly and at the moment all of its libuv objects have completed close.
266 */
267
268LWS_VISIBLE LWS_EXTERN uv_loop_t *
269lws_uv_getloop(struct lws_context *context, int tsi);
270
272lws_libuv_static_refcount_add(uv_handle_t *, struct lws_context *context,
273 int tsi);
274
276lws_libuv_static_refcount_del(uv_handle_t *);
277
278#endif /* LWS_WITH_LIBUV */
279
280#if defined(LWS_PLAT_FREERTOS)
281#define lws_libuv_static_refcount_add(_a, _b, _c)
282#define lws_libuv_static_refcount_del NULL
283#endif
LWS_VISIBLE LWS_EXTERN int lws_handle_POLLOUT_event(struct lws *wsi, struct lws_pollfd *pollfd)
LWS_VISIBLE LWS_EXTERN void lws_cancel_service_pt(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN lws_sockfd_type lws_service_wake_fd(struct lws_context *context, int tsi)
LWS_VISIBLE LWS_EXTERN int lws_service_adjust_timeout(struct lws_context *context, int timeout_ms, int tsi)
LWS_VISIBLE LWS_EXTERN void lws_cancel_service(struct lws_context *context)
LWS_VISIBLE LWS_EXTERN int lws_service_work_outstanding(struct lws_context *context)
LWS_VISIBLE LWS_EXTERN int lws_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
LWS_VISIBLE LWS_EXTERN lws_usec_t lws_service_set_now(struct lws_context *context, int tsi, lws_usec_t now_us, time_t now_wall)
LWS_VISIBLE LWS_EXTERN int lws_service_fd(struct lws_context *context, struct lws_pollfd *pollfd)
LWS_VISIBLE LWS_EXTERN int lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd, int tsi)
LWS_VISIBLE LWS_EXTERN int lws_service(struct lws_context *context, int timeout_ms)
#define lws_pollfd
#define LWS_EXTERN
int64_t lws_usec_t
int lws_sockfd_type
#define LWS_VISIBLE