| Copyright | (c) Viktor Dukhovni 2026 |
|---|---|
| License | BSD-3-Clause |
| Maintainer | ietf-dane@dukhovni.org |
| Stability | unstable |
| Safe Haskell | None |
| Language | GHC2024 |
Net.DNSBase.NsecTypes
Description
The packed bitmap used to list which RR types are present at
(or relevant to) the owner name. NsecTypes is the
window-based encoding from
RFC 4034 section 4.1.2,
used by T_nsec,
T_nsec3, and
T_csync to carry an arbitrary set of
RRTYPE codepoints in a compact form. NxtTypes is the legacy
single-window encoding used by the obsolete NXT record, which
restricts types to the first 128 codepoints.
NsecTypes is an instance of IsList with , so construction is via Item NsecTypes =
RRTYPE from
GHC.IsList (or fromList xs[ under A, AAAA, ...]OverloadedLists,
via the associated RRTYPE pattern synonyms) and enumeration
is via toList. The input list is deduplicated and reordered
into wire-form canonical order; an empty input produces the empty
bitmap. hasRRtype is the efficient membership predicate used by
DNSSEC validators.
Example
ghci> import qualified GHC.IsList as IL (fromList, toList) ghci> tys = IL.fromList @NsecTypes [MX, A, AAAA, A] ghci> tys fromList @NsecTypes [1,15,28] ghci> IL.toList tys [1,15,28] ghci> hasRRtype AAAA tys True ghci> hasRRtype NS tys False
Synopsis
- data NsecTypes
- nsecTypesFromList :: [RRTYPE] -> NsecTypes
- nsecTypesToList :: NsecTypes -> [RRTYPE]
- getNsecTypes :: Int -> SGet NsecTypes
- putNsecTypes :: NsecTypes -> SPut s RData
- hasRRtype :: RRTYPE -> NsecTypes -> Bool
- newtype NxtTypes = NxtTypes ShortByteString
- data NxtRRtype
- toNxtTypes :: NonEmpty RRTYPE -> NxtTypes
- nxtTypesFromNE :: NonEmpty NxtRRtype -> NxtTypes
- nxtTypesToNE :: NxtTypes -> NonEmpty NxtRRtype
- getNxtTypes :: Int -> SGet NxtTypes
- hasNxtRRtype :: RRTYPE -> NxtTypes -> Bool
- module Net.DNSBase.NonEmpty
NSECNSEC3CSYNC Type Bitmap structure
Abstract representation of a set of RRTYPE codepoints,
stored as the window-based wire-format bitmap from RFC 4034
section 4.1.2. Used by T_nsec,
T_nsec3, and
T_csync to carry the set of types
present at the owner name.
An NsecTypes may legitimately be empty -- this is the
expected encoding for an NSEC3 empty-non-terminal. With NSEC,
the type bitmap is expected to include at least the NSEC type
itself; that invariant is not enforced by the type.
Construction and enumeration go through IsList:
builds the bitmap from a list offromListtys ::NsecTypesRRTYPEvalues; duplicates are merged and the wire-form ordering is canonical regardless of input order. UnderOverloadedListsthe same input shape is just[A, AAAA, MX].enumerates the contained types in ascending wire-form order.toListbm :: [RRTYPE](unions two bitmaps;<>)memptyis the empty bitmap.
For membership without enumerating the whole set, use
hasRRtype, which goes directly to the relevant window, block
and bit offset.
Instances
| Presentable NsecTypes Source # | Presentation form: contained types in canonical wire-form
order, space-separated, with no leading separator. The empty
bitmap renders as the empty string. When the bitmap follows
another field in an RR's presentation form, compose with
|
Defined in Net.DNSBase.NsecTypes Methods present :: NsecTypes -> Builder -> Builder Source # presentLazy :: NsecTypes -> ByteString -> ByteString Source # | |
| Semigroup NsecTypes Source # | The |
| IsList NsecTypes Source # | Construction is via |
| Show NsecTypes Source # | |
| Eq NsecTypes Source # | |
| Ord NsecTypes Source # | The |
| type Item NsecTypes Source # | |
Defined in Net.DNSBase.NsecTypes | |
nsecTypesFromList :: [RRTYPE] -> NsecTypes Source #
Construct the per-window bitmaps from a list of types.
hasRRtype :: RRTYPE -> NsecTypes -> Bool Source #
Efficient NSEC/NSEC3 type bitmap membership predicate.
Legacy type bitmap in NXT records
Constructors
| NxtTypes ShortByteString |
Instances
| Presentable NxtTypes Source # | |
Defined in Net.DNSBase.NsecTypes Methods present :: NxtTypes -> Builder -> Builder Source # presentLazy :: NxtTypes -> ByteString -> ByteString Source # | |
| IsNonEmptyList NxtTypes Source # | |
| Semigroup NxtTypes Source # | Concatentation va |
| Show NxtTypes Source # | |
| Eq NxtTypes Source # | |
| Ord NxtTypes Source # | The |
Defined in Net.DNSBase.NsecTypes | |
| type Item1 NxtTypes Source # | |
Defined in Net.DNSBase.NsecTypes | |
An RRtype representable in an NXT RR bitmap.
Instances
| Presentable NxtRRtype Source # | |
Defined in Net.DNSBase.NsecTypes Methods present :: NxtRRtype -> Builder -> Builder Source # presentLazy :: NxtRRtype -> ByteString -> ByteString Source # | |
| Bounded NxtRRtype Source # | |
| Enum NxtRRtype Source # | |
Defined in Net.DNSBase.NsecTypes Methods succ :: NxtRRtype -> NxtRRtype # pred :: NxtRRtype -> NxtRRtype # fromEnum :: NxtRRtype -> Int # enumFrom :: NxtRRtype -> [NxtRRtype] # enumFromThen :: NxtRRtype -> NxtRRtype -> [NxtRRtype] # enumFromTo :: NxtRRtype -> NxtRRtype -> [NxtRRtype] # enumFromThenTo :: NxtRRtype -> NxtRRtype -> NxtRRtype -> [NxtRRtype] # | |
| Show NxtRRtype Source # | |
| Eq NxtRRtype Source # | |
| Ord NxtRRtype Source # | |
nxtTypesFromNE :: NonEmpty NxtRRtype -> NxtTypes Source #
Construct the bitmap from a non-empty list of types.
module Net.DNSBase.NonEmpty