fn answer(zone: &Zone, qname: &Name, rr_type: Type, response: &mut Writer) -> ProcessingResult<()> {
    match zone.lookup(qname, rr_type) {
        LookupResult::Found(rrset) => {
            response.set_aa(true);
            response.add_answer_rrset(qname, rrset)?;
            do_additional_section_processing(zone, rrset, response)
        }
        LookupResult::Cname(cname_rrset) => do_cname(zone, qname, cname_rrset, rr_type, response),
        LookupResult::Referral(child_zone, ns_rrset) => {
            do_referral(zone, child_zone, ns_rrset, response)
        }
        LookupResult::NoRecords => {
            response.set_aa(true);
            add_negative_caching_soa(zone, response)
        }
        LookupResult::NxDomain => {
            response.set_rcode(Rcode::NxDomain);
            response.set_aa(true);
            add_negative_caching_soa(zone, response)
        }
        LookupResult::WrongZone => {
            response.set_rcode(Rcode::Refused);
            Ok(())
        }
    }
}
/// Answers a query for a specific RR type once the appropriate zone to
/// search has been determined.
Answers a query for a specific RR type once the appropriate zone to
search has been determined.
Answers a query for a specific RR type once the appropriate zone to search has been determined .
fn answer(zone: &Zone, qname: &Name, rr_type: Type, response: &mut Writer) -> ProcessingResult<()> {
    match zone.lookup(qname, rr_type) {
        LookupResult::Found(rrset) => {
            response.set_aa(true);
            response.add_answer_rrset(qname, rrset)?;
            do_additional_section_processing(zone, rrset, response)
        }
        LookupResult::Cname(cname_rrset) => do_cname(zone, qname, cname_rrset, rr_type, response),
        LookupResult::Referral(child_zone, ns_rrset) => {
            do_referral(zone, child_zone, ns_rrset, response)
        }
        LookupResult::NoRecords => {
            response.set_aa(true);
            add_negative_caching_soa(zone, response)
        }
        LookupResult::NxDomain => {
            response.set_rcode(Rcode::NxDomain);
            response.set_aa(true);
            add_negative_caching_soa(zone, response)
        }
        LookupResult::WrongZone => {
            response.set_rcode(Rcode::Refused);
            Ok(())
        }
    }
}
fn answer ( zone : & Zone , qname : & Name , rr_type : Type , response : & mut Writer ) -> ProcessingResult < ( ) > { match zone . lookup ( qname , rr_type ) { LookupResult :: Found ( rrset ) => { response . set_aa ( true ) ; response . add_answer_rrset ( qname , rrset ) ? ; do_additional_section_processing ( zone , rrset , response ) } LookupResult :: Cname ( cname_rrset ) => do_cname ( zone , qname , cname_rrset , rr_type , response ) , LookupResult :: Referral ( child_zone , ns_rrset ) => { do_referral ( zone , child_zone , ns_rrset , response ) } LookupResult :: NoRecords => { response . set_aa ( true ) ; add_negative_caching_soa ( zone , response ) } LookupResult :: NxDomain => { response . set_rcode ( Rcode :: NxDomain ) ; response . set_aa ( true ) ; add_negative_caching_soa ( zone , response ) } LookupResult :: WrongZone => { response . set_rcode ( Rcode :: Refused ) ; Ok ( ( ) ) } } }
Answers a query for a specific RR type once the appropriate zone to
search has been determined.
Answers a query for a specific RR type once the appropriate zone to search has been determined .
zone
&Zone
qname
&Name
rr_type
Type
response
&mut Writer
zone
&Zone
qname
&Name
rr_type
Type
response
&mut Writer