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

Network.LibP2P.Mux.Yamux.Frame

Description

Yamux frame header encoding/decoding.

Every Yamux frame has a fixed 12-byte header: Version (1) | Type (1) | Flags (2 BE) | StreamID (4 BE) | Length (4 BE)

Synopsis

Documentation

data FrameType Source #

Yamux frame types.

Constructors

FrameData

0x00: Data frame with payload

FrameWindowUpdate

0x01: Window size increment

FramePing

0x02: Keepalive/latency measurement

FrameGoAway

0x03: Session termination

Instances

Instances details
Show FrameType Source # 
Instance details

Defined in Network.LibP2P.Mux.Yamux.Frame

Eq FrameType Source # 
Instance details

Defined in Network.LibP2P.Mux.Yamux.Frame

data Flags Source #

Frame flags (bitmask).

Constructors

Flags 

Fields

Instances

Instances details
Show Flags Source # 
Instance details

Defined in Network.LibP2P.Mux.Yamux.Frame

Methods

showsPrec :: Int -> Flags -> ShowS #

show :: Flags -> String #

showList :: [Flags] -> ShowS #

Eq Flags Source # 
Instance details

Defined in Network.LibP2P.Mux.Yamux.Frame

Methods

(==) :: Flags -> Flags -> Bool #

(/=) :: Flags -> Flags -> Bool #

data YamuxHeader Source #

Complete Yamux frame header (12 bytes).

Constructors

YamuxHeader 

Instances

Instances details
Show YamuxHeader Source # 
Instance details

Defined in Network.LibP2P.Mux.Yamux.Frame

Eq YamuxHeader Source # 
Instance details

Defined in Network.LibP2P.Mux.Yamux.Frame

data GoAwayCode Source #

Go Away error codes.

Constructors

GoAwayNormal

0x00: Normal termination

GoAwayProtocol

0x01: Protocol error

GoAwayInternal

0x02: Internal error

Instances

Instances details
Show GoAwayCode Source # 
Instance details

Defined in Network.LibP2P.Mux.Yamux.Frame

Eq GoAwayCode Source # 
Instance details

Defined in Network.LibP2P.Mux.Yamux.Frame

encodeHeader :: YamuxHeader -> ByteString Source #

Encode a Yamux header to 12 bytes.

decodeHeader :: ByteString -> Either String YamuxHeader Source #

Decode a Yamux header from 12 bytes.

defaultFlags :: Flags Source #

No flags set.

headerSize :: Int Source #

Yamux header size is always 12 bytes.

initialWindowSize :: Word32 Source #

Default initial window size: 256 KiB (262144 bytes).