unbound: reply_info Struct Reference

unbound 0.1

Data Fields
reply_info Struct Reference

Structure to store DNS query and the reply packet. More...

`#include <msgreply.h>`

## Data Fields
uint16_t | flags
| the flags for the answer, host byte order.
uint8_t | authoritative
| This flag informs unbound the answer is authoritative and the AA flag should be preserved.
uint8_t | qdcount
| Number of RRs in the query section.
uint32_t | padding
| 32 bit padding to pad struct member alignment to 64 bits.
time_t | ttl
| TTL of the entire reply (for negative caching).
time_t | prefetch_ttl
| TTL for prefetch.
time_t | serve_expired_ttl
| Reply TTL extended with serve expired TTL, to limit time to serve expired message.
enum sec_status | security
| The security status from DNSSEC validation of this message.
sldns_ede_code | reason_bogus
| EDE (rfc8914) code with reason for DNSSEC bogus status.
size_t | an_numrrsets
| Number of RRsets in each section.
size_t | ns_numrrsets
| Count of authority section RRsets.
size_t | ar_numrrsets
| Count of additional section RRsets.
size_t | rrset_count
| number of RRsets: an_numrrsets + ns_numrrsets + ar_numrrsets
struct ub_packed_rrset_key ** | rrsets
| List of pointers (only) to the rrsets in the order in which they appear in the reply message.
struct rrset_ref | ref [1]
| Packed array of ids (see counts) and pointers to packed_rrset_key.

## Detailed Description

Structure to store DNS query and the reply packet.

To use it, copy over the flags from reply and modify using flags from the query (RD,CD if not AA). prepend ID.

Memory layout is: o struct o rrset_ref array o packed_rrset_key* array.

Memory layout is sometimes not packed, when the message is synthesized, for easy of the generation. It is allocated packed when it is copied from the region allocation to the malloc allocation.

## Field Documentation

## ◆ qdcount

uint8_t reply_info::qdcount

Number of RRs in the query section.

If qdcount is not 0, then it is 1, and the data that appears in the reply is the same as the query_info. Host byte order.

Referenced by construct_reply_info_base(), dns64_adjust_a(), dns_msg_create(), dump_msg(), error_response_cache(), load_msg(), local_encode(), msg_create(), processClassResponse(), reply_equal(), reply_info_copy(), reply_info_encode(), rpz_local_encode(), rrset_msg(), synth_dname_msg(), tomsg(), and val_new_getmsg().

## ◆ ttl

time_t reply_info::ttl

TTL of the entire reply (for negative caching).

only for use when there are 0 RRsets in this message. if there are RRsets, check those instead.

Referenced by answer_from_cache(), az_add_negative_soa(), bogus_del_msg(), construct_reply_info_base(), dns64_adjust_a(), dns_cache_store_msg(), dump_msg(), error_response_cache(), fill_res(), invalidateQueryInCache(), iter_prepend(), load_msg(), msg_ttl(), negative_del_msg(), parse_copy_decompress(), processClassResponse(), processFinished(), processInitRequest(), rdata_copy(), reply_info_copy(), reply_info_set_ttls(), rpz_local_encode(), rrset_msg(), synth_dname_msg(), tomsg(), worker_handle_request(), and zone_del_msg().

## ◆ prefetch_ttl

time_t reply_info::prefetch_ttl

TTL for prefetch.

After it has expired, a prefetch is suitable. Smaller than the TTL, otherwise the prefetch would not happen.

Referenced by az_add_negative_soa(), construct_reply_info_base(), dns64_adjust_a(), dns_cache_prefetch_adjust(), error_response_cache(), load_msg(), msg_ttl(), parse_copy_decompress(), processClassResponse(), processFinished(), processInitRequest(), reply_info_copy(), reply_info_set_ttls(), rrset_msg(), synth_dname_msg(), tomsg(), worker_handle_request(), and zone_del_msg().

## ◆ an_numrrsets

size_t reply_info::an_numrrsets

Number of RRsets in each section.

The answer section. Add up the RRs in every RRset to calculate the number of RRs, and the count for the dns packet. The number of RRs in RRsets can change due to RRset updates.

Referenced by add_synth_cname(), answer_from_cache(), az_change_dnames(), calc_data_need(), caps_strip_reply(), check_delegation_secure(), construct_reply_info_base(), deleg_remove_nonsecure_additional(), delegpt_add_neg_msg(), delegpt_from_message(), detect_wrongly_truncated(), dns64_adjust_a(), dns_cache_lookup(), dns_msg_ansadd(), ds_response_to_ke(), dump_msg(), errinf_reply(), extract_keys(), handle_cname_response(), iter_ds_toolow(), iter_msg_from_zone(), iter_msg_has_dnssec(), iter_prepend(), iter_scrub_ds(), iter_scrub_nxdomain(), load_msg(), local_encode(), msg_add_rrset_an(), needs_validation(), negative_del_msg(), pr_rrs(), print_packet_rrsets(), processClassResponse(), processFinished(), processQueryResponse(), processValidate(), remove_spurious_authority(), reply_check_cname_chain(), reply_equal(), reply_find_answer_rrset(), reply_find_final_cname_target(), reply_find_rrset_section_an(), reply_find_rrset_section_ns(), reply_find_soa(), reply_has_nsec(), reply_info_copy(), reply_info_encode(), reply_nsec_signer(), respip_addr_lookup(), respip_merge_cname(), response_type_from_cache(), response_type_from_server(), rpz_local_encode(), rrset_msg(), synth_dname_msg(), tomsg(), val_chase_cname(), val_check_nonsecure(), val_classify_response(), val_fill_reply(), val_find_DS(), val_find_signer(), val_has_signed_nsecs(), val_neg_addreferral(), val_neg_addreply(), val_nsec_prove_nodata_dsreply(), val_reply_remove_auth(), validate_any_response(), validate_cname_noanswer_response(), validate_cname_response(), validate_msg_signatures(), validate_nameerror_response(), validate_nodata_response(), and validate_positive_response().

## ◆ rrsets

struct ub_packed_rrset_key** reply_info::rrsets

List of pointers (only) to the rrsets in the order in which they appear in the reply message.

Number of elements is ancount+nscount+arcount RRsets. This is a pointer to that array. Use the accessor function for access.

Referenced by add_synth_cname(), addr_to_additional(), answer_from_cache(), az_add_negative_soa(), az_change_dnames(), az_generate_dname_answer(), calc_data_need(), caps_strip_reply(), check_delegation_secure(), check_the_rrsigs(), construct_reply_info_base(), deleg_remove_nonsecure_additional(), delegpt_from_message(), detect_wrongly_truncated(), dns64_adjust_a(), dns_cache_lookup(), dns_cache_store(), dns_cache_store_msg(), dns_msg_ansadd(), dns_msg_authadd(), dns_msg_create(), ds_response_to_ke(), dump_msg(), extract_keys(), fill_res(), find_add_ds(), find_NS(), find_rrset_type(), gen_dns_msg(), handle_cname_response(), insert_section(), iter_ds_toolow(), iter_msg_from_zone(), iter_msg_has_dnssec(), iter_prepend(), iter_scrub_ds(), iter_scrub_nxdomain(), iter_store_parentside_neg(), load_msg(), local_encode(), msg_add_rrset_an(), msg_add_rrset_ar(), msg_add_rrset_ns(), msg_grow_array(), msg_rrset_duplicate(), msg_ttl(), no_data_for_rrsig(), parse_copy_decompress(), pr_rrs(), print_dp_main(), print_packet_rrsets(), processClassResponse(), processInit(), processQueryResponse(), remove_spurious_authority(), repinfo_copy_rrsets(), reply_all_rrsets_secure(), reply_check_cname_chain(), reply_equal(), reply_find_answer_rrset(), reply_find_final_cname_target(), reply_find_rrset(), reply_find_rrset_section_an(), reply_find_rrset_section_ns(), reply_find_soa(), reply_get_NS_rrset(), reply_has_nsec(), reply_info_alloc_rrset_keys(), reply_info_encode(), reply_info_parsedelete(), reply_nsec_signer(), respip_addr_lookup(), respip_data_answer(), respip_merge_cname(), respip_rewrite_reply(), response_type_from_cache(), response_type_from_server(), rpz_add_soa(), rpz_local_encode(), rrset_msg(), store_rrsets(), synth_dname_msg(), tomsg(), val_chase_cname(), val_check_nonsecure(), val_classify_response(), val_fill_reply(), val_find_DS(), val_find_signer(), val_has_signed_nsecs(), val_mark_indeterminate(), val_mark_insecure(), val_neg_addreferral(), val_neg_addreply(), val_new_getmsg(), val_next_unchecked(), val_nsec_prove_nodata_dsreply(), val_reply_remove_auth(), validate_any_response(), validate_cname_noanswer_response(), validate_cname_response(), validate_msg_signatures(), validate_nameerror_response(), validate_nodata_response(), validate_positive_response(), validate_referral_response(), and verifytest_entry().

## ◆ ref

struct rrset_ref reply_info::ref[1]

Packed array of ids (see counts) and pointers to packed_rrset_key.

The number equals ancount+nscount+arcount RRsets. These are sorted in ascending pointer, the locking order. So this list can be locked (and id, ttl checked), to see if all the data is available and recent enough.

This is defined as an array of size 1, so that the compiler associates the identifier with this position in the structure. Array bound overflow on this array then gives access to the further elements of the array, which are allocated after the main structure.

It could be more pure to define as array of size 0, ref[0]. But ref[1] may be less confusing for compilers. Use the accessor function for access.

Referenced by answer_from_cache(), construct_reply_info_base(), dns_cache_store_msg(), dump_msg(), invalidateQueryInCache(), reply_info_set_ttls(), reply_info_sortref(), store_rrsets(), and tomsg().

The documentation for this struct was generated from the following file:

- util/data/msgreply.h