2001-12-14 09:13:43 +01:00
|
|
|
/*
|
|
|
|
* ngIRCd -- The Next Generation IRC Daemon
|
2012-03-31 15:24:30 +02:00
|
|
|
* Copyright (c)2001-2012 Alexander Barton (alex@barton.de)
|
2001-12-14 09:13:43 +01:00
|
|
|
*
|
2002-12-12 13:23:43 +01:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
* Please read the file COPYING, README and AUTHORS for more information.
|
2001-12-14 09:13:43 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __client_h__
|
|
|
|
#define __client_h__
|
|
|
|
|
2010-12-27 17:14:14 +01:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Client management (header)
|
|
|
|
*/
|
|
|
|
|
2002-12-12 13:23:43 +01:00
|
|
|
#define CLIENT_UNKNOWN 1 /* connection of unknown type */
|
|
|
|
#define CLIENT_GOTPASS 2 /* client did send PASS */
|
|
|
|
#define CLIENT_GOTNICK 4 /* client did send NICK */
|
|
|
|
#define CLIENT_GOTUSER 8 /* client did send USER */
|
|
|
|
#define CLIENT_USER 16 /* client is an IRC user */
|
2006-10-01 21:05:00 +02:00
|
|
|
#define CLIENT_SERVER 32 /* client is a server */
|
|
|
|
#define CLIENT_SERVICE 64 /* client is a service */
|
|
|
|
#define CLIENT_UNKNOWNSERVER 128 /* unregistered server connection */
|
2008-08-14 23:23:04 +02:00
|
|
|
#define CLIENT_GOTPASS_2813 256 /* client did send PASS, RFC 2813 style */
|
2011-03-27 19:33:48 +02:00
|
|
|
#ifndef STRICT_RFC
|
|
|
|
# define CLIENT_WAITAUTHPING 512 /* waiting for AUTH PONG from client */
|
|
|
|
#endif
|
2012-03-31 16:37:31 +02:00
|
|
|
#define CLIENT_WAITCAPEND 1024 /* waiting for "CAP END" command */
|
2002-11-30 16:04:57 +01:00
|
|
|
|
2005-03-19 19:43:48 +01:00
|
|
|
#define CLIENT_TYPE int
|
2001-12-14 09:13:43 +01:00
|
|
|
|
2006-04-23 12:37:27 +02:00
|
|
|
#include "defines.h"
|
2001-12-14 09:13:43 +01:00
|
|
|
|
2012-03-31 15:59:06 +02:00
|
|
|
#if defined(__client_c__) | defined(__client_cap_c__) | defined(S_SPLINT_S)
|
2002-03-12 15:37:51 +01:00
|
|
|
|
2001-12-14 09:13:43 +01:00
|
|
|
typedef struct _CLIENT
|
|
|
|
{
|
2005-06-12 18:18:49 +02:00
|
|
|
time_t starttime; /* Start time of link */
|
2005-03-19 19:43:48 +01:00
|
|
|
char id[CLIENT_ID_LEN]; /* nick (user) / ID (server) */
|
2002-12-12 13:23:43 +01:00
|
|
|
UINT32 hash; /* hash of lower-case ID */
|
|
|
|
POINTER *next; /* pointer to next client structure */
|
|
|
|
CLIENT_TYPE type; /* type of client, see CLIENT_xxx */
|
|
|
|
CONN_ID conn_id; /* ID of the connection (if local) or NONE (remote) */
|
|
|
|
struct _CLIENT *introducer; /* ID of the servers which the client is connected to */
|
|
|
|
struct _CLIENT *topserver; /* toplevel servers (only valid if client is a server) */
|
2005-03-19 19:43:48 +01:00
|
|
|
char host[CLIENT_HOST_LEN]; /* hostname of the client */
|
2013-08-04 11:15:11 +02:00
|
|
|
char *cloaked; /* cloaked hostname of the client */
|
2005-03-19 19:43:48 +01:00
|
|
|
char user[CLIENT_USER_LEN]; /* user name ("login") */
|
2010-07-12 13:22:48 +02:00
|
|
|
#if defined(PAM) && defined(IDENTAUTH)
|
2010-07-11 17:03:43 +02:00
|
|
|
char orig_user[CLIENT_USER_LEN];/* user name supplied by USER command */
|
|
|
|
#endif
|
2005-03-19 19:43:48 +01:00
|
|
|
char info[CLIENT_INFO_LEN]; /* long user name (user) / info text (server) */
|
|
|
|
char modes[CLIENT_MODE_LEN]; /* client modes */
|
|
|
|
int hops, token, mytoken; /* "hops" and "Token" (see SERVER command) */
|
|
|
|
bool oper_by_me; /* client is local IRC operator on this server? */
|
|
|
|
char away[CLIENT_AWAY_LEN]; /* AWAY text (valid if mode 'a' is set) */
|
|
|
|
char flags[CLIENT_FLAGS_LEN]; /* flags of the client */
|
2013-08-22 15:40:30 +02:00
|
|
|
char *account_name; /* login account (for services) */
|
2012-03-31 15:59:06 +02:00
|
|
|
int capabilities; /* enabled IRC capabilities */
|
2001-12-14 09:13:43 +01:00
|
|
|
} CLIENT;
|
2002-03-12 15:37:51 +01:00
|
|
|
|
2002-01-04 02:21:22 +01:00
|
|
|
#else
|
2002-03-12 15:37:51 +01:00
|
|
|
|
2002-01-04 02:21:22 +01:00
|
|
|
typedef POINTER CLIENT;
|
2002-03-12 15:37:51 +01:00
|
|
|
|
2002-01-04 02:21:22 +01:00
|
|
|
#endif
|
2001-12-23 23:03:47 +01:00
|
|
|
|
|
|
|
|
2005-05-16 14:24:31 +02:00
|
|
|
typedef struct _WHOWAS
|
|
|
|
{
|
|
|
|
time_t time; /* time stamp of entry or 0 if unused */
|
2012-11-02 14:30:19 +01:00
|
|
|
char id[CLIENT_NICK_LEN]; /* client nickname */
|
2005-05-16 14:24:31 +02:00
|
|
|
char host[CLIENT_HOST_LEN]; /* hostname of the client */
|
|
|
|
char user[CLIENT_USER_LEN]; /* user name ("login") */
|
|
|
|
char info[CLIENT_INFO_LEN]; /* long user name */
|
|
|
|
char server[CLIENT_HOST_LEN]; /* server name */
|
|
|
|
} WHOWAS;
|
|
|
|
|
|
|
|
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL void Client_Init PARAMS(( void ));
|
|
|
|
GLOBAL void Client_Exit PARAMS(( void ));
|
2003-01-15 15:28:25 +01:00
|
|
|
|
2009-04-12 01:09:42 +02:00
|
|
|
GLOBAL CLIENT *Client_NewLocal PARAMS(( CONN_ID Idx, const char *Hostname, int Type, bool Idented ));
|
|
|
|
GLOBAL CLIENT *Client_NewRemoteServer PARAMS(( CLIENT *Introducer, const char *Hostname, CLIENT *TopServer, int Hops, int Token, const char *Info, bool Idented ));
|
|
|
|
GLOBAL CLIENT *Client_NewRemoteUser PARAMS(( CLIENT *Introducer, const char *Nick, int Hops, const char *User, const char *Hostname, int Token, const char *Modes, const char *Info, bool Idented ));
|
2003-01-15 15:28:25 +01:00
|
|
|
|
2009-04-12 01:09:42 +02:00
|
|
|
GLOBAL void Client_Destroy PARAMS(( CLIENT *Client, const char *LogMsg, const char *FwdMsg, bool SendQuit ));
|
2003-01-15 15:28:25 +01:00
|
|
|
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL CLIENT *Client_ThisServer PARAMS(( void ));
|
2003-01-15 15:28:25 +01:00
|
|
|
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL CLIENT *Client_GetFromToken PARAMS(( CLIENT *Client, int Token ));
|
2003-01-15 15:28:25 +01:00
|
|
|
|
2013-08-04 01:22:38 +02:00
|
|
|
GLOBAL bool Client_Announce PARAMS(( CLIENT *Client, CLIENT *Prefix, CLIENT *User ));
|
|
|
|
|
2008-05-03 21:20:02 +02:00
|
|
|
GLOBAL CLIENT *Client_Search PARAMS(( const char *ID ));
|
2013-02-05 13:04:11 +01:00
|
|
|
GLOBAL CLIENT *Client_SearchServer PARAMS(( const char *ID ));
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL CLIENT *Client_First PARAMS(( void ));
|
2003-01-15 15:28:25 +01:00
|
|
|
GLOBAL CLIENT *Client_Next PARAMS(( CLIENT *c ));
|
|
|
|
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL int Client_Type PARAMS(( CLIENT *Client ));
|
2003-01-15 15:28:25 +01:00
|
|
|
GLOBAL CONN_ID Client_Conn PARAMS(( CLIENT *Client ));
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL char *Client_ID PARAMS(( CLIENT *Client ));
|
|
|
|
GLOBAL char *Client_Mask PARAMS(( CLIENT *Client ));
|
2010-08-17 20:54:33 +02:00
|
|
|
GLOBAL char *Client_MaskCloaked PARAMS(( CLIENT *Client ));
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL char *Client_Info PARAMS(( CLIENT *Client ));
|
|
|
|
GLOBAL char *Client_User PARAMS(( CLIENT *Client ));
|
2010-07-11 17:03:43 +02:00
|
|
|
#ifdef PAM
|
|
|
|
GLOBAL char *Client_OrigUser PARAMS(( CLIENT *Client ));
|
|
|
|
#endif
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL char *Client_Hostname PARAMS(( CLIENT *Client ));
|
2012-11-24 16:15:35 +01:00
|
|
|
GLOBAL char *Client_HostnameCloaked PARAMS((CLIENT *Client));
|
2012-11-24 13:37:56 +01:00
|
|
|
GLOBAL char *Client_HostnameDisplayed PARAMS(( CLIENT *Client ));
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL char *Client_Modes PARAMS(( CLIENT *Client ));
|
|
|
|
GLOBAL char *Client_Flags PARAMS(( CLIENT *Client ));
|
2003-01-15 15:28:25 +01:00
|
|
|
GLOBAL CLIENT *Client_Introducer PARAMS(( CLIENT *Client ));
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL bool Client_OperByMe PARAMS(( CLIENT *Client ));
|
|
|
|
GLOBAL int Client_Hops PARAMS(( CLIENT *Client ));
|
|
|
|
GLOBAL int Client_Token PARAMS(( CLIENT *Client ));
|
|
|
|
GLOBAL int Client_MyToken PARAMS(( CLIENT *Client ));
|
2003-01-15 15:28:25 +01:00
|
|
|
GLOBAL CLIENT *Client_TopServer PARAMS(( CLIENT *Client ));
|
|
|
|
GLOBAL CLIENT *Client_NextHop PARAMS(( CLIENT *Client ));
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL char *Client_Away PARAMS(( CLIENT *Client ));
|
2013-08-22 15:40:30 +02:00
|
|
|
GLOBAL char *Client_AccountName PARAMS((CLIENT *Client));
|
2005-06-12 18:18:49 +02:00
|
|
|
GLOBAL time_t Client_StartTime PARAMS(( CLIENT *Client ));
|
2005-03-19 19:43:48 +01:00
|
|
|
|
|
|
|
GLOBAL bool Client_HasMode PARAMS(( CLIENT *Client, char Mode ));
|
2013-08-04 04:20:13 +02:00
|
|
|
GLOBAL bool Client_HasFlag PARAMS(( CLIENT *Client, char Flag ));
|
2005-03-19 19:43:48 +01:00
|
|
|
|
2009-04-12 01:09:42 +02:00
|
|
|
GLOBAL void Client_SetHostname PARAMS(( CLIENT *Client, const char *Hostname ));
|
|
|
|
GLOBAL void Client_SetID PARAMS(( CLIENT *Client, const char *Nick ));
|
|
|
|
GLOBAL void Client_SetUser PARAMS(( CLIENT *Client, const char *User, bool Idented ));
|
2010-07-11 17:03:43 +02:00
|
|
|
GLOBAL void Client_SetOrigUser PARAMS(( CLIENT *Client, const char *User ));
|
2009-04-12 01:09:42 +02:00
|
|
|
GLOBAL void Client_SetInfo PARAMS(( CLIENT *Client, const char *Info ));
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL void Client_SetType PARAMS(( CLIENT *Client, int Type ));
|
|
|
|
GLOBAL void Client_SetHops PARAMS(( CLIENT *Client, int Hops ));
|
|
|
|
GLOBAL void Client_SetToken PARAMS(( CLIENT *Client, int Token ));
|
|
|
|
GLOBAL void Client_SetOperByMe PARAMS(( CLIENT *Client, bool OperByMe ));
|
2009-04-12 01:09:42 +02:00
|
|
|
GLOBAL void Client_SetModes PARAMS(( CLIENT *Client, const char *Modes ));
|
|
|
|
GLOBAL void Client_SetFlags PARAMS(( CLIENT *Client, const char *Flags ));
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL void Client_SetIntroducer PARAMS(( CLIENT *Client, CLIENT *Introducer ));
|
2009-04-12 01:09:42 +02:00
|
|
|
GLOBAL void Client_SetAway PARAMS(( CLIENT *Client, const char *Txt ));
|
2013-08-22 15:40:30 +02:00
|
|
|
GLOBAL void Client_SetAccountName PARAMS((CLIENT *Client, const char *AccountName));
|
2005-03-19 19:43:48 +01:00
|
|
|
|
|
|
|
GLOBAL bool Client_ModeAdd PARAMS(( CLIENT *Client, char Mode ));
|
|
|
|
GLOBAL bool Client_ModeDel PARAMS(( CLIENT *Client, char Mode ));
|
|
|
|
|
|
|
|
GLOBAL bool Client_CheckNick PARAMS(( CLIENT *Client, char *Nick ));
|
|
|
|
GLOBAL bool Client_CheckID PARAMS(( CLIENT *Client, char *ID ));
|
|
|
|
|
|
|
|
GLOBAL long Client_UserCount PARAMS(( void ));
|
|
|
|
GLOBAL long Client_ServiceCount PARAMS(( void ));
|
|
|
|
GLOBAL long Client_ServerCount PARAMS(( void ));
|
2006-10-07 12:40:52 +02:00
|
|
|
GLOBAL unsigned long Client_OperCount PARAMS(( void ));
|
|
|
|
GLOBAL unsigned long Client_UnknownCount PARAMS(( void ));
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL long Client_MyUserCount PARAMS(( void ));
|
|
|
|
GLOBAL long Client_MyServiceCount PARAMS(( void ));
|
2006-10-07 12:40:52 +02:00
|
|
|
GLOBAL unsigned long Client_MyServerCount PARAMS(( void ));
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL long Client_MaxUserCount PARAMS(( void ));
|
|
|
|
GLOBAL long Client_MyMaxUserCount PARAMS(( void ));
|
|
|
|
|
2006-10-06 21:57:56 +02:00
|
|
|
GLOBAL bool Client_IsValidNick PARAMS(( const char *Nick ));
|
2002-02-06 17:49:56 +01:00
|
|
|
|
2005-05-16 14:24:31 +02:00
|
|
|
GLOBAL WHOWAS *Client_GetWhowas PARAMS(( void ));
|
|
|
|
GLOBAL int Client_GetLastWhowasIndex PARAMS(( void ));
|
|
|
|
|
2005-05-18 01:18:54 +02:00
|
|
|
GLOBAL void Client_RegisterWhowas PARAMS(( CLIENT *Client ));
|
|
|
|
|
2010-06-26 00:31:08 +02:00
|
|
|
GLOBAL const char *Client_TypeText PARAMS((CLIENT *Client));
|
2002-01-16 23:10:35 +01:00
|
|
|
|
2012-01-22 18:17:28 +01:00
|
|
|
GLOBAL void Client_Reject PARAMS((CLIENT *Client, const char *Reason,
|
|
|
|
bool InformClient));
|
2012-03-31 15:24:30 +02:00
|
|
|
GLOBAL void Client_Introduce PARAMS((CLIENT *From, CLIENT *Client, int Type));
|
|
|
|
|
2012-11-24 16:15:35 +01:00
|
|
|
GLOBAL void Client_UpdateCloakedHostname PARAMS((CLIENT *Client,
|
|
|
|
CLIENT *Originator,
|
|
|
|
const char *hostname));
|
|
|
|
|
2012-01-22 18:17:28 +01:00
|
|
|
|
2008-04-09 19:03:24 +02:00
|
|
|
#ifdef DEBUG
|
|
|
|
GLOBAL void Client_DebugDump PARAMS((void));
|
2001-12-14 09:13:43 +01:00
|
|
|
#endif
|
|
|
|
|
2008-04-09 19:03:24 +02:00
|
|
|
#endif
|
|
|
|
|
2001-12-14 09:13:43 +01:00
|
|
|
/* -eof- */
|