Transport implementation for the legacy (v1) unencrypted P2P protocol.

Synopsis

Declared in <net.h>

class V1Transport final
    : public Transport

Base Classes

Name

Description

Transport

The Transport converts one connection's sent messages to wire bytes, and received bytes back.

Types

Name

Description

Info

Summary information about a transport, exposed for stats.

Type Aliases

Name

Description

BytesToSend

Return type for GetBytesToSend, consisting of: ‐ std::span<const uint8_t> to_send: span of bytes to be sent over the wire (possibly empty). ‐ bool more: whether there will be more bytes to be sent after the ones in to_send are all sent (as signaled by MarkBytesSent()). ‐ const std::string& m_type: message type on behalf of which this is being sent ("" for bytes that are not on behalf of any message).

Member Functions

Name

Description

V1Transport [constructor]

Construct a v1 transport for the given node id (used only for logging).

GetBytesToSend [virtual]

Return the bytes currently pending to be sent on the wire.

GetInfo [virtual]

Return the transport info (protocol type; v1 has no session id).

GetReceivedMessage [virtual]

Retrieve a completed received message, stamping it with the given time.

GetSendMemoryUsage [virtual]

Return the memory used by buffered send data.

MarkBytesSent [virtual]

Report how many pending bytes were actually sent.

ReceivedBytes [virtual]

Feed received wire bytes to the transport, consuming them from the front.

ReceivedMessageComplete [virtual]

Return whether a full message has been received and can be retrieved.

SetMessageToSend [virtual]

Set the next message to send, returning whether it was accepted.

ShouldReconnectV1 [virtual]

Whether a v1 reconnect is warranted; always false for a v1 transport.

Created with MrDocs