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 c40592d2 2003-12-26 alex * $Id: conn.h,v 1.32 2003/12/26 15:55:07 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 2a3f8cc5 2003-02-21 alex #include <time.h> /* fro time_t, see below */
24 2a3f8cc5 2003-02-21 alex #define CONN_ISCLOSING 1 /* Conn_Close() already called */
27 2a3f8cc5 2003-02-21 alex #define CONN_ZIP 2 /* zlib compressed link */
31 933e62fb 2001-12-14 alex typedef INT CONN_ID;
34 b77dae34 2002-12-30 alex #ifdef CONN_MODULE
36 e68cdf30 2002-12-30 alex #include "defines.h"
37 e68cdf30 2002-12-30 alex #include "resolve.h"
40 e68cdf30 2002-12-30 alex #include <zlib.h>
41 e68cdf30 2002-12-30 alex typedef struct _ZipData
43 e68cdf30 2002-12-30 alex z_stream in; /* "Handle" for input stream */
44 e68cdf30 2002-12-30 alex z_stream out; /* "Handle" for output stream */
45 e68cdf30 2002-12-30 alex CHAR rbuf[READBUFFER_LEN]; /* Read buffer */
46 e68cdf30 2002-12-30 alex INT rdatalen; /* Length of data in read buffer (compressed) */
47 e68cdf30 2002-12-30 alex CHAR wbuf[WRITEBUFFER_LEN]; /* Write buffer */
48 e68cdf30 2002-12-30 alex INT wdatalen; /* Length of data in write buffer (uncompressed) */
49 e68cdf30 2002-12-30 alex LONG bytes_in, bytes_out; /* Counter for statistics (uncompressed!) */
51 c40592d2 2003-12-26 alex #endif /* ZLIB */
53 e68cdf30 2002-12-30 alex typedef struct _Connection
55 e68cdf30 2002-12-30 alex INT sock; /* Socket handle */
56 e68cdf30 2002-12-30 alex struct sockaddr_in addr; /* Client address */
57 e68cdf30 2002-12-30 alex RES_STAT *res_stat; /* Status of resolver process, if any */
58 e68cdf30 2002-12-30 alex CHAR host[HOST_LEN]; /* Hostname */
59 e68cdf30 2002-12-30 alex CHAR rbuf[READBUFFER_LEN]; /* Read buffer */
60 e68cdf30 2002-12-30 alex INT rdatalen; /* Length of data in read buffer */
61 e68cdf30 2002-12-30 alex CHAR wbuf[WRITEBUFFER_LEN]; /* Write buffer */
62 e68cdf30 2002-12-30 alex INT wdatalen; /* Length of data in write buffer */
63 e68cdf30 2002-12-30 alex time_t starttime; /* Start time of link */
64 e68cdf30 2002-12-30 alex time_t lastdata; /* Last activity */
65 e68cdf30 2002-12-30 alex time_t lastping; /* Last PING */
66 e68cdf30 2002-12-30 alex time_t lastprivmsg; /* Last PRIVMSG */
67 e68cdf30 2002-12-30 alex time_t delaytime; /* Ignore link ("penalty") */
68 e68cdf30 2002-12-30 alex LONG bytes_in, bytes_out; /* Received and sent bytes */
69 e68cdf30 2002-12-30 alex LONG msg_in, msg_out; /* Received and sent IRC messages */
70 e68cdf30 2002-12-30 alex INT flag; /* Flag (see "irc-write" module) */
71 e68cdf30 2002-12-30 alex INT options; /* Link options */
73 e68cdf30 2002-12-30 alex ZIPDATA zip; /* Compression information */
74 c40592d2 2003-12-26 alex #endif /* ZLIB */
75 e68cdf30 2002-12-30 alex } CONNECTION;
77 e68cdf30 2002-12-30 alex GLOBAL CONNECTION *My_Connections;
78 e68cdf30 2002-12-30 alex GLOBAL CONN_ID Pool_Size;
79 b77dae34 2002-12-30 alex GLOBAL LONG WCounter;
81 b77dae34 2002-12-30 alex #endif /* CONN_MODULE */
84 c2f60abe 2002-05-27 alex GLOBAL VOID Conn_Init PARAMS((VOID ));
85 c2f60abe 2002-05-27 alex GLOBAL VOID Conn_Exit PARAMS(( VOID ));
87 a0c032b2 2002-11-22 alex GLOBAL INT Conn_InitListeners PARAMS(( VOID ));
88 a0c032b2 2002-11-22 alex GLOBAL VOID Conn_ExitListeners PARAMS(( VOID ));
90 c2f60abe 2002-05-27 alex GLOBAL BOOLEAN Conn_NewListener PARAMS(( CONST UINT Port ));
92 b966b210 2002-06-02 alex GLOBAL VOID Conn_Handler PARAMS(( VOID ));
94 c2f60abe 2002-05-27 alex GLOBAL BOOLEAN Conn_Write PARAMS(( CONN_ID Idx, CHAR *Data, INT Len ));
95 c2f60abe 2002-05-27 alex GLOBAL BOOLEAN Conn_WriteStr PARAMS(( CONN_ID Idx, CHAR *Format, ... ));
97 c2f60abe 2002-05-27 alex GLOBAL VOID Conn_Close PARAMS(( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient ));
99 59a0fb8c 2003-03-27 alex GLOBAL VOID Conn_SyncServerStruct PARAMS(( VOID ));
101 c2f60abe 2002-05-27 alex GLOBAL INT Conn_MaxFD;
107 5fefe1a3 2001-12-12 alex /* -eof- */