ldns documentation

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Typedefs | Functions
resolver.h File Reference

Defines the ldns_resolver structure, a stub resolver that can send queries and parse answers. More...

Go to the source code of this file.

## Data Structures
struct | ldns_struct_resolver
| DNS stub resolver structure. More...

## Macros
#define | LDNS_RESOLV_CONF "/etc/resolv.conf"
| Default location of the resolv.conf file. More...
#define | LDNS_RESOLV_HOSTS "/etc/hosts"
| Default location of the hosts file. More...
#define | LDNS_RESOLV_KEYWORD -1
#define | LDNS_RESOLV_DEFDOMAIN 0
#define | LDNS_RESOLV_NAMESERVER 1
#define | LDNS_RESOLV_SEARCH 2
#define | LDNS_RESOLV_SORTLIST 3
#define | LDNS_RESOLV_OPTIONS 4
#define | LDNS_RESOLV_ANCHOR 5
#define | LDNS_RESOLV_KEYWORDS 6
#define | LDNS_RESOLV_INETANY 0
#define | LDNS_RESOLV_INET 1
#define | LDNS_RESOLV_INET6 2
#define | LDNS_RESOLV_RTT_INF 0 /* infinity */
#define | LDNS_RESOLV_RTT_MIN 1 /* reachable */

## Typedefs
typedef struct ldns_struct_resolver | ldns_resolver

## 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...
signed char | ldns_resolver_recursive (const ldns_resolver *r)
| Is the resolver set to recurse. More...
signed char | ldns_resolver_debug (const ldns_resolver *r)
| Get the debug status of the resolver. 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...
signed char | 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...
uint16_t | ldns_resolver_edns_udp_size (const ldns_resolver *r)
| Get the resolver's udp size. More...
signed char | ldns_resolver_usevc (const ldns_resolver *r)
| Does the resolver use tcp or udp. More...
signed char | ldns_resolver_fail (const ldns_resolver *r)
| Does the resolver only try the first nameserver. More...
signed char | ldns_resolver_defnames (const ldns_resolver *r)
| Does the resolver apply default domain name. More...
signed char | ldns_resolver_dnsrch (const ldns_resolver *r)
| Does the resolver apply search list. More...
signed char | ldns_resolver_dnssec (const ldns_resolver *r)
| Does the resolver do DNSSEC. More...
signed char | 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...
signed char | ldns_resolver_igntc (const ldns_resolver *r)
| Does the resolver ignore the TC bit (truncated) More...
signed char | ldns_resolver_random (const ldns_resolver *r)
| Does the resolver randomize the nameserver before usage. More...
size_t | ldns_resolver_nameserver_count (const ldns_resolver *r)
| How many nameserver are configured in the resolver. More...
ldns_rdf * | ldns_resolver_domain (const ldns_resolver *r)
| What is the default dname to add to relative queries. More...
struct timeval | ldns_resolver_timeout (const ldns_resolver *r)
| What is the timeout on socket connections. 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_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...
char * | ldns_resolver_tsig_keyname (const ldns_resolver *r)
| Return the tsig keyname as used by the nameserver. More...
char * | ldns_resolver_tsig_algorithm (const ldns_resolver *r)
| Return the tsig algorithm as used by the nameserver. More...
char * | ldns_resolver_tsig_keydata (const ldns_resolver *r)
| Return the tsig keydata as used by the nameserver. More...
ldns_rdf * | ldns_resolver_pop_nameserver (ldns_resolver *r)
| pop the last nameserver from the resolver. 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...
void | ldns_resolver_set_recursive (ldns_resolver *r, signed char b)
| Set the resolver recursion. More...
void | ldns_resolver_set_debug (ldns_resolver *r, signed char b)
| Set the resolver debugging. 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_nameserver_count (ldns_resolver *r, size_t c)
| Set the resolver's nameserver count directly. More...
void | ldns_resolver_set_nameservers (ldns_resolver *r, ldns_rdf **rd)
| Set the resolver's nameserver count directly by using an rdf list. More...
void | ldns_resolver_set_domain (ldns_resolver *r, ldns_rdf *rd)
| 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 *rd)
| Push a new rd to the resolver's searchlist. More...
void | ldns_resolver_set_defnames (ldns_resolver *r, signed char b)
| Whether the resolver uses the name set with _set_domain. More...
void | ldns_resolver_set_usevc (ldns_resolver *r, signed char b)
| Whether the resolver uses a virtual circuit (TCP) More...
void | ldns_resolver_set_dnsrch (ldns_resolver *r, signed char b)
| Whether the resolver uses the searchlist. More...
void | ldns_resolver_set_dnssec (ldns_resolver *r, signed char b)
| Whether the resolver uses DNSSEC. More...
void | ldns_resolver_set_dnssec_cd (ldns_resolver *r, signed char b)
| 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_retrans (ldns_resolver *r, uint8_t re)
| Set the resolver retrans timeout (in seconds) More...
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. More...
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. More...
void | ldns_resolver_set_ip6 (ldns_resolver *r, uint8_t i)
| Whether the resolver uses ip6. More...
void | ldns_resolver_set_fail (ldns_resolver *r, signed char b)
| Whether or not to fail after one failed query. More...
void | ldns_resolver_set_igntc (ldns_resolver *r, signed char b)
| Whether or not to ignore the TC bit. More...
void | ldns_resolver_set_edns_udp_size (ldns_resolver *r, uint16_t s)
| Set maximum udp size. More...
void | ldns_resolver_set_tsig_keyname (ldns_resolver *r, char *tsig_keyname)
| Set the tsig key name. More...
void | ldns_resolver_set_tsig_algorithm (ldns_resolver *r, char *tsig_algorithm)
| Set the tsig algorithm. More...
void | ldns_resolver_set_tsig_keydata (ldns_resolver *r, char *tsig_keydata)
| Set the tsig key data. 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_set_random (ldns_resolver *r, signed char b)
| Should the nameserver list be randomized before each use. More...
ldns_status | ldns_resolver_push_nameserver (ldns_resolver *r, ldns_rdf *n)
| Push a new nameserver to the resolver. More...
ldns_status | ldns_resolver_push_nameserver_rr (ldns_resolver *r, ldns_rr *rr)
| Push a new nameserver to the resolver. More...
ldns_status | ldns_resolver_push_nameserver_rr_list (ldns_resolver *r, ldns_rr_list *rrlist)
| Push a new nameserver rr_list to the resolver. More...
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. More...
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. More...
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. 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_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_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_resolver * | ldns_resolver_new (void)
| Create a new resolver structure. More...
ldns_status | ldns_resolver_new_frm_fp (ldns_resolver **r, FILE *fp)
| Create a resolver structure from a file like /etc/resolv.conf. More...
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. More...
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. 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_rr * | ldns_axfr_next (ldns_resolver *resolver)
| Get the next stream of RRs in a AXFR. More...
signed char | ldns_axfr_complete (const ldns_resolver *resolver)
| 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 uasable for instance to get the error code on failure. More...
void | ldns_resolver_nameservers_randomize (ldns_resolver *r)
| Randomize the nameserver list in the resolver. More...
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. More...

## Detailed Description

Defines the ldns_resolver structure, a stub resolver that can send queries and parse answers.

Definition in file resolver.h.

## Macro Definition Documentation

#define LDNS_RESOLV_CONF "/etc/resolv.conf"

Default location of the resolv.conf file.

Definition at line 36 of file resolver.h.

#define LDNS_RESOLV_HOSTS "/etc/hosts"

Default location of the hosts file.

Definition at line 38 of file resolver.h.

#define LDNS_RESOLV_KEYWORD -1

Definition at line 40 of file resolver.h.

#define LDNS_RESOLV_DEFDOMAIN 0

Definition at line 41 of file resolver.h.

#define LDNS_RESOLV_NAMESERVER 1

Definition at line 42 of file resolver.h.

#define LDNS_RESOLV_SEARCH 2

Definition at line 43 of file resolver.h.

#define LDNS_RESOLV_SORTLIST 3

Definition at line 44 of file resolver.h.

#define LDNS_RESOLV_OPTIONS 4

Definition at line 45 of file resolver.h.

#define LDNS_RESOLV_ANCHOR 5

Definition at line 46 of file resolver.h.

#define LDNS_RESOLV_KEYWORDS 6

Definition at line 47 of file resolver.h.

#define LDNS_RESOLV_INETANY 0

Definition at line 49 of file resolver.h.

#define LDNS_RESOLV_INET 1

Definition at line 50 of file resolver.h.

#define LDNS_RESOLV_INET6 2

Definition at line 51 of file resolver.h.

#define LDNS_RESOLV_RTT_INF 0 /* infinity */

Definition at line 53 of file resolver.h.

#define LDNS_RESOLV_RTT_MIN 1 /* reachable */

Definition at line 54 of file resolver.h.

## Typedef Documentation

typedef struct ldns_struct_resolver ldns_resolver

Definition at line 145 of file resolver.h.

## Function Documentation

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

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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_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 containg trusted DNSSEC anchors

Definition at line 132 of file resolver.c.

References ldns_struct_resolver::_dnssec_anchors.

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.

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.

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

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.

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

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.

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

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.

Definition at line 207 of file resolver.c.

References ldns_struct_resolver::_tsig_keyname.

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.

Definition at line 213 of file resolver.c.

References ldns_struct_resolver::_tsig_algorithm.

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.

Definition at line 219 of file resolver.c.

References ldns_struct_resolver::_tsig_keydata.

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.

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.

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.

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.

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

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

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

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

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.

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.

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.

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.

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.

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

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

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

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

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

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

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.

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

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.

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.

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

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

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.

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

Set the tsig key name.

Parameters

  [in] | r | the resolver
  [in] | tsig_keyname | the tsig key name

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,
|  | char * | tsig_algorithm
| ) |  |

Set the tsig algorithm.

Parameters

  [in] | r | the resolver
  [in] | tsig_algorithm | the tsig algorithm

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,
|  | char * | tsig_keydata
| ) |  |

Set the tsig key data.

Parameters

  [in] | r | the resolver
  [in] | tsig_keydata | the key data

Definition at line 594 of file resolver.c.

References ldns_struct_resolver::_tsig_keydata, and LDNS_FREE.

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.

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

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

ldns_status ldns_resolver_push_nameserver | ( | ldns_resolver * | r,
|  | 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_status ldns_resolver_push_nameserver_rr | ( | ldns_resolver * | r,
|  | 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_status ldns_resolver_push_nameserver_rr_list | ( | ldns_resolver * | r,
|  | 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_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 1024 of file resolver.c.

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

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 990 of file resolver.c.

References ldns_dname_absolute(), ldns_dname_cat_clone(), ldns_pkt_free(), ldns_pkt_get_rcode(), LDNS_RCODE_NOERROR, ldns_rdf_free(), ldns_resolver_dnsrch(), ldns_resolver_query_status(), ldns_resolver_searchlist(), ldns_resolver_searchlist_count(), 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.

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 1153 of file resolver.c.

References LDNS_CD, 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_resolver_debug(), ldns_resolver_dnssec(), ldns_resolver_dnssec_cd(), ldns_resolver_edns_udp_size(), ldns_resolver_set_edns_udp_size(), LDNS_RR_TYPE_IXFR, LDNS_STATUS_ERR, and LDNS_STATUS_OK.

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_pkt* a packet with the reply from the nameserver

Definition at line 1207 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_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 1097 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_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 1036 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.

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 1057 of file resolver.c.

References LDNS_FREE, ldns_pkt_free(), ldns_resolver_nameserver_count(), ldns_resolver_query_status(), ldns_resolver_rtt(), ldns_resolver_set_rtt(), LDNS_STATUS_OK, and LDNS_XMALLOC.

ldns_resolver* ldns_resolver_new | ( | void |  | ) |

Create a new resolver structure.

Returns
  ldns_resolver* pointer to new strcture

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_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_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 666 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.

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 672 of file resolver.c.

References ldns_bget_token(), ldns_buffer_free(), ldns_buffer_new_frm_data(), ldns_fget_token_l(), 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_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_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 908 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 pionter! You should probably be using _deep_free.

Parameters

  res | resolver to free

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

Parameters

  res | resolver to free

Definition at line 945 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::_tsig_algorithm, ldns_struct_resolver::_tsig_keydata, ldns_struct_resolver::_tsig_keyname, LDNS_FREE, ldns_pkt_free(), ldns_rdf_deep_free(), ldns_resolver_domain(), ldns_resolver_searchlist_count(), and ldns_rr_list_deep_free().

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 1274 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_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(), ldns_wire2pkt(), and ldns_struct_lookup_table::name.

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 1391 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 uasable 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 1398 of file resolver.c.

References ldns_struct_resolver::_cur_axfr_pkt.

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

Randomize the nameserver list in the resolver.

Parameters

  [in] | r | the resolver

Definition at line 1405 of file resolver.c.

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

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