[#Transport] = Transport :mrdocs: The Transport converts one connection's sent messages to wire bytes, and received bytes back. == Synopsis Declared in `<net.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class Transport; ---- == Types [cols="1,4"] |=== | Name| Description | xref:Transport/Info.adoc[`Info`] | Summary information about a transport, exposed for stats. |=== == Type Aliases [cols="1,4"] |=== | Name| Description | xref:Transport/BytesToSend.adoc[`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 [cols="1,4"] |=== | Name| Description | xref:Transport/2destructor.adoc[`~Transport`] [.small]#[destructor]# [.small]#[virtual]# | Destroy the transport. | xref:Transport/GetBytesToSend.adoc[`GetBytesToSend`] [.small]#[virtual]# | Get bytes to send on the wire, if any, along with other information about it. | xref:Transport/GetInfo.adoc[`GetInfo`] [.small]#[virtual]# | Retrieve information about this transport. | xref:Transport/GetReceivedMessage.adoc[`GetReceivedMessage`] [.small]#[virtual]# | Retrieve a completed message from transport. | xref:Transport/GetSendMemoryUsage.adoc[`GetSendMemoryUsage`] [.small]#[virtual]# | Return the memory usage of this transport attributable to buffered data to send. | xref:Transport/MarkBytesSent.adoc[`MarkBytesSent`] [.small]#[virtual]# | Report how many bytes returned by the last GetBytesToSend() have been sent. | xref:Transport/ReceivedBytes.adoc[`ReceivedBytes`] [.small]#[virtual]# | Feed wire bytes to the transport. | xref:Transport/ReceivedMessageComplete.adoc[`ReceivedMessageComplete`] [.small]#[virtual]# | Returns true if the current message is complete (so GetReceivedMessage can be called). | xref:Transport/SetMessageToSend.adoc[`SetMessageToSend`] [.small]#[virtual]# | Set the next message to send. | xref:Transport/ShouldReconnectV1.adoc[`ShouldReconnectV1`] [.small]#[virtual]# | Whether upon disconnections, a reconnect with V1 is warranted. |=== == Derived Classes [cols="1,4"] |=== | Name| Description | xref:V1Transport.adoc[`V1Transport`] | Transport implementation for the legacy (v1) unencrypted P2P protocol. | xref:V2Transport.adoc[`V2Transport`] | Transport implementation for the encrypted BIP324 (v2) P2P protocol, with automatic fallback to v1 when the peer does not speak v2. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#