2 * IRC - Internet Relay Chat, include/client.h
3 * Copyright (C) 1990 Jarkko Oikarinen and
4 * University of Oulu, Computing Center
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #ifndef INCLUDED_client_h
24 #define INCLUDED_client_h
25 #ifndef INCLUDED_ircd_defs_h
26 #include "ircd_defs.h"
28 #ifndef INCLUDED_dbuf_h
31 #ifndef INCLUDED_msgq_h
34 #ifndef INCLUDED_ircd_events_h
35 #include "ircd_events.h"
37 #ifndef INCLUDED_ircd_handler_h
38 #include "ircd_handler.h"
40 #ifndef INCLUDED_sys_types_h
41 #include <sys/types.h> /* time_t, size_t */
42 #define INCLUDED_sys_types_h
44 #ifndef INCLUDED_netinet_in_h
45 #include <netinet/in.h> /* in_addr */
46 #define INCLUDED_netinet_in_h
64 * Only put structures here that are being used in a very large number of
65 * source files. Other structures go in the header file of there corresponding
66 * source file, or in the source file itself (when only used in that file).
69 #define PRIV_CHAN_LIMIT 1 /* no channel limit on oper */
70 #define PRIV_MODE_LCHAN 2 /* oper can mode local chans */
71 #define PRIV_WALK_LCHAN 3 /* oper can walk thru local modes */
72 #define PRIV_DEOP_LCHAN 4 /* no deop oper on local chans */
73 #define PRIV_SHOW_INVIS 5 /* show local invisible users */
74 #define PRIV_SHOW_ALL_INVIS 6 /* show all invisible users */
75 #define PRIV_UNLIMIT_QUERY 7 /* unlimit who queries */
77 #define PRIV_KILL 8 /* oper can KILL */
78 #define PRIV_LOCAL_KILL 9 /* oper can local KILL */
79 #define PRIV_REHASH 10 /* oper can REHASH */
80 #define PRIV_RESTART 11 /* oper can RESTART */
81 #define PRIV_DIE 12 /* oper can DIE */
82 #define PRIV_GLINE 13 /* oper can GLINE */
83 #define PRIV_LOCAL_GLINE 14 /* oper can local GLINE */
84 #define PRIV_JUPE 15 /* oper can JUPE */
85 #define PRIV_LOCAL_JUPE 16 /* oper can local JUPE */
86 #define PRIV_OPMODE 17 /* oper can OP/CLEARMODE */
87 #define PRIV_LOCAL_OPMODE 18 /* oper can local OP/CLEARMODE */
88 #define PRIV_SET 19 /* oper can SET */
89 #define PRIV_WHOX 20 /* oper can use /who x */
90 #define PRIV_BADCHAN 21 /* oper can BADCHAN */
91 #define PRIV_LOCAL_BADCHAN 22 /* oper can local BADCHAN */
92 #define PRIV_SEE_CHAN 23 /* oper can see in secret chans */
94 #define PRIV_PROPAGATE 24 /* propagate oper status */
95 #define PRIV_DISPLAY 25 /* "Is an oper" displayed */
96 #define PRIV_SEE_OPERS 26 /* display hidden opers */
98 #define PRIV_LAST_PRIV 26 /* must be the same as the last priv */
100 #define _PRIV_NBITS (8 * sizeof(unsigned long))
102 #define _PRIV_IDX(priv) ((priv) / _PRIV_NBITS)
103 #define _PRIV_BIT(priv) (1 << ((priv) % _PRIV_NBITS))
106 unsigned long priv_mask[(PRIV_LAST_PRIV / _PRIV_NBITS) + 1];
111 * The following fields are allocated only for local clients
112 * (directly connected to *this* server with a socket.
113 * The first of them *MUST* be the "count"--it is the field
114 * to which the allocation is tied to! *Never* refer to
115 * these fields, if (from != self).
117 unsigned long con_magic; /* magic number */
118 struct Connection* con_next; /* Next connection with queued data */
119 struct Connection** con_prev_p; /* What points to us */
120 struct Client* con_client; /* Client associated with connection */
121 unsigned int con_count; /* Amount of data in buffer */
122 int con_fd; /* >= 0, for local clients */
123 int con_freeflag; /* indicates if connection can be freed */
124 int con_error; /* last socket level error for client */
125 unsigned int con_snomask; /* mask for server messages */
126 time_t con_nextnick; /* Next time a nick change is allowed */
127 time_t con_nexttarget;/* Next time a target change is allowed */
128 unsigned int con_cookie; /* Random number the user must PONG */
129 struct MsgQ con_sendQ; /* Outgoing message queue--if socket full */
130 struct DBuf con_recvQ; /* Hold for data incoming yet to be parsed */
131 unsigned int con_sendM; /* Statistics: protocol messages send */
132 unsigned int con_sendK; /* Statistics: total k-bytes send */
133 unsigned int con_receiveM;/* Statistics: protocol messages received */
134 unsigned int con_receiveK; /* Statistics: total k-bytes received */
135 unsigned short con_sendB; /* counters to count upto 1-k lots of bytes */
136 unsigned short con_receiveB; /* sent and received. */
137 struct Listener* con_listener; /* listening client which we accepted
139 struct SLink* con_confs; /* Configuration record associated */
140 HandlerType con_handler; /* message index into command table
142 struct DNSReply* con_dns_reply; /* DNS reply used during client
144 struct ListingArgs* con_listing;
145 unsigned int con_max_sendq; /* cached max send queue for client */
146 unsigned int con_ping_freq; /* cached ping freq from client conf
148 unsigned short con_lastsq; /* # 2k blocks when sendqueued called last */
149 unsigned short con_port; /* and the remote port# too :-) */
150 unsigned char con_targets[MAXTARGETS]; /* Hash values of current
152 char con_sock_ip[SOCKIPLEN + 1]; /* this is the ip address as a string */
153 char con_sockhost[HOSTLEN + 1]; /* This is the host name from the socket and
154 after which the connection was accepted. */
155 char con_passwd[PASSWDLEN + 1];
156 char con_buffer[BUFSIZE]; /* Incoming message buffer; or the error that
157 caused this clients socket to be `dead' */
158 struct Socket con_socket; /* socket descriptor for client */
159 struct Timer con_proc; /* process latent messages from client */
160 struct AuthRequest* con_auth; /* auth request for client */
163 #define CONNECTION_MAGIC 0x12f955f3
166 unsigned long cli_magic; /* magic number */
167 struct Client* cli_next; /* link in GlobalClientList */
168 struct Client* cli_prev; /* link in GlobalClientList */
169 struct Client* cli_hnext; /* link in hash table bucket or this */
170 struct Connection* cli_connect; /* Connection structure associated with us */
171 struct User* cli_user; /* ...defined, if this is a User */
172 struct Server* cli_serv; /* ...defined, if this is a server */
173 struct Whowas* cli_whowas; /* Pointer to ww struct to be freed on quit */
174 char cli_yxx[4]; /* Numeric Nick: YMM if this is a server,
175 XX0 if this is a user */
177 * XXX - move these to local part for next release
180 time_t cli_lasttime; /* last time data read from socket */
181 time_t cli_since; /* last time we parsed something, flood control */
183 time_t cli_firsttime; /* time client was created */
184 time_t cli_lastnick; /* TimeStamp on nick */
185 int cli_marker; /* /who processing marker */
186 unsigned int cli_flags; /* client flags */
187 unsigned int cli_hopcount; /* number of servers to this 0 = local */
188 struct in_addr cli_ip; /* Real ip# NOT defined for remote servers! */
189 short cli_status; /* Client type */
190 unsigned char cli_local; /* local or remote client */
191 struct Privs cli_privs; /* Oper privileges */
192 char cli_name[HOSTLEN + 1]; /* Unique name of the client, nick or host */
193 char cli_username[USERLEN + 1]; /* username here now for auth stuff */
194 char cli_info[REALLEN + 1]; /* Free form additional client information */
197 #define CLIENT_MAGIC 0x4ca08286
199 #define cli_verify(cli) ((cli)->cli_magic == CLIENT_MAGIC)
200 #define cli_magic(cli) ((cli)->cli_magic)
201 #define cli_next(cli) ((cli)->cli_next)
202 #define cli_prev(cli) ((cli)->cli_prev)
203 #define cli_hnext(cli) ((cli)->cli_hnext)
204 #define cli_connect(cli) ((cli)->cli_connect)
205 #define cli_from(cli) ((cli)->cli_connect->con_client)
206 #define cli_user(cli) ((cli)->cli_user)
207 #define cli_serv(cli) ((cli)->cli_serv)
208 #define cli_whowas(cli) ((cli)->cli_whowas)
209 #define cli_yxx(cli) ((cli)->cli_yxx)
210 #define cli_lasttime(cli) ((cli)->cli_lasttime)
211 #define cli_since(cli) ((cli)->cli_since)
212 #define cli_firsttime(cli) ((cli)->cli_firsttime)
213 #define cli_lastnick(cli) ((cli)->cli_lastnick)
214 #define cli_marker(cli) ((cli)->cli_marker)
215 #define cli_flags(cli) ((cli)->cli_flags)
216 #define cli_hopcount(cli) ((cli)->cli_hopcount)
217 #define cli_ip(cli) ((cli)->cli_ip)
218 #define cli_status(cli) ((cli)->cli_status)
219 #define cli_local(cli) ((cli)->cli_local)
220 #define cli_privs(cli) ((cli)->cli_privs)
221 #define cli_name(cli) ((cli)->cli_name)
222 #define cli_username(cli) ((cli)->cli_username)
223 #define cli_info(cli) ((cli)->cli_info)
225 #define cli_count(cli) ((cli)->cli_connect->con_count)
226 #define cli_fd(cli) ((cli)->cli_connect->con_fd)
227 #define cli_freeflag(cli) ((cli)->cli_connect->con_freeflag)
228 #define cli_error(cli) ((cli)->cli_connect->con_error)
229 #define cli_snomask(cli) ((cli)->cli_connect->con_snomask)
230 #define cli_nextnick(cli) ((cli)->cli_connect->con_nextnick)
231 #define cli_nexttarget(cli) ((cli)->cli_connect->con_nexttarget)
232 #define cli_cookie(cli) ((cli)->cli_connect->con_cookie)
233 #define cli_sendQ(cli) ((cli)->cli_connect->con_sendQ)
234 #define cli_recvQ(cli) ((cli)->cli_connect->con_recvQ)
235 #define cli_sendM(cli) ((cli)->cli_connect->con_sendM)
236 #define cli_sendK(cli) ((cli)->cli_connect->con_sendK)
237 #define cli_receiveM(cli) ((cli)->cli_connect->con_receiveM)
238 #define cli_receiveK(cli) ((cli)->cli_connect->con_receiveK)
239 #define cli_sendB(cli) ((cli)->cli_connect->con_sendB)
240 #define cli_receiveB(cli) ((cli)->cli_connect->con_receiveB)
241 #define cli_listener(cli) ((cli)->cli_connect->con_listener)
242 #define cli_confs(cli) ((cli)->cli_connect->con_confs)
243 #define cli_handler(cli) ((cli)->cli_connect->con_handler)
244 #define cli_dns_reply(cli) ((cli)->cli_connect->con_dns_reply)
245 #define cli_listing(cli) ((cli)->cli_connect->con_listing)
246 #define cli_max_sendq(cli) ((cli)->cli_connect->con_max_sendq)
247 #define cli_ping_freq(cli) ((cli)->cli_connect->con_ping_freq)
248 #define cli_lastsq(cli) ((cli)->cli_connect->con_lastsq)
249 #define cli_port(cli) ((cli)->cli_connect->con_port)
250 #define cli_targets(cli) ((cli)->cli_connect->con_targets)
251 #define cli_sock_ip(cli) ((cli)->cli_connect->con_sock_ip)
252 #define cli_sockhost(cli) ((cli)->cli_connect->con_sockhost)
253 #define cli_passwd(cli) ((cli)->cli_connect->con_passwd)
254 #define cli_buffer(cli) ((cli)->cli_connect->con_buffer)
255 #define cli_socket(cli) ((cli)->cli_connect->con_socket)
256 #define cli_proc(cli) ((cli)->cli_connect->con_proc)
257 #define cli_auth(cli) ((cli)->cli_connect->con_auth)
259 #define con_verify(con) ((con)->con_magic == CONNECTION_MAGIC)
260 #define con_magic(con) ((con)->con_magic)
261 #define con_next(con) ((con)->con_next)
262 #define con_prev_p(con) ((con)->con_prev_p)
263 #define con_client(con) ((con)->con_client)
264 #define con_count(con) ((con)->con_count)
265 #define con_fd(con) ((con)->con_fd)
266 #define con_freeflag(con) ((con)->con_freeflag)
267 #define con_error(con) ((con)->con_error)
268 #define con_snomask(con) ((con)->con_snomask)
269 #define con_nextnick(con) ((con)->con_nextnick)
270 #define con_nexttarget(con) ((con)->con_nexttarget)
271 #define con_cookie(con) ((con)->con_cookie)
272 #define con_sendQ(con) ((con)->con_sendQ)
273 #define con_recvQ(con) ((con)->con_recvQ)
274 #define con_sendM(con) ((con)->con_sendM)
275 #define con_sendK(con) ((con)->con_sendK)
276 #define con_receiveM(con) ((con)->con_receiveM)
277 #define con_receiveK(con) ((con)->con_receiveK)
278 #define con_sendB(con) ((con)->con_sendB)
279 #define con_receiveB(con) ((con)->con_receiveB)
280 #define con_listener(con) ((con)->con_listener)
281 #define con_confs(con) ((con)->con_confs)
282 #define con_handler(con) ((con)->con_handler)
283 #define con_dns_reply(con) ((con)->con_dns_reply)
284 #define con_listing(con) ((con)->con_listing)
285 #define con_max_sendq(con) ((con)->con_max_sendq)
286 #define con_ping_freq(con) ((con)->con_ping_freq)
287 #define con_lastsq(con) ((con)->con_lastsq)
288 #define con_port(con) ((con)->con_port)
289 #define con_targets(con) ((con)->con_targets)
290 #define con_sock_ip(con) ((con)->con_sock_ip)
291 #define con_sockhost(con) ((con)->con_sockhost)
292 #define con_passwd(con) ((con)->con_passwd)
293 #define con_buffer(con) ((con)->con_buffer)
294 #define con_socket(con) ((con)->con_socket)
295 #define con_proc(con) ((con)->con_proc)
296 #define con_auth(con) ((con)->con_auth)
298 #define STAT_CONNECTING 0x001 /* connecting to another server */
299 #define STAT_HANDSHAKE 0x002 /* pass - server sent */
300 #define STAT_ME 0x004 /* this server */
301 #define STAT_UNKNOWN 0x008 /* unidentified connection */
302 #define STAT_UNKNOWN_USER 0x010 /* Connect to client port */
303 #define STAT_UNKNOWN_SERVER 0x020 /* Connect to server port */
304 #define STAT_SERVER 0x040
305 #define STAT_USER 0x080
310 #define IsRegistered(x) (cli_status(x) & (STAT_SERVER | STAT_USER))
311 #define IsConnecting(x) (cli_status(x) == STAT_CONNECTING)
312 #define IsHandshake(x) (cli_status(x) == STAT_HANDSHAKE)
313 #define IsMe(x) (cli_status(x) == STAT_ME)
314 #define IsUnknown(x) (cli_status(x) & \
315 (STAT_UNKNOWN | STAT_UNKNOWN_USER | STAT_UNKNOWN_SERVER))
317 #define IsServerPort(x) (cli_status(x) == STAT_UNKNOWN_SERVER )
318 #define IsUserPort(x) (cli_status(x) == STAT_UNKNOWN_USER )
319 #define IsClient(x) (cli_status(x) & \
320 (STAT_HANDSHAKE | STAT_ME | STAT_UNKNOWN |\
321 STAT_UNKNOWN_USER | STAT_UNKNOWN_SERVER | STAT_SERVER | STAT_USER))
323 #define IsTrusted(x) (cli_status(x) & \
324 (STAT_CONNECTING | STAT_HANDSHAKE | STAT_ME | STAT_SERVER))
326 #define IsServer(x) (cli_status(x) == STAT_SERVER)
327 #define IsUser(x) (cli_status(x) == STAT_USER)
330 #define SetConnecting(x) (cli_status(x) = STAT_CONNECTING)
331 #define SetHandshake(x) (cli_status(x) = STAT_HANDSHAKE)
332 #define SetServer(x) (cli_status(x) = STAT_SERVER)
333 #define SetMe(x) (cli_status(x) = STAT_ME)
334 #define SetUser(x) (cli_status(x) = STAT_USER)
336 #define MyConnect(x) (cli_from(x) == (x))
337 #define MyUser(x) (MyConnect(x) && IsUser(x))
338 #define MyOper(x) (MyConnect(x) && IsOper(x))
339 #define Protocol(x) ((cli_serv(x))->prot)
341 #define PARSE_AS_SERVER(x) (cli_status(x) & \
342 (STAT_SERVER | STAT_CONNECTING | STAT_HANDSHAKE))
347 #define FLAGS_PINGSENT 0x0001 /* Unreplied ping sent */
348 #define FLAGS_DEADSOCKET 0x0002 /* Local socket is dead--Exiting soon */
349 #define FLAGS_KILLED 0x0004 /* Prevents "QUIT" from being sent for this */
350 #define FLAGS_OPER 0x0008 /* Operator */
351 #define FLAGS_LOCOP 0x0010 /* Local operator -- SRB */
352 #define FLAGS_INVISIBLE 0x0020 /* makes user invisible */
353 #define FLAGS_WALLOP 0x0040 /* send wallops to them */
354 #define FLAGS_SERVNOTICE 0x0080 /* server notices such as kill */
355 #define FLAGS_BLOCKED 0x0100 /* socket is in a blocked condition */
356 #define FLAGS_CLOSING 0x0400 /* set when closing to suppress errors */
357 #define FLAGS_UPING 0x0800 /* has active UDP ping request */
358 #define FLAGS_CHKACCESS 0x1000 /* ok to check clients access if set */
359 #define FLAGS_LOCAL 0x00010000 /* set for local clients */
360 #define FLAGS_GOTID 0x00020000 /* successful ident lookup achieved */
361 #define FLAGS_DOID 0x00040000 /* I-lines say must use ident return */
362 #define FLAGS_NONL 0x00080000 /* No \n in buffer */
363 #define FLAGS_TS8 0x00100000 /* Why do you want to know? */
364 #define FLAGS_MAP 0x00800000 /* Show server on the map */
365 #define FLAGS_JUNCTION 0x01000000 /* Junction causing the net.burst */
366 #define FLAGS_DEAF 0x02000000 /* Makes user deaf */
367 #define FLAGS_CHSERV 0x04000000 /* Disallow KICK or MODE -o on the user;
368 don't display channels in /whois */
369 #define FLAGS_BURST 0x08000000 /* Server is receiving a net.burst */
370 #define FLAGS_BURST_ACK 0x10000000 /* Server is waiting for eob ack */
371 #define FLAGS_DEBUG 0x20000000 /* send global debug/anti-hack info */
372 #define FLAGS_IPCHECK 0x40000000 /* Added or updated IPregistry data */
374 #define SEND_UMODES \
375 (FLAGS_INVISIBLE|FLAGS_OPER|FLAGS_WALLOP|FLAGS_DEAF|FLAGS_CHSERV|FLAGS_DEBUG)
376 #define ALL_UMODES (SEND_UMODES|FLAGS_SERVNOTICE|FLAGS_LOCOP)
377 #define FLAGS_ID (FLAGS_DOID|FLAGS_GOTID)
382 #define DoAccess(x) (cli_flags(x) & FLAGS_CHKACCESS)
383 #define IsAnOper(x) (cli_flags(x) & (FLAGS_OPER|FLAGS_LOCOP))
384 #define IsBlocked(x) (cli_flags(x) & FLAGS_BLOCKED)
385 #define IsBurst(x) (cli_flags(x) & FLAGS_BURST)
386 #define IsBurstAck(x) (cli_flags(x) & FLAGS_BURST_ACK)
387 #define IsBurstOrBurstAck(x) (cli_flags(x) & (FLAGS_BURST|FLAGS_BURST_ACK))
388 #define IsChannelService(x) (cli_flags(x) & FLAGS_CHSERV)
389 #define IsDead(x) (cli_flags(x) & FLAGS_DEADSOCKET)
390 #define IsDeaf(x) (cli_flags(x) & FLAGS_DEAF)
391 #define IsIPChecked(x) (cli_flags(x) & FLAGS_IPCHECK)
392 #define IsIdented(x) (cli_flags(x) & FLAGS_GOTID)
393 #define IsInvisible(x) (cli_flags(x) & FLAGS_INVISIBLE)
394 #define IsJunction(x) (cli_flags(x) & FLAGS_JUNCTION)
395 #define IsLocOp(x) (cli_flags(x) & FLAGS_LOCOP)
396 #define IsLocal(x) (cli_flags(x) & FLAGS_LOCAL)
397 #define IsOper(x) (cli_flags(x) & FLAGS_OPER)
398 #define IsUPing(x) (cli_flags(x) & FLAGS_UPING)
399 #define NoNewLine(x) (cli_flags(x) & FLAGS_NONL)
400 #define SendDebug(x) (cli_flags(x) & FLAGS_DEBUG)
401 #define SendServNotice(x) (cli_flags(x) & FLAGS_SERVNOTICE)
402 #define SendWallops(x) (cli_flags(x) & FLAGS_WALLOP)
404 #define IsPrivileged(x) (IsAnOper(x) || IsServer(x))
406 #define SetAccess(x) (cli_flags(x) |= FLAGS_CHKACCESS)
407 #define SetBurst(x) (cli_flags(x) |= FLAGS_BURST)
408 #define SetBurstAck(x) (cli_flags(x) |= FLAGS_BURST_ACK)
409 #define SetChannelService(x) (cli_flags(x) |= FLAGS_CHSERV)
410 #define SetDeaf(x) (cli_flags(x) |= FLAGS_DEAF)
411 #define SetDebug(x) (cli_flags(x) |= FLAGS_DEBUG)
412 #define SetGotId(x) (cli_flags(x) |= FLAGS_GOTID)
413 #define SetIPChecked(x) (cli_flags(x) |= FLAGS_IPCHECK)
414 #define SetInvisible(x) (cli_flags(x) |= FLAGS_INVISIBLE)
415 #define SetJunction(x) (cli_flags(x) |= FLAGS_JUNCTION)
416 #define SetLocOp(x) (cli_flags(x) |= FLAGS_LOCOP)
417 #define SetOper(x) (cli_flags(x) |= FLAGS_OPER)
418 #define SetUPing(x) (cli_flags(x) |= FLAGS_UPING)
419 #define SetWallops(x) (cli_flags(x) |= FLAGS_WALLOP)
420 #define SetServNotice(x) (cli_flags(x) |= FLAGS_SERVNOTICE)
422 #define ClearAccess(x) (cli_flags(x) &= ~FLAGS_CHKACCESS)
423 #define ClearBurst(x) (cli_flags(x) &= ~FLAGS_BURST)
424 #define ClearBurstAck(x) (cli_flags(x) &= ~FLAGS_BURST_ACK)
425 #define ClearChannelService(x) (cli_flags(x) &= ~FLAGS_CHSERV)
426 #define ClearDeaf(x) (cli_flags(x) &= ~FLAGS_DEAF)
427 #define ClearDebug(x) (cli_flags(x) &= ~FLAGS_DEBUG)
428 #define ClearIPChecked(x) (cli_flags(x) &= ~FLAGS_IPCHECK)
429 #define ClearInvisible(x) (cli_flags(x) &= ~FLAGS_INVISIBLE)
430 #define ClearLocOp(x) (cli_flags(x) &= ~FLAGS_LOCOP)
431 #define ClearOper(x) (cli_flags(x) &= ~FLAGS_OPER)
432 #define ClearUPing(x) (cli_flags(x) &= ~FLAGS_UPING)
433 #define ClearWallops(x) (cli_flags(x) &= ~FLAGS_WALLOP)
434 #define ClearServNotice(x) (cli_flags(x) &= ~FLAGS_SERVNOTICE)
437 #define FREEFLAG_SOCKET 0x0001 /* socket needs to be freed */
438 #define FREEFLAG_TIMER 0x0002 /* timer needs to be freed */
440 /* server notice stuff */
445 /* DON'T CHANGE THESE VALUES ! */
446 /* THE CLIENTS DEPEND ON IT ! */
447 #define SNO_OLDSNO 0x1 /* unsorted old messages */
448 #define SNO_SERVKILL 0x2 /* server kills (nick collisions) */
449 #define SNO_OPERKILL 0x4 /* oper kills */
450 #define SNO_HACK2 0x8 /* desyncs */
451 #define SNO_HACK3 0x10 /* temporary desyncs */
452 #define SNO_UNAUTH 0x20 /* unauthorized connections */
453 #define SNO_TCPCOMMON 0x40 /* common TCP or socket errors */
454 #define SNO_TOOMANY 0x80 /* too many connections */
455 #define SNO_HACK4 0x100 /* Uworld actions on channels */
456 #define SNO_GLINE 0x200 /* glines */
457 #define SNO_NETWORK 0x400 /* net join/break, etc */
458 #define SNO_IPMISMATCH 0x800 /* IP mismatches */
459 #define SNO_THROTTLE 0x1000 /* host throttle add/remove notices */
460 #define SNO_OLDREALOP 0x2000 /* old oper-only messages */
461 #define SNO_CONNEXIT 0x4000 /* client connect/exit (ugh) */
462 #define SNO_DEBUG 0x8000 /* debugging messages (DEBUGMODE only) */
465 # define SNO_ALL 0xffff /* Don't make it larger then significant,
466 * that looks nicer */
468 # define SNO_ALL 0x7fff
471 #define SNO_USER (SNO_ALL & ~SNO_OPER)
473 #define SNO_DEFAULT (SNO_NETWORK|SNO_OPERKILL|SNO_GLINE)
474 #define SNO_OPERDEFAULT (SNO_DEFAULT|SNO_HACK2|SNO_HACK4|SNO_THROTTLE|SNO_OLDSNO)
475 #define SNO_OPER (SNO_CONNEXIT|SNO_OLDREALOP)
476 #define SNO_NOISY (SNO_SERVKILL|SNO_UNAUTH)
478 #define PrivSet(pset, priv) ((pset)->priv_mask[_PRIV_IDX(priv)] |= \
480 #define PrivClr(pset, priv) ((pset)->priv_mask[_PRIV_IDX(priv)] &= \
482 #define PrivHas(pset, priv) ((pset)->priv_mask[_PRIV_IDX(priv)] & \
485 #define GrantPriv(cli, priv) (PrivSet(&(cli_privs(cli)), priv))
486 #define RevokePriv(cli, priv) (PrivClr(&(cli_privs(cli)), priv))
487 #define HasPriv(cli, priv) (PrivHas(&(cli_privs(cli)), priv))
489 typedef enum ShowIPType {
495 extern const char* get_client_name(const struct Client* sptr, int showip);
496 extern int client_get_ping(const struct Client* local_client);
497 extern void client_drop_sendq(struct Connection* con);
498 extern void client_add_sendq(struct Connection* con,
499 struct Connection** con_p);
500 extern void client_set_privs(struct Client* client);
501 extern int client_report_privs(struct Client* to, struct Client* client);
503 #endif /* INCLUDED_client_h */