Struct trust_dns::authority::RRSet
[−]
[src]
pub struct RRSet { // some fields omitted }
Set of resource records associated to a name and type
Methods
impl RRSet
fn new(name: &Name, record_type: RecordType, serial: u32) -> RRSet
Creates a new Resource Record Set.
Arguments
name
- The label for theRRSet
record_type
-RecordType
of thisRRSet
, all records in theRRSet
must be of the specifiedRecordType
.serial
- current serial number of theSOA
record, this is to be used forIXFR
and signing for DNSSec after updates.
Return value
The newly created Resource Record Set
fn get_name(&self) -> &Name
Return value
Label of the Resource Record Set
fn get_record_type(&self) -> RecordType
Return value
RecordType
of the Resource Record Set
fn get_ttl(&self) -> u32
Return value
TTL, time-to-live, of the Resource Record Set, this is the maximum length of time that an RRSet should be cached.
fn get_records(&self, and_rrsigs: bool) -> Vec<&Record>
Return value
Slice of all records in the set
fn is_empty(&self) -> bool
Return value
True if there are no records in this set
fn get_serial(&self) -> u32
Return value
The serial number at which the record was updated.
fn get_rrsigs(&self) -> &[Record]
fn insert_rrsig(&mut self, rrsig: Record)
fn clear_rrsigs(&mut self)
fn insert(&mut self, record: Record, serial: u32) -> bool
Inserts a new Resource Record into the Set.
If the record is inserted, the ttl for the most recent record will be used for the ttl of the entire resource record set.
This abides by the following restrictions in RFC 2136, April 1997:
1.1.5. The following RR types cannot be appended to an RRset. If the
following comparison rules are met, then an attempt to add the new RR
will result in the replacement of the previous RR:
SOA compare only NAME, CLASS and TYPE -- it is not possible to
have more than one SOA per zone, even if any of the data
fields differ.
CNAME compare only NAME, CLASS, and TYPE -- it is not possible
to have more than one CNAME RR, even if their data fields
differ.
Arguments
record
-Record
asserts that thename
andrecord_type
match theRRSet
.serial
- current serial number of theSOA
record, this is to be used forIXFR
and signing for DNSSec after updates. The serial will only be updated if the record was added.
Return value
True if the record was inserted.
fn remove(&mut self, record: &Record, serial: u32) -> bool
Removes the Resource Record if it exists.
Arguments
record
-Record
asserts that thename
andrecord_type
match theRRSet
. Removes anyrecord
if the record data,RData
, match.serial
- current serial number of theSOA
record, this is to be used forIXFR
and signing for DNSSec after updates. The serial will only be updated if the record was added.
Return value
True if a record was removed.