Expand description
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
ProtocolsHandlerhandles 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 theNetworkBehaviourtrait.
Modules§
- multi
- A
ProtocolsHandlerimplementation that combines multiple otherProtocolsHandlers indexed by some key.
Structs§
- Dummy
Protocols Handler - Implementation of
ProtocolsHandlerthat doesn’t handle anything. - Into
Protocols Handler Select - Implementation of
IntoProtocolsHandlerthat combines two protocols into one. - MapIn
Event - Wrapper around a protocol handler that turns the input event into something else.
- MapOut
Event - Wrapper around a protocol handler that turns the output event into something else.
- Node
Handler Wrapper - Wraps around an implementation of
ProtocolsHandler, and implementsNodeHandler. - Node
Handler Wrapper Builder - Prototype for a
NodeHandlerWrapper. - OneShot
Handler - A
ProtocolsHandlerthat opens a new substream for each request. - OneShot
Handler Config - Configuration parameters for the
OneShotHandler - Protocols
Handler Select - Implementation of
ProtocolsHandlerthat combines two protocols into one. - Substream
Protocol - Configuration of inbound or outbound substream protocol(s)
for a
ProtocolsHandler.
Enums§
- Keep
Alive - How long the connection should be kept alive.
- Node
Handler Wrapper Error - Error generated by the
NodeHandlerWrapper. - Protocols
Handler Event - Event produced by a handler.
- Protocols
Handler Upgr Err - Error that can happen on an outbound substream opening attempt.
Traits§
- Inbound
Upgrade Send - Implemented automatically on all types that implement
InboundUpgradeandSend + 'static. - Into
Protocols Handler - Prototype for a
ProtocolsHandler. - Outbound
Upgrade Send - Implemented automatically on all types that implement
OutboundUpgradeandSend + 'static. - Protocols
Handler - A handler for a set of protocols used on a connection with a remote.
- Upgrade
Info Send - Implemented automatically on all types that implement
UpgradeInfoandSend + 'static.