[−][src]Struct toluol::DnsMessage
Represents a DNS message. See RFC 1035 for further information.
Fields
header: DnsHeader
Implementations
impl DnsMessage
[src]
pub fn new_query(
domain: &str,
qtype: DnsType,
opcode: DnsOpcode,
rd: bool,
ad: bool,
cd: bool,
edns: bool,
do_flag: bool,
bufsize: u16
) -> Result<DnsMessage>
[src]
domain: &str,
qtype: DnsType,
opcode: DnsOpcode,
rd: bool,
ad: bool,
cd: bool,
edns: bool,
do_flag: bool,
bufsize: u16
) -> Result<DnsMessage>
Creates a DNS query.
edns
dictates whether the query contains an OPT record for indication of EDNS support.
bufsize
is the payload size that gets sent in the OPT record. If edns == false
the value
of bufsize
is ignored. do_flag
indicates DNSSEC support. See
RFC 1035 and the documentation of DnsHeader
for
information about the remaining parameters.
Returns an error if do_flag && !edns == true
.
pub fn new_response(
msg_id: u16,
opcode: DnsOpcode,
aa: bool,
tc: bool,
rd: bool,
ra: bool,
ad: bool,
cd: bool,
rcode: DnsRcode,
questions: Vec<DnsQuestion>,
answers: Vec<DnsRecord>,
authoritative_answers: Vec<DnsRecord>,
additional_answers: Vec<DnsRecord>
) -> DnsMessage
[src]
msg_id: u16,
opcode: DnsOpcode,
aa: bool,
tc: bool,
rd: bool,
ra: bool,
ad: bool,
cd: bool,
rcode: DnsRcode,
questions: Vec<DnsQuestion>,
answers: Vec<DnsRecord>,
authoritative_answers: Vec<DnsRecord>,
additional_answers: Vec<DnsRecord>
) -> DnsMessage
Creates a DNS response.
See the documentation of DnsHeader
for information about the parameters.
pub fn encode(&self) -> Result<Vec<u8>>
[src]
Encodes a DnsMessage as a series of bytes.
Returns an error if DnsHeader::encode()
, DnsQuestion::encode()
or DnsRecord::encode()
return an error.
pub fn parse(msg: &mut Cursor<&[u8]>) -> Result<DnsMessage>
[src]
Parses an encoded DnsMessage from a series of bytes.
Returns an error if DnsHeader::parse()
, DnsQuestion::parse()
or DnsRecord::parse()
return an error, the header/EDNS header contain an RCODE other than DnsRcode::NoError
or a
truncated message is received.
pub fn encode_qname(domain: &str) -> Result<Vec<u8>>
[src]
Encodes a domain name as a DNS QNAME. Does not use message compression.
Returns an error if the domain name is longer than 255 characters, a label
(part between two dots) in the domain name is longer than 63 characters or a method defined
in byteorder::WriteBytesExt
returns an error.
pub fn parse_string(msg: &mut Cursor<&[u8]>) -> Result<String>
[src]
Parses a character string as defined by RFC 1035.
Returns an error if a method defined in byteorder::ReadBytesExt
returns an error.
pub fn parse_qname(msg: &mut Cursor<&[u8]>) -> Result<String>
[src]
Parses a DNS QNAME as defined by RFC 1035,
returning it in common url format. As required by the specification, method compression
is supported.
Returns an error if a method defined in byteorder::ReadBytesExt
returns an error or an
extended or invalid label type is encountered.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for DnsMessage
impl Send for DnsMessage
impl Sync for DnsMessage
impl Unpin for DnsMessage
impl UnwindSafe for DnsMessage
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,