ouroboros-network-framework-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.Handshake

Description

API for running Handshake protocol.

Synopsis

Documentation

runHandshakeClient ∷ (MonadAsync m, MonadFork m, MonadMonotonicTime m, MonadTimer m, MonadMask m, MonadThrow (STM m), Ord vNumber) ⇒ MuxBearer m → connectionId → HandshakeArguments connectionId vNumber vData m → Versions vNumber vData application → m (Either (HandshakeException vNumber) (application, vNumber, vData)) Source #

Run client side of the Handshake protocol

runHandshakeServer ∷ (MonadAsync m, MonadFork m, MonadMonotonicTime m, MonadTimer m, MonadMask m, MonadThrow (STM m), Ord vNumber) ⇒ MuxBearer m → connectionId → HandshakeArguments connectionId vNumber vData m → Versions vNumber vData application → m (Either (HandshakeException vNumber) (application, vNumber, vData)) Source #

Run server side of the Handshake protocol.

data HandshakeArguments connectionId vNumber vData m Source #

Common arguments for both Handshake client & server.

Constructors

HandshakeArguments 

Fields

newtype Versions vNum vData r Source #

The version map supported by the local agent keyed on the version identifier.

Each Version contains a function which takes negotiated version data and returns negotiated application (the r type variable).

If one needs to combine multiple versions the simplest way is to use one of the combinators: foldMapVersions, combineVersions or the Semigroup instance directly:

fold $ (simpleSingletonVersions ...)
      :| [ (simpleSingletonVersions ...)
         , (simpleSingletonVersions ...)
         , ...
         ]

Constructors

Versions 

Fields

Instances

Instances details
Functor (Versions vNum extra) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Version

Methods

fmap ∷ (a → b) → Versions vNum extra a → Versions vNum extra b Source #

(<$) ∷ a → Versions vNum extra b → Versions vNum extra a Source #

Ord vNum ⇒ Semigroup (Versions vNum vData r) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Version

Methods

(<>)Versions vNum vData r → Versions vNum vData r → Versions vNum vData r Source #

sconcatNonEmpty (Versions vNum vData r) → Versions vNum vData r Source #

stimesIntegral b ⇒ b → Versions vNum vData r → Versions vNum vData r Source #

data HandshakeException vNumber Source #

Wrapper around initiator and responder errors experienced by tryHandshake.

Instances

Instances details
Show vNumber ⇒ Show (HandshakeException vNumber) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake

data HandshakeProtocolError vNumber Source #

Extends handshake error RefuseReason type, by client specific errors.

data RefuseReason vNumber Source #

Reasons by which a server can refuse proposed version.

Constructors

VersionMismatch [vNumber] [Int]

All of the prosed versions where not known to the server. Since the server sends all versions that it can knows about, some of them we might not be able to decode, so we include raw tags [Int].

HandshakeDecodeError vNumber Text

The server failed to decode version parameters.

Refused vNumber Text

The server refused to run the proposed version parameters

Instances

Instances details
Eq vNumber ⇒ Eq (RefuseReason vNumber) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

(==)RefuseReason vNumber → RefuseReason vNumber → Bool Source #

(/=)RefuseReason vNumber → RefuseReason vNumber → Bool Source #

Show vNumber ⇒ Show (RefuseReason vNumber) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

showsPrecIntRefuseReason vNumber → ShowS Source #

showRefuseReason vNumber → String Source #

showList ∷ [RefuseReason vNumber] → ShowS Source #

(Typeable vNumber, Show vNumber) ⇒ Exception (RefuseReason vNumber) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

data Accept vData Source #

A Maybe like type which better explains its purpose.

Constructors

Accept vData 
Refuse !Text 

Instances

Instances details
Eq vData ⇒ Eq (Accept vData) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Version

Methods

(==)Accept vData → Accept vData → Bool Source #

(/=)Accept vData → Accept vData → Bool Source #

Show vData ⇒ Show (Accept vData) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Version

Methods

showsPrecIntAccept vData → ShowS Source #

showAccept vData → String Source #

showList ∷ [Accept vData] → ShowS Source #