1 /*
2  * ----------------------------------------------------------------
3  * ircproxy - Connection Header
4  * ----------------------------------------------------------------
5  * Copyright (C) 1997-2009 Jonas Kvinge
6  *
7  * This file is part of ircproxy.
8  *
9  * ircproxy is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * ircproxy is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with ircproxy.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  * Additional permission under GNU GPL version 3 section 7
23  *
24  * If you modify ircproxy, or any covered work, by linking or
25  * combining it with openssl (or a modified version of that library),
26  * containing parts covered by the terms of the OpenSSL License and the
27  * SSLeay License, the licensors of ircproxy grant you additional
28  * permission to convey the resulting work.
29  *
30  * $Id: conn.h 54 2009-03-18 18:23:29Z jonasio $
31  *
32  */
33 
34 #ifdef CONN_H
35 #warning "conn.h already included."
36 #else
37 #define CONN_H
38 
39 struct in_addr;
40 #if IPV6_SUPPORT
41 struct in6_addr;
42 #endif
43 struct Who_Struct;
44 struct IRC_ISupport_Struct;
45 struct ConnConf_Struct;
46 
47 /* DEFINES - JONAS (24.06.2000) */
48 
49 #define CONN_INTERVAL					120
50 #define CONN_SOCKKEEPALIVEOPT				TRUE
51 #define CONN_CONNECTTIMEOUT				120
52 #define CONN_QUITTIMEOUT				5
53 #define CONN_IDLETIMEBEFOREPING				30
54 #define CONN_PINGTIMEOUT				1800
55 #define CONN_ISONTIME					30
56 #define CONN_IGNORENICKMASK				6
57 #define CONN_IGNOREUSERMASK				6
58 #define CONN_IGNOREHOSTMASK				1
59 #define CONN_IGNOREEXPIRETIME				30
60 #define CONN_IGNORETTL					10
61 #define CHAN_HASHSIZE					100
62 #define CHANUSER_HASHSIZE				10000
63 
64 /* BIT MASKS - JONAS (24.06.2000) */
65 
66 #define CONN_BITMASK_ATTACHED				1
67 #define CONN_BITMASK_REMOVE				2
68 #define CONN_BITMASK_LOGHOMEDIR				4
69 #define CONN_BITMASK_LOGERROR				8
70 
71 #define CONN_BITMASK_CONNECTPROC			1
72 #define CONN_BITMASK_SOCKET				2
73 #define CONN_BITMASK_SOCKOPT				4
74 #define CONN_BITMASK_KEEPALIVEOPT			8
75 #define CONN_BITMASK_BOUND				16
76 #define CONN_BITMASK_CONNECTING				32
77 #define CONN_BITMASK_CONNECTED				64
78 #define CONN_BITMASK_SOCKNAME				128
79 #define CONN_BITMASK_PEERNAME				256
80 #define CONN_BITMASK_SSLHANDSHAKE			512
81 #define CONN_BITMASK_WELCOME				1024
82 #define CONN_BITMASK_AWAY				2048
83 #define CONN_BITMASK_SENTNICK				4096
84 #define CONN_BITMASK_SENTAWAYNICK			8192
85 #define CONN_BITMASK_SENTPING				16384
86 #define CONN_BITMASK_SENTISON				32768
87 #define CONN_BITMASK_SENTQUIT				65536
88 #define CONN_BITMASK_AWAYNICK				131072
89 
90 
91 #define CONN_USERMODE_INVISIBLE				1
92 #define CONN_USERMODE_NOTICE				2
93 #define CONN_USERMODE_WALLOPS				4
94 #define CONN_USERMODE_GOPER				8
95 #define CONN_USERMODE_LOPER				16
96 
97 #define CONN_CHANMODE_ANONYMOUS				1
98 #define CONN_CHANMODE_INVITEONLY			2
99 #define CONN_CHANMODE_MODERATED				4
100 #define CONN_CHANMODE_NOOUTSIDE				8
101 #define CONN_CHANMODE_QUIET				16
102 #define CONN_CHANMODE_PRIVATE				32
103 #define CONN_CHANMODE_SECRET				64
104 #define CONN_CHANMODE_REOP				128
105 #define CONN_CHANMODE_ONLYOPTOPIC			256
106 #define CONN_CHANMODE_KEY				512
107 #define CONN_CHANMODE_LIMIT				1024
108 
109 #define CONN_CHANLISTMODE_BAN				1
110 #define CONN_CHANLISTMODE_EXCEPTION			2
111 #define CONN_CHANLISTMODE_INVITATION			4
112 
113 #define CONN_CHANUSERMODE_CREATOR			1
114 #define CONN_CHANUSERMODE_OPERATOR			2
115 #define CONN_CHANUSERMODE_VOICE				4
116 
117 /* MACROS - JONAS (24.06.2000) */
118 
119 #define Conn_SetAttached(x)				((x)->Flags |= CONN_BITMASK_ATTACHED)
120 #define Conn_SetRemove(x)				((x)->Flags |= CONN_BITMASK_REMOVE)
121 #define Conn_SetLogHomeDir(x)				((x)->Flags |= CONN_BITMASK_LOGHOMEDIR)
122 #define Conn_SetLogError(x)				((x)->Flags |= CONN_BITMASK_LOGERROR)
123 
124 #define Conn_ClearAttached(x)				((x)->Flags &= ~CONN_BITMASK_ATTACHED)
125 #define Conn_ClearRemove(x)				((x)->Flags &= ~CONN_BITMASK_REMOVE)
126 #define Conn_ClearLogHomeDir(x)				((x)->Flags &= ~CONN_BITMASK_LOGHOMEDIR)
127 #define Conn_ClearLogError(x)				((x)->Flags &= ~CONN_BITMASK_LOGERROR)
128 
129 #define Conn_IsAttached(x)				((x)->Flags & CONN_BITMASK_ATTACHED)
130 #define Conn_IsRemove(x)				((x)->Flags & CONN_BITMASK_REMOVE)
131 #define Conn_IsLogHomeDir(x)				((x)->Flags & CONN_BITMASK_LOGHOMEDIR)
132 #define Conn_IsLogError(x)				((x)->Flags & CONN_BITMASK_LOGERROR)
133 
134 
135 #define Conn_SetConnectProc(x)				((x)->ConnectionFlags |= CONN_BITMASK_CONNECTPROC)
136 #define Conn_SetSocket(x)				((x)->ConnectionFlags |= CONN_BITMASK_SOCKET)
137 #define Conn_SetSockOPT(x)				((x)->ConnectionFlags |= CONN_BITMASK_SOCKOPT)
138 #define Conn_SetKeepAliveOPT(x)				((x)->ConnectionFlags |= CONN_BITMASK_KEEPALIVEOPT)
139 #define Conn_SetBound(x)				((x)->ConnectionFlags |= CONN_BITMASK_BOUND)
140 #define Conn_SetConnecting(x)				((x)->ConnectionFlags |= CONN_BITMASK_CONNECTING)
141 #define Conn_SetConnected(x)				((x)->ConnectionFlags |= CONN_BITMASK_CONNECTED)
142 #define Conn_SetSockName(x)				((x)->ConnectionFlags |= CONN_BITMASK_SOCKNAME)
143 #define Conn_SetPeerName(x)				((x)->ConnectionFlags |= CONN_BITMASK_PEERNAME)
144 #define Conn_SetSSLHandshake(x)				((x)->ConnectionFlags |= CONN_BITMASK_SSLHANDSHAKE)
145 #define Conn_SetWelcome(x)				((x)->ConnectionFlags |= CONN_BITMASK_WELCOME)
146 #define Conn_SetAway(x)					((x)->ConnectionFlags |= CONN_BITMASK_AWAY)
147 #define Conn_SetSentNick(x)				((x)->ConnectionFlags |= CONN_BITMASK_SENTNICK)
148 #define Conn_SetSentAwayNick(x)				((x)->ConnectionFlags |= CONN_BITMASK_SENTAWAYNICK)
149 #define Conn_SetSentPing(x)				((x)->ConnectionFlags |= CONN_BITMASK_SENTPING)
150 #define Conn_SetSentISON(x)				((x)->ConnectionFlags |= CONN_BITMASK_SENTISON)
151 #define Conn_SetSentQuit(x)				((x)->ConnectionFlags |= CONN_BITMASK_SENTQUIT)
152 #define Conn_SetAwayNick(x)				((x)->ConnectionFlags |= CONN_BITMASK_AWAYNICK)
153 
154 #define Conn_ClearConnectProc(x)			((x)->ConnectionFlags &= ~CONN_BITMASK_CONNECTPROC)
155 #define Conn_ClearSocket(x)				((x)->ConnectionFlags &= ~CONN_BITMASK_SOCKET)
156 #define Conn_ClearSockOPT(x)				((x)->ConnectionFlags &= ~CONN_BITMASK_SOCKOPT)
157 #define Conn_ClearKeepAliveOPT(x)			((x)->ConnectionFlags &= ~CONN_BITMASK_KEEPALIVEOPT)
158 #define Conn_ClearBound(x)				((x)->ConnectionFlags &= ~CONN_BITMASK_BOUND)
159 #define Conn_ClearConnecting(x)				((x)->ConnectionFlags &= ~CONN_BITMASK_CONNECTING)
160 #define Conn_ClearConnected(x)				((x)->ConnectionFlags &= ~CONN_BITMASK_CONNECTED)
161 #define Conn_ClearSockName(x)				((x)->ConnectionFlags &= ~CONN_BITMASK_SOCKNAME)
162 #define Conn_ClearPeerName(x)				((x)->ConnectionFlags &= ~CONN_BITMASK_PEERNAME)
163 #define Conn_ClearSSLHandshake(x)			((x)->ConnectionFlags &= ~CONN_BITMASK_SSLHANDSHAKE)
164 #define Conn_ClearWelcome(x)				((x)->ConnectionFlags &= ~CONN_BITMASK_WELCOME)
165 #define Conn_ClearAway(x)				((x)->ConnectionFlags &= ~CONN_BITMASK_AWAY)
166 #define Conn_ClearSentNick(x)				((x)->ConnectionFlags &= ~CONN_BITMASK_SENTNICK)
167 #define Conn_ClearSentAwayNick(x)			((x)->ConnectionFlags &= ~CONN_BITMASK_SENTAWAYNICK)
168 #define Conn_ClearSentPing(x)				((x)->ConnectionFlags &= ~CONN_BITMASK_SENTPING)
169 #define Conn_ClearSentISON(x)				((x)->ConnectionFlags &= ~CONN_BITMASK_SENTISON)
170 #define Conn_ClearSentQuit(x)				((x)->ConnectionFlags &= ~CONN_BITMASK_SENTQUIT)
171 #define Conn_ClearAwayNick(x)				((x)->ConnectionFlags &= ~CONN_BITMASK_AWAYNICK)
172 
173 #define Conn_IsConnectProc(x)				((x)->ConnectionFlags & CONN_BITMASK_CONNECTPROC)
174 #define Conn_IsSocket(x)				((x)->ConnectionFlags & CONN_BITMASK_SOCKET)
175 #define Conn_IsSockOPT(x)				((x)->ConnectionFlags & CONN_BITMASK_SOCKOPT)
176 #define Conn_IsKeepAliveOPT(x)				((x)->ConnectionFlags & CONN_BITMASK_KEEPALIVEOPT)
177 #define Conn_IsBound(x)					((x)->ConnectionFlags & CONN_BITMASK_BOUND)
178 #define Conn_IsConnecting(x)				((x)->ConnectionFlags & CONN_BITMASK_CONNECTING)
179 #define Conn_IsConnected(x)				((x)->ConnectionFlags & CONN_BITMASK_CONNECTED)
180 #define Conn_IsSockName(x)				((x)->ConnectionFlags & CONN_BITMASK_SOCKNAME)
181 #define Conn_IsPeerName(x)				((x)->ConnectionFlags & CONN_BITMASK_PEERNAME)
182 #define Conn_IsSSLHandshake(x)				((x)->ConnectionFlags & CONN_BITMASK_SSLHANDSHAKE)
183 #define Conn_IsWelcome(x)				((x)->ConnectionFlags & CONN_BITMASK_WELCOME)
184 #define Conn_IsAway(x)					((x)->ConnectionFlags & CONN_BITMASK_AWAY)
185 #define Conn_IsSentNick(x)				((x)->ConnectionFlags & CONN_BITMASK_SENTNICK)
186 #define Conn_IsSentAwayNick(x)				((x)->ConnectionFlags & CONN_BITMASK_SENTAWAYNICK)
187 #define Conn_IsSentPing(x)				((x)->ConnectionFlags & CONN_BITMASK_SENTPING)
188 #define Conn_IsSentISON(x)				((x)->ConnectionFlags & CONN_BITMASK_SENTISON)
189 #define Conn_IsSentQuit(x)				((x)->ConnectionFlags & CONN_BITMASK_SENTQUIT)
190 #define Conn_IsAwayNick(x)				((x)->ConnectionFlags & CONN_BITMASK_AWAYNICK)
191 
192 #define Conn_IsConnect(x)				((x)->ConnectionFlags & (CONN_BITMASK_CONNECTING|CONN_BITMASK_CONNECTED))
193 
194 
195 #define ConnISupport_SetInvisible(x)			((x)->UserModeFlags |= CONN_USERMODE_INVISIBLE)
196 #define ConnISupport_SetNotice(x)			((x)->UserModeFlags |= CONN_USERMODE_NOTICE)
197 #define ConnISupport_SetWallops(x)			((x)->UserModeFlags |= CONN_USERMODE_WALLOPS)
198 #define ConnISupport_SetGOper(x)			((x)->UserModeFlags |= CONN_USERMODE_GOPER)
199 #define ConnISupport_SetLOper(x)			((x)->UserModeFlags |= CONN_USERMODE_LOPER)
200 
201 #define ConnISupport_SetAnonymous(x)			((x)->ChanModeFlags |= CONN_CHANMODE_ANONYMOUS)
202 #define ConnISupport_SetInviteOnly(x)			((x)->ChanModeFlags |= CONN_CHANMODE_INVITEONLY)
203 #define ConnISupport_SetModerated(x)			((x)->ChanModeFlags |= CONN_CHANMODE_MODERATED)
204 #define ConnISupport_SetNoOutSide(x)			((x)->ChanModeFlags |= CONN_CHANMODE_NOOUTSIDE)
205 #define ConnISupport_SetQuiet(x)			((x)->ChanModeFlags |= CONN_CHANMODE_QUIET)
206 #define ConnISupport_SetPrivate(x)			((x)->ChanModeFlags |= CONN_CHANMODE_PRIVATE)
207 #define ConnISupport_SetSecret(x)			((x)->ChanModeFlags |= CONN_CHANMODE_SECRET)
208 #define ConnISupport_SetReOP(x)				((x)->ChanModeFlags |= CONN_CHANMODE_REOP)
209 #define ConnISupport_SetOnlyOPTopic(x)			((x)->ChanModeFlags |= CONN_CHANMODE_ONLYOPTOPIC)
210 #define ConnISupport_SetKey(x)				((x)->ChanModeFlags |= CONN_CHANMODE_KEY)
211 #define ConnISupport_SetLimit(x)			((x)->ChanModeFlags |= CONN_CHANMODE_LIMIT)
212 
213 #define ConnISupport_SetBan(x)				((x)->ChanListModeFlags |= CONN_CHANLISTMODE_BAN)
214 #define ConnISupport_SetException(x)			((x)->ChanListModeFlags |= CONN_CHANLISTMODE_EXCEPTION)
215 #define ConnISupport_SetInvitation(x)			((x)->ChanListModeFlags |= CONN_CHANLISTMODE_INVITATION)
216 #define ConnISupport_SetCreator(x)			((x)->ChanUserModeFlags |= CONN_CHANUSERMODE_CREATOR)
217 #define ConnISupport_SetOperator(x)			((x)->ChanUserModeFlags |= CONN_CHANUSERMODE_OPERATOR)
218 #define ConnISupport_SetVoice(x)			((x)->ChanUserModeFlags |= CONN_CHANUSERMODE_VOICE)
219 
220 #define ConnISupport_ClearInvisible(x)			((x)->UserModeFlags &= ~CONN_USERMODE_INVISIBLE)
221 #define ConnISupport_ClearNotice(x)			((x)->UserModeFlags &= ~CONN_USERMODE_NOTICE)
222 #define ConnISupport_ClearWallops(x)			((x)->UserModeFlags &= ~CONN_USERMODE_WALLOPS)
223 #define ConnISupport_ClearGOper(x)			((x)->UserModeFlags &= ~CONN_USERMODE_GOPER)
224 #define ConnISupport_ClearLOper(x)			((x)->UserModeFlags &= ~CONN_USERMODE_LOPER)
225 #define ConnISupport_ClearAnonymous(x)			((x)->ChanModeFlags &= ~CONN_CHANMODE_ANONYMOUS)
226 #define ConnISupport_ClearInviteOnly(x)			((x)->ChanModeFlags &= ~CONN_CHANMODE_INVITEONLY)
227 #define ConnISupport_ClearModerated(x)			((x)->ChanModeFlags &= ~CONN_CHANMODE_MODERATED)
228 #define ConnISupport_ClearNoOutSide(x)			((x)->ChanModeFlags &= ~CONN_CHANMODE_NOOUTSIDE)
229 #define ConnISupport_ClearQuiet(x)			((x)->ChanModeFlags &= ~CONN_CHANMODE_QUIET)
230 #define ConnISupport_ClearPrivate(x)			((x)->ChanModeFlags &= ~CONN_CHANMODE_PRIVATE)
231 #define ConnISupport_ClearSecret(x)			((x)->ChanModeFlags &= ~CONN_CHANMODE_SECRET)
232 #define ConnISupport_ClearReOP(x)			((x)->ChanModeFlags &= ~CONN_CHANMODE_REOP)
233 #define ConnISupport_ClearOnlyOPTopic(x)		((x)->ChanModeFlags &= ~CONN_CHANMODE_ONLYOPTOPIC)
234 #define ConnISupport_ClearKey(x)			((x)->ChanModeFlags &= ~CONN_CHANMODE_KEY)
235 #define ConnISupport_ClearLimit(x)			((x)->ChanModeFlags &= ~CONN_CHANMODE_LIMIT)
236 #define ConnISupport_ClearBan(x)			((x)->ChanListModeFlags &= ~CONN_CHANLISTMODE_BAN)
237 #define ConnISupport_ClearException(x)			((x)->ChanListModeFlags &= ~CONN_CHANLISTMODE_EXCEPTION)
238 #define ConnISupport_ClearInvitation(x)			((x)->ChanListModeFlags &= ~CONN_CHANLISTMODE_INVITATION)
239 #define ConnISupport_ClearCreator(x)			((x)->ChanUserModeFlags &= ~CONN_CHANUSERMODE_CREATOR)
240 #define ConnISupport_ClearOperator(x)			((x)->ChanUserModeFlags &= ~CONN_CHANUSERMODE_OPERATOR)
241 #define ConnISupport_ClearVoice(x)			((x)->ChanUserModeFlags &= ~CONN_CHANUSERMODE_VOICE)
242 
243 #define ConnISupport_IsInvisible(x)			((x)->UserModeFlags & CONN_USERMODE_INVISIBLE)
244 #define ConnISupport_IsNotice(x)			((x)->UserModeFlags & CONN_USERMODE_NOTICE)
245 #define ConnISupport_IsWallops(x)			((x)->UserModeFlags & CONN_USERMODE_WALLOPS)
246 #define ConnISupport_IsGOper(x)				((x)->UserModeFlags & CONN_USERMODE_GOPER)
247 #define ConnISupport_IsLOper(x)				((x)->UserModeFlags & CONN_USERMODE_LOPER)
248 #define ConnISupport_IsAnonymous(x)			((x)->ChanModeFlags & CONN_CHANMODE_ANONYMOUS)
249 #define ConnISupport_IsInviteOnly(x)			((x)->ChanModeFlags & CONN_CHANMODE_INVITEONLY)
250 #define ConnISupport_IsModerated(x)			((x)->ChanModeFlags & CONN_CHANMODE_MODERATED)
251 #define ConnISupport_IsNoOutSide(x)			((x)->ChanModeFlags & CONN_CHANMODE_NOOUTSIDE)
252 #define ConnISupport_IsQuiet(x)				((x)->ChanModeFlags & CONN_CHANMODE_QUIET)
253 #define ConnISupport_IsPrivate(x)			((x)->ChanModeFlags & CONN_CHANMODE_PRIVATE)
254 #define ConnISupport_IsSecret(x)			((x)->ChanModeFlags & CONN_CHANMODE_SECRET)
255 #define ConnISupport_IsReOP(x)				((x)->ChanModeFlags & CONN_CHANMODE_REOP)
256 #define ConnISupport_IsOnlyOPTopic(x)			((x)->ChanModeFlags & CONN_CHANMODE_ONLYOPTOPIC)
257 #define ConnISupport_IsKey(x)				((x)->ChanModeFlags & CONN_CHANMODE_KEY)
258 #define ConnISupport_IsLimit(x)				((x)->ChanModeFlags & CONN_CHANMODE_LIMIT)
259 #define ConnISupport_IsBan(x)				((x)->ChanListModeFlags & CONN_CHANLISTMODE_BAN)
260 #define ConnISupport_IsException(x)			((x)->ChanListModeFlags & CONN_CHANLISTMODE_EXCEPTION)
261 #define ConnISupport_IsInvitation(x)			((x)->ChanListModeFlags & CONN_CHANLISTMODE_INVITATION)
262 #define ConnISupport_IsCreator(x)			((x)->ChanUserModeFlags & CONN_CHANUSERMODE_CREATOR)
263 #define ConnISupport_IsOperator(x)			((x)->ChanUserModeFlags & CONN_CHANUSERMODE_OPERATOR)
264 #define ConnISupport_IsVoice(x)				((x)->ChanUserModeFlags & CONN_CHANUSERMODE_VOICE)
265 
266 /* STRUCTURES - JONAS (18.07.2001) */
267 
268 struct Conn_Struct {
269 
270   char *Name;
271   char *Nick;
272   char *AwayNick;
273   char *User;
274   char *Host;
275   char *Mode;
276   char *Info;
277   char *Chans;
278   char *AwayMsg;
279   char *PublicDetachMsg;
280   char *PublicAttachMsg;
281   char *NickServNUH;
282   char *NickServPass;
283   char *NickServText;
284   unsigned long int ConfFlags;
285   unsigned short int MaxClients;
286   unsigned short int SendMaxLines;
287   unsigned short int SendLineTime;
288   unsigned short int SendMaxBuffer;
289   unsigned short int SendBufferTime;
290   unsigned long int ChanLogFlags;
291 
292   unsigned short int NumServers;
293   struct ConnServer_Struct *Server_Head;
294   struct ConnServer_Struct *Server_Tail;
295 
296 
297   unsigned long int Flags;
298 
299   unsigned short int NumClients;
300   struct ConnServer_Struct *ConnServerTry;
301 
302 
303   unsigned long int ResolveFlags;
304   char *HostName;
305   char *HostIPS;
306   struct in_addr INAddr;
307 #if IPV6_SUPPORT
308   struct in6_addr INAddr6;
309 #endif
310   unsigned long int PortH;
311   unsigned long int PortN;
312 
313   unsigned long int ServerResolveFlags;
314   char *ServerHostName;
315   char *ServerHostIPS;
316 
317   struct in_addr ServerINAddr;
318 #if IPV6_SUPPORT
319   struct in6_addr ServerINAddr6;
320 #endif
321   unsigned long int ServerPortH;
322   unsigned long int ServerPortN;
323   char *ServerPass;
324 
325   unsigned long long int ConnectionFlags;
326   signed long int FD;
327   char *ServerName;
328   char *IRCNick;
329   char *Welcome[5];
330   char **ISupport_String;
331   char **MOTD_Line;
332   unsigned short int ISupportLines;
333   unsigned short int MOTDLines;
334   unsigned short int ISuppChanModes;
335   unsigned short int ISuppChanUserModes;
336   struct IRC_ISupport_Struct ISupport;
337   struct IRC_ISupport_ChanMode_Struct *ISuppChanMode;
338   struct IRC_ISupport_ChanUserMode_Struct *ISuppChanUserMode;
339   unsigned long int UserModeFlags;
340   unsigned long int ChanModeFlags;
341   unsigned long int ChanListModeFlags;
342   unsigned long int ChanUserModeFlags;
343   unsigned short int NumSendQs;
344   struct SendQ_Struct *SendQ_Head;
345   unsigned short int NumFlushLs;
346   unsigned long int SendQMaxFlushLines;
347   struct FlushL_Struct *FlushL_Head;
348   struct FlushL_Struct *FlushL_Tail;
349   unsigned short int NumFlushBs;
350   unsigned long int SendQMaxFlushBuffer;
351   struct FlushB_Struct *FlushB_Head;
352   struct FlushB_Struct *FlushB_Tail;
353   char *RecvBuffer;
354   char *SendBuffer;
355   unsigned short int NicksIndex;
356   time_t ConnectProcTime;
357   time_t ConnectTime;
358   time_t ConnectedTime;
359   time_t SentPingTime;
360   time_t SentQuitTime;
361   time_t LastRecvTime;
362   time_t IgnoreExpireTime;
363   time_t SentISONTime;
364   time_t LogError;
365 
366   char *RawLogFile;
367   FILE *RawLogFileFP;
368   char *PrivLogFile;
369   FILE *PrivLogFileFP;
370 
371   unsigned short int NumChans;
372   struct Chan_Struct *Chan_Head;
373   struct Chan_Struct *Chan_Tail;
374   struct Chan_Struct *Chan_Table[CHAN_HASHSIZE];
375 
376   unsigned short int NumIgnores;
377   struct Ignore_Struct *Ignore_Head;
378   struct Ignore_Struct *Ignore_Tail;
379 
380   unsigned short int NumLogs;
381   struct ConnLog_Struct *Log_Head;
382   struct ConnLog_Struct *Log_Tail;
383 
384 
385 #if SSL_SUPPORT
386   SSL *SSL_H;
387 #if defined(HAVE_GNUTLS)
388   const X509 *Cert;
389 #else
390   X509 *Cert;
391 #endif
392 #endif
393 
394   struct Conn_Struct *Prev;
395   struct Conn_Struct *Next;
396 
397 };
398 
399 struct ConnServer_Struct {
400 
401   char *Host;
402   unsigned long int Port;
403   char *Pass;
404 
405   unsigned short int Tries;
406 
407   struct ConnServer_Struct *Prev;
408   struct ConnServer_Struct *Next;
409 
410 };
411 
412 /* FUNCTION PROTOTYPES - JONAS (18.07.2001) */
413 
414 struct Conn_Struct *conn_add(struct ConnConf_Struct *ConnConf);
415 void conn_rem(struct Conn_Struct *ConnS);
416 struct Conn_Struct *conn_get(const char *const NamePT);
417 struct ConnServer_Struct *conn_addserver(struct Conn_Struct *ConnS, const char *const HostPT, const unsigned long int Port, const char *const PassPT);
418 void conn_remserver(struct Conn_Struct *ConnS, struct ConnServer_Struct *ConnServer);
419 struct ConnServer_Struct *conn_getserver(struct Conn_Struct *ConnS, const char *const HostPT);
420 void conn_destroyservers(struct Conn_Struct *ConnS);
421 void conn_initconnection(struct Conn_Struct *ConnS);
422 
423 #endif
424