diff options
author | Giel van Schijndel <me@mortis.eu> | 2011-08-11 18:49:03 +0200 |
---|---|---|
committer | Giel van Schijndel <me@mortis.eu> | 2011-08-19 07:24:38 +0200 |
commit | e4dde849ae5544383703ef2d73592677e6c528ad (patch) | |
tree | 5b50a12a27206ddd5c949d1aaed41382a912f5e8 /src/protocol.h | |
parent | 33e28c9948336784324cf5c7248ce608b93dbfde (diff) |
Move CInv to protocol.[ch]pp
This commit does *not* and should not modify *any* code, it only moves
it from net.h and splits it across protocol.cpp and protocol.hpp.
Signed-off-by: Giel van Schijndel <me@mortis.eu>
Diffstat (limited to 'src/protocol.h')
-rw-r--r-- | src/protocol.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/protocol.h b/src/protocol.h index 009f67dfa1..53d3eef4d5 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -12,6 +12,7 @@ #include "serialize.h" #include <string> +#include "uint256.h" extern bool fTestNet; static inline unsigned short GetDefaultPort(const bool testnet = fTestNet) @@ -120,4 +121,30 @@ class CAddress unsigned int nLastTry; }; +class CInv +{ + public: + CInv(); + CInv(int typeIn, const uint256& hashIn); + CInv(const std::string& strType, const uint256& hashIn); + + IMPLEMENT_SERIALIZE + ( + READWRITE(type); + READWRITE(hash); + ) + + friend bool operator<(const CInv& a, const CInv& b); + + bool IsKnownType() const; + const char* GetCommand() const; + std::string ToString() const; + void print() const; + + // TODO: make private (improves encapsulation) + public: + int type; + uint256 hash; +}; + #endif // __INCLUDED_PROTOCOL_H__ |