2007-01-25 07:40:21 +01:00
|
|
|
/*
|
|
|
|
* charybdis: A useful ircd.
|
|
|
|
* client.h: The ircd client header.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
|
|
|
|
* Copyright (C) 1996-2002 Hybrid Development Team
|
|
|
|
* Copyright (C) 2002-2004 ircd-ratbox development team
|
|
|
|
* Copyright (C) 2005 William Pitcock and Jilles Tjoelker
|
2016-08-24 01:08:40 +02:00
|
|
|
* Copyright (C) 2005-2016 Charybdis Development Team
|
2007-01-25 07:40:21 +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.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
* USA
|
|
|
|
*/
|
|
|
|
|
2016-08-13 05:05:54 +02:00
|
|
|
#pragma once
|
|
|
|
#define HAVE_IRCD_CLIENT_H
|
2016-08-24 00:25:09 +02:00
|
|
|
|
2016-08-24 01:08:40 +02:00
|
|
|
#ifdef __cplusplus
|
2016-09-11 08:05:38 +02:00
|
|
|
namespace ircd {
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-09-11 08:05:38 +02:00
|
|
|
struct sock;
|
|
|
|
struct client;
|
2016-09-12 23:07:46 +02:00
|
|
|
|
|
|
|
std::shared_ptr<client> shared_from(client &);
|
|
|
|
std::weak_ptr<client> weak_from(client &);
|
2016-08-23 04:33:36 +02:00
|
|
|
|
2016-09-11 08:05:38 +02:00
|
|
|
// Client socket addressing
|
2016-09-12 23:07:46 +02:00
|
|
|
bool has_socket(const client &);
|
|
|
|
const sock &socket(const client &);
|
|
|
|
sock &socket(client &);
|
|
|
|
|
2016-09-11 08:05:38 +02:00
|
|
|
using ip_port_pair = std::pair<std::string, uint16_t>;
|
|
|
|
using ip_port = IRCD_WEAK_T(ip_port_pair);
|
|
|
|
ip_port remote_address(const client &);
|
|
|
|
ip_port local_address(const client &);
|
|
|
|
std::string string(const ip_port &);
|
2016-08-23 04:33:36 +02:00
|
|
|
|
2016-09-12 23:07:46 +02:00
|
|
|
enum class dc
|
|
|
|
{
|
|
|
|
RST, // hardest disconnect
|
|
|
|
FIN, // graceful shutdown both directions
|
|
|
|
FIN_SEND, // graceful shutdown send side
|
|
|
|
FIN_RECV, // graceful shutdown recv side
|
|
|
|
};
|
|
|
|
|
2016-09-13 00:10:56 +02:00
|
|
|
|
2016-09-12 23:07:46 +02:00
|
|
|
bool connected(const client &) noexcept;
|
|
|
|
bool disconnect(std::nothrow_t, client &, const dc & = dc::FIN) noexcept;
|
|
|
|
void disconnect(client &, const dc & = dc::FIN);
|
2016-09-13 02:10:04 +02:00
|
|
|
void recv_cancel(client &);
|
|
|
|
void recv_next(client &, const std::chrono::milliseconds &timeout);
|
|
|
|
void recv_next(client &);
|
2016-09-13 00:10:56 +02:00
|
|
|
|
|
|
|
// Destroys a client. This only removes the client from the clients list,
|
|
|
|
// and may result in a destruction and disconnect, or it may not.
|
|
|
|
void finished(client &);
|
2010-02-13 15:18:17 +01:00
|
|
|
|
2016-09-13 00:10:56 +02:00
|
|
|
// Creates a client.
|
2016-09-11 08:05:38 +02:00
|
|
|
std::shared_ptr<client> add_client();
|
2016-09-13 02:10:04 +02:00
|
|
|
std::shared_ptr<client> add_client(std::shared_ptr<struct sock>);
|
2016-09-10 21:57:33 +02:00
|
|
|
|
2016-09-12 23:07:46 +02:00
|
|
|
using clist = std::list<std::shared_ptr<client>>;
|
2016-09-11 08:05:38 +02:00
|
|
|
const clist &clients();
|
2016-01-21 04:26:55 +01:00
|
|
|
|
2016-09-10 21:57:33 +02:00
|
|
|
} // namespace ircd
|
|
|
|
#endif // __cplusplus
|
2016-08-23 04:33:36 +02:00
|
|
|
|
2016-09-10 21:57:33 +02:00
|
|
|
/*
|
2016-08-23 04:33:36 +02:00
|
|
|
inline bool
|
2016-08-28 06:52:31 +02:00
|
|
|
is(const client &client, const mode::mask &mask)
|
2016-08-23 04:33:36 +02:00
|
|
|
{
|
2016-08-28 06:52:31 +02:00
|
|
|
return mode::is(client.mode, mask);
|
2016-08-23 04:33:36 +02:00
|
|
|
}
|
|
|
|
|
2016-08-24 00:25:09 +02:00
|
|
|
inline void
|
2016-08-28 06:52:31 +02:00
|
|
|
set(client &client, const mode::mask &mask)
|
2016-08-24 00:25:09 +02:00
|
|
|
{
|
2016-08-28 06:52:31 +02:00
|
|
|
return mode::set(client.mode, mask);
|
2016-08-24 00:25:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
2016-08-28 06:52:31 +02:00
|
|
|
clear(client &client, const mode::mask &mask)
|
2016-08-24 00:25:09 +02:00
|
|
|
{
|
2016-08-28 06:52:31 +02:00
|
|
|
return mode::clear(client.mode, mask);
|
2016-08-24 00:25:09 +02:00
|
|
|
}
|
2016-08-23 04:33:36 +02:00
|
|
|
|
|
|
|
inline void
|
|
|
|
set_got_id(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::GOTID;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_got_id(const client &client)
|
|
|
|
{
|
|
|
|
return (client.flags & flags::GOTID) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_exempt_kline(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::EXEMPTKLINE;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_exempt_kline(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::EXEMPTKLINE;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_exempt_flood(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::EXEMPTFLOOD;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_exempt_flood(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::EXEMPTFLOOD;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_exempt_spambot(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::EXEMPTSPAMBOT;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_exempt_spambot(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::EXEMPTSPAMBOT;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_exempt_shide(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::EXEMPTSHIDE;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_exempt_shide(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::EXEMPTSHIDE;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_exempt_jupe(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::EXEMPTJUPE;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_exempt_jupe(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::EXEMPTJUPE;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_exempt_resv(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::EXEMPTRESV;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_exempt_resv(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::EXEMPTRESV;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_ip_spoof(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::IP_SPOOFING;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_ip_spoof(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::IP_SPOOFING;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_extend_chans(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::EXTENDCHANS;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_extend_chans(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::EXTENDCHANS;
|
|
|
|
}
|
2016-08-19 07:56:18 +02:00
|
|
|
|
|
|
|
inline bool
|
2016-08-22 03:57:43 +02:00
|
|
|
is_client(const client &client)
|
2016-08-19 07:56:18 +02:00
|
|
|
{
|
2016-08-23 04:33:36 +02:00
|
|
|
return client.status == status::CLIENT;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_registered_user(const client &client)
|
|
|
|
{
|
|
|
|
return client.status == status::CLIENT;
|
2016-08-19 07:56:18 +02:00
|
|
|
}
|
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
inline bool
|
|
|
|
is_registered(const client &client)
|
|
|
|
{
|
|
|
|
return client.status > status::UNKNOWN && client.status != status::REJECT;
|
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
inline bool
|
|
|
|
is_connecting(const client &client)
|
|
|
|
{
|
|
|
|
return client.status == status::CONNECTING;
|
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
inline bool
|
|
|
|
is_handshake(const client &client)
|
|
|
|
{
|
|
|
|
return client.status == status::HANDSHAKE;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_me(const client &client)
|
|
|
|
{
|
|
|
|
return client.status == status::ME;
|
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
inline bool
|
|
|
|
is_unknown(const client &client)
|
|
|
|
{
|
|
|
|
return client.status == status::UNKNOWN;
|
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
inline bool
|
|
|
|
is_server(const client &client)
|
|
|
|
{
|
|
|
|
return client.status == status::SERVER;
|
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
inline bool
|
|
|
|
is_reject(const client &client)
|
|
|
|
{
|
|
|
|
return client.status == status::REJECT;
|
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
inline bool
|
|
|
|
is_any_server(const client &client)
|
|
|
|
{
|
|
|
|
return is_server(client) || is_handshake(client) || is_connecting(client);
|
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
inline void
|
|
|
|
set_reject(client &client)
|
|
|
|
{
|
|
|
|
client.status = status::REJECT;
|
2016-09-06 01:05:16 +02:00
|
|
|
//client.handler = UNREGISTERED_HANDLER;
|
2016-08-23 04:33:36 +02:00
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
inline void
|
|
|
|
set_connecting(client &client)
|
|
|
|
{
|
|
|
|
client.status = status::CONNECTING;
|
2016-09-06 01:05:16 +02:00
|
|
|
//client.handler = UNREGISTERED_HANDLER;
|
2016-08-23 04:33:36 +02:00
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
inline void
|
|
|
|
set_handshake(client &client)
|
|
|
|
{
|
|
|
|
client.status = status::HANDSHAKE;
|
2016-09-06 01:05:16 +02:00
|
|
|
//client.handler = UNREGISTERED_HANDLER;
|
2016-08-23 04:33:36 +02:00
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
inline void
|
|
|
|
set_me(client &client)
|
|
|
|
{
|
|
|
|
client.status = status::ME;
|
2016-09-06 01:05:16 +02:00
|
|
|
//client.handler = UNREGISTERED_HANDLER;
|
2016-08-23 04:33:36 +02:00
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
inline void
|
|
|
|
set_unknown(client &client)
|
|
|
|
{
|
|
|
|
client.status = status::UNKNOWN;
|
2016-09-06 01:05:16 +02:00
|
|
|
//client.handler = UNREGISTERED_HANDLER;
|
2016-08-23 04:33:36 +02:00
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
inline void
|
|
|
|
set_server(client &client)
|
|
|
|
{
|
|
|
|
client.status = status::SERVER;
|
2016-09-06 01:05:16 +02:00
|
|
|
//client.handler = SERVER_HANDLER;
|
2016-08-23 04:33:36 +02:00
|
|
|
}
|
|
|
|
|
2016-08-24 00:25:09 +02:00
|
|
|
bool is_oper(const client &);
|
2016-08-23 04:33:36 +02:00
|
|
|
|
|
|
|
inline void
|
|
|
|
set_client(client &client)
|
|
|
|
{
|
|
|
|
client.status = status::CLIENT;
|
2016-09-06 01:05:16 +02:00
|
|
|
//client.handler = is_oper(client)? OPER_HANDLER : CLIENT_HANDLER;
|
2016-08-23 04:33:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_remote_client(client &client)
|
|
|
|
{
|
|
|
|
client.status = status::CLIENT;
|
2016-09-06 01:05:16 +02:00
|
|
|
//client.handler = RCLIENT_HANDLER;
|
2016-08-23 04:33:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
parse_as_client(const client &client)
|
|
|
|
{
|
|
|
|
return bool(client.status & (status::UNKNOWN | status::CLIENT));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
parse_as_server(const client &client)
|
|
|
|
{
|
|
|
|
return bool(client.status & (status::CONNECTING | status::HANDSHAKE | status::SERVER));
|
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-09-10 21:57:33 +02:00
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
#define TS_CURRENT 6
|
|
|
|
#define TS_MIN 6
|
|
|
|
|
|
|
|
#define TS_DOESTS 0x10000000
|
|
|
|
#define DoesTS(x) ((x)->tsinfo & TS_DOESTS)
|
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
|
2016-08-24 01:08:40 +02:00
|
|
|
inline bool
|
|
|
|
has_id(const client &client)
|
|
|
|
{
|
|
|
|
return client.id[0] != '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
has_id(const client *const &client)
|
|
|
|
{
|
|
|
|
return has_id(*client);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const char *
|
|
|
|
use_id(const client &client)
|
|
|
|
{
|
|
|
|
return has_id(client)? client.id : client.name;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const char *
|
|
|
|
use_id(const client *const &client)
|
|
|
|
{
|
|
|
|
return use_id(*client);
|
|
|
|
}
|
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
bool is_server(const client &client);
|
2016-08-24 12:11:01 +02:00
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
inline char *get_id(const client *const &source, const client *const &target)
|
|
|
|
{
|
2016-08-23 04:33:36 +02:00
|
|
|
return const_cast<char *>(is_server(*target->from) && has_id(target->from) ? use_id(source) : (source)->name);
|
2016-08-23 02:37:07 +02:00
|
|
|
}
|
|
|
|
|
2016-08-24 12:11:01 +02:00
|
|
|
inline auto
|
|
|
|
get_id(const client &source, const client &target)
|
2016-08-23 02:37:07 +02:00
|
|
|
{
|
|
|
|
return get_id(&source, &target);
|
|
|
|
}
|
|
|
|
|
2016-08-24 12:11:01 +02:00
|
|
|
inline auto
|
|
|
|
id(const client &source, const client &target)
|
|
|
|
{
|
|
|
|
return is_server(*target.from) && has_id(*target.from)? use_id(source) : source.name;
|
|
|
|
}
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
|
2008-04-06 18:55:12 +02:00
|
|
|
#define LFLAGS_SSL 0x00000001
|
|
|
|
#define LFLAGS_FLUSH 0x00000002
|
2008-04-06 16:52:42 +02:00
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
inline bool
|
|
|
|
is_person(const client &client)
|
|
|
|
{
|
|
|
|
return is_client(client) && client.user;
|
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
inline bool
|
|
|
|
my_connect(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::MYCONNECT;
|
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
inline void
|
|
|
|
set_my_connect(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::MYCONNECT;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
clear_my_connect(client &client)
|
|
|
|
{
|
|
|
|
client.flags &= ~flags::MYCONNECT;
|
|
|
|
}
|
2016-08-19 07:56:18 +02:00
|
|
|
|
|
|
|
inline bool
|
2016-08-22 03:57:43 +02:00
|
|
|
my(const client &client)
|
2016-08-19 07:56:18 +02:00
|
|
|
{
|
2016-08-23 04:33:36 +02:00
|
|
|
return my_connect(client) && is_client(client);
|
|
|
|
}
|
|
|
|
|
2016-08-24 00:25:09 +02:00
|
|
|
inline bool
|
|
|
|
my_oper(const client &client)
|
|
|
|
{
|
|
|
|
return my_connect(client) && is_oper(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_oper(const client &client)
|
|
|
|
{
|
|
|
|
return is(client, mode::OPER);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_oper(client &client)
|
|
|
|
{
|
|
|
|
set(client, mode::OPER);
|
2016-09-06 01:05:16 +02:00
|
|
|
// if (my(client))
|
|
|
|
// client.handler = OPER_HANDLER;
|
2016-08-24 00:25:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
clear_oper(client &client)
|
|
|
|
{
|
|
|
|
clear(client, mode::OPER);
|
|
|
|
clear(client, mode::ADMIN);
|
2016-09-06 01:05:16 +02:00
|
|
|
// if (my(client) && !is_server(client))
|
|
|
|
// client.handler = CLIENT_HANDLER;
|
2016-08-24 00:25:09 +02:00
|
|
|
}
|
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
inline void
|
|
|
|
set_mark(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::MARK;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
clear_mark(client &client)
|
|
|
|
{
|
|
|
|
client.flags &= ~flags::MARK;
|
2016-08-19 07:56:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
2016-08-23 04:33:36 +02:00
|
|
|
is_marked(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::MARK;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_hidden(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::HIDDEN;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
clear_hidden(client &client)
|
|
|
|
{
|
|
|
|
client.flags &= ~flags::HIDDEN;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_hidden(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::HIDDEN;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
clear_eob(client &client)
|
|
|
|
{
|
|
|
|
client.flags &= ~flags::EOB;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_eob(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::EOB;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
has_sent_eob(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::EOB;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_dead(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::DEAD;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_dead(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::DEAD;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_closing(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::CLOSING;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_closing(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::CLOSING;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_io_error(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::IOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_io_error(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::IOERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_any_dead(const client &client)
|
|
|
|
{
|
|
|
|
return is_io_error(client) || is_dead(client) || is_closing(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_tg_change(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::TGCHANGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
clear_tg_change(client &client)
|
|
|
|
{
|
|
|
|
client.flags &= ~flags::TGCHANGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_tg_change(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::TGCHANGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_dyn_spoof(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::DYNSPOOF;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
clear_dyn_spoof(client &client)
|
|
|
|
{
|
|
|
|
client.flags &= ~flags::DYNSPOOF;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_dyn_spoof(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::DYNSPOOF;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_tg_excessive(client &client)
|
|
|
|
{
|
|
|
|
client.flags|= flags::TGEXCESSIVE;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
clear_tg_excessive(client &client)
|
2016-08-19 07:56:18 +02:00
|
|
|
{
|
2016-08-23 04:33:36 +02:00
|
|
|
client.flags &= ~flags::TGEXCESSIVE;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_tg_excessive(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::TGEXCESSIVE;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
set_flood_done(client &client)
|
|
|
|
{
|
|
|
|
client.flags |= flags::FLOODDONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
is_flood_done(const client &client)
|
|
|
|
{
|
|
|
|
return client.flags & flags::FLOODDONE;
|
|
|
|
}
|
|
|
|
|
2016-08-24 01:08:40 +02:00
|
|
|
inline bool
|
|
|
|
operator==(const client &a, const client &b)
|
|
|
|
{
|
|
|
|
return &a == &b;
|
|
|
|
}
|
|
|
|
|
2016-08-28 10:16:24 +02:00
|
|
|
inline bool
|
|
|
|
operator!=(const client &a, const client &b)
|
|
|
|
{
|
|
|
|
return !(a == b);
|
|
|
|
}
|
|
|
|
|
2016-09-10 21:57:33 +02:00
|
|
|
*/
|