diff options
author | Jonas Schnelli <dev@jonasschnelli.ch> | 2019-08-07 15:56:24 +0200 |
---|---|---|
committer | Carl Dong <contact@carldong.me> | 2020-01-22 14:55:24 -0500 |
commit | 16d6113f4faa901e248adb693d4768a9e5019a16 (patch) | |
tree | 881ce4f3f41bd30d163915f0c184aa58bf0ec23e /src/net.h | |
parent | 04f78b818f02279d32c3ad3a1140e9410bfb26bf (diff) |
Refactor message transport packaging
Diffstat (limited to 'src/net.h')
-rw-r--r-- | src/net.h | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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}; |