ouroboros-network-framework-0.13.2.0: Ouroboros network framework
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Network.Protocol.Handshake

Description

API for running Handshake protocol.

Synopsis

Documentation

runHandshakeClient ∷ (MonadAsync m, MonadFork 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) (HandshakeResult application vNumber vData)) Source #

Run client side of the Handshake protocol

runHandshakeServer ∷ (MonadAsync m, MonadFork 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) (HandshakeResult 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 #

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

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 #

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

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

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

Methods

showsPrecIntHandshakeException vNumber → ShowS #

showHandshakeException vNumber → String #

showList ∷ [HandshakeException vNumber] → ShowS #

data HandshakeProtocolError vNumber Source #

Extends handshake error RefuseReason type, by client specific errors.

Instances

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

Defined in Ouroboros.Network.Protocol.Handshake.Type

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

Defined in Ouroboros.Network.Protocol.Handshake.Type

Eq vNumber ⇒ Eq (HandshakeProtocolError vNumber) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

(==)HandshakeProtocolError vNumber → HandshakeProtocolError vNumber → Bool #

(/=)HandshakeProtocolError vNumber → HandshakeProtocolError vNumber → Bool #

data HandshakeResult r vNumber vData Source #

The result of a handshake.

Constructors

HandshakeNegotiationResult r vNumber vData 
HandshakeQueryResult (Map vNumber (Either Text vData)) 

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
(Typeable vNumber, Show vNumber) ⇒ Exception (RefuseReason vNumber) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Generic (RefuseReason vNumber) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Associated Types

type Rep (RefuseReason vNumber) ∷ TypeType #

Methods

fromRefuseReason vNumber → Rep (RefuseReason vNumber) x #

toRep (RefuseReason vNumber) x → RefuseReason vNumber #

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

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

showsPrecIntRefuseReason vNumber → ShowS #

showRefuseReason vNumber → String #

showList ∷ [RefuseReason vNumber] → ShowS #

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

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

rnfRefuseReason vNumber → () #

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

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

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

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

type Rep (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
Show vData ⇒ Show (Accept vData) 
Instance details

Defined in Ouroboros.Network.Handshake.Acceptable

Methods

showsPrecIntAccept vData → ShowS #

showAccept vData → String #

showList ∷ [Accept vData] → ShowS #

Eq vData ⇒ Eq (Accept vData) 
Instance details

Defined in Ouroboros.Network.Handshake.Acceptable

Methods

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

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

handshake_QUERY_SHUTDOWN_DELAYDiffTime Source #

A 20s delay after query result was send back, before we close the connection. After that delay we close the connection.