ouroboros-network-framework-0.1.0.1
Safe Haskell None
Language Haskell2010

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 #

sconcat :: NonEmpty ( Versions vNum vData r) -> Versions vNum vData r Source #

stimes :: Integral b => b -> Versions vNum vData r -> Versions vNum vData r Source #

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