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 849 by db, Mon Feb 19 19:41:59 2007 UTC vs.
ircd-hybrid-8/include/client.h (file contents), Revision 1192 by michael, Thu Aug 18 20:25:18 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 >  time_t            servicestamp;
109 >  uint64_t          flags;      /* client flags */
110 >
111    unsigned int      umodes;     /* opers, normal users subset */
112 <  unsigned int      flags;      /* client flags */
112 >  unsigned int      hopcount;   /* number of servers to this 0 = local */
113 >  unsigned int      status;     /* Client type */
114 >  unsigned int      handler;    /* Handler index */
115 >
116 >  dlink_list        channel;   /* chain of channel pointer blocks */
117  
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;
118    /*
119     * client->name is the unique name for a client nick or host
120     */
121    char name[HOSTLEN + 1];
122    char id[IDLEN + 1];       /* client ID, unique ID per client */
123  
131  /*
132   * client->llname is used to store the clients requested nick
133   * temporarily for new connections.
134   */
135  char              llname[NICKLEN];
136
124    /*
125     * client->username is the username from ident or the USER message,
126     * If the client is idented the USER message is ignored, otherwise
# Line 156 | Line 143 | struct Client
143     * gcos field in /etc/passwd but anything can go here.
144     */
145    char              info[REALLEN + 1]; /* Free form additional client info */
159  char              client_host[HOSTLEN + 1];
160  char              client_server[HOSTLEN + 1];
146  
147 <  /* client->sockhost contains the ip address gotten from the socket as a
147 >  /*
148 >   * client->sockhost contains the ip address gotten from the socket as a
149     * string, this field should be considered read-only once the connection
150     * has been made. (set in s_bsd.c only)
151     */
152    char              sockhost[HOSTIPLEN + 1]; /* This is the host name from the
153                                                  socket ip address as string */
168  /* caller ID allow list */
169  /* This has to be here, since a client on an on_allow_list could
170   * be a remote client. simpler to keep both here.
171   */
172  dlink_list    allow_list;     /* clients I'll allow to talk to me */
173  dlink_list    on_allow_list;  /* clients that have =me= on their allow list*/
174
175  dlink_list     channel;   /* chain of channel pointer blocks */
176
177  struct LocalUser *localClient;
154   };
155  
156   struct LocalUser
# Line 183 | Line 159 | struct LocalUser
159     * The following fields are allocated only for local clients
160     * (directly connected to *this* server with a socket.
161     */
162 +  dlink_node   lclient_node;
163 +
164 +  char         client_host[HOSTLEN + 1];
165 +  char         client_server[HOSTLEN + 1];
166 +
167    unsigned int registration;
168    unsigned int cap_client;    /* Client capabilities (from us) */
169    unsigned int cap_active;    /* Active capabilities (to us) */
170  
171 +  unsigned int operflags;     /* oper priv flags */
172 +  unsigned int random_ping;
173 +
174 +  unsigned int serial;     /* used to enforce 1 send per nick */
175 +
176    /* Anti flooding part, all because of lamers... */
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
177 >  time_t       last_knock;    /* time of last knock */
178 >  time_t       last_away; /* Away since... */
179 >  time_t       last_join_time;   /* when this client last
180 >                                    joined a channel */
181 >  time_t       last_leave_time;  /* when this client last
182                                         * left a channel */
183 <  int               join_leave_count; /* count of JOIN/LEAVE in less than
183 >  int          join_leave_count; /* count of JOIN/LEAVE in less than
184                                           MIN_JOIN_LEAVE_TIME seconds */
185 <  int               oper_warn_count_down; /* warn opers of this possible
185 >  int          oper_warn_count_down; /* warn opers of this possible
186                                            spambot every time this gets to 0 */
187 <  time_t            reject_delay;
188 <  time_t            last_caller_id_time;
189 <  time_t            first_received_message_time;
190 <  int               received_number_of_privmsgs;
191 <  int               flood_noticed;
205 <
206 <  dlink_node        lclient_node;
187 >  time_t       reject_delay;
188 >  time_t       last_caller_id_time;
189 >  time_t       first_received_message_time;
190 >  time_t       last_nick_change;
191 >  time_t       last_privmsg; /* Last time we got a PRIVMSG */
192  
193 <  unsigned int      operflags; /* oper priv flags */
193 >  int          received_number_of_privmsgs;
194 >  unsigned int number_of_nick_changes;
195  
196 <  struct ListTask   *list_task;
196 >  struct ListTask  *list_task;
197    /* Send and receive dbufs .. */
198    struct dbuf_queue buf_sendq;
199    struct dbuf_queue buf_recvq;
# Line 217 | Line 203 | struct LocalUser
203      uint64_t bytes;             /* Statistics: total bytes sent/received */
204    } recv, send;
205  
206 +  struct AuthRequest *auth;
207    struct Listener *listener;   /* listener accepted from */
208 +  dlink_list        acceptlist; /* clients I'll allow to talk to me */
209 +  dlink_list        watches;   /* chain of Watch pointer blocks */
210    dlink_list        confs;     /* Configuration record associated */
211    dlink_list        invited;   /* chain of invite pointer blocks */
212    struct irc_ssaddr ip;
213    int               aftype;     /* Makes life easier for DNS res in IPV6 */
225  struct DNSQuery   *dns_query; /* result returned from resolver query */
226  unsigned long     serverMask; /* Only used for Lazy Links */
227  time_t last; /* Last time we got a PRIVMSG */
228  time_t            last_nick_change;
229  int               number_of_nick_changes;
214  
215    char              *passwd;
216 <  int               caps;       /* capabilities bit-field */
217 <  int               enc_caps;   /* cipher capabilities bit-field */
216 >  unsigned int       caps;       /* capabilities bit-field */
217 >  unsigned int       enc_caps;   /* cipher capabilities bit-field */
218  
219   #ifdef HAVE_LIBCRYPTO
220    struct EncCapability *in_cipher;
# Line 258 | Line 242 | struct LocalUser
242     */
243    int allow_read;       /* how many we're allowed to read in this second */
244    int sent_parsed;      /* how many messages we've parsed in this second */
261  time_t last_knock;    /* time of last knock */
262  unsigned long random_ping;
245  
246    char*          response;  /* expected response from client */
247    char*          auth_oper; /* Operator to become if they supply the response.*/
# Line 321 | Line 303 | struct LocalUser
303   * ts stuff
304   */
305   #define TS_CURRENT      6       /* current TS protocol version */
306 < #ifdef TS5_ONLY
325 < #define TS_MIN          5
326 < #else
327 < #define TS_MIN          3       /* minimum supported TS protocol version */
328 < #endif
306 > #define TS_MIN          5       /* minimum supported TS protocol version */
307   #define TS_DOESTS       0x20000000
308   #define DoesTS(x)       ((x)->tsinfo == TS_DOESTS)
309  
# Line 333 | Line 311 | struct LocalUser
311  
312   #define CAP_MULTI_PREFIX  0x00000001
313  
314 + #define HasCap(x, y) ((x)->localClient->cap_active & (y))
315 +
316   /* housekeeping flags */
317 < #define FLAGS_PINGSENT      0x00000001 /* Unreplied ping sent                      */
318 < #define FLAGS_DEADSOCKET    0x00000002 /* Local socket is dead--Exiting soon       */
319 < #define FLAGS_KILLED        0x00000004 /* Prevents "QUIT" from being sent for this */
320 < #define FLAGS_CLOSING       0x00000008 /* set when closing to suppress errors      */
321 < #define FLAGS_GOTID         0x00000010 /* successful ident lookup achieved         */
322 < #define FLAGS_NEEDID        0x00000020 /* I-lines say must use ident return        */
323 < #define FLAGS_SENDQEX       0x00000040 /* Sendq exceeded                           */
324 < #define FLAGS_IPHASH        0x00000080 /* iphashed this client                     */
325 < #define FLAGS_CRYPTIN       0x00000100 /* incoming data must be decrypted          */
326 < #define FLAGS_CRYPTOUT      0x00000200 /* outgoing data must be encrypted          */
327 < #define FLAGS_WAITAUTH      0x00000400 /* waiting for CRYPTLINK AUTH command       */
328 < #define FLAGS_SERVLINK      0x00000800 /* servlink has servlink process            */
329 < #define FLAGS_MARK          0x00001000 /* marked client                            */
330 < #define FLAGS_CANFLOOD      0x00002000 /* client has the ability to flood          */
331 < #define FLAGS_EXEMPTGLINE   0x00004000 /* client can't be G-lined                  */
332 < #define FLAGS_EXEMPTKLINE   0x00008000 /* client is exempt from kline              */
333 < #define FLAGS_NOLIMIT       0x00010000 /* client is exempt from limits             */
334 < #define FLAGS_RESTRICTED    0x00020000 /* client cannot op others                  */
335 < #define FLAGS_PING_COOKIE   0x00040000 /* PING Cookie                              */
336 < #define FLAGS_IDLE_LINED    0x00080000 /* client is exempt from idle-time limits   */
337 < #define FLAGS_IP_SPOOFING   0x00100000 /* client IP is spoofed                     */
338 < #define FLAGS_FLOODDONE     0x00200000 /* Flood grace period has been ended.       */
339 < #define FLAGS_EOB           0x00400000 /* server has received EOB                  */
340 < #define FLAGS_HIDDEN        0x00800000 /* a hidden server. not shown in /links     */
341 < #define FLAGS_BLOCKED       0x01000000 /* must wait for COMM_SELECT_WRITE          */
342 < #define FLAGS_SBLOCKED      0x02000000 /* slinkq is blocked                        */
343 < #define FLAGS_USERHOST      0x04000000 /* client is in userhost hash               */
344 < #define FLAGS_BURSTED       0x08000000 /* user was already bursted                 */
345 < #define FLAGS_EXEMPTRESV    0x10000000 /* client is exempt from RESV               */
346 < #define FLAGS_GOTUSER       0x20000000 /* if we received a USER command            */
347 < #define FLAGS_PINGWARNING   0x40000000 /* unreplied ping warning already sent      */
348 < #define FLAGS_FINISHED_AUTH 0x80000000 /* Client has been released from auth       */
317 > #define FLAGS_PINGSENT      0x0000000000000001 /* Unreplied ping sent                      */
318 > #define FLAGS_DEADSOCKET    0x0000000000000002 /* Local socket is dead--Exiting soon       */
319 > #define FLAGS_KILLED        0x0000000000000004 /* Prevents "QUIT" from being sent for this */
320 > #define FLAGS_CLOSING       0x0000000000000008 /* set when closing to suppress errors      */
321 > #define FLAGS_GOTID         0x0000000000000010 /* successful ident lookup achieved         */
322 > #define FLAGS_NEEDID        0x0000000000000020 /* I-lines say must use ident return        */
323 > #define FLAGS_SENDQEX       0x0000000000000040 /* Sendq exceeded                           */
324 > #define FLAGS_IPHASH        0x0000000000000080 /* iphashed this client                     */
325 > #define FLAGS_CRYPTIN       0x0000000000000100 /* incoming data must be decrypted          */
326 > #define FLAGS_CRYPTOUT      0x0000000000000200 /* outgoing data must be encrypted          */
327 > #define FLAGS_WAITAUTH      0x0000000000000400 /* waiting for CRYPTLINK AUTH command       */
328 > #define FLAGS_SERVLINK      0x0000000000000800 /* servlink has servlink process            */
329 > #define FLAGS_MARK          0x0000000000001000 /* marked client                            */
330 > #define FLAGS_CANFLOOD      0x0000000000002000 /* client has the ability to flood          */
331 > #define FLAGS_EXEMPTGLINE   0x0000000000004000 /* client can't be G-lined                  */
332 > #define FLAGS_EXEMPTKLINE   0x0000000000008000 /* client is exempt from kline              */
333 > #define FLAGS_NOLIMIT       0x0000000000010000 /* client is exempt from limits             */
334 > #define FLAGS_UNUSED___     0x0000000000020000 /* Unused                                   */
335 > #define FLAGS_PING_COOKIE   0x0000000000040000 /* PING Cookie                              */
336 > #define FLAGS_UNUSED____    0x0000000000080000 /* Unused                                   */
337 > #define FLAGS_IP_SPOOFING   0x0000000000100000 /* client IP is spoofed                     */
338 > #define FLAGS_FLOODDONE     0x0000000000200000 /* Flood grace period has been ended.       */
339 > #define FLAGS_EOB           0x0000000000400000 /* server has received EOB                  */
340 > #define FLAGS_HIDDEN        0x0000000000800000 /* a hidden server. not shown in /links     */
341 > #define FLAGS_BLOCKED       0x0000000001000000 /* must wait for COMM_SELECT_WRITE          */
342 > #define FLAGS_SBLOCKED      0x0000000002000000 /* slinkq is blocked                        */
343 > #define FLAGS_USERHOST      0x0000000004000000 /* client is in userhost hash               */
344 > #define FLAGS_BURSTED       0x0000000008000000 /* user was already bursted                 */
345 > #define FLAGS_EXEMPTRESV    0x0000000010000000 /* client is exempt from RESV               */
346 > #define FLAGS_GOTUSER       0x0000000020000000 /* if we received a USER command            */
347 > #define FLAGS_PINGWARNING   0x0000000040000000 /* unreplied ping warning already sent      */
348 > #define FLAGS_FINISHED_AUTH 0x0000000080000000 /* Client has been released from auth       */
349 > #define FLAGS_FLOOD_NOTICED 0x0000000100000000
350 > #define FLAGS_SERVICE       0x0000000200000000 /* Client/server is a network service       */
351  
352  
353   /* umodes, settable flags */
# Line 388 | Line 370 | struct LocalUser
370   #define UMODE_LOCOPS       0x00010000 /* show locops */
371   #define UMODE_DEAF         0x00020000 /* don't receive channel messages */
372   #define UMODE_CCONN_FULL   0x00040000 /* add unused fields to connection monitoring */
373 + #define UMODE_REGISTERED   0x00080000 /* User has identified for that nick. */
374 + #define UMODE_REGONLY      0x00100000 /* Only registered nicks may PM */
375  
376   /* user information flags, only settable by remote mode or local oper */
377   #define UMODE_OPER         0x40000000 /* Operator */
# Line 395 | Line 379 | struct LocalUser
379  
380   #define UMODE_ALL          UMODE_SERVNOTICE
381  
382 + #define HasUMode(x, y) ((x)->umodes &   (y))
383 + #define AddUMode(x, y) ((x)->umodes |=  (y))
384 + #define DelUMode(x, y) ((x)->umodes &= ~(y))
385 +
386   #define SEND_UMODES  (UMODE_INVISIBLE | UMODE_OPER | UMODE_WALLOP | \
387 <                      UMODE_ADMIN)
387 >                      UMODE_REGISTERED | UMODE_ADMIN)
388 >
389 >
390  
391  
392   /* oper priv flags */
# Line 420 | Line 410 | struct LocalUser
410  
411  
412   /* flags macros. */
413 + #define IsMsgFloodNoticed(x)       ((x)->flags & FLAGS_FLOOD_NOTICED)
414 + #define SetMsgFloodNoticed(x)      ((x)->flags |= FLAGS_FLOOD_NOTICED)
415 + #define ClearMsgFloodNoticed(x)    ((x)->flags &= ~FLAGS_FLOOD_NOTICED)
416   #define IsAuthFinished(x)       ((x)->flags & FLAGS_FINISHED_AUTH)
417   #define IsDead(x)               ((x)->flags & FLAGS_DEADSOCKET)
418   #define SetDead(x)              ((x)->flags |= FLAGS_DEADSOCKET)
# Line 465 | Line 458 | struct LocalUser
458                                   (UMODE_CALLERID|UMODE_SOFTCALLERID))
459   #define IsSoftCallerId(x)       ((x)->umodes & UMODE_SOFTCALLERID)
460   #define IsDeaf(x)               ((x)->umodes & UMODE_DEAF)
461 + #define IsFull(x)               ((x)->umodes & UMODE_CCONN_FULL)
462  
463   #define SetSendQExceeded(x)     ((x)->flags |= FLAGS_SENDQEX)
464   #define IsSendQExceeded(x)      ((x)->flags &  FLAGS_SENDQEX)
# Line 502 | Line 496 | struct LocalUser
496   #define SetIPSpoof(x)           ((x)->flags |= FLAGS_IP_SPOOFING)
497   #define IsIPSpoof(x)            ((x)->flags & FLAGS_IP_SPOOFING)
498  
505 #define IsIdlelined(x)          ((x)->flags &  FLAGS_IDLE_LINED)
506 #define SetIdlelined(x)         ((x)->flags |= FLAGS_IDLE_LINED)
507 #define IsRestricted(x)         ((x)->flags &  FLAGS_RESTRICTED)
508 #define SetRestricted(x)        ((x)->flags |= FLAGS_RESTRICTED)
509
499   #define IsFloodDone(x)          ((x)->flags &  FLAGS_FLOODDONE)
500   #define SetFloodDone(x)         ((x)->flags |= FLAGS_FLOODDONE)
501   #define HasPingCookie(x)        ((x)->flags & FLAGS_PING_COOKIE)
502   #define SetPingCookie(x)        ((x)->flags |= FLAGS_PING_COOKIE)
503   #define IsHidden(x)             ((x)->flags &  FLAGS_HIDDEN)
504   #define SetHidden(x)            ((x)->flags |= FLAGS_HIDDEN)
505 + #define IsService(x)            ((x)->flags &  FLAGS_SERVICE)
506 + #define SetService(x)           ((x)->flags |= FLAGS_SERVICE)
507  
508   #define IsSendqBlocked(x)       ((x)->flags &  FLAGS_BLOCKED)
509   #define SetSendqBlocked(x)      ((x)->flags |= FLAGS_BLOCKED)
# Line 559 | Line 550 | extern dlink_list listing_client_list;
550   extern dlink_list global_client_list;
551  
552   extern int accept_message(struct Client *, struct Client *);
553 < extern void set_initial_nick(struct Client *, struct Client *, const char *);
553 > extern struct split_nuh_item *find_accept(const char *, const char *,
554 >                                          const char *, struct Client *, int);
555 > extern void del_accept(struct split_nuh_item *, struct Client *);
556 > extern void del_all_accepts(struct Client *);
557   extern void exit_client(struct Client *, struct Client *, const char *);
558   extern void check_conf_klines(void);
559   extern void init_client(void);
566 extern void del_from_accept(struct Client *, struct Client *);
567 extern void del_all_accepts(struct Client *);
568 extern void del_all_their_accepts(struct Client *);
569 extern void change_local_nick(struct Client *, struct Client *, const char *);
560   extern void dead_link_on_write(struct Client *, int);
561   extern void dead_link_on_read(struct Client *, int);
562   extern void exit_aborted_clients(void);
# Line 574 | Line 564 | extern void free_exited_clients(void);
564   extern struct Client *make_client(struct Client *);
565   extern struct Client *find_chasing(struct Client *, struct Client *, const char *, int *);
566   extern struct Client *find_person(const struct Client *const, const char *);
567 < extern const char *get_client_name(struct Client *, int);
567 > extern const char *get_client_name(const struct Client *, int);
568  
569   #endif /* INCLUDED_client_h */

Diff Legend

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