X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=include%2Fclient.h;h=26f0481cdaf13a7e8a4704dc8ae44e90793d703c;hb=b3e7a2bbceb4d17cdab3ce7579fcaac2aa77868d;hp=dfaccc9180a67a1086996407812f4a2eb70f00b0;hpb=8e0f02c37aa9898f8870a037ec1913e3179a4cca;p=ircu2.10.12-pk.git diff --git a/include/client.h b/include/client.h index dfaccc9..26f0481 100644 --- a/include/client.h +++ b/include/client.h @@ -73,7 +73,7 @@ typedef unsigned long flagpage_t; /** Element number for flag \a flag. */ #define FLAGSET_INDEX(flag) ((flag) / FLAGSET_NBITS) /** Element bit for flag \a flag. */ -#define FLAGSET_MASK(flag) (1<<((flag) % FLAGSET_NBITS)) +#define FLAGSET_MASK(flag) (1ul<<((flag) % FLAGSET_NBITS)) /** Declare a flagset structure of a particular size. */ #define DECLARE_FLAGSET(name,max) \ @@ -83,13 +83,13 @@ typedef unsigned long flagpage_t; } /** Test whether a flag is set in a flagset. */ -#define FLAGSET_ISSET(set,flag) ((set).bits[FLAGSET_INDEX(flag)] & FLAGSET_MASK(flag)) +#define FlagHas(set,flag) ((set)->bits[FLAGSET_INDEX(flag)] & FLAGSET_MASK(flag)) /** Set a flag in a flagset. */ -#define FLAGSET_SET(set, flag) (set).bits[FLAGSET_INDEX(flag)] |= FLAGSET_MASK(flag) +#define FlagSet(set,flag) ((set)->bits[FLAGSET_INDEX(flag)] |= FLAGSET_MASK(flag)) /** Clear a flag in a flagset. */ -#define FLAGSET_CLEAR(set, flag) (set).bits[FLAGSET_INDEX(flag)] &= ~FLAGSET_MASK(flag) +#define FlagClr(set,flag) ((set)->bits[FLAGSET_INDEX(flag)] &= ~FLAGSET_MASK(flag)) -/** String containig valid user modes, in no particular order. */ +/** String containing valid user modes, in no particular order. */ #define infousermodes "dioswkgx" /** Operator privileges. */ @@ -125,6 +125,7 @@ enum Priv PRIV_LIST_CHAN, /**< oper can list secret channels */ PRIV_FORCE_OPMODE, /**< can hack modes on quarantined channels */ PRIV_FORCE_LOCAL_OPMODE, /**< can hack modes on quarantined local channels */ + PRIV_APASS_OPMODE, /**< can hack modes +A/-A/+U/-U */ PRIV_LAST_PRIV /**< number of privileges */ }; @@ -142,12 +143,9 @@ enum Flag 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 - * @todo Remove (never set). */ FLAG_HUB, /**< server is a hub */ + FLAG_IPV6, /**< server understands P10 IPv6 addrs */ FLAG_SERVICE, /**< server is a service */ - FLAG_LOCAL, /**< set for local clients - * @todo Remove (never used). */ FLAG_GOTID, /**< successful ident lookup achieved */ FLAG_DOID, /**< I-lines say must use ident return */ FLAG_NONL, /**< No \n in buffer */ @@ -157,7 +155,6 @@ enum Flag 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_IAUTHED, /**< Got IAUTH response for user */ FLAG_LOCOP, /**< Local operator -- SRB */ FLAG_SERVNOTICE, /**< server notices such as kill */ FLAG_OPER, /**< Operator */ @@ -179,6 +176,8 @@ DECLARE_FLAGSET(Privs, PRIV_LAST_PRIV); /** Declare flagset type for user flags. */ DECLARE_FLAGSET(Flags, FLAG_LAST_FLAG); +#include "capab.h" /* client capabilities */ + /** Represents a local connection. * This contains a lot of stuff irrelevant to server connections, but * those are so rare as to not be worth special-casing. @@ -190,34 +189,30 @@ struct Connection 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 */ + int con_sentalong; /**< sentalong marker for connection */ unsigned int con_snomask; /**< mask for server messages */ time_t con_nextnick; /**< Next time a nick change is allowed */ time_t con_nexttarget;/**< Next time a target change is allowed */ - unsigned int con_cookie; /**< Random number the user must PONG */ + time_t con_lasttime; /**< Last time data read from socket */ + time_t con_since; /**< Last time we accepted a command */ struct MsgQ con_sendQ; /**< Outgoing message queue */ struct DBuf con_recvQ; /**< Incoming data yet to be parsed */ unsigned int con_sendM; /**< Stats: protocol messages sent */ - unsigned int con_sendK; /**< Stats: total k-bytes sent */ unsigned int con_receiveM; /**< Stats: protocol messages received */ - unsigned int con_receiveK; /**< Stats: total k-bytes received */ - unsigned short con_sendB; /**< Bytes sent, mod 1024. */ - unsigned short con_receiveB; /**< Bytes received, mod 1024. */ + uint64_t con_sendB; /**< Bytes sent. */ + uint64_t con_receiveB; /**< Bytes received. */ struct Listener* con_listener; /**< Listening socket which we accepted from. */ struct SLink* con_confs; /**< Associated configuration records. */ HandlerType con_handler; /**< Message index into command table for parsing. */ - struct DNSReply* con_dns_reply; /**< DNS reply received during client - registration. */ struct ListingArgs* con_listing; /**< Current LIST status. */ unsigned int con_max_sendq; /**< cached max send queue for client */ unsigned int con_ping_freq; /**< cached ping freq */ unsigned short con_lastsq; /**< # 2k blocks when sendqueued called last. */ - unsigned short con_port; /**< Remote port number. */ unsigned char con_targets[MAXTARGETS]; /**< Hash values of current targets. */ char con_sock_ip[SOCKIPLEN + 1]; /**< Remote IP address as a string. */ @@ -232,8 +227,10 @@ struct Connection client */ struct Timer con_proc; /**< process latent messages from client */ - struct AuthRequest* con_auth; /**< auth request for client */ - struct IAuthRequest* con_iauth; /**< iauth request for client */ + struct Privs con_privs; /**< Oper privileges */ + struct CapSet con_capab; /**< Client capabilities (from us) */ + struct CapSet con_active; /**< Active capabilities (to us) */ + struct AuthRequest* con_auth; /**< Auth request for client */ }; /** Magic constant to identify valid Connection structures. */ @@ -251,25 +248,16 @@ struct Client { struct Whowas* cli_whowas; /**< Pointer to ww struct to be freed on quit */ char cli_yxx[4]; /**< Numeric Nick: YY if this is a server, XXX if this is a user */ - /* - * XXX - move these to local part for next release - * (lasttime, since) - */ - time_t cli_lasttime; /**< last time data read from socket */ - time_t cli_since; /**< last time we parsed something, flood control */ - - time_t cli_firsttime; /**< time client was created */ - time_t cli_lastnick; /**< TimeStamp on nick */ - int cli_marker; /**< /who processing marker */ - struct Flags cli_flags; /**< client flags */ - unsigned int cli_hopcount; /**< number of servers to this 0 = local */ - struct irc_in_addr cli_ip; /**< Real IP of client */ - short cli_status; /**< Client type */ - unsigned char cli_local; /**< local or remote client */ - 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 */ + time_t cli_firsttime; /**< time client was created */ + time_t cli_lastnick; /**< TimeStamp on nick */ + int cli_marker; /**< /who processing marker */ + struct Flags cli_flags; /**< client flags */ + unsigned int cli_hopcount; /**< number of servers to this 0 = local */ + struct irc_in_addr cli_ip; /**< Real IP of client */ + short cli_status; /**< Client type */ + char cli_name[HOSTLEN + 1]; /**< Unique name of the client, nick or host */ + char cli_username[USERLEN + 1]; /**< Username determined by ident lookup */ + char cli_info[REALLEN + 1]; /**< Free form additional client information */ }; /** Magic constant to identify valid Client structures. */ @@ -288,7 +276,7 @@ struct Client { /** Get connection associated with client. */ #define cli_connect(cli) ((cli)->cli_connect) /** Get local client that links us to \a cli. */ -#define cli_from(cli) ((cli)->cli_connect->con_client) +#define cli_from(cli) con_client(cli_connect(cli)) /** Get User structure for client, if client is a user. */ #define cli_user(cli) ((cli)->cli_user) /** Get Server structure for client, if client is a server. */ @@ -298,9 +286,9 @@ struct Client { /** Get client numnick. */ #define cli_yxx(cli) ((cli)->cli_yxx) /** Get time we last read data from the client socket. */ -#define cli_lasttime(cli) ((cli)->cli_lasttime) +#define cli_lasttime(cli) con_lasttime(cli_connect(cli)) /** Get time we last parsed something from the client. */ -#define cli_since(cli) ((cli)->cli_since) +#define cli_since(cli) con_since(cli_connect(cli)) /** Get time client was created. */ #define cli_firsttime(cli) ((cli)->cli_firsttime) /** Get time client last changed nickname. */ @@ -315,10 +303,14 @@ struct Client { #define cli_ip(cli) ((cli)->cli_ip) /** Get status bitmask for client. */ #define cli_status(cli) ((cli)->cli_status) -/** Get local status flag for client. */ -#define cli_local(cli) ((cli)->cli_local) +/** Return non-zero if the client is local. */ +#define cli_local(cli) (cli_from(cli) == cli) /** Get oper privileges for client. */ -#define cli_privs(cli) ((cli)->cli_privs) +#define cli_privs(cli) con_privs(cli_connect(cli)) +/** Get client capabilities for client */ +#define cli_capab(cli) con_capab(cli_connect(cli)) +/** Get active client capabilities for client */ +#define cli_active(cli) con_active(cli_connect(cli)) /** Get client name. */ #define cli_name(cli) ((cli)->cli_name) /** Get client username (ident). */ @@ -327,73 +319,63 @@ struct Client { #define cli_info(cli) ((cli)->cli_info) /** Get number of incoming bytes queued for client. */ -#define cli_count(cli) ((cli)->cli_connect->con_count) +#define cli_count(cli) con_count(cli_connect(cli)) /** Get file descriptor for sending in client's direction. */ -#define cli_fd(cli) ((cli)->cli_connect->con_fd) +#define cli_fd(cli) con_fd(cli_connect(cli)) /** Get free flags for the client's connection. */ -#define cli_freeflag(cli) ((cli)->cli_connect->con_freeflag) +#define cli_freeflag(cli) con_freeflag(cli_connect(cli)) /** Get last error code for the client's connection. */ -#define cli_error(cli) ((cli)->cli_connect->con_error) +#define cli_error(cli) con_error(cli_connect(cli)) /** Get server notice mask for the client. */ -#define cli_snomask(cli) ((cli)->cli_connect->con_snomask) +#define cli_snomask(cli) con_snomask(cli_connect(cli)) /** Get next time a nick change is allowed for the client. */ -#define cli_nextnick(cli) ((cli)->cli_connect->con_nextnick) +#define cli_nextnick(cli) con_nextnick(cli_connect(cli)) /** Get next time a target change is allowed for the client. */ -#define cli_nexttarget(cli) ((cli)->cli_connect->con_nexttarget) -/** Get required PING/PONG cookie for client. */ -#define cli_cookie(cli) ((cli)->cli_connect->con_cookie) +#define cli_nexttarget(cli) con_nexttarget(cli_connect(cli)) /** Get SendQ for client. */ -#define cli_sendQ(cli) ((cli)->cli_connect->con_sendQ) +#define cli_sendQ(cli) con_sendQ(cli_connect(cli)) /** Get RecvQ for client. */ -#define cli_recvQ(cli) ((cli)->cli_connect->con_recvQ) +#define cli_recvQ(cli) con_recvQ(cli_connect(cli)) /** Get count of messages sent to client. */ -#define cli_sendM(cli) ((cli)->cli_connect->con_sendM) -/** Get number of kilobytes sent to client. */ -#define cli_sendK(cli) ((cli)->cli_connect->con_sendK) +#define cli_sendM(cli) con_sendM(cli_connect(cli)) /** Get number of messages received from client. */ -#define cli_receiveM(cli) ((cli)->cli_connect->con_receiveM) -/** Get number of kilobytes received from client. */ -#define cli_receiveK(cli) ((cli)->cli_connect->con_receiveK) +#define cli_receiveM(cli) con_receiveM(cli_connect(cli)) /** Get number of bytes (modulo 1024) sent to client. */ -#define cli_sendB(cli) ((cli)->cli_connect->con_sendB) +#define cli_sendB(cli) con_sendB(cli_connect(cli)) /** Get number of bytes (modulo 1024) received from client. */ -#define cli_receiveB(cli) ((cli)->cli_connect->con_receiveB) +#define cli_receiveB(cli) con_receiveB(cli_connect(cli)) /** Get listener that accepted the client's connection. */ -#define cli_listener(cli) ((cli)->cli_connect->con_listener) +#define cli_listener(cli) con_listener(cli_connect(cli)) /** Get list of attached conf lines. */ -#define cli_confs(cli) ((cli)->cli_connect->con_confs) +#define cli_confs(cli) con_confs(cli_connect(cli)) /** Get handler type for client. */ -#define cli_handler(cli) ((cli)->cli_connect->con_handler) -/** Get DNS reply for client. */ -#define cli_dns_reply(cli) ((cli)->cli_connect->con_dns_reply) +#define cli_handler(cli) con_handler(cli_connect(cli)) /** Get LIST status for client. */ -#define cli_listing(cli) ((cli)->cli_connect->con_listing) +#define cli_listing(cli) con_listing(cli_connect(cli)) /** Get cached max SendQ for client. */ -#define cli_max_sendq(cli) ((cli)->cli_connect->con_max_sendq) +#define cli_max_sendq(cli) con_max_sendq(cli_connect(cli)) /** Get ping frequency for client. */ -#define cli_ping_freq(cli) ((cli)->cli_connect->con_ping_freq) +#define cli_ping_freq(cli) con_ping_freq(cli_connect(cli)) /** Get lastsq for client's connection. */ -#define cli_lastsq(cli) ((cli)->cli_connect->con_lastsq) -/** Get remote port number for client. */ -#define cli_port(cli) ((cli)->cli_connect->con_port) +#define cli_lastsq(cli) con_lastsq(cli_connect(cli)) /** Get the array of current targets for the client. */ -#define cli_targets(cli) ((cli)->cli_connect->con_targets) +#define cli_targets(cli) con_targets(cli_connect(cli)) /** Get the string form of the client's IP address. */ -#define cli_sock_ip(cli) ((cli)->cli_connect->con_sock_ip) +#define cli_sock_ip(cli) con_sock_ip(cli_connect(cli)) /** Get the resolved hostname for the client. */ -#define cli_sockhost(cli) ((cli)->cli_connect->con_sockhost) +#define cli_sockhost(cli) con_sockhost(cli_connect(cli)) /** Get the client's password. */ -#define cli_passwd(cli) ((cli)->cli_connect->con_passwd) +#define cli_passwd(cli) con_passwd(cli_connect(cli)) /** Get the unprocessed input buffer for a client's connection. */ -#define cli_buffer(cli) ((cli)->cli_connect->con_buffer) +#define cli_buffer(cli) con_buffer(cli_connect(cli)) /** Get the Socket structure for sending to a client. */ -#define cli_socket(cli) ((cli)->cli_connect->con_socket) +#define cli_socket(cli) con_socket(cli_connect(cli)) /** Get Timer for processing waiting messages from the client. */ -#define cli_proc(cli) ((cli)->cli_connect->con_proc) +#define cli_proc(cli) con_proc(cli_connect(cli)) /** Get auth request for client. */ -#define cli_auth(cli) ((cli)->cli_connect->con_auth) -/** Get iauth request for client. */ -#define cli_iauth(cli) ((cli)->cli_connect->con_iauth) +#define cli_auth(cli) con_auth(cli_connect(cli)) +/** Get sentalong marker for client. */ +#define cli_sentalong(cli) con_sentalong(cli_connect(cli)) /** Verify that a connection is valid. */ #define con_verify(con) ((con)->con_magic == CONNECTION_MAGIC) @@ -408,31 +390,31 @@ struct Client { /** Get number of unprocessed data bytes from connection. */ #define con_count(con) ((con)->con_count) /** Get file descriptor for connection. */ -#define con_fd(con) ((con)->con_fd) +#define con_fd(con) s_fd(&(con)->con_socket) /** Get freeable flags for connection. */ #define con_freeflag(con) ((con)->con_freeflag) /** Get last error code on connection. */ #define con_error(con) ((con)->con_error) +/** Get sentalong marker for connection. */ +#define con_sentalong(con) ((con)->con_sentalong) /** Get server notice mask for connection. */ #define con_snomask(con) ((con)->con_snomask) /** Get next nick change time for connection. */ #define con_nextnick(con) ((con)->con_nextnick) /** Get next new target time for connection. */ #define con_nexttarget(con) ((con)->con_nexttarget) -/** Get PING/PONG confirmation cookie for connection. */ -#define con_cookie(con) ((con)->con_cookie) +/** Get last time we read from the connection. */ +#define con_lasttime(con) ((con)->con_lasttime) +/** Get last time we accepted a command from the connection. */ +#define con_since(con) ((con)->con_since) /** Get SendQ for connection. */ #define con_sendQ(con) ((con)->con_sendQ) /** Get RecvQ for connection. */ #define con_recvQ(con) ((con)->con_recvQ) /** Get number of messages sent to connection. */ #define con_sendM(con) ((con)->con_sendM) -/** Get number of kilobytes sent to connection. */ -#define con_sendK(con) ((con)->con_sendK) /** Get number of messages received from connection. */ #define con_receiveM(con) ((con)->con_receiveM) -/** Get number of kilobytes received from connection. */ -#define con_receiveK(con) ((con)->con_receiveK) /** Get number of bytes (modulo 1024) sent to connection. */ #define con_sendB(con) ((con)->con_sendB) /** Get number of bytes (modulo 1024) received from connection. */ @@ -443,8 +425,6 @@ struct Client { #define con_confs(con) ((con)->con_confs) /** Get command handler for the connection. */ #define con_handler(con) ((con)->con_handler) -/** Get DNS reply for the connection. */ -#define con_dns_reply(con) ((con)->con_dns_reply) /** Get the LIST status for the connection. */ #define con_listing(con) ((con)->con_listing) /** Get the maximum permitted SendQ size for the connection. */ @@ -453,8 +433,6 @@ struct Client { #define con_ping_freq(con) ((con)->con_ping_freq) /** Get the lastsq for the connection. */ #define con_lastsq(con) ((con)->con_lastsq) -/** Get the remote port number for the connection. */ -#define con_port(con) ((con)->con_port) /** Get the current targets array for the connection. */ #define con_targets(con) ((con)->con_targets) /** Get the string-formatted IP address for the connection. */ @@ -469,10 +447,14 @@ struct Client { #define con_socket(con) ((con)->con_socket) /** Get the Timer for processing more data from the connection. */ #define con_proc(con) ((con)->con_proc) +/** Get the oper privilege set for the connection. */ +#define con_privs(con) (&(con)->con_privs) +/** Get the peer's capabilities for the connection. */ +#define con_capab(con) (&(con)->con_capab) +/** Get the active capabilities for the connection. */ +#define con_active(con) (&(con)->con_active) /** Get the auth request for the connection. */ #define con_auth(con) ((con)->con_auth) -/** Get the iauth request for the connection. */ -#define con_iauth(con) ((con)->con_iauth) #define STAT_CONNECTING 0x001 /**< connecting to another server */ #define STAT_HANDSHAKE 0x002 /**< pass - server sent */ @@ -541,23 +523,15 @@ struct Client { /* * flags macros */ -/** Set a flag in a flagset. */ -#define FlagSet(fset, flag) FLAGSET_SET(*fset, flag) -/** Clear a flag from a flagset. */ -#define FlagClr(fset, flag) FLAGSET_CLEAR(*fset, flag) -/** Return non-zero if a flag is set in a flagset. */ -#define FlagHas(fset, flag) FLAGSET_ISSET(*fset, flag) /** Set a flag in a client's flags. */ -#define SetFlag(cli, flag) FlagSet(&cli_flags(cli), flag) +#define SetFlag(cli, flag) FlagSet(&cli_flags(cli), flag) /** Clear a flag from a client's flags. */ -#define ClrFlag(cli, flag) FlagClr(&cli_flags(cli), flag) +#define ClrFlag(cli, flag) FlagClr(&cli_flags(cli), flag) /** Return non-zero if a flag is set in a client's flags. */ -#define HasFlag(cli, flag) FlagHas(&cli_flags(cli), flag) +#define HasFlag(cli, flag) FlagHas(&cli_flags(cli), flag) -/** Return non-zero if we can check the client's access. */ -#define DoAccess(x) HasFlag(x, FLAG_CHKACCESS) /** Return non-zero if the client is an IRC operator (global or local). */ -#define IsAnOper(x) (HasFlag(x, FLAG_OPER) || HasFlag(x, FLAG_LOCOP)) +#define IsAnOper(x) (IsOper(x) || IsLocOp(x)) /** Return non-zero if the client's connection is blocked. */ #define IsBlocked(x) HasFlag(x, FLAG_BLOCKED) /** Return non-zero if the client's connection is still being burst. */ @@ -575,18 +549,14 @@ struct Client { #define IsDeaf(x) HasFlag(x, FLAG_DEAF) /** Return non-zero if the client has been IP-checked for clones. */ #define IsIPChecked(x) HasFlag(x, FLAG_IPCHECK) -/** Return non-zero if the client has been okayed by iauth. */ -#define IsIAuthed(x) HasFlag(x, FLAG_IAUTHED) /** Return non-zero if we have received an ident response for the client. */ #define IsIdented(x) HasFlag(x, FLAG_GOTID) /** Return non-zero if the client has set mode +i (invisible). */ #define IsInvisible(x) HasFlag(x, FLAG_INVISIBLE) /** Return non-zero if the client caused a net.burst. */ #define IsJunction(x) HasFlag(x, FLAG_JUNCTION) -/** Return non-zero if the client has set mode +O (local operator). */ -#define IsLocOp(x) HasFlag(x, FLAG_LOCOP) -/** Return non-zero if the client is directly connected. */ -#define IsLocal(x) HasFlag(x, FLAG_LOCAL) +/** Return non-zero if the client has set mode +O (local operator) locally. */ +#define IsLocOp(x) (MyConnect(x) && HasFlag(x, FLAG_LOCOP)) /** Return non-zero if the client has set mode +o (global operator). */ #define IsOper(x) HasFlag(x, FLAG_OPER) /** Return non-zero if the client has an active UDP ping request. */ @@ -601,6 +571,8 @@ struct Client { #define SendWallops(x) HasFlag(x, FLAG_WALLOP) /** Return non-zero if the client claims to be a hub. */ #define IsHub(x) HasFlag(x, FLAG_HUB) +/** Return non-zero if the client understands IPv6 addresses in P10. */ +#define IsIPv6(x) HasFlag(x, FLAG_IPV6) /** Return non-zero if the client claims to be a services server. */ #define IsService(x) HasFlag(x, FLAG_SERVICE) /** Return non-zero if the client has an account stamp. */ @@ -615,8 +587,6 @@ struct Client { /** Return non-zero if the client's host is hidden. */ #define HasHiddenHost(x) (IsHiddenHost(x) && IsAccount(x)) -/** Mark a client as being okay to check access. */ -#define SetAccess(x) SetFlag(x, FLAG_CHKACCESS) /** Mark a client as having an in-progress net.burst. */ #define SetBurst(x) SetFlag(x, FLAG_BURST) /** Mark a client as being between EOB and EOB ACK. */ @@ -631,8 +601,6 @@ struct Client { #define SetGotId(x) SetFlag(x, FLAG_GOTID) /** Mark a client as being IP-checked. */ #define SetIPChecked(x) SetFlag(x, FLAG_IPCHECK) -/** Mark a client as being iauth-checked. */ -#define SetIAuthed(x) SetFlag(x, FLAG_IAUTHED) /** Mark a client as having mode +i (invisible). */ #define SetInvisible(x) SetFlag(x, FLAG_INVISIBLE) /** Mark a client as causing a net.join. */ @@ -649,6 +617,8 @@ struct Client { #define SetServNotice(x) SetFlag(x, FLAG_SERVNOTICE) /** Mark a client as being a hub server. */ #define SetHub(x) SetFlag(x, FLAG_HUB) +/** Mark a client as being an IPv6-grokking server. */ +#define SetIPv6(x) SetFlag(x, FLAG_IPV6) /** Mark a client as being a services server. */ #define SetService(x) SetFlag(x, FLAG_SERVICE) /** Mark a client as having an account stamp. */ @@ -662,8 +632,6 @@ struct Client { #define SeeOper(sptr,acptr) (IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) \ || HasPriv(sptr, PRIV_SEE_OPERS))) -/** Clear the client's okay to check access flag. */ -#define ClearAccess(x) ClrFlag(x, FLAG_CHKACCESS) /** Clear the client's net.burst in-progress flag. */ #define ClearBurst(x) ClrFlag(x, FLAG_BURST) /** Clear the client's between EOB and EOB ACK flag. */ @@ -692,6 +660,8 @@ struct Client { #define ClearHiddenHost(x) ClrFlag(x, FLAG_HIDDENHOST) /** Clear the client's pending PING flag. */ #define ClearPingSent(x) ClrFlag(x, FLAG_PINGSENT) +/** Clear the client's HUB flag. */ +#define ClearHub(x) ClrFlag(x, FLAG_HUB) /* free flags */ #define FREEFLAG_SOCKET 0x0001 /**< socket needs to be freed */ @@ -721,12 +691,13 @@ struct Client { #define SNO_CONNEXIT 0x4000 /**< client connect/exit (ugh) */ #define SNO_AUTO 0x8000 /**< AUTO G-Lines */ #define SNO_DEBUG 0x10000 /**< debugging messages (DEBUGMODE only) */ +#define SNO_AUTH 0x20000 /**< IAuth notices */ +/** Bitmask of all valid server notice bits. */ #ifdef DEBUGMODE -# define SNO_ALL 0x1ffff /**< Bitmask of all valid server - * notice bits. */ +# define SNO_ALL 0x3ffff #else -# define SNO_ALL 0xffff +# define SNO_ALL 0x2ffff #endif /** Server notice bits allowed to normal users. */ @@ -737,23 +708,21 @@ struct Client { /** Server notice bits enabled by default for IRC operators. */ #define SNO_OPERDEFAULT (SNO_DEFAULT|SNO_HACK2|SNO_HACK4|SNO_THROTTLE|SNO_OLDSNO) /** Server notice bits reserved to IRC operators. */ -#define SNO_OPER (SNO_CONNEXIT|SNO_OLDREALOP) +#define SNO_OPER (SNO_CONNEXIT|SNO_OLDREALOP|SNO_AUTH) /** Noisy server notice bits that cause other bits to be cleared during connect. */ #define SNO_NOISY (SNO_SERVKILL|SNO_UNAUTH) -/** Set a privilege flag on a privilege flagset. */ -#define PrivSet(fset, flag) FLAGSET_SET(*fset, flag) -/** Clear a privilege flag from a privilege flagset. */ -#define PrivClr(fset, flag) FLAGSET_CLEAR(*fset, flag) -/** Test a privilege flag in a privilege flagset. */ -#define PrivHas(fset, flag) FLAGSET_ISSET(*fset, flag) - +/** Test whether a privilege has been granted to a client. */ +#define HasPriv(cli, priv) FlagHas(cli_privs(cli), priv) /** Grant a privilege to a client. */ -#define GrantPriv(cli, priv) (PrivSet(&(cli_privs(cli)), priv)) +#define SetPriv(cli, priv) FlagSet(cli_privs(cli), priv) /** Revoke a privilege from a client. */ -#define RevokePriv(cli, priv) (PrivClr(&(cli_privs(cli)), priv)) -/** Test whether a privilege has been grated to a client. */ -#define HasPriv(cli, priv) (PrivHas(&(cli_privs(cli)), priv)) +#define ClrPriv(cli, priv) FlagClr(cli_privs(cli), priv) + +/** Test whether a client has a capability */ +#define HasCap(cli, cap) CapHas(cli_capab(cli), (cap)) +/** Test whether a client has the capability active */ +#define CapActive(cli, cap) CapHas(cli_active(cli), (cap)) #define HIDE_IP 0 /**< Do not show IP address in get_client_name() */ #define SHOW_IP 1 /**< Show ident and IP address in get_client_name() */