[#Transport]
= Transport
:mrdocs:

The Transport converts one connection&apos;s sent messages to wire bytes, and received bytes back&period;

== Synopsis

Declared in `&lt;net&period;h&gt;`

[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&period;
|===


== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:Transport/BytesToSend.adoc[`BytesToSend`] 
| Return type for GetBytesToSend, consisting of&colon; &hyphen; std&colon;&colon;span&lt;const uint8&lowbar;t&gt; to&lowbar;send&colon; span of bytes to be sent over the wire (possibly empty)&period; &hyphen; bool more&colon; whether there will be more bytes to be sent after the ones in to&lowbar;send are all sent (as signaled by MarkBytesSent())&period; &hyphen; const std&colon;&colon;string&amp; m&lowbar;type&colon; message type on behalf of which this is being sent (&quot;&quot; for bytes that are not on behalf of any message)&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:Transport/2destructor.adoc[`&#126;Transport`] [.small]#[destructor]# [.small]#[virtual]#
| Destroy the transport&period;
| xref:Transport/GetBytesToSend.adoc[`GetBytesToSend`]  [.small]#[virtual]#
| Get bytes to send on the wire, if any, along with other information about it&period;
| xref:Transport/GetInfo.adoc[`GetInfo`]  [.small]#[virtual]#
| Retrieve information about this transport&period;
| xref:Transport/GetReceivedMessage.adoc[`GetReceivedMessage`]  [.small]#[virtual]#
| Retrieve a completed message from transport&period;
| xref:Transport/GetSendMemoryUsage.adoc[`GetSendMemoryUsage`]  [.small]#[virtual]#
| Return the memory usage of this transport attributable to buffered data to send&period;
| xref:Transport/MarkBytesSent.adoc[`MarkBytesSent`]  [.small]#[virtual]#
| Report how many bytes returned by the last GetBytesToSend() have been sent&period;
| xref:Transport/ReceivedBytes.adoc[`ReceivedBytes`]  [.small]#[virtual]#
| Feed wire bytes to the transport&period;
| xref:Transport/ReceivedMessageComplete.adoc[`ReceivedMessageComplete`]  [.small]#[virtual]#
| Returns true if the current message is complete (so GetReceivedMessage can be called)&period;
| xref:Transport/SetMessageToSend.adoc[`SetMessageToSend`]  [.small]#[virtual]#
| Set the next message to send&period;
| xref:Transport/ShouldReconnectV1.adoc[`ShouldReconnectV1`]  [.small]#[virtual]#
| Whether upon disconnections, a reconnect with V1 is warranted&period;
|===


== Derived Classes

[cols="1,4"]
|===
| Name| Description
| xref:V1Transport.adoc[`V1Transport`] 
| Transport implementation for the legacy (v1) unencrypted P2P protocol&period;
| 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&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
