ouroboros-network-framework
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.Handshake.Codec

Synopsis

Documentation

codecHandshake :: forall vNumber (m :: Type -> Type) failure. (MonadST m, Ord vNumber, Show failure) => CodecCBORTerm (failure, Maybe Int) vNumber -> Codec (Handshake vNumber Term) DeserialiseFailure m ByteString Source #

Handshake codec. The MsgProposeVersions encodes proposed map in ascending order and it expects to receive them in this order. This allows to construct the map in linear time. There is also another limiting factor to the number of versions on can present: the whole message must fit into a single TCP segment.

byteLimitsHandshake :: forall {k} (vNumber :: k). ProtocolSizeLimits (Handshake vNumber Term) ByteString Source #

Byte limits

timeLimitsHandshake :: forall {k} (vNumber :: k). ProtocolTimeLimits (Handshake vNumber Term) Source #

Time limits.

noTimeLimitsHandshake :: forall {k} (vNumber :: k). ProtocolTimeLimits (Handshake vNumber Term) Source #

decodeRefuseReason :: Show failure => CodecCBORTerm (failure, Maybe Int) vNumber -> Decoder s (RefuseReason vNumber) Source #

Version data codec

data VersionDataCodec bytes vNumber vData Source #

Codec for version data (vData in code) exchanged by the handshake protocol.

Note: extra type param is instantiated to DictVersion; agreedOptions is instantiated to NodeToNodeVersionData in Ouroboros.Network.NodeToNode or to () in Ouroboros.Network.NodeToClient.

Constructors

VersionDataCodec 

Fields

  • encodeData :: vNumber -> vData -> bytes

    encoder of vData which has access to 'extra vData' which can bring extra instances into the scope (by means of pattern matching on a GADT).

  • decodeData :: vNumber -> bytes -> Either Text vData

    decoder of vData.

NodeToNode & NodeToClient Codecs

nodeToNodeHandshakeCodec :: forall (m :: Type -> Type). MonadST m => Codec (Handshake NodeToNodeVersion Term) DeserialiseFailure m ByteString Source #

Handshake codec for the node-to-node protocol suite.

nodeToClientHandshakeCodec :: forall (m :: Type -> Type). MonadST m => Codec (Handshake NodeToClientVersion Term) DeserialiseFailure m ByteString Source #

Handshake codec for the node-to-client protocol suite.