Go to the source code of this file.
Functions | |
uint16_t | ldns_resolver_port (const ldns_resolver *r) |
Get the port the resolver should use. More... | |
ldns_rdf * | ldns_resolver_source (const ldns_resolver *r) |
Get the source address the resolver should use. More... | |
uint16_t | ldns_resolver_edns_udp_size (const ldns_resolver *r) |
Get the resolver's udp size. More... | |
uint8_t | ldns_resolver_retry (const ldns_resolver *r) |
Get the number of retries. More... | |
uint8_t | ldns_resolver_retrans (const ldns_resolver *r) |
Get the retransmit interval. More... | |
bool | ldns_resolver_fallback (const ldns_resolver *r) |
Get the truncation fallback status. More... | |
uint8_t | ldns_resolver_ip6 (const ldns_resolver *r) |
Does the resolver use ip6 or ip4. More... | |
bool | ldns_resolver_recursive (const ldns_resolver *r) |
Is the resolver set to recurse. More... | |
bool | ldns_resolver_debug (const ldns_resolver *r) |
Get the debug status of the resolver. More... | |
bool | ldns_resolver_dnsrch (const ldns_resolver *r) |
Does the resolver apply search list. More... | |
bool | ldns_resolver_fail (const ldns_resolver *r) |
Does the resolver only try the first nameserver. More... | |
bool | ldns_resolver_defnames (const ldns_resolver *r) |
Does the resolver apply default domain name. More... | |
ldns_rdf * | ldns_resolver_domain (const ldns_resolver *r) |
What is the default dname to add to relative queries. More... | |
ldns_rdf ** | ldns_resolver_searchlist (const ldns_resolver *r) |
What is the searchlist as used by the resolver. More... | |
ldns_rdf ** | ldns_resolver_nameservers (const ldns_resolver *r) |
Return the configured nameserver ip address. More... | |
size_t | ldns_resolver_nameserver_count (const ldns_resolver *r) |
How many nameserver are configured in the resolver. More... | |
bool | ldns_resolver_dnssec (const ldns_resolver *r) |
Does the resolver do DNSSEC. More... | |
bool | ldns_resolver_dnssec_cd (const ldns_resolver *r) |
Does the resolver set the CD bit. More... | |
ldns_rr_list * | ldns_resolver_dnssec_anchors (const ldns_resolver *r) |
Get the resolver's DNSSEC anchors. More... | |
bool | ldns_resolver_trusted_key (const ldns_resolver *r, ldns_rr_list *keys, ldns_rr_list *trusted_keys) |
Returns true if at least one of the provided keys is a trust anchor. More... | |
bool | ldns_resolver_igntc (const ldns_resolver *r) |
Does the resolver ignore the TC bit (truncated) More... | |
bool | ldns_resolver_usevc (const ldns_resolver *r) |
Does the resolver use tcp or udp. More... | |
size_t * | ldns_resolver_rtt (const ldns_resolver *r) |
Return the used round trip times for the nameservers. More... | |
size_t | ldns_resolver_nameserver_rtt (const ldns_resolver *r, size_t pos) |
Return the used round trip time for a specific nameserver. More... | |
struct timeval | ldns_resolver_timeout (const ldns_resolver *r) |
What is the timeout on socket connections. More... | |
const char * | ldns_resolver_tsig_keyname (const ldns_resolver *r) |
Return the tsig keyname as used by the nameserver. More... | |
const char * | ldns_resolver_tsig_algorithm (const ldns_resolver *r) |
Return the tsig algorithm as used by the nameserver. More... | |
const char * | ldns_resolver_tsig_keydata (const ldns_resolver *r) |
Return the tsig keydata as used by the nameserver. More... | |
bool | ldns_resolver_random (const ldns_resolver *r) |
Does the resolver randomize the nameserver before usage. More... | |
size_t | ldns_resolver_searchlist_count (const ldns_resolver *r) |
Return the resolver's searchlist count. More... | |
void | ldns_resolver_set_port (ldns_resolver *r, uint16_t p) |
Set the port the resolver should use. More... | |
void | ldns_resolver_set_source (ldns_resolver *r, ldns_rdf *s) |
Set the source rdf (address) the resolver should use. More... | |
ldns_rdf * | ldns_resolver_pop_nameserver (ldns_resolver *r) |
pop the last nameserver from the resolver. More... | |
ldns_status | ldns_resolver_push_nameserver (ldns_resolver *r, const ldns_rdf *n) |
Push a new nameserver to the resolver. More... | |
ldns_status | ldns_resolver_push_nameserver_rr (ldns_resolver *r, const ldns_rr *rr) |
Push a new nameserver to the resolver. More... | |
ldns_status | ldns_resolver_push_nameserver_rr_list (ldns_resolver *r, const ldns_rr_list *rrlist) |
Push a new nameserver rr_list to the resolver. More... | |
void | ldns_resolver_set_edns_udp_size (ldns_resolver *r, uint16_t s) |
Set maximum udp size. More... | |
void | ldns_resolver_set_recursive (ldns_resolver *r, bool re) |
Set the resolver recursion. More... | |
void | ldns_resolver_set_dnssec (ldns_resolver *r, bool d) |
Whether the resolver uses DNSSEC. More... | |
void | ldns_resolver_set_dnssec_cd (ldns_resolver *r, bool d) |
Whether the resolver uses the checking disable bit. More... | |
void | ldns_resolver_set_dnssec_anchors (ldns_resolver *r, ldns_rr_list *l) |
Set the resolver's DNSSEC anchor list directly. More... | |
ldns_status | ldns_resolver_push_dnssec_anchor (ldns_resolver *r, ldns_rr *rr) |
Push a new trust anchor to the resolver. More... | |
void | ldns_resolver_set_igntc (ldns_resolver *r, bool i) |
Whether or not to ignore the TC bit. More... | |
void | ldns_resolver_set_usevc (ldns_resolver *r, bool vc) |
Whether the resolver uses a virtual circuit (TCP) More... | |
void | ldns_resolver_set_debug (ldns_resolver *r, bool d) |
Set the resolver debugging. More... | |
void | ldns_resolver_set_ip6 (ldns_resolver *r, uint8_t ip6) |
Whether the resolver uses ip6. More... | |
void | ldns_resolver_set_fail (ldns_resolver *r, bool f) |
Whether or not to fail after one failed query. More... | |
void | ldns_resolver_set_nameserver_count (ldns_resolver *r, size_t c) |
Set the resolver's nameserver count directly. More... | |
void | ldns_resolver_set_dnsrch (ldns_resolver *r, bool d) |
Whether the resolver uses the searchlist. More... | |
void | ldns_resolver_set_retry (ldns_resolver *r, uint8_t retry) |
Set the number of times a resolver should retry a nameserver before the next one is tried. More... | |
void | ldns_resolver_set_retrans (ldns_resolver *r, uint8_t retrans) |
Set the resolver retrans timeout (in seconds) More... | |
void | ldns_resolver_set_fallback (ldns_resolver *r, bool fallback) |
Set whether the resolvers truncation fallback mechanism is used when ldns_resolver_query() is called. More... | |
void | ldns_resolver_set_nameservers (ldns_resolver *r, ldns_rdf **n) |
Set the resolver's nameserver count directly by using an rdf list. More... | |
void | ldns_resolver_set_defnames (ldns_resolver *r, bool d) |
Whether the resolver uses the name set with _set_domain. More... | |
void | ldns_resolver_set_rtt (ldns_resolver *r, size_t *rtt) |
Set round trip time for all nameservers. More... | |
void | ldns_resolver_set_nameserver_rtt (ldns_resolver *r, size_t pos, size_t value) |
Set round trip time for a specific nameserver. More... | |
void | ldns_resolver_incr_nameserver_count (ldns_resolver *r) |
Incremental the resolver's nameserver count. More... | |
void | ldns_resolver_dec_nameserver_count (ldns_resolver *r) |
Decrement the resolver's nameserver count. More... | |
void | ldns_resolver_set_domain (ldns_resolver *r, ldns_rdf *d) |
Set the resolver's default domain. More... | |
void | ldns_resolver_set_timeout (ldns_resolver *r, struct timeval timeout) |
Set the resolver's socket time out when talking to remote hosts. More... | |
void | ldns_resolver_push_searchlist (ldns_resolver *r, ldns_rdf *d) |
Push a new rd to the resolver's searchlist. More... | |
void | ldns_resolver_set_tsig_keyname (ldns_resolver *r, const char *tsig_keyname) |
Set the tsig key name. More... | |
void | ldns_resolver_set_tsig_algorithm (ldns_resolver *r, const char *tsig_algorithm) |
Set the tsig algorithm. More... | |
void | ldns_resolver_set_tsig_keydata (ldns_resolver *r, const char *tsig_keydata) |
Set the tsig key data. More... | |
void | ldns_resolver_set_random (ldns_resolver *r, bool b) |
Should the nameserver list be randomized before each use. More... | |
ldns_resolver * | ldns_resolver_new (void) |
Create a new resolver structure. More... | |
ldns_resolver * | ldns_resolver_clone (ldns_resolver *src) |
Clone a resolver. More... | |
ldns_status | ldns_resolver_new_frm_fp (ldns_resolver **res, FILE *fp) |
Create a resolver structure from a file like /etc/resolv.conf. More... | |
ldns_status | ldns_resolver_new_frm_fp_l (ldns_resolver **res, FILE *fp, int *line_nr) |
Create a resolver structure from a file like /etc/resolv.conf. More... | |
ldns_status | ldns_resolver_new_frm_file (ldns_resolver **res, const char *filename) |
Configure a resolver by means of a resolv.conf file The file may be NULL in which case there will be looked the RESOLV_CONF (defaults to /etc/resolv.conf) More... | |
void | ldns_resolver_free (ldns_resolver *res) |
Frees the allocated space for this resolver. More... | |
void | ldns_resolver_deep_free (ldns_resolver *res) |
Frees the allocated space for this resolver and all it's data. More... | |
ldns_status | ldns_resolver_search_status (ldns_pkt **pkt, ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags) |
Send the query for using the resolver and take the search list into account The search algorithm is as follows: If the name is absolute, try it as-is, otherwise apply the search list. More... | |
ldns_pkt * | ldns_resolver_search (const ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags) |
Send the query for using the resolver and take the search list into account The search algorithm is as follows: If the name is absolute, try it as-is, otherwise apply the search list. More... | |
ldns_status | ldns_resolver_query_status (ldns_pkt **pkt, ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags) |
Send a query to a nameserver. More... | |
ldns_pkt * | ldns_resolver_query (const ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags) |
Send a query to a nameserver. More... | |
ldns_status | ldns_resolver_send_pkt (ldns_pkt **answer, ldns_resolver *r, ldns_pkt *query_pkt) |
Send the given packet to a nameserver. More... | |
ldns_status | ldns_resolver_prepare_query_pkt (ldns_pkt **query_pkt, ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags) |
Form a query packet from a resolver and name/type/class combo. More... | |
ldns_status | ldns_resolver_send (ldns_pkt **answer, ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags) |
Send the query for name as-is. More... | |
ldns_rr * | ldns_axfr_next (ldns_resolver *resolver) |
Get the next stream of RRs in a AXFR. More... | |
void | ldns_axfr_abort (ldns_resolver *resolver) |
Abort a transfer that is in progress. More... | |
bool | ldns_axfr_complete (const ldns_resolver *res) |
Returns true if the axfr transfer has completed (i.e. More... | |
ldns_pkt * | ldns_axfr_last_pkt (const ldns_resolver *res) |
Returns a pointer to the last ldns_pkt that was sent by the server in the AXFR transfer usable for instance to get the error code on failure. More... | |
void | ldns_resolver_set_ixfr_serial (ldns_resolver *r, uint32_t serial) |
Get the serial for requesting IXFR. More... | |
uint32_t | ldns_resolver_get_ixfr_serial (const ldns_resolver *res) |
Get the serial for requesting IXFR. More... | |
void | ldns_resolver_nameservers_randomize (ldns_resolver *r) |
Randomize the nameserver list in the resolver. More... | |
uint16_t ldns_resolver_port | ( | const ldns_resolver * | r | ) |
Get the port the resolver should use.
[in] | r | the resolver |
Definition at line 24 of file resolver.c.
References ldns_struct_resolver::_port.
ldns_rdf* ldns_resolver_source | ( | const ldns_resolver * | r | ) |
Get the source address the resolver should use.
[in] | r | the resolver |
Definition at line 30 of file resolver.c.
References ldns_struct_resolver::_source.
uint16_t ldns_resolver_edns_udp_size | ( | const ldns_resolver * | r | ) |
Get the resolver's udp size.
[in] | r | the resolver |
Definition at line 36 of file resolver.c.
References ldns_struct_resolver::_edns_udp_size.
uint8_t ldns_resolver_retry | ( | const ldns_resolver * | r | ) |
Get the number of retries.
[in] | r | the resolver |
Definition at line 42 of file resolver.c.
References ldns_struct_resolver::_retry.
uint8_t ldns_resolver_retrans | ( | const ldns_resolver * | r | ) |
Get the retransmit interval.
[in] | r | the resolver |
Definition at line 48 of file resolver.c.
References ldns_struct_resolver::_retrans.
bool ldns_resolver_fallback | ( | const ldns_resolver * | r | ) |
Get the truncation fallback status.
[in] | r | the resolver |
Definition at line 54 of file resolver.c.
References ldns_struct_resolver::_fallback.
uint8_t ldns_resolver_ip6 | ( | const ldns_resolver * | r | ) |
Does the resolver use ip6 or ip4.
[in] | r | the resolver |
Definition at line 60 of file resolver.c.
References ldns_struct_resolver::_ip6.
bool ldns_resolver_recursive | ( | const ldns_resolver * | r | ) |
Is the resolver set to recurse.
[in] | r | the resolver |
Definition at line 66 of file resolver.c.
References ldns_struct_resolver::_recursive.
bool ldns_resolver_debug | ( | const ldns_resolver * | r | ) |
Get the debug status of the resolver.
[in] | r | the resolver |
Definition at line 72 of file resolver.c.
References ldns_struct_resolver::_debug.
bool ldns_resolver_dnsrch | ( | const ldns_resolver * | r | ) |
Does the resolver apply search list.
[in] | r | the resolver |
Definition at line 78 of file resolver.c.
References ldns_struct_resolver::_dnsrch.
bool ldns_resolver_fail | ( | const ldns_resolver * | r | ) |
Does the resolver only try the first nameserver.
[in] | r | the resolver |
Definition at line 84 of file resolver.c.
References ldns_struct_resolver::_fail.
bool ldns_resolver_defnames | ( | const ldns_resolver * | r | ) |
Does the resolver apply default domain name.
[in] | r | the resolver |
Definition at line 90 of file resolver.c.
References ldns_struct_resolver::_defnames.
ldns_rdf* ldns_resolver_domain | ( | const ldns_resolver * | r | ) |
What is the default dname to add to relative queries.
[in] | r | the resolver |
Definition at line 96 of file resolver.c.
References ldns_struct_resolver::_domain.
ldns_rdf** ldns_resolver_searchlist | ( | const ldns_resolver * | r | ) |
What is the searchlist as used by the resolver.
[in] | r | the resolver |
Definition at line 102 of file resolver.c.
References ldns_struct_resolver::_searchlist.
ldns_rdf** ldns_resolver_nameservers | ( | const ldns_resolver * | r | ) |
Return the configured nameserver ip address.
[in] | r | the resolver |
Definition at line 108 of file resolver.c.
References ldns_struct_resolver::_nameservers.
size_t ldns_resolver_nameserver_count | ( | const ldns_resolver * | r | ) |
How many nameserver are configured in the resolver.
[in] | r | the resolver |
Definition at line 114 of file resolver.c.
References ldns_struct_resolver::_nameserver_count.
bool ldns_resolver_dnssec | ( | const ldns_resolver * | r | ) |
Does the resolver do DNSSEC.
[in] | r | the resolver |
Definition at line 120 of file resolver.c.
References ldns_struct_resolver::_dnssec.
bool ldns_resolver_dnssec_cd | ( | const ldns_resolver * | r | ) |
Does the resolver set the CD bit.
[in] | r | the resolver |
Definition at line 126 of file resolver.c.
References ldns_struct_resolver::_dnssec_cd.
ldns_rr_list* ldns_resolver_dnssec_anchors | ( | const ldns_resolver * | r | ) |
Get the resolver's DNSSEC anchors.
[in] | r | the resolver |
Definition at line 132 of file resolver.c.
References ldns_struct_resolver::_dnssec_anchors.
bool ldns_resolver_trusted_key | ( | const ldns_resolver * | r, |
ldns_rr_list * | keys, | ||
ldns_rr_list * | trusted_keys | ||
) |
Returns true if at least one of the provided keys is a trust anchor.
[in] | r | the current resolver |
[in] | keys | the keyset to check |
[out] | trusted_keys | the subset of trusted keys in the 'keys' rrset |
Definition at line 138 of file resolver.c.
References ldns_resolver_dnssec_anchors(), ldns_rr_list_contains_rr(), ldns_rr_list_push_rr(), ldns_rr_list_rr(), and ldns_rr_list_rr_count().
bool ldns_resolver_igntc | ( | const ldns_resolver * | r | ) |
Does the resolver ignore the TC bit (truncated)
[in] | r | the resolver |
Definition at line 165 of file resolver.c.
References ldns_struct_resolver::_igntc.
bool ldns_resolver_usevc | ( | const ldns_resolver * | r | ) |
Does the resolver use tcp or udp.
[in] | r | the resolver |
Definition at line 171 of file resolver.c.
References ldns_struct_resolver::_usevc.
size_t* ldns_resolver_rtt | ( | const ldns_resolver * | r | ) |
Return the used round trip times for the nameservers.
[in] | r | the resolver |
Definition at line 177 of file resolver.c.
References ldns_struct_resolver::_rtt.
size_t ldns_resolver_nameserver_rtt | ( | const ldns_resolver * | r, |
size_t | pos | ||
) |
Return the used round trip time for a specific nameserver.
[in] | r | the resolver |
[in] | pos | the index to the nameserver |
Definition at line 183 of file resolver.c.
References ldns_resolver_nameserver_count(), and ldns_resolver_rtt().
struct timeval ldns_resolver_timeout | ( | const ldns_resolver * | r | ) |
What is the timeout on socket connections.
[in] | r | the resolver |
Definition at line 183 of file resolver.c.
const char* ldns_resolver_tsig_keyname | ( | const ldns_resolver * | r | ) |
Return the tsig keyname as used by the nameserver.
[in] | r | the resolver |
Definition at line 207 of file resolver.c.
References ldns_struct_resolver::_tsig_keyname.
const char* ldns_resolver_tsig_algorithm | ( | const ldns_resolver * | r | ) |
Return the tsig algorithm as used by the nameserver.
[in] | r | the resolver |
Definition at line 213 of file resolver.c.
References ldns_struct_resolver::_tsig_algorithm.
const char* ldns_resolver_tsig_keydata | ( | const ldns_resolver * | r | ) |
Return the tsig keydata as used by the nameserver.
[in] | r | the resolver |
Definition at line 219 of file resolver.c.
References ldns_struct_resolver::_tsig_keydata.
bool ldns_resolver_random | ( | const ldns_resolver * | r | ) |
Does the resolver randomize the nameserver before usage.
[in] | r | the resolver |
Definition at line 225 of file resolver.c.
References ldns_struct_resolver::_random.
size_t ldns_resolver_searchlist_count | ( | const ldns_resolver * | r | ) |
Return the resolver's searchlist count.
[in] | r | the resolver |
Definition at line 231 of file resolver.c.
References ldns_struct_resolver::_searchlist_count.
void ldns_resolver_set_port | ( | ldns_resolver * | r, |
uint16_t | p | ||
) |
Set the port the resolver should use.
[in] | r | the resolver |
[in] | p | the port number |
Definition at line 238 of file resolver.c.
References ldns_struct_resolver::_port.
void ldns_resolver_set_source | ( | ldns_resolver * | r, |
ldns_rdf * | s | ||
) |
Set the source rdf (address) the resolver should use.
[in] | r | the resolver |
[in] | s | the source address |
Definition at line 244 of file resolver.c.
References ldns_struct_resolver::_source.
ldns_rdf* ldns_resolver_pop_nameserver | ( | ldns_resolver * | r | ) |
pop the last nameserver from the resolver.
[in] | r | the resolver |
Definition at line 250 of file resolver.c.
References LDNS_FREE, ldns_resolver_dec_nameserver_count(), ldns_resolver_nameserver_count(), ldns_resolver_nameservers(), ldns_resolver_rtt(), ldns_resolver_set_nameservers(), ldns_resolver_set_rtt(), and LDNS_XREALLOC.
ldns_status ldns_resolver_push_nameserver | ( | ldns_resolver * | r, |
const ldns_rdf * | n | ||
) |
Push a new nameserver to the resolver.
It must be an IP address v4 or v6.
[in] | r | the resolver |
[in] | n | the ip address |
Definition at line 288 of file resolver.c.
References ldns_rdf_clone(), ldns_rdf_get_type(), LDNS_RDF_TYPE_A, LDNS_RDF_TYPE_AAAA, LDNS_RESOLV_RTT_MIN, ldns_resolver_incr_nameserver_count(), ldns_resolver_nameserver_count(), ldns_resolver_nameservers(), ldns_resolver_rtt(), ldns_resolver_set_nameservers(), ldns_resolver_set_rtt(), LDNS_STATUS_ERR, LDNS_STATUS_MEM_ERR, LDNS_STATUS_OK, LDNS_XMALLOC, and LDNS_XREALLOC.
ldns_status ldns_resolver_push_nameserver_rr | ( | ldns_resolver * | r, |
const ldns_rr * | rr | ||
) |
Push a new nameserver to the resolver.
It must be an A or AAAA RR record type
[in] | r | the resolver |
[in] | rr | the resource record |
Definition at line 335 of file resolver.c.
References ldns_resolver_push_nameserver(), ldns_rr_get_type(), ldns_rr_rdf(), LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA, and LDNS_STATUS_ERR.
ldns_status ldns_resolver_push_nameserver_rr_list | ( | ldns_resolver * | r, |
const ldns_rr_list * | rrlist | ||
) |
Push a new nameserver rr_list to the resolver.
[in] | r | the resolver |
[in] | rrlist | the rr_list to push |
Definition at line 351 of file resolver.c.
References ldns_resolver_push_nameserver_rr(), ldns_rr_list_rr(), ldns_rr_list_rr_count(), LDNS_STATUS_ERR, and LDNS_STATUS_OK.
void ldns_resolver_set_edns_udp_size | ( | ldns_resolver * | r, |
uint16_t | s | ||
) |
Set maximum udp size.
[in] | r | the resolver |
[in] | s | the udp max size |
Definition at line 373 of file resolver.c.
References ldns_struct_resolver::_edns_udp_size.
void ldns_resolver_set_recursive | ( | ldns_resolver * | r, |
bool | b | ||
) |
Set the resolver recursion.
[in] | r | the resolver |
[in] | b | true: set to recurse, false: unset |
Definition at line 379 of file resolver.c.
References ldns_struct_resolver::_recursive.
void ldns_resolver_set_dnssec | ( | ldns_resolver * | r, |
bool | b | ||
) |
Whether the resolver uses DNSSEC.
[in] | r | the resolver |
[in] | b | true: use DNSSEC, false: don't use DNSSEC |
Definition at line 385 of file resolver.c.
References ldns_struct_resolver::_dnssec.
void ldns_resolver_set_dnssec_cd | ( | ldns_resolver * | r, |
bool | b | ||
) |
Whether the resolver uses the checking disable bit.
[in] | r | the resolver |
[in] | b | true: enable , false: don't use TCP |
Definition at line 391 of file resolver.c.
References ldns_struct_resolver::_dnssec_cd.
void ldns_resolver_set_dnssec_anchors | ( | ldns_resolver * | r, |
ldns_rr_list * | l | ||
) |
Set the resolver's DNSSEC anchor list directly.
RRs should be of type DS or DNSKEY.
[in] | r | the resolver |
[in] | l | the list of RRs to use as trust anchors |
Definition at line 397 of file resolver.c.
References ldns_struct_resolver::_dnssec_anchors.
ldns_status ldns_resolver_push_dnssec_anchor | ( | ldns_resolver * | r, |
ldns_rr * | rr | ||
) |
Push a new trust anchor to the resolver.
It must be a DS or DNSKEY rr
[in] | r | the resolver. |
[in] | rr | the RR to add as a trust anchor. |
Definition at line 403 of file resolver.c.
References ldns_resolver_dnssec_anchors(), ldns_resolver_set_dnssec_anchors(), ldns_rr_clone(), ldns_rr_get_type(), ldns_rr_list_new(), ldns_rr_list_push_rr(), LDNS_RR_TYPE_DNSKEY, LDNS_RR_TYPE_DS, LDNS_STATUS_ERR, and LDNS_STATUS_OK.
void ldns_resolver_set_igntc | ( | ldns_resolver * | r, |
bool | b | ||
) |
Whether or not to ignore the TC bit.
[in] | r | the resolver |
[in] | b | true: yes ignore, false: don't ignore |
Definition at line 422 of file resolver.c.
References ldns_struct_resolver::_igntc.
void ldns_resolver_set_usevc | ( | ldns_resolver * | r, |
bool | b | ||
) |
Whether the resolver uses a virtual circuit (TCP)
[in] | r | the resolver |
[in] | b | true: use TCP, false: don't use TCP |
Definition at line 428 of file resolver.c.
References ldns_struct_resolver::_usevc.
void ldns_resolver_set_debug | ( | ldns_resolver * | r, |
bool | b | ||
) |
Set the resolver debugging.
[in] | r | the resolver |
[in] | b | true: debug on: false debug off |
Definition at line 434 of file resolver.c.
References ldns_struct_resolver::_debug.
void ldns_resolver_set_ip6 | ( | ldns_resolver * | r, |
uint8_t | i | ||
) |
Whether the resolver uses ip6.
[in] | r | the resolver |
[in] | i | 0: no pref, 1: ip4, 2: ip6 |
Definition at line 440 of file resolver.c.
References ldns_struct_resolver::_ip6.
void ldns_resolver_set_fail | ( | ldns_resolver * | r, |
bool | b | ||
) |
Whether or not to fail after one failed query.
[in] | r | the resolver |
[in] | b | true: yes fail, false: continue with next nameserver |
Definition at line 446 of file resolver.c.
References ldns_struct_resolver::_fail.
void ldns_resolver_set_nameserver_count | ( | ldns_resolver * | r, |
size_t | c | ||
) |
Set the resolver's nameserver count directly.
[in] | r | the resolver |
[in] | c | the nameserver count |
Definition at line 458 of file resolver.c.
References ldns_struct_resolver::_nameserver_count.
void ldns_resolver_set_dnsrch | ( | ldns_resolver * | r, |
bool | b | ||
) |
Whether the resolver uses the searchlist.
[in] | r | the resolver |
[in] | b | true: use the list, false: don't use the list |
Definition at line 464 of file resolver.c.
References ldns_struct_resolver::_dnsrch.
void ldns_resolver_set_retry | ( | ldns_resolver * | r, |
uint8_t | re | ||
) |
Set the number of times a resolver should retry a nameserver before the next one is tried.
[in] | r | the resolver |
[in] | re | the number of retries |
Definition at line 470 of file resolver.c.
References ldns_struct_resolver::_retry.
void ldns_resolver_set_retrans | ( | ldns_resolver * | r, |
uint8_t | re | ||
) |
Set the resolver retrans timeout (in seconds)
[in] | r | the resolver |
[in] | re | the retransmission interval in seconds |
Definition at line 476 of file resolver.c.
References ldns_struct_resolver::_retrans.
void ldns_resolver_set_fallback | ( | ldns_resolver * | r, |
bool | fallback | ||
) |
Set whether the resolvers truncation fallback mechanism is used when ldns_resolver_query() is called.
[in] | r | the resolver |
[in] | fallback | whether to use the fallback mechanism |
Definition at line 482 of file resolver.c.
References ldns_struct_resolver::_fallback.
void ldns_resolver_set_nameservers | ( | ldns_resolver * | r, |
ldns_rdf ** | rd | ||
) |
Set the resolver's nameserver count directly by using an rdf list.
[in] | r | the resolver |
[in] | rd | the resolver addresses |
Definition at line 488 of file resolver.c.
References ldns_struct_resolver::_nameservers.
void ldns_resolver_set_defnames | ( | ldns_resolver * | r, |
bool | b | ||
) |
Whether the resolver uses the name set with _set_domain.
[in] | r | the resolver |
[in] | b | true: use the defaults, false: don't use them |
Definition at line 494 of file resolver.c.
References ldns_struct_resolver::_defnames.
void ldns_resolver_set_rtt | ( | ldns_resolver * | r, |
size_t * | rtt | ||
) |
Set round trip time for all nameservers.
Note this currently differentiates between: unreachable and reachable.
[in] | r | the resolver |
[in] | rtt | a list with the times |
Definition at line 500 of file resolver.c.
References ldns_struct_resolver::_rtt.
void ldns_resolver_set_nameserver_rtt | ( | ldns_resolver * | r, |
size_t | pos, | ||
size_t | value | ||
) |
Set round trip time for a specific nameserver.
Note this currently differentiates between: unreachable and reachable.
[in] | r | the resolver |
[in] | pos | the nameserver position |
[in] | value | the rtt |
Definition at line 506 of file resolver.c.
References ldns_resolver_nameserver_count(), and ldns_resolver_rtt().
void ldns_resolver_incr_nameserver_count | ( | ldns_resolver * | r | ) |
Incremental the resolver's nameserver count.
[in] | r | the resolver |
Definition at line 523 of file resolver.c.
References ldns_resolver_nameserver_count(), and ldns_resolver_set_nameserver_count().
void ldns_resolver_dec_nameserver_count | ( | ldns_resolver * | r | ) |
Decrement the resolver's nameserver count.
[in] | r | the resolver |
Definition at line 532 of file resolver.c.
References ldns_resolver_nameserver_count(), and ldns_resolver_set_nameserver_count().
void ldns_resolver_set_domain | ( | ldns_resolver * | r, |
ldns_rdf * | rd | ||
) |
Set the resolver's default domain.
This gets appended when no absolute name is given
[in] | r | the resolver |
[in] | rd | the name to append |
Definition at line 545 of file resolver.c.
References ldns_struct_resolver::_domain.
void ldns_resolver_set_timeout | ( | ldns_resolver * | r, |
struct timeval | timeout | ||
) |
Set the resolver's socket time out when talking to remote hosts.
[in] | r | the resolver |
[in] | timeout | the timeout to use |
Definition at line 551 of file resolver.c.
References ldns_struct_resolver::_timeout.
void ldns_resolver_push_searchlist | ( | ldns_resolver * | r, |
ldns_rdf * | rd | ||
) |
Push a new rd to the resolver's searchlist.
[in] | r | the resolver |
[in] | rd | to push |
Definition at line 558 of file resolver.c.
References ldns_struct_resolver::_searchlist, ldns_rdf_clone(), ldns_rdf_get_type(), LDNS_RDF_TYPE_DNAME, ldns_resolver_searchlist(), ldns_resolver_searchlist_count(), and LDNS_XREALLOC.
void ldns_resolver_set_tsig_keyname | ( | ldns_resolver * | r, |
const char * | tsig_keyname | ||
) |
Set the tsig key name.
[in] | r | the resolver |
[in] | tsig_keyname | the tsig key name (copied into resolver) |
Definition at line 580 of file resolver.c.
References ldns_struct_resolver::_tsig_keyname, and LDNS_FREE.
void ldns_resolver_set_tsig_algorithm | ( | ldns_resolver * | r, |
const char * | tsig_algorithm | ||
) |
Set the tsig algorithm.
[in] | r | the resolver |
[in] | tsig_algorithm | the tsig algorithm (copied into resolver) |
Definition at line 587 of file resolver.c.
References ldns_struct_resolver::_tsig_algorithm, and LDNS_FREE.
void ldns_resolver_set_tsig_keydata | ( | ldns_resolver * | r, |
const char * | tsig_keydata | ||
) |
Set the tsig key data.
[in] | r | the resolver |
[in] | tsig_keydata | the key data (copied into resolver) |
Definition at line 594 of file resolver.c.
References ldns_struct_resolver::_tsig_keydata, and LDNS_FREE.
void ldns_resolver_set_random | ( | ldns_resolver * | r, |
bool | b | ||
) |
Should the nameserver list be randomized before each use.
[in] | r | the resolver |
[in] | b | true: randomize, false: don't |
Definition at line 601 of file resolver.c.
References ldns_struct_resolver::_random.
ldns_resolver* ldns_resolver_new | ( | void | ) |
Create a new resolver structure.
Definition at line 608 of file resolver.c.
References ldns_struct_resolver::_nameservers, ldns_struct_resolver::_rtt, ldns_struct_resolver::_searchlist, and LDNS_MALLOC.
ldns_resolver* ldns_resolver_clone | ( | ldns_resolver * | r | ) |
Clone a resolver.
[in] | r | the resolver to clone |
Definition at line 665 of file resolver.c.
References ldns_struct_resolver::_cur_axfr_pkt, ldns_struct_resolver::_dnssec_anchors, ldns_struct_resolver::_domain, ldns_struct_resolver::_nameserver_count, ldns_struct_resolver::_nameservers, ldns_struct_resolver::_rtt, ldns_struct_resolver::_searchlist, ldns_struct_resolver::_searchlist_count, ldns_struct_resolver::_tsig_algorithm, ldns_struct_resolver::_tsig_keydata, ldns_struct_resolver::_tsig_keyname, LDNS_FREE, LDNS_MALLOC, ldns_pkt_clone(), ldns_pkt_free(), ldns_rdf_clone(), ldns_rdf_deep_free(), ldns_rr_list_clone(), and LDNS_XMALLOC.
ldns_status ldns_resolver_new_frm_fp | ( | ldns_resolver ** | r, |
FILE * | fp | ||
) |
Create a resolver structure from a file like /etc/resolv.conf.
[out] | r | the new resolver |
[in] | fp | file pointer to create new resolver from if NULL use /etc/resolv.conf |
Definition at line 759 of file resolver.c.
References ldns_resolver_new_frm_fp_l().
ldns_status ldns_resolver_new_frm_fp_l | ( | ldns_resolver ** | r, |
FILE * | fp, | ||
int * | line_nr | ||
) |
Create a resolver structure from a file like /etc/resolv.conf.
[out] | r | the new resolver |
[in] | fp | file pointer to create new resolver from if NULL use /etc/resolv.conf |
[in] | line_nr | pointer to an integer containing the current line number (for debugging purposes) |
Definition at line 765 of file resolver.c.
References ldns_buffer_new_frm_data(), ldns_fget_token_l(), LDNS_MALLOC, LDNS_MAX_LINELEN, LDNS_PARSE_NORMAL, LDNS_PARSE_SKIP_SPACE, ldns_rdf_deep_free(), ldns_rdf_new_frm_str(), LDNS_RDF_TYPE_A, LDNS_RDF_TYPE_AAAA, LDNS_RDF_TYPE_DNAME, LDNS_RESOLV_ANCHOR, LDNS_RESOLV_CONF, LDNS_RESOLV_DEFDOMAIN, LDNS_RESOLV_KEYWORD, LDNS_RESOLV_KEYWORDS, LDNS_RESOLV_NAMESERVER, LDNS_RESOLV_OPTIONS, LDNS_RESOLV_SEARCH, LDNS_RESOLV_SORTLIST, ldns_resolver_deep_free(), ldns_resolver_new(), ldns_resolver_push_nameserver(), ldns_resolver_set_domain(), LDNS_STATUS_FILE_ERR, LDNS_STATUS_MEM_ERR, LDNS_STATUS_SYNTAX_DNAME_ERR, LDNS_STATUS_SYNTAX_ERR, and LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR.
ldns_status ldns_resolver_new_frm_file | ( | ldns_resolver ** | r, |
const char * | filename | ||
) |
Configure a resolver by means of a resolv.conf file The file may be NULL in which case there will be looked the RESOLV_CONF (defaults to /etc/resolv.conf)
[out] | r | the new resolver |
[in] | filename | the filename to use |
Definition at line 1002 of file resolver.c.
References LDNS_RESOLV_CONF, ldns_resolver_free(), ldns_resolver_new_frm_fp(), LDNS_STATUS_FILE_ERR, LDNS_STATUS_NULL, and LDNS_STATUS_OK.
void ldns_resolver_free | ( | ldns_resolver * | res | ) |
Frees the allocated space for this resolver.
Only frees the resolver pointer! You should probably be using _deep_free.
res | resolver to free |
Definition at line 1033 of file resolver.c.
References LDNS_FREE.
void ldns_resolver_deep_free | ( | ldns_resolver * | res | ) |
Frees the allocated space for this resolver and all it's data.
res | resolver to free |
Definition at line 1039 of file resolver.c.
References ldns_struct_resolver::_cur_axfr_pkt, ldns_struct_resolver::_dnssec_anchors, ldns_struct_resolver::_nameserver_count, ldns_struct_resolver::_nameservers, ldns_struct_resolver::_rtt, ldns_struct_resolver::_searchlist, ldns_struct_resolver::_socket, ldns_struct_resolver::_tsig_algorithm, ldns_struct_resolver::_tsig_keydata, ldns_struct_resolver::_tsig_keyname, close_socket, LDNS_FREE, ldns_pkt_free(), ldns_rdf_deep_free(), ldns_resolver_domain(), ldns_resolver_searchlist_count(), and ldns_rr_list_deep_free().
ldns_status ldns_resolver_search_status | ( | ldns_pkt ** | pkt, |
ldns_resolver * | r, | ||
const ldns_rdf * | rdf, | ||
ldns_rr_type | t, | ||
ldns_rr_class | c, | ||
uint16_t | flags | ||
) |
Send the query for using the resolver and take the search list into account The search algorithm is as follows: If the name is absolute, try it as-is, otherwise apply the search list.
[out] | pkt | a packet with the reply from the nameserver |
[in] | *r | operate using this resolver |
[in] | *rdf | query for this name |
[in] | t | query for this type (may be 0, defaults to A) |
[in] | c | query for this class (may be 0, default to IN) |
[in] | flags | the query flags |
Definition at line 1086 of file resolver.c.
References ldns_dname_absolute(), ldns_dname_cat_clone(), ldns_pkt_free(), ldns_pkt_get_rcode(), LDNS_RCODE_NOERROR, ldns_rdf_deep_free(), LDNS_RDF_TYPE_DNAME, ldns_resolver_dnsrch(), ldns_resolver_query_status(), ldns_resolver_searchlist(), ldns_resolver_searchlist_count(), and LDNS_STATUS_OK.
ldns_pkt* ldns_resolver_search | ( | const ldns_resolver * | r, |
const ldns_rdf * | rdf, | ||
ldns_rr_type | t, | ||
ldns_rr_class | c, | ||
uint16_t | flags | ||
) |
Send the query for using the resolver and take the search list into account The search algorithm is as follows: If the name is absolute, try it as-is, otherwise apply the search list.
[in] | *r | operate using this resolver |
[in] | *rdf | query for this name |
[in] | t | query for this type (may be 0, defaults to A) |
[in] | c | query for this class (may be 0, default to IN) |
[in] | flags | the query flags |
Definition at line 1130 of file resolver.c.
References ldns_pkt_free(), ldns_resolver_search_status(), and LDNS_STATUS_OK.
ldns_status ldns_resolver_query_status | ( | ldns_pkt ** | pkt, |
ldns_resolver * | r, | ||
const ldns_rdf * | name, | ||
ldns_rr_type | t, | ||
ldns_rr_class | c, | ||
uint16_t | flags | ||
) |
Send a query to a nameserver.
[out] | pkt | a packet with the reply from the nameserver |
[in] | *r | operate using this resolver |
[in] | *name | query for this name |
[in] | *t | query for this type (may be 0, defaults to A) |
[in] | *c | query for this class (may be 0, default to IN) |
[in] | flags | the query flags |
Definition at line 1143 of file resolver.c.
References ldns_dname_cat_clone(), ldns_rdf_free(), ldns_resolver_defnames(), ldns_resolver_domain(), ldns_resolver_send(), and LDNS_STATUS_MEM_ERR.
ldns_pkt* ldns_resolver_query | ( | const ldns_resolver * | r, |
const ldns_rdf * | name, | ||
ldns_rr_type | t, | ||
ldns_rr_class | c, | ||
uint16_t | flags | ||
) |
Send a query to a nameserver.
[in] | *r | operate using this resolver (despite the const in the declaration, the struct is altered as a side-effect) |
[in] | *name | query for this name |
[in] | *t | query for this type (may be 0, defaults to A) |
[in] | *c | query for this class (may be 0, default to IN) |
[in] | flags | the query flags |
Definition at line 1164 of file resolver.c.
References ldns_pkt_free(), ldns_resolver_query_status(), and LDNS_STATUS_OK.
ldns_status ldns_resolver_send_pkt | ( | ldns_pkt ** | answer, |
ldns_resolver * | r, | ||
ldns_pkt * | query_pkt | ||
) |
Send the given packet to a nameserver.
[out] | **answer | a pointer to a ldns_pkt pointer (initialized by this function) |
[in] | *r | operate using this resolver |
[in] | *query_pkt | query |
Definition at line 1206 of file resolver.c.
References ldns_pkt_edns_udp_size(), ldns_pkt_free(), ldns_pkt_set_edns_udp_size(), ldns_pkt_tc(), ldns_resolver_fallback(), ldns_resolver_usevc(), ldns_send(), and LDNS_STATUS_OK.
ldns_status ldns_resolver_prepare_query_pkt | ( | ldns_pkt ** | q, |
ldns_resolver * | r, | ||
const ldns_rdf * | name, | ||
ldns_rr_type | t, | ||
ldns_rr_class | c, | ||
uint16_t | f | ||
) |
Form a query packet from a resolver and name/type/class combo.
[out] | **q | a pointer to a ldns_pkt pointer (initialized by this function) |
[in] | *r | operate using this resolver |
[in] | *name | query for this name |
[in] | t | query for this type (may be 0, defaults to A) |
[in] | c | query for this class (may be 0, default to IN) |
[in] | f | the query flags |
Definition at line 1264 of file resolver.c.
References LDNS_CD, ldns_native2rdf_int32(), ldns_pkt_id(), ldns_pkt_ixfr_request_new(), ldns_pkt_print(), ldns_pkt_query_new(), ldns_pkt_set_cd(), ldns_pkt_set_edns_do(), ldns_pkt_set_edns_udp_size(), ldns_pkt_set_random_id(), ldns_pkt_set_timestamp(), ldns_rdf_clone(), LDNS_RDF_TYPE_INT32, ldns_resolver_debug(), ldns_resolver_dnssec(), ldns_resolver_dnssec_cd(), ldns_resolver_edns_udp_size(), ldns_resolver_get_ixfr_serial(), ldns_resolver_set_edns_udp_size(), ldns_rr_free(), ldns_rr_new(), ldns_rr_push_rdf(), ldns_rr_set_class(), ldns_rr_set_owner(), ldns_rr_set_question(), ldns_rr_set_type(), LDNS_RR_TYPE_IXFR, LDNS_RR_TYPE_SOA, LDNS_STATUS_ERR, LDNS_STATUS_OK, and ldns_str2rdf_dname().
ldns_status ldns_resolver_send | ( | ldns_pkt ** | answer, |
ldns_resolver * | r, | ||
const ldns_rdf * | name, | ||
ldns_rr_type | t, | ||
ldns_rr_class | c, | ||
uint16_t | flags | ||
) |
Send the query for name as-is.
[out] | **answer | a pointer to a ldns_pkt pointer (initialized by this function) |
[in] | *r | operate using this resolver |
[in] | *name | query for this name |
[in] | t | query for this type (may be 0, defaults to A) |
[in] | c | query for this class (may be 0, default to IN) |
[in] | flags | the query flags |
Definition at line 1375 of file resolver.c.
References ldns_pkt_free(), ldns_pkt_tsig_sign(), ldns_rdf_get_type(), LDNS_RDF_TYPE_DNAME, ldns_resolver_nameserver_count(), ldns_resolver_prepare_query_pkt(), ldns_resolver_send_pkt(), ldns_resolver_tsig_algorithm(), ldns_resolver_tsig_keydata(), ldns_resolver_tsig_keyname(), LDNS_RR_CLASS_IN, LDNS_RR_TYPE_A, LDNS_STATUS_CRYPTO_TSIG_ERR, LDNS_STATUS_OK, LDNS_STATUS_RES_NO_NS, and LDNS_STATUS_RES_QUERY.
ldns_rr* ldns_axfr_next | ( | ldns_resolver * | resolver | ) |
Get the next stream of RRs in a AXFR.
[in] | resolver | the resolver to use. First ldns_axfr_start() must be called |
Definition at line 1442 of file resolver.c.
References ldns_struct_resolver::_axfr_i, ldns_struct_resolver::_axfr_soa_count, ldns_struct_resolver::_cur_axfr_pkt, ldns_struct_resolver::_socket, ldns_struct_resolver::_timeout, close_socket, LDNS_FREE, ldns_get_errorstr_by_id(), ldns_lookup_by_id(), ldns_pkt_ancount(), ldns_pkt_answer(), ldns_pkt_free(), ldns_pkt_get_rcode(), ldns_rcodes, ldns_rr_clone(), ldns_rr_get_type(), ldns_rr_list_rr(), LDNS_RR_TYPE_SOA, LDNS_STATUS_OK, ldns_tcp_read_wire_timeout(), ldns_wire2pkt(), and ldns_struct_lookup_table::name.
void ldns_axfr_abort | ( | ldns_resolver * | resolver | ) |
Abort a transfer that is in progress.
[in] | resolver | the resolver that is used |
Definition at line 1534 of file resolver.c.
References ldns_struct_resolver::_socket.
bool ldns_axfr_complete | ( | const ldns_resolver * | resolver | ) |
Returns true if the axfr transfer has completed (i.e.
2 SOA RRs and no errors were encountered
[in] | resolver | the resolver that is used |
Definition at line 1549 of file resolver.c.
References ldns_struct_resolver::_axfr_soa_count.
ldns_pkt* ldns_axfr_last_pkt | ( | const ldns_resolver * | res | ) |
Returns a pointer to the last ldns_pkt that was sent by the server in the AXFR transfer usable for instance to get the error code on failure.
[in] | res | the resolver that was used in the axfr transfer |
Definition at line 1556 of file resolver.c.
References ldns_struct_resolver::_cur_axfr_pkt.
void ldns_resolver_set_ixfr_serial | ( | ldns_resolver * | r, |
uint32_t | serial | ||
) |
Get the serial for requesting IXFR.
[in] | r | the resolver |
[in] | serial | serial |
Definition at line 1562 of file resolver.c.
References ldns_struct_resolver::_serial.
uint32_t ldns_resolver_get_ixfr_serial | ( | const ldns_resolver * | res | ) |
Get the serial for requesting IXFR.
[in] | res | the resolver |
Definition at line 1568 of file resolver.c.
References ldns_struct_resolver::_serial.
void ldns_resolver_nameservers_randomize | ( | ldns_resolver * | r | ) |
Randomize the nameserver list in the resolver.
[in] | r | the resolver |
Definition at line 1576 of file resolver.c.
References ldns_get_random(), ldns_resolver_nameserver_count(), ldns_resolver_nameservers(), ldns_resolver_rtt(), and ldns_resolver_set_nameservers().