]> jfr.im git - irc/rqf/shadowircd.git/blame - servlink/servlink.h
[svn] - the new plan:
[irc/rqf/shadowircd.git] / servlink / servlink.h
CommitLineData
212380e3 1/************************************************************************
2 * IRC - Internet Relay Chat, servlink/servlink.h
3 *
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 1, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 *
18 * $Id: servlink.h 1285 2006-05-05 15:03:53Z nenolod $
19 */
20
21#ifndef INCLUDED_servlink_servlink_h
22#define INCLUDED_servlink_servlink_h
23
24#include "setup.h"
25
26#ifdef HAVE_LIBZ
27#include <zlib.h>
28#endif
29
30/* do not use stdin/out/err, as it seems to break on solaris */
31#define CONTROL fds[0]
32#define LOCAL fds[1]
33#define REMOTE fds[2]
34
35#undef SERVLINK_DEBUG
36
37#define READLEN 16384
38
39#ifdef HAVE_LIBZ
40#define BUFLEN READLEN * 6 /* allow for decompression */
41#else
42#define BUFLEN READLEN
43#endif
44
45
46#ifdef HAVE_LIBZ
47struct zip_state
48{
49 z_stream z_stream;
50 int level; /* compression level */
51};
52#endif
53
54struct slink_state
55{
56 unsigned int crypt:1;
57 unsigned int zip:1;
58 unsigned int active:1;
59
60 unsigned char buf[BUFLEN * 2];
61 unsigned int ofs;
62 unsigned int len;
63
64#ifdef HAVE_LIBZ
65 struct zip_state zip_state;
66#endif
67};
68
69
70typedef void (io_callback) (void);
71
72struct fd_table
73{
74 int fd;
75 io_callback *read_cb;
76 io_callback *write_cb;
77};
78
79extern struct slink_state in_state;
80extern struct slink_state out_state;
81extern struct fd_table fds[3];
82
83#endif /* INCLUDED_servlink_servlink_h */