Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / include / client.h
1 /*
2  * IRC - Internet Relay Chat, include/client.h
3  * Copyright (C) 1990 Jarkko Oikarinen and
4  *                    University of Oulu, Computing Center
5  *
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)
9  * any later version.
10  *
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.
15  *
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.
19  *
20  *
21  * $Id$
22  */
23 #ifndef INCLUDED_client_h
24 #define INCLUDED_client_h
25 #ifndef INCLUDED_ircd_defs_h
26 #include "ircd_defs.h"
27 #endif
28 #ifndef INCLUDED_config_h
29 #include "config.h"
30 #endif
31 #ifndef INCLUDED_dbuf_h
32 #include "dbuf.h"
33 #endif
34 #ifndef INCLUDED_msgq_h
35 #include "msgq.h"
36 #endif
37 #ifndef INCLUDED_ircd_handler_h
38 #include "ircd_handler.h"
39 #endif
40 #ifndef INCLUDED_sys_types_h
41 #include <sys/types.h>          /* time_t, size_t */
42 #define INCLUDED_sys_types_h
43 #endif
44 #ifndef INCLUDED_netinet_in_h
45 #include <netinet/in.h>         /* in_addr */
46 #define INCLUDED_netinet_in_h
47 #endif
48
49 struct ConfItem;
50 struct Listener;
51 struct ListingArgs;
52 struct SLink;
53 struct Server;
54 struct User;
55 struct Whowas;
56 struct DNSReply;
57 struct hostent;
58
59 /*
60  * Structures
61  *
62  * Only put structures here that are being used in a very large number of
63  * source files. Other structures go in the header file of there corresponding
64  * source file, or in the source file itself (when only used in that file).
65  */
66
67 struct Connection {
68   /*
69    *  The following fields are allocated only for local clients
70    *  (directly connected to *this* server with a socket.
71    *  The first of them *MUST* be the "count"--it is the field
72    *  to which the allocation is tied to! *Never* refer to
73    *  these fields, if (from != self).
74    */
75   struct Connection*  con_next;  /* Next connection with queued data */
76   struct Connection** con_prev_p; /* What points to us */
77   struct Client*      con_client; /* Client associated with connection */
78   unsigned int        con_count; /* Amount of data in buffer */
79   int                 con_fd;    /* >= 0, for local clients */
80   int                 con_error; /* last socket level error for client */
81   unsigned int        con_snomask; /* mask for server messages */
82   time_t              con_nextnick; /* Next time a nick change is allowed */
83   time_t              con_nexttarget;/* Next time a target change is allowed */
84   unsigned int        con_cookie; /* Random number the user must PONG */
85   struct MsgQ         con_sendQ; /* Outgoing message queue--if socket full */
86   struct DBuf         con_recvQ; /* Hold for data incoming yet to be parsed */
87   unsigned int        con_sendM; /* Statistics: protocol messages send */
88   unsigned int        con_sendK; /* Statistics: total k-bytes send */
89   unsigned int        con_receiveM;/* Statistics: protocol messages received */
90   unsigned int        con_receiveK; /* Statistics: total k-bytes received */
91   unsigned short      con_sendB; /* counters to count upto 1-k lots of bytes */
92   unsigned short      con_receiveB; /* sent and received. */
93   struct Listener*    con_listener; /* listening client which we accepted
94                                        from */
95   struct SLink*       con_confs; /* Configuration record associated */
96   HandlerType         con_handler; /* message index into command table
97                                       for parsing */
98   struct DNSReply*    con_dns_reply; /* DNS reply used during client
99                                         registration */
100   struct ListingArgs* con_listing;
101   unsigned int        con_max_sendq; /* cached max send queue for client */
102   unsigned int        con_ping_freq; /* cached ping freq from client conf
103                                         class */
104   unsigned short      con_lastsq; /* # 2k blocks when sendqueued called last */
105   unsigned short      con_port;  /* and the remote port# too :-) */
106   unsigned char       con_targets[MAXTARGETS]; /* Hash values of current
107                                                   targets */
108   char con_sock_ip[SOCKIPLEN + 1]; /* this is the ip address as a string */
109   char con_sockhost[HOSTLEN + 1]; /* This is the host name from the socket and
110                                     after which the connection was accepted. */
111   char con_passwd[PASSWDLEN + 1];
112   char con_buffer[BUFSIZE];     /* Incoming message buffer; or the error that
113                                    caused this clients socket to be `dead' */
114 };
115
116 struct Client {
117   struct Client* cli_next;      /* link in GlobalClientList */
118   struct Client* cli_prev;      /* link in GlobalClientList */
119   struct Client* cli_hnext;     /* link in hash table bucket or this */
120   struct Connection* cli_connect; /* Connection structure associated with us */
121   struct User*   cli_user;      /* ...defined, if this is a User */
122   struct Server* cli_serv;      /* ...defined, if this is a server */
123   struct Whowas* cli_whowas;    /* Pointer to ww struct to be freed on quit */
124   char           cli_yxx[4];    /* Numeric Nick: YMM if this is a server,
125                                    XX0 if this is a user */
126   /*
127    * XXX - move these to local part for next release
128    * (lasttime, since)
129    */
130   time_t         cli_lasttime;  /* last time data read from socket */
131   time_t         cli_since;     /* last time we parsed something, flood control */
132                                 
133   time_t         cli_firsttime; /* time client was created */
134   time_t         cli_lastnick;  /* TimeStamp on nick */
135   int            cli_marker;    /* /who processing marker */
136   unsigned int   cli_flags;     /* client flags */
137   unsigned int   cli_hopcount;  /* number of servers to this 0 = local */
138   struct in_addr cli_ip;        /* Real ip# NOT defined for remote servers! */
139   short          cli_status;    /* Client type */
140   unsigned char  cli_local;     /* local or remote client */
141   unsigned int   cli_privs;     /* Oper privileges */
142   char cli_name[HOSTLEN + 1];   /* Unique name of the client, nick or host */
143   char cli_username[USERLEN + 1]; /* username here now for auth stuff */
144   char cli_info[REALLEN + 1];   /* Free form additional client information */
145 };
146
147 #define cli_next(cli)           ((cli)->cli_next)
148 #define cli_prev(cli)           ((cli)->cli_prev)
149 #define cli_hnext(cli)          ((cli)->cli_hnext)
150 #define cli_connect(cli)        ((cli)->cli_connect)
151 #define cli_from(cli)           ((cli)->cli_connect->con_client)
152 #define cli_user(cli)           ((cli)->cli_user)
153 #define cli_serv(cli)           ((cli)->cli_serv)
154 #define cli_whowas(cli)         ((cli)->cli_whowas)
155 #define cli_yxx(cli)            ((cli)->cli_yxx)
156 #define cli_lasttime(cli)       ((cli)->cli_lasttime)
157 #define cli_since(cli)          ((cli)->cli_since)
158 #define cli_firsttime(cli)      ((cli)->cli_firsttime)
159 #define cli_lastnick(cli)       ((cli)->cli_lastnick)
160 #define cli_marker(cli)         ((cli)->cli_marker)
161 #define cli_flags(cli)          ((cli)->cli_flags)
162 #define cli_hopcount(cli)       ((cli)->cli_hopcount)
163 #define cli_ip(cli)             ((cli)->cli_ip)
164 #define cli_status(cli)         ((cli)->cli_status)
165 #define cli_local(cli)          ((cli)->cli_local)
166 #define cli_privs(cli)          ((cli)->cli_privs)
167 #define cli_name(cli)           ((cli)->cli_name)
168 #define cli_username(cli)       ((cli)->cli_username)
169 #define cli_info(cli)           ((cli)->cli_info)
170
171 #define cli_count(cli)          ((cli)->cli_connect->con_count)
172 #define cli_fd(cli)             ((cli)->cli_connect->con_fd)
173 #define cli_error(cli)          ((cli)->cli_connect->con_error)
174 #define cli_snomask(cli)        ((cli)->cli_connect->con_snomask)
175 #define cli_nextnick(cli)       ((cli)->cli_connect->con_nextnick)
176 #define cli_nexttarget(cli)     ((cli)->cli_connect->con_nexttarget)
177 #define cli_cookie(cli)         ((cli)->cli_connect->con_cookie)
178 #define cli_sendQ(cli)          ((cli)->cli_connect->con_sendQ)
179 #define cli_recvQ(cli)          ((cli)->cli_connect->con_recvQ)
180 #define cli_sendM(cli)          ((cli)->cli_connect->con_sendM)
181 #define cli_sendK(cli)          ((cli)->cli_connect->con_sendK)
182 #define cli_receiveM(cli)       ((cli)->cli_connect->con_receiveM)
183 #define cli_receiveK(cli)       ((cli)->cli_connect->con_receiveK)
184 #define cli_sendB(cli)          ((cli)->cli_connect->con_sendB)
185 #define cli_receiveB(cli)       ((cli)->cli_connect->con_receiveB)
186 #define cli_listener(cli)       ((cli)->cli_connect->con_listener)
187 #define cli_confs(cli)          ((cli)->cli_connect->con_confs)
188 #define cli_handler(cli)        ((cli)->cli_connect->con_handler)
189 #define cli_dns_reply(cli)      ((cli)->cli_connect->con_dns_reply)
190 #define cli_listing(cli)        ((cli)->cli_connect->con_listing)
191 #define cli_max_sendq(cli)      ((cli)->cli_connect->con_max_sendq)
192 #define cli_ping_freq(cli)      ((cli)->cli_connect->con_ping_freq)
193 #define cli_lastsq(cli)         ((cli)->cli_connect->con_lastsq)
194 #define cli_port(cli)           ((cli)->cli_connect->con_port)
195 #define cli_targets(cli)        ((cli)->cli_connect->con_targets)
196 #define cli_sock_ip(cli)        ((cli)->cli_connect->con_sock_ip)
197 #define cli_sockhost(cli)       ((cli)->cli_connect->con_sockhost)
198 #define cli_passwd(cli)         ((cli)->cli_connect->con_passwd)
199 #define cli_buffer(cli)         ((cli)->cli_connect->con_buffer)
200
201 #define con_next(con)           ((con)->con_next)
202 #define con_prev_p(con)         ((con)->con_prev_p)
203 #define con_client(con)         ((con)->con_client)
204 #define con_count(con)          ((con)->con_count)
205 #define con_fd(con)             ((con)->con_fd)
206 #define con_error(con)          ((con)->con_error)
207 #define con_snomask(con)        ((con)->con_snomask)
208 #define con_nextnick(con)       ((con)->con_nextnick)
209 #define con_nexttarget(con)     ((con)->con_nexttarget)
210 #define con_cookie(con)         ((con)->con_cookie)
211 #define con_sendQ(con)          ((con)->con_sendQ)
212 #define con_recvQ(con)          ((con)->con_recvQ)
213 #define con_sendM(con)          ((con)->con_sendM)
214 #define con_sendK(con)          ((con)->con_sendK)
215 #define con_receiveM(con)       ((con)->con_receiveM)
216 #define con_receiveK(con)       ((con)->con_receiveK)
217 #define con_sendB(con)          ((con)->con_sendB)
218 #define con_receiveB(con)       ((con)->con_receiveB)
219 #define con_listener(con)       ((con)->con_listener)
220 #define con_confs(con)          ((con)->con_confs)
221 #define con_handler(con)        ((con)->con_handler)
222 #define con_dns_reply(con)      ((con)->con_dns_reply)
223 #define con_listing(con)        ((con)->con_listing)
224 #define con_max_sendq(con)      ((con)->con_max_sendq)
225 #define con_ping_freq(con)      ((con)->con_ping_freq)
226 #define con_lastsq(con)         ((con)->con_lastsq)
227 #define con_port(con)           ((con)->con_port)
228 #define con_targets(con)        ((con)->con_targets)
229 #define con_sock_ip(con)        ((con)->con_sock_ip)
230 #define con_sockhost(con)       ((con)->con_sockhost)
231 #define con_passwd(con)         ((con)->con_passwd)
232 #define con_buffer(con)         ((con)->con_buffer)
233
234 #define STAT_CONNECTING         0x001 /* connecting to another server */
235 #define STAT_HANDSHAKE          0x002 /* pass - server sent */
236 #define STAT_ME                 0x004 /* this server */
237 #define STAT_UNKNOWN            0x008 /* unidentified connection */
238 #define STAT_UNKNOWN_USER       0x010 /* Connect to client port */
239 #define STAT_UNKNOWN_SERVER     0x020 /* Connect to server port */
240 #define STAT_SERVER             0x040
241 #define STAT_USER               0x080
242
243 /*
244  * status macros.
245  */
246 #define IsRegistered(x)         (cli_status(x) & (STAT_SERVER | STAT_USER))
247 #define IsConnecting(x)         (cli_status(x) == STAT_CONNECTING)
248 #define IsHandshake(x)          (cli_status(x) == STAT_HANDSHAKE)
249 #define IsMe(x)                 (cli_status(x) == STAT_ME)
250 #define IsUnknown(x)            (cli_status(x) & \
251         (STAT_UNKNOWN | STAT_UNKNOWN_USER | STAT_UNKNOWN_SERVER))
252
253 #define IsServerPort(x)         (cli_status(x) == STAT_UNKNOWN_SERVER )
254 #define IsUserPort(x)           (cli_status(x) == STAT_UNKNOWN_USER )
255 #define IsClient(x)             (cli_status(x) & \
256         (STAT_HANDSHAKE | STAT_ME | STAT_UNKNOWN |\
257          STAT_UNKNOWN_USER | STAT_UNKNOWN_SERVER | STAT_SERVER | STAT_USER))
258
259 #define IsTrusted(x)            (cli_status(x) & \
260         (STAT_CONNECTING | STAT_HANDSHAKE | STAT_ME | STAT_SERVER))
261
262 #define IsServer(x)             (cli_status(x) == STAT_SERVER)
263 #define IsUser(x)               (cli_status(x) == STAT_USER)
264
265
266 #define SetConnecting(x)        (cli_status(x) = STAT_CONNECTING)
267 #define SetHandshake(x)         (cli_status(x) = STAT_HANDSHAKE)
268 #define SetServer(x)            (cli_status(x) = STAT_SERVER)
269 #define SetMe(x)                (cli_status(x) = STAT_ME)
270 #define SetUser(x)              (cli_status(x) = STAT_USER)
271
272 #define MyConnect(x)    (cli_from(x) == (x))
273 #define MyUser(x)       (MyConnect(x) && IsUser(x))
274 #define MyOper(x)       (MyConnect(x) && IsOper(x))
275 #define Protocol(x)     ((cli_serv(x))->prot)
276
277 #define PARSE_AS_SERVER(x) (cli_status(x) & \
278             (STAT_SERVER | STAT_CONNECTING | STAT_HANDSHAKE))
279
280 /*
281  * FLAGS macros
282  */
283 #define FLAGS_PINGSENT   0x0001 /* Unreplied ping sent */
284 #define FLAGS_DEADSOCKET 0x0002 /* Local socket is dead--Exiting soon */
285 #define FLAGS_KILLED     0x0004 /* Prevents "QUIT" from being sent for this */
286 #define FLAGS_OPER       0x0008 /* Operator */
287 #define FLAGS_LOCOP      0x0010 /* Local operator -- SRB */
288 #define FLAGS_INVISIBLE  0x0020 /* makes user invisible */
289 #define FLAGS_WALLOP     0x0040 /* send wallops to them */
290 #define FLAGS_SERVNOTICE 0x0080 /* server notices such as kill */
291 #define FLAGS_BLOCKED    0x0100 /* socket is in a blocked condition */
292 #define FLAGS_CLOSING    0x0400 /* set when closing to suppress errors */
293 #define FLAGS_UPING      0x0800 /* has active UDP ping request */
294 #define FLAGS_CHKACCESS  0x1000 /* ok to check clients access if set */
295 #define FLAGS_LOCAL     0x00010000      /* set for local clients */
296 #define FLAGS_GOTID     0x00020000      /* successful ident lookup achieved */
297 #define FLAGS_DOID      0x00040000      /* I-lines say must use ident return */
298 #define FLAGS_NONL      0x00080000      /* No \n in buffer */
299 #define FLAGS_TS8       0x00100000      /* Why do you want to know? */
300 #define FLAGS_MAP       0x00800000      /* Show server on the map */
301 #define FLAGS_JUNCTION  0x01000000      /* Junction causing the net.burst */
302 #define FLAGS_DEAF      0x02000000      /* Makes user deaf */
303 #define FLAGS_CHSERV    0x04000000      /* Disallow KICK or MODE -o on the user;
304                                            don't display channels in /whois */
305 #define FLAGS_BURST     0x08000000      /* Server is receiving a net.burst */
306 #define FLAGS_BURST_ACK 0x10000000      /* Server is waiting for eob ack */
307 #define FLAGS_DEBUG     0x20000000      /* send global debug/anti-hack info */
308 #define FLAGS_IPCHECK   0x40000000      /* Added or updated IPregistry data */
309
310 #define SEND_UMODES \
311     (FLAGS_INVISIBLE|FLAGS_OPER|FLAGS_WALLOP|FLAGS_DEAF|FLAGS_CHSERV|FLAGS_DEBUG)
312 #define ALL_UMODES (SEND_UMODES|FLAGS_SERVNOTICE|FLAGS_LOCOP)
313 #define FLAGS_ID (FLAGS_DOID|FLAGS_GOTID)
314
315 /*
316  * flags macros.
317  */
318 #define DoAccess(x)             (cli_flags(x) & FLAGS_CHKACCESS)
319 #define IsAnOper(x)             (cli_flags(x) & (FLAGS_OPER|FLAGS_LOCOP))
320 #define IsBlocked(x)            (cli_flags(x) & FLAGS_BLOCKED)
321 #define IsBurst(x)              (cli_flags(x) & FLAGS_BURST)
322 #define IsBurstAck(x)           (cli_flags(x) & FLAGS_BURST_ACK)
323 #define IsBurstOrBurstAck(x)    (cli_flags(x) & (FLAGS_BURST|FLAGS_BURST_ACK))
324 #define IsChannelService(x)     (cli_flags(x) & FLAGS_CHSERV)
325 #define IsDead(x)               (cli_flags(x) & FLAGS_DEADSOCKET)
326 #define IsDeaf(x)               (cli_flags(x) & FLAGS_DEAF)
327 #define IsIPChecked(x)          (cli_flags(x) & FLAGS_IPCHECK)
328 #define IsIdented(x)            (cli_flags(x) & FLAGS_GOTID)
329 #define IsInvisible(x)          (cli_flags(x) & FLAGS_INVISIBLE)
330 #define IsJunction(x)           (cli_flags(x) & FLAGS_JUNCTION)
331 #define IsLocOp(x)              (cli_flags(x) & FLAGS_LOCOP)
332 #define IsLocal(x)              (cli_flags(x) & FLAGS_LOCAL)
333 #define IsOper(x)               (cli_flags(x) & FLAGS_OPER)
334 #define IsUPing(x)              (cli_flags(x) & FLAGS_UPING)
335 #define NoNewLine(x)            (cli_flags(x) & FLAGS_NONL)
336 #define SendDebug(x)            (cli_flags(x) & FLAGS_DEBUG)
337 #define SendServNotice(x)       (cli_flags(x) & FLAGS_SERVNOTICE)
338 #define SendWallops(x)          (cli_flags(x) & FLAGS_WALLOP)
339
340 #define IsPrivileged(x)         (IsAnOper(x) || IsServer(x))
341
342 #define SetAccess(x)            (cli_flags(x) |= FLAGS_CHKACCESS)
343 #define SetBurst(x)             (cli_flags(x) |= FLAGS_BURST)
344 #define SetBurstAck(x)          (cli_flags(x) |= FLAGS_BURST_ACK)
345 #define SetChannelService(x)    (cli_flags(x) |= FLAGS_CHSERV)
346 #define SetDeaf(x)              (cli_flags(x) |= FLAGS_DEAF)
347 #define SetDebug(x)             (cli_flags(x) |= FLAGS_DEBUG)
348 #define SetGotId(x)             (cli_flags(x) |= FLAGS_GOTID)
349 #define SetIPChecked(x)         (cli_flags(x) |= FLAGS_IPCHECK)
350 #define SetInvisible(x)         (cli_flags(x) |= FLAGS_INVISIBLE)
351 #define SetJunction(x)          (cli_flags(x) |= FLAGS_JUNCTION)
352 #define SetLocOp(x)             (cli_flags(x) |= FLAGS_LOCOP)
353 #define SetOper(x)              (cli_flags(x) |= FLAGS_OPER)
354 #define SetUPing(x)             (cli_flags(x) |= FLAGS_UPING)
355 #define SetWallops(x)           (cli_flags(x) |= FLAGS_WALLOP)
356
357 #define ClearAccess(x)          (cli_flags(x) &= ~FLAGS_CHKACCESS)
358 #define ClearBurst(x)           (cli_flags(x) &= ~FLAGS_BURST)
359 #define ClearBurstAck(x)        (cli_flags(x) &= ~FLAGS_BURST_ACK)
360 #define ClearChannelService(x)  (cli_flags(x) &= ~FLAGS_CHSERV)
361 #define ClearDeaf(x)            (cli_flags(x) &= ~FLAGS_DEAF)
362 #define ClearDebug(x)           (cli_flags(x) &= ~FLAGS_DEBUG)
363 #define ClearIPChecked(x)       (cli_flags(x) &= ~FLAGS_IPCHECK)
364 #define ClearInvisible(x)       (cli_flags(x) &= ~FLAGS_INVISIBLE)
365 #define ClearLocOp(x)           (cli_flags(x) &= ~FLAGS_LOCOP)
366 #define ClearOper(x)            (cli_flags(x) &= ~FLAGS_OPER)
367 #define ClearUPing(x)           (cli_flags(x) &= ~FLAGS_UPING)
368 #define ClearWallops(x)         (cli_flags(x) &= ~FLAGS_WALLOP)
369
370 /* server notice stuff */
371
372 #define SNO_ADD         1
373 #define SNO_DEL         2
374 #define SNO_SET         3
375                                 /* DON'T CHANGE THESE VALUES ! */
376                                 /* THE CLIENTS DEPEND ON IT  ! */
377 #define SNO_OLDSNO      0x1     /* unsorted old messages */
378 #define SNO_SERVKILL    0x2     /* server kills (nick collisions) */
379 #define SNO_OPERKILL    0x4     /* oper kills */
380 #define SNO_HACK2       0x8     /* desyncs */
381 #define SNO_HACK3       0x10    /* temporary desyncs */
382 #define SNO_UNAUTH      0x20    /* unauthorized connections */
383 #define SNO_TCPCOMMON   0x40    /* common TCP or socket errors */
384 #define SNO_TOOMANY     0x80    /* too many connections */
385 #define SNO_HACK4       0x100   /* Uworld actions on channels */
386 #define SNO_GLINE       0x200   /* glines */
387 #define SNO_NETWORK     0x400   /* net join/break, etc */
388 #define SNO_IPMISMATCH  0x800   /* IP mismatches */
389 #define SNO_THROTTLE    0x1000  /* host throttle add/remove notices */
390 #define SNO_OLDREALOP   0x2000  /* old oper-only messages */
391 #define SNO_CONNEXIT    0x4000  /* client connect/exit (ugh) */
392 #define SNO_DEBUG       0x8000  /* debugging messages (DEBUGMODE only) */
393
394 #ifdef DEBUGMODE
395 # define SNO_ALL        0xffff  /* Don't make it larger then significant,
396                                  * that looks nicer */
397 #else
398 # define SNO_ALL        0x7fff
399 #endif
400
401 #define SNO_USER        (SNO_ALL & ~SNO_OPER)
402
403 #define SNO_DEFAULT (SNO_NETWORK|SNO_OPERKILL|SNO_GLINE)
404 #define SNO_OPERDEFAULT (SNO_DEFAULT|SNO_HACK2|SNO_HACK4|SNO_THROTTLE|SNO_OLDSNO)
405 #define SNO_OPER (SNO_CONNEXIT|SNO_OLDREALOP)
406 #define SNO_NOISY (SNO_SERVKILL|SNO_UNAUTH)
407
408 #define PRIV_CHAN_LIMIT         0x00000001 /* no channel limit on oper */
409 #define PRIV_MODE_LCHAN         0x00000002 /* oper can mode local chans */
410 #define PRIV_WALK_LCHAN         0x00000004 /* oper can walk thru local modes */
411 #define PRIV_DEOP_LCHAN         0x00000008 /* no deop oper on local chans */
412 #define PRIV_SHOW_INVIS         0x00000010 /* show local invisible users */
413 #define PRIV_SHOW_ALL_INVIS     0x00000020 /* show all invisible users */
414 #define PRIV_UNLIMIT_QUERY      0x00000040 /* unlimit who queries */
415
416 #define PRIV_KILL               0x00000080 /* oper can KILL */
417 #define PRIV_LOCAL_KILL         0x00000100 /* oper can local KILL */
418 #define PRIV_REHASH             0x00000200 /* oper can REHASH */
419 #define PRIV_RESTART            0x00000400 /* oper can RESTART */
420 #define PRIV_DIE                0x00000800 /* oper can DIE */
421 #define PRIV_GLINE              0x00001000 /* oper can GLINE */
422 #define PRIV_LOCAL_GLINE        0x00002000 /* oper can local GLINE */
423 #define PRIV_JUPE               0x00004000 /* oper can JUPE */
424 #define PRIV_LOCAL_JUPE         0x00008000 /* oper can local JUPE */
425 #define PRIV_OPMODE             0x00010000 /* oper can OP/CLEARMODE */
426 #define PRIV_LOCAL_OPMODE       0x00020000 /* oper can local OP/CLEARMODE */
427 #define PRIV_SET                0x00040000 /* oper can SET */
428 #define PRIV_WHOX               0x00080000 /* oper can use /who x */
429 #define PRIV_BADCHAN            0x00100000 /* oper can BADCHAN */
430 #define PRIV_LOCAL_BADCHAN      0x00200000 /* oper can local BADCHAN */
431 #define PRIV_SEE_CHAN           0x00400000 /* oper can see in secret chans */
432
433 #define PRIV_PROPAGATE          0x00800000 /* propagate oper status */
434 #define PRIV_DISPLAY            0x01000000 /* "Is an oper" displayed */
435 #define PRIV_SEE_OPERS          0x02000000 /* display hidden opers */
436
437 #define HasPriv(cli, priv)      (cli_privs(cli) & (priv))
438
439 typedef enum ShowIPType {
440   HIDE_IP,
441   SHOW_IP,
442   MASK_IP
443 } ShowIPType;
444
445 extern const char* get_client_name(const struct Client* sptr, int showip);
446 extern int client_get_ping(const struct Client* local_client);
447 extern void client_drop_sendq(struct Connection* con);
448 extern void client_add_sendq(struct Connection* con,
449                              struct Connection** con_p);
450 extern void client_set_privs(struct Client* client);
451 extern int client_report_privs(struct Client* to, struct Client* client);
452
453 #endif /* INCLUDED_client_h */
454