2005-11-25 12:32:35 +00:00
|
|
|
/* +------------------------------------+
|
|
|
|
* | Inspire Internet Relay Chat Daemon |
|
|
|
|
* +------------------------------------+
|
|
|
|
*
|
2006-01-15 15:59:11 +00:00
|
|
|
* InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
|
2005-11-25 12:32:35 +00:00
|
|
|
* E-mail:
|
|
|
|
* <brain@chatspike.net>
|
|
|
|
* <Craig@chatspike.net>
|
|
|
|
*
|
|
|
|
* Written by Craig Edwards, Craig McLure, and others.
|
|
|
|
* This program is free but copyrighted software; see
|
|
|
|
* the file COPYING for details.
|
|
|
|
*
|
|
|
|
* ---------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CONNECTION_H__
|
|
|
|
#define __CONNECTION_H__
|
|
|
|
|
2006-04-10 22:16:34 +00:00
|
|
|
#include <time.h>
|
|
|
|
#include "inspircd_config.h"
|
|
|
|
#include "base.h"
|
|
|
|
|
2006-08-11 19:32:37 +00:00
|
|
|
/** connection is the base class of userrec, and holds basic user properties.
|
|
|
|
* This can be extended for holding other user-like objects in the future.
|
|
|
|
*/
|
2005-11-25 12:32:35 +00:00
|
|
|
class connection : public Extensible
|
|
|
|
{
|
|
|
|
public:
|
2006-08-11 19:32:37 +00:00
|
|
|
/** File descriptor of the connection.
|
|
|
|
* For a remote connection, this will have a negative value.
|
2005-11-25 12:32:35 +00:00
|
|
|
*/
|
|
|
|
int fd;
|
|
|
|
|
2006-08-11 19:32:37 +00:00
|
|
|
/** Hostname of connection.
|
|
|
|
* This should be valid as per RFC1035.
|
2005-11-25 12:32:35 +00:00
|
|
|
*/
|
2006-05-10 22:59:53 +00:00
|
|
|
char host[65];
|
2006-01-27 15:26:59 +00:00
|
|
|
|
2005-11-25 12:32:35 +00:00
|
|
|
/** Stats counter for bytes inbound
|
|
|
|
*/
|
|
|
|
int bytes_in;
|
|
|
|
|
|
|
|
/** Stats counter for bytes outbound
|
|
|
|
*/
|
|
|
|
int bytes_out;
|
|
|
|
|
|
|
|
/** Stats counter for commands inbound
|
|
|
|
*/
|
|
|
|
int cmds_in;
|
|
|
|
|
|
|
|
/** Stats counter for commands outbound
|
|
|
|
*/
|
|
|
|
int cmds_out;
|
|
|
|
|
2006-08-04 01:59:41 +00:00
|
|
|
/** True if user has authenticated, false if otherwise
|
2005-11-25 12:32:35 +00:00
|
|
|
*/
|
|
|
|
bool haspassed;
|
|
|
|
|
|
|
|
/** Used by userrec to indicate the registration status of the connection
|
2006-08-11 19:32:37 +00:00
|
|
|
* It is a bitfield of the REG_NICK, REG_USER and REG_ALL bits to indicate
|
|
|
|
* the connection state.
|
2005-11-25 12:32:35 +00:00
|
|
|
*/
|
|
|
|
char registered;
|
|
|
|
|
|
|
|
/** Time the connection was last pinged
|
|
|
|
*/
|
|
|
|
time_t lastping;
|
|
|
|
|
2006-08-11 19:32:37 +00:00
|
|
|
/** Time the connection was created, set in the constructor. This
|
|
|
|
* may be different from the time the user's classbase object was
|
|
|
|
* created.
|
2005-11-25 12:32:35 +00:00
|
|
|
*/
|
|
|
|
time_t signon;
|
|
|
|
|
2006-08-11 19:32:37 +00:00
|
|
|
/** Time that the connection last sent a message, used to calculate idle time
|
2005-11-25 12:32:35 +00:00
|
|
|
*/
|
|
|
|
time_t idle_lastmsg;
|
|
|
|
|
2006-08-11 19:32:37 +00:00
|
|
|
/** Used by PING checking code
|
2005-11-25 12:32:35 +00:00
|
|
|
*/
|
|
|
|
time_t nping;
|
|
|
|
|
2006-08-11 19:32:37 +00:00
|
|
|
/** Default constructor, creates the user as remote.
|
2005-11-25 12:32:35 +00:00
|
|
|
*/
|
2005-11-25 13:45:12 +00:00
|
|
|
connection()
|
|
|
|
{
|
|
|
|
this->fd = -1;
|
|
|
|
}
|
2005-11-25 12:32:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|