#ifndef INCLUDED_ircd_defs_h
#include "ircd_defs.h"
#endif
-#ifndef INCLUDED_config_h
-#include "config.h"
-#endif
#ifndef INCLUDED_dbuf_h
#include "dbuf.h"
#endif
#ifndef INCLUDED_msgq_h
#include "msgq.h"
#endif
+#ifndef INCLUDED_ircd_events_h
+#include "ircd_events.h"
+#endif
#ifndef INCLUDED_ircd_handler_h
#include "ircd_handler.h"
#endif
struct Server;
struct User;
struct Whowas;
-struct DNSReply;
struct hostent;
+struct Privs;
+struct AuthRequest;
/*
* Structures
* source file, or in the source file itself (when only used in that file).
*/
-struct Connection {
+typedef unsigned long flagpage_t;
+
+#define FLAGSET_NBITS (8 * sizeof(flagpage_t))
+#define FLAGSET_INDEX(flag) (flag / FLAGSET_NBITS)
+#define FLAGSET_MASK(flag) (1<<(flag % FLAGSET_NBITS))
+
+#define DECLARE_FLAGSET(name,max) \
+ struct name \
+ { \
+ unsigned long bits[((max + FLAGSET_NBITS - 1) / FLAGSET_NBITS)]; \
+ };
+
+#define FLAGSET_ISSET(set,flag) ((set).bits[FLAGSET_INDEX(flag)] & FLAGSET_MASK(flag))
+#define FLAGSET_SET(set, flag) (set).bits[FLAGSET_INDEX(flag)] |= FLAGSET_MASK(flag)
+#define FLAGSET_CLEAR(set, flag) (set).bits[FLAGSET_INDEX(flag)] &= ~FLAGSET_MASK(flag)
+
+#define infousermodes "dioswkgx"
+
+enum Priv
+ {
+ PRIV_CHAN_LIMIT, /* no channel limit on oper */
+ PRIV_MODE_LCHAN, /* oper can mode local chans */
+ PRIV_WALK_LCHAN, /* oper can walk thru local modes */
+ PRIV_DEOP_LCHAN, /* no deop oper on local chans */
+ PRIV_SHOW_INVIS, /* show local invisible users */
+ PRIV_SHOW_ALL_INVIS, /* show all invisible users */
+ PRIV_UNLIMIT_QUERY, /* unlimit who queries */
+ PRIV_KILL, /* oper can KILL */
+ PRIV_LOCAL_KILL, /* oper can local KILL */
+ PRIV_REHASH, /* oper can REHASH */
+ PRIV_RESTART, /* oper can RESTART */
+ PRIV_DIE, /* oper can DIE */
+ PRIV_GLINE, /* oper can GLINE */
+ PRIV_LOCAL_GLINE, /* oper can local GLINE */
+ PRIV_JUPE, /* oper can JUPE */
+ PRIV_LOCAL_JUPE, /* oper can local JUPE */
+ PRIV_OPMODE, /* oper can OP/CLEARMODE */
+ PRIV_LOCAL_OPMODE, /* oper can local OP/CLEARMODE */
+ PRIV_SET, /* oper can SET */
+ PRIV_WHOX, /* oper can use /who x */
+ PRIV_BADCHAN, /* oper can BADCHAN */
+ PRIV_LOCAL_BADCHAN, /* oper can local BADCHAN */
+ PRIV_SEE_CHAN, /* oper can see in secret chans */
+ PRIV_PROPAGATE, /* propagate oper status */
+ PRIV_DISPLAY, /* "Is an oper" displayed */
+ PRIV_SEE_OPERS, /* display hidden opers */
+ PRIV_WIDE_GLINE, /* oper can set wider G-lines */
+ PRIV_LIST_CHAN, /* oper can list secret channels */
+ PRIV_FORCE_OPMODE,
+ PRIV_FORCE_LOCAL_OPMODE,
+ PRIV_LAST_PRIV /* must be the same as the last priv */
+ };
+
+enum Flag
+ {
+ FLAG_PINGSENT, /* Unreplied ping sent */
+ FLAG_DEADSOCKET, /* Local socket is dead--Exiting soon */
+ FLAG_KILLED, /* Prevents "QUIT" from being sent for this */
+ FLAG_BLOCKED, /* socket is in a blocked condition */
+ FLAG_CLOSING, /* set when closing to suppress errors */
+ FLAG_UPING, /* has active UDP ping request */
+ FLAG_CHKACCESS, /* ok to check clients access if set */
+ FLAG_HUB, /* server is a hub */
+ FLAG_SERVICE, /* server is a service */
+ FLAG_LOCAL, /* set for local clients */
+ FLAG_GOTID, /* successful ident lookup achieved */
+ FLAG_DOID, /* I-lines say must use ident return */
+ FLAG_NONL, /* No \n in buffer */
+ FLAG_TS8, /* Why do you want to know? */
+ FLAG_MAP, /* Show server on the map */
+ FLAG_JUNCTION, /* Junction causing the net.burst */
+ FLAG_BURST, /* Server is receiving a net.burst */
+ FLAG_BURST_ACK, /* Server is waiting for eob ack */
+ FLAG_IPCHECK, /* Added or updated IPregistry data */
+ FLAG_LOCOP, /* Local operator -- SRB */
+ FLAG_SERVNOTICE, /* server notices such as kill */
+ FLAG_OPER, /* Operator */
+ FLAG_INVISIBLE, /* makes user invisible */
+ FLAG_WALLOP, /* send wallops to them */
+ FLAG_DEAF, /* Makes user deaf */
+ FLAG_CHSERV, /* Disallow KICK or MODE -o on the user;
+ don't display channels in /whois */
+ FLAG_DEBUG, /* send global debug/anti-hack info */
+ FLAG_ACCOUNT, /* account name has been set */
+ FLAG_HIDDENHOST, /* user's host is hidden */
+ FLAG_LAST_FLAG,
+ FLAG_LOCAL_UMODES = FLAG_LOCOP, /* First local mode flag */
+ FLAG_GLOBAL_UMODES = FLAG_OPER /* First global mode flag */
+ };
+
+DECLARE_FLAGSET(Privs, PRIV_LAST_PRIV);
+DECLARE_FLAGSET(Flags, FLAG_LAST_FLAG);
+
+struct Connection
+{
/*
* The following fields are allocated only for local clients
* (directly connected to *this* server with a socket.
* to which the allocation is tied to! *Never* refer to
* these fields, if (from != self).
*/
+ unsigned long con_magic; /* magic number */
struct Connection* con_next; /* Next connection with queued data */
struct Connection** con_prev_p; /* What points to us */
struct Client* con_client; /* Client associated with connection */
unsigned int con_count; /* Amount of data in buffer */
int con_fd; /* >= 0, for local clients */
+ int con_freeflag; /* indicates if connection can be freed */
int con_error; /* last socket level error for client */
unsigned int con_snomask; /* mask for server messages */
time_t con_nextnick; /* Next time a nick change is allowed */
struct SLink* con_confs; /* Configuration record associated */
HandlerType con_handler; /* message index into command table
for parsing */
- struct DNSReply* con_dns_reply; /* DNS reply used during client
+ struct hostent* con_dns_reply; /* DNS reply used during client
registration */
struct ListingArgs* con_listing;
unsigned int con_max_sendq; /* cached max send queue for client */
char con_passwd[PASSWDLEN + 1];
char con_buffer[BUFSIZE]; /* Incoming message buffer; or the error that
caused this clients socket to be `dead' */
+ struct Socket con_socket; /* socket descriptor for client */
+ struct Timer con_proc; /* process latent messages from client */
+ struct AuthRequest* con_auth; /* auth request for client */
};
+#define CONNECTION_MAGIC 0x12f955f3
+
struct Client {
+ unsigned long cli_magic; /* magic number */
struct Client* cli_next; /* link in GlobalClientList */
struct Client* cli_prev; /* link in GlobalClientList */
struct Client* cli_hnext; /* link in hash table bucket or this */
time_t cli_firsttime; /* time client was created */
time_t cli_lastnick; /* TimeStamp on nick */
int cli_marker; /* /who processing marker */
- unsigned int cli_flags; /* client flags */
+ struct Flags cli_flags; /* client flags */
unsigned int cli_hopcount; /* number of servers to this 0 = local */
struct in_addr cli_ip; /* Real ip# NOT defined for remote servers! */
short cli_status; /* Client type */
unsigned char cli_local; /* local or remote client */
- unsigned int cli_privs; /* Oper privileges */
+ struct Privs cli_privs; /* Oper privileges */
char cli_name[HOSTLEN + 1]; /* Unique name of the client, nick or host */
char cli_username[USERLEN + 1]; /* username here now for auth stuff */
char cli_info[REALLEN + 1]; /* Free form additional client information */
};
+#define CLIENT_MAGIC 0x4ca08286
+
+#define cli_verify(cli) ((cli)->cli_magic == CLIENT_MAGIC)
+#define cli_magic(cli) ((cli)->cli_magic)
#define cli_next(cli) ((cli)->cli_next)
#define cli_prev(cli) ((cli)->cli_prev)
#define cli_hnext(cli) ((cli)->cli_hnext)
#define cli_count(cli) ((cli)->cli_connect->con_count)
#define cli_fd(cli) ((cli)->cli_connect->con_fd)
+#define cli_freeflag(cli) ((cli)->cli_connect->con_freeflag)
#define cli_error(cli) ((cli)->cli_connect->con_error)
#define cli_snomask(cli) ((cli)->cli_connect->con_snomask)
#define cli_nextnick(cli) ((cli)->cli_connect->con_nextnick)
#define cli_sockhost(cli) ((cli)->cli_connect->con_sockhost)
#define cli_passwd(cli) ((cli)->cli_connect->con_passwd)
#define cli_buffer(cli) ((cli)->cli_connect->con_buffer)
+#define cli_socket(cli) ((cli)->cli_connect->con_socket)
+#define cli_proc(cli) ((cli)->cli_connect->con_proc)
+#define cli_auth(cli) ((cli)->cli_connect->con_auth)
+#define con_verify(con) ((con)->con_magic == CONNECTION_MAGIC)
+#define con_magic(con) ((con)->con_magic)
#define con_next(con) ((con)->con_next)
#define con_prev_p(con) ((con)->con_prev_p)
#define con_client(con) ((con)->con_client)
#define con_count(con) ((con)->con_count)
#define con_fd(con) ((con)->con_fd)
+#define con_freeflag(con) ((con)->con_freeflag)
#define con_error(con) ((con)->con_error)
#define con_snomask(con) ((con)->con_snomask)
#define con_nextnick(con) ((con)->con_nextnick)
#define con_sockhost(con) ((con)->con_sockhost)
#define con_passwd(con) ((con)->con_passwd)
#define con_buffer(con) ((con)->con_buffer)
+#define con_socket(con) ((con)->con_socket)
+#define con_proc(con) ((con)->con_proc)
+#define con_auth(con) ((con)->con_auth)
#define STAT_CONNECTING 0x001 /* connecting to another server */
#define STAT_HANDSHAKE 0x002 /* pass - server sent */
(STAT_SERVER | STAT_CONNECTING | STAT_HANDSHAKE))
/*
- * FLAGS macros
+ * flags macros
*/
-#define FLAGS_PINGSENT 0x0001 /* Unreplied ping sent */
-#define FLAGS_DEADSOCKET 0x0002 /* Local socket is dead--Exiting soon */
-#define FLAGS_KILLED 0x0004 /* Prevents "QUIT" from being sent for this */
-#define FLAGS_OPER 0x0008 /* Operator */
-#define FLAGS_LOCOP 0x0010 /* Local operator -- SRB */
-#define FLAGS_INVISIBLE 0x0020 /* makes user invisible */
-#define FLAGS_WALLOP 0x0040 /* send wallops to them */
-#define FLAGS_SERVNOTICE 0x0080 /* server notices such as kill */
-#define FLAGS_BLOCKED 0x0100 /* socket is in a blocked condition */
-#define FLAGS_CLOSING 0x0400 /* set when closing to suppress errors */
-#define FLAGS_UPING 0x0800 /* has active UDP ping request */
-#define FLAGS_CHKACCESS 0x1000 /* ok to check clients access if set */
-#define FLAGS_LOCAL 0x00010000 /* set for local clients */
-#define FLAGS_GOTID 0x00020000 /* successful ident lookup achieved */
-#define FLAGS_DOID 0x00040000 /* I-lines say must use ident return */
-#define FLAGS_NONL 0x00080000 /* No \n in buffer */
-#define FLAGS_TS8 0x00100000 /* Why do you want to know? */
-#define FLAGS_MAP 0x00800000 /* Show server on the map */
-#define FLAGS_JUNCTION 0x01000000 /* Junction causing the net.burst */
-#define FLAGS_DEAF 0x02000000 /* Makes user deaf */
-#define FLAGS_CHSERV 0x04000000 /* Disallow KICK or MODE -o on the user;
- don't display channels in /whois */
-#define FLAGS_BURST 0x08000000 /* Server is receiving a net.burst */
-#define FLAGS_BURST_ACK 0x10000000 /* Server is waiting for eob ack */
-#define FLAGS_DEBUG 0x20000000 /* send global debug/anti-hack info */
-#define FLAGS_IPCHECK 0x40000000 /* Added or updated IPregistry data */
-
-#define SEND_UMODES \
- (FLAGS_INVISIBLE|FLAGS_OPER|FLAGS_WALLOP|FLAGS_DEAF|FLAGS_CHSERV|FLAGS_DEBUG)
-#define ALL_UMODES (SEND_UMODES|FLAGS_SERVNOTICE|FLAGS_LOCOP)
-#define FLAGS_ID (FLAGS_DOID|FLAGS_GOTID)
-
-/*
- * flags macros.
- */
-#define DoAccess(x) (cli_flags(x) & FLAGS_CHKACCESS)
-#define IsAnOper(x) (cli_flags(x) & (FLAGS_OPER|FLAGS_LOCOP))
-#define IsBlocked(x) (cli_flags(x) & FLAGS_BLOCKED)
-#define IsBurst(x) (cli_flags(x) & FLAGS_BURST)
-#define IsBurstAck(x) (cli_flags(x) & FLAGS_BURST_ACK)
-#define IsBurstOrBurstAck(x) (cli_flags(x) & (FLAGS_BURST|FLAGS_BURST_ACK))
-#define IsChannelService(x) (cli_flags(x) & FLAGS_CHSERV)
-#define IsDead(x) (cli_flags(x) & FLAGS_DEADSOCKET)
-#define IsDeaf(x) (cli_flags(x) & FLAGS_DEAF)
-#define IsIPChecked(x) (cli_flags(x) & FLAGS_IPCHECK)
-#define IsIdented(x) (cli_flags(x) & FLAGS_GOTID)
-#define IsInvisible(x) (cli_flags(x) & FLAGS_INVISIBLE)
-#define IsJunction(x) (cli_flags(x) & FLAGS_JUNCTION)
-#define IsLocOp(x) (cli_flags(x) & FLAGS_LOCOP)
-#define IsLocal(x) (cli_flags(x) & FLAGS_LOCAL)
-#define IsOper(x) (cli_flags(x) & FLAGS_OPER)
-#define IsUPing(x) (cli_flags(x) & FLAGS_UPING)
-#define NoNewLine(x) (cli_flags(x) & FLAGS_NONL)
-#define SendDebug(x) (cli_flags(x) & FLAGS_DEBUG)
-#define SendServNotice(x) (cli_flags(x) & FLAGS_SERVNOTICE)
-#define SendWallops(x) (cli_flags(x) & FLAGS_WALLOP)
+#define FlagSet(fset, flag) FLAGSET_SET(*fset, flag)
+#define FlagClr(fset, flag) FLAGSET_CLEAR(*fset, flag)
+#define FlagHas(fset, flag) FLAGSET_ISSET(*fset, flag)
+#define SetFlag(cli, flag) FlagSet(&cli_flags(cli), flag)
+#define ClrFlag(cli, flag) FlagClr(&cli_flags(cli), flag)
+#define HasFlag(cli, flag) FlagHas(&cli_flags(cli), flag)
+
+#define DoAccess(x) HasFlag(x, FLAG_CHKACCESS)
+#define IsAnOper(x) (HasFlag(x, FLAG_OPER) || HasFlag(x, FLAG_LOCOP))
+#define IsBlocked(x) HasFlag(x, FLAG_BLOCKED)
+#define IsBurst(x) HasFlag(x, FLAG_BURST)
+#define IsBurstAck(x) HasFlag(x, FLAG_BURST_ACK)
+#define IsBurstOrBurstAck(x) (HasFlag(x, FLAG_BURST) || HasFlag(x, FLAG_BURST_ACK))
+#define IsChannelService(x) HasFlag(x, FLAG_CHSERV)
+#define IsDead(x) HasFlag(x, FLAG_DEADSOCKET)
+#define IsDeaf(x) HasFlag(x, FLAG_DEAF)
+#define IsIPChecked(x) HasFlag(x, FLAG_IPCHECK)
+#define IsIdented(x) HasFlag(x, FLAG_GOTID)
+#define IsInvisible(x) HasFlag(x, FLAG_INVISIBLE)
+#define IsJunction(x) HasFlag(x, FLAG_JUNCTION)
+#define IsLocOp(x) HasFlag(x, FLAG_LOCOP)
+#define IsLocal(x) HasFlag(x, FLAG_LOCAL)
+#define IsOper(x) HasFlag(x, FLAG_OPER)
+#define IsUPing(x) HasFlag(x, FLAG_UPING)
+#define NoNewLine(x) HasFlag(x, FLAG_NONL)
+#define SendDebug(x) HasFlag(x, FLAG_DEBUG)
+#define SendServNotice(x) HasFlag(x, FLAG_SERVNOTICE)
+#define SendWallops(x) HasFlag(x, FLAG_WALLOP)
+#define IsHub(x) HasFlag(x, FLAG_HUB)
+#define IsService(x) HasFlag(x, FLAG_SERVICE)
+#define IsAccount(x) HasFlag(x, FLAG_ACCOUNT)
+#define IsHiddenHost(x) HasFlag(x, FLAG_HIDDENHOST)
+#define IsPingSent(x) HasFlag(x, FLAG_PINGSENT)
#define IsPrivileged(x) (IsAnOper(x) || IsServer(x))
-
-#define SetAccess(x) (cli_flags(x) |= FLAGS_CHKACCESS)
-#define SetBurst(x) (cli_flags(x) |= FLAGS_BURST)
-#define SetBurstAck(x) (cli_flags(x) |= FLAGS_BURST_ACK)
-#define SetChannelService(x) (cli_flags(x) |= FLAGS_CHSERV)
-#define SetDeaf(x) (cli_flags(x) |= FLAGS_DEAF)
-#define SetDebug(x) (cli_flags(x) |= FLAGS_DEBUG)
-#define SetGotId(x) (cli_flags(x) |= FLAGS_GOTID)
-#define SetIPChecked(x) (cli_flags(x) |= FLAGS_IPCHECK)
-#define SetInvisible(x) (cli_flags(x) |= FLAGS_INVISIBLE)
-#define SetJunction(x) (cli_flags(x) |= FLAGS_JUNCTION)
-#define SetLocOp(x) (cli_flags(x) |= FLAGS_LOCOP)
-#define SetOper(x) (cli_flags(x) |= FLAGS_OPER)
-#define SetUPing(x) (cli_flags(x) |= FLAGS_UPING)
-#define SetWallops(x) (cli_flags(x) |= FLAGS_WALLOP)
-
-#define ClearAccess(x) (cli_flags(x) &= ~FLAGS_CHKACCESS)
-#define ClearBurst(x) (cli_flags(x) &= ~FLAGS_BURST)
-#define ClearBurstAck(x) (cli_flags(x) &= ~FLAGS_BURST_ACK)
-#define ClearChannelService(x) (cli_flags(x) &= ~FLAGS_CHSERV)
-#define ClearDeaf(x) (cli_flags(x) &= ~FLAGS_DEAF)
-#define ClearDebug(x) (cli_flags(x) &= ~FLAGS_DEBUG)
-#define ClearIPChecked(x) (cli_flags(x) &= ~FLAGS_IPCHECK)
-#define ClearInvisible(x) (cli_flags(x) &= ~FLAGS_INVISIBLE)
-#define ClearLocOp(x) (cli_flags(x) &= ~FLAGS_LOCOP)
-#define ClearOper(x) (cli_flags(x) &= ~FLAGS_OPER)
-#define ClearUPing(x) (cli_flags(x) &= ~FLAGS_UPING)
-#define ClearWallops(x) (cli_flags(x) &= ~FLAGS_WALLOP)
+#define HasHiddenHost(x) (IsHiddenHost(x) && IsAccount(x))
+
+#define SetAccess(x) SetFlag(x, FLAG_CHKACCESS)
+#define SetBurst(x) SetFlag(x, FLAG_BURST)
+#define SetBurstAck(x) SetFlag(x, FLAG_BURST_ACK)
+#define SetChannelService(x) SetFlag(x, FLAG_CHSERV)
+#define SetDeaf(x) SetFlag(x, FLAG_DEAF)
+#define SetDebug(x) SetFlag(x, FLAG_DEBUG)
+#define SetGotId(x) SetFlag(x, FLAG_GOTID)
+#define SetIPChecked(x) SetFlag(x, FLAG_IPCHECK)
+#define SetInvisible(x) SetFlag(x, FLAG_INVISIBLE)
+#define SetJunction(x) SetFlag(x, FLAG_JUNCTION)
+#define SetLocOp(x) SetFlag(x, FLAG_LOCOP)
+#define SetOper(x) SetFlag(x, FLAG_OPER)
+#define SetUPing(x) SetFlag(x, FLAG_UPING)
+#define SetWallops(x) SetFlag(x, FLAG_WALLOP)
+#define SetServNotice(x) SetFlag(x, FLAG_SERVNOTICE)
+#define SetHub(x) SetFlag(x, FLAG_HUB)
+#define SetService(x) SetFlag(x, FLAG_SERVICE)
+#define SetAccount(x) SetFlag(x, FLAG_ACCOUNT)
+#define SetHiddenHost(x) SetFlag(x, FLAG_HIDDENHOST)
+#define SetPingSent(x) SetFlag(x, FLAG_PINGSENT)
+
+#define SeeOper(sptr,acptr) (IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) \
+ || HasPriv(sptr, PRIV_SEE_OPERS)))
+
+#define ClearAccess(x) ClrFlag(x, FLAG_CHKACCESS)
+#define ClearBurst(x) ClrFlag(x, FLAG_BURST)
+#define ClearBurstAck(x) ClrFlag(x, FLAG_BURST_ACK)
+#define ClearChannelService(x) ClrFlag(x, FLAG_CHSERV)
+#define ClearDeaf(x) ClrFlag(x, FLAG_DEAF)
+#define ClearDebug(x) ClrFlag(x, FLAG_DEBUG)
+#define ClearIPChecked(x) ClrFlag(x, FLAG_IPCHECK)
+#define ClearInvisible(x) ClrFlag(x, FLAG_INVISIBLE)
+#define ClearLocOp(x) ClrFlag(x, FLAG_LOCOP)
+#define ClearOper(x) ClrFlag(x, FLAG_OPER)
+#define ClearUPing(x) ClrFlag(x, FLAG_UPING)
+#define ClearWallops(x) ClrFlag(x, FLAG_WALLOP)
+#define ClearServNotice(x) ClrFlag(x, FLAG_SERVNOTICE)
+#define ClearHiddenHost(x) ClrFlag(x, FLAG_HIDDENHOST)
+#define ClearPingSent(x) ClrFlag(x, FLAG_PINGSENT)
+
+/* free flags */
+#define FREEFLAG_SOCKET 0x0001 /* socket needs to be freed */
+#define FREEFLAG_TIMER 0x0002 /* timer needs to be freed */
/* server notice stuff */
#define SNO_THROTTLE 0x1000 /* host throttle add/remove notices */
#define SNO_OLDREALOP 0x2000 /* old oper-only messages */
#define SNO_CONNEXIT 0x4000 /* client connect/exit (ugh) */
-#define SNO_DEBUG 0x8000 /* debugging messages (DEBUGMODE only) */
+#define SNO_AUTO 0x8000 /* AUTO G-Lines */
+#define SNO_DEBUG 0x10000 /* debugging messages (DEBUGMODE only) */
#ifdef DEBUGMODE
-# define SNO_ALL 0xffff /* Don't make it larger then significant,
- * that looks nicer */
+# define SNO_ALL 0x1ffff /* Don't make it larger then significant,
+ * that looks nicer */
#else
-# define SNO_ALL 0x7fff
+# define SNO_ALL 0xffff
#endif
#define SNO_USER (SNO_ALL & ~SNO_OPER)
#define SNO_OPER (SNO_CONNEXIT|SNO_OLDREALOP)
#define SNO_NOISY (SNO_SERVKILL|SNO_UNAUTH)
-#define PRIV_CHAN_LIMIT 0x00000001 /* no channel limit on oper */
-#define PRIV_MODE_LCHAN 0x00000002 /* oper can mode local chans */
-#define PRIV_WALK_LCHAN 0x00000004 /* oper can walk thru local modes */
-#define PRIV_DEOP_LCHAN 0x00000008 /* no deop oper on local chans */
-#define PRIV_SHOW_INVIS 0x00000010 /* show local invisible users */
-#define PRIV_SHOW_ALL_INVIS 0x00000020 /* show all invisible users */
-#define PRIV_UNLIMIT_QUERY 0x00000040 /* unlimit who queries */
-
-#define PRIV_KILL 0x00000080 /* oper can KILL */
-#define PRIV_LOCAL_KILL 0x00000100 /* oper can local KILL */
-#define PRIV_REHASH 0x00000200 /* oper can REHASH */
-#define PRIV_RESTART 0x00000400 /* oper can RESTART */
-#define PRIV_DIE 0x00000800 /* oper can DIE */
-#define PRIV_GLINE 0x00001000 /* oper can GLINE */
-#define PRIV_LOCAL_GLINE 0x00002000 /* oper can local GLINE */
-#define PRIV_JUPE 0x00004000 /* oper can JUPE */
-#define PRIV_LOCAL_JUPE 0x00008000 /* oper can local JUPE */
-#define PRIV_OPMODE 0x00010000 /* oper can OP/CLEARMODE */
-#define PRIV_LOCAL_OPMODE 0x00020000 /* oper can local OP/CLEARMODE */
-#define PRIV_SET 0x00040000 /* oper can SET */
-#define PRIV_WHOX 0x00080000 /* oper can use /who x */
-#define PRIV_BADCHAN 0x00100000 /* oper can BADCHAN */
-#define PRIV_LOCAL_BADCHAN 0x00200000 /* oper can local BADCHAN */
-#define PRIV_SEE_CHAN 0x00400000 /* oper can see in secret chans */
-
-#define PRIV_PROPAGATE 0x00800000 /* propagate oper status */
-#define PRIV_DISPLAY 0x01000000 /* "Is an oper" displayed */
-#define PRIV_SEE_OPERS 0x02000000 /* display hidden opers */
-
-#define HasPriv(cli, priv) (cli_privs(cli) & (priv))
+#define PrivSet(fset, flag) FLAGSET_SET(*fset, flag)
+#define PrivClr(fset, flag) FLAGSET_CLEAR(*fset, flag)
+#define PrivHas(fset, flag) FLAGSET_ISSET(*fset, flag)
+
+#define GrantPriv(cli, priv) (PrivSet(&(cli_privs(cli)), priv))
+#define RevokePriv(cli, priv) (PrivClr(&(cli_privs(cli)), priv))
+#define HasPriv(cli, priv) (PrivHas(&(cli_privs(cli)), priv))
typedef enum ShowIPType {
HIDE_IP,
} ShowIPType;
extern const char* get_client_name(const struct Client* sptr, int showip);
+extern const char* client_get_default_umode(const struct Client* sptr);
extern int client_get_ping(const struct Client* local_client);
extern void client_drop_sendq(struct Connection* con);
extern void client_add_sendq(struct Connection* con,
struct Connection** con_p);
-extern void client_set_privs(struct Client* client);
+extern void client_set_privs(struct Client *client, struct ConfItem *oper);
+extern int client_report_privs(struct Client* to, struct Client* client);
#endif /* INCLUDED_client_h */