[#V2Transport] = V2Transport :mrdocs: Transport implementation for the encrypted BIP324 (v2) P2P protocol, with automatic fallback to v1 when the peer does not speak v2. == Synopsis Declared in `<net.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class V2Transport final : public xref:Transport.adoc[Transport] ---- == Base Classes [cols="1,4"] |=== | Name| Description | `xref:Transport.adoc[Transport]` | The Transport converts one connection's sent messages to wire bytes, and received bytes back. |=== == 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:V2Transport/2constructor-07.adoc[`V2Transport`] [.small]#[constructor]# | Constructors | xref:V2Transport/GetBytesToSend.adoc[`GetBytesToSend`] [.small]#[virtual]# | Return the bytes currently pending to be sent on the wire. | xref:V2Transport/GetInfo.adoc[`GetInfo`] [.small]#[virtual]# | Return the transport info, including the BIP324 session id. | xref:V2Transport/GetReceivedMessage.adoc[`GetReceivedMessage`] [.small]#[virtual]# | Retrieve a completed received message, stamping it with the given time. | xref:V2Transport/GetSendMemoryUsage.adoc[`GetSendMemoryUsage`] [.small]#[virtual]# | Return the memory used by buffered send data. | xref:V2Transport/MarkBytesSent.adoc[`MarkBytesSent`] [.small]#[virtual]# | Report how many pending bytes were actually sent. | xref:V2Transport/ReceivedBytes.adoc[`ReceivedBytes`] [.small]#[virtual]# | Feed received wire bytes to the transport, consuming them from the front. | xref:V2Transport/ReceivedMessageComplete.adoc[`ReceivedMessageComplete`] [.small]#[virtual]# | Return whether a full message has been received and can be retrieved. | xref:V2Transport/SetMessageToSend.adoc[`SetMessageToSend`] [.small]#[virtual]# | Set the next message to send, returning whether it was accepted. | xref:V2Transport/ShouldReconnectV1.adoc[`ShouldReconnectV1`] [.small]#[virtual]# | Whether a v1 reconnect is warranted after this v2 connection failed. |=== == Static Data Members [cols="1,4"] |=== | Name| Description | xref:V2Transport/MAX_GARBAGE_LEN.adoc[`MAX_GARBAGE_LEN`] | Maximum length of the garbage bytes sent before the garbage terminator. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#