Changeset View
Changeset View
Standalone View
Standalone View
src/address.h
- This file was added.
// Copyright (c) 2018 The Bitcoin developers | |||||
// Distributed under the MIT software license, see the accompanying | |||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | |||||
#ifndef BITCOIN_CADDRESS_H | |||||
#define BITCOIN_CADDRESS_H | |||||
#include "protocol.h" | |||||
#include "serialize.h" | |||||
/** | |||||
* A CService with information about it as peer. | |||||
*/ | |||||
class CAddress : public CService { | |||||
public: | |||||
CAddress(); | |||||
explicit CAddress(CService ipIn, ServiceFlags nServicesIn); | |||||
void Init(); | |||||
ADD_SERIALIZE_METHODS; | |||||
template <typename Stream, typename Operation> | |||||
inline void SerializationOp(Stream &s, Operation ser_action) { | |||||
if (ser_action.ForRead()) Init(); | |||||
int nVersion = s.GetVersion(); | |||||
if (s.GetType() & SER_DISK) READWRITE(nVersion); | |||||
if ((s.GetType() & SER_DISK) || | |||||
(nVersion >= CADDR_TIME_VERSION && !(s.GetType() & SER_GETHASH))) | |||||
READWRITE(nTime); | |||||
uint64_t nServicesInt = nServices; | |||||
READWRITE(nServicesInt); | |||||
nServices = (ServiceFlags)nServicesInt; | |||||
READWRITE(*(CService *)this); | |||||
} | |||||
// TODO: make private (improves encapsulation) | |||||
public: | |||||
ServiceFlags nServices; | |||||
// disk and network only | |||||
unsigned int nTime; | |||||
}; | |||||
#endif // BITCOIN_CADDRESS_H |