We should include netinet/in.h to use sockaddr_in (POSIX.1-2001)
[novacoin.git] / src / protocol.h
index 009f67d..c8723fa 100644 (file)
 #ifndef __INCLUDED_PROTOCOL_H__
 #define __INCLUDED_PROTOCOL_H__
 
+#ifndef WIN32
+#include <netinet/in.h>
+#endif
+
 #include "serialize.h"
 #include <string>
+#include "uint256.h"
 
 extern bool fTestNet;
 static inline unsigned short GetDefaultPort(const bool testnet = fTestNet)
@@ -120,4 +125,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__