| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Gini.Core.Protocol.Types.Message.Internal
Description
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
Constructors
| Message | |
Fields
| |
Instances
magicValue :: Word8 #
data MessageBody #
Message body whose content depends on block type in the header.
Constructors
| 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
Constructors
| NetworkIdTest | Network ID |
| NetworkIdBeta | Network ID |
| NetworkIdLive | Network ID |
Instances
networkIdValue :: NetworkId -> Word8 #
data MessageType #
Constructors
Instances
messageTypeValue :: MessageType -> Word8 #
newtype Extensions #
Constructors
| Extensions Word16 |
Instances
| Eq Extensions # | |
Defined in Gini.Core.Protocol.Types.Message.Internal | |
| Show Extensions # | |
Defined in Gini.Core.Protocol.Types.Message.Internal Methods showsPrec :: Int -> Extensions -> ShowS # show :: Extensions -> String # showList :: [Extensions] -> ShowS # | |
| Generic Extensions # | |
Defined in Gini.Core.Protocol.Types.Message.Internal Associated Types type Rep Extensions :: * -> * # | |
| Persist Extensions # | |
Defined in Gini.Core.Protocol.Types.Message.Internal | |
| type Rep Extensions # | |
Defined in Gini.Core.Protocol.Types.Message.Internal type Rep Extensions = D1 (MetaData "Extensions" "Gini.Core.Protocol.Types.Message.Internal" "gini-core-0.1.0.0-CYC9q60CJ5rDf5hHcbgY0V" True) (C1 (MetaCons "Extensions" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Word16))) | |
blockTypeFromExtensions :: Extensions -> Get BlockType #
newtype KeepAliveMessage #
A list of 8 peers, some of which may be all-zero.
Constructors
| KeepAliveMessage | |
Fields
| |
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 | |
| 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 | |
| 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
Constructors
| RawPeer | |
Fields
| |
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 | |
| 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
Constructors
| 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
Constructors
| BlockHashPairs | |
Fields
| |
Instances
data ConfirmAckMessage #
Signed confirmation of a block or a list of block hashes
Constructors
| ConfirmAckMessage | |
Instances
getConfirmAck :: BlockType -> Get ConfirmAckMessage #
putConfirmAck :: ConfirmAckMessage -> (BlockType, Put ()) #
data ConfirmAckVoteBy #
Constructors
| 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.
Constructors
| VoteByHashes | |
Fields
| |
Instances
| Eq VoteByHashes # | |
Defined in Gini.Core.Protocol.Types.Message.Internal | |
| Show VoteByHashes # | |
Defined in Gini.Core.Protocol.Types.Message.Internal Methods showsPrec :: Int -> VoteByHashes -> ShowS # show :: VoteByHashes -> String # showList :: [VoteByHashes] -> ShowS # | |
| Generic VoteByHashes # | |
Defined in Gini.Core.Protocol.Types.Message.Internal Associated Types type Rep VoteByHashes :: * -> * # | |
| Validity VoteByHashes # | |
Defined in Gini.Core.Protocol.Types.Message.Internal Methods validate :: VoteByHashes -> Validation | |
| Persist VoteByHashes # | |
Defined in Gini.Core.Protocol.Types.Message.Internal | |
| type Rep VoteByHashes # | |
Defined in Gini.Core.Protocol.Types.Message.Internal type Rep VoteByHashes = D1 (MetaData "VoteByHashes" "Gini.Core.Protocol.Types.Message.Internal" "gini-core-0.1.0.0-CYC9q60CJ5rDf5hHcbgY0V" True) (C1 (MetaCons "VoteByHashes" PrefixI True) (S1 (MetaSel (Just "unVoteByHashes") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [BlockHash]))) | |
mkVoteByHashes :: [BlockHash] -> Either String VoteByHashes #
Construct a valid VoteByHashes (or return Left if invalid)
maxVoteByHashes :: Int #
data BulkPullMessage #
Bulk pull request
Constructors
| BulkPullMessage | |
Fields
| |
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.
Constructors
| BulkPushMessage | |
Fields | |
Instances
data FrontierReqMessage #
Request frontiers (account chain head blocks) from a remote node
Constructors
| FrontierReqMessage | |
Fields | |
Instances
data NodeIdHandshakeMessage #
A node ID handshake request and/or response.
Constructors
| NodeIdHandshakeMessage | |
Instances
getNodeIdHandshake :: Bool -> Bool -> Get NodeIdHandshakeMessage #
putNodeIdHandshake :: NodeIdHandshakeMessage -> (Bool, Bool, Put ()) #
Per-endpoint random number
Constructors
| Cookie | |
Fields | |
Instances
| Eq Cookie # | |
| Show Cookie # | |
| IsString Cookie # | |
Defined in Gini.Core.Protocol.Types.Message.Internal Methods fromString :: String -> Cookie # | |
| Generic Cookie # | |
| Display Cookie # | |
Defined in Gini.Core.Protocol.Types.Message.Internal | |
| Validity Cookie # | |
Defined in Gini.Core.Protocol.Types.Message.Internal | |
| Persist Cookie # | |
Defined in Gini.Core.Protocol.Types.Message.Internal | |
| PersistField Cookie # | |
Defined in Gini.Core.Protocol.Types.Message.Internal Methods toPersistValue :: Cookie -> PersistValue fromPersistValue :: PersistValue -> Either Text Cookie | |
| PersistFieldSql Cookie # | |
Defined in Gini.Core.Protocol.Types.Message.Internal | |
| type Rep Cookie # | |
Defined in Gini.Core.Protocol.Types.Message.Internal type Rep Cookie = D1 (MetaData "Cookie" "Gini.Core.Protocol.Types.Message.Internal" "gini-core-0.1.0.0-CYC9q60CJ5rDf5hHcbgY0V" True) (C1 (MetaCons "Cookie" PrefixI True) (S1 (MetaSel (Just "unCookie") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Raw32ByteValue))) | |
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
Constructors
| NodeIdHandshakeResponse | |
Fields
| |
Instances
data BulkPullAccountMessage #
Bulk pull account request
Constructors
| BulkPullAccountMessage | |
Instances
data BulkPullAccountFlags #
Flags for pulp pull account request
Constructors
| BulkPullAccountFlagsPendingHashAndAmount | 0x00 |
| BulkPullAccountFlagsPendingAddressOnly | 0x01 |
| BulkPullAccountFlagsPendingHashAmountAndAddress | 0x02 |
Instances
getWhileJust :: Get (Maybe a) -> Get [a] #
Get elements until the provided monad returns Nothing or EOF
