cardano-diffusion
Safe HaskellNone
LanguageHaskell2010

Cardano.Network.NodeToNode

Description

This is the starting point for a module that will bring together the overall node to node protocol, as a collection of mini-protocols.

Synopsis

Documentation

nodeToNodeProtocols Source #

Arguments

:: forall (muxMode :: Mode) initiatorCtx responderCtx bytes (m :: Type -> Type) a b. MiniProtocolParameters 
-> NodeToNodeProtocols muxMode initiatorCtx responderCtx bytes m a b 
-> NodeToNodeVersion

negotiated version number

-> NodeToNodeVersionData

negotiated version data

-> OuroborosBundle muxMode initiatorCtx responderCtx bytes m a b 

Make an OuroborosApplication for the bundle of mini-protocols that make up the overall node-to-node protocol.

This function specifies the wire format protocol numbers.

The application specific protocol numbers start from 2. The MiniProtocolNum 0 is reserved for the Handshake protocol, while MiniProtocolNum 1 is reserved for DeltaQ messages. Handshake protocol is not included in NodeToNodeProtocols as it runs before mux is started but it reusing MuxBearer to send and receive messages. Only when the handshake protocol succeeds, we will know which protocols to run / multiplex.

These are chosen to not overlap with the node to client protocol numbers (and the handshake protocol number). This is not essential for correctness, but is helpful to allow a single shared implementation of tools that can analyse both protocols, e.g. wireshark plugins.

data NodeToNodeProtocols (appType :: Mode) initiatorCtx responderCtx bytes (m :: Type -> Type) a b Source #

Constructors

NodeToNodeProtocols 

Fields

  • chainSyncProtocol :: RunMiniProtocol appType initiatorCtx responderCtx bytes m a b

    chain-sync mini-protocol

  • blockFetchProtocol :: RunMiniProtocol appType initiatorCtx responderCtx bytes m a b

    block-fetch mini-protocol

  • txSubmissionProtocol :: RunMiniProtocol appType initiatorCtx responderCtx bytes m a b

    tx-submission mini-protocol

  • keepAliveProtocol :: RunMiniProtocol appType initiatorCtx responderCtx bytes m a b

    keep-alive mini-protocol

  • peerSharingProtocol :: RunMiniProtocol appType initiatorCtx responderCtx bytes m a b

    peer sharing mini-protocol

type NodeToNodeProtocolsWithExpandedCtx (appType :: Mode) ntnAddr bytes (m :: Type -> Type) a b = NodeToNodeProtocols appType (ExpandedInitiatorContext ntnAddr m) (ResponderContext ntnAddr) bytes m a b Source #

type NodeToNodeProtocolsWithMinimalCtx (appType :: Mode) ntnAddr bytes (m :: Type -> Type) a b = NodeToNodeProtocols appType (MinimalInitiatorContext ntnAddr) (ResponderContext ntnAddr) bytes m a b Source #

data MiniProtocolParameters Source #

Constructors

MiniProtocolParameters 

Fields

data NodeToNodeVersion #

Instances

Instances details
NFData NodeToNodeVersion 
Instance details

Defined in Cardano.Network.NodeToNode.Version

Methods

rnf :: NodeToNodeVersion -> () #

Bounded NodeToNodeVersion 
Instance details

Defined in Cardano.Network.NodeToNode.Version

Enum NodeToNodeVersion 
Instance details

Defined in Cardano.Network.NodeToNode.Version

Generic NodeToNodeVersion 
Instance details

Defined in Cardano.Network.NodeToNode.Version

Associated Types

type Rep NodeToNodeVersion 
Instance details

Defined in Cardano.Network.NodeToNode.Version

type Rep NodeToNodeVersion = D1 ('MetaData "NodeToNodeVersion" "Cardano.Network.NodeToNode.Version" "cardano-diffusion-0.1.0.0-inplace-api" 'False) (C1 ('MetaCons "NodeToNodeV_14" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NodeToNodeV_15" 'PrefixI 'False) (U1 :: Type -> Type))
Show NodeToNodeVersion 
Instance details

Defined in Cardano.Network.NodeToNode.Version

Eq NodeToNodeVersion 
Instance details

Defined in Cardano.Network.NodeToNode.Version

Ord NodeToNodeVersion 
Instance details

Defined in Cardano.Network.NodeToNode.Version

NoThunks NodeToNodeVersion 
Instance details

Defined in Cardano.Network.NodeToNode.Version

type Rep NodeToNodeVersion 
Instance details

Defined in Cardano.Network.NodeToNode.Version

type Rep NodeToNodeVersion = D1 ('MetaData "NodeToNodeVersion" "Cardano.Network.NodeToNode.Version" "cardano-diffusion-0.1.0.0-inplace-api" 'False) (C1 ('MetaCons "NodeToNodeV_14" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NodeToNodeV_15" 'PrefixI 'False) (U1 :: Type -> Type))

ntnDataFlow :: NodeToNodeVersionData -> DataFlow Source #

Node-To-Node protocol connections which negotiated InitiatorAndResponderDiffusionMode are Duplex.

P2P Governor

data PeerAdvertise #

Instances

Instances details
FromJSON PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

ToJSON PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

Generic PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

Associated Types

type Rep PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

type Rep PeerAdvertise = D1 ('MetaData "PeerAdvertise" "Ouroboros.Network.PeerSelection.PeerAdvertise" "ouroboros-network-0.23.0.0-inplace-api" 'False) (C1 ('MetaCons "DoNotAdvertisePeer" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DoAdvertisePeer" 'PrefixI 'False) (U1 :: Type -> Type))
Show PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

Eq PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

Ord PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

type Rep PeerAdvertise 
Instance details

Defined in Ouroboros.Network.PeerSelection.PeerAdvertise

type Rep PeerAdvertise = D1 ('MetaData "PeerAdvertise" "Ouroboros.Network.PeerSelection.PeerAdvertise" "ouroboros-network-0.23.0.0-inplace-api" 'False) (C1 ('MetaCons "DoNotAdvertisePeer" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DoAdvertisePeer" 'PrefixI 'False) (U1 :: Type -> Type))

data PeerSelectionTargets #

Adjustable targets for the peer selection mechanism.

These are used by the peer selection governor as targets. They are used by the peer churn governor loop as knobs to adjust, to influence the peer selection governor.

The known, established and active peer targets are targets both from below and from above: the governor will attempt to grow or shrink the sets to hit these targets.

Unlike the other targets, the root peer target is "one sided", it is only a target from below. The governor does not try to shrink the root set to hit it, it simply stops looking for more.

There is also an implicit target that enough local root peers are selected as active. This comes from the configuration for local roots, and is not an independently adjustable target.

Constructors

PeerSelectionTargets 

Fields

Subscription Workers

Versions

newtype Versions vNum vData r #

Constructors

Versions 

Fields

Instances

Instances details
Functor (Versions vNum extra) 
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) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Version

Methods

(<>) :: Versions vNum vData r -> Versions vNum vData r -> Versions vNum vData r #

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

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

simpleSingletonVersions :: vNum -> vData -> (vData -> r) -> Versions vNum vData r #

foldMapVersions :: (Ord vNum, Foldable f, HasCallStack) => (x -> Versions vNum extra r) -> f x -> Versions vNum extra r #

combineVersions :: (Ord vNum, Foldable f, HasCallStack) => f (Versions vNum extra r) -> Versions vNum extra r #

Codecs

Re-exports

newtype ResponderContext addr #

Constructors

ResponderContext 

Instances

Instances details
Functor ResponderContext 
Instance details

Defined in Ouroboros.Network.Context

Methods

fmap :: (a -> b) -> ResponderContext a -> ResponderContext b #

(<$) :: a -> ResponderContext b -> ResponderContext a #

data ConnectionId addr #

Constructors

ConnectionId 

Fields

Instances

Instances details
Functor ConnectionId 
Instance details

Defined in Ouroboros.Network.ConnectionId

Methods

fmap :: (a -> b) -> ConnectionId a -> ConnectionId b #

(<$) :: a -> ConnectionId b -> ConnectionId a #

ShowProxy addr => ShowProxy (ConnectionId addr :: Type) 
Instance details

Defined in Ouroboros.Network.ConnectionId

Methods

showProxy :: Proxy (ConnectionId addr) -> String

Generic (ConnectionId addr) 
Instance details

Defined in Ouroboros.Network.ConnectionId

Associated Types

type Rep (ConnectionId addr) 
Instance details

Defined in Ouroboros.Network.ConnectionId

type Rep (ConnectionId addr) = D1 ('MetaData "ConnectionId" "Ouroboros.Network.ConnectionId" "ouroboros-network-0.23.0.0-inplace-framework" 'False) (C1 ('MetaCons "ConnectionId" 'PrefixI 'True) (S1 ('MetaSel ('Just "localAddress") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 addr) :*: S1 ('MetaSel ('Just "remoteAddress") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 addr)))

Methods

from :: ConnectionId addr -> Rep (ConnectionId addr) x #

to :: Rep (ConnectionId addr) x -> ConnectionId addr #

Show addr => Show (ConnectionId addr) 
Instance details

Defined in Ouroboros.Network.ConnectionId

Methods

showsPrec :: Int -> ConnectionId addr -> ShowS #

show :: ConnectionId addr -> String #

showList :: [ConnectionId addr] -> ShowS #

Eq addr => Eq (ConnectionId addr) 
Instance details

Defined in Ouroboros.Network.ConnectionId

Methods

(==) :: ConnectionId addr -> ConnectionId addr -> Bool #

(/=) :: ConnectionId addr -> ConnectionId addr -> Bool #

Ord addr => Ord (ConnectionId addr) 
Instance details

Defined in Ouroboros.Network.ConnectionId

Methods

compare :: ConnectionId addr -> ConnectionId addr -> Ordering #

(<) :: ConnectionId addr -> ConnectionId addr -> Bool #

(<=) :: ConnectionId addr -> ConnectionId addr -> Bool #

(>) :: ConnectionId addr -> ConnectionId addr -> Bool #

(>=) :: ConnectionId addr -> ConnectionId addr -> Bool #

max :: ConnectionId addr -> ConnectionId addr -> ConnectionId addr #

min :: ConnectionId addr -> ConnectionId addr -> ConnectionId addr #

Hashable a => Hashable (ConnectionId a) 
Instance details

Defined in Ouroboros.Network.ConnectionId

Typeable addr => NoThunks (ConnectionId addr) 
Instance details

Defined in Ouroboros.Network.ConnectionId

type Rep (ConnectionId addr) 
Instance details

Defined in Ouroboros.Network.ConnectionId

type Rep (ConnectionId addr) = D1 ('MetaData "ConnectionId" "Ouroboros.Network.ConnectionId" "ouroboros-network-0.23.0.0-inplace-framework" 'False) (C1 ('MetaCons "ConnectionId" 'PrefixI 'True) (S1 ('MetaSel ('Just "localAddress") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 addr) :*: S1 ('MetaSel ('Just "remoteAddress") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 addr)))

newtype NumTxIdsToAck #

Constructors

NumTxIdsToAck 

Instances

Instances details
NFData NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Methods

rnf :: NumTxIdsToAck -> () #

Monoid NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Semigroup NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Bounded NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Enum NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Generic NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Associated Types

type Rep NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

type Rep NumTxIdsToAck = D1 ('MetaData "NumTxIdsToAck" "Ouroboros.Network.Protocol.TxSubmission2.Type" "ouroboros-network-0.23.0.0-inplace-protocols" 'True) (C1 ('MetaCons "NumTxIdsToAck" 'PrefixI 'True) (S1 ('MetaSel ('Just "getNumTxIdsToAck") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16)))
Num NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Integral NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Real NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Show NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Eq NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Ord NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

NoThunks NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

type Rep NumTxIdsToAck 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

type Rep NumTxIdsToAck = D1 ('MetaData "NumTxIdsToAck" "Ouroboros.Network.Protocol.TxSubmission2.Type" "ouroboros-network-0.23.0.0-inplace-protocols" 'True) (C1 ('MetaCons "NumTxIdsToAck" 'PrefixI 'True) (S1 ('MetaSel ('Just "getNumTxIdsToAck") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16)))

data Handshake (vNumber :: k) (vParams :: k1) #

Instances

Instances details
ShowProxy (Handshake vNumber vParams :: Type) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

showProxy :: Proxy (Handshake vNumber vParams) -> String

(NFData vNumber, NFData vParams) => NFData (Message (Handshake vNumber vParams) from to) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

rnf :: Message (Handshake vNumber vParams) from to -> () #

(Show vNumber, Show vParams) => Show (Message (Handshake vNumber vParams) from to) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

showsPrec :: Int -> Message (Handshake vNumber vParams) from to -> ShowS #

show :: Message (Handshake vNumber vParams) from to -> String #

showList :: [Message (Handshake vNumber vParams) from to] -> ShowS #

Protocol (Handshake vNumber vParams) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Associated Types

type StateToken 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

type StateToken = SingHandshake :: Handshake vNumber vParams -> Type
StateTokenI ('StConfirm :: Handshake vNumber vParams) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

stateToken :: StateToken ('StConfirm :: Handshake vNumber vParams) #

StateTokenI ('StDone :: Handshake vNumber vParams) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

stateToken :: StateToken ('StDone :: Handshake vNumber vParams) #

StateTokenI ('StPropose :: Handshake vNumber vParams) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

Methods

stateToken :: StateToken ('StPropose :: Handshake vNumber vParams) #

data Message (Handshake vNumber vParams) (from :: Handshake vNumber vParams) (to :: Handshake vNumber vParams) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

data Message (Handshake vNumber vParams) (from :: Handshake vNumber vParams) (to :: Handshake vNumber vParams) where
type StateToken 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

type StateToken = SingHandshake :: Handshake vNumber vParams -> Type
type StateAgency ('StConfirm :: Handshake vNumber vParams) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

type StateAgency ('StConfirm :: Handshake vNumber vParams) = 'ServerAgency
type StateAgency ('StDone :: Handshake vNumber vParams) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

type StateAgency ('StDone :: Handshake vNumber vParams) = 'NobodyAgency
type StateAgency ('StPropose :: Handshake vNumber vParams) 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Type

type StateAgency ('StPropose :: Handshake vNumber vParams) = 'ClientAgency

data Socket #

Basic type for a socket.

Instances

Instances details
Show Socket 
Instance details

Defined in Network.Socket.Types

Eq Socket 
Instance details

Defined in Network.Socket.Types

Methods

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

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

Exceptions

Traces

data TraceSendRecv ps where #

Constructors

TraceSendMsg :: forall ps. AnyMessage ps -> TraceSendRecv ps 
TraceRecvMsg :: forall ps. AnyMessage ps -> TraceSendRecv ps 

Instances

Instances details
Show (AnyMessage ps) => Show (TraceSendRecv ps) 
Instance details

Defined in Ouroboros.Network.Driver.Simple

For Consensus ThreadNet Tests