unbound: iterator/iter_resptype.h File Reference

unbound 0.1

Enumerations | Functions
iter_resptype.h File Reference

This file defines the response type. More...

## Enumerations
enum | response_type { RESPONSE_TYPE_UNTYPED = 0 , RESPONSE_TYPE_ANSWER , RESPONSE_TYPE_REFERRAL , RESPONSE_TYPE_CNAME , RESPONSE_TYPE_THROWAWAY , RESPONSE_TYPE_LAME , RESPONSE_TYPE_REC_LAME }
| The response type is used to interpret the response. More...

## Functions
enum response_type | response_type_from_cache (struct dns_msg *msg, struct query_info *request)
| Classifies a response message from cache based on the current request.
enum response_type | response_type_from_server (int rdset, struct dns_msg *msg, struct query_info *request, struct delegpt *dp)
| Classifies a response message (from the wire) based on the current request.

## Detailed Description

This file defines the response type.

DNS Responses can be classified as one of the response types.

## Enumeration Type Documentation

## ◆ response_type

enum response_type

The response type is used to interpret the response.

Enumerator
RESPONSE_TYPE_UNTYPED | 'untyped' means that the type of this response hasn't been assigned.
RESPONSE_TYPE_ANSWER | 'answer' means that the response terminates the resolution process.
RESPONSE_TYPE_REFERRAL | 'delegation' means that the response is a delegation.
RESPONSE_TYPE_CNAME | 'cname' means that the response is a cname without the final answer, and thus must be restarted.
RESPONSE_TYPE_THROWAWAY | 'throwaway' means that this particular response should be discarded and the next nameserver should be contacted
RESPONSE_TYPE_LAME | 'lame' means that this particular response indicates that the nameserver knew nothing about the question.
RESPONSE_TYPE_REC_LAME | Recursion lame means that the nameserver is some sort of open recursor, and not authoritative for the question. It may know something, but not authoritatively.

## Function Documentation

## ◆ response_type_from_cache()

enum response_type response_type_from_cache | ( | struct dns_msg * | msg,
|  | struct query_info * | request
| ) |  |

Classifies a response message from cache based on the current request.

Note that this routine assumes that THROWAWAY or LAME responses will not occur. Also, it will not detect REFERRAL type messages, since those are (currently) automatically classified based on how they came from the cache (findDelegation() instead of lookup()).

Parameters

  msg | the message from the cache.
  request | the request that generated the response.

Returns
  the response type (CNAME or ANSWER).

References reply_info::an_numrrsets, packed_rrset_key::dname, reply_info::flags, FLAGS_GET_RCODE, get_cname_target(), LDNS_RR_TYPE_ANY, LDNS_RR_TYPE_CNAME, query_info::qclass, query_info::qname, query_info::qname_len, query_info::qtype, query_dname_compare(), dns_msg::rep, RESPONSE_TYPE_ANSWER, RESPONSE_TYPE_CNAME, ub_packed_rrset_key::rk, packed_rrset_key::rrset_class, reply_info::rrsets, and packed_rrset_key::type.

Referenced by processInitRequest().

## ◆ response_type_from_server()

enum response_type response_type_from_server | ( | int | rdset,
|  | struct dns_msg * | msg,
|  | struct query_info * | request,
|  | struct delegpt * | dp
| ) |  |

Classifies a response message (from the wire) based on the current request.

NOTE: currently this routine uses the AA bit in the response to help distinguish between some non-standard referrals and answers. It also relies somewhat on the originating zone to be accurate (for lameness detection, mostly).

Parameters

  rdset | if RD bit was sent in query sent by unbound.
  msg | the message from the cache.
  request | the request that generated the response.
  dp | The delegation point that was being queried when the response was returned.

Returns
  the response type (CNAME or ANSWER).

References reply_info::an_numrrsets, BIT_AA, BIT_RA, BIT_TC, packed_rrset_key::dname, dname_strict_subdomain_c(), dname_subdomain_c(), reply_info::flags, FLAGS_GET_RCODE, get_cname_target(), LDNS_RR_TYPE_ANY, LDNS_RR_TYPE_CNAME, LDNS_RR_TYPE_NS, LDNS_RR_TYPE_SOA, delegpt::name, reply_info::ns_numrrsets, query_info::qclass, query_info::qname, query_info::qname_len, query_info::qtype, query_dname_compare(), dns_msg::rep, RESPONSE_TYPE_ANSWER, RESPONSE_TYPE_CNAME, RESPONSE_TYPE_LAME, RESPONSE_TYPE_REC_LAME, RESPONSE_TYPE_REFERRAL, RESPONSE_TYPE_THROWAWAY, ub_packed_rrset_key::rk, packed_rrset_key::rrset_class, reply_info::rrsets, and packed_rrset_key::type.

Referenced by processPrimeResponse(), and processQueryResponse().