]> jfr.im git - irc/evilnet/x3.git/blame - src/ioset.h
allow auto-oper on LOC too
[irc/evilnet/x3.git] / src / ioset.h
CommitLineData
d76ed9a9
AS
1/* ioset.h - srvx event loop
2 * Copyright 2002-2003 srvx Development Team
3 *
0f6fe38c 4 * This file is part of x3.
d76ed9a9 5 *
0f6fe38c 6 * x3 is free software; you can redistribute it and/or modify
d76ed9a9 7 * it under the terms of the GNU General Public License as published by
0f6fe38c 8 * the Free Software Foundation; either version 3 of the License, or
d76ed9a9
AS
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with srvx; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19 */
20
21#if !defined(IOSET_H)
22#define IOSET_H
23
0f6fe38c 24/* Forward declare, since ioset_connect() takes a sockaddr argument. */
d76ed9a9
AS
25struct sockaddr;
26
27struct ioq {
28 char *buf;
29 unsigned int size, get, put;
30};
31
32struct io_fd {
33 int fd;
34 void *data;
0f6fe38c 35 unsigned int connected : 1;
36 unsigned int wants_reads : 1;
d76ed9a9 37 unsigned int line_reads : 1;
0f6fe38c 38 unsigned int eof : 1;
d76ed9a9
AS
39 int line_len;
40 struct ioq send;
41 struct ioq recv;
42 void (*connect_cb)(struct io_fd *fd, int error);
43 void (*readable_cb)(struct io_fd *fd);
44 void (*destroy_cb)(struct io_fd *fd);
45};
0f6fe38c 46
d76ed9a9
AS
47extern int do_write_dbs;
48extern int do_reopen;
49
50struct io_fd *ioset_add(int fd);
51struct 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));
52void ioset_run(void);
53void ioset_write(struct io_fd *fd, const char *buf, unsigned int nbw);
54int ioset_line_read(struct io_fd *fd, char *buf, int maxlen);
0f6fe38c 55void ioset_close(int fd, int os_close);
d76ed9a9
AS
56void ioset_cleanup(void);
57void ioset_set_time(unsigned long new_now);
58
59#endif /* !defined(IOSET_H) */