![]() |
Bitcoin ABC 0.32.4
P2P Digital Currency
|
Message header. More...
#include <protocol.h>
Public Types | |
| typedef std::array< uint8_t, MESSAGE_START_SIZE > | MessageMagic |
Public Member Functions | |
| CMessageHeader (const MessageMagic &pchMessageStartIn) | |
| CMessageHeader (const MessageMagic &pchMessageStartIn, const char *msg_type, unsigned int nMessageSizeIn) | |
| Construct a P2P message header from message-start characters, a message type and the size of the message. More... | |
| std::string | GetMessageType () const |
| bool | IsValid (const Config &config) const |
| bool | IsValidWithoutConfig (const MessageMagic &magic) const |
| This is a transition method in order to stay compatible with older code that do not use the config. More... | |
| bool | IsOversized (const Config &config) const |
| SERIALIZE_METHODS (CMessageHeader, obj) | |
Public Attributes | |
| MessageMagic | pchMessageStart |
| std::array< char, MESSAGE_TYPE_SIZE > | m_msg_type |
| uint32_t | nMessageSize |
| uint8_t | pchChecksum [CHECKSUM_SIZE] |
Static Public Attributes | |
| static constexpr size_t | MESSAGE_START_SIZE = 4 |
| static constexpr size_t | MESSAGE_TYPE_SIZE = 12 |
| static constexpr size_t | MESSAGE_SIZE_SIZE = 4 |
| static constexpr size_t | CHECKSUM_SIZE = 4 |
| static constexpr size_t | MESSAGE_SIZE_OFFSET |
| static constexpr size_t | CHECKSUM_OFFSET |
| static constexpr size_t | HEADER_SIZE |
Message header.
(4) message start. (12) message type. (4) size. (4) checksum.
Definition at line 34 of file protocol.h.
| typedef std::array<uint8_t, MESSAGE_START_SIZE> CMessageHeader::MessageMagic |
Definition at line 47 of file protocol.h.
|
explicit |
Definition at line 91 of file protocol.cpp.
| CMessageHeader::CMessageHeader | ( | const MessageMagic & | pchMessageStartIn, |
| const char * | msg_type, | ||
| unsigned int | nMessageSizeIn | ||
| ) |
Construct a P2P message header from message-start characters, a message type and the size of the message.
msg_type longer than MESSAGE_TYPE_SIZE will result in a run-time assertion error. Definition at line 99 of file protocol.cpp.
| std::string CMessageHeader::GetMessageType | ( | ) | const |
Definition at line 120 of file protocol.cpp.
| bool CMessageHeader::IsOversized | ( | const Config & | config | ) | const |
Definition at line 197 of file protocol.cpp.
| bool CMessageHeader::IsValid | ( | const Config & | config | ) | const |
Definition at line 156 of file protocol.cpp.
| bool CMessageHeader::IsValidWithoutConfig | ( | const MessageMagic & | magic | ) | const |
This is a transition method in order to stay compatible with older code that do not use the config.
It assumes message will not get too large. This cannot be used for any piece of code that will download blocks as blocks may be bigger than the permitted size. Idealy, code that uses this function should be migrated toward using the config.
Definition at line 180 of file protocol.cpp.
|
inline |
Definition at line 65 of file protocol.h.
|
staticconstexpr |
Definition at line 42 of file protocol.h.
|
staticconstexpr |
Definition at line 39 of file protocol.h.
|
staticconstexpr |
Definition at line 44 of file protocol.h.
| std::array<char, MESSAGE_TYPE_SIZE> CMessageHeader::m_msg_type |
Definition at line 71 of file protocol.h.
|
staticconstexpr |
Definition at line 40 of file protocol.h.
|
staticconstexpr |
Definition at line 38 of file protocol.h.
|
staticconstexpr |
Definition at line 36 of file protocol.h.
|
staticconstexpr |
Definition at line 37 of file protocol.h.
| uint32_t CMessageHeader::nMessageSize |
Definition at line 72 of file protocol.h.
| uint8_t CMessageHeader::pchChecksum[CHECKSUM_SIZE] |
Definition at line 73 of file protocol.h.
| MessageMagic CMessageHeader::pchMessageStart |
Definition at line 70 of file protocol.h.