Browse Source

make records fields public

preview
Stefan Bühler 4 years ago
parent
commit
5519e7faa8
  1. 314
      lib/dnsbox-base/src/records/structs.rs

314
lib/dnsbox-base/src/records/structs.rs

@ -16,55 +16,55 @@ pub struct A {
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct NS {
nsdname: DnsCompressedName,
pub nsdname: DnsCompressedName,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct MD {
madname: DnsCompressedName,
pub madname: DnsCompressedName,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct MF {
madname: DnsCompressedName,
pub madname: DnsCompressedName,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct CNAME {
cname: DnsCompressedName,
pub cname: DnsCompressedName,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct SOA {
mname: DnsCompressedName,
rname: DnsCompressedName,
serial: u32,
refresh: u32,
retry: u32,
expire: u32,
minimum: u32,
pub mname: DnsCompressedName,
pub rname: DnsCompressedName,
pub serial: u32,
pub refresh: u32,
pub retry: u32,
pub expire: u32,
pub minimum: u32,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct MB {
madname: DnsCompressedName,
pub madname: DnsCompressedName,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct MG {
mgmname: DnsCompressedName,
pub mgmname: DnsCompressedName,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct MR {
newname: DnsCompressedName,
pub newname: DnsCompressedName,
}
// not allowed in zone files anyway, i.e. no text representation.
@ -80,42 +80,42 @@ pub struct MR {
// #[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
// #[RRClass(IN)]
// pub struct WKS {
// address: Ipv4Addr,
// protocol: u8,
// bitmap: ..., // remaining bytes
// pub address: Ipv4Addr,
// pub protocol: u8,
// pub bitmap: ..., // remaining bytes
// }
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct PTR {
ptrdname: DnsCompressedName,
pub ptrdname: DnsCompressedName,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct HINFO {
cpu: ShortText,
os: ShortText,
pub cpu: ShortText,
pub os: ShortText,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct MINFO {
rmailbx: DnsCompressedName,
emailbx: DnsCompressedName,
pub rmailbx: DnsCompressedName,
pub emailbx: DnsCompressedName,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct MX {
preference: u16,
mxname: DnsCompressedName,
pub preference: u16,
pub mxname: DnsCompressedName,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct TXT {
text: LongText,
pub text: LongText,
}
// end of RFC 1035: no DnsCompressedName below!
@ -123,15 +123,15 @@ pub struct TXT {
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct RP {
mbox: DnsCanonicalName,
txt: DnsCanonicalName,
pub mbox: DnsCanonicalName,
pub txt: DnsCanonicalName,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct AFSDB {
subtype: u16,
hostname: DnsCanonicalName,
pub subtype: u16,
pub hostname: DnsCanonicalName,
}
// https://tools.ietf.org/html/rfc1183#section-3.1 says "its format in
@ -146,20 +146,20 @@ pub struct AFSDB {
//
// #[RRClass(ANY)]
// pub struct X25 {
// psdn_address: ShortText,
// pub psdn_address: ShortText,
// }
// #[RRClass(ANY)]
// pub struct ISDN {
// isdn_address: ShortText,
// subaddress: Option<ShortText>,
// pub isdn_address: ShortText,
// pub subaddress: Option<ShortText>,
// }
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct RT {
preference: u16,
intermediate: DnsCanonicalName,
pub preference: u16,
pub intermediate: DnsCanonicalName,
}
// #[RRClass(ANY)]
@ -170,55 +170,55 @@ pub struct RT {
#[RRTypeName = "NSAP-PTR"]
#[RRClass(ANY)]
pub struct NSAP_PTR {
owner: DnsCanonicalName,
pub owner: DnsCanonicalName,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct SIG {
rr_type: Type,
algorithm: u8,
labels: u8,
pub rr_type: Type,
pub algorithm: u8,
pub labels: u8,
// RFC says this can be omitted in text form if it is the same as
// the TTL on the SIG record. not supported to be omitted here
// (TODO?).
original_ttl: OptionalTTL,
signature_expiration: TimeStrict,
signature_inception: TimeStrict,
key_tag: u16,
signers_name: DnsCanonicalName,
signature: Base64RemainingBlob,
pub original_ttl: OptionalTTL,
pub signature_expiration: TimeStrict,
pub signature_inception: TimeStrict,
pub key_tag: u16,
pub signers_name: DnsCanonicalName,
pub signature: Base64RemainingBlob,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct KEY {
flags: u16,
protocol: u8,
algorithm: u8,
public_key: Base64RemainingBlob,
pub flags: u16,
pub protocol: u8,
pub algorithm: u8,
pub public_key: Base64RemainingBlob,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(IN)]
pub struct PX {
preference: u16,
map822: DnsCanonicalName,
mapx400: DnsCanonicalName,
pub preference: u16,
pub map822: DnsCanonicalName,
pub mapx400: DnsCanonicalName,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)] // not restricted in rfc 1712
pub struct GPOS {
longitude: ShortText,
latitude: ShortText,
altitude: ShortText,
pub longitude: ShortText,
pub latitude: ShortText,
pub altitude: ShortText,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(IN)]
pub struct AAAA {
addr: Ipv6Addr,
pub addr: Ipv6Addr,
}
pub use super::weird_structs::LOC;
@ -226,8 +226,8 @@ pub use super::weird_structs::LOC;
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct NXT {
next: DnsCanonicalName,
types: NxtTypeBitmap,
pub next: DnsCanonicalName,
pub types: NxtTypeBitmap,
}
// #[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
@ -241,10 +241,10 @@ pub struct NXT {
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(IN)]
pub struct SRV {
preference: u16,
weight: u16,
port: u16,
target: DnsCanonicalName,
pub preference: u16,
pub weight: u16,
pub port: u16,
pub target: DnsCanonicalName,
}
// #[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
@ -254,28 +254,28 @@ pub struct SRV {
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct NAPTR {
order: u16,
preference: u16,
flags: ShortText,
service: ShortText,
regexp: ShortText,
replacement: DnsCanonicalName,
pub order: u16,
pub preference: u16,
pub flags: ShortText,
pub service: ShortText,
pub regexp: ShortText,
pub replacement: DnsCanonicalName,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(IN)]
pub struct KX {
preference: u16,
exchanger: DnsCanonicalName,
pub preference: u16,
pub exchanger: DnsCanonicalName,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
// #[RRClass(?)]
pub struct CERT {
cert_type: u16,
key_tag: u16,
algorithm: u8,
certificate: Base64RemainingBlob,
pub cert_type: u16,
pub key_tag: u16,
pub algorithm: u8,
pub certificate: Base64RemainingBlob,
}
pub use super::weird_structs::A6;
@ -283,7 +283,7 @@ pub use super::weird_structs::A6;
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct DNAME {
target: DnsCanonicalName,
pub target: DnsCanonicalName,
}
// #[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
@ -301,20 +301,20 @@ pub struct DNAME {
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct DS {
key_tag: u16,
algorithm: u8,
digest_type: u8,
digest: HexRemainingBlob,
pub key_tag: u16,
pub algorithm: u8,
pub digest_type: u8,
pub digest: HexRemainingBlob,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
// #[RRClass(?)]
pub struct SSHFP {
algorithm: u8,
fingerprint_type: u8,
pub algorithm: u8,
pub fingerprint_type: u8,
// RFC 4255 doesn't specify whether whitespace is allowed.
// `HexRemainingBlob` allows whitespace.
fingerprint: HexRemainingBlob,
pub fingerprint: HexRemainingBlob,
}
pub use super::weird_structs::IPSECKEY;
@ -322,77 +322,77 @@ pub use super::weird_structs::IPSECKEY;
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct RRSIG {
rr_type: Type,
algorithm: u8,
labels: u8,
original_ttl: u32,
signature_expiration: Time,
signature_inception: Time,
key_tag: u16,
signers_name: DnsCanonicalName,
signature: Base64RemainingBlob,
pub rr_type: Type,
pub algorithm: u8,
pub labels: u8,
pub original_ttl: u32,
pub signature_expiration: Time,
pub signature_inception: Time,
pub key_tag: u16,
pub signers_name: DnsCanonicalName,
pub signature: Base64RemainingBlob,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct NSEC {
next: DnsName, // RFC 6840 says not canonic (updates RFC 4034)
types: NsecTypeBitmap,
pub next: DnsName, // RFC 6840 says not canonic (updates RFC 4034)
pub types: NsecTypeBitmap,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct DNSKEY {
flags: u16,
protocol: u8,
algorithm: u8,
public_key: Base64RemainingBlob,
pub flags: u16,
pub protocol: u8,
pub algorithm: u8,
pub public_key: Base64RemainingBlob,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(IN)]
pub struct DHCID {
content: Base64RemainingBlob,
pub content: Base64RemainingBlob,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct NSEC3 {
hash_algorithm: u8,
flags: u8,
iterations: u16,
salt: HexShortBlob,
next_hashed: NextHashedOwnerName,
types: NsecTypeBitmap,
pub hash_algorithm: u8,
pub flags: u8,
pub iterations: u16,
pub salt: HexShortBlob,
pub next_hashed: NextHashedOwnerName,
pub types: NsecTypeBitmap,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct NSEC3PARAM {
hash_algorithm: u8,
flags: u8,
iterations: u16,
salt: HexShortBlob,
pub hash_algorithm: u8,
pub flags: u8,
pub iterations: u16,
pub salt: HexShortBlob,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct TLSA {
// TODO: support acronyms from https://tools.ietf.org/html/rfc7218
cert_usage: u8,
selector: u8,
matching_type: u8,
data: HexRemainingBlob,
pub cert_usage: u8,
pub selector: u8,
pub matching_type: u8,
pub data: HexRemainingBlob,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct SMIMEA {
// TODO: support acronyms from https://tools.ietf.org/html/rfc7218
cert_usage: u8,
selector: u8,
matching_type: u8,
data: HexRemainingBlob,
pub cert_usage: u8,
pub selector: u8,
pub matching_type: u8,
pub data: HexRemainingBlob,
}
// #[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
@ -402,17 +402,17 @@ pub struct SMIMEA {
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct NINFO {
text: LongText,
pub text: LongText,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct RKEY {
flags: u16,
protocol: u8,
algorithm: u8,
public_key: Base64RemainingBlob,
pub flags: u16,
pub protocol: u8,
pub algorithm: u8,
pub public_key: Base64RemainingBlob,
}
// #[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
@ -422,25 +422,25 @@ pub struct RKEY {
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct CDS {
key_tag: u16,
algorithm: u8,
digest_type: u8,
digest: HexRemainingBlob,
pub key_tag: u16,
pub algorithm: u8,
pub digest_type: u8,
pub digest: HexRemainingBlob,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct CDNSKEY {
flags: u16,
protocol: u8,
algorithm: u8,
public_key: Base64RemainingBlob,
pub flags: u16,
pub protocol: u8,
pub algorithm: u8,
pub public_key: Base64RemainingBlob,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct OPENPGPKEY {
public_key: Base64RemainingBlob,
pub public_key: Base64RemainingBlob,
}
// #[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
@ -450,7 +450,7 @@ pub struct OPENPGPKEY {
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
// #[RRClass(?)]
pub struct SPF {
text: LongText,
pub text: LongText,
}
// #[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
@ -488,37 +488,37 @@ pub struct SPF {
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct EUI48 {
addr: EUI48Addr,
pub addr: EUI48Addr,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct EUI64 {
addr: EUI64Addr
pub addr: EUI64Addr
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct TKEY {
algorithm: DnsName,
inception: u32,
expiration: u32,
mode: u16,
error: u16,
key: Base64LongBlob,
other: Base64LongBlob,
pub algorithm: DnsName,
pub inception: u32,
pub expiration: u32,
pub mode: u16,
pub error: u16,
pub key: Base64LongBlob,
pub other: Base64LongBlob,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct TSIG {
algorithm: DnsName,
signed: Time48,
fudge: u16,
mac: Base64LongBlob,
original_id: u16,
error: u16,
other: Base64LongBlob,
pub algorithm: DnsName,
pub signed: Time48,
pub fudge: u16,
pub mac: Base64LongBlob,
pub original_id: u16,
pub error: u16,
pub other: Base64LongBlob,
}
// QTYPEs: IXFR, AXFR, MAILB, MAILA, ANY
@ -526,17 +526,17 @@ pub struct TSIG {
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct URI {
priority: u16,
weight: u16,
target: UriText,
pub priority: u16,
pub weight: u16,
pub target: UriText,
}
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
// #[RRClass(?)]
pub struct CAA {
flags: u8,
tag: UnquotedShortText,
value: RemainingText,
pub flags: u8,
pub tag: UnquotedShortText,
pub value: RemainingText,
}
// pub struct AVC;
@ -545,15 +545,15 @@ pub struct CAA {
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(ANY)]
pub struct DLV {
key_tag: u16,
algorithm: u8,
digest_type: u8,
digest: HexRemainingBlob,
pub key_tag: u16,
pub algorithm: u8,
pub digest_type: u8,
pub digest: HexRemainingBlob,
}
// powerdns
#[derive(Clone, PartialEq, Eq, Debug, DnsPacketData, DnsTextData, RRData)]
#[RRClass(IN)] // used to lookup A and AAAA - only useful in IN
pub struct ALIAS {
content: DnsName,
pub content: DnsName,
}

Loading…
Cancel
Save