Module libp2p_swarm::protocols_handler[][src]

Once a connection to a remote peer is established, a ProtocolsHandler negotiates and handles one or more specific protocols on the connection.

Protocols are negotiated and used on individual substreams of the connection. Thus a ProtocolsHandler defines the inbound and outbound upgrades to apply when creating a new inbound or outbound substream, respectively, and is notified by a Swarm when these upgrades have been successfully applied, including the final output of the upgrade. A ProtocolsHandler can then continue communicating with the peer over the substream using the negotiated protocol(s).

Two ProtocolsHandlers can be composed with ProtocolsHandler::select() in order to build a new handler supporting the combined set of protocols, with methods being dispatched to the appropriate handler according to the used protocol(s) determined by the associated types of the handlers.

Note: A ProtocolsHandler handles one or more protocols in the context of a single connection with a remote. In order to handle a protocol that requires knowledge of the network as a whole, see the NetworkBehaviour trait.

Modules

multi

A ProtocolsHandler implementation that combines multiple other ProtocolsHandlers indexed by some key.

Structs

DummyProtocolsHandler

Implementation of ProtocolsHandler that doesn't handle anything.

IntoProtocolsHandlerSelect

Implementation of IntoProtocolsHandler that combines two protocols into one.

MapInEvent

Wrapper around a protocol handler that turns the input event into something else.

MapOutEvent

Wrapper around a protocol handler that turns the output event into something else.

NodeHandlerWrapper

Wraps around an implementation of ProtocolsHandler, and implements NodeHandler.

NodeHandlerWrapperBuilder

Prototype for a NodeHandlerWrapper.

OneShotHandler

A ProtocolsHandler that opens a new substream for each request.

OneShotHandlerConfig

Configuration parameters for the OneShotHandler

ProtocolsHandlerSelect

Implementation of ProtocolsHandler that combines two protocols into one.

SubstreamProtocol

Configuration of inbound or outbound substream protocol(s) for a ProtocolsHandler.

Enums

KeepAlive

How long the connection should be kept alive.

NodeHandlerWrapperError

Error generated by the NodeHandlerWrapper.

ProtocolsHandlerEvent

Event produced by a handler.

ProtocolsHandlerUpgrErr

Error that can happen on an outbound substream opening attempt.

Traits

InboundUpgradeSend

Implemented automatically on all types that implement InboundUpgrade and Send + 'static.

IntoProtocolsHandler

Prototype for a ProtocolsHandler.

OutboundUpgradeSend

Implemented automatically on all types that implement OutboundUpgrade and Send + 'static.

ProtocolsHandler

A handler for a set of protocols used on a connection with a remote.

UpgradeInfoSend

Implemented automatically on all types that implement UpgradeInfo and Send + 'static.