Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/protocol.h
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2011 The Bitcoin developers | // Copyright (c) 2011 The Bitcoin developers | ||||
// Distributed under the MIT/X11 software license, see the accompanying | // Distributed under the MIT/X11 software license, see the accompanying | ||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php. | // file license.txt or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef __cplusplus | #ifndef __cplusplus | ||||
#error This header can only be compiled as C++. | #error This header can only be compiled as C++. | ||||
#endif | #endif | ||||
#ifndef __INCLUDED_PROTOCOL_H__ | #ifndef BITCOIN_SEEDER_PROTOCOL_H | ||||
#define __INCLUDED_PROTOCOL_H__ | #define BITCOIN_SEEDER_PROTOCOL_H | ||||
#include "netbase.h" | #include "netbase.h" | ||||
#include "serialize.h" | #include "serialize.h" | ||||
#include "uint256.h" | #include "uint256.h" | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <string> | #include <string> | ||||
extern bool fTestNet; | extern bool fTestNet; | ||||
static inline unsigned short GetDefaultPort(const bool testnet = fTestNet) { | static inline unsigned short GetDefaultPort(const bool testnet = fTestNet) { | ||||
return testnet ? 18333 : 8333; | return testnet ? 18333 : 8333; | ||||
} | } | ||||
// | // | ||||
// Message header | // Message header | ||||
// (4) message start | // (4) message start | ||||
// (12) command | // (12) command | ||||
// (4) size | // (4) size | ||||
// (4) checksum | // (4) checksum | ||||
extern unsigned char pchMessageStart[4]; | extern uint8_t pchMessageStart[4]; | ||||
class CMessageHeader { | class CMessageHeader { | ||||
public: | public: | ||||
CMessageHeader(); | CMessageHeader(); | ||||
CMessageHeader(const char *pszCommand, unsigned int nMessageSizeIn); | CMessageHeader(const char *pszCommand, unsigned int nMessageSizeIn); | ||||
std::string GetCommand() const; | std::string GetCommand() const; | ||||
bool IsValid() const; | bool IsValid() const; | ||||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |