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/trunk/include/client.h (file contents):
Revision 1797 by michael, Thu Jan 24 19:26:51 2013 UTC vs.
Revision 1798 by michael, Sun Mar 31 17:09:50 2013 UTC

# Line 35 | Line 35
35   #include "dbuf.h"
36   #include "channel.h"
37  
38 –
39 – /*! \brief addr_mask_type enumeration */
40 – enum addr_mask_type
41 – {
42 –  HIDE_IP, /**< IP is hidden. Resolved hostname is shown instead */
43 –  SHOW_IP, /**< IP is shown. No parts of it are hidden or masked */
44 –  MASK_IP  /**< IP is masked. 255.255.255.255 is shown instead */
45 – };
46 –
47 – /*! \brief Server structure */
48 – struct Server
49 – {
50 –  dlink_list server_list; /**< Servers on this server */
51 –  dlink_list client_list; /**< Clients on this server */
52 –  char by[NICKLEN + 1];   /**< who activated this connection */
53 – };
54 –
55 – /*! \brief ListTask structure */
56 – struct ListTask
57 – {
58 –  dlink_list show_mask; /**< show these channels.. */
59 –  dlink_list hide_mask; /**< ..and hide these ones */
60 –
61 –  unsigned int hash_index; /**< the bucket we are currently in */
62 –  unsigned int users_min;
63 –  unsigned int users_max;
64 –  unsigned int created_min;
65 –  unsigned int created_max;
66 –  unsigned int topicts_min;
67 –  unsigned int topicts_max;
68 – };
69 –
70 – /*! \brief LocalUser structure
71 – *
72 – * Allocated only for local clients, that are directly connected
73 – * to \b this server with a socket.
74 – */
75 – struct LocalUser
76 – {
77 –  dlink_node   lclient_node;
78 –
79 –  char         client_host[HOSTLEN + 1];
80 –  char         client_server[HOSTLEN + 1];
81 –
82 –  unsigned int registration;
83 –  unsigned int cap_client;    /**< Client capabilities (from us) */
84 –  unsigned int cap_active;    /**< Active capabilities (to us) */
85 –  unsigned int       caps;       /**< capabilities bit-field */
86 –
87 –  unsigned int operflags;     /**< IRC Operator privilege flags */
88 –  unsigned int random_ping; /**< Holding a 32bit value used for PING cookies */
89 –
90 –  unsigned int serial;     /**< used to enforce 1 send per nick */
91 –
92 –  time_t       lasttime;   /**< ...should be only LOCAL clients? --msa */
93 –  time_t       firsttime;  /**< time client was created */
94 –  time_t       since;      /**< last time we parsed something */
95 –  time_t       last_knock;    /**< time of last knock */
96 –  time_t       last_join_time;   /**< when this client last
97 –                                    joined a channel */
98 –  time_t       last_leave_time;  /**< when this client last
99 –                                       * left a channel */
100 –  int          join_leave_count; /**< count of JOIN/LEAVE in less than
101 –                                         MIN_JOIN_LEAVE_TIME seconds */
102 –  int          oper_warn_count_down; /**< warn opers of this possible
103 –                                          spambot every time this gets to 0 */
104 –  time_t       last_caller_id_time;
105 –  time_t       first_received_message_time;
106 –  time_t       last_nick_change;
107 –  time_t       last_privmsg; /**< Last time we got a PRIVMSG */
108 –  time_t       last_away; /**< Away since... */
109 –
110 –  int          received_number_of_privmsgs;
111 –  unsigned int number_of_nick_changes;
112 –
113 –  struct ListTask  *list_task;
114 –
115 –  struct dbuf_queue buf_sendq;
116 –  struct dbuf_queue buf_recvq;
117 –
118 –  struct {
119 –    unsigned int messages;      /**< Statistics: protocol messages sent/received */
120 –    uint64_t bytes;             /**< Statistics: total bytes sent/received */
121 –  } recv, send;
122 –
123 –  struct AuthRequest *auth;
124 –  struct Listener *listener;   /**< listener accepted from */
125 –  dlink_list        acceptlist; /**< clients I'll allow to talk to me */
126 –  dlink_list        watches;   /**< chain of Watch pointer blocks */
127 –  dlink_list        confs;     /**< Configuration record associated */
128 –  dlink_list        invited;   /**< chain of invite pointer blocks */
129 –  struct irc_ssaddr ip;
130 –  int               aftype;    /**< Makes life easier for DNS res in IPV6 */
131 –
132 –  char              *passwd;
133 –  fde_t             fd;
134 –
135 –  /* Anti-flood stuff. We track how many messages were parsed and how
136 –   * many we were allowed in the current second, and apply a simple
137 –   * decay to avoid flooding.
138 –   *   -- adrian
139 –   */
140 –  int allow_read;       /**< how many we're allowed to read in this second */
141 –  int sent_parsed;      /**< how many messages we've parsed in this second */
142 –
143 –  char*          response;  /**< expected response from client */
144 –  char*          auth_oper; /**< Operator to become if they supply the response.*/
145 – };
146 –
147 – /*! \brief Client structure */
148 – struct Client
149 – {
150 –  dlink_node node;
151 –  dlink_node lnode;             /**< Used for Server->servers/users */
152 –
153 –  struct LocalUser *localClient;
154 –  struct Client    *hnext;      /**< For client hash table lookups by name */
155 –  struct Client    *idhnext;    /**< For SID hash table lookups by sid */
156 –  struct Server    *serv;       /**< ...defined, if this is a server */
157 –  struct Client    *servptr;    /**< Points to server this Client is on */
158 –  struct Client    *from;       /**< == self, if Local Client, *NEVER* NULL! */
159 –
160 –  time_t            tsinfo;     /**< TS on the nick, SVINFO on server */
161 –
162 –  unsigned int      flags;      /**< client flags */
163 –  unsigned int      umodes;     /**< opers, normal users subset */
164 –  unsigned int      hopcount;   /**< number of servers to this 0 = local */
165 –  unsigned int      status;     /**< Client type */
166 –  unsigned int      handler;    /**< Handler index */
167 –
168 –  dlink_list        whowas;
169 –  dlink_list        channel;   /**< chain of channel pointer blocks */
170 –
171 –  char away[AWAYLEN + 1]; /**< Client's AWAY message. Can be set/unset via AWAY command */
172 –  char name[HOSTLEN + 1]; /**< unique name for a client nick or host */
173 –  char svid[HOSTLEN + 1]; /**< Services ID. XXX: Going with HOSTLEN for now. NICKLEN might be too small
174 –                                if dealing with timestamps */
175 –  char id[IDLEN + 1];       /**< client ID, unique ID per client */
176 –  /*
177 –   * client->username is the username from ident or the USER message,
178 –   * If the client is idented the USER message is ignored, otherwise
179 –   * the username part of the USER message is put here prefixed with a
180 –   * tilde depending on the auth{} block. Once a client has registered,
181 –   * this field should be considered read-only.
182 –   */
183 –  char              username[USERLEN + 1]; /* client's username */
184 –
185 –  /*
186 –   * client->host contains the resolved name or ip address
187 –   * as a string for the user, it may be fiddled with for oper spoofing etc.
188 –   * once it's changed the *real* address goes away. This should be
189 –   * considered a read-only field after the client has registered.
190 –   */
191 –  char              host[HOSTLEN + 1];     /* client's hostname */
192 –
193 –  /*
194 –   * client->info for unix clients will normally contain the info from the
195 –   * gcos field in /etc/passwd but anything can go here.
196 –   */
197 –  char              info[REALLEN + 1]; /* Free form additional client info */
198 –
199 –  /*
200 –   * client->sockhost contains the ip address gotten from the socket as a
201 –   * string, this field should be considered read-only once the connection
202 –   * has been made. (set in s_bsd.c only)
203 –   */
204 –  char              sockhost[HOSTIPLEN + 1]; /* This is the host name from the
205 –                                                socket ip address as string */
206 – };
207 –
38   /*
39   * status macros.
40   */
# Line 434 | Line 264 | struct Client
264   #define ClearSendqBlocked(x)    ((x)->flags &= ~FLAGS_BLOCKED)
265  
266  
267 + /*! \brief addr_mask_type enumeration */
268 + enum addr_mask_type
269 + {
270 +  HIDE_IP, /**< IP is hidden. Resolved hostname is shown instead */
271 +  SHOW_IP, /**< IP is shown. No parts of it are hidden or masked */
272 +  MASK_IP  /**< IP is masked. 255.255.255.255 is shown instead */
273 + };
274 +
275 + /*! \brief Server structure */
276 + struct Server
277 + {
278 +  dlink_list server_list; /**< Servers on this server */
279 +  dlink_list client_list; /**< Clients on this server */
280 +  char by[NICKLEN + 1];   /**< who activated this connection */
281 + };
282 +
283 + /*! \brief ListTask structure */
284 + struct ListTask
285 + {
286 +  dlink_list show_mask; /**< show these channels.. */
287 +  dlink_list hide_mask; /**< ..and hide these ones */
288 +
289 +  unsigned int hash_index; /**< the bucket we are currently in */
290 +  unsigned int users_min;
291 +  unsigned int users_max;
292 +  unsigned int created_min;
293 +  unsigned int created_max;
294 +  unsigned int topicts_min;
295 +  unsigned int topicts_max;
296 + };
297 +
298 + /*! \brief LocalUser structure
299 + *
300 + * Allocated only for local clients, that are directly connected
301 + * to \b this server with a socket.
302 + */
303 + struct LocalUser
304 + {
305 +  dlink_node   lclient_node;
306 +
307 +  char         client_host[HOSTLEN + 1];
308 +  char         client_server[HOSTLEN + 1];
309 +
310 +  unsigned int registration;
311 +  unsigned int cap_client;    /**< Client capabilities (from us) */
312 +  unsigned int cap_active;    /**< Active capabilities (to us) */
313 +  unsigned int       caps;       /**< capabilities bit-field */
314 +
315 +  unsigned int operflags;     /**< IRC Operator privilege flags */
316 +  unsigned int random_ping; /**< Holding a 32bit value used for PING cookies */
317 +
318 +  unsigned int serial;     /**< used to enforce 1 send per nick */
319 +
320 +  time_t       lasttime;   /**< ...should be only LOCAL clients? --msa */
321 +  time_t       firsttime;  /**< time client was created */
322 +  time_t       since;      /**< last time we parsed something */
323 +  time_t       last_knock;    /**< time of last knock */
324 +  time_t       last_join_time;   /**< when this client last
325 +                                    joined a channel */
326 +  time_t       last_leave_time;  /**< when this client last
327 +                                       * left a channel */
328 +  int          join_leave_count; /**< count of JOIN/LEAVE in less than
329 +                                         MIN_JOIN_LEAVE_TIME seconds */
330 +  int          oper_warn_count_down; /**< warn opers of this possible
331 +                                          spambot every time this gets to 0 */
332 +  time_t       last_caller_id_time;
333 +  time_t       first_received_message_time;
334 +  time_t       last_nick_change;
335 +  time_t       last_privmsg; /**< Last time we got a PRIVMSG */
336 +  time_t       last_away; /**< Away since... */
337 +
338 +  int          received_number_of_privmsgs;
339 +  unsigned int number_of_nick_changes;
340 +
341 +  struct ListTask  *list_task;
342 +
343 +  struct dbuf_queue buf_sendq;
344 +  struct dbuf_queue buf_recvq;
345 +
346 +  struct {
347 +    unsigned int messages;      /**< Statistics: protocol messages sent/received */
348 +    uint64_t bytes;             /**< Statistics: total bytes sent/received */
349 +  } recv, send;
350 +
351 +  struct AuthRequest *auth;
352 +  struct Listener *listener;   /**< listener accepted from */
353 +  dlink_list        acceptlist; /**< clients I'll allow to talk to me */
354 +  dlink_list        watches;   /**< chain of Watch pointer blocks */
355 +  dlink_list        confs;     /**< Configuration record associated */
356 +  dlink_list        invited;   /**< chain of invite pointer blocks */
357 +  struct irc_ssaddr ip;
358 +  int               aftype;    /**< Makes life easier for DNS res in IPV6 */
359 +
360 +  char              *passwd;
361 +  fde_t             fd;
362 +  /* Anti-flood stuff. We track how many messages were parsed and how
363 +   * many we were allowed in the current second, and apply a simple
364 +   * decay to avoid flooding.
365 +   *   -- adrian
366 +   */
367 +  int allow_read;       /**< how many we're allowed to read in this second */
368 +  int sent_parsed;      /**< how many messages we've parsed in this second */
369 +
370 +  char*          response;  /**< expected response from client */
371 +  char*          auth_oper; /**< Operator to become if they supply the response.*/
372 + };
373 +
374 + /*! \brief Client structure */
375 + struct Client
376 + {
377 +  dlink_node node;
378 +  dlink_node lnode;             /**< Used for Server->servers/users */
379 +
380 +  struct LocalUser *localClient;
381 +  struct Client    *hnext;      /**< For client hash table lookups by name */
382 +  struct Client    *idhnext;    /**< For SID hash table lookups by sid */
383 +  struct Server    *serv;       /**< ...defined, if this is a server */
384 +  struct Client    *servptr;    /**< Points to server this Client is on */
385 +  struct Client    *from;       /**< == self, if Local Client, *NEVER* NULL! */
386 +
387 +  time_t            tsinfo;     /**< TS on the nick, SVINFO on server */
388 +
389 +  unsigned int      flags;      /**< client flags */
390 +  unsigned int      umodes;     /**< opers, normal users subset */
391 +  unsigned int      hopcount;   /**< number of servers to this 0 = local */
392 +  unsigned int      status;     /**< Client type */
393 +  unsigned int      handler;    /**< Handler index */
394 +
395 +  dlink_list        whowas;
396 +  dlink_list        channel;   /**< chain of channel pointer blocks */
397 +
398 +  char away[AWAYLEN + 1]; /**< Client's AWAY message. Can be set/unset via AWAY command */
399 +  char name[HOSTLEN + 1]; /**< unique name for a client nick or host */
400 +  char svid[HOSTLEN + 1]; /**< Services ID. XXX: Going with HOSTLEN for now. NICKLEN might be too small
401 +                                if dealing with timestamps */
402 +  char id[IDLEN + 1];       /**< client ID, unique ID per client */
403 +  /*
404 +   * client->username is the username from ident or the USER message,
405 +   * If the client is idented the USER message is ignored, otherwise
406 +   * the username part of the USER message is put here prefixed with a
407 +   * tilde depending on the auth{} block. Once a client has registered,
408 +   * this field should be considered read-only.
409 +   */
410 +  char              username[USERLEN + 1]; /* client's username */
411 +  /*
412 +   * client->host contains the resolved name or ip address
413 +   * as a string for the user, it may be fiddled with for oper spoofing etc.
414 +   * once it's changed the *real* address goes away. This should be
415 +   * considered a read-only field after the client has registered.
416 +   */
417 +  char              host[HOSTLEN + 1];     /* client's hostname */
418 +
419 +  /*
420 +   * client->info for unix clients will normally contain the info from the
421 +   * gcos field in /etc/passwd but anything can go here.
422 +   */
423 +  char              info[REALLEN + 1]; /* Free form additional client info */
424 +
425 +  /*
426 +   * client->sockhost contains the ip address gotten from the socket as a
427 +   * string, this field should be considered read-only once the connection
428 +   * has been made. (set in s_bsd.c only)
429 +   */
430 +  char              sockhost[HOSTIPLEN + 1]; /* This is the host name from the
431 +                                                socket ip address as string */
432 + };
433 +
434 +
435   extern struct Client me;
436   extern dlink_list listing_client_list;
437   extern dlink_list global_client_list;
# Line 451 | Line 449 | extern void del_accept(struct split_nuh_
449   extern void del_all_accepts(struct Client *);
450   extern void exit_client(struct Client *, struct Client *, const char *);
451   extern void check_conf_klines(void);
452 < extern void init_client(void);
452 > extern void client_init(void);
453   extern void dead_link_on_write(struct Client *, int);
454   extern void dead_link_on_read(struct Client *, int);
455   extern void exit_aborted_clients(void);

Diff Legend

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