Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data types for DNS Query and Response. For more information, see http://www.ietf.org/rfc/rfc1035 .
Synopsis
- data ResourceRecord = ResourceRecord { }
- type Domain = ByteString
- type CLASS = Word16
- classIN :: CLASS
- type TTL = Word32
-
data
TYPE
where
- pattern A :: TYPE
- pattern NS :: TYPE
- pattern CNAME :: TYPE
- pattern SOA :: TYPE
- pattern NULL :: TYPE
- pattern PTR :: TYPE
- pattern MX :: TYPE
- pattern TXT :: TYPE
- pattern AAAA :: TYPE
- pattern SRV :: TYPE
- pattern DNAME :: TYPE
- pattern OPT :: TYPE
- pattern DS :: TYPE
- pattern RRSIG :: TYPE
- pattern NSEC :: TYPE
- pattern DNSKEY :: TYPE
- pattern NSEC3 :: TYPE
- pattern NSEC3PARAM :: TYPE
- pattern TLSA :: TYPE
- pattern CDS :: TYPE
- pattern CDNSKEY :: TYPE
- pattern CSYNC :: TYPE
- pattern ANY :: TYPE
- fromTYPE :: TYPE -> Word16
- toTYPE :: Word16 -> TYPE
-
data
RData
- = RD_A IPv4
- | RD_NS Domain
- | RD_CNAME Domain
- | RD_SOA Domain Mailbox Word32 Word32 Word32 Word32 Word32
- | RD_NULL
- | RD_PTR Domain
- | RD_MX Word16 Domain
- | RD_TXT ByteString
- | RD_AAAA IPv6
- | RD_SRV Word16 Word16 Word16 Domain
- | RD_DNAME Domain
- | RD_OPT [ OData ]
- | RD_DS Word16 Word8 Word8 ByteString
- | RD_DNSKEY Word16 Word8 Word8 ByteString
- | RD_NSEC3PARAM Word8 Word8 Word16 ByteString
- | RD_TLSA Word8 Word8 Word8 ByteString
- | UnknownRData ByteString
-
data
DNSMessage
=
DNSMessage
{
- header :: DNSHeader
- question :: [ Question ]
- answer :: [ ResourceRecord ]
- authority :: [ ResourceRecord ]
- additional :: [ ResourceRecord ]
- defaultQuery :: DNSMessage
- defaultResponse :: DNSMessage
- type DNSFormat = DNSMessage
-
data
DNSHeader
=
DNSHeader
{
- identifier :: Identifier
- flags :: DNSFlags
- type Identifier = Word16
-
data
QorR
- = QR_Query
- | QR_Response
-
data
DNSFlags
=
DNSFlags
{
- qOrR :: QorR
- opcode :: OPCODE
- authAnswer :: Bool
- trunCation :: Bool
- recDesired :: Bool
- recAvailable :: Bool
- rcode :: RCODE
- authenData :: Bool
- data OPCODE
-
data
RCODE
where
- pattern NoErr :: RCODE
- pattern FormatErr :: RCODE
- pattern ServFail :: RCODE
- pattern NameErr :: RCODE
- pattern NotImpl :: RCODE
- pattern Refused :: RCODE
- pattern YXDomain :: RCODE
- pattern YXRRSet :: RCODE
- pattern NXRRSet :: RCODE
- pattern NotAuth :: RCODE
- pattern NotZone :: RCODE
- pattern BadOpt :: RCODE
- fromRCODE :: RCODE -> Word16
- toRCODE :: Word16 -> RCODE
- fromRCODEforHeader :: RCODE -> Word16
- toRCODEforHeader :: Word16 -> RCODE
- data Question = Question { }
- data DNSError
- data EDNS0
- defaultEDNS0 :: EDNS0
- maxUdpSize :: Word16
- minUdpSize :: Word16
- udpSize :: EDNS0 -> Word16
- extRCODE :: EDNS0 -> RCODE
- dnssecOk :: EDNS0 -> Bool
- options :: EDNS0 -> [ OData ]
- fromEDNS0 :: EDNS0 -> ResourceRecord
- toEDNS0 :: DNSFlags -> ResourceRecord -> Maybe EDNS0
- data OData
-
data
OptCode
where
- pattern ClientSubnet :: OptCode
- fromOptCode :: OptCode -> Word16
- toOptCode :: Word16 -> OptCode
- type Mailbox = ByteString
Resource Records
data ResourceRecord Source #
Raw data format for resource records.
Instances
Eq ResourceRecord Source # | |
Defined in Network.DNS.Types (==) :: ResourceRecord -> ResourceRecord -> Bool Source # (/=) :: ResourceRecord -> ResourceRecord -> Bool Source # |
|
Show ResourceRecord Source # | |
Defined in Network.DNS.Types |
Types
type Domain = ByteString Source #
Type for domain.
Resource Record Types
Types for resource records.
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 |
Resource Data
Raw data format for each type.
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.
DNSMessage | |
|
Instances
Eq DNSMessage Source # | |
Defined in Network.DNS.Types (==) :: DNSMessage -> DNSMessage -> Bool Source # (/=) :: DNSMessage -> DNSMessage -> Bool Source # |
|
Show DNSMessage Source # | |
Defined in Network.DNS.Types |
defaultQuery :: DNSMessage Source #
Default query.
defaultResponse :: DNSMessage Source #
Default response.
type DNSFormat = DNSMessage Source #
Deprecated: Use DNSMessage instead
For backward compatibility.
DNS Header
Raw data format for the header of DNS Query and Response.
DNSHeader | |
|
type Identifier = Word16 Source #
An identifier assigned by the program that generates any kind of query.
Query or response.
QR_Query |
Query. |
QR_Response |
Response. |
Instances
Bounded QorR Source # | |
Enum QorR Source # | |
Eq QorR Source # | |
Show QorR Source # | |
Raw data format for the flags of DNS Query and Response.
DNSFlags | |
|
Kind of query.
Instances
Bounded OPCODE Source # | |
Enum OPCODE Source # | |
Defined in Network.DNS.Types succ :: OPCODE -> OPCODE Source # pred :: OPCODE -> OPCODE Source # toEnum :: Int -> OPCODE Source # fromEnum :: OPCODE -> Int Source # enumFrom :: OPCODE -> [ OPCODE ] Source # enumFromThen :: OPCODE -> OPCODE -> [ OPCODE ] Source # enumFromTo :: OPCODE -> OPCODE -> [ OPCODE ] Source # enumFromThenTo :: OPCODE -> OPCODE -> OPCODE -> [ OPCODE ] Source # |
|
Eq OPCODE Source # | |
Show OPCODE Source # | |
Response code including EDNS0's 12bit ones.
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). |
Instances
Enum RCODE Source # |
Provide an Enum instance for backwards compatibility |
Defined in Network.DNS.Types succ :: RCODE -> RCODE Source # pred :: RCODE -> RCODE Source # toEnum :: Int -> RCODE Source # fromEnum :: RCODE -> Int Source # enumFrom :: RCODE -> [ RCODE ] Source # enumFromThen :: RCODE -> RCODE -> [ RCODE ] Source # enumFromTo :: RCODE -> RCODE -> [ RCODE ] Source # enumFromThenTo :: RCODE -> RCODE -> RCODE -> [ RCODE ] Source # |
|
Eq RCODE Source # | |
Show RCODE Source # |
Use https://tools.ietf.org/html/rfc2929#section-2.3 names for DNS RCODEs |
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
An enumeration of all possible DNS errors that can occur.
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 |
Instances
Eq DNSError Source # | |
Show DNSError Source # | |
Exception DNSError Source # | |
Defined in Network.DNS.Types toException :: DNSError -> SomeException Source # fromException :: SomeException -> Maybe DNSError Source # displayException :: DNSError -> String Source # |
EDNS0
EDNS0 infromation defined in RFC 6891.
Instances
defaultEDNS0 :: EDNS0 Source #
Default information for EDNS0.
>>>
defaultEDNS0
EDNS0 {udpSize = 4096, extRCODE = NoError, dnssecOk = False, options = []}
maxUdpSize :: Word16 Source #
minUdpSize :: Word16 Source #
Accessors
Converters
fromEDNS0 :: EDNS0 -> ResourceRecord Source #
toEDNS0 :: DNSFlags -> ResourceRecord -> Maybe EDNS0 Source #
Generating EDNS0 information from the OPT RR.
EDNS0 option data
Optional resource data.
OD_ClientSubnet Word8 Word8 IP |
Client subnet (RFC7871) |
UnknownOData OptCode ByteString |
Unknown optional type |
EDNS0 Option Code (RFC 6891).
pattern ClientSubnet :: OptCode |
Client subnet (RFC7871) |
Instances
Eq OptCode Source # | |
Ord OptCode Source # | |
Show OptCode Source # | |
fromOptCode :: OptCode -> Word16 Source #
From option code to number.
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.