Trait domain::base::cmp::CanonicalOrd

source ·
pub trait CanonicalOrd<Rhs: ?Sized = Self> {
    // Required method
    fn canonical_cmp(&self, other: &Rhs) -> Ordering;

    // Provided methods
    fn canonical_lt(&self, other: &Rhs) -> bool { ... }
    fn canonical_le(&self, other: &Rhs) -> bool { ... }
    fn canonical_gt(&self, other: &Rhs) -> bool { ... }
    fn canonical_ge(&self, other: &Rhs) -> bool { ... }
}
Expand description

A trait for the canonical sort order of values.

The canonical sort order is used in DNSSEC when multiple values are part of constructing or validating a signature. This sort order differs in some cases from the normal sort order. To avoid confusion, only this trait should be used when DNSSEC signatures are involved.

Canonical order is defined in RFC 4034 and clarified in RFC 6840. It is defined for domain names and resource records within an RR set (i.e., a set of records with the same owner name, class, and type).

For domain names, canonical order is the same as the ‘normal’ order as implemented through the PartialOrd and Ord traits: Labels are compared from right to left (i.e, starting from the root label) with each pair of labels compared as octet sequences with ASCII letters lowercased before comparison. The name_cmp methods of the ToDname and ToRelativeDname traits can be used to implement this canonical order for name types.

Resource records within an RR set are ordered by comparing the canonical wire-format representation of their record data as octet sequences. The canonical form differs from the regular form by lower-casing domain names included in the record data for the record types NS, MD, MF, CNAME, SOA, MB, MG, MR, PTR, MINFO, MX, RP, AFSDB, RT, SIG, PX, NXT, NAPTR, KX, SRV, DNAME, A6, and RRSIG. (NSEC is listed in RFC 4034 but has been withdrawn by RFC 6840). This canonical representation is provided via the Compose::compose_canonical method.

In order to help implementing this trait for record data types, there are implementations of it for some types that can appear in record data that sort differently in their composed representation than normally.

Apart from these explicit use cases, the CanonicalOrd trait is also implemented for the Record type to allow ordering records of a zone into RRsets. It does so by ordering by class first, then canonical owner, record type, and finally canonical record data. The reason for this somewhat odd ordering is that in this way not only are all records for the same owner name and class kept together, but also all the records subordinate to a owner name and class pair (i.e., the records for a zone) will sort together.

Required Methods§

source

fn canonical_cmp(&self, other: &Rhs) -> Ordering

Returns the canonical ordering between self and other.

Provided Methods§

source

fn canonical_lt(&self, other: &Rhs) -> bool

Returns whether self is canonically less than other.

source

fn canonical_le(&self, other: &Rhs) -> bool

Returns whether self is canonically less than or equal to other.

source

fn canonical_gt(&self, other: &Rhs) -> bool

Returns whether self is canonically greater than other.

source

fn canonical_ge(&self, other: &Rhs) -> bool

Returns whether self is canonically greater than or equal to other.

Implementors§

source§

impl CanonicalOrd<Aaaa> for Aaaa

source§

impl CanonicalOrd<A> for A

source§

impl CanonicalOrd<Serial> for Serial

source§

impl<N, NN> CanonicalOrd<Question<NN>> for Question<N>where N: ToDname, NN: ToDname,

source§

impl<N, NN, D, DD> CanonicalOrd<Record<NN, DD>> for Record<N, D>where N: ToDname, NN: ToDname, D: RecordData + CanonicalOrd<DD>, DD: RecordData,

source§

impl<N, NN, O, OO> CanonicalOrd<Rrsig<OO, NN>> for Rrsig<O, N>where N: ToDname, NN: ToDname, O: AsRef<[u8]>, OO: AsRef<[u8]>,

source§

impl<N: ToDname, NN: ToDname> CanonicalOrd<Dname<NN>> for domain::rdata::dname::Dname<N>

source§

impl<N: ToDname, NN: ToDname> CanonicalOrd<Cname<NN>> for Cname<N>

source§

impl<N: ToDname, NN: ToDname> CanonicalOrd<Mb<NN>> for Mb<N>

source§

impl<N: ToDname, NN: ToDname> CanonicalOrd<Md<NN>> for Md<N>

source§

impl<N: ToDname, NN: ToDname> CanonicalOrd<Mf<NN>> for Mf<N>

source§

impl<N: ToDname, NN: ToDname> CanonicalOrd<Mg<NN>> for Mg<N>

source§

impl<N: ToDname, NN: ToDname> CanonicalOrd<Minfo<NN>> for Minfo<N>

source§

impl<N: ToDname, NN: ToDname> CanonicalOrd<Mr<NN>> for Mr<N>

source§

impl<N: ToDname, NN: ToDname> CanonicalOrd<Mx<NN>> for Mx<N>

source§

impl<N: ToDname, NN: ToDname> CanonicalOrd<Ns<NN>> for Ns<N>

source§

impl<N: ToDname, NN: ToDname> CanonicalOrd<Ptr<NN>> for Ptr<N>

source§

impl<N: ToDname, NN: ToDname> CanonicalOrd<Soa<NN>> for Soa<N>

source§

impl<N: ToDname, NN: ToDname> CanonicalOrd<Srv<NN>> for Srv<N>

source§

impl<O, OO> CanonicalOrd<RtypeBitmap<OO>> for RtypeBitmap<O>where O: AsRef<[u8]>, OO: AsRef<[u8]>,

source§

impl<O, OO, N, NN> CanonicalOrd<ZoneRecordData<OO, NN>> for ZoneRecordData<O, N>where O: AsRef<[u8]>, OO: AsRef<[u8]>, N: CanonicalOrd<NN> + ToDname, NN: ToDname,

source§

impl<O, OO, N, NN> CanonicalOrd<Nsec<OO, NN>> for Nsec<O, N>where O: AsRef<[u8]>, OO: AsRef<[u8]>, N: ToDname, NN: ToDname,

source§

impl<O, OO, N, NN> CanonicalOrd<Tsig<OO, NN>> for Tsig<O, N>where O: AsRef<[u8]>, OO: AsRef<[u8]>, N: ToDname, NN: ToDname,

source§

impl<Octs, N> CanonicalOrd<N> for domain::base::name::Dname<Octs>where Octs: AsRef<[u8]> + ?Sized, N: ToDname + ?Sized,

source§

impl<Octs, N> CanonicalOrd<N> for ParsedDname<Octs>where Octs: AsRef<[u8]>, N: ToDname + ?Sized,

source§

impl<Octs, Other> CanonicalOrd<Cdnskey<Other>> for Cdnskey<Octs>where Octs: AsRef<[u8]>, Other: AsRef<[u8]>,

source§

impl<Octs, Other> CanonicalOrd<Cds<Other>> for Cds<Octs>where Octs: AsRef<[u8]>, Other: AsRef<[u8]>,

source§

impl<Octs, Other> CanonicalOrd<Dnskey<Other>> for Dnskey<Octs>where Octs: AsRef<[u8]>, Other: AsRef<[u8]>,

source§

impl<Octs, Other> CanonicalOrd<Ds<Other>> for Ds<Octs>where Octs: AsRef<[u8]>, Other: AsRef<[u8]>,

source§

impl<Octs, Other> CanonicalOrd<Nsec3<Other>> for Nsec3<Octs>where Octs: AsRef<[u8]>, Other: AsRef<[u8]>,

source§

impl<Octs, Other> CanonicalOrd<Nsec3param<Other>> for Nsec3param<Octs>where Octs: AsRef<[u8]>, Other: AsRef<[u8]>,

source§

impl<Octs, Other> CanonicalOrd<Hinfo<Other>> for Hinfo<Octs>where Octs: AsRef<[u8]>, Other: AsRef<[u8]>,

source§

impl<Octs, Other> CanonicalOrd<Null<Other>> for Null<Octs>where Octs: AsRef<[u8]> + ?Sized, Other: AsRef<[u8]> + ?Sized,

source§

impl<Octs, Other> CanonicalOrd<Txt<Other>> for Txt<Octs>where Octs: AsRef<[u8]>, Other: AsRef<[u8]>,

source§

impl<Octs, Other> CanonicalOrd<UnknownRecordData<Other>> for UnknownRecordData<Octs>where Octs: AsRef<[u8]>, Other: AsRef<[u8]>,

source§

impl<T, U> CanonicalOrd<Nsec3Salt<U>> for Nsec3Salt<T>where T: AsRef<[u8]> + ?Sized, U: AsRef<[u8]> + ?Sized,

source§

impl<T, U> CanonicalOrd<OwnerHash<U>> for OwnerHash<T>where T: AsRef<[u8]> + ?Sized, U: AsRef<[u8]> + ?Sized,

source§

impl<T, U> CanonicalOrd<CharStr<U>> for CharStr<T>where T: AsRef<[u8]> + ?Sized, U: AsRef<[u8]> + ?Sized,