ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-8/include/client.h
Revision: 912
Committed: Wed Nov 7 22:47:44 2007 UTC (16 years, 5 months ago) by michael
Content type: text/x-chdr
Original Path: ircd-hybrid-7.2/include/client.h
File size: 24927 byte(s)
Log Message:
- Implemented libtool-ltdl. Only shared modules are supported currently
- Several build fixes and cleanups. ircd now builds and runs without any problems
- Added back all files to SVN that are needed to built the daemon
  I really don't want to force other people that want to test the snapshots
  or svn versions to install yyacc, lex, automake, autoconf and libtool...
  No problem having required files in svn
- Removed some automake maintainer stuff which is kinda useless for us

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * client.h: The ircd client header.
4 *
5 * Copyright (C) 2002 by the past and present ircd coders, and others.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 *
22 * $Id$
23 */
24
25 #ifndef INCLUDED_client_h
26 #define INCLUDED_client_h
27
28 #include "fdlist.h"
29 #include "config.h"
30 #include "ircd_defs.h"
31 #include "ircd_handler.h"
32 #include "dbuf.h"
33 #include "channel.h"
34 #include "irc_res.h"
35
36 #define HOSTIPLEN 53 /* sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255.ipv6") */
37 #define PASSWDLEN 20
38 #define CIPHERKEYLEN 64 /* 512bit */
39 #define IDLEN 12 /* this is the maximum length, not the actual
40 generated length; DO NOT CHANGE! */
41
42 /*
43 * pre declare structs
44 */
45 struct AccessItem;
46 struct Whowas;
47 struct DNSReply;
48 struct Listener;
49 struct Client;
50 struct LocalUser;
51
52
53 struct Server
54 {
55 char by[NICKLEN]; /* who activated this connection */
56 struct ConfItem *sconf; /* ConfItem connect{} pointer for this server */
57 dlink_list server_list; /* Servers on this server */
58 dlink_list client_list; /* Clients on this server */
59 };
60
61 struct SlinkRpl
62 {
63 int command;
64 int datalen;
65 int gotdatalen;
66 int readdata;
67 unsigned char *data;
68 };
69
70 struct ZipStats
71 {
72 unsigned long in;
73 unsigned long in_wire;
74 unsigned long out;
75 unsigned long out_wire;
76 double in_ratio;
77 double out_ratio;
78 };
79
80 struct ListTask
81 {
82 int hash_index; /* the bucket we are currently in */
83 dlink_list show_mask; /* show these channels.. */
84 dlink_list hide_mask; /* ..and hide these ones */
85 unsigned int users_min, users_max;
86 unsigned int created_min, created_max;
87 unsigned int topicts_min, topicts_max;
88 };
89
90 struct Client
91 {
92 dlink_node node;
93 dlink_node lnode; /* Used for Server->servers/users */
94
95 struct Client *hnext; /* For client hash table lookups by name */
96 struct Client *idhnext; /* For SID hash table lookups by sid */
97
98 struct Server* serv; /* ...defined, if this is a server */
99 struct Client* servptr; /* Points to server this Client is on */
100 struct Client* from; /* == self, if Local Client, *NEVER* NULL! */
101
102 struct Whowas* whowas; /* Pointers to whowas structs */
103 time_t lasttime; /* ...should be only LOCAL clients? --msa */
104 time_t firsttime; /* time client was created */
105 time_t since; /* last time we parsed something */
106 time_t tsinfo; /* TS on the nick, SVINFO on server */
107 unsigned long connect_id; /* unique connection ID */
108 unsigned int umodes; /* opers, normal users subset */
109 unsigned int flags; /* client flags */
110
111 unsigned short hopcount; /* number of servers to this 0 = local */
112 unsigned short status; /* Client type */
113 unsigned char handler; /* Handler index */
114 unsigned long serial; /* used to enforce 1 send per nick */
115 char *away;
116 /*
117 * client->name is the unique name for a client nick or host
118 */
119 char name[HOSTLEN + 1];
120 char id[IDLEN + 1]; /* client ID, unique ID per client */
121
122 /*
123 * client->username is the username from ident or the USER message,
124 * If the client is idented the USER message is ignored, otherwise
125 * the username part of the USER message is put here prefixed with a
126 * tilde depending on the I:line, Once a client has registered, this
127 * field should be considered read-only.
128 */
129 char username[USERLEN + 1]; /* client's username */
130
131 /*
132 * client->host contains the resolved name or ip address
133 * as a string for the user, it may be fiddled with for oper spoofing etc.
134 * once it's changed the *real* address goes away. This should be
135 * considered a read-only field after the client has registered.
136 */
137 char host[HOSTLEN + 1]; /* client's hostname */
138
139 /*
140 * client->info for unix clients will normally contain the info from the
141 * gcos field in /etc/passwd but anything can go here.
142 */
143 char info[REALLEN + 1]; /* Free form additional client info */
144 char client_host[HOSTLEN + 1];
145 char client_server[HOSTLEN + 1];
146
147 /* client->sockhost contains the ip address gotten from the socket as a
148 * string, this field should be considered read-only once the connection
149 * has been made. (set in s_bsd.c only)
150 */
151 char sockhost[HOSTIPLEN + 1]; /* This is the host name from the
152 socket ip address as string */
153 dlink_list channel; /* chain of channel pointer blocks */
154
155 struct LocalUser *localClient;
156 };
157
158 struct LocalUser
159 {
160 /*
161 * The following fields are allocated only for local clients
162 * (directly connected to *this* server with a socket.
163 */
164 unsigned int registration;
165 unsigned int cap_client; /* Client capabilities (from us) */
166 unsigned int cap_active; /* Active capabilities (to us) */
167
168 /* Anti flooding part, all because of lamers... */
169 time_t last_away; /* Away since... */
170 time_t last_join_time; /* when this client last
171 joined a channel */
172 time_t last_leave_time; /* when this client last
173 * left a channel */
174 int join_leave_count; /* count of JOIN/LEAVE in less than
175 MIN_JOIN_LEAVE_TIME seconds */
176 int oper_warn_count_down; /* warn opers of this possible
177 spambot every time this gets to 0 */
178 time_t reject_delay;
179 time_t last_caller_id_time;
180 time_t first_received_message_time;
181 int received_number_of_privmsgs;
182 int flood_noticed;
183
184 dlink_node lclient_node;
185
186 unsigned int operflags; /* oper priv flags */
187
188 struct ListTask *list_task;
189 /* Send and receive dbufs .. */
190 struct dbuf_queue buf_sendq;
191 struct dbuf_queue buf_recvq;
192
193 struct {
194 unsigned int messages; /* Statistics: protocol messages sent/received */
195 uint64_t bytes; /* Statistics: total bytes sent/received */
196 } recv, send;
197
198 struct Listener *listener; /* listener accepted from */
199 dlink_list acceptlist; /* clients I'll allow to talk to me */
200 dlink_list watches; /* chain of Watch pointer blocks */
201 dlink_list confs; /* Configuration record associated */
202 dlink_list invited; /* chain of invite pointer blocks */
203 struct irc_ssaddr ip;
204 int aftype; /* Makes life easier for DNS res in IPV6 */
205 struct DNSQuery *dns_query; /* result returned from resolver query */
206 time_t last; /* Last time we got a PRIVMSG */
207 time_t last_nick_change;
208 int number_of_nick_changes;
209
210 char *passwd;
211 int caps; /* capabilities bit-field */
212 int enc_caps; /* cipher capabilities bit-field */
213
214 #ifdef HAVE_LIBCRYPTO
215 struct EncCapability *in_cipher;
216 struct EncCapability *out_cipher;
217
218 char in_key[CIPHERKEYLEN];
219 char out_key[CIPHERKEYLEN];
220 #endif
221
222 fde_t fd;
223 fde_t ctrlfd; /* For servers: control fd used for sending commands
224 to servlink */
225
226 struct SlinkRpl slinkrpl; /* slink reply being parsed */
227 char *slinkq; /* sendq for control data */
228 int slinkq_ofs; /* ofset into slinkq */
229 int slinkq_len; /* length remaining after slinkq_ofs */
230
231 struct ZipStats zipstats;
232
233 /* Anti-flood stuff. We track how many messages were parsed and how
234 * many we were allowed in the current second, and apply a simple
235 * decay to avoid flooding.
236 * -- adrian
237 */
238 int allow_read; /* how many we're allowed to read in this second */
239 int sent_parsed; /* how many messages we've parsed in this second */
240 time_t last_knock; /* time of last knock */
241 unsigned long random_ping;
242
243 char* response; /* expected response from client */
244 char* auth_oper; /* Operator to become if they supply the response.*/
245 };
246
247 /*
248 * status macros.
249 */
250 #define STAT_CONNECTING 0x01
251 #define STAT_HANDSHAKE 0x02
252 #define STAT_ME 0x04
253 #define STAT_UNKNOWN 0x08
254 #define STAT_SERVER 0x10
255 #define STAT_CLIENT 0x20
256
257 #define REG_NEED_USER 0x1
258 #define REG_NEED_NICK 0x2
259 #define REG_NEED_CAP 0x4
260 #define REG_INIT (REG_NEED_USER|REG_NEED_NICK)
261
262 #define HasID(x) ((x)->id[0] != '\0')
263 #define ID(x) (HasID(x) ? (x)->id : (x)->name)
264 #define ID_or_name(x,client_p) ((IsCapable(client_p, CAP_TS6) && HasID(x)) ? (x)->id : (x)->name)
265
266 #define IsRegistered(x) ((x)->status > STAT_UNKNOWN)
267 #define IsConnecting(x) ((x)->status == STAT_CONNECTING)
268 #define IsHandshake(x) ((x)->status == STAT_HANDSHAKE)
269 #define IsMe(x) ((x)->status == STAT_ME)
270 #define IsUnknown(x) ((x)->status == STAT_UNKNOWN)
271 #define IsServer(x) ((x)->status == STAT_SERVER)
272 #define IsClient(x) ((x)->status == STAT_CLIENT)
273
274 #define IsOper(x) ((x)->umodes & UMODE_OPER)
275 #define IsAdmin(x) ((x)->umodes & UMODE_ADMIN)
276
277 #define SetConnecting(x) {(x)->status = STAT_CONNECTING; \
278 (x)->handler = UNREGISTERED_HANDLER; }
279
280 #define SetHandshake(x) {(x)->status = STAT_HANDSHAKE; \
281 (x)->handler = UNREGISTERED_HANDLER; }
282
283 #define SetMe(x) {(x)->status = STAT_ME; \
284 (x)->handler = UNREGISTERED_HANDLER; }
285
286 #define SetUnknown(x) {(x)->status = STAT_UNKNOWN; \
287 (x)->handler = UNREGISTERED_HANDLER; }
288
289 #define SetServer(x) {(x)->status = STAT_SERVER; \
290 (x)->handler = SERVER_HANDLER; }
291
292 #define SetClient(x) {(x)->status = STAT_CLIENT; \
293 (x)->handler = IsOper((x)) ? \
294 OPER_HANDLER : CLIENT_HANDLER; }
295
296 #define SetEob(x) ((x)->flags |= FLAGS_EOB)
297 #define HasSentEob(x) ((x)->flags & FLAGS_EOB)
298
299 /*
300 * ts stuff
301 */
302 #define TS_CURRENT 6 /* current TS protocol version */
303 #ifdef TS5_ONLY
304 #define TS_MIN 5
305 #else
306 #define TS_MIN 3 /* minimum supported TS protocol version */
307 #endif
308 #define TS_DOESTS 0x20000000
309 #define DoesTS(x) ((x)->tsinfo == TS_DOESTS)
310
311
312
313 #define CAP_MULTI_PREFIX 0x00000001
314
315 /* housekeeping flags */
316 #define FLAGS_PINGSENT 0x00000001 /* Unreplied ping sent */
317 #define FLAGS_DEADSOCKET 0x00000002 /* Local socket is dead--Exiting soon */
318 #define FLAGS_KILLED 0x00000004 /* Prevents "QUIT" from being sent for this */
319 #define FLAGS_CLOSING 0x00000008 /* set when closing to suppress errors */
320 #define FLAGS_GOTID 0x00000010 /* successful ident lookup achieved */
321 #define FLAGS_NEEDID 0x00000020 /* I-lines say must use ident return */
322 #define FLAGS_SENDQEX 0x00000040 /* Sendq exceeded */
323 #define FLAGS_IPHASH 0x00000080 /* iphashed this client */
324 #define FLAGS_CRYPTIN 0x00000100 /* incoming data must be decrypted */
325 #define FLAGS_CRYPTOUT 0x00000200 /* outgoing data must be encrypted */
326 #define FLAGS_WAITAUTH 0x00000400 /* waiting for CRYPTLINK AUTH command */
327 #define FLAGS_SERVLINK 0x00000800 /* servlink has servlink process */
328 #define FLAGS_MARK 0x00001000 /* marked client */
329 #define FLAGS_CANFLOOD 0x00002000 /* client has the ability to flood */
330 #define FLAGS_EXEMPTGLINE 0x00004000 /* client can't be G-lined */
331 #define FLAGS_EXEMPTKLINE 0x00008000 /* client is exempt from kline */
332 #define FLAGS_NOLIMIT 0x00010000 /* client is exempt from limits */
333 #define FLAGS_RESTRICTED 0x00020000 /* client cannot op others */
334 #define FLAGS_PING_COOKIE 0x00040000 /* PING Cookie */
335 #define FLAGS_IDLE_LINED 0x00080000 /* client is exempt from idle-time limits */
336 #define FLAGS_IP_SPOOFING 0x00100000 /* client IP is spoofed */
337 #define FLAGS_FLOODDONE 0x00200000 /* Flood grace period has been ended. */
338 #define FLAGS_EOB 0x00400000 /* server has received EOB */
339 #define FLAGS_HIDDEN 0x00800000 /* a hidden server. not shown in /links */
340 #define FLAGS_BLOCKED 0x01000000 /* must wait for COMM_SELECT_WRITE */
341 #define FLAGS_SBLOCKED 0x02000000 /* slinkq is blocked */
342 #define FLAGS_USERHOST 0x04000000 /* client is in userhost hash */
343 #define FLAGS_BURSTED 0x08000000 /* user was already bursted */
344 #define FLAGS_EXEMPTRESV 0x10000000 /* client is exempt from RESV */
345 #define FLAGS_GOTUSER 0x20000000 /* if we received a USER command */
346 #define FLAGS_PINGWARNING 0x40000000 /* unreplied ping warning already sent */
347 #define FLAGS_FINISHED_AUTH 0x80000000 /* Client has been released from auth */
348
349
350 /* umodes, settable flags */
351 #define UMODE_SERVNOTICE 0x00000001 /* server notices such as kill */
352 #define UMODE_CCONN 0x00000002 /* Client Connections */
353 #define UMODE_REJ 0x00000004 /* Bot Rejections */
354 #define UMODE_SKILL 0x00000008 /* Server Killed */
355 #define UMODE_FULL 0x00000010 /* Full messages */
356 #define UMODE_SPY 0x00000020 /* see STATS / LINKS */
357 #define UMODE_DEBUG 0x00000040 /* 'debugging' info */
358 #define UMODE_NCHANGE 0x00000080 /* Nick change notice */
359 #define UMODE_WALLOP 0x00000100 /* send wallops to them */
360 #define UMODE_OPERWALL 0x00000200 /* Operwalls */
361 #define UMODE_INVISIBLE 0x00000400 /* makes user invisible */
362 #define UMODE_BOTS 0x00000800 /* shows bots */
363 #define UMODE_EXTERNAL 0x00001000 /* show servers introduced and splitting */
364 #define UMODE_CALLERID 0x00002000 /* block unless caller id's */
365 #define UMODE_SOFTCALLERID 0x00004000 /* block unless on common channel */
366 #define UMODE_UNAUTH 0x00008000 /* show unauth connects here */
367 #define UMODE_LOCOPS 0x00010000 /* show locops */
368 #define UMODE_DEAF 0x00020000 /* don't receive channel messages */
369 #define UMODE_CCONN_FULL 0x00040000 /* add unused fields to connection monitoring */
370
371 /* user information flags, only settable by remote mode or local oper */
372 #define UMODE_OPER 0x40000000 /* Operator */
373 #define UMODE_ADMIN 0x80000000 /* Admin on server */
374
375 #define UMODE_ALL UMODE_SERVNOTICE
376
377 #define SEND_UMODES (UMODE_INVISIBLE | UMODE_OPER | UMODE_WALLOP | \
378 UMODE_ADMIN)
379
380
381 /* oper priv flags */
382 #define OPER_FLAG_GLOBAL_KILL 0x00000001 /* oper can global kill */
383 #define OPER_FLAG_REMOTE 0x00000002 /* oper can do squits/connects */
384 #define OPER_FLAG_UNKLINE 0x00000004 /* oper can use unkline */
385 #define OPER_FLAG_GLINE 0x00000008 /* oper can use gline */
386 #define OPER_FLAG_N 0x00000010 /* oper can umode n */
387 #define OPER_FLAG_K 0x00000020 /* oper can kill/kline */
388 #define OPER_FLAG_X 0x00000040 /* oper can xline */
389 #define OPER_FLAG_DIE 0x00000080 /* oper can die */
390 #define OPER_FLAG_REHASH 0x00000100 /* oper can rehash */
391 #define OPER_FLAG_ADMIN 0x00000200 /* oper can set umode +a */
392 #define OPER_FLAG_HIDDEN_ADMIN 0x00000400 /* admin is hidden */
393 #define OPER_FLAG_OPERWALL 0x00000800 /* */
394 #define OPER_FLAG_OPER_SPY 0x00001000 /* */
395 #define OPER_FLAG_REMOTEBAN 0x00002000 /* */
396 #define OPER_FLAG_HIDDEN_OPER 0x00004000 /* */
397
398 #define SetOFlag(x, y) ((x)->localClient->operflags |= (y))
399
400
401 /* flags macros. */
402 #define IsAuthFinished(x) ((x)->flags & FLAGS_FINISHED_AUTH)
403 #define IsDead(x) ((x)->flags & FLAGS_DEADSOCKET)
404 #define SetDead(x) ((x)->flags |= FLAGS_DEADSOCKET)
405 #define IsClosing(x) ((x)->flags & FLAGS_CLOSING)
406 #define SetClosing(x) ((x)->flags |= FLAGS_CLOSING)
407 #define IsKilled(x) ((x)->flags & FLAGS_KILLED)
408 #define SetKilled(x) ((x)->flags |= FLAGS_KILLED)
409 #define IsCryptIn(x) ((x)->flags & FLAGS_CRYPTIN)
410 #define SetCryptIn(x) ((x)->flags |= FLAGS_CRYPTIN)
411 #define IsCryptOut(x) ((x)->flags & FLAGS_CRYPTOUT)
412 #define SetCryptOut(x) ((x)->flags |= FLAGS_CRYPTOUT)
413 #define IsWaitAuth(x) ((x)->flags & FLAGS_WAITAUTH)
414 #define SetWaitAuth(x) ((x)->flags |= FLAGS_WAITAUTH)
415 #define ClearWaitAuth(x) ((x)->flags &= ~FLAGS_WAITAUTH)
416 #define HasServlink(x) ((x)->flags & FLAGS_SERVLINK)
417 #define SetServlink(x) ((x)->flags |= FLAGS_SERVLINK)
418 #define MyConnect(x) ((x)->localClient != NULL)
419 #define MyClient(x) (MyConnect(x) && IsClient(x))
420 #define SetMark(x) ((x)->flags |= FLAGS_MARK)
421 #define ClearMark(x) ((x)->flags &= ~FLAGS_MARK)
422 #define IsMarked(x) ((x)->flags & FLAGS_MARK)
423 #define SetCanFlood(x) ((x)->flags |= FLAGS_CANFLOOD)
424 #define IsCanFlood(x) ((x)->flags & FLAGS_CANFLOOD)
425 #define IsDefunct(x) ((x)->flags & (FLAGS_DEADSOCKET|FLAGS_CLOSING| \
426 FLAGS_KILLED))
427
428 /* oper flags */
429 #define MyOper(x) (MyConnect(x) && IsOper(x))
430
431 #define SetOper(x) {(x)->umodes |= UMODE_OPER; \
432 if (!IsServer((x))) (x)->handler = OPER_HANDLER;}
433
434 #define ClearOper(x) {(x)->umodes &= ~(UMODE_OPER|UMODE_ADMIN); \
435 if (!IsOper((x)) && !IsServer((x))) \
436 (x)->handler = CLIENT_HANDLER; }
437
438 #define IsPrivileged(x) (IsOper(x) || IsServer(x))
439
440 /* umode flags */
441 #define IsInvisible(x) ((x)->umodes & UMODE_INVISIBLE)
442 #define SendWallops(x) ((x)->umodes & UMODE_WALLOP)
443 #define IsSetCallerId(x) ((x)->umodes & \
444 (UMODE_CALLERID|UMODE_SOFTCALLERID))
445 #define IsSoftCallerId(x) ((x)->umodes & UMODE_SOFTCALLERID)
446 #define IsDeaf(x) ((x)->umodes & UMODE_DEAF)
447 #define IsFull(x) ((x)->umodes & UMODE_CCONN_FULL)
448
449 #define SetSendQExceeded(x) ((x)->flags |= FLAGS_SENDQEX)
450 #define IsSendQExceeded(x) ((x)->flags & FLAGS_SENDQEX)
451
452 #define SetIpHash(x) ((x)->flags |= FLAGS_IPHASH)
453 #define ClearIpHash(x) ((x)->flags &= ~FLAGS_IPHASH)
454 #define IsIpHash(x) ((x)->flags & FLAGS_IPHASH)
455
456 #define SetUserHost(x) ((x)->flags |= FLAGS_USERHOST)
457 #define ClearUserHost(x) ((x)->flags &= ~FLAGS_USERHOST)
458 #define IsUserHostIp(x) ((x)->flags & FLAGS_USERHOST)
459
460 #define SetPingSent(x) ((x)->flags |= FLAGS_PINGSENT)
461 #define IsPingSent(x) ((x)->flags & FLAGS_PINGSENT)
462 #define ClearPingSent(x) ((x)->flags &= ~FLAGS_PINGSENT)
463
464 #define SetPingWarning(x) ((x)->flags |= FLAGS_PINGWARNING)
465 #define IsPingWarning(x) ((x)->flags & FLAGS_PINGWARNING)
466 #define ClearPingWarning(x) ((x)->flags &= ~FLAGS_PINGWARNING)
467
468 #define SetNeedId(x) ((x)->flags |= FLAGS_NEEDID)
469 #define IsNeedId(x) ((x)->flags & FLAGS_NEEDID)
470
471 #define SetGotId(x) ((x)->flags |= FLAGS_GOTID)
472 #define IsGotId(x) ((x)->flags & FLAGS_GOTID)
473
474 #define IsExemptKline(x) ((x)->flags & FLAGS_EXEMPTKLINE)
475 #define SetExemptKline(x) ((x)->flags |= FLAGS_EXEMPTKLINE)
476 #define IsExemptLimits(x) ((x)->flags & FLAGS_NOLIMIT)
477 #define SetExemptLimits(x) ((x)->flags |= FLAGS_NOLIMIT)
478 #define IsExemptGline(x) ((x)->flags & FLAGS_EXEMPTGLINE)
479 #define SetExemptGline(x) ((x)->flags |= FLAGS_EXEMPTGLINE)
480 #define IsExemptResv(x) ((x)->flags & FLAGS_EXEMPTRESV)
481 #define SetExemptResv(x) ((x)->flags |= FLAGS_EXEMPTRESV)
482 #define SetIPSpoof(x) ((x)->flags |= FLAGS_IP_SPOOFING)
483 #define IsIPSpoof(x) ((x)->flags & FLAGS_IP_SPOOFING)
484
485 #define IsIdlelined(x) ((x)->flags & FLAGS_IDLE_LINED)
486 #define SetIdlelined(x) ((x)->flags |= FLAGS_IDLE_LINED)
487 #define IsRestricted(x) ((x)->flags & FLAGS_RESTRICTED)
488 #define SetRestricted(x) ((x)->flags |= FLAGS_RESTRICTED)
489
490 #define IsFloodDone(x) ((x)->flags & FLAGS_FLOODDONE)
491 #define SetFloodDone(x) ((x)->flags |= FLAGS_FLOODDONE)
492 #define HasPingCookie(x) ((x)->flags & FLAGS_PING_COOKIE)
493 #define SetPingCookie(x) ((x)->flags |= FLAGS_PING_COOKIE)
494 #define IsHidden(x) ((x)->flags & FLAGS_HIDDEN)
495 #define SetHidden(x) ((x)->flags |= FLAGS_HIDDEN)
496
497 #define IsSendqBlocked(x) ((x)->flags & FLAGS_BLOCKED)
498 #define SetSendqBlocked(x) ((x)->flags |= FLAGS_BLOCKED)
499 #define ClearSendqBlocked(x) ((x)->flags &= ~FLAGS_BLOCKED)
500 #define IsSlinkqBlocked(x) ((x)->flags & FLAGS_SBLOCKED)
501 #define SetSlinkqBlocked(x) ((x)->flags |= FLAGS_SBLOCKED)
502 #define ClearSlinkqBlocked(x) ((x)->flags &= ~FLAGS_SBLOCKED)
503
504 #define IsBursted(x) ((x)->flags & FLAGS_BURSTED)
505 #define SetBursted(x) ((x)->flags |= FLAGS_BURSTED)
506 #define ClearBursted(x) ((x)->flags &= ~FLAGS_BURSTED)
507
508 #define IsCaptured(x) ((x)->handler == DUMMY_HANDLER)
509 #define SetCaptured(x) ((x)->handler = DUMMY_HANDLER)
510 #define ClearCaptured(x) ((x)->handler = CLIENT_HANDLER)
511
512 /* operflags macros */
513 #define ClearOperFlags(x) ((x)->localClient->operflags = 0)
514 #define IsOperGlobalKill(x) (MyConnect(x) ? (x)->localClient->operflags & OPER_FLAG_GLOBAL_KILL : 0)
515 #define IsOperRemote(x) (MyConnect(x) ? (x)->localClient->operflags & OPER_FLAG_REMOTE : 0)
516 #define IsOperUnkline(x) (MyConnect(x) ? (x)->localClient->operflags & OPER_FLAG_UNKLINE : 0)
517 #define IsOperGline(x) (MyConnect(x) ? (x)->localClient->operflags & OPER_FLAG_GLINE : 0)
518 #define IsOperN(x) (MyConnect(x) ? (x)->localClient->operflags & OPER_FLAG_N : 0)
519 #define IsOperK(x) (MyConnect(x) ? (x)->localClient->operflags & OPER_FLAG_K : 0)
520 #define IsOperDie(x) (MyConnect(x) ? (x)->localClient->operflags & OPER_FLAG_DIE : 0)
521 #define IsOperRehash(x) (MyConnect(x) ? (x)->localClient->operflags & OPER_FLAG_REHASH : 0)
522 #define IsOperAdmin(x) (MyConnect(x) ? (x)->localClient->operflags & OPER_FLAG_ADMIN : 0)
523 #define IsOperHiddenAdmin(x) (MyConnect(x) ? (x)->localClient->operflags & OPER_FLAG_HIDDEN_ADMIN : 0)
524 #define IsOperX(x) (MyConnect(x) ? (x)->localClient->operflags & OPER_FLAG_X : 0)
525 #define IsOperWall(x) (MyConnect(x) ? (x)->localClient->operflags & OPER_FLAG_OPERWALL : 0)
526 #define IsOperRemoteBan(x) (MyConnect(x) ? (x)->localClient->operflags & OPER_FLAG_REMOTEBAN : 0)
527 #define IsOperHidden(x) (MyConnect(x) ? (x)->localClient->operflags & OPER_FLAG_HIDDEN_OPER : 0)
528
529 /*
530 * definitions for get_client_name
531 * TBD - make this an enum
532 */
533 #define HIDE_IP 0
534 #define SHOW_IP 1
535 #define MASK_IP 2
536
537 extern struct Client me;
538 extern dlink_list listing_client_list;
539 extern dlink_list global_client_list;
540
541 extern int accept_message(struct Client *, struct Client *);
542 extern struct split_nuh_item *find_accept(const char *, const char *,
543 const char *, struct Client *, int);
544 extern void del_accept(struct split_nuh_item *, struct Client *);
545 extern void del_all_accepts(struct Client *);
546 extern void set_initial_nick(struct Client *, struct Client *, const char *);
547 extern void exit_client(struct Client *, struct Client *, const char *);
548 extern void check_conf_klines(void);
549 extern void init_client(void);
550 extern void change_local_nick(struct Client *, struct Client *, const char *);
551 extern void dead_link_on_write(struct Client *, int);
552 extern void dead_link_on_read(struct Client *, int);
553 extern void exit_aborted_clients(void);
554 extern void free_exited_clients(void);
555 extern struct Client *make_client(struct Client *);
556 extern struct Client *find_chasing(struct Client *, struct Client *, const char *, int *);
557 extern struct Client *find_person(const struct Client *const, const char *);
558 extern const char *get_client_name(struct Client *, int);
559
560 #endif /* INCLUDED_client_h */

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision