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/include/client.h (file contents), Revision 31 by knight, Sun Oct 2 20:34:05 2005 UTC vs.
ircd-hybrid-7.2/include/client.h (file contents), Revision 1015 by michael, Sun Oct 25 00:08:06 2009 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 >  unsigned int      serial;     /* used to enforce 1 send per nick */
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 */
146 +  char              client_host[HOSTLEN + 1];
147 +  char              client_server[HOSTLEN + 1];
148  
149    /* client->sockhost contains the ip address gotten from the socket as a
150     * string, this field should be considered read-only once the connection
# Line 163 | Line 152 | struct Client
152     */
153    char              sockhost[HOSTIPLEN + 1]; /* This is the host name from the
154                                                  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  dlink_list     invited;   /* chain of invite pointer blocks */
175
176  struct LocalUser *localClient;
155   };
156  
157   struct LocalUser
# Line 182 | Line 160 | struct LocalUser
160     * The following fields are allocated only for local clients
161     * (directly connected to *this* server with a socket.
162     */
163 +  dlink_node        lclient_node;
164 +
165 +
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 +
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;
199 <  int               flood_noticed;
200 <
201 <  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 212 | 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        confs;      /* Configuration record associated */
207 <
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;
219  unsigned short    port;       /* and the remote port# too :-) */
211    int               aftype;     /* Makes life easier for DNS res in IPV6 */
221  struct DNSQuery   *dns_query;  /* result returned from resolver query */
222  unsigned long     serverMask; /* Only used for Lazy Links */
212    time_t last; /* Last time we got a PRIVMSG */
224  time_t            last_nick_change;
225  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 254 | 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 */
257  time_t last_knock;    /* time of last knock */
258  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 271 | 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 321 | Line 311 | struct LocalUser
311   #define DoesTS(x)       ((x)->tsinfo == TS_DOESTS)
312  
313  
314 +
315 + #define CAP_MULTI_PREFIX  0x00000001
316 +
317   /* housekeeping flags */
318 < #define FLAGS_PINGSENT    0x00000001 /* Unreplied ping sent                      */
319 < #define FLAGS_DEADSOCKET  0x00000002 /* Local socket is dead--Exiting soon       */
320 < #define FLAGS_KILLED      0x00000004 /* Prevents "QUIT" from being sent for this */
321 < #define FLAGS_CLOSING     0x00000008 /* set when closing to suppress errors      */
322 < #define FLAGS_GOTID       0x00000010 /* successful ident lookup achieved         */
323 < #define FLAGS_NEEDID      0x00000020 /* I-lines say must use ident return        */
324 < #define FLAGS_SENDQEX     0x00000040 /* Sendq exceeded                           */
325 < #define FLAGS_IPHASH      0x00000080 /* iphashed this client                     */
326 < #define FLAGS_CRYPTIN     0x00000100 /* incoming data must be decrypted          */
327 < #define FLAGS_CRYPTOUT    0x00000200 /* outgoing data must be encrypted          */
328 < #define FLAGS_WAITAUTH    0x00000400 /* waiting for CRYPTLINK AUTH command       */
329 < #define FLAGS_SERVLINK    0x00000800 /* servlink has servlink process            */
330 < #define FLAGS_MARK        0x00001000 /* marked client                            */
331 < #define FLAGS_CANFLOOD    0x00002000 /* client has the ability to flood          */
332 < #define FLAGS_EXEMPTGLINE 0x00004000 /* client can't be G-lined                  */
333 < #define FLAGS_EXEMPTKLINE 0x00008000 /* client is exempt from kline              */
334 < #define FLAGS_NOLIMIT     0x00010000 /* client is exempt from limits             */
335 < #define FLAGS_RESTRICTED  0x00020000 /* client cannot op others                  */
336 < #define FLAGS_PING_COOKIE 0x00040000 /* PING Cookie                              */
337 < #define FLAGS_IDLE_LINED  0x00080000 /* client is exempt from idle-time limits   */
338 < #define FLAGS_IP_SPOOFING 0x00100000 /* client IP is spoofed                     */
339 < #define FLAGS_FLOODDONE   0x00200000 /* Flood grace period has been ended.       */
340 < #define FLAGS_EOB         0x00400000 /* server has received EOB                  */
341 < #define FLAGS_HIDDEN      0x00800000 /* a hidden server. not shown in /links     */
342 < #define FLAGS_BLOCKED     0x01000000 /* must wait for COMM_SELECT_WRITE          */
343 < #define FLAGS_SBLOCKED    0x02000000 /* slinkq is blocked                        */
344 < #define FLAGS_USERHOST    0x04000000 /* client is in userhost hash               */
345 < #define FLAGS_BURSTED     0x08000000 /* user was already bursted                 */
346 < #define FLAGS_EXEMPTRESV  0x10000000 /* client is exempt from RESV               */
347 < #define FLAGS_GOTUSER     0x20000000 /* if we received a USER command            */
348 < #define FLAGS_PINGWARNING 0x40000000 /* unreplied ping warning already sent      */
349 < /*                        0x80000000  */
318 > #define FLAGS_PINGSENT      0x0000000000000001 /* Unreplied ping sent                      */
319 > #define FLAGS_DEADSOCKET    0x0000000000000002 /* Local socket is dead--Exiting soon       */
320 > #define FLAGS_KILLED        0x0000000000000004 /* Prevents "QUIT" from being sent for this */
321 > #define FLAGS_CLOSING       0x0000000000000008 /* set when closing to suppress errors      */
322 > #define FLAGS_GOTID         0x0000000000000010 /* successful ident lookup achieved         */
323 > #define FLAGS_NEEDID        0x0000000000000020 /* I-lines say must use ident return        */
324 > #define FLAGS_SENDQEX       0x0000000000000040 /* Sendq exceeded                           */
325 > #define FLAGS_IPHASH        0x0000000000000080 /* iphashed this client                     */
326 > #define FLAGS_CRYPTIN       0x0000000000000100 /* incoming data must be decrypted          */
327 > #define FLAGS_CRYPTOUT      0x0000000000000200 /* outgoing data must be encrypted          */
328 > #define FLAGS_WAITAUTH      0x0000000000000400 /* waiting for CRYPTLINK AUTH command       */
329 > #define FLAGS_SERVLINK      0x0000000000000800 /* servlink has servlink process            */
330 > #define FLAGS_MARK          0x0000000000001000 /* marked client                            */
331 > #define FLAGS_CANFLOOD      0x0000000000002000 /* client has the ability to flood          */
332 > #define FLAGS_EXEMPTGLINE   0x0000000000004000 /* client can't be G-lined                  */
333 > #define FLAGS_EXEMPTKLINE   0x0000000000008000 /* client is exempt from kline              */
334 > #define FLAGS_NOLIMIT       0x0000000000010000 /* client is exempt from limits             */
335 > #define FLAGS_RESTRICTED    0x0000000000020000 /* client cannot op others                  */
336 > #define FLAGS_PING_COOKIE   0x0000000000040000 /* PING Cookie                              */
337 > #define FLAGS_IDLE_LINED    0x0000000000080000 /* client is exempt from idle-time limits   */
338 > #define FLAGS_IP_SPOOFING   0x0000000000100000 /* client IP is spoofed                     */
339 > #define FLAGS_FLOODDONE     0x0000000000200000 /* Flood grace period has been ended.       */
340 > #define FLAGS_EOB           0x0000000000400000 /* server has received EOB                  */
341 > #define FLAGS_HIDDEN        0x0000000000800000 /* a hidden server. not shown in /links     */
342 > #define FLAGS_BLOCKED       0x0000000001000000 /* must wait for COMM_SELECT_WRITE          */
343 > #define FLAGS_SBLOCKED      0x0000000002000000 /* slinkq is blocked                        */
344 > #define FLAGS_USERHOST      0x0000000004000000 /* client is in userhost hash               */
345 > #define FLAGS_BURSTED       0x0000000008000000 /* user was already bursted                 */
346 > #define FLAGS_EXEMPTRESV    0x0000000010000000 /* client is exempt from RESV               */
347 > #define FLAGS_GOTUSER       0x0000000020000000 /* if we received a USER command            */
348 > #define FLAGS_PINGWARNING   0x0000000040000000 /* unreplied ping warning already sent      */
349 > #define FLAGS_FINISHED_AUTH 0x0000000080000000 /* Client has been released from auth       */
350 > #define FLAGS_FLOOD_NOTICED 0x0000000100000000
351  
352  
353   /* umodes, settable flags */
354 < #define UMODE_SERVNOTICE   0x00001 /* server notices such as kill */
355 < #define UMODE_CCONN        0x00002 /* Client Connections */
356 < #define UMODE_REJ          0x00004 /* Bot Rejections */
357 < #define UMODE_SKILL        0x00008 /* Server Killed */
358 < #define UMODE_FULL         0x00010 /* Full messages */
359 < #define UMODE_SPY          0x00020 /* see STATS / LINKS */
360 < #define UMODE_DEBUG        0x00040 /* 'debugging' info */
361 < #define UMODE_NCHANGE      0x00080 /* Nick change notice */
362 < #define UMODE_WALLOP       0x00100 /* send wallops to them */
363 < #define UMODE_OPERWALL     0x00200 /* Operwalls */
364 < #define UMODE_INVISIBLE    0x00400 /* makes user invisible */
365 < #define UMODE_BOTS         0x00800 /* shows bots */
366 < #define UMODE_EXTERNAL     0x01000 /* show servers introduced and splitting */
367 < #define UMODE_CALLERID     0x02000 /* block unless caller id's */
368 < #define UMODE_SOFTCALLERID 0x04000 /* block unless on common channel */
369 < #define UMODE_UNAUTH       0x08000 /* show unauth connects here */
370 < #define UMODE_LOCOPS       0x10000 /* show locops */
371 < #define UMODE_DEAF         0x20000 /* don't receive channel messages */
354 > #define UMODE_SERVNOTICE   0x00000001 /* server notices such as kill */
355 > #define UMODE_CCONN        0x00000002 /* Client Connections */
356 > #define UMODE_REJ          0x00000004 /* Bot Rejections */
357 > #define UMODE_SKILL        0x00000008 /* Server Killed */
358 > #define UMODE_FULL         0x00000010 /* Full messages */
359 > #define UMODE_SPY          0x00000020 /* see STATS / LINKS */
360 > #define UMODE_DEBUG        0x00000040 /* 'debugging' info */
361 > #define UMODE_NCHANGE      0x00000080 /* Nick change notice */
362 > #define UMODE_WALLOP       0x00000100 /* send wallops to them */
363 > #define UMODE_OPERWALL     0x00000200 /* Operwalls */
364 > #define UMODE_INVISIBLE    0x00000400 /* makes user invisible */
365 > #define UMODE_BOTS         0x00000800 /* shows bots */
366 > #define UMODE_EXTERNAL     0x00001000 /* show servers introduced and splitting */
367 > #define UMODE_CALLERID     0x00002000 /* block unless caller id's */
368 > #define UMODE_SOFTCALLERID 0x00004000 /* block unless on common channel */
369 > #define UMODE_UNAUTH       0x00008000 /* show unauth connects here */
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  
374   /* user information flags, only settable by remote mode or local oper */
375 < #define UMODE_OPER         0x40000 /* Operator */
376 < #define UMODE_ADMIN        0x80000 /* Admin on server */
375 > #define UMODE_OPER         0x40000000 /* Operator */
376 > #define UMODE_ADMIN        0x80000000 /* Admin on server */
377 >
378   #define UMODE_ALL          UMODE_SERVNOTICE
379  
380   #define SEND_UMODES  (UMODE_INVISIBLE | UMODE_OPER | UMODE_WALLOP | \
# Line 406 | Line 402 | struct LocalUser
402  
403  
404   /* flags macros. */
405 + #define IsMsgFloodNoticed(x)       ((x)->flags & FLAGS_FLOOD_NOTICED)
406 + #define SetMsgFloodNoticed(x)      ((x)->flags |= FLAGS_FLOOD_NOTICED)
407 + #define ClearMsgFloodNoticed(x)    ((x)->flags &= ~FLAGS_FLOOD_NOTICED)
408 + #define IsAuthFinished(x)       ((x)->flags & FLAGS_FINISHED_AUTH)
409   #define IsDead(x)               ((x)->flags & FLAGS_DEADSOCKET)
410   #define SetDead(x)              ((x)->flags |= FLAGS_DEADSOCKET)
411   #define IsClosing(x)            ((x)->flags & FLAGS_CLOSING)
# Line 450 | Line 450 | struct LocalUser
450                                   (UMODE_CALLERID|UMODE_SOFTCALLERID))
451   #define IsSoftCallerId(x)       ((x)->umodes & UMODE_SOFTCALLERID)
452   #define IsDeaf(x)               ((x)->umodes & UMODE_DEAF)
453 + #define IsFull(x)               ((x)->umodes & UMODE_CCONN_FULL)
454  
455   #define SetSendQExceeded(x)     ((x)->flags |= FLAGS_SENDQEX)
456   #define IsSendQExceeded(x)      ((x)->flags &  FLAGS_SENDQEX)
# Line 544 | Line 545 | extern dlink_list listing_client_list;
545   extern dlink_list global_client_list;
546  
547   extern int accept_message(struct Client *, struct Client *);
548 < extern void set_initial_nick(struct Client *, struct Client *, const char *);
548 > extern struct split_nuh_item *find_accept(const char *, const char *,
549 >                                          const char *, struct Client *, int);
550 > extern void del_accept(struct split_nuh_item *, struct Client *);
551 > extern void del_all_accepts(struct Client *);
552   extern void exit_client(struct Client *, struct Client *, const char *);
553   extern void check_conf_klines(void);
554   extern void init_client(void);
551 extern void del_from_accept(struct Client *, struct Client *);
552 extern void del_all_accepts(struct Client *);
553 extern void del_all_their_accepts(struct Client *);
555   extern void change_local_nick(struct Client *, struct Client *, const char *);
556   extern void dead_link_on_write(struct Client *, int);
557   extern void dead_link_on_read(struct Client *, int);

Comparing:
ircd-hybrid/include/client.h (property svn:keywords), Revision 31 by knight, Sun Oct 2 20:34:05 2005 UTC vs.
ircd-hybrid-7.2/include/client.h (property svn:keywords), Revision 1015 by michael, Sun Oct 25 00:08:06 2009 UTC

# Line 1 | Line 1
1 < "Id Revision"
1 > Id Revision

Diff Legend

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