summaryrefslogtreecommitdiff
path: root/include/bancache.h
blob: 1edbbe5a11dfd578cf5fa2e4a175defd37e3fd9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*       +------------------------------------+
 *       | Inspire Internet Relay Chat Daemon |
 *       +------------------------------------+
 *
 *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
 * See: http://www.inspircd.org/wiki/index.php/Credits
 *
 * This program is free but copyrighted software; see
 *	    the file COPYING for details.
 *
 * ---------------------------------------------------
 */

#ifndef __BANCACHE_H
#define __BANCACHE_H

#include <string>

class CoreExport BanCacheHit : public classbase
{
 private:
 public:
	const std::string Type;
	const std::string Reason;
	const bool Banned;
	const time_t Duration;
	const time_t Creation;
}

// must be defined after class BanCacheHit.
typedef nspace::hash_map<std::string, BanCacheHit *, nspace::hash<std::string> > BanCacheHash;

class CoreExport BanCacheManager : public classbase
{
 private:
	BanCacheHash *BanHash;
	InspIRCd *ServerInstance;
 public:
	BanCacheHit *AddHit(const std::string &ip, bool banned, const std::string &reason);
	BanCacheHit *GetHit(const std::string &ip);

	BanCacheManager(InspIRCd *Instance)
	{
		this->ServerInstance = Instance;
		this->BanHash = new BanCacheHash();
	}
}

#endif