/build/ldns-00A0O8/ldns-1.8.4/resolver.c File Reference

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.
ldns_rdf * | ldns_resolver_source (const ldns_resolver *r)
| Get the source address the resolver should use.
uint16_t | ldns_resolver_edns_udp_size (const ldns_resolver *r)
| Get the resolver's udp size.
uint8_t | ldns_resolver_retry (const ldns_resolver *r)
| Get the number of retries.
uint8_t | ldns_resolver_retrans (const ldns_resolver *r)
| Get the retransmit interval.
signed char | ldns_resolver_fallback (const ldns_resolver *r)
| Get the truncation fallback status.
uint8_t | ldns_resolver_ip6 (const ldns_resolver *r)
| Does the resolver use ip6 or ip4.
signed char | ldns_resolver_recursive (const ldns_resolver *r)
| Is the resolver set to recurse.
signed char | ldns_resolver_debug (const ldns_resolver *r)
| Get the debug status of the resolver.
signed char | ldns_resolver_dnsrch (const ldns_resolver *r)
| Does the resolver apply search list.
signed char | ldns_resolver_fail (const ldns_resolver *r)
| Does the resolver only try the first nameserver.
signed char | ldns_resolver_defnames (const ldns_resolver *r)
| Does the resolver apply default domain name.
ldns_rdf * | ldns_resolver_domain (const ldns_resolver *r)
| What is the default dname to add to relative queries.
ldns_rdf ** | ldns_resolver_searchlist (const ldns_resolver *r)
| What is the searchlist as used by the resolver.
ldns_rdf ** | ldns_resolver_nameservers (const ldns_resolver *r)
| Return the configured nameserver ip address.
size_t | ldns_resolver_nameserver_count (const ldns_resolver *r)
| How many nameserver are configured in the resolver.
signed char | ldns_resolver_dnssec (const ldns_resolver *r)
| Does the resolver do DNSSEC.
signed char | ldns_resolver_dnssec_cd (const ldns_resolver *r)
| Does the resolver set the CD bit.
ldns_rr_list * | ldns_resolver_dnssec_anchors (const ldns_resolver *r)
| Get the resolver's DNSSEC anchors.
signed char | 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.
signed char | ldns_resolver_igntc (const ldns_resolver *r)
| Does the resolver ignore the TC bit (truncated).
signed char | ldns_resolver_usevc (const ldns_resolver *r)
| Does the resolver use tcp or udp.
size_t * | ldns_resolver_rtt (const ldns_resolver *r)
| Return the used round trip times for the nameservers.
size_t | ldns_resolver_nameserver_rtt (const ldns_resolver *r, size_t pos)
| Return the used round trip time for a specific nameserver.
struct timeval | ldns_resolver_timeout (const ldns_resolver *r)
| What is the timeout on socket connections.
const char * | ldns_resolver_tsig_keyname (const ldns_resolver *r)
| Return the tsig keyname as used by the nameserver.
const char * | ldns_resolver_tsig_algorithm (const ldns_resolver *r)
| Return the tsig algorithm as used by the nameserver.
const char * | ldns_resolver_tsig_keydata (const ldns_resolver *r)
| Return the tsig keydata as used by the nameserver.
signed char | ldns_resolver_random (const ldns_resolver *r)
| Does the resolver randomize the nameserver before usage.
size_t | ldns_resolver_searchlist_count (const ldns_resolver *r)
| Return the resolver's searchlist count.
void | ldns_resolver_set_port (ldns_resolver *r, uint16_t p)
| Set the port the resolver should use.
void | ldns_resolver_set_source (ldns_resolver *r, ldns_rdf *s)
| Set the source rdf (address) the resolver should use.
ldns_rdf * | ldns_resolver_pop_nameserver (ldns_resolver *r)
| pop the last nameserver from the resolver.
ldns_status | ldns_resolver_push_nameserver (ldns_resolver *r, const ldns_rdf *n)
| Push a new nameserver to the resolver.
ldns_status | ldns_resolver_push_nameserver_rr (ldns_resolver *r, const ldns_rr *rr)
| Push a new nameserver to the resolver.
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.
void | ldns_resolver_set_edns_udp_size (ldns_resolver *r, uint16_t s)
| Set maximum udp size.
void | ldns_resolver_set_recursive (ldns_resolver *r, signed char re)
| Set the resolver recursion.
void | ldns_resolver_set_dnssec (ldns_resolver *r, signed char d)
| Whether the resolver uses DNSSEC.
void | ldns_resolver_set_dnssec_cd (ldns_resolver *r, signed char d)
| Whether the resolver uses the checking disable bit.
void | ldns_resolver_set_dnssec_anchors (ldns_resolver *r, ldns_rr_list *l)
| Set the resolver's DNSSEC anchor list directly.
ldns_status | ldns_resolver_push_dnssec_anchor (ldns_resolver *r, ldns_rr *rr)
| Push a new trust anchor to the resolver.
void | ldns_resolver_set_igntc (ldns_resolver *r, signed char i)
| Whether or not to ignore the TC bit.
void | ldns_resolver_set_usevc (ldns_resolver *r, signed char vc)
| Whether the resolver uses a virtual circuit (TCP).
void | ldns_resolver_set_debug (ldns_resolver *r, signed char d)
| Set the resolver debugging.
void | ldns_resolver_set_ip6 (ldns_resolver *r, uint8_t ip6)
| Whether the resolver uses ip6.
void | ldns_resolver_set_fail (ldns_resolver *r, signed char f)
| Whether or not to fail after one failed query.
void | ldns_resolver_set_nameserver_count (ldns_resolver *r, size_t c)
| Set the resolver's nameserver count directly.
void | ldns_resolver_set_dnsrch (ldns_resolver *r, signed char d)
| Whether the resolver uses the searchlist.
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.
void | ldns_resolver_set_retrans (ldns_resolver *r, uint8_t retrans)
| Set the resolver retrans timeout (in seconds).
void | ldns_resolver_set_fallback (ldns_resolver *r, signed char fallback)
| Set whether the resolvers truncation fallback mechanism is used when ldns_resolver_query() is called.
void | ldns_resolver_set_nameservers (ldns_resolver *r, ldns_rdf **n)
| Set the resolver's nameserver count directly by using an rdf list.
void | ldns_resolver_set_defnames (ldns_resolver *r, signed char d)
| Whether the resolver uses the name set with _set_domain.
void | ldns_resolver_set_rtt (ldns_resolver *r, size_t *rtt)
| Set round trip time for all nameservers.
void | ldns_resolver_set_nameserver_rtt (ldns_resolver *r, size_t pos, size_t value)
| Set round trip time for a specific nameserver.
void | ldns_resolver_incr_nameserver_count (ldns_resolver *r)
| Incremental the resolver's nameserver count.
void | ldns_resolver_dec_nameserver_count (ldns_resolver *r)
| Decrement the resolver's nameserver count.
void | ldns_resolver_set_domain (ldns_resolver *r, ldns_rdf *d)
| Set the resolver's default domain.
void | ldns_resolver_set_timeout (ldns_resolver *r, struct timeval timeout)
| Set the resolver's socket time out when talking to remote hosts.
void | ldns_resolver_push_searchlist (ldns_resolver *r, ldns_rdf *d)
| Push a new rd to the resolver's searchlist.
void | ldns_resolver_set_tsig_keyname (ldns_resolver *r, const char *tsig_keyname)
| Set the tsig key name.
void | ldns_resolver_set_tsig_algorithm (ldns_resolver *r, const char *tsig_algorithm)
| Set the tsig algorithm.
void | ldns_resolver_set_tsig_keydata (ldns_resolver *r, const char *tsig_keydata)
| Set the tsig key data.
void | ldns_resolver_set_random (ldns_resolver *r, signed char b)
| Should the nameserver list be randomized before each use.
ldns_resolver * | ldns_resolver_new (void)
| Create a new resolver structure.
ldns_resolver * | ldns_resolver_clone (ldns_resolver *src)
| Clone a resolver.
ldns_status | ldns_resolver_new_frm_fp (ldns_resolver **res, FILE *fp)
| Create a resolver structure from a file like /etc/resolv.conf.
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.
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).
void | ldns_resolver_free (ldns_resolver *res)
| Frees the allocated space for this resolver.
void | ldns_resolver_deep_free (ldns_resolver *res)
| Frees the allocated space for this resolver and all it's data.
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.
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.
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.
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.
ldns_status | ldns_resolver_send_pkt (ldns_pkt **answer, ldns_resolver *r, ldns_pkt *query_pkt)
| Send the given packet to a nameserver.
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.
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.
ldns_rr * | ldns_axfr_next (ldns_resolver *resolver)
| Get the next stream of RRs in a AXFR.
void | ldns_axfr_abort (ldns_resolver *resolver)
| Abort a transfer that is in progress.
signed char | ldns_axfr_complete (const ldns_resolver *res)
| Returns true if the axfr transfer has completed (i.e.
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.
void | ldns_resolver_set_ixfr_serial (ldns_resolver *r, uint32_t serial)
| Get the serial for requesting IXFR.
uint32_t | ldns_resolver_get_ixfr_serial (const ldns_resolver *res)
| Get the serial for requesting IXFR.
void | ldns_resolver_nameservers_randomize (ldns_resolver *r)
| Randomize the nameserver list in the resolver.

## Function Documentation

## ldns_resolver_port()

uint16_t ldns_resolver_port | ( | const ldns_resolver * | r | ) |

Get the port the resolver should use.

Parameters

  [in] | r | the resolver

Returns
  the port number

Definition at line 24 of file resolver.c.

References ldns_struct_resolver::_port.

## ldns_resolver_source()

ldns_rdf * ldns_resolver_source | ( | const ldns_resolver * | r | ) |

Get the source address the resolver should use.

Parameters

  [in] | r | the resolver

Returns
  the source rdf

Definition at line 30 of file resolver.c.

References ldns_struct_resolver::_source.

## ldns_resolver_edns_udp_size()

uint16_t ldns_resolver_edns_udp_size | ( | const ldns_resolver * | r | ) |

Get the resolver's udp size.

Parameters

  [in] | r | the resolver

Returns
  the udp mesg size

Definition at line 36 of file resolver.c.

References ldns_struct_resolver::_edns_udp_size.

## ldns_resolver_retry()

uint8_t ldns_resolver_retry | ( | const ldns_resolver * | r | ) |

Get the number of retries.

Parameters

  [in] | r | the resolver

Returns
  the number of retries

Definition at line 42 of file resolver.c.

References ldns_struct_resolver::_retry.

## ldns_resolver_retrans()

uint8_t ldns_resolver_retrans | ( | const ldns_resolver * | r | ) |

Get the retransmit interval.

Parameters

  [in] | r | the resolver

Returns
  the retransmit interval

Definition at line 48 of file resolver.c.

References ldns_struct_resolver::_retrans.

## ldns_resolver_fallback()

signed char ldns_resolver_fallback | ( | const ldns_resolver * | r | ) |

Get the truncation fallback status.

Parameters

  [in] | r | the resolver

Returns
  whether the truncation fallback mechanism is used

Definition at line 54 of file resolver.c.

References ldns_struct_resolver::_fallback.

## ldns_resolver_ip6()

uint8_t ldns_resolver_ip6 | ( | const ldns_resolver * | r | ) |

Does the resolver use ip6 or ip4.

Parameters

  [in] | r | the resolver

Returns
  0: both, 1: ip4, 2:ip6

Definition at line 60 of file resolver.c.

References ldns_struct_resolver::_ip6.

## ldns_resolver_recursive()

signed char ldns_resolver_recursive | ( | const ldns_resolver * | r | ) |

Is the resolver set to recurse.

Parameters

  [in] | r | the resolver

Returns
  true if so, otherwise false

Definition at line 66 of file resolver.c.

References ldns_struct_resolver::_recursive.

## ldns_resolver_debug()

signed char ldns_resolver_debug | ( | const ldns_resolver * | r | ) |

Get the debug status of the resolver.

Parameters

  [in] | r | the resolver

Returns
  true if so, otherwise false

Definition at line 72 of file resolver.c.

References ldns_struct_resolver::_debug.

## ldns_resolver_dnsrch()

signed char ldns_resolver_dnsrch | ( | const ldns_resolver * | r | ) |

Does the resolver apply search list.

Parameters

  [in] | r | the resolver

Returns
  true: yes, false: no

Definition at line 78 of file resolver.c.

References ldns_struct_resolver::_dnsrch.

## ldns_resolver_fail()

signed char ldns_resolver_fail | ( | const ldns_resolver * | r | ) |

Does the resolver only try the first nameserver.

Parameters

  [in] | r | the resolver

Returns
  true: yes, fail, false: no, try the others

Definition at line 84 of file resolver.c.

References ldns_struct_resolver::_fail.

## ldns_resolver_defnames()

signed char ldns_resolver_defnames | ( | const ldns_resolver * | r | ) |

Does the resolver apply default domain name.

Parameters

  [in] | r | the resolver

Returns
  true: yes, false: no

Definition at line 90 of file resolver.c.

References ldns_struct_resolver::_defnames.

## ldns_resolver_domain()

ldns_rdf * ldns_resolver_domain | ( | const ldns_resolver * | r | ) |

What is the default dname to add to relative queries.

Parameters

  [in] | r | the resolver

Returns
  the dname which is added

Definition at line 96 of file resolver.c.

References ldns_struct_resolver::_domain.

## ldns_resolver_searchlist()

ldns_rdf ** ldns_resolver_searchlist | ( | const ldns_resolver * | r | ) |

What is the searchlist as used by the resolver.

Parameters

  [in] | r | the resolver

Returns
  a ldns_rdf pointer to a list of the addresses

Definition at line 102 of file resolver.c.

References ldns_struct_resolver::_searchlist.

## ldns_resolver_nameservers()

ldns_rdf ** ldns_resolver_nameservers | ( | const ldns_resolver * | r | ) |

Return the configured nameserver ip address.

Parameters

  [in] | r | the resolver

Returns
  a ldns_rdf pointer to a list of the addresses

Definition at line 108 of file resolver.c.

References ldns_struct_resolver::_nameservers.

## ldns_resolver_nameserver_count()

size_t ldns_resolver_nameserver_count | ( | const ldns_resolver * | r | ) |

How many nameserver are configured in the resolver.

Parameters

  [in] | r | the resolver

Returns
  number of nameservers

Definition at line 114 of file resolver.c.

References ldns_struct_resolver::_nameserver_count.

## ldns_resolver_dnssec()

signed char ldns_resolver_dnssec | ( | const ldns_resolver * | r | ) |

Does the resolver do DNSSEC.

Parameters

  [in] | r | the resolver

Returns
  true: yes, false: no

Definition at line 120 of file resolver.c.

References ldns_struct_resolver::_dnssec.

## ldns_resolver_dnssec_cd()

signed char ldns_resolver_dnssec_cd | ( | const ldns_resolver * | r | ) |

Does the resolver set the CD bit.

Parameters

  [in] | r | the resolver

Returns
  true: yes, false: no

Definition at line 126 of file resolver.c.

References ldns_struct_resolver::_dnssec_cd.

## ldns_resolver_dnssec_anchors()

ldns_rr_list * ldns_resolver_dnssec_anchors | ( | const ldns_resolver * | r | ) |

Get the resolver's DNSSEC anchors.

Parameters

  [in] | r | the resolver

Returns
  an rr_list containing trusted DNSSEC anchors

Definition at line 132 of file resolver.c.

References ldns_struct_resolver::_dnssec_anchors.

## ldns_resolver_trusted_key()

signed char 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.

Parameters

  [in] | r | the current resolver
  [in] | keys | the keyset to check
  [out] | trusted_keys | the subset of trusted keys in the 'keys' rrset

Returns
  true if at least one of the provided keys is a configured trust anchor

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().

## ldns_resolver_igntc()

signed char ldns_resolver_igntc | ( | const ldns_resolver * | r | ) |

Does the resolver ignore the TC bit (truncated).

Parameters

  [in] | r | the resolver

Returns
  true: yes, false: no

Definition at line 165 of file resolver.c.

References ldns_struct_resolver::_igntc.

## ldns_resolver_usevc()

signed char ldns_resolver_usevc | ( | const ldns_resolver * | r | ) |

Does the resolver use tcp or udp.

Parameters

  [in] | r | the resolver

Returns
  true: tcp, false: udp

Definition at line 171 of file resolver.c.

References ldns_struct_resolver::_usevc.

## ldns_resolver_rtt()

size_t * ldns_resolver_rtt | ( | const ldns_resolver * | r | ) |

Return the used round trip times for the nameservers.

Parameters

  [in] | r | the resolver

Returns
  a size_t* pointer to the list. yet)

Definition at line 177 of file resolver.c.

References ldns_struct_resolver::_rtt.

## ldns_resolver_nameserver_rtt()

size_t ldns_resolver_nameserver_rtt | ( | const ldns_resolver * | r,
|  | size_t | pos )

Return the used round trip time for a specific nameserver.

Parameters

  [in] | r | the resolver
  [in] | pos | the index to the nameserver

Returns
  the rrt, 0: infinite, >0: undefined (as of * yet)

Definition at line 183 of file resolver.c.

References ldns_resolver_nameserver_count(), and ldns_resolver_rtt().

## ldns_resolver_timeout()

struct timeval ldns_resolver_timeout | ( | const ldns_resolver * | r | ) |

What is the timeout on socket connections.

Parameters

  [in] | r | the resolver

Returns
  the timeout as struct timeval

Definition at line 201 of file resolver.c.

References ldns_resolver_timeout().

## ldns_resolver_tsig_keyname()

const char * ldns_resolver_tsig_keyname | ( | const ldns_resolver * | r | ) |

Return the tsig keyname as used by the nameserver.

Parameters

  [in] | r | the resolver

Returns
  the name used. Still owned by the resolver - change using ldns_resolver_set_tsig_keyname().

Definition at line 207 of file resolver.c.

References ldns_struct_resolver::_tsig_keyname.

## ldns_resolver_tsig_algorithm()

const char * ldns_resolver_tsig_algorithm | ( | const ldns_resolver * | r | ) |

Return the tsig algorithm as used by the nameserver.

Parameters

  [in] | r | the resolver

Returns
  the algorithm used. Still owned by the resolver - change using ldns_resolver_set_tsig_algorithm().

Definition at line 213 of file resolver.c.

References ldns_struct_resolver::_tsig_algorithm.

## ldns_resolver_tsig_keydata()

const char * ldns_resolver_tsig_keydata | ( | const ldns_resolver * | r | ) |

Return the tsig keydata as used by the nameserver.

Parameters

  [in] | r | the resolver

Returns
  the keydata used. Still owned by the resolver - change using ldns_resolver_set_tsig_keydata().

Definition at line 219 of file resolver.c.

References ldns_struct_resolver::_tsig_keydata.

## ldns_resolver_random()

signed char ldns_resolver_random | ( | const ldns_resolver * | r | ) |

Does the resolver randomize the nameserver before usage.

Parameters

  [in] | r | the resolver

Returns
  true: yes, false: no

Definition at line 225 of file resolver.c.

References ldns_struct_resolver::_random.

## ldns_resolver_searchlist_count()

size_t ldns_resolver_searchlist_count | ( | const ldns_resolver * | r | ) |

Return the resolver's searchlist count.

Parameters

  [in] | r | the resolver

Returns
  the searchlist count

Definition at line 231 of file resolver.c.

References ldns_struct_resolver::_searchlist_count.

## ldns_resolver_set_port()

void ldns_resolver_set_port | ( | ldns_resolver * | r,
|  | uint16_t | p )

Set the port the resolver should use.

Parameters

  [in] | r | the resolver
  [in] | p | the port number

Definition at line 238 of file resolver.c.

References ldns_struct_resolver::_port.

## ldns_resolver_set_source()

void ldns_resolver_set_source | ( | ldns_resolver * | r,
|  | ldns_rdf * | s )

Set the source rdf (address) the resolver should use.

Parameters

  [in] | r | the resolver
  [in] | s | the source address

Definition at line 244 of file resolver.c.

References ldns_struct_resolver::_source.

## ldns_resolver_pop_nameserver()

ldns_rdf * ldns_resolver_pop_nameserver | ( | ldns_resolver * | r | ) |

pop the last nameserver from the resolver.

Parameters

  [in] | r | the resolver

Returns
  the popped address or NULL if empty

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_resolver_push_nameserver()

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.

Parameters

  [in] | r | the resolver
  [in] | n | the ip address

Returns
  ldns_status a status

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_resolver_push_nameserver_rr()

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

Parameters

  [in] | r | the resolver
  [in] | rr | the resource record

Returns
  ldns_status a status

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_resolver_push_nameserver_rr_list()

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.

Parameters

  [in] | r | the resolver
  [in] | rrlist | the rr_list to push

Returns
  ldns_status a status

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.

## ldns_resolver_set_edns_udp_size()

void ldns_resolver_set_edns_udp_size | ( | ldns_resolver * | r,
|  | uint16_t | s )

Set maximum udp size.

Parameters

  [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.

## ldns_resolver_set_recursive()

void ldns_resolver_set_recursive | ( | ldns_resolver * | r,
|  | signed char | b )

Set the resolver recursion.

Parameters

  [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.

## ldns_resolver_set_dnssec()

void ldns_resolver_set_dnssec | ( | ldns_resolver * | r,
|  | signed char | b )

Whether the resolver uses DNSSEC.

Parameters

  [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.

## ldns_resolver_set_dnssec_cd()

void ldns_resolver_set_dnssec_cd | ( | ldns_resolver * | r,
|  | signed char | b )

Whether the resolver uses the checking disable bit.

Parameters

  [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.

## ldns_resolver_set_dnssec_anchors()

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.

Parameters

  [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_resolver_push_dnssec_anchor()

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

Parameters

  [in] | r | the resolver.
  [in] | rr | the RR to add as a trust anchor.

Returns
  a status

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.

## ldns_resolver_set_igntc()

void ldns_resolver_set_igntc | ( | ldns_resolver * | r,
|  | signed char | b )

Whether or not to ignore the TC bit.

Parameters

  [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.

## ldns_resolver_set_usevc()

void ldns_resolver_set_usevc | ( | ldns_resolver * | r,
|  | signed char | b )

Whether the resolver uses a virtual circuit (TCP).

Parameters

  [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.

## ldns_resolver_set_debug()

void ldns_resolver_set_debug | ( | ldns_resolver * | r,
|  | signed char | b )

Set the resolver debugging.

Parameters

  [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.

## ldns_resolver_set_ip6()

void ldns_resolver_set_ip6 | ( | ldns_resolver * | r,
|  | uint8_t | i )

Whether the resolver uses ip6.

Parameters

  [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.

## ldns_resolver_set_fail()

void ldns_resolver_set_fail | ( | ldns_resolver * | r,
|  | signed char | b )

Whether or not to fail after one failed query.

Parameters

  [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.

## ldns_resolver_set_nameserver_count()

void ldns_resolver_set_nameserver_count | ( | ldns_resolver * | r,
|  | size_t | c )

Set the resolver's nameserver count directly.

Parameters

  [in] | r | the resolver
  [in] | c | the nameserver count

Definition at line 458 of file resolver.c.

References ldns_struct_resolver::_nameserver_count.

## ldns_resolver_set_dnsrch()

void ldns_resolver_set_dnsrch | ( | ldns_resolver * | r,
|  | signed char | b )

Whether the resolver uses the searchlist.

Parameters

  [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.

## ldns_resolver_set_retry()

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.

Parameters

  [in] | r | the resolver
  [in] | re | the number of retries

Definition at line 470 of file resolver.c.

References ldns_struct_resolver::_retry.

## ldns_resolver_set_retrans()

void ldns_resolver_set_retrans | ( | ldns_resolver * | r,
|  | uint8_t | re )

Set the resolver retrans timeout (in seconds).

Parameters

  [in] | r | the resolver
  [in] | re | the retransmission interval in seconds

Definition at line 476 of file resolver.c.

References ldns_struct_resolver::_retrans.

## ldns_resolver_set_fallback()

void ldns_resolver_set_fallback | ( | ldns_resolver * | r,
|  | signed char | fallback )

Set whether the resolvers truncation fallback mechanism is used when ldns_resolver_query() is called.

Parameters

  [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.

## ldns_resolver_set_nameservers()

void ldns_resolver_set_nameservers | ( | ldns_resolver * | r,
|  | ldns_rdf ** | rd )

Set the resolver's nameserver count directly by using an rdf list.

Parameters

  [in] | r | the resolver
  [in] | rd | the resolver addresses

Definition at line 488 of file resolver.c.

References ldns_struct_resolver::_nameservers.

## ldns_resolver_set_defnames()

void ldns_resolver_set_defnames | ( | ldns_resolver * | r,
|  | signed char | b )

Whether the resolver uses the name set with _set_domain.

Parameters

  [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.

## ldns_resolver_set_rtt()

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.

Parameters

  [in] | r | the resolver
  [in] | rtt | a list with the times

Definition at line 500 of file resolver.c.

References ldns_struct_resolver::_rtt.

## ldns_resolver_set_nameserver_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.

Parameters

  [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().

## ldns_resolver_incr_nameserver_count()

void ldns_resolver_incr_nameserver_count | ( | ldns_resolver * | r | ) |

Incremental the resolver's nameserver count.

Parameters

  [in] | r | the resolver

Definition at line 523 of file resolver.c.

References ldns_resolver_nameserver_count(), and ldns_resolver_set_nameserver_count().

## ldns_resolver_dec_nameserver_count()

void ldns_resolver_dec_nameserver_count | ( | ldns_resolver * | r | ) |

Decrement the resolver's nameserver count.

Parameters

  [in] | r | the resolver

Definition at line 532 of file resolver.c.

References ldns_resolver_nameserver_count(), and ldns_resolver_set_nameserver_count().

## ldns_resolver_set_domain()

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

Parameters

  [in] | r | the resolver
  [in] | rd | the name to append

Definition at line 545 of file resolver.c.

References ldns_struct_resolver::_domain.

## ldns_resolver_set_timeout()

void ldns_resolver_set_timeout | ( | ldns_resolver * | r,
|  | struct timeval | timeout )

Set the resolver's socket time out when talking to remote hosts.

Parameters

  [in] | r | the resolver
  [in] | timeout | the timeout to use

Definition at line 551 of file resolver.c.

References ldns_struct_resolver::_timeout.

## ldns_resolver_push_searchlist()

void ldns_resolver_push_searchlist | ( | ldns_resolver * | r,
|  | ldns_rdf * | rd )

Push a new rd to the resolver's searchlist.

Parameters

  [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.

## ldns_resolver_set_tsig_keyname()

void ldns_resolver_set_tsig_keyname | ( | ldns_resolver * | r,
|  | const char * | tsig_keyname )

Set the tsig key name.

Parameters

  [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.

## ldns_resolver_set_tsig_algorithm()

void ldns_resolver_set_tsig_algorithm | ( | ldns_resolver * | r,
|  | const char * | tsig_algorithm )

Set the tsig algorithm.

Parameters

  [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.

## ldns_resolver_set_tsig_keydata()

void ldns_resolver_set_tsig_keydata | ( | ldns_resolver * | r,
|  | const char * | tsig_keydata )

Set the tsig key data.

Parameters

  [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.

## ldns_resolver_set_random()

void ldns_resolver_set_random | ( | ldns_resolver * | r,
|  | signed char | b )

Should the nameserver list be randomized before each use.

Parameters

  [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_new()

ldns_resolver * ldns_resolver_new | ( | void |  | ) |

Create a new resolver structure.

Returns
  ldns_resolver* pointer to new structure

Definition at line 608 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::_nameservers, ldns_struct_resolver::_rtt, ldns_struct_resolver::_searchlist, ldns_struct_resolver::_socket, ldns_struct_resolver::_timeout, ldns_struct_resolver::_tsig_algorithm, ldns_struct_resolver::_tsig_keydata, ldns_struct_resolver::_tsig_keyname, LDNS_DEFAULT_TIMEOUT_SEC, LDNS_DEFAULT_TIMEOUT_USEC, LDNS_MALLOC, LDNS_PORT, LDNS_RESOLV_INETANY, ldns_resolver_set_debug(), ldns_resolver_set_defnames(), ldns_resolver_set_dnsrch(), ldns_resolver_set_dnssec(), ldns_resolver_set_dnssec_anchors(), ldns_resolver_set_dnssec_cd(), ldns_resolver_set_domain(), ldns_resolver_set_edns_udp_size(), ldns_resolver_set_fail(), ldns_resolver_set_fallback(), ldns_resolver_set_igntc(), ldns_resolver_set_ip6(), ldns_resolver_set_ixfr_serial(), ldns_resolver_set_nameserver_count(), ldns_resolver_set_port(), ldns_resolver_set_random(), ldns_resolver_set_recursive(), ldns_resolver_set_retrans(), ldns_resolver_set_retry(), ldns_resolver_set_source(), and ldns_resolver_set_usevc().

## ldns_resolver_clone()

ldns_resolver * ldns_resolver_clone | ( | ldns_resolver * | r | ) |

Clone a resolver.

Parameters

  [in] | r | the resolver to clone

Returns
  ldns_resolver* pointer to new structure

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_resolver_new_frm_fp()

ldns_status ldns_resolver_new_frm_fp | ( | ldns_resolver ** | r,
|  | FILE * | fp )

Create a resolver structure from a file like /etc/resolv.conf.

Parameters

  [out] | r | the new resolver
  [in] | fp | file pointer to create new resolver from if NULL use /etc/resolv.conf

Returns
  LDNS_STATUS_OK or the error

Definition at line 759 of file resolver.c.

References ldns_resolver_new_frm_fp_l().

## 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.

Parameters

  [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)

Returns
  LDNS_STATUS_OK or the error

Definition at line 765 of file resolver.c.

References ldns_bget_token(), ldns_buffer_free(), ldns_buffer_new_frm_data(), ldns_fget_token_l_resolv_conf(), LDNS_FREE, 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_read_anchor_file(), 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_dnssec_anchor(), ldns_resolver_push_nameserver(), ldns_resolver_push_searchlist(), ldns_resolver_set_domain(), ldns_rr_free(), LDNS_STATUS_FILE_ERR, LDNS_STATUS_MEM_ERR, LDNS_STATUS_NULL, LDNS_STATUS_OK, LDNS_STATUS_SYNTAX_DNAME_ERR, LDNS_STATUS_SYNTAX_ERR, and LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR.

## ldns_resolver_new_frm_file()

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).

Parameters

  [out] | r | the new resolver
  [in] | filename | the filename to use

Returns
  LDNS_STATUS_OK or the error

Definition at line 967 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.

## ldns_resolver_free()

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.

Parameters

  res | resolver to free

Definition at line 998 of file resolver.c.

References LDNS_FREE.

## ldns_resolver_deep_free()

void ldns_resolver_deep_free | ( | ldns_resolver * | res | ) |

Frees the allocated space for this resolver and all it's data.

Parameters

  res | resolver to free

Definition at line 1004 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_resolver_search_status()

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.

Parameters

  [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

Returns
  ldns_status LDNS_STATUS_OK on success

Definition at line 1051 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_resolver_search()

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.

Parameters

  [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

Returns
  ldns_pkt* a packet with the reply from the nameserver

Definition at line 1095 of file resolver.c.

References ldns_pkt_free(), ldns_resolver_search_status(), and LDNS_STATUS_OK.

## ldns_resolver_query_status()

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.

Parameters

  [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

Returns
  ldns_status LDNS_STATUS_OK on success if _defnames is true the default domain will be added

Definition at line 1108 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_resolver_query()

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.

Parameters

  [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

Returns
  ldns_pkt* a packet with the reply from the nameserver if _defnames is true the default domain will be added

Definition at line 1129 of file resolver.c.

References ldns_pkt_free(), ldns_resolver_query_status(), and LDNS_STATUS_OK.

## ldns_resolver_send_pkt()

ldns_status ldns_resolver_send_pkt | ( | ldns_pkt ** | answer,
|  | ldns_resolver * | r,
|  | ldns_pkt * | query_pkt )

Send the given packet to a nameserver.

Parameters

  [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 1171 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_set_usevc(), ldns_resolver_usevc(), ldns_send(), and LDNS_STATUS_OK.

## ldns_resolver_prepare_query_pkt()

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.

Parameters

  [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

Returns
  ldns_pkt* a packet with the reply from the nameserver

Definition at line 1229 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_resolver_send()

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.

Parameters

  [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

Returns
  ldns_status LDNS_STATUS_OK on success

Definition at line 1340 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_axfr_next()

ldns_rr * ldns_axfr_next | ( | ldns_resolver * | resolver | ) |

Get the next stream of RRs in a AXFR.

Parameters

  [in] | resolver | the resolver to use. First ldns_axfr_start() must be called

Returns
  ldns_rr the next RR from the AXFR stream After you get this returned RR (not NULL: on error), then check if ldns_axfr_complete() is true to see if the zone transfer has completed.

Definition at line 1407 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_axfr_next(), 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.

## ldns_axfr_abort()

void ldns_axfr_abort | ( | ldns_resolver * | resolver | ) |

Abort a transfer that is in progress.

Parameters

  [in] | resolver | the resolver that is used

Definition at line 1499 of file resolver.c.

References ldns_struct_resolver::_socket.

## ldns_axfr_complete()

signed char 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

Parameters

  [in] | resolver | the resolver that is used

Returns
  bool true if axfr transfer was completed without error

Definition at line 1514 of file resolver.c.

References ldns_struct_resolver::_axfr_soa_count.

## ldns_axfr_last_pkt()

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.

Parameters

  [in] | res | the resolver that was used in the axfr transfer

Returns
  ldns_pkt the last packet sent

Definition at line 1521 of file resolver.c.

References ldns_struct_resolver::_cur_axfr_pkt.

## ldns_resolver_set_ixfr_serial()

void ldns_resolver_set_ixfr_serial | ( | ldns_resolver * | r,
|  | uint32_t | serial )

Get the serial for requesting IXFR.

Parameters

  [in] | r | the resolver
  [in] | serial | serial

Definition at line 1527 of file resolver.c.

References ldns_struct_resolver::_serial.

## ldns_resolver_get_ixfr_serial()

uint32_t ldns_resolver_get_ixfr_serial | ( | const ldns_resolver * | res | ) |

Get the serial for requesting IXFR.

Parameters

  [in] | res | the resolver

Returns
  uint32_t serial

Definition at line 1533 of file resolver.c.

References ldns_struct_resolver::_serial.

## ldns_resolver_nameservers_randomize()

void ldns_resolver_nameservers_randomize | ( | ldns_resolver * | r | ) |

Randomize the nameserver list in the resolver.

Parameters

  [in] | r | the resolver

Definition at line 1541 of file resolver.c.

References ldns_get_random(), ldns_resolver_nameserver_count(), ldns_resolver_nameservers(), ldns_resolver_rtt(), and ldns_resolver_set_nameservers().