1 /* Licensed under BSD-MIT - see LICENSE file for details */
2 #ifndef CCAN_IO_BACKEND_H
3 #define CCAN_IO_BACKEND_H
11 struct io_op *(*next)(struct io_conn *, void *arg);
14 void (*finish)(struct io_conn *, void *arg);
19 /* Listeners create connections. */
25 NEXT, /* eg starting, woken from idle, return from io_break. */
32 PROCESSING /* We expect them to change this now. */
35 static inline enum io_state from_ioop(struct io_op *op)
37 return (enum io_state)(long)op;
40 struct io_state_read {
45 struct io_state_write {
50 struct io_state_readpart {
55 struct io_state_writepart {
60 /* One connection per client. */
66 struct io_state_read read;
67 struct io_state_write write;
68 struct io_state_readpart readpart;
69 struct io_state_writepart writepart;
73 extern void *io_loop_return;
75 bool add_listener(struct io_listener *l);
76 bool add_conn(struct io_conn *c);
77 void del_listener(struct io_listener *l);
78 void backend_set_state(struct io_conn *conn, struct io_op *op);
80 struct io_op *do_writeable(struct io_conn *conn);
81 struct io_op *do_readable(struct io_conn *conn);
82 #endif /* CCAN_IO_BACKEND_H */