pub struct DnsOutgoing { /* private fields */ }
Expand description
Representation of one outgoing DNS message that could be sent in one or more packet(s).
Implementations§
Source§impl DnsOutgoing
impl DnsOutgoing
pub fn new(flags: u16) -> Self
pub fn questions(&self) -> &[DnsQuestion]
pub fn answers_count(&self) -> usize
pub fn additionals(&self) -> &[DnsRecordBox] ⓘ
pub fn known_answer_count(&self) -> i64
pub fn set_id(&mut self, id: u16)
pub const fn is_query(&self) -> bool
pub fn add_additional_answer(&mut self, answer: impl DnsRecordExt + 'static)
Sourcepub fn add_answer_box(&mut self, answer_box: DnsRecordBox)
pub fn add_answer_box(&mut self, answer_box: DnsRecordBox)
A workaround as Rust doesn’t allow us to pass DnsRecordBox in as impl DnsRecordExt
Sourcepub fn add_answer(
&mut self,
msg: &DnsIncoming,
answer: impl DnsRecordExt + Send + 'static,
) -> bool
pub fn add_answer( &mut self, msg: &DnsIncoming, answer: impl DnsRecordExt + Send + 'static, ) -> bool
Returns true if answer
is added to the outgoing msg.
Returns false if answer
was not added as it expired or suppressed by the incoming msg
.
Sourcepub fn add_answer_at_time(
&mut self,
answer: impl DnsRecordExt + Send + 'static,
now: u64,
) -> bool
pub fn add_answer_at_time( &mut self, answer: impl DnsRecordExt + Send + 'static, now: u64, ) -> bool
Returns true if answer
is added to the outgoing msg.
Returns false if the answer is expired now
hence not added.
If now
is 0, do not check if the answer expires.
pub fn add_question(&mut self, name: &str, qtype: RRType)
Sourcepub fn to_data_on_wire(&self) -> Vec<Vec<u8>>
pub fn to_data_on_wire(&self) -> Vec<Vec<u8>>
Returns a list of actual DNS packet data to be sent on the wire.
Sourcepub fn to_packets(&self) -> Vec<DnsOutPacket>
pub fn to_packets(&self) -> Vec<DnsOutPacket>
Encode self into one or more packets.
Auto Trait Implementations§
impl Freeze for DnsOutgoing
impl !RefUnwindSafe for DnsOutgoing
impl !Send for DnsOutgoing
impl !Sync for DnsOutgoing
impl Unpin for DnsOutgoing
impl !UnwindSafe for DnsOutgoing
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more