ldns  1.7.0
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_rdfldns_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_listldns_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_rdfldns_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...
 
const char * ldns_resolver_tsig_keyname (const ldns_resolver *r)
 Return the tsig keyname as used by the nameserver. More...
 
const char * ldns_resolver_tsig_algorithm (const ldns_resolver *r)
 Return the tsig algorithm as used by the nameserver. More...
 
const char * ldns_resolver_tsig_keydata (const ldns_resolver *r)
 Return the tsig keydata as used by the nameserver. More...
 
ldns_rdfldns_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, const char *tsig_keyname)
 Set the tsig key name. More...
 
void ldns_resolver_set_tsig_algorithm (ldns_resolver *r, const char *tsig_algorithm)
 Set the tsig algorithm. More...
 
void ldns_resolver_set_tsig_keydata (ldns_resolver *r, const char *tsig_keydata)
 Set the tsig key data. More...
 
void ldns_resolver_set_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, const ldns_rdf *n)
 Push a new nameserver to the resolver. More...
 
ldns_status ldns_resolver_push_nameserver_rr (ldns_resolver *r, const ldns_rr *rr)
 Push a new nameserver to the resolver. More...
 
ldns_status ldns_resolver_push_nameserver_rr_list (ldns_resolver *r, const ldns_rr_list *rrlist)
 Push a new nameserver rr_list to the resolver. More...
 
ldns_pktldns_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_pktldns_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_resolverldns_resolver_new (void)
 Create a new resolver structure. More...
 
ldns_resolverldns_resolver_clone (ldns_resolver *r)
 Clone a resolver. 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_rrldns_axfr_next (ldns_resolver *resolver)
 Get the next stream of RRs in a AXFR. More...
 
void ldns_axfr_abort (ldns_resolver *resolver)
 Abort a transfer that is in progress. More...