\subsubsection{Nodes Request (0x02)}
\begin{tabular}{l|l|l}
Length & Type & \href{#rpc-services}{Contents} \\
\hline
\texttt{32} & Public Key & Requested DHT Public Key \\
\end{tabular}
The DHT Public Key sent in the request is the one the sender is searching for.
\begin{code}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-}
module Network.Tox.DHT.NodesRequest where
import Data.Binary (Binary)
import Data.MessagePack (MessagePack)
import Data.Typeable (Typeable)
import GHC.Generics (Generic)
import Network.Tox.Crypto.Key (PublicKey)
import Test.QuickCheck.Arbitrary (Arbitrary, arbitrary)
newtype NodesRequest = NodesRequest
{ NodesRequest -> PublicKey
requestedKey :: PublicKey
}
deriving (NodesRequest -> NodesRequest -> Bool
(NodesRequest -> NodesRequest -> Bool)
-> (NodesRequest -> NodesRequest -> Bool) -> Eq NodesRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodesRequest -> NodesRequest -> Bool
$c/= :: NodesRequest -> NodesRequest -> Bool
== :: NodesRequest -> NodesRequest -> Bool
$c== :: NodesRequest -> NodesRequest -> Bool
Eq, ReadPrec [NodesRequest]
ReadPrec NodesRequest
Int -> ReadS NodesRequest
ReadS [NodesRequest]
(Int -> ReadS NodesRequest)
-> ReadS [NodesRequest]
-> ReadPrec NodesRequest
-> ReadPrec [NodesRequest]
-> Read NodesRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodesRequest]
$creadListPrec :: ReadPrec [NodesRequest]
readPrec :: ReadPrec NodesRequest
$creadPrec :: ReadPrec NodesRequest
readList :: ReadS [NodesRequest]
$creadList :: ReadS [NodesRequest]
readsPrec :: Int -> ReadS NodesRequest
$creadsPrec :: Int -> ReadS NodesRequest
Read, Int -> NodesRequest -> ShowS
[NodesRequest] -> ShowS
NodesRequest -> String
(Int -> NodesRequest -> ShowS)
-> (NodesRequest -> String)
-> ([NodesRequest] -> ShowS)
-> Show NodesRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodesRequest] -> ShowS
$cshowList :: [NodesRequest] -> ShowS
show :: NodesRequest -> String
$cshow :: NodesRequest -> String
showsPrec :: Int -> NodesRequest -> ShowS
$cshowsPrec :: Int -> NodesRequest -> ShowS
Show, (forall x. NodesRequest -> Rep NodesRequest x)
-> (forall x. Rep NodesRequest x -> NodesRequest)
-> Generic NodesRequest
forall x. Rep NodesRequest x -> NodesRequest
forall x. NodesRequest -> Rep NodesRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodesRequest x -> NodesRequest
$cfrom :: forall x. NodesRequest -> Rep NodesRequest x
Generic, Typeable)
instance Binary NodesRequest
instance MessagePack NodesRequest
instance Arbitrary NodesRequest where
arbitrary :: Gen NodesRequest
arbitrary = PublicKey -> NodesRequest
NodesRequest (PublicKey -> NodesRequest) -> Gen PublicKey -> Gen NodesRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen PublicKey
forall a. Arbitrary a => Gen a
arbitrary
\end{code}