pub struct DnsLayer {
pub index: LayerIndex,
}Expand description
DNS layer — a zero-copy view into the packet buffer.
Provides lazy field access for all DNS header fields and on-demand parsing of question/RR sections.
Fields§
§index: LayerIndexImplementations§
Source§impl DnsLayer
impl DnsLayer
Sourcepub fn questions(&self, buf: &[u8]) -> Result<Vec<DnsQuestion>, FieldError>
pub fn questions(&self, buf: &[u8]) -> Result<Vec<DnsQuestion>, FieldError>
Parse all questions from the packet.
Sourcepub fn answers_rr(
&self,
buf: &[u8],
) -> Result<Vec<DnsResourceRecord>, FieldError>
pub fn answers_rr( &self, buf: &[u8], ) -> Result<Vec<DnsResourceRecord>, FieldError>
Parse all answer RRs from the packet.
Parse all authority RRs from the packet.
Sourcepub fn additionals(
&self,
buf: &[u8],
) -> Result<Vec<DnsResourceRecord>, FieldError>
pub fn additionals( &self, buf: &[u8], ) -> Result<Vec<DnsResourceRecord>, FieldError>
Parse all additional RRs from the packet.
Sourcepub fn parse_all(
&self,
buf: &[u8],
) -> Result<(Vec<DnsQuestion>, Vec<DnsResourceRecord>, Vec<DnsResourceRecord>, Vec<DnsResourceRecord>), FieldError>
pub fn parse_all( &self, buf: &[u8], ) -> Result<(Vec<DnsQuestion>, Vec<DnsResourceRecord>, Vec<DnsResourceRecord>, Vec<DnsResourceRecord>), FieldError>
Parse all sections at once.
Sourcepub fn get_field(
&self,
buf: &[u8],
name: &str,
) -> Option<Result<FieldValue, FieldError>>
pub fn get_field( &self, buf: &[u8], name: &str, ) -> Option<Result<FieldValue, FieldError>>
Get a field value by name.
Sourcepub fn set_field(
&self,
buf: &mut [u8],
name: &str,
value: FieldValue,
) -> Option<Result<(), FieldError>>
pub fn set_field( &self, buf: &mut [u8], name: &str, value: FieldValue, ) -> Option<Result<(), FieldError>>
Set a field value by name.
Sourcepub fn field_names() -> &'static [&'static str]
pub fn field_names() -> &'static [&'static str]
Get the list of field names.
Trait Implementations§
Source§impl Layer for DnsLayer
impl Layer for DnsLayer
Source§fn header_len(&self, buf: &[u8]) -> usize
fn header_len(&self, buf: &[u8]) -> usize
Get the header length for this layer
Source§fn field_names(&self) -> &'static [&'static str]
fn field_names(&self) -> &'static [&'static str]
Get the list of field names for this layer
Auto Trait Implementations§
impl Freeze for DnsLayer
impl RefUnwindSafe for DnsLayer
impl Send for DnsLayer
impl Sync for DnsLayer
impl Unpin for DnsLayer
impl UnsafeUnpin for DnsLayer
impl UnwindSafe for DnsLayer
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