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

Net.DNSBase.RData.XNAME

Description

The classical RR types from RFC 1035 whose RDATA is a single domain name: T_ns (delegation), T_cname (canonical-name alias), and T_ptr (reverse-mapping pointer). All three share the X_domain newtype underneath, but the types are nominally distinct so a CNAME value can't be used where a PTR is expected (and vice versa).

T_dname (RFC 6672) is exported alongside because it has the same shape — a single Domain — though it does not share the codec: DNAME's target is not subject to wire-form name compression on encode.

The obsolete mailbox-pointer types MB, MD, MF, MG, MR are also X_domain instances but live in Net.DNSBase.RData.Obsolete.

Synopsis

RR types representing a single domain name

data X_domain (n :: Nat) where Source #

Shared wire-format representation for the RFC 1035 RR types whose RDATA is a single domain name: NS (section 3.3.11), CNAME (section 3.3.1), PTR (section 3.3.12), and the obsolete mailbox-pointer types MB, MD, MF, MG, MR (RFC 1035 sections 3.3.3-3.3.8). The type parameter n (one of N_ns, N_cname, N_ptr, N_mb, N_md, N_mf, N_mg, N_mr) determines the RR type. Each has its own type synonym (T_ns, T_cname, ...) and matching pattern synonym (T_NS, T_CNAME, ...).

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
/                 DOMAINNAME                    /
/                                               /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

Although all these RR types share a common underlying representation, the constructors are not shared and the types are not mutually coercible — this is deliberate, to catch RR-type confusion at compile time.

The target domain is subject to wire-form name compression on encode (RFC 3597 section 4) and canonicalises to lower case (RFC 4034 section 6.2). The Eq and Ord instances compare in canonical wire form (via equalWireHost / compareWireHost), so Ord is canonical. Presentation preserves the original case.

Bundled Patterns

pattern T_NS :: Domain -> T_ns

Authoritative name server for a delegated zone (RFC 1035 section 3.3.11).

pattern T_PTR :: Domain -> T_ptr

Domain-name pointer, typically used for reverse mapping (RFC 1035 section 3.3.12).

pattern T_CNAME :: Domain -> T_cname

Canonical-name alias for the owner name (RFC 1035 section 3.3.1).

Instances

Instances details
Presentable (X_domain f) Source #

Presentation form preserves case.

Instance details

Defined in Net.DNSBase.RData.Internal.XNAME

(Typeable n, Nat16 n, KnownSymbol (XdomainConName n)) => KnownRData (X_domain n) Source #

Name compression used on input and output.

Instance details

Defined in Net.DNSBase.RData.Internal.XNAME

Associated Types

type RDataExtensionVal (X_domain n) 
Instance details

Defined in Net.DNSBase.RData.Internal.XNAME

Methods

rdataExtensionVal :: forall b -> b ~ X_domain n => RDataExtensionVal (X_domain n) Source #

rdType :: forall b -> b ~ X_domain n => RRTYPE Source #

rdTypePres :: forall b -> b ~ X_domain n => Builder -> Builder Source #

rdDecode :: forall b -> b ~ X_domain n => RDataExtensionVal (X_domain n) -> Int -> SGet RData Source #

rdEncode :: X_domain n -> SPut s RData Source #

cnEncode :: X_domain n -> SPut s RData Source #

(Nat16 n, KnownSymbol (XdomainConName n)) => Show (X_domain n) Source # 
Instance details

Defined in Net.DNSBase.RData.Internal.XNAME

Methods

showsPrec :: Int -> X_domain n -> ShowS #

show :: X_domain n -> String #

showList :: [X_domain n] -> ShowS #

Eq (X_domain f) Source #

Case-insensitive wire-form equality.

Instance details

Defined in Net.DNSBase.RData.Internal.XNAME

Methods

(==) :: X_domain f -> X_domain f -> Bool #

(/=) :: X_domain f -> X_domain f -> Bool #

Ord (X_domain f) Source #

Case-insensitive wire-form order.

Instance details

Defined in Net.DNSBase.RData.Internal.XNAME

Methods

compare :: X_domain f -> X_domain f -> Ordering #

(<) :: X_domain f -> X_domain f -> Bool #

(<=) :: X_domain f -> X_domain f -> Bool #

(>) :: X_domain f -> X_domain f -> Bool #

(>=) :: X_domain f -> X_domain f -> Bool #

max :: X_domain f -> X_domain f -> X_domain f #

min :: X_domain f -> X_domain f -> X_domain f #

type RDataExtensionVal (X_domain n) Source # 
Instance details

Defined in Net.DNSBase.RData.Internal.XNAME

type family XdomainConName (n :: Nat) :: Symbol where ... Source #

Equations

XdomainConName N_ns = "T_NS" 
XdomainConName N_cname = "T_CNAME" 
XdomainConName N_ptr = "T_PTR" 
XdomainConName N_md = "T_MD" 
XdomainConName N_mf = "T_MF" 
XdomainConName N_mb = "T_MB" 
XdomainConName N_mg = "T_MG" 
XdomainConName N_mr = "T_MR" 
XdomainConName n = TypeError ('ShowType n ':<>: 'Text " is not an RFC1035 domain-valued RRTYPE") :: Symbol 

type T_ns = X_domain N_ns Source #

X_domain specialised to NS records.

type T_ptr = X_domain N_ptr Source #

X_domain specialised to PTR records.

type T_cname = X_domain N_cname Source #

X_domain specialised to CNAME records.

newtype T_dname Source #

The DNAME resource record (RFC 6672 section 2.1) — redirection for a subtree of the domain-name space: a Domain naming the target subtree under which queries are rewritten.

The target field is not subject to wire-form name compression on encode (RFC 3597 section 4) but canonicalises to lower case (RFC 4034 section 6.2). The Eq and Ord instances compare in canonical wire form (via equalWireHost / compareWireHost), so Ord is canonical. Presentation preserves the original case.

See X_domain for the sibling family of RFC 1035 single-domain RR types, which differ from DNAME in that they do use name compression on encode.

Constructors

T_DNAME Domain

Target Domain

Instances

Instances details
Presentable T_dname Source #

Presentation form preserves case.

Instance details

Defined in Net.DNSBase.RData.Internal.XNAME

KnownRData T_dname Source #

Name compression used on input only.

Instance details

Defined in Net.DNSBase.RData.Internal.XNAME

Associated Types

type RDataExtensionVal T_dname 
Instance details

Defined in Net.DNSBase.RData.Internal.XNAME

Show T_dname Source # 
Instance details

Defined in Net.DNSBase.RData.Internal.XNAME

Eq T_dname Source #

Case-insensitive wire-form equality.

Instance details

Defined in Net.DNSBase.RData.Internal.XNAME

Methods

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

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

Ord T_dname Source #

Case-insensitive wire-form order.

Instance details

Defined in Net.DNSBase.RData.Internal.XNAME

type RDataExtensionVal T_dname Source # 
Instance details

Defined in Net.DNSBase.RData.Internal.XNAME