25 lines
595 B
Rust
25 lines
595 B
Rust
use bytes::Bytes;
|
|
use common_types::Type;
|
|
use errors::*;
|
|
use std::io::Cursor;
|
|
use ser::DnsPacketData;
|
|
|
|
pub trait RRDataPacket: Sized {
|
|
fn deserialize_rr_data(ttl: u32, rr_class: u16, rr_type: Type, data: &mut Cursor<Bytes>) -> Result<Self>;
|
|
}
|
|
|
|
impl<T: DnsPacketData> RRDataPacket for T {
|
|
fn deserialize_rr_data(_ttl: u32, _rr_class: u16, _rr_type: Type, data: &mut Cursor<Bytes>) -> Result<Self> {
|
|
T::deserialize(data)
|
|
}
|
|
}
|
|
|
|
pub trait RRData: RRDataPacket + super::DnsTextData {
|
|
fn rr_type(&self) -> Type;
|
|
}
|
|
|
|
pub trait StaticRRData: RRData {
|
|
const TYPE: Type;
|
|
const NAME: &'static str;
|
|
}
|