diff options
| author | Luke Dashjr <[email protected]> | 2016-02-27 06:11:04 +0000 |
|---|---|---|
| committer | Luke Dashjr <[email protected]> | 2016-02-27 06:11:37 +0000 |
| commit | e5daa2e2aef61f0b9441d19f0b67015f426c6056 (patch) | |
| tree | 90a095dcd23c8a74cb605f55e224a902cba75a06 /src/protocol.cpp | |
| parent | Bugfix: gitian: Add curl to packages (now needed for depends) (diff) | |
| parent | Merge #7583: [doc] Fix typos (diff) | |
| download | discoin-e5daa2e2aef61f0b9441d19f0b67015f426c6056.tar.xz discoin-e5daa2e2aef61f0b9441d19f0b67015f426c6056.zip | |
Merge branch 'master' into depends_curl
Diffstat (limited to 'src/protocol.cpp')
| -rw-r--r-- | src/protocol.cpp | 69 |
1 files changed, 64 insertions, 5 deletions
diff --git a/src/protocol.cpp b/src/protocol.cpp index dd855aa33..c1c7c0b96 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin Core developers +// Copyright (c) 2009-2015 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -12,13 +12,67 @@ # include <arpa/inet.h> #endif +namespace NetMsgType { +const char *VERSION="version"; +const char *VERACK="verack"; +const char *ADDR="addr"; +const char *INV="inv"; +const char *GETDATA="getdata"; +const char *MERKLEBLOCK="merkleblock"; +const char *GETBLOCKS="getblocks"; +const char *GETHEADERS="getheaders"; +const char *TX="tx"; +const char *HEADERS="headers"; +const char *BLOCK="block"; +const char *GETADDR="getaddr"; +const char *MEMPOOL="mempool"; +const char *PING="ping"; +const char *PONG="pong"; +const char *ALERT="alert"; +const char *NOTFOUND="notfound"; +const char *FILTERLOAD="filterload"; +const char *FILTERADD="filteradd"; +const char *FILTERCLEAR="filterclear"; +const char *REJECT="reject"; +const char *SENDHEADERS="sendheaders"; +}; + static const char* ppszTypeName[] = { - "ERROR", - "tx", - "block", - "filtered block" + "ERROR", // Should never occur + NetMsgType::TX, + NetMsgType::BLOCK, + "filtered block" // Should never occur +}; + +/** All known message types. Keep this in the same order as the list of + * messages above and in protocol.h. + */ +const static std::string allNetMessageTypes[] = { + NetMsgType::VERSION, + NetMsgType::VERACK, + NetMsgType::ADDR, + NetMsgType::INV, + NetMsgType::GETDATA, + NetMsgType::MERKLEBLOCK, + NetMsgType::GETBLOCKS, + NetMsgType::GETHEADERS, + NetMsgType::TX, + NetMsgType::HEADERS, + NetMsgType::BLOCK, + NetMsgType::GETADDR, + NetMsgType::MEMPOOL, + NetMsgType::PING, + NetMsgType::PONG, + NetMsgType::ALERT, + NetMsgType::NOTFOUND, + NetMsgType::FILTERLOAD, + NetMsgType::FILTERADD, + NetMsgType::FILTERCLEAR, + NetMsgType::REJECT, + NetMsgType::SENDHEADERS }; +const static std::vector<std::string> allNetMessageTypesVec(allNetMessageTypes, allNetMessageTypes+ARRAYLEN(allNetMessageTypes)); CMessageHeader::CMessageHeader(const MessageStartChars& pchMessageStartIn) { @@ -140,3 +194,8 @@ std::string CInv::ToString() const { return strprintf("%s %s", GetCommand(), hash.ToString()); } + +const std::vector<std::string> &getAllNetMessageTypes() +{ + return allNetMessageTypesVec; +} |