dnsbase
Copyright(c) Viktor Dukhovni 2026
LicenseBSD-3-Clause
Maintainerietf-dane@dukhovni.org
Stabilityunstable
Safe HaskellNone
LanguageGHC2024

Net.DNSBase.RR

Description

An RR value is the standard DNS resource record: an owner name, a class, a type, a TTL, and an RData payload. The payload is held inside the existential RData wrapper, so a single RR value can carry any registered RR type's data. Use rrDataCast to recover a specific KnownRData value from the wrapper; the fromRData / monoRData / rdataType helpers re-exported from Net.DNSBase.RData do the same on RData directly.

Synopsis

DNS resource record data type

data RR Source #

DNS Resource Record RFC1035 3.2.1

                                1  1  1  1  1  1
  0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                                               |
/                                               /
/                      NAME                     /
|                                               |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                      TYPE                     |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                     CLASS                     |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                      TTL                      |
|                                               |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                   RDLENGTH                    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
/                     RDATA                     /
/                                               /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

The TYPE field is implicit in the polymorphic rrData.

Constructors

RR 

Instances

Instances details
Presentable RR Source # 
Instance details

Defined in Net.DNSBase.Internal.RR

Show RR Source # 
Instance details

Defined in Net.DNSBase.Internal.RR

Methods

showsPrec :: Int -> RR -> ShowS #

show :: RR -> String #

showList :: [RR] -> ShowS #

Eq RR Source # 
Instance details

Defined in Net.DNSBase.Internal.RR

Methods

(==) :: RR -> RR -> Bool #

(/=) :: RR -> RR -> Bool #

rrDataCast :: KnownRData a => RR -> Maybe a Source #

Attempt to cast the RData payload of an RR to a KnownRData type, obtaining its type-specific representation. Returns Nothing if the types do not match.

Note that opaque RData payloads can't be cast directly to type-specific forms, instead their content has to be explicitly decoded (see fromOpaque).

rrType :: RR -> RRTYPE Source #

Returns the RRTYPE of the RData payload of the RR.