]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/connection.h
bb9f7a5805319d1d0756eb157ee9f6ecf075d288
[user/henk/code/inspircd.git] / include / connection.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
6  *                       E-mail:
7  *                <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *     
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *            the file COPYING for details.
13  *
14  * ---------------------------------------------------
15  */
16
17 #ifndef __CONNECTION_H__
18 #define __CONNECTION_H__
19
20 #include <time.h>
21 #include "inspircd_config.h"
22 #include "base.h"
23
24 /** connection is the base class of userrec, and holds basic user properties.
25  * This can be extended for holding other user-like objects in the future.
26  */
27 class connection : public Extensible
28 {
29  public:
30         /** File descriptor of the connection.
31          * For a remote connection, this will have a negative value.
32          */
33         int fd;
34         
35         /** Hostname of connection.
36          * This should be valid as per RFC1035.
37          */
38         char host[65];
39
40         /** Stats counter for bytes inbound
41          */
42         int bytes_in;
43
44         /** Stats counter for bytes outbound
45          */
46         int bytes_out;
47
48         /** Stats counter for commands inbound
49          */
50         int cmds_in;
51
52         /** Stats counter for commands outbound
53          */
54         int cmds_out;
55
56         /** True if user has authenticated, false if otherwise
57          */
58         bool haspassed;
59
60         /** Used by userrec to indicate the registration status of the connection
61          * It is a bitfield of the REG_NICK, REG_USER and REG_ALL bits to indicate
62          * the connection state.
63          */
64         char registered;
65         
66         /** Time the connection was last pinged
67          */
68         time_t lastping;
69         
70         /** Time the connection was created, set in the constructor. This
71          * may be different from the time the user's classbase object was
72          * created.
73          */
74         time_t signon;
75         
76         /** Time that the connection last sent a message, used to calculate idle time
77          */
78         time_t idle_lastmsg;
79         
80         /** Used by PING checking code
81          */
82         time_t nping;
83         
84         /** Default constructor, creates the user as remote.
85          */
86         connection()
87         {
88                 this->fd = -1;
89         }
90 };
91
92
93 #endif