0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-03 12:28:52 +01:00
construct/include/ircd/whowas.h

87 lines
2.7 KiB
C
Raw Normal View History

/*
* 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
*
* 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
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;
2016-08-25 04:52:37 +02:00
/* lets speed this up... also removed away information. *tough*
* - Dianora
*/
2016-08-25 04:52:37 +02:00
struct whowas
{
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;
char name[NICKLEN + 1];
char username[USERLEN + 1];
char hostname[HOSTLEN + 1];
char sockhost[HOSTIPLEN + 1];
char realname[REALLEN + 1];
char suser[NICKLEN + 1];
2016-08-25 04:52:37 +02:00
enum flag flag;
whowas(client &client);
};
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);
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);
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 &);
2016-08-25 04:52:37 +02:00
// Add whowas information about client *before* a nick change or logoff.
void add(client &);
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 &);
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();
2016-08-25 04:52:37 +02:00
} // namespace whowas
2016-08-13 05:05:54 +02:00
} // namespace ircd
#endif // __cplusplus