Safe Haskell | None |
---|---|
Language | Haskell2010 |
UDP Messages
Synopsis
- data Message = Message {}
- magicValue :: Word8
- data MessageBody
- = MessageBodyKeepAlive !KeepAliveMessage
- | MessageBodyPublish !SignedBlock
- | MessageBodyConfirmReq !ConfirmReqMessage
- | MessageBodyConfirmAck !ConfirmAckMessage
- | MessageBodyBulkPull !BulkPullMessage
- | MessageBodyBulkPush !BulkPushMessage
- | MessageBodyFrontierReq !FrontierReqMessage
- | MessageBodyBulkPullBlocks
- | MessageBodyNodeIdHandshake !NodeIdHandshakeMessage
- | MessageBodyBulkPullAccount !BulkPullAccountMessage
- getMessageBody :: MessageType -> Extensions -> Get MessageBody
- putMessageBody :: MessageBody -> (MessageType, Extensions, Put ())
- data NetworkId
- networkIdMap :: Map Word8 NetworkId
- networkIdValue :: NetworkId -> Word8
- data MessageType
- messageTypeMap :: Map Word8 MessageType
- messageTypeValue :: MessageType -> Word8
- newtype Extensions = Extensions Word16
- noExtensions :: Extensions
- blockTypeFromExtensions :: Extensions -> Get BlockType
- extensionsFromBlockType :: BlockType -> Extensions
- blockTypeMap :: Map Word8 BlockType
- newtype KeepAliveMessage = KeepAliveMessage {}
- keepAliveMessagePeers :: KeepAliveMessage -> [Peer]
- mkKeepAliveMessage :: [Peer] -> Either String KeepAliveMessage
- maxKeepAliveMessagePeers :: Int
- newtype Peer = Peer {}
- mkPeer :: HostAddress6 -> PortNumber -> Either String Peer
- mkPeerFromRaw :: RawPeer -> Either String Peer
- peerHost :: Peer -> HostAddress6
- peerPort :: Peer -> PortNumber
- data RawPeer = RawPeer {}
- nullRawPeer :: RawPeer
- putHostAddress6 :: HostAddress6 -> Put ()
- data ConfirmReqMessage
- getConfirmReq :: BlockType -> Get ConfirmReqMessage
- putConfirmReq :: ConfirmReqMessage -> (BlockType, Put ())
- newtype BlockHashPairs = BlockHashPairs {
- unBlockHashPairs :: [(BlockHash, BlockHash)]
- data ConfirmAckMessage = ConfirmAckMessage {}
- getConfirmAck :: BlockType -> Get ConfirmAckMessage
- putConfirmAck :: ConfirmAckMessage -> (BlockType, Put ())
- data ConfirmAckVoteBy
- putConfirmAckVoteBy :: ConfirmAckVoteBy -> (BlockType, Put ())
- newtype VoteByHashes = VoteByHashes {
- unVoteByHashes :: [BlockHash]
- mkVoteByHashes :: [BlockHash] -> Either String VoteByHashes
- maxVoteByHashes :: Int
- data BulkPullMessage = BulkPullMessage {}
- getBulkPull :: Bool -> Get BulkPullMessage
- putBulkPull :: BulkPullMessage -> (Bool, Put ())
- newtype BulkPushMessage = BulkPushMessage {}
- data FrontierReqMessage = FrontierReqMessage {}
- data NodeIdHandshakeMessage = NodeIdHandshakeMessage {}
- getNodeIdHandshake :: Bool -> Bool -> Get NodeIdHandshakeMessage
- putNodeIdHandshake :: NodeIdHandshakeMessage -> (Bool, Bool, Put ())
- newtype Cookie = Cookie {}
- cookieToByteString :: Cookie -> ByteString
- generateRandomCookie :: MonadRandom m => m Cookie
- data NodeIdHandshakeResponse = NodeIdHandshakeResponse {}
- data BulkPullAccountMessage = BulkPullAccountMessage {}
- data BulkPullAccountFlags
- bulkPullAccountFlagsMap :: Map Word8 BulkPullAccountFlags
- bulkPullAccountFlagsValue :: BulkPullAccountFlags -> Word8
- getWhileJust :: Get (Maybe a) -> Get [a]
- getMaxN :: Persist a => Int -> Get [a]
Documentation
Message | |
|
Instances
magicValue :: Word8 #
data MessageBody #
Message body whose content depends on block type in the header.
MessageBodyKeepAlive !KeepAliveMessage | A list of 8 peers, some of which may be all-zero. |
MessageBodyPublish !SignedBlock | Publish the given block |
MessageBodyConfirmReq !ConfirmReqMessage | Requests confirmation of the given block or list of root/hash pairs |
MessageBodyConfirmAck !ConfirmAckMessage | Signed confirmation of a block or a list of block hashes |
MessageBodyBulkPull !BulkPullMessage | Bulk pull request. |
MessageBodyBulkPush !BulkPushMessage | A bulk push is equivalent to an unsolicited bulk pull response. If a node knows about an account a peer doesn't, the node sends its local blocks for that account to the peer. The stream of blocks ends with a sentinel block of type enum_blocktype::not_a_block. |
MessageBodyFrontierReq !FrontierReqMessage | Request frontiers (account chain head blocks) from a remote node |
MessageBodyBulkPullBlocks | Deprecated. The server will respond with a single enum_blocktype::not_a_block byte. |
MessageBodyNodeIdHandshake !NodeIdHandshakeMessage | A node ID handshake request and/or response. |
MessageBodyBulkPullAccount !BulkPullAccountMessage | Bulk pull account request |
Instances
getMessageBody :: MessageType -> Extensions -> Get MessageBody #
putMessageBody :: MessageBody -> (MessageType, Extensions, Put ()) #
Network ID A
, B
or C
for test, beta or live network respectively
NetworkIdTest | Network ID |
NetworkIdBeta | Network ID |
NetworkIdLive | Network ID |
Instances
networkIdValue :: NetworkId -> Word8 #
data MessageType #
Instances
messageTypeValue :: MessageType -> Word8 #
newtype Extensions #
Instances
blockTypeFromExtensions :: Extensions -> Get BlockType #
newtype KeepAliveMessage #
A list of 8 peers, some of which may be all-zero.
KeepAliveMessage | |
|
Instances
keepAliveMessagePeers :: KeepAliveMessage -> [Peer] #
Access peers in keepalive message.
mkKeepAliveMessage :: [Peer] -> Either String KeepAliveMessage #
Construct a valid KeepAliveMessage
(or return Left
if invalid).
A peer entry in the keepalive message
Instances
Eq Peer # | |
Ord Peer # | |
Show Peer # | |
Generic Peer # | |
Display Peer # | |
Defined in Gini.Core.Protocol.Types.Message.Internal display :: Peer -> Utf8Builder textDisplay :: Peer -> Text | |
Validity Peer # | |
Defined in Gini.Core.Protocol.Types.Message.Internal | |
Persist Peer # | |
Defined in Gini.Core.Protocol.Types.Message.Internal | |
PersistField Peer # | |
Defined in Gini.Core.Protocol.Types.Message.Internal toPersistValue :: Peer -> PersistValue fromPersistValue :: PersistValue -> Either Text Peer | |
PersistFieldSql Peer # | |
Defined in Gini.Core.Protocol.Types.Message.Internal | |
type Rep Peer # | |
Defined in Gini.Core.Protocol.Types.Message.Internal |
mkPeer :: HostAddress6 -> PortNumber -> Either String Peer #
Make a valid peer. The host and port must be non-zero.
peerHost :: Peer -> HostAddress6 #
ipv6 address, or ipv6-mapped ipv4 address.
peerPort :: Peer -> PortNumber #
An unvalidated peer entry in the keepalive message
RawPeer | |
|
Instances
Eq RawPeer # | |
Ord RawPeer # | |
Defined in Gini.Core.Protocol.Types.Message.Internal | |
Show RawPeer # | |
Generic RawPeer # | |
Display RawPeer # | |
Defined in Gini.Core.Protocol.Types.Message.Internal display :: RawPeer -> Utf8Builder textDisplay :: RawPeer -> Text | |
Validity RawPeer # | |
Defined in Gini.Core.Protocol.Types.Message.Internal | |
Persist RawPeer # | |
Defined in Gini.Core.Protocol.Types.Message.Internal | |
type Rep RawPeer # | |
Defined in Gini.Core.Protocol.Types.Message.Internal type Rep RawPeer = D1 (MetaData "RawPeer" "Gini.Core.Protocol.Types.Message.Internal" "gini-core-0.1.0.0-CYC9q60CJ5rDf5hHcbgY0V" False) (C1 (MetaCons "RawPeer" PrefixI True) (S1 (MetaSel (Just "rawPeerHost") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 HostAddress6) :*: S1 (MetaSel (Just "rawPeerPort") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 PortNumber))) |
nullRawPeer :: RawPeer #
putHostAddress6 :: HostAddress6 -> Put () #
data ConfirmReqMessage #
Requests confirmation of the given block or list of root/hash pairs
ConfirmReqMessageByHash !BlockHashPairs | If _root.header.block_type == enum_blocktype::not_a_block |
ConfirmReqMessageBlock !SignedBlock | If _root.header.block_type != enum_blocktype::not_a_block |
Instances
getConfirmReq :: BlockType -> Get ConfirmReqMessage #
putConfirmReq :: ConfirmReqMessage -> (BlockType, Put ()) #
newtype BlockHashPairs #
A sequence of hash,root pairs
BlockHashPairs | |
|
Instances
data ConfirmAckMessage #
Signed confirmation of a block or a list of block hashes
Instances
getConfirmAck :: BlockType -> Get ConfirmAckMessage #
putConfirmAck :: ConfirmAckMessage -> (BlockType, Put ()) #
data ConfirmAckVoteBy #
ConfirmAckVoteByHashes !VoteByHashes | If _root.header.block_type == enum_blocktype::not_a_block |
ConfirmAckVoteByBlock !SignedBlock | If _root.header.block_type != enum_blocktype::not_a_block |
Instances
putConfirmAckVoteBy :: ConfirmAckVoteBy -> (BlockType, Put ()) #
newtype VoteByHashes #
A sequence of up to 12 hashes, terminated by EOF.
Instances
mkVoteByHashes :: [BlockHash] -> Either String VoteByHashes #
Construct a valid VoteByHashes
(or return Left
if invalid)
maxVoteByHashes :: Int #
data BulkPullMessage #
Bulk pull request
BulkPullMessage | |
|
Instances
getBulkPull :: Bool -> Get BulkPullMessage #
putBulkPull :: BulkPullMessage -> (Bool, Put ()) #
newtype BulkPushMessage #
A bulk push is equivalent to an unsolicited bulk pull response.
| If a node knows about an account a peer doesn't, the node sends
| its local blocks for that account to the peer. The stream of
| blocks ends with a sentinel block of type BlockTypeNotABlock
.
Instances
data FrontierReqMessage #
Request frontiers (account chain head blocks) from a remote node
Instances
data NodeIdHandshakeMessage #
A node ID handshake request and/or response.
Instances
getNodeIdHandshake :: Bool -> Bool -> Get NodeIdHandshakeMessage #
putNodeIdHandshake :: NodeIdHandshakeMessage -> (Bool, Bool, Put ()) #
Per-endpoint random number
Instances
cookieToByteString :: Cookie -> ByteString #
Extract bytestring from cookie
generateRandomCookie :: MonadRandom m => m Cookie #
Generate a cryptographically random cookie value
data NodeIdHandshakeResponse #
A node ID handshake response
NodeIdHandshakeResponse | |
|
Instances
data BulkPullAccountMessage #
Bulk pull account request
Instances
data BulkPullAccountFlags #
Flags for pulp pull account request
BulkPullAccountFlagsPendingHashAndAmount | 0x00 |
BulkPullAccountFlagsPendingAddressOnly | 0x01 |
BulkPullAccountFlagsPendingHashAmountAndAddress | 0x02 |
Instances
getWhileJust :: Get (Maybe a) -> Get [a] #
Get elements until the provided monad returns Nothing
or EOF