pub(super) fn handle_query(
        &self,
        mut query: Reader,
        response_buf: &mut [u8],
        over_tcp: bool,
    ) -> Response {
        // Read the query.
        let question = match read_query(&mut query) {
            Ok(question) => question,
            Err(maybe_question) => {
                return generate_error(
                    &query,
                    maybe_question.as_ref(),
                    Rcode::FormErr,
                    response_buf,
                );
            }
        };

        // Currently, the only special QTYPE we handle is * (ANY).
        if matches!(
            question.qtype,
            Qtype::IXFR | Qtype::AXFR | Qtype::MAILB | Qtype::MAILA
        ) {
            return generate_error(&query, Some(&question), Rcode::NotImp, response_buf);
        }

        // We do not support QCLASS * (ANY).
        if question.qclass == Qclass::ANY {
            return generate_error(&query, Some(&question), Rcode::NotImp, response_buf);
        }

        // When we support multiple zones, here is where we will find
        // the appropriate zone. But for now, we just make sure that the
        // QCLASS matches, and then we try to answer the query. The
        // answering logic currently takes care of responding REFUSED if
        // it turns out (after calling the Zone lookup methods) that the
        // QNAME is not part of the single zone we serve.
        if Class::from(question.qclass) != self.zone.class() {
            return generate_error(&query, Some(&question), Rcode::Refused, response_buf);
        }

        match handle_non_axfr_query(&self.zone, query, question, response_buf, over_tcp) {
            Some(response_len) => Response::Single(response_len),
            None => Response::None,
        }
    }
/// Handles a DNS message with opcode QUERY.
Handles a DNS message with opcode QUERY.
Handles a DNS message with opcode QUERY .
pub(super) fn handle_query(
        &self,
        mut query: Reader,
        response_buf: &mut [u8],
        over_tcp: bool,
    ) -> Response {
        // Read the query.
        let question = match read_query(&mut query) {
            Ok(question) => question,
            Err(maybe_question) => {
                return generate_error(
                    &query,
                    maybe_question.as_ref(),
                    Rcode::FormErr,
                    response_buf,
                );
            }
        };
        // Currently, the only special QTYPE we handle is * (ANY).
        if matches!(
            question.qtype,
            Qtype::IXFR | Qtype::AXFR | Qtype::MAILB | Qtype::MAILA
        ) {
            return generate_error(&query, Some(&question), Rcode::NotImp, response_buf);
        }
        // We do not support QCLASS * (ANY).
        if question.qclass == Qclass::ANY {
            return generate_error(&query, Some(&question), Rcode::NotImp, response_buf);
        }
        // When we support multiple zones, here is where we will find
        // the appropriate zone. But for now, we just make sure that the
        // QCLASS matches, and then we try to answer the query. The
        // answering logic currently takes care of responding REFUSED if
        // it turns out (after calling the Zone lookup methods) that the
        // QNAME is not part of the single zone we serve.
        if Class::from(question.qclass) != self.zone.class() {
            return generate_error(&query, Some(&question), Rcode::Refused, response_buf);
        }
        match handle_non_axfr_query(&self.zone, query, question, response_buf, over_tcp) {
            Some(response_len) => Response::Single(response_len),
            None => Response::None,
        }
    }
pub ( super ) fn handle_query ( & self , mut query : Reader , response_buf : & mut [ u8 ] , over_tcp : bool , ) -> Response { // Read the query. let question = match read_query ( & mut query ) { Ok ( question ) => question , Err ( maybe_question ) => { return generate_error ( & query , maybe_question . as_ref ( ) , Rcode :: FormErr , response_buf , ) ; } } ; // Currently, the only special QTYPE we handle is * (ANY). if matches ! ( question qtype Qtype IXFR Qtype AXFR Qtype MAILB Qtype MAILA ) { return generate_error ( & query , Some ( & question ) , Rcode :: NotImp , response_buf ) ; } // We do not support QCLASS * (ANY). if question . qclass == Qclass :: ANY { return generate_error ( & query , Some ( & question ) , Rcode :: NotImp , response_buf ) ; } // When we support multiple zones, here is where we will find // the appropriate zone. But for now, we just make sure that the // QCLASS matches, and then we try to answer the query. The // answering logic currently takes care of responding REFUSED if // it turns out (after calling the Zone lookup methods) that the // QNAME is not part of the single zone we serve. if Class :: from ( question . qclass ) != self . zone . class ( ) { return generate_error ( & query , Some ( & question ) , Rcode :: Refused , response_buf ) ; } match handle_non_axfr_query ( & self . zone , query , question , response_buf , over_tcp ) { Some ( response_len ) => Response :: Single ( response_len ) , None => Response :: None , } }
Handles a DNS message with opcode QUERY.
Handles a DNS message with opcode QUERY .
&self
query
Reader
response_buf
&mut [u8]
over_tcp
bool
&self
query
Reader
response_buf
&mut [u8]
over_tcp
bool