ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/client.h
(Generate patch)

Comparing:
ircd-hybrid-7.2/include/client.h (file contents), Revision 317 by michael, Sat Dec 24 14:45:17 2005 UTC vs.
ircd-hybrid-7.3/include/client.h (file contents), Revision 1124 by michael, Mon Feb 7 11:45:27 2011 UTC

# Line 25 | Line 25
25   #ifndef INCLUDED_client_h
26   #define INCLUDED_client_h
27  
28 + #include "list.h"
29   #include "fdlist.h"
30 < #include "setup.h"
30 > #include "config.h"
31   #include "ircd_defs.h"
32   #include "ircd_handler.h"
33   #include "dbuf.h"
# Line 44 | Line 45
45   */
46   struct AccessItem;
47   struct Whowas;
47 struct DNSReply;
48   struct Listener;
49   struct Client;
50   struct LocalUser;
51  
52 /*
53 * Client structures
54 */
52  
53   struct Server
54   {
58  char by[NICKLEN];       /* who activated this connection     */
55    struct ConfItem *sconf; /* ConfItem connect{} pointer for this server */
56 <  dlink_list servers;     /* Servers on this server            */
57 <  dlink_list users;       /* Users on this server              */
58 <  int dep_servers;        /* Total number of dependent servers on all levels */
63 <  int dep_users;          /* Total number of dependent users on all levels */
56 >  dlink_list server_list; /* Servers on this server            */
57 >  dlink_list client_list; /* Clients on this server            */
58 >  char by[NICKLEN];       /* who activated this connection     */
59   };
60  
61   struct SlinkRpl
# Line 74 | Line 69 | struct SlinkRpl
69  
70   struct ZipStats
71   {
72 <  unsigned long in;
73 <  unsigned long in_wire;
74 <  unsigned long out;
75 <  unsigned long out_wire;
72 >  uint64_t in;
73 >  uint64_t in_wire;
74 >  uint64_t out;
75 >  uint64_t out_wire;
76    double in_ratio;
77    double out_ratio;
78   };
79  
80   struct ListTask
81   {
82 <  int hash_index;       /* the bucket we are currently in */
82 >  unsigned int hash_index; /* the bucket we are currently in */
83    dlink_list show_mask; /* show these channels..          */
84    dlink_list hide_mask; /* ..and hide these ones          */
85    unsigned int users_min, users_max;
# Line 97 | Line 92 | struct Client
92    dlink_node node;
93    dlink_node lnode;             /* Used for Server->servers/users */
94  
95 <  struct Client *hnext;         /* For client hash table lookups by name */
96 <  struct Client *idhnext;       /* For SID hash table lookups by sid */
97 <
98 <  struct Server*    serv;       /* ...defined, if this is a server */
99 <  struct Client*    servptr;    /* Points to server this Client is on */
100 <  struct Client*    from;       /* == self, if Local Client, *NEVER* NULL! */
95 >  struct LocalUser *localClient;
96 >  struct Client    *hnext;              /* For client hash table lookups by name */
97 >  struct Client    *idhnext;    /* For SID hash table lookups by sid */
98 >  struct Server    *serv;       /* ...defined, if this is a server */
99 >  struct Client    *servptr;    /* Points to server this Client is on */
100 >  struct Client    *from;       /* == self, if Local Client, *NEVER* NULL! */
101 >  struct Whowas    *whowas;     /* Pointers to whowas structs */
102 >  char             *away;
103  
107  struct Whowas*    whowas;     /* Pointers to whowas structs */
104    time_t            lasttime;   /* ...should be only LOCAL clients? --msa */
105    time_t            firsttime;  /* time client was created */
106    time_t            since;      /* last time we parsed something */
107    time_t            tsinfo;     /* TS on the nick, SVINFO on server */
108 <  unsigned long     connect_id; /* unique connection ID */
108 >  uint64_t          flags;      /* client flags */
109 >
110    unsigned int      umodes;     /* opers, normal users subset */
111 <  unsigned int      flags;      /* client flags */
111 >  unsigned int      hopcount;   /* number of servers to this 0 = local */
112 >  unsigned int      status;     /* Client type */
113 >  unsigned int      handler;    /* Handler index */
114 >
115 >  dlink_list        channel;   /* chain of channel pointer blocks */
116  
116  unsigned short    hopcount;   /* number of servers to this 0 = local */
117  unsigned short    status;     /* Client type */
118  unsigned char     handler;    /* Handler index */
119  unsigned long     serial;     /* used to enforce 1 send per nick */
120  unsigned long     lazyLinkClientExists; /* This client exists on the
121                                           * bit mapped lazylink servers
122                                           * mapped here
123                                           */
124  char *away;
117    /*
118     * client->name is the unique name for a client nick or host
119     */
120    char name[HOSTLEN + 1];
121    char id[IDLEN + 1];       /* client ID, unique ID per client */
122  
131  /*
132   * client->llname is used to store the clients requested nick
133   * temporarily for new connections.
134   */
135  char              llname[NICKLEN];
136
123    /*
124     * client->username is the username from ident or the USER message,
125     * If the client is idented the USER message is ignored, otherwise
# Line 157 | Line 143 | struct Client
143     */
144    char              info[REALLEN + 1]; /* Free form additional client info */
145  
146 <  /* client->sockhost contains the ip address gotten from the socket as a
146 >  /*
147 >   * client->sockhost contains the ip address gotten from the socket as a
148     * string, this field should be considered read-only once the connection
149     * has been made. (set in s_bsd.c only)
150     */
151    char              sockhost[HOSTIPLEN + 1]; /* This is the host name from the
152                                                  socket ip address as string */
166  /* caller ID allow list */
167  /* This has to be here, since a client on an on_allow_list could
168   * be a remote client. simpler to keep both here.
169   */
170  dlink_list    allow_list;     /* clients I'll allow to talk to me */
171  dlink_list    on_allow_list;  /* clients that have =me= on their allow list*/
172
173  dlink_list     channel;   /* chain of channel pointer blocks */
174
175  struct LocalUser *localClient;
153   };
154  
155   struct LocalUser
# Line 181 | Line 158 | struct LocalUser
158     * The following fields are allocated only for local clients
159     * (directly connected to *this* server with a socket.
160     */
161 +  dlink_node   lclient_node;
162 +
163 +  char         client_host[HOSTLEN + 1];
164 +  char         client_server[HOSTLEN + 1];
165 +
166 +  unsigned int registration;
167 +  unsigned int cap_client;    /* Client capabilities (from us) */
168 +  unsigned int cap_active;    /* Active capabilities (to us) */
169 +
170 +  unsigned int operflags;     /* oper priv flags */
171 +  unsigned int random_ping;
172 +
173 +  unsigned int serial;     /* used to enforce 1 send per nick */
174 +
175    /* Anti flooding part, all because of lamers... */
176 <  time_t            last_away; /* Away since... */
177 <  time_t            last_join_time;   /* when this client last
178 <                                         joined a channel */
179 <  time_t            last_leave_time;  /* when this client last
176 >  time_t       last_knock;    /* time of last knock */
177 >  time_t       last_away; /* Away since... */
178 >  time_t       last_join_time;   /* when this client last
179 >                                    joined a channel */
180 >  time_t       last_leave_time;  /* when this client last
181                                         * left a channel */
182 <  int               join_leave_count; /* count of JOIN/LEAVE in less than
182 >  int          join_leave_count; /* count of JOIN/LEAVE in less than
183                                           MIN_JOIN_LEAVE_TIME seconds */
184 <  int               oper_warn_count_down; /* warn opers of this possible
184 >  int          oper_warn_count_down; /* warn opers of this possible
185                                            spambot every time this gets to 0 */
186 <  time_t            reject_delay;
187 <  time_t            last_caller_id_time;
188 <  time_t            first_received_message_time;
189 <  int               received_number_of_privmsgs;
198 <  int               flood_noticed;
199 <
200 <  dlink_node        lclient_node;
186 >  time_t       reject_delay;
187 >  time_t       last_caller_id_time;
188 >  time_t       first_received_message_time;
189 >  time_t       last_nick_change;
190  
191 <  unsigned int      operflags; /* oper priv flags */
191 >  int          received_number_of_privmsgs;
192 >  unsigned int number_of_nick_changes;
193  
194 <  struct ListTask   *list_task;
194 >  struct ListTask  *list_task;
195    /* Send and receive dbufs .. */
196    struct dbuf_queue buf_sendq;
197    struct dbuf_queue buf_recvq;
# Line 211 | Line 201 | struct LocalUser
201      uint64_t bytes;             /* Statistics: total bytes sent/received */
202    } recv, send;
203  
204 +  struct AuthRequest *auth;
205    struct Listener *listener;   /* listener accepted from */
206 +  dlink_list        acceptlist; /* clients I'll allow to talk to me */
207 +  dlink_list        watches;   /* chain of Watch pointer blocks */
208    dlink_list        confs;     /* Configuration record associated */
209    dlink_list        invited;   /* chain of invite pointer blocks */
210    struct irc_ssaddr ip;
211    int               aftype;     /* Makes life easier for DNS res in IPV6 */
219  struct DNSQuery   *dns_query; /* result returned from resolver query */
220  unsigned long     serverMask; /* Only used for Lazy Links */
212    time_t last; /* Last time we got a PRIVMSG */
222  time_t            last_nick_change;
223  int               number_of_nick_changes;
213  
214    char              *passwd;
215 <  int               caps;       /* capabilities bit-field */
216 <  int               enc_caps;   /* cipher capabilities bit-field */
215 >  unsigned int       caps;       /* capabilities bit-field */
216 >  unsigned int       enc_caps;   /* cipher capabilities bit-field */
217  
218   #ifdef HAVE_LIBCRYPTO
219    struct EncCapability *in_cipher;
# Line 252 | Line 241 | struct LocalUser
241     */
242    int allow_read;       /* how many we're allowed to read in this second */
243    int sent_parsed;      /* how many messages we've parsed in this second */
255  time_t last_knock;    /* time of last knock */
256  unsigned long random_ping;
244  
245    char*          response;  /* expected response from client */
246    char*          auth_oper; /* Operator to become if they supply the response.*/
# Line 269 | Line 256 | struct LocalUser
256   #define STAT_SERVER             0x10
257   #define STAT_CLIENT             0x20
258  
259 + #define REG_NEED_USER 0x1
260 + #define REG_NEED_NICK 0x2
261 + #define REG_NEED_CAP  0x4
262 + #define REG_INIT (REG_NEED_USER|REG_NEED_NICK)
263 +
264   #define HasID(x)                ((x)->id[0] != '\0')
265   #define ID(x)                   (HasID(x) ? (x)->id : (x)->name)
266   #define ID_or_name(x,client_p)  ((IsCapable(client_p, CAP_TS6) && HasID(x)) ? (x)->id : (x)->name)
# Line 310 | Line 302 | struct LocalUser
302   * ts stuff
303   */
304   #define TS_CURRENT      6       /* current TS protocol version */
305 < #ifdef TS5_ONLY
314 < #define TS_MIN          5
315 < #else
316 < #define TS_MIN          3       /* minimum supported TS protocol version */
317 < #endif
305 > #define TS_MIN          5       /* minimum supported TS protocol version */
306   #define TS_DOESTS       0x20000000
307   #define DoesTS(x)       ((x)->tsinfo == TS_DOESTS)
308  
309  
310 +
311 + #define CAP_MULTI_PREFIX  0x00000001
312 +
313   /* housekeeping flags */
314 < #define FLAGS_PINGSENT    0x00000001 /* Unreplied ping sent                      */
315 < #define FLAGS_DEADSOCKET  0x00000002 /* Local socket is dead--Exiting soon       */
316 < #define FLAGS_KILLED      0x00000004 /* Prevents "QUIT" from being sent for this */
317 < #define FLAGS_CLOSING     0x00000008 /* set when closing to suppress errors      */
318 < #define FLAGS_GOTID       0x00000010 /* successful ident lookup achieved         */
319 < #define FLAGS_NEEDID      0x00000020 /* I-lines say must use ident return        */
320 < #define FLAGS_SENDQEX     0x00000040 /* Sendq exceeded                           */
321 < #define FLAGS_IPHASH      0x00000080 /* iphashed this client                     */
322 < #define FLAGS_CRYPTIN     0x00000100 /* incoming data must be decrypted          */
323 < #define FLAGS_CRYPTOUT    0x00000200 /* outgoing data must be encrypted          */
324 < #define FLAGS_WAITAUTH    0x00000400 /* waiting for CRYPTLINK AUTH command       */
325 < #define FLAGS_SERVLINK    0x00000800 /* servlink has servlink process            */
326 < #define FLAGS_MARK        0x00001000 /* marked client                            */
327 < #define FLAGS_CANFLOOD    0x00002000 /* client has the ability to flood          */
328 < #define FLAGS_EXEMPTGLINE 0x00004000 /* client can't be G-lined                  */
329 < #define FLAGS_EXEMPTKLINE 0x00008000 /* client is exempt from kline              */
330 < #define FLAGS_NOLIMIT     0x00010000 /* client is exempt from limits             */
331 < #define FLAGS_RESTRICTED  0x00020000 /* client cannot op others                  */
332 < #define FLAGS_PING_COOKIE 0x00040000 /* PING Cookie                              */
333 < #define FLAGS_IDLE_LINED  0x00080000 /* client is exempt from idle-time limits   */
334 < #define FLAGS_IP_SPOOFING 0x00100000 /* client IP is spoofed                     */
335 < #define FLAGS_FLOODDONE   0x00200000 /* Flood grace period has been ended.       */
336 < #define FLAGS_EOB         0x00400000 /* server has received EOB                  */
337 < #define FLAGS_HIDDEN      0x00800000 /* a hidden server. not shown in /links     */
338 < #define FLAGS_BLOCKED     0x01000000 /* must wait for COMM_SELECT_WRITE          */
339 < #define FLAGS_SBLOCKED    0x02000000 /* slinkq is blocked                        */
340 < #define FLAGS_USERHOST    0x04000000 /* client is in userhost hash               */
341 < #define FLAGS_BURSTED     0x08000000 /* user was already bursted                 */
342 < #define FLAGS_EXEMPTRESV  0x10000000 /* client is exempt from RESV               */
343 < #define FLAGS_GOTUSER     0x20000000 /* if we received a USER command            */
344 < #define FLAGS_PINGWARNING 0x40000000 /* unreplied ping warning already sent      */
345 < /*                        0x80000000  */
314 > #define FLAGS_PINGSENT      0x0000000000000001 /* Unreplied ping sent                      */
315 > #define FLAGS_DEADSOCKET    0x0000000000000002 /* Local socket is dead--Exiting soon       */
316 > #define FLAGS_KILLED        0x0000000000000004 /* Prevents "QUIT" from being sent for this */
317 > #define FLAGS_CLOSING       0x0000000000000008 /* set when closing to suppress errors      */
318 > #define FLAGS_GOTID         0x0000000000000010 /* successful ident lookup achieved         */
319 > #define FLAGS_NEEDID        0x0000000000000020 /* I-lines say must use ident return        */
320 > #define FLAGS_SENDQEX       0x0000000000000040 /* Sendq exceeded                           */
321 > #define FLAGS_IPHASH        0x0000000000000080 /* iphashed this client                     */
322 > #define FLAGS_CRYPTIN       0x0000000000000100 /* incoming data must be decrypted          */
323 > #define FLAGS_CRYPTOUT      0x0000000000000200 /* outgoing data must be encrypted          */
324 > #define FLAGS_WAITAUTH      0x0000000000000400 /* waiting for CRYPTLINK AUTH command       */
325 > #define FLAGS_SERVLINK      0x0000000000000800 /* servlink has servlink process            */
326 > #define FLAGS_MARK          0x0000000000001000 /* marked client                            */
327 > #define FLAGS_CANFLOOD      0x0000000000002000 /* client has the ability to flood          */
328 > #define FLAGS_EXEMPTGLINE   0x0000000000004000 /* client can't be G-lined                  */
329 > #define FLAGS_EXEMPTKLINE   0x0000000000008000 /* client is exempt from kline              */
330 > #define FLAGS_NOLIMIT       0x0000000000010000 /* client is exempt from limits             */
331 > #define FLAGS_RESTRICTED    0x0000000000020000 /* client cannot op others                  */
332 > #define FLAGS_PING_COOKIE   0x0000000000040000 /* PING Cookie                              */
333 > #define FLAGS_IDLE_LINED    0x0000000000080000 /* client is exempt from idle-time limits   */
334 > #define FLAGS_IP_SPOOFING   0x0000000000100000 /* client IP is spoofed                     */
335 > #define FLAGS_FLOODDONE     0x0000000000200000 /* Flood grace period has been ended.       */
336 > #define FLAGS_EOB           0x0000000000400000 /* server has received EOB                  */
337 > #define FLAGS_HIDDEN        0x0000000000800000 /* a hidden server. not shown in /links     */
338 > #define FLAGS_BLOCKED       0x0000000001000000 /* must wait for COMM_SELECT_WRITE          */
339 > #define FLAGS_SBLOCKED      0x0000000002000000 /* slinkq is blocked                        */
340 > #define FLAGS_USERHOST      0x0000000004000000 /* client is in userhost hash               */
341 > #define FLAGS_BURSTED       0x0000000008000000 /* user was already bursted                 */
342 > #define FLAGS_EXEMPTRESV    0x0000000010000000 /* client is exempt from RESV               */
343 > #define FLAGS_GOTUSER       0x0000000020000000 /* if we received a USER command            */
344 > #define FLAGS_PINGWARNING   0x0000000040000000 /* unreplied ping warning already sent      */
345 > #define FLAGS_FINISHED_AUTH 0x0000000080000000 /* Client has been released from auth       */
346 > #define FLAGS_FLOOD_NOTICED 0x0000000100000000
347  
348  
349   /* umodes, settable flags */
350 < #define UMODE_SERVNOTICE   0x00001 /* server notices such as kill */
351 < #define UMODE_CCONN        0x00002 /* Client Connections */
352 < #define UMODE_REJ          0x00004 /* Bot Rejections */
353 < #define UMODE_SKILL        0x00008 /* Server Killed */
354 < #define UMODE_FULL         0x00010 /* Full messages */
355 < #define UMODE_SPY          0x00020 /* see STATS / LINKS */
356 < #define UMODE_DEBUG        0x00040 /* 'debugging' info */
357 < #define UMODE_NCHANGE      0x00080 /* Nick change notice */
358 < #define UMODE_WALLOP       0x00100 /* send wallops to them */
359 < #define UMODE_OPERWALL     0x00200 /* Operwalls */
360 < #define UMODE_INVISIBLE    0x00400 /* makes user invisible */
361 < #define UMODE_BOTS         0x00800 /* shows bots */
362 < #define UMODE_EXTERNAL     0x01000 /* show servers introduced and splitting */
363 < #define UMODE_CALLERID     0x02000 /* block unless caller id's */
364 < #define UMODE_SOFTCALLERID 0x04000 /* block unless on common channel */
365 < #define UMODE_UNAUTH       0x08000 /* show unauth connects here */
366 < #define UMODE_LOCOPS       0x10000 /* show locops */
367 < #define UMODE_DEAF         0x20000 /* don't receive channel messages */
350 > #define UMODE_SERVNOTICE   0x00000001 /* server notices such as kill */
351 > #define UMODE_CCONN        0x00000002 /* Client Connections */
352 > #define UMODE_REJ          0x00000004 /* Bot Rejections */
353 > #define UMODE_SKILL        0x00000008 /* Server Killed */
354 > #define UMODE_FULL         0x00000010 /* Full messages */
355 > #define UMODE_SPY          0x00000020 /* see STATS / LINKS */
356 > #define UMODE_DEBUG        0x00000040 /* 'debugging' info */
357 > #define UMODE_NCHANGE      0x00000080 /* Nick change notice */
358 > #define UMODE_WALLOP       0x00000100 /* send wallops to them */
359 > #define UMODE_OPERWALL     0x00000200 /* Operwalls */
360 > #define UMODE_INVISIBLE    0x00000400 /* makes user invisible */
361 > #define UMODE_BOTS         0x00000800 /* shows bots */
362 > #define UMODE_EXTERNAL     0x00001000 /* show servers introduced and splitting */
363 > #define UMODE_CALLERID     0x00002000 /* block unless caller id's */
364 > #define UMODE_SOFTCALLERID 0x00004000 /* block unless on common channel */
365 > #define UMODE_UNAUTH       0x00008000 /* show unauth connects here */
366 > #define UMODE_LOCOPS       0x00010000 /* show locops */
367 > #define UMODE_DEAF         0x00020000 /* don't receive channel messages */
368 > #define UMODE_CCONN_FULL   0x00040000 /* add unused fields to connection monitoring */
369  
370   /* user information flags, only settable by remote mode or local oper */
371 < #define UMODE_OPER         0x40000 /* Operator */
372 < #define UMODE_ADMIN        0x80000 /* Admin on server */
371 > #define UMODE_OPER         0x40000000 /* Operator */
372 > #define UMODE_ADMIN        0x80000000 /* Admin on server */
373 >
374   #define UMODE_ALL          UMODE_SERVNOTICE
375  
376   #define SEND_UMODES  (UMODE_INVISIBLE | UMODE_OPER | UMODE_WALLOP | \
# Line 404 | Line 398 | struct LocalUser
398  
399  
400   /* flags macros. */
401 + #define IsMsgFloodNoticed(x)       ((x)->flags & FLAGS_FLOOD_NOTICED)
402 + #define SetMsgFloodNoticed(x)      ((x)->flags |= FLAGS_FLOOD_NOTICED)
403 + #define ClearMsgFloodNoticed(x)    ((x)->flags &= ~FLAGS_FLOOD_NOTICED)
404 + #define IsAuthFinished(x)       ((x)->flags & FLAGS_FINISHED_AUTH)
405   #define IsDead(x)               ((x)->flags & FLAGS_DEADSOCKET)
406   #define SetDead(x)              ((x)->flags |= FLAGS_DEADSOCKET)
407   #define IsClosing(x)            ((x)->flags & FLAGS_CLOSING)
# Line 448 | Line 446 | struct LocalUser
446                                   (UMODE_CALLERID|UMODE_SOFTCALLERID))
447   #define IsSoftCallerId(x)       ((x)->umodes & UMODE_SOFTCALLERID)
448   #define IsDeaf(x)               ((x)->umodes & UMODE_DEAF)
449 + #define IsFull(x)               ((x)->umodes & UMODE_CCONN_FULL)
450  
451   #define SetSendQExceeded(x)     ((x)->flags |= FLAGS_SENDQEX)
452   #define IsSendQExceeded(x)      ((x)->flags &  FLAGS_SENDQEX)
# Line 542 | Line 541 | extern dlink_list listing_client_list;
541   extern dlink_list global_client_list;
542  
543   extern int accept_message(struct Client *, struct Client *);
544 < extern void set_initial_nick(struct Client *, struct Client *, const char *);
544 > extern struct split_nuh_item *find_accept(const char *, const char *,
545 >                                          const char *, struct Client *, int);
546 > extern void del_accept(struct split_nuh_item *, struct Client *);
547 > extern void del_all_accepts(struct Client *);
548   extern void exit_client(struct Client *, struct Client *, const char *);
549   extern void check_conf_klines(void);
550   extern void init_client(void);
549 extern void del_from_accept(struct Client *, struct Client *);
550 extern void del_all_accepts(struct Client *);
551 extern void del_all_their_accepts(struct Client *);
551   extern void change_local_nick(struct Client *, struct Client *, const char *);
552   extern void dead_link_on_write(struct Client *, int);
553   extern void dead_link_on_read(struct Client *, int);
# Line 557 | Line 556 | extern void free_exited_clients(void);
556   extern struct Client *make_client(struct Client *);
557   extern struct Client *find_chasing(struct Client *, struct Client *, const char *, int *);
558   extern struct Client *find_person(const struct Client *const, const char *);
559 < extern const char *get_client_name(struct Client *, int);
559 > extern const char *get_client_name(const struct Client *, int);
560  
561   #endif /* INCLUDED_client_h */

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)