[][src]Struct toluol::DnsRecord

pub struct DnsRecord { /* fields omitted */ }

Represents a DNS record, i. e. an entry in the answer, authority or additional section of a DNS message. class and ttl are None iff atype == DnsType::OPT. payload_size, rcode, edns_version and flags are None iff atype != DnsType::OPT. See RFC 1035 for further information.

Implementations

impl DnsRecord[src]

pub fn new_opt_record(payload_size: u16, do_flag: bool) -> DnsRecord[src]

Creates a new OPT record.

pub fn encode(&self) -> Result<Vec<u8>>[src]

Encodes a DnsRecord as a series of bytes. Returns an error if a method defined in byteorder::WriteBytesExt returns an error.

pub fn parse(msg: &mut Cursor<&[u8]>, rcode: DnsRcode) -> Result<DnsRecord>[src]

Parses an encoded DnsRecord from a series of bytes. Returns an error if DnsMessage::parse_qname(), DnsType::parse(), DnsClass::parse(), DnsRecord::parse_rdata() or a method defined in byteorder::ReadBytesExt return an error or an OPT record has a name other than "".

pub fn parse_rdata(
    atype: &DnsType,
    msg: &mut Cursor<&[u8]>,
    rdlength: u16
) -> Result<Vec<String>>
[src]

Parses encoded rdata into a vector of strings (canonical format). atype is the type of the record containing the rdata. msg is the complete response message, which is needed for message compression. rdlength is the length of the RDATA in bytes. Returns an error if DnsMessage::parse_qname(), DnsMessage::parse_string(), DnsType::parse(), DnsClass::parse(), DnsRecord::parse_rdata(), DnsRecord::parse_nsec_type_bitmap(), DnsRecord::interpret_nsec_type_bitmap() or a method defined in byteorder::ReadBytesExt return an error or a TXT record contains an invalid byte.

pub fn interpret_dnssec_algorithm(algorithm: u8) -> Result<String>[src]

Interprets a DNSSEC algorithm number and returns a describing string.

pub fn interpret_nsec_type_bitmap(types: Vec<u16>) -> Result<String>[src]

Takes a list of DNS TYPEs (e. g. the return value of DnsRecord::parse_nsec_type_bitmap()) and returns a string containing the representation of the listed TYPEs. Returns an error if DnsType::parse() returns an error (i. e. types contains an invalid or unimplemented type).

pub fn parse_nsec_type_bitmap(
    msg: &mut Cursor<&[u8]>,
    len_read: u16,
    rdlength: u16
) -> Result<Vec<u16>>
[src]

Parses the type bitmap in the RDATA section of an NSEC or NSEC3 record. len_read is the count of the bytes already read from the rdata. rdlength is the total length of the rdata. Returns an error if a method defined in byteorder::ReadBytesExt returns an error.

pub fn as_padded_string(&self, owner_len: usize) -> String[src]

Returns a string representing the record in the canonical format, with the owner padded to the given length. Panics when called on an OPT record.

Trait Implementations

impl Clone for DnsRecord[src]

impl Display for DnsRecord[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,