pub trait DnsRecordExt: Debug {
Show 22 methods
// Required methods
fn get_record(&self) -> &DnsRecord;
fn get_record_mut(&mut self) -> &mut DnsRecord;
fn write(&self, packet: &mut DnsOutPacket);
fn any(&self) -> &dyn Any;
fn matches(&self, other: &dyn DnsRecordExt) -> bool;
fn rrdata_match(&self, other: &dyn DnsRecordExt) -> bool;
fn compare_rdata(&self, other: &dyn DnsRecordExt) -> Ordering;
fn rdata_print(&self) -> String;
fn clone_box(&self) -> DnsRecordBox;
// Provided methods
fn compare(&self, other: &dyn DnsRecordExt) -> Ordering { ... }
fn get_class(&self) -> u16 { ... }
fn get_cache_flush(&self) -> bool { ... }
fn get_name(&self) -> &str { ... }
fn get_type(&self) -> RRType { ... }
fn reset_ttl(&mut self, other: &dyn DnsRecordExt) { ... }
fn get_created(&self) -> u64 { ... }
fn get_expire(&self) -> u64 { ... }
fn set_expire(&mut self, expire_at: u64) { ... }
fn set_expire_sooner(&mut self, expire_at: u64) { ... }
fn updated_refresh_time(&mut self, now: u64) -> Option<u64> { ... }
fn suppressed_by_answer(&self, other: &dyn DnsRecordExt) -> bool { ... }
fn suppressed_by(&self, msg: &DnsIncoming) -> bool { ... }
}Expand description
Common methods for DNS resource records.
Required Methods§
fn get_record(&self) -> &DnsRecord
fn get_record_mut(&mut self) -> &mut DnsRecord
fn write(&self, packet: &mut DnsOutPacket)
fn any(&self) -> &dyn Any
Sourcefn matches(&self, other: &dyn DnsRecordExt) -> bool
fn matches(&self, other: &dyn DnsRecordExt) -> bool
Returns whether other record is considered the same except TTL.
Sourcefn rrdata_match(&self, other: &dyn DnsRecordExt) -> bool
fn rrdata_match(&self, other: &dyn DnsRecordExt) -> bool
Returns whether other record has the same rdata.
Sourcefn compare_rdata(&self, other: &dyn DnsRecordExt) -> Ordering
fn compare_rdata(&self, other: &dyn DnsRecordExt) -> Ordering
Returns the result based on a byte-level comparison of rdata.
If other is not valid, returns Greater.
Sourcefn rdata_print(&self) -> String
fn rdata_print(&self) -> String
Returns a human-readable string of rdata.
fn clone_box(&self) -> DnsRecordBox
Provided Methods§
Sourcefn compare(&self, other: &dyn DnsRecordExt) -> Ordering
fn compare(&self, other: &dyn DnsRecordExt) -> Ordering
Returns the result based on “lexicographically later” defined below.
fn get_cache_flush(&self) -> bool
Sourcefn get_name(&self) -> &str
fn get_name(&self) -> &str
Return the new name if exists, otherwise the regular name in DnsEntry.
fn get_type(&self) -> RRType
Sourcefn reset_ttl(&mut self, other: &dyn DnsRecordExt)
fn reset_ttl(&mut self, other: &dyn DnsRecordExt)
Resets TTL using other record.
self.refresh and self.expires are also reset.
fn get_created(&self) -> u64
fn get_expire(&self) -> u64
fn set_expire(&mut self, expire_at: u64)
Sourcefn set_expire_sooner(&mut self, expire_at: u64)
fn set_expire_sooner(&mut self, expire_at: u64)
Set expire as expire_at if it is sooner than the current expire.
Sourcefn updated_refresh_time(&mut self, now: u64) -> Option<u64>
fn updated_refresh_time(&mut self, now: u64) -> Option<u64>
Given now, if the record is due to refresh, this method updates the refresh time
and returns the new refresh time. Otherwise, returns None.
Sourcefn suppressed_by_answer(&self, other: &dyn DnsRecordExt) -> bool
fn suppressed_by_answer(&self, other: &dyn DnsRecordExt) -> bool
Returns true if another record has matched content, and if its TTL is at least half of this record’s.
Sourcefn suppressed_by(&self, msg: &DnsIncoming) -> bool
fn suppressed_by(&self, msg: &DnsIncoming) -> bool
Required by RFC 6762 Section 7.1: Known-Answer Suppression.