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. More...
 
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. More...
 
uint32_t padding
 32 bit padding to pad struct member alignment to 64 bits. More...
 
time_t ttl
 TTL of the entire reply (for negative caching). More...
 
time_t prefetch_ttl
 TTL for prefetch. More...
 
enum sec_status security
 The security status from DNSSEC validation of this message.
 
size_t an_numrrsets
 Number of RRsets in each section. More...
 
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. More...
 
struct rrset_ref ref [1]
 Packed array of ids (see counts) and pointers to packed_rrset_key. More...
 

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

◆ flags

uint16_t reply_info::flags

◆ 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(), dns_msg_create(), dump_msg(), error_response_cache(), load_msg(), local_encode(), msg_create(), reply_equal(), reply_info_copy(), rrset_msg(), synth_dname_msg(), and tomsg().

◆ padding

uint32_t reply_info::padding

32 bit padding to pad struct member alignment to 64 bits.

◆ ttl

time_t reply_info::ttl

◆ 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 construct_reply_info_base(), dns_cache_prefetch_adjust(), error_response_cache(), load_msg(), msg_ttl(), parse_copy_decompress(), processFinished(), reply_info_copy(), reply_info_set_ttls(), rrset_msg(), synth_dname_msg(), and tomsg().

◆ 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 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(), dns_msg_ansadd(), dump_msg(), extract_keys(), handle_cname_response(), iter_ds_toolow(), iter_msg_from_zone(), iter_msg_has_dnssec(), iter_prepend(), iter_scrub_ds(), load_msg(), local_encode(), msg_add_rrset_an(), negative_del_msg(), pr_rrs(), print_packet_rrsets(), processFinished(), processQueryResponse(), 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_nsec_signer(), respip_addr_lookup(), rrset_msg(), synth_dname_msg(), tomsg(), val_chase_cname(), val_check_nonsecure(), val_fill_reply(), val_find_DS(), val_find_signer(), val_has_signed_nsecs(), val_neg_addreferral(), val_neg_addreply(), val_nsec_check_dlv(), 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 addr_to_additional(), answer_from_cache(), az_add_negative_soa(), az_change_dnames(), 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(), dns_cache_store(), dns_cache_store_msg(), dns_msg_ansadd(), dns_msg_authadd(), dns_msg_create(), dump_msg(), extract_keys(), fill_res(), find_NS(), find_rrset_type(), gen_dns_msg(), handle_cname_response(), iter_ds_toolow(), iter_msg_from_zone(), iter_msg_has_dnssec(), iter_prepend(), iter_scrub_ds(), 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(), 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_parsedelete(), reply_nsec_signer(), respip_addr_lookup(), respip_data_answer(), rrset_msg(), store_rrsets(), synth_dname_msg(), tomsg(), val_chase_cname(), val_check_nonsecure(), 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_next_unchecked(), 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: