Skip to content

Commit 98478a5

Browse files
committed
add test min values to bytes ds
1 parent 39a24f9 commit 98478a5

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/message/rdata/ds_rdata.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ use crate::message::resource_record::{FromBytes, ToBytes};
1515
1616

1717
pub struct DsRdata {
18-
pub key_tag: u16,
19-
pub algorithm: u8,
20-
pub digest_type: u8,
21-
pub digest: Vec<u8>,
18+
pub key_tag: u16, //the key tag of the DNSKEY RR referred
19+
pub algorithm: u8, //the algorithm number of the DNSKEY RR referred to by the DS record.
20+
pub digest_type: u8, //the algorithm to construct the digest
21+
pub digest: Vec<u8>, //digest = digest_algorithm( DNSKEY owner name | DNSKEY RDATA);
2222
}
2323

2424
impl ToBytes for DsRdata{
@@ -220,4 +220,11 @@ mod ds_rdata_test{
220220
assert_eq!(ds_rdata.get_digest_type(), 0);
221221
assert_eq!(ds_rdata.get_digest(), vec![1, 2, 3]);
222222
}
223+
224+
#[test]
225+
fn to_bytes_min_values(){
226+
let ds_rdata = DsRdata::new(0, 0, 0, Vec::new());
227+
let ds_rdata_bytes = ds_rdata.to_bytes();
228+
assert_eq!(ds_rdata_bytes, vec![0, 0, 0, 0]);
229+
}
223230
}

0 commit comments

Comments
 (0)