]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/connection.h
Routing more socket includes through socket.h
[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 /** Please note: classes serverrec and userrec both inherit from class connection.
25  */
26 class connection : public Extensible
27 {
28  public:
29         /** File descriptor of the connection
30          */
31         int fd;
32         
33         /** Hostname of connection. Not used if this is a serverrec
34          */
35         char host[64];
36
37         /** Stats counter for bytes inbound
38          */
39         int bytes_in;
40
41         /** Stats counter for bytes outbound
42          */
43         int bytes_out;
44
45         /** Stats counter for commands inbound
46          */
47         int cmds_in;
48
49         /** Stats counter for commands outbound
50          */
51         int cmds_out;
52
53         /** True if server/user has authenticated, false if otherwise
54          */
55         bool haspassed;
56
57         /** Port number
58          * For a userrec, this is the port they connected to the network on.
59          * For a serverrec this is the current listening port of the serverrec object.
60          */
61         int port;
62         
63         /** Used by userrec to indicate the registration status of the connection
64          */
65         char registered;
66         
67         /** Time the connection was last pinged
68          */
69         time_t lastping;
70         
71         /** Time the connection was created, set in the constructor
72          */
73         time_t signon;
74         
75         /** Time that the connection last sent data, used to calculate idle time
76          */
77         time_t idle_lastmsg;
78         
79         /** Used by PING checks with clients
80          */
81         time_t nping;
82         
83         /** Default constructor
84          */
85         connection()
86         {
87                 this->fd = -1;
88         }
89 };
90
91
92 #endif