![]() |
Bitcoin Core
25.99.0
P2P Digital Currency
|
Message header. More...
#include <protocol.h>
Public Member Functions | |
CMessageHeader ()=default | |
CMessageHeader (const MessageStartChars &pchMessageStartIn, const char *pszCommand, unsigned int nMessageSizeIn) | |
Construct a P2P message header from message-start characters, a command and the size of the message. More... | |
std::string | GetCommand () const |
bool | IsCommandValid () const |
SERIALIZE_METHODS (CMessageHeader, obj) | |
Public Attributes | |
MessageStartChars | pchMessageStart {} |
char | pchCommand [COMMAND_SIZE] {} |
uint32_t | nMessageSize {std::numeric_limits<uint32_t>::max()} |
uint8_t | pchChecksum [CHECKSUM_SIZE] {} |
Static Public Attributes | |
static constexpr size_t | COMMAND_SIZE = 12 |
static constexpr size_t | MESSAGE_SIZE_SIZE = 4 |
static constexpr size_t | CHECKSUM_SIZE = 4 |
static constexpr size_t | MESSAGE_SIZE_OFFSET = std::tuple_size_v<MessageStartChars> + COMMAND_SIZE |
static constexpr size_t | CHECKSUM_OFFSET = MESSAGE_SIZE_OFFSET + MESSAGE_SIZE_SIZE |
static constexpr size_t | HEADER_SIZE = std::tuple_size_v<MessageStartChars> + COMMAND_SIZE + MESSAGE_SIZE_SIZE + CHECKSUM_SIZE |
Message header.
(4) message start. (12) command. (4) size. (4) checksum.
Definition at line 28 of file protocol.h.
|
explicitdefault |
CMessageHeader::CMessageHeader | ( | const MessageStartChars & | pchMessageStartIn, |
const char * | pszCommand, | ||
unsigned int | nMessageSizeIn | ||
) |
Construct a P2P message header from message-start characters, a command and the size of the message.
pszCommand
longer than COMMAND_SIZE will result in a run-time assertion error. Definition at line 93 of file protocol.cpp.
std::string CMessageHeader::GetCommand | ( | ) | const |
Definition at line 105 of file protocol.cpp.
bool CMessageHeader::IsCommandValid | ( | ) | const |
Definition at line 110 of file protocol.cpp.
|
inline |
Definition at line 48 of file protocol.h.
|
staticconstexpr |
Definition at line 35 of file protocol.h.
|
staticconstexpr |
Definition at line 33 of file protocol.h.
|
staticconstexpr |
Definition at line 31 of file protocol.h.
|
staticconstexpr |
Definition at line 36 of file protocol.h.
|
staticconstexpr |
Definition at line 34 of file protocol.h.
|
staticconstexpr |
Definition at line 32 of file protocol.h.
uint32_t CMessageHeader::nMessageSize {std::numeric_limits<uint32_t>::max()} |
Definition at line 52 of file protocol.h.
uint8_t CMessageHeader::pchChecksum[CHECKSUM_SIZE] {} |
Definition at line 53 of file protocol.h.
char CMessageHeader::pchCommand[COMMAND_SIZE] {} |
Definition at line 51 of file protocol.h.
MessageStartChars CMessageHeader::pchMessageStart {} |
Definition at line 50 of file protocol.h.