libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws-io-ops.h
Go to the documentation of this file.
1/*
2 * libwebsockets - small server side websockets and web server implementation
3 *
4 * Copyright (C) 2010 - 2026 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
22 * DEALINGS IN THE SOFTWARE.
23 *
24 * lws-io-ops.h: the four requests the sansIO half of lws makes of the IO
25 * half. See READMEs/README.sans-io-split.md, "The interface" and "The
26 * headers".
27 *
28 * sansIO asks IO for exactly these: call my tx when the transport can take
29 * bytes, feed or stop feeding my rx, wake me at this deadline, and release
30 * my transport. It asks through the names it always has (
31 * lws_callback_on_writable(), lws_rx_flow_control(), lws_set_timeout() and
32 * lws_sul_schedule(), lws_close_free_wsi()); at the bottom of each, where
33 * the request reaches the transport, it goes through this struct.
34 *
35 * IO fills it in for the normal build (lws_io_ops_default). An embedder of
36 * the sansIO half alone supplies its own in
37 * lws_context_creation_info.io_ops, and a port that returns its requests as
38 * polled outputs implements the same four.
39 */
40
41typedef struct lws_io_ops {
42 int (*want_write)(struct lws *wsi);
47 int (*want_read)(struct lws *wsi, int on);
50 void (*deadline)(struct lws_context *cx, int tsi, lws_usec_t us);
56 void (*close)(struct lws *wsi);
int64_t lws_usec_t
struct lws_io_ops lws_io_ops_t
void(* deadline)(struct lws_context *cx, int tsi, lws_usec_t us)
Definition lws-io-ops.h:50
int(* want_read)(struct lws *wsi, int on)
Definition lws-io-ops.h:47
void(* close)(struct lws *wsi)
Definition lws-io-ops.h:56
int(* want_write)(struct lws *wsi)
Definition lws-io-ops.h:42