2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * Please read the file COPYING, README and AUTHORS for more information.
11 * $Id: conn.h,v 1.29 2002/12/30 17:14:59 alex Exp $
13 * Connection management (header)
21 #include <time.h> /* wg. time_t, s.u. */
25 #define CONN_ZIP 4 /* Kompression mit zlib */
39 typedef struct _ZipData
41 z_stream in; /* "Handle" for input stream */
42 z_stream out; /* "Handle" for output stream */
43 CHAR rbuf[READBUFFER_LEN]; /* Read buffer */
44 INT rdatalen; /* Length of data in read buffer (compressed) */
45 CHAR wbuf[WRITEBUFFER_LEN]; /* Write buffer */
46 INT wdatalen; /* Length of data in write buffer (uncompressed) */
47 LONG bytes_in, bytes_out; /* Counter for statistics (uncompressed!) */
51 typedef struct _Connection
53 INT sock; /* Socket handle */
54 struct sockaddr_in addr; /* Client address */
55 RES_STAT *res_stat; /* Status of resolver process, if any */
56 CHAR host[HOST_LEN]; /* Hostname */
57 CHAR rbuf[READBUFFER_LEN]; /* Read buffer */
58 INT rdatalen; /* Length of data in read buffer */
59 CHAR wbuf[WRITEBUFFER_LEN]; /* Write buffer */
60 INT wdatalen; /* Length of data in write buffer */
61 time_t starttime; /* Start time of link */
62 time_t lastdata; /* Last activity */
63 time_t lastping; /* Last PING */
64 time_t lastprivmsg; /* Last PRIVMSG */
65 time_t delaytime; /* Ignore link ("penalty") */
66 LONG bytes_in, bytes_out; /* Received and sent bytes */
67 LONG msg_in, msg_out; /* Received and sent IRC messages */
68 INT flag; /* Flag (see "irc-write" module) */
69 INT options; /* Link options */
71 ZIPDATA zip; /* Compression information */
75 GLOBAL CONNECTION *My_Connections;
76 GLOBAL CONN_ID Pool_Size;
79 #endif /* CONN_MODULE */
82 GLOBAL VOID Conn_Init PARAMS((VOID ));
83 GLOBAL VOID Conn_Exit PARAMS(( VOID ));
85 GLOBAL INT Conn_InitListeners PARAMS(( VOID ));
86 GLOBAL VOID Conn_ExitListeners PARAMS(( VOID ));
88 GLOBAL BOOLEAN Conn_NewListener PARAMS(( CONST UINT Port ));
90 GLOBAL VOID Conn_Handler PARAMS(( VOID ));
92 GLOBAL BOOLEAN Conn_Write PARAMS(( CONN_ID Idx, CHAR *Data, INT Len ));
93 GLOBAL BOOLEAN Conn_WriteStr PARAMS(( CONN_ID Idx, CHAR *Format, ... ));
95 GLOBAL VOID Conn_Close PARAMS(( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient ));
98 GLOBAL INT Conn_MaxFD;