Expand description
Contains implementation of a Session message protocol.
The implementation in this crate follows
the HOPR RFC-0007.
§What is Session protocol?
Session protocol is a simple protocol for unreliable networks that implements
basic TCP-like features, such as segmentation, retransmission and acknowledgement.
The goal of this protocol is to establish a read-write session between two parties, where one is a message sender and the other one is the receiver. The messages are called frames which are split and are delivered as segments from the sender to the recipient. The session has some reliability guarantees given by the retransmission and acknowledgement capabilities of individual segments.
The UnreliableSocket acts as an unreliable Session protocol socket, taking care only of
segmentation, reassembly and sequencing.
The ReliableSocket has (in addition to segmentation, reassembly and sequencing) an
internal state that allows acknowledging frames, retransmit unacknowledged frames and/or
requesting of missing frame segments. It therefore offers data some delivery guarantees
up to the pre-defined frame expiration time.
The above sockets can be constructed on top of any transport that implements
[futures::io::AsyncRead] and [futures::io::AsyncWrite],
also using the extension methods.
§Overview of the crate
- Protocol messages are defined in the
protocolsubmodule. - Socket-like Session interface is defined in
socketsubmodule. - Frames and segments are defined in the
framesmodule. - Segmentation, reassembly and sequencing are defined in the
processingsubmodule.
Modules§
- errors
- Contains errors thrown from this module.
Structs§
- Acknowledgement
State - Represents a Session socket state is able to process acknowledgements.
- Acknowledgement
State Config - Configuration object of the
AcknowledgementState. - Frame
Acknowledgements - Holds the Frame Acknowledgement message.
This carries an ordered set of up to
FrameAcknowledgements::MAX_ACK_FRAMESframe IDs that has been acknowledged by the counterparty. - Frame
Inspector - Allows inspecting incomplete frame buffer inside the Reassembler.
- Noop
Tracker - Session socket statistics tracker that does nothing.
- Segment
- Represents a frame segment.
- Segment
Id - Convenience type that identifies a segment within a frame.
- Segment
Request - Holds the Segment Retransmission Request message.
- SeqIndicator
- Carries segment flags and the length of the segment sequence.
- Session
Socket - Socket-like object implementing the Session protocol that can operate on any transport that
implements [
futures::io::AsyncRead] and [futures::io::AsyncWrite]. - Session
Socket Config - Configuration object for
SessionSocket. - Socket
Components - Components the [
SessionSocket] exposes to aSocketState. - Stateless
- Represents a stateless Session socket.
Enums§
- Acknowledgement
Mode - Indicates the acknowledgement mode of a stateful Session socket.
- Session
Message Discriminants - Auto-generated discriminant enum variants
Traits§
- Session
Socket Ext - Adaptors for [
futures::io::AsyncRead] + [futures::io::AsyncWrite] transport to use Session protocol. - Session
Telemetry Tracker - Used to track various statistics of a
SessionSocket. - Socket
State - Abstraction of the
SessionSocketstate.
Functions§
- session_
socket_ mtu - Computes the Session Socket MTU, given the MTU
Cof the underlying socket.
Type Aliases§
- FrameId
- ID of a [Frame].
- Reliable
Socket - Represents a socket with reliable delivery.
- Unreliable
Socket - Represents a stateless (and therefore unreliable) socket.