Lines Matching refs:cb
26 struct sock_io_cb *cb; member
32 bool (*cb)(struct server_state *srvst, size_t idx); member
40 struct sock_io_cb *cb = srvst->cb; in server_io_cb() local
45 if (!cb->read) in server_io_cb()
47 else if (!cb->read(cb->ptr, fd, events)) in server_io_cb()
52 if (!cb->write) in server_io_cb()
54 else if (!cb->write(cb->ptr, fd, events)) in server_io_cb()
70 bool (*cb)(struct server_state *srvst, size_t idx), in server_add_state()
79 srvst->socks[n].cb = cb; in server_add_state()
92 srvst->socks[srvst->nfds].cb = cb; in server_add_state()
127 if (srvst->cb->accept && in tcp_server_accept_cb()
128 !srvst->cb->accept(srvst->cb->ptr, fd, &io_events)) { in tcp_server_accept_cb()
145 return srvst->cb->accept(srvst->cb->ptr, srvst->fds[idx].fd, NULL); in udp_server_cb()
156 bool (*cb)(struct server_state *srvst, size_t idx)) in sock_server()
158 struct server_state srvst = { .cb = ts->cb }; in sock_server()
166 if (!server_add_state(&srvst, cb, ts->bind + n, in sock_server()
190 if (!srvst.socks[n].cb(&srvst, n)) in sock_server()
313 static bool sock_server_init(struct sock_server *ts, struct sock_io_cb *cb, in sock_server_init() argument
325 ts->cb = cb; in sock_server_init()
371 bool sock_server_init_tcp(struct sock_server *sock_serv, struct sock_io_cb *cb) in sock_server_init_tcp() argument
373 return sock_server_init(sock_serv, cb, SOCK_STREAM); in sock_server_init_tcp()
376 bool sock_server_init_udp(struct sock_server *sock_serv, struct sock_io_cb *cb) in sock_server_init_udp() argument
378 return sock_server_init(sock_serv, cb, SOCK_DGRAM); in sock_server_init_udp()