12 # include <arpa/inet.h> 19 const char *
INV=
"inv";
47 const static std::string allNetMessageTypes[] = {
75 const static std::vector<std::string> allNetMessageTypesVec(allNetMessageTypes, allNetMessageTypes+
ARRAYLEN(allNetMessageTypes));
79 memcpy(pchMessageStart, pchMessageStartIn, MESSAGE_START_SIZE);
80 memset(pchCommand, 0,
sizeof(pchCommand));
82 memset(pchChecksum, 0, CHECKSUM_SIZE);
87 memcpy(pchMessageStart, pchMessageStartIn, MESSAGE_START_SIZE);
88 memset(pchCommand, 0,
sizeof(pchCommand));
89 strncpy(pchCommand, pszCommand, COMMAND_SIZE);
90 nMessageSize = nMessageSizeIn;
91 memset(pchChecksum, 0, CHECKSUM_SIZE);
96 return std::string(pchCommand, pchCommand +
strnlen(pchCommand, COMMAND_SIZE));
102 if (memcmp(pchMessageStart, pchMessageStartIn, MESSAGE_START_SIZE) != 0)
106 for (
const char* p1 = pchCommand; p1 < pchCommand + COMMAND_SIZE; p1++)
111 for (; p1 < pchCommand + COMMAND_SIZE; p1++)
115 else if (*p1 < ' ' || *p1 > 0x7E)
120 if (nMessageSize > MAX_SIZE)
122 LogPrintf(
"CMessageHeader::IsValid(): (%s, %u bytes) nMessageSize > MAX_SIZE\n", GetCommand(), nMessageSize);
165 cmd.append(
"witness-");
174 throw std::out_of_range(
strprintf(
"CInv::GetCommand(): type=%d unknown type",
type));
182 }
catch(
const std::out_of_range &) {
189 return allNetMessageTypesVec;
const char * PING
The ping message is sent periodically to help confirm that the receiving peer is still connected...
const char * FILTERLOAD
The filterload message tells the receiving peer to filter all relayed transactions and requested merk...
const char * MERKLEBLOCK
The merkleblock message is a reply to a getdata message which requested a block using the inventory t...
const char * BLOCKTXN
Contains a BlockTransactions.
ServiceFlags
nServices flags
const char * GETADDR
The getaddr message requests an addr message from the receiving node, preferably one with lots of IP ...
const char * SENDCMPCT
Contains a 1-byte bool and 8-byte LE version number.
const uint32_t MSG_WITNESS_FLAG
getdata message type flags
const uint32_t MSG_TYPE_MASK
const char * PONG
The pong message replies to a ping message, proving to the pinging node that the ponging node is stil...
const char * HEADERS
The headers message sends one or more block headers to a node which previously requested certain head...
const char * INV
The inv message (inventory message) transmits one or more inventories of objects known to the transmi...
std::string ToString() const
const char * GETHEADERS
The getheaders message requests a headers message that provides block headers starting from a particu...
Fabcoin protocol message types.
A combination of a network address (CNetAddr) and a (TCP) port.
const char * SENDHEADERS
Indicates that a node prefers to receive new block announcements via a "headers" message rather than ...
const char * MEMPOOL
The mempool message requests the TXIDs of transactions that the receiving node has verified as valid ...
const std::vector< std::string > & getAllNetMessageTypes()
const char * ADDR
The addr (IP address) message relays connection information for peers on the network.
const char * FILTERCLEAR
The filterclear message tells the receiving peer to remove a previously-set bloom filter...
const char * NOTFOUND
The notfound message is a reply to a getdata message which requested an object the receiving node doe...
const char * BLOCK
The block message transmits a single serialized block.
const char * FEEFILTER
The feefilter message tells the receiving peer not to inv us any txs which do not meet the specified ...
const char * REJECT
The reject message informs the receiving node that one of its previous messages has been rejected...
const char * GETBLOCKS
The getblocks message requests an inv message that provides block header hashes starting from a parti...
const char * VERACK
The verack message acknowledges a previously-received version message, informing the connecting node ...
const char * CMPCTBLOCK
Contains a CBlockHeaderAndShortTxIDs object - providing a header and list of "short txids"...
PlatformStyle::TableColorType type
const char * VERSION
The version message provides information about the transmitting node to the receiving node at the beg...
void * memcpy(void *a, const void *b, size_t c)
size_t strnlen(const char *start, size_t max_len)
const char * GETDATA
The getdata message requests one or more data objects from another node.
const char * TX
The tx message transmits a single transaction.
std::string ToString() const
std::string GetCommand() const
friend bool operator<(const CInv &a, const CInv &b)
const char * FILTERADD
The filteradd message tells the receiving peer to add a single element to a previously-set bloom filt...
const char * GETBLOCKTXN
Contains a BlockTransactionsRequest Peer should respond with "blocktxn" message.