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 "chainparams.h" | |||||
| #include "fs.h" | #include "fs.h" | ||||
| #include "serialize.h" | #include "serialize.h" | ||||
| #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 47 Lines • ▼ Show 20 Lines | |||||
| }; | }; | ||||
| 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: | ||||
| fs::path pathAddr; | fs::path pathAddr; | ||||
| const CChainParams &chainParams; | |||||
| public: | public: | ||||
| CAddrDB(); | CAddrDB(const CChainParams &chainParams); | ||||
| 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: | ||||
| fs::path pathBanlist; | fs::path pathBanlist; | ||||
| const CChainParams &chainParams; | |||||
| public: | public: | ||||
| CBanDB(); | CBanDB(const CChainParams &chainParams); | ||||
| 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 | ||||