dns-3.0.4: DNS library in Haskell
Safe Haskell None
Language Haskell2010

Network.DNS.Types

Description

Data types for DNS Query and Response. For more information, see http://www.ietf.org/rfc/rfc1035 .

Synopsis

Resource Records

Types

type Domain = ByteString Source #

Type for domain.

type CLASS = Word16 Source #

Resource record class.

classIN :: CLASS Source #

Resource record class for the Internet.

type TTL = Word32 Source #

Time to live in second.

Resource Record Types

data TYPE where Source #

Types for resource records.

Bundled Patterns

pattern A :: TYPE

IPv4 address

pattern NS :: TYPE

An authoritative name serve

pattern CNAME :: TYPE

The canonical name for an alias

pattern SOA :: TYPE

Marks the start of a zone of authority

pattern NULL :: TYPE

A null RR (EXPERIMENTAL)

pattern PTR :: TYPE

A domain name pointer

pattern MX :: TYPE

Mail exchange

pattern TXT :: TYPE

Text strings

pattern AAAA :: TYPE

IPv6 Address

pattern SRV :: TYPE

Server Selection (RFC2782)

pattern DNAME :: TYPE

DNAME (RFC6672)

pattern OPT :: TYPE

OPT (RFC6891)

pattern DS :: TYPE

Delegation Signer (RFC4034)

pattern RRSIG :: TYPE

RRSIG (RFC4034)

pattern NSEC :: TYPE

NSEC (RFC4034)

pattern DNSKEY :: TYPE

DNSKEY (RFC4034)

pattern NSEC3 :: TYPE

NSEC3 (RFC5155)

pattern NSEC3PARAM :: TYPE

NSEC3PARAM (RFC5155)

pattern TLSA :: TYPE

TLSA (RFC6698)

pattern CDS :: TYPE

Child DS (RFC7344)

pattern CDNSKEY :: TYPE

DNSKEY(s) the Child wants reflected in DS (RFC7344)

pattern CSYNC :: TYPE

Child-To-Parent Synchronization (RFC7477)

pattern ANY :: TYPE

A request for all records the server/cache has available

toTYPE :: Word16 -> TYPE Source #

From number to type.

Resource Data

data RData Source #

Raw data format for each type.

Constructors

RD_A IPv4

IPv4 address

RD_NS Domain

An authoritative name serve

RD_CNAME Domain

The canonical name for an alias

RD_SOA Domain Mailbox Word32 Word32 Word32 Word32 Word32

Marks the start of a zone of authority

RD_NULL

A null RR (EXPERIMENTAL). Anything can be in a NULL record, for now we just drop this data.

RD_PTR Domain

A domain name pointer

RD_MX Word16 Domain

Mail exchange

RD_TXT ByteString

Text strings

RD_AAAA IPv6

IPv6 Address

RD_SRV Word16 Word16 Word16 Domain

Server Selection (RFC2782)

RD_DNAME Domain

DNAME (RFC6672)

RD_OPT [ OData ]

OPT (RFC6891)

RD_DS Word16 Word8 Word8 ByteString

Delegation Signer (RFC4034) RD_RRSIG RD_NSEC

RD_DNSKEY Word16 Word8 Word8 ByteString

DNSKEY (RFC4034) RD_NSEC3

RD_NSEC3PARAM Word8 Word8 Word16 ByteString
RD_TLSA Word8 Word8 Word8 ByteString

TLSA (RFC6698) RD_CDS RD_CDNSKEY RD_CSYNC

UnknownRData ByteString

Unknown resource data

DNS Message

data DNSMessage Source #

Raw data format for DNS Query and Response.

Constructors

DNSMessage

Fields

type DNSFormat = DNSMessage Source #

Deprecated: Use DNSMessage instead

For backward compatibility.

DNS Header

type Identifier = Word16 Source #

An identifier assigned by the program that generates any kind of query.

data DNSFlags Source #

Raw data format for the flags of DNS Query and Response.

Constructors

DNSFlags

Fields

  • qOrR :: QorR

    Query or response.

  • opcode :: OPCODE

    Kind of query.

  • authAnswer :: Bool

    Authoritative Answer - this bit is valid in responses, and specifies that the responding name server is an authority for the domain name in question section.

  • trunCation :: Bool

    TrunCation - specifies that this message was truncated due to length greater than that permitted on the transmission channel.

  • recDesired :: Bool

    Recursion Desired - this bit may be set in a query and is copied into the response. If RD is set, it directs the name server to pursue the query recursively. Recursive query support is optional.

  • recAvailable :: Bool

    Recursion Available - this be is set or cleared in a response, and denotes whether recursive query support is available in the name server.

  • rcode :: RCODE

    Response code.

  • authenData :: Bool

    Authentic Data (RFC4035).

data RCODE where Source #

Response code including EDNS0's 12bit ones.

Bundled Patterns

pattern NoErr :: RCODE

No error condition.

pattern FormatErr :: RCODE

Format error - The name server was unable to interpret the query.

pattern ServFail :: RCODE

Server failure - The name server was unable to process this query due to a problem with the name server.

pattern NameErr :: RCODE

Name Error - Meaningful only for responses from an authoritative name server, this code signifies that the domain name referenced in the query does not exist.

pattern NotImpl :: RCODE

Not Implemented - The name server does not support the requested kind of query.

pattern Refused :: RCODE

Refused - The name server refuses to perform the specified operation for policy reasons. For example, a name server may not wish to provide the information to the particular requester, or a name server may not wish to perform a particular operation (e.g., zone transfer) for particular data.

pattern YXDomain :: RCODE

YXDomain - Dynamic update response, a pre-requisite domain that should not exist, does exist.

pattern YXRRSet :: RCODE

YXRRSet - Dynamic update response, a pre-requisite RRSet that should not exist, does exist.

pattern NXRRSet :: RCODE

NXRRSet - Dynamic update response, a pre-requisite RRSet that should exist, does not exist.

pattern NotAuth :: RCODE

NotAuth - Dynamic update response, the server is not authoritative for the zone named in the Zone Section.

pattern NotZone :: RCODE

NotZone - Dynamic update response, a name used in the Prerequisite or Update Section is not within the zone denoted by the Zone Section.

pattern BadOpt :: RCODE

Bad OPT Version (RFC 6891) or TSIG Signature Failure (RFC2845).

toRCODE :: Word16 -> RCODE Source #

From number to rcode.

fromRCODEforHeader :: RCODE -> Word16 Source #

From rcode to number for header (4bits only).

toRCODEforHeader :: Word16 -> RCODE Source #

From number in header to rcode (4bits only).

DNS Body

DNS Error

data DNSError Source #

An enumeration of all possible DNS errors that can occur.

Constructors

SequenceNumberMismatch

The sequence number of the answer doesn't match our query. This could indicate foul play.

RetryLimitExceeded

The number of retries for the request was exceeded.

TimeoutExpired

TCP fallback request timed out.

UnexpectedRDATA

The answer has the correct sequence number, but returned an unexpected RDATA format.

IllegalDomain

The domain for query is illegal.

FormatError

The name server was unable to interpret the query.

ServerFailure

The name server was unable to process this query due to a problem with the name server.

NameError

This code signifies that the domain name referenced in the query does not exist.

NotImplemented

The name server does not support the requested kind of query.

OperationRefused

The name server refuses to perform the specified operation for policy reasons. For example, a name server may not wish to provide the information to the particular requester, or a name server may not wish to perform a particular operation (e.g., zone transfer) for particular data.

BadOptRecord

The server detected a malformed OPT RR.

BadConfiguration

Configuration is wrong.

NetworkFailure IOException

Network failure.

DecodeError String

Error is unknown

UnknownDNSError

EDNS0

defaultEDNS0 :: EDNS0 Source #

Default information for EDNS0.

>>> defaultEDNS0
EDNS0 {udpSize = 4096, extRCODE = NoError, dnssecOk = False, options = []}

maxUdpSize :: Word16 Source #

Maximum UDP size. If udpSize of EDNS0 is larger than this, fromEDNS0 uses this value instead.

>>> maxUdpSize
16384

minUdpSize :: Word16 Source #

Minimum UDP size. If udpSize of EDNS0 is smaller than this, fromEDNS0 uses this value instead.

>>> minUdpSize
512

Accessors

options :: EDNS0 -> [ OData ] Source #

EDNS0 option data.

Converters

fromEDNS0 :: EDNS0 -> ResourceRecord Source #

Generating a resource record for the additional section based on EDNS0. DNSFlags is not generated. Just set the same RCODE to DNSFlags .

toEDNS0 :: DNSFlags -> ResourceRecord -> Maybe EDNS0 Source #

Generating EDNS0 information from the OPT RR.

EDNS0 option data

fromOptCode :: OptCode -> Word16 Source #

From option code to number.

toOptCode :: Word16 -> OptCode Source #

From number to option code.

Other types

type Mailbox = ByteString Source #

Type for a mailbox encoded on the wire as a DNS name, but the first label is conceptually the user name, and sometimes has contains internal periods that are not label separators. Therefore, in mailboxes @ is used as the separator between the first and second labels.