dns_message_parser/encode/rr/
rfc_3658.rs1use crate::encode::Encoder;
2use crate::rr::{SSHFPAlgorithm, SSHFPType, Type, SSHFP};
3use crate::EncodeResult;
4
5impl Encoder {
6 #[inline]
7 fn rr_sshfp_algorithm(&mut self, algorihtm: &SSHFPAlgorithm) {
8 self.u8(*algorihtm as u8);
9 }
10
11 #[inline]
12 fn rr_sshfp_type(&mut self, type_: &SSHFPType) {
13 self.u8(*type_ as u8);
14 }
15
16 pub(super) fn rr_sshfp(&mut self, ssh_fp: &SSHFP) -> EncodeResult<()> {
17 self.domain_name(&ssh_fp.domain_name)?;
18 self.rr_type(&Type::SSHFP);
19 self.rr_class(&ssh_fp.class);
20 self.u32(ssh_fp.ttl);
21 let length_index = self.create_length_index();
22 self.rr_sshfp_algorithm(&ssh_fp.algorithm);
23 self.rr_sshfp_type(&ssh_fp.type_);
24 self.vec(&ssh_fp.fp);
25 self.set_length_index(length_index)
26 }
27}
28
29impl_encode_rr!(SSHFP, rr_sshfp);