Equity
Bitcoin Protocol Library
Message.h
1 #pragma once
2 
3 #include "p2p/Serialize.h"
4 #include <stdexcept>
5 #include <string>
6 #include <vector>
7 
8 namespace Network
9 {
10 
12 
13 class Message : public P2p::Serializable
14 {
15 public:
16 
17  // Constructor
19  explicit Message(char const * type);
20 
22  std::string type() const { return type_; }
23 
24 private:
25 
26  std::string type_;
27 };
28 
30 struct InvalidMessageError : public std::runtime_error
31 {
32  InvalidMessageError() : std::runtime_error("invalid message data") {}
33 };
34 
35 } // namespace Network
An abstract class that enables an object to be serialized by the serialization functions.
Definition: Serialize.h:27
Message(char const *type)
Definition: Message.cpp:13
std::string type() const
Returns the type.
Definition: Message.h:22
Thrown by a message constructor if the data in the message is invalid.
Definition: Message.h:30
Bitcoin Network Layer.
Definition: Address.h:7
All network message classes are derived from this class.
Definition: Message.h:13