1 /* ioset.h - srvx event loop
2 * Copyright 2002-2003 srvx Development Team
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version. Important limitations are
8 * listed in the COPYING file that accompanies this software.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, email srvx-maintainers@srvx.net.
22 /* Forward declare, since ioset_connect() takes a sockaddr argument. */
27 unsigned int size, get, put;
33 unsigned int connected : 1;
34 unsigned int wants_reads : 1;
35 unsigned int line_reads : 1;
40 void (*connect_cb)(struct io_fd *fd, int error);
41 void (*readable_cb)(struct io_fd *fd);
42 void (*destroy_cb)(struct io_fd *fd);
45 extern int clock_skew;
46 extern int do_write_dbs;
49 struct io_fd *ioset_add(int fd);
50 struct io_fd *ioset_connect(struct sockaddr *local, unsigned int sa_size, const char *hostname, unsigned int port, int blocking, void *data, void (*connect_cb)(struct io_fd *fd, int error));
52 void ioset_write(struct io_fd *fd, const char *buf, unsigned int nbw);
53 int ioset_line_read(struct io_fd *fd, char *buf, int maxlen);
54 void ioset_close(int fd, int os_close);
55 void ioset_cleanup(void);
56 void ioset_set_time(unsigned long new_now);
58 #endif /* !defined(IOSET_H) */