reimplemented fakeident support
[ircu2.10.12-pk.git] / include / struct.h
1 /*
2  * IRC - Internet Relay Chat, include/struct.h
3  * Copyright (C) 1990 Jarkko Oikarinen and
4  *                    University of Oulu, Computing Center
5  * Copyright (C) 1996 -1997 Carlo Wood
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21 /** @file
22  * @brief Structure definitions for users and servers.
23  * @version $Id: struct.h 1746 2007-01-15 03:08:23Z entrope $
24  */
25 #ifndef INCLUDED_struct_h
26 #define INCLUDED_struct_h
27 #ifndef INCLUDED_sys_types_h
28 #include <sys/types.h>      /* time_t */
29 #define INCLUDED_sys_types_h
30 #endif
31 #ifndef INCLUDED_ircd_defs_h
32 #include "ircd_defs.h"       /* sizes */
33 #endif
34
35 struct DLink;
36 struct Client;
37 struct User;
38 struct Membership;
39 struct SLink;
40
41 /** Describes a server on the network. */
42 struct Server {
43   struct Client*  up;           /**< Server one closer to me */
44   struct DLink*   down;         /**< List with downlink servers */
45   struct DLink*   updown;       /**< own Dlink in up->serv->down struct */
46   struct Client** client_list;  /**< List with client pointers on this server */
47   struct User*    user;         /**< who activated this connection */
48   time_t          timestamp;    /**< Remotely determined connect try time */
49   time_t          ghost;        /**< Local time at which a new server
50                                    caused a Ghost */
51   int             lag;          /**< Approximation of the amount of lag to this server */
52   unsigned int    clients;      /**< Number of clients on the server */
53   unsigned short  prot;         /**< Major protocol */
54   unsigned int    nn_mask;      /**< Number of clients supported by server, minus 1 */
55   char          nn_capacity[4]; /**< Numeric representation of server capacity */
56
57   int            asll_rtt;      /**< AsLL round-trip time */
58   int            asll_to;       /**< AsLL upstream lag */
59   int            asll_from;     /**< AsLL downstream lag */
60   time_t         asll_last;     /**< Last time we sent or received an AsLL ping */
61
62   char *last_error_msg;         /**< Allocated memory with last message receive with an ERROR */
63   char by[NICKLEN + 1];         /**< Numnick of client who requested the link */
64 };
65
66 /** Describes a user on the network. */
67 struct User {
68   struct Client*     server;         /**< client structure of server */
69   struct Membership* channel;        /**< chain of channel pointer blocks */
70   struct SLink*      invited;        /**< chain of invite pointer blocks */
71   struct Ban*        silence;        /**< chain of silence pointer blocks */
72   char*              away;           /**< pointer to away message */
73   time_t             last;           /**< last time user sent a message */
74   unsigned int       refcnt;         /**< Number of times this block is referenced */
75   unsigned int       joined;         /**< number of channels joined */
76   unsigned int       invites;        /**< Number of channels we've been invited to */
77   /** Remote account name.  Before registration is complete, this is
78    * either empty or contains the username from the USER command.
79    * After registration, that may be prefixed with ~ or it may be
80    * overwritten with the ident response.
81    */
82   char               username[USERLEN + 1];
83   char               fakeuser[USERLEN + 1];
84   char               host[HOSTLEN + 1];       /**< displayed hostname */
85   char               realhost[HOSTLEN + 1];   /**< actual hostname */
86   char               fakehost[HOSTLEN + 1];   /**< fakehost */
87   char               account[ACCOUNTLEN + 1]; /**< IRC account name */
88   time_t                 acc_create;              /**< IRC account timestamp */
89   time_t             lastmsg_time;            /**< time last PRIVMSG was sent */
90   unsigned int       lastmsg_num;             /**< number of prev msg that matched */
91   char               *lastmsg;                /**< last message */
92 };
93
94 #endif /* INCLUDED_struct_h */