network-dns-1.0.0.1: Domain Name System data structures

Safe HaskellNone

Network.DNS

Description

This module provides Domain Name System data structures and (de)serialization routines.

Synopsis

Documentation

hostNameLabels :: HostName -> [ByteString]Source

List the HostName labels:

   hostNameLabels (fromJust (fromString "www.google.com")) = ["www", "google", "com"]

arpaHostName :: IP -> HostNameSource

Host name for reverse DNS lookups.

   toString (arpaHostName (IPv4 (ip4FromOctets 1 2 3 4))) = "4.3.2.1.in-addr.arpa"
   toString (arpaHostName (IPv6 (ip6FromWords 1 2 3 4 5 6 7 8))) = "8.0.0.0.7.0.0.0.6.0.0.0.5.0.0.0.4.0.0.0.3.0.0.0.2.0.0.0.1.0.0.0.ip6.arpa"

data HostAddr a Source

Host address. Either a host name or an IP address.

Constructors

HostName !HostName 
HostAddr !a 

aHostAddrOf :: Proxy a -> Proxy (HostAddr a)Source

HostAddr a proxy value.

type DnsId = Word16Source

Message identifier.

dnsTypeCode :: DnsType α -> Word16Source

Numeric representation of a Resource Record type.

data DnsData Source

Resource Record data.

Constructors

forall α . DnsData 

Fields

dnsType :: !(DnsType α)

The type

dnsData :: α

The data

data DnsRecord Source

Resource Record.

Constructors

DnsRecord 

Fields

dnsRecOwner :: !HostName

Record owner

dnsRecTtl :: !Word32

Maximum caching time in secords

dnsRecData :: !DnsData

Record data

data DnsQType Source

DNS query type.

Constructors

forall α . StdDnsType (DnsType α)

Record type

AllDnsType

All record types

dnsQTypeCode :: DnsQType -> Word16Source

Numeric representation of a DNS query type.

data DnsQuestion Source

DNS question.

Constructors

DnsQuestion 

Fields

dnsQName :: !HostName

Ask about the specified host name

dnsQType :: !DnsQType

Query type

data DnsReq Source

Request message.

Constructors

DnsReq

Standard query

Fields

dnsReqId :: !DnsId

Message identifier

dnsReqTruncd :: !Bool

Truncation flag

dnsReqRec :: !Bool

Recursion flag

dnsReqQuestion :: !DnsQuestion

Question

DnsInvReq

Inverse query

Fields

dnsReqId :: !DnsId

Message identifier

dnsReqInv :: !IP

IP address

data DnsResp Source

Response message.

Constructors

DnsResp

Normal response.

Fields

dnsRespId :: !DnsId

Request identifer

dnsRespTruncd :: !Bool

Truncation flag

dnsRespAuthd :: !Bool

Authoritative answer flag

dnsRespRec :: !Bool

Recursive query support flag

dnsRespQuestion :: !DnsQuestion

Request question

dnsRespAnswers :: [DnsRecord]

Answer records

dnsRespAuths :: [DnsRecord]

Authority records

dnsRespExtras :: [DnsRecord]

Additional records

DnsErrResp

Error response.

Fields

dnsRespId :: !DnsId

Request identifer

dnsRespError :: !DnsError

Error