Changeset View
Changeset View
Standalone View
Standalone View
src/protocol.h
Show First 20 Lines • Show All 343 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Checks if a peer with the given service flags may be capable of having a | * Checks if a peer with the given service flags may be capable of having a | ||||
* robust address-storage DB. Currently an alias for checking NODE_NETWORK. | * robust address-storage DB. Currently an alias for checking NODE_NETWORK. | ||||
*/ | */ | ||||
static inline bool MayHaveUsefulAddressDB(ServiceFlags services) { | static inline bool MayHaveUsefulAddressDB(ServiceFlags services) { | ||||
return services & NODE_NETWORK; | return services & NODE_NETWORK; | ||||
} | } | ||||
/** | |||||
* 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; | |||||
}; | |||||
/** getdata message type flags */ | /** getdata message type flags */ | ||||
const uint32_t MSG_TYPE_MASK = 0xffffffff >> 3; | const uint32_t MSG_TYPE_MASK = 0xffffffff >> 3; | ||||
/** getdata / inv message types. | /** getdata / inv message types. | ||||
* These numbers are defined by the protocol. When adding a new value, be sure | * These numbers are defined by the protocol. When adding a new value, be sure | ||||
* to mention it in the respective BIP. | * to mention it in the respective BIP. | ||||
*/ | */ | ||||
enum GetDataMsg { | enum GetDataMsg { | ||||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |