libp2p-hs-0.1.0.0: Haskell implementation of the libp2p networking stack
Safe HaskellNone
LanguageGHC2021

Network.LibP2P.Mux.Yamux.Types

Description

Shared types for Yamux session management.

Types follow the HashiCorp yamux spec.md and docs/06-multiplexing.md. SessionRole determines stream ID parity, StreamState tracks the stream lifecycle state machine, and YamuxSession/YamuxStream hold per-session/per-stream mutable state via STM.

Synopsis

Documentation

data SessionRole Source #

SessionRole determines stream ID parity (spec.md §Stream Identification). Client uses odd IDs (1, 3, 5, ...), Server uses even IDs (2, 4, 6, ...).

Constructors

RoleClient 
RoleServer 

Instances

Instances details
Show SessionRole Source # 
Instance details

Defined in Network.LibP2P.Mux.Yamux.Types

Eq SessionRole Source # 
Instance details

Defined in Network.LibP2P.Mux.Yamux.Types

data StreamState Source #

Stream state machine (spec.md §Stream OpenCloseReset). States map to the spec's lifecycle: SYN sentreceived -> Established -> FIN sentreceived -> Closed

Constructors

StreamSYNSent

SYN sent, awaiting ACK (initiator)

StreamSYNReceived

SYN received, awaiting local ACK (responder)

StreamEstablished

Both SYN/ACK exchanged, data flows

StreamLocalClose

Local FIN sent (half-closed)

StreamRemoteClose

Remote FIN received (half-closed)

StreamClosed

Both FIN'd

StreamReset

RST sent or received

Instances

Instances details
Show StreamState Source # 
Instance details

Defined in Network.LibP2P.Mux.Yamux.Types

Eq StreamState Source # 
Instance details

Defined in Network.LibP2P.Mux.Yamux.Types

data YamuxError Source #

Errors map to spec-defined conditions.

Constructors

YamuxProtocolError !String

Spec violation (e.g., invalid version, unknown frame type)

YamuxStreamClosed

Write/read on closed stream

YamuxStreamReset

RST received

YamuxSessionShutdown

GoAway received or session closed

YamuxGoAway !GoAwayCode

Remote sent GoAway with specific code

Instances

Instances details
Show YamuxError Source # 
Instance details

Defined in Network.LibP2P.Mux.Yamux.Types

Eq YamuxError Source # 
Instance details

Defined in Network.LibP2P.Mux.Yamux.Types

data YamuxStream Source #

Per-stream state (spec.md §Flow Control: per-stream windows only).

Constructors

YamuxStream 

Fields

data YamuxSession Source #

Session state.

Constructors

YamuxSession 

Fields