aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2019-08-07 15:56:24 +0200
committerCarl Dong <contact@carldong.me>2020-01-22 14:55:24 -0500
commit16d6113f4faa901e248adb693d4768a9e5019a16 (patch)
tree881ce4f3f41bd30d163915f0c184aa58bf0ec23e /src/net.h
parent04f78b818f02279d32c3ad3a1140e9410bfb26bf (diff)
Refactor message transport packaging
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/net.h b/src/net.h
index 2e7f29a8d7..14ab090685 100644
--- a/src/net.h
+++ b/src/net.h
@@ -699,12 +699,27 @@ public:
CNetMessage GetMessage(const CMessageHeader::MessageStartChars& message_start, int64_t time) override;
};
+/** The TransportSerializer prepares messages for the network transport
+ */
+class TransportSerializer {
+public:
+ // prepare message for transport (header construction, error-correction computation, payload encryption, etc.)
+ virtual void prepareForTransport(CSerializedNetMsg& msg, std::vector<unsigned char>& header) = 0;
+ virtual ~TransportSerializer() {}
+};
+
+class V1TransportSerializer : public TransportSerializer {
+public:
+ void prepareForTransport(CSerializedNetMsg& msg, std::vector<unsigned char>& header) override;
+};
+
/** Information about a peer */
class CNode
{
friend class CConnman;
public:
std::unique_ptr<TransportDeserializer> m_deserializer;
+ std::unique_ptr<TransportSerializer> m_serializer;
// socket
std::atomic<ServiceFlags> nServices{NODE_NONE};