{-# OPTIONS_HADDOCK hide #-}
module Network.DNS.Decode.Internal (
decodeDNSHeader
, decodeDNSFlags
, decodeDomain
, decodeMailbox
, decodeResourceRecordAt
, decodeResourceRecord
) where
import Network.DNS.Decode.Parsers
import Network.DNS.Imports
import Network.DNS.StateBinary
import Network.DNS.Types.Internal
decodeDNSFlags :: ByteString -> Either DNSError DNSFlags
decodeDNSFlags :: ByteString -> Either DNSError DNSFlags
decodeDNSFlags ByteString
bs = forall a b. (a, b) -> a
fst forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. SGet a -> ByteString -> Either DNSError (a, PState)
runSGet SGet DNSFlags
getDNSFlags ByteString
bs
decodeDNSHeader :: ByteString -> Either DNSError DNSHeader
ByteString
bs = forall a b. (a, b) -> a
fst forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. SGet a -> ByteString -> Either DNSError (a, PState)
runSGet SGet DNSHeader
getHeader ByteString
bs
decodeDomain :: ByteString -> Either DNSError Domain
decodeDomain :: ByteString -> Either DNSError ByteString
decodeDomain ByteString
bs = forall a b. (a, b) -> a
fst forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. SGet a -> ByteString -> Either DNSError (a, PState)
runSGet SGet ByteString
getDomain ByteString
bs
decodeMailbox :: ByteString -> Either DNSError Mailbox
decodeMailbox :: ByteString -> Either DNSError ByteString
decodeMailbox ByteString
bs = forall a b. (a, b) -> a
fst forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. SGet a -> ByteString -> Either DNSError (a, PState)
runSGet SGet ByteString
getMailbox ByteString
bs
decodeResourceRecord :: ByteString -> Either DNSError ResourceRecord
decodeResourceRecord :: ByteString -> Either DNSError ResourceRecord
decodeResourceRecord ByteString
bs = forall a b. (a, b) -> a
fst forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. SGet a -> ByteString -> Either DNSError (a, PState)
runSGet SGet ResourceRecord
getResourceRecord ByteString
bs
decodeResourceRecordAt :: Int64
-> ByteString
-> Either DNSError ResourceRecord
decodeResourceRecordAt :: Int64 -> ByteString -> Either DNSError ResourceRecord
decodeResourceRecordAt Int64
t ByteString
bs = forall a b. (a, b) -> a
fst forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a.
Int64 -> SGet a -> ByteString -> Either DNSError (a, PState)
runSGetAt Int64
t SGet ResourceRecord
getResourceRecord ByteString
bs