Changeset View
Changeset View
Standalone View
Standalone View
src/addrdb.h
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_ADDRDB_H | #ifndef BITCOIN_ADDRDB_H | ||||
#define BITCOIN_ADDRDB_H | #define BITCOIN_ADDRDB_H | ||||
#include "fs.h" | |||||
#include "serialize.h" | #include "serialize.h" | ||||
#include <boost/filesystem/path.hpp> | |||||
#include <map> | #include <map> | ||||
#include <string> | #include <string> | ||||
class CSubNet; | class CSubNet; | ||||
class CAddrMan; | class CAddrMan; | ||||
class CDataStream; | class CDataStream; | ||||
typedef enum BanReason { | typedef enum BanReason { | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | public: | ||||
} | } | ||||
}; | }; | ||||
typedef std::map<CSubNet, CBanEntry> banmap_t; | typedef std::map<CSubNet, CBanEntry> banmap_t; | ||||
/** Access to the (IP) address database (peers.dat) */ | /** Access to the (IP) address database (peers.dat) */ | ||||
class CAddrDB { | class CAddrDB { | ||||
private: | private: | ||||
boost::filesystem::path pathAddr; | fs::path pathAddr; | ||||
public: | public: | ||||
CAddrDB(); | CAddrDB(); | ||||
bool Write(const CAddrMan &addr); | bool Write(const CAddrMan &addr); | ||||
bool Read(CAddrMan &addr); | bool Read(CAddrMan &addr); | ||||
bool Read(CAddrMan &addr, CDataStream &ssPeers); | bool Read(CAddrMan &addr, CDataStream &ssPeers); | ||||
}; | }; | ||||
/** Access to the banlist database (banlist.dat) */ | /** Access to the banlist database (banlist.dat) */ | ||||
class CBanDB { | class CBanDB { | ||||
private: | private: | ||||
boost::filesystem::path pathBanlist; | fs::path pathBanlist; | ||||
public: | public: | ||||
CBanDB(); | CBanDB(); | ||||
bool Write(const banmap_t &banSet); | bool Write(const banmap_t &banSet); | ||||
bool Read(banmap_t &banSet); | bool Read(banmap_t &banSet); | ||||
}; | }; | ||||
#endif // BITCOIN_ADDRDB_H | #endif // BITCOIN_ADDRDB_H |