Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
Message header. More...
#include <protocol.h>
Public Types | |
typedef unsigned char | MessageStartChars[MESSAGE_START_SIZE] |
Public Member Functions | |
CMessageHeader (const MessageStartChars &pchMessageStartIn) | |
CMessageHeader (const MessageStartChars &pchMessageStartIn, const char *pszCommand, unsigned int nMessageSizeIn) | |
std::string | GetCommand () const |
bool | IsValid (const MessageStartChars &messageStart) const |
template<typename Stream , typename Operation > | |
void | SerializationOp (Stream &s, Operation ser_action) |
Public Attributes | |
ADD_SERIALIZE_METHODS | |
char | pchMessageStart [MESSAGE_START_SIZE] |
char | pchCommand [COMMAND_SIZE] |
uint32_t | nMessageSize |
uint8_t | pchChecksum [CHECKSUM_SIZE] |
Static Public Attributes | |
static constexpr size_t | MESSAGE_START_SIZE = 4 |
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 = MESSAGE_START_SIZE + COMMAND_SIZE |
static constexpr size_t | CHECKSUM_OFFSET = MESSAGE_SIZE_OFFSET + MESSAGE_SIZE_SIZE |
static constexpr size_t | HEADER_SIZE = MESSAGE_START_SIZE + COMMAND_SIZE + MESSAGE_SIZE_SIZE + CHECKSUM_SIZE |
Detailed Description
Message header.
(4) message start. (12) command. (4) size. (4) checksum.
Definition at line 28 of file protocol.h.
Member Typedef Documentation
◆ MessageStartChars
typedef unsigned char CMessageHeader::MessageStartChars[MESSAGE_START_SIZE] |
Definition at line 38 of file protocol.h.
Constructor & Destructor Documentation
◆ CMessageHeader() [1/2]
|
explicit |
Definition at line 148 of file protocol.cpp.
References CHECKSUM_SIZE, memcpy(), MESSAGE_START_SIZE, nMessageSize, pchChecksum, pchCommand, and pchMessageStart.
◆ CMessageHeader() [2/2]
CMessageHeader::CMessageHeader | ( | const MessageStartChars & | pchMessageStartIn, |
const char * | pszCommand, | ||
unsigned int | nMessageSizeIn | ||
) |
Definition at line 156 of file protocol.cpp.
References CHECKSUM_SIZE, COMMAND_SIZE, memcpy(), MESSAGE_START_SIZE, nMessageSize, pchChecksum, pchCommand, and pchMessageStart.
Member Function Documentation
◆ GetCommand()
std::string CMessageHeader::GetCommand | ( | ) | const |
Definition at line 165 of file protocol.cpp.
References COMMAND_SIZE, pchCommand, and strnlen().
Referenced by IsValid(), and PeerLogicValidation::ProcessMessages().
◆ IsValid()
bool CMessageHeader::IsValid | ( | const MessageStartChars & | messageStart | ) | const |
Definition at line 170 of file protocol.cpp.
References COMMAND_SIZE, GetCommand(), LogPrintf, MAX_SIZE, MESSAGE_START_SIZE, nMessageSize, pchCommand, and pchMessageStart.
Referenced by PeerLogicValidation::ProcessMessages().
◆ SerializationOp()
|
inline |
Definition at line 49 of file protocol.h.
References FLATDATA, nMessageSize, pchChecksum, pchCommand, pchMessageStart, and READWRITE.
Member Data Documentation
◆ ADD_SERIALIZE_METHODS
CMessageHeader::ADD_SERIALIZE_METHODS |
Definition at line 46 of file protocol.h.
◆ CHECKSUM_OFFSET
|
static |
Definition at line 36 of file protocol.h.
◆ CHECKSUM_SIZE
|
static |
Definition at line 34 of file protocol.h.
Referenced by CMessageHeader(), PeerLogicValidation::ProcessMessages(), and CConnman::PushMessage().
◆ COMMAND_SIZE
|
static |
Definition at line 32 of file protocol.h.
Referenced by CMessageHeader(), GetCommand(), IsValid(), and ProcessMessage().
◆ HEADER_SIZE
|
static |
Definition at line 37 of file protocol.h.
Referenced by PeerLogicValidation::ProcessMessages(), CConnman::PushMessage(), CNode::ReceiveMsgBytes(), and CConnman::SocketRecvData().
◆ MESSAGE_SIZE_OFFSET
|
static |
Definition at line 35 of file protocol.h.
◆ MESSAGE_SIZE_SIZE
|
static |
Definition at line 33 of file protocol.h.
◆ MESSAGE_START_SIZE
|
static |
Definition at line 31 of file protocol.h.
Referenced by CMessageHeader(), IsValid(), LoadExternalBlockFile(), and PeerLogicValidation::ProcessMessages().
◆ nMessageSize
uint32_t CMessageHeader::nMessageSize |
Definition at line 59 of file protocol.h.
Referenced by CMessageHeader(), CNetMessage::complete(), IsValid(), PeerLogicValidation::ProcessMessages(), CNetMessage::readData(), CNetMessage::readHeader(), CNode::ReceiveMsgBytes(), and SerializationOp().
◆ pchChecksum
uint8_t CMessageHeader::pchChecksum[CHECKSUM_SIZE] |
Definition at line 60 of file protocol.h.
Referenced by CMessageHeader(), PeerLogicValidation::ProcessMessages(), and SerializationOp().
◆ pchCommand
char CMessageHeader::pchCommand[COMMAND_SIZE] |
Definition at line 58 of file protocol.h.
Referenced by CMessageHeader(), GetCommand(), IsValid(), CNode::ReceiveMsgBytes(), and SerializationOp().
◆ pchMessageStart
char CMessageHeader::pchMessageStart[MESSAGE_START_SIZE] |
Definition at line 57 of file protocol.h.
Referenced by CMessageHeader(), IsValid(), and SerializationOp().
The documentation for this class was generated from the following files:
- src/protocol.h
- src/protocol.cpp