2007-01-25 07:40:21 +01:00
|
|
|
/*
|
|
|
|
* ircd-ratbox: A slightly useful ircd.
|
|
|
|
* whowas.h: Header for the whowas functions.
|
|
|
|
*
|
|
|
|
* 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
|
2016-08-25 04:52:37 +02:00
|
|
|
* Copyright (C) 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_WHOWAS_H
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-13 05:05:54 +02:00
|
|
|
#ifdef __cplusplus
|
2016-08-25 04:52:37 +02:00
|
|
|
namespace ircd {
|
|
|
|
namespace whowas {
|
2016-08-13 05:05:54 +02:00
|
|
|
|
2016-08-25 04:52:37 +02:00
|
|
|
using client::client;
|
|
|
|
using id_t = uint64_t;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-25 04:52:37 +02:00
|
|
|
/* lets speed this up... also removed away information. *tough*
|
|
|
|
* - Dianora
|
2007-01-25 07:40:21 +01:00
|
|
|
*/
|
2016-08-25 04:52:37 +02:00
|
|
|
struct whowas
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-08-25 04:52:37 +02:00
|
|
|
enum flag
|
|
|
|
{
|
|
|
|
IP_SPOOFING = 0x01,
|
|
|
|
DYNSPOOF = 0x02,
|
|
|
|
};
|
|
|
|
|
|
|
|
id_t wwid; // Unique whowas index ID
|
|
|
|
client *online; // Pointer to online client or nullptr
|
|
|
|
time_t logoff;
|
|
|
|
std::shared_ptr<cache::serv::entry> scache;
|
2007-01-25 07:40:21 +01:00
|
|
|
char name[NICKLEN + 1];
|
|
|
|
char username[USERLEN + 1];
|
|
|
|
char hostname[HOSTLEN + 1];
|
|
|
|
char sockhost[HOSTIPLEN + 1];
|
|
|
|
char realname[REALLEN + 1];
|
2010-08-29 22:30:54 +02:00
|
|
|
char suser[NICKLEN + 1];
|
2016-08-25 04:52:37 +02:00
|
|
|
enum flag flag;
|
|
|
|
|
|
|
|
whowas(client &client);
|
2007-01-25 07:40:21 +01:00
|
|
|
};
|
|
|
|
|
2016-08-25 04:52:37 +02:00
|
|
|
// Get a full history for nickname (may contain different users!)
|
|
|
|
std::vector<std::shared_ptr<whowas>> history(const std::string &name, const time_t &limit = 0, const bool &online = false);
|
2013-09-14 12:26:32 +02:00
|
|
|
|
2016-08-25 04:52:37 +02:00
|
|
|
// Get a full history for this unique whowas ID. This is effectively similar to
|
|
|
|
// a lookup by a client pointer address; allocators may reuse the same address,
|
|
|
|
// so this ID is used as the index instead.
|
|
|
|
std::vector<std::shared_ptr<whowas>> history(const id_t &wwid);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-25 04:52:37 +02:00
|
|
|
// Get a full history for this client (must be online);
|
|
|
|
std::vector<std::shared_ptr<whowas>> history(const client &);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-25 04:52:37 +02:00
|
|
|
// Add whowas information about client *before* a nick change or logoff.
|
|
|
|
void add(client &);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-25 04:52:37 +02:00
|
|
|
// Notify this subsystem the client pointer is about to be invalidated (does not call add())
|
|
|
|
void off(client &);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-25 04:52:37 +02:00
|
|
|
// Util
|
|
|
|
void memory_usage(size_t *const &count, size_t *const &memused);
|
|
|
|
void set_size(const size_t &max);
|
|
|
|
void init();
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-25 04:52:37 +02:00
|
|
|
} // namespace whowas
|
2016-08-13 05:05:54 +02:00
|
|
|
} // namespace ircd
|
|
|
|
#endif // __cplusplus
|