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