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