    {-# OPTIONS_HADDOCK hide #-}

    -- | Internal DNS message component encoders for the test-suite.
    module Network.DNS.Encode.Internal (
        encodeDNSHeader
      , encodeDNSFlags
      , encodeDomain
      , encodeMailbox
      , encodeResourceRecord
      ) where

    import Network.DNS.Encode.Builders
    import Network.DNS.Imports
    import Network.DNS.StateBinary
    import Network.DNS.Types.Internal

    -- | Encode DNS flags.
    encodeDNSFlags :: DNSFlags -> ByteString
    encodeDNSFlags :: DNSFlags -> ByteString
    encodeDNSFlags = SPut -> ByteString
    runSPut (SPut -> ByteString)
    -> (DNSFlags -> SPut) -> DNSFlags -> ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . DNSFlags -> SPut
    putDNSFlags

    -- | Encode DNS header.
    encodeDNSHeader :: DNSHeader -> ByteString
    encodeDNSHeader :: DNSHeader -> ByteString
    encodeDNSHeader = SPut -> ByteString
    runSPut (SPut -> ByteString)
    -> (DNSHeader -> SPut) -> DNSHeader -> ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . DNSHeader -> SPut
    putHeader

    -- | Encode a domain.
    encodeDomain :: Domain -> ByteString
    encodeDomain :: ByteString -> ByteString
    encodeDomain = SPut -> ByteString
    runSPut (SPut -> ByteString)
    -> (ByteString -> SPut) -> ByteString -> ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ByteString -> SPut
    putDomain

    -- | Encode a mailbox name.  The first label is separated from the remaining
    -- labels by an @'\@'@ rather than a @.@.  This is used for the contact
    -- address in the @SOA@ and @RP@ records.
    --
    encodeMailbox :: Mailbox -> ByteString
    encodeMailbox :: ByteString -> ByteString
    encodeMailbox = SPut -> ByteString
    runSPut (SPut -> ByteString)
    -> (ByteString -> SPut) -> ByteString -> ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ByteString -> SPut
    putMailbox

    -- | Encode a ResourceRecord.
    encodeResourceRecord :: ResourceRecord -> ByteString
    encodeResourceRecord :: ResourceRecord -> ByteString
    encodeResourceRecord ResourceRecord
    rr = SPut -> ByteString
    runSPut (SPut -> ByteString) -> SPut -> ByteString
    forall a b. (a -> b) -> a -> b
    $ ResourceRecord -> SPut
    putResourceRecord ResourceRecord
    rr