ldns documentation

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

resolver.h
Go to the documentation of this file.
1 /*
2 * resolver.h
3 *
4 * DNS Resolver definitions
5 *
6 * a Net::DNS like library for C
7 *
8 * (c) NLnet Labs, 2005-2006
9 *
10 * See the file LICENSE for the license
11 */
12
20 #ifndef LDNS_RESOLVER_H
21 #define LDNS_RESOLVER_H
22
23 #include <ldns/error.h>
24 #include <ldns/common.h>
25 #include <ldns/rr.h>
26 #include <ldns/tsig.h>
27 #include <ldns/rdata.h>
28 #include <ldns/packet.h>
29 #include <sys/time.h>
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
36 #define LDNS_RESOLV_CONF "/etc/resolv.conf"
37
38 #define LDNS_RESOLV_HOSTS "/etc/hosts"
39
40 #define LDNS_RESOLV_KEYWORD -1
41 #define LDNS_RESOLV_DEFDOMAIN 0
42 #define LDNS_RESOLV_NAMESERVER 1
43 #define LDNS_RESOLV_SEARCH 2
44 #define LDNS_RESOLV_SORTLIST 3
45 #define LDNS_RESOLV_OPTIONS 4
46 #define LDNS_RESOLV_ANCHOR 5
47 #define LDNS_RESOLV_KEYWORDS 6
48
49 #define LDNS_RESOLV_INETANY 0
50 #define LDNS_RESOLV_INET 1
51 #define LDNS_RESOLV_INET6 2
52
53 #define LDNS_RESOLV_RTT_INF 0 /* infinity */
54 #define LDNS_RESOLV_RTT_MIN 1 /* reachable */
55
59 struct ldns_struct_resolver
60 {
62 uint16_t _port;
63
65 ldns_rdf **_nameservers;
67 size_t _nameserver_count; /* how many do we have */
68
70 size_t *_rtt;
71
73 bool _recursive;
74
76 bool _debug;
77
79 ldns_rdf *_domain;
80
82 ldns_rdf **_searchlist;
83
85 size_t _searchlist_count;
86
88 uint8_t _retry;
90 uint8_t _retrans;
92 bool _fallback;
93
95 bool _dnssec;
97 bool _dnssec_cd;
99 ldns_rr_list * _dnssec_anchors;
101 bool _usevc;
103 bool _igntc;
105 uint8_t _ip6;
107 bool _defnames;
109 bool _dnsrch;
111 struct timeval _timeout;
113 bool _fail;
115 bool _random;
117 int _socket;
121 int _axfr_soa_count;
122 /* when axfring we get complete packets from the server
123 but we want to give the caller 1 rr at a time, so
124 keep the current pkt */
126 ldns_pkt *_cur_axfr_pkt;
128 uint16_t _axfr_i;
129 /* EDNS0 available buffer size */
130 uint16_t _edns_udp_size;
131
132 /* Optional tsig key for signing queries,
133 outgoing messages are signed if and only if both are set
134 */
136 char *_tsig_keyname;
138 char *_tsig_keydata;
140 char *_tsig_algorithm;
141
143 ldns_rdf *_source;
144 };
145 typedef struct ldns_struct_resolver ldns_resolver;
146
147 /* prototypes */
148 /* read access functions */
149
155 uint16_t ldns_resolver_port(const ldns_resolver *r);
156
162 ldns_rdf *ldns_resolver_source(const ldns_resolver *r);
163
169 bool ldns_resolver_recursive(const ldns_resolver *r);
170
176 bool ldns_resolver_debug(const ldns_resolver *r);
177
183 uint8_t ldns_resolver_retry(const ldns_resolver *r);
184
190 uint8_t ldns_resolver_retrans(const ldns_resolver *r);
191
197 bool ldns_resolver_fallback(const ldns_resolver *r);
198
204 uint8_t ldns_resolver_ip6(const ldns_resolver *r);
205
211 uint16_t ldns_resolver_edns_udp_size(const ldns_resolver *r);
217 bool ldns_resolver_usevc(const ldns_resolver *r);
223 bool ldns_resolver_fail(const ldns_resolver *r);
229 bool ldns_resolver_defnames(const ldns_resolver *r);
235 bool ldns_resolver_dnsrch(const ldns_resolver *r);
241 bool ldns_resolver_dnssec(const ldns_resolver *r);
247 bool ldns_resolver_dnssec_cd(const ldns_resolver *r);
253 ldns_rr_list * ldns_resolver_dnssec_anchors(const ldns_resolver *r);
259 bool ldns_resolver_igntc(const ldns_resolver *r);
265 bool ldns_resolver_random(const ldns_resolver *r);
271 size_t ldns_resolver_nameserver_count(const ldns_resolver *r);
277 ldns_rdf *ldns_resolver_domain(const ldns_resolver *r);
283 struct timeval ldns_resolver_timeout(const ldns_resolver *r);
289 ldns_rdf** ldns_resolver_searchlist(const ldns_resolver *r);
295 ldns_rdf** ldns_resolver_nameservers(const ldns_resolver *r);
302 size_t * ldns_resolver_rtt(const ldns_resolver *r);
309 size_t ldns_resolver_nameserver_rtt(const ldns_resolver *r, size_t pos);
315 char *ldns_resolver_tsig_keyname(const ldns_resolver *r);
321 char *ldns_resolver_tsig_algorithm(const ldns_resolver *r);
327 char *ldns_resolver_tsig_keydata(const ldns_resolver *r);
333 ldns_rdf* ldns_resolver_pop_nameserver(ldns_resolver *r);
334
340 size_t ldns_resolver_searchlist_count(const ldns_resolver *r);
341
342 /* write access function */
348 void ldns_resolver_set_port(ldns_resolver *r, uint16_t p);
349
355 void ldns_resolver_set_source(ldns_resolver *r, ldns_rdf *s);
356
362 void ldns_resolver_set_recursive(ldns_resolver *r, bool b);
363
369 void ldns_resolver_set_debug(ldns_resolver *r, bool b);
370
375 void ldns_resolver_incr_nameserver_count(ldns_resolver *r);
376
381 void ldns_resolver_dec_nameserver_count(ldns_resolver *r);
382
388 void ldns_resolver_set_nameserver_count(ldns_resolver *r, size_t c);
389
395 void ldns_resolver_set_nameservers(ldns_resolver *r, ldns_rdf **rd);
396
403 void ldns_resolver_set_domain(ldns_resolver *r, ldns_rdf *rd);
404
410 void ldns_resolver_set_timeout(ldns_resolver *r, struct timeval timeout);
411
417 void ldns_resolver_push_searchlist(ldns_resolver *r, ldns_rdf *rd);
418
424 void ldns_resolver_set_defnames(ldns_resolver *r, bool b);
425
431 void ldns_resolver_set_usevc(ldns_resolver *r, bool b);
432
438 void ldns_resolver_set_dnsrch(ldns_resolver *r, bool b);
439
445 void ldns_resolver_set_dnssec(ldns_resolver *r, bool b);
446
452 void ldns_resolver_set_dnssec_cd(ldns_resolver *r, bool b);
458 void ldns_resolver_set_dnssec_anchors(ldns_resolver *r, ldns_rr_list * l);
459
466 ldns_status ldns_resolver_push_dnssec_anchor(ldns_resolver *r, ldns_rr *rr);
467
473 void ldns_resolver_set_retrans(ldns_resolver *r, uint8_t re);
474
481 void ldns_resolver_set_fallback(ldns_resolver *r, bool fallback);
482
489 void ldns_resolver_set_retry(ldns_resolver *r, uint8_t re);
490
496 void ldns_resolver_set_ip6(ldns_resolver *r, uint8_t i);
497
503 void ldns_resolver_set_fail(ldns_resolver *r, bool b);
504
510 void ldns_resolver_set_igntc(ldns_resolver *r, bool b);
511
517 void ldns_resolver_set_edns_udp_size(ldns_resolver *r, uint16_t s);
518
524 void ldns_resolver_set_tsig_keyname(ldns_resolver *r, char *tsig_keyname);
525
531 void ldns_resolver_set_tsig_algorithm(ldns_resolver *r, char *tsig_algorithm);
532
538 void ldns_resolver_set_tsig_keydata(ldns_resolver *r, char *tsig_keydata);
539
546 void ldns_resolver_set_rtt(ldns_resolver *r, size_t *rtt);
547
555 void ldns_resolver_set_nameserver_rtt(ldns_resolver *r, size_t pos, size_t value);
556
562 void ldns_resolver_set_random(ldns_resolver *r, bool b);
563
571 ldns_status ldns_resolver_push_nameserver(ldns_resolver *r, ldns_rdf *n);
572
580 ldns_status ldns_resolver_push_nameserver_rr(ldns_resolver *r, ldns_rr *rr);
581
588 ldns_status ldns_resolver_push_nameserver_rr_list(ldns_resolver *r, ldns_rr_list *rrlist);
589
602 ldns_pkt* ldns_resolver_search(const ldns_resolver *r, const ldns_rdf *rdf, ldns_rr_type t, ldns_rr_class c, uint16_t flags);
603
604
618 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);
619
631 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);
632
644 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);
645
652 ldns_status ldns_resolver_send_pkt(ldns_pkt **answer, ldns_resolver *r, ldns_pkt *query_pkt);
653
666 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);
667
668
682 ldns_pkt* ldns_resolver_query(const ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags);
683
684
689 ldns_resolver* ldns_resolver_new(void);
690
698 ldns_status ldns_resolver_new_frm_fp(ldns_resolver **r, FILE *fp);
699
708 ldns_status ldns_resolver_new_frm_fp_l(ldns_resolver **r, FILE *fp, int *line_nr);
709
718 ldns_status ldns_resolver_new_frm_file(ldns_resolver **r, const char *filename);
719
724 void ldns_resolver_free(ldns_resolver *res);
725
730 void ldns_resolver_deep_free(ldns_resolver *res);
731
740 ldns_rr* ldns_axfr_next(ldns_resolver *resolver);
741
747 bool ldns_axfr_complete(const ldns_resolver *resolver);
748
755 ldns_pkt *ldns_axfr_last_pkt(const ldns_resolver *res);
756
761 void ldns_resolver_nameservers_randomize(ldns_resolver *r);
762
770 bool ldns_resolver_trusted_key(const ldns_resolver *r, ldns_rr_list * keys, ldns_rr_list * trusted_keys);
771
772 #ifdef __cplusplus
773 }
774 #endif
775
776 #endif /* LDNS_RESOLVER_H */
ldns_resolver_push_nameserver
ldns_status ldns_resolver_push_nameserver(ldns_resolver *r, ldns_rdf *n)
Push a new nameserver to the resolver.
Definition: resolver.c:288
ldns_resolver_push_nameserver_rr
ldns_status ldns_resolver_push_nameserver_rr(ldns_resolver *r, ldns_rr *rr)
Push a new nameserver to the resolver.
Definition: resolver.c:335
ldns_axfr_next
ldns_rr * ldns_axfr_next(ldns_resolver *resolver)
Get the next stream of RRs in a AXFR.
Definition: resolver.c:1274
ldns_resolver_recursive
signed char ldns_resolver_recursive(const ldns_resolver *r)
Is the resolver set to recurse.
Definition: resolver.c:66
ldns_resolver_set_usevc
void ldns_resolver_set_usevc(ldns_resolver *r, signed char b)
Whether the resolver uses a virtual circuit (TCP)
ldns_resolver_searchlist
ldns_rdf ** ldns_resolver_searchlist(const ldns_resolver *r)
What is the searchlist as used by the resolver.
Definition: resolver.c:102
ldns_resolver_dnssec_anchors
ldns_rr_list * ldns_resolver_dnssec_anchors(const ldns_resolver *r)
Get the resolver&#39;s DNSSEC anchors.
Definition: resolver.c:132
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.
Definition: resolver.c:183
ldns_struct_resolver::_dnssec_anchors
ldns_rr_list * _dnssec_anchors
Optional trust anchors for complete DNSSEC validation.
Definition: resolver.h:99
ldns_struct_resolver
DNS stub resolver structure.
Definition: resolver.h:59
rdata.h
Defines ldns_rdf and functions to manipulate those.
ldns_struct_resolver::_fail
signed char _fail
Only try the first nameserver, and return with an error directly if it fails.
Definition: resolver.h:113
ldns_struct_resolver::_port
uint16_t _port
Port to send queries to.
Definition: resolver.h:62
ldns_rr_class
enum ldns_enum_rr_class ldns_rr_class
Definition: rr.h:64
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.
Definition: resolver.c:1153
ldns_struct_rr_list
List or Set of Resource Records.
Definition: rr.h:327
ldns_struct_resolver::_searchlist_count
size_t _searchlist_count
Number of entries in the searchlist array.
Definition: resolver.h:85
ldns_struct_resolver::_retrans
uint8_t _retrans
Time to wait before retrying.
Definition: resolver.h:90
ldns_resolver_source
ldns_rdf * ldns_resolver_source(const ldns_resolver *r)
Get the source address the resolver should use.
Definition: resolver.c:30
ldns_struct_resolver::_dnssec
signed char _dnssec
Whether to do DNSSEC.
Definition: resolver.h:95
ldns_resolver_nameservers
ldns_rdf ** ldns_resolver_nameservers(const ldns_resolver *r)
Return the configured nameserver ip address.
Definition: resolver.c:108
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.
Definition: resolver.c:1097
ldns_resolver_timeout
struct timeval ldns_resolver_timeout(const ldns_resolver *r)
What is the timeout on socket connections.
Definition: resolver.c:201
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.
Definition: resolver.c:1036
tsig.h
Defines functions for TSIG usage.
ldns_resolver_nameservers_randomize
void ldns_resolver_nameservers_randomize(ldns_resolver *r)
Randomize the nameserver list in the resolver.
Definition: resolver.c:1405
ldns_resolver_set_nameserver_count
void ldns_resolver_set_nameserver_count(ldns_resolver *r, size_t c)
Set the resolver&#39;s nameserver count directly.
Definition: resolver.c:458
ldns_struct_resolver::_edns_udp_size
uint16_t _edns_udp_size
Definition: resolver.h:130
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 a...
Definition: resolver.c:990
ldns_resolver_set_dnsrch
void ldns_resolver_set_dnsrch(ldns_resolver *r, signed char b)
Whether the resolver uses the searchlist.
ldns_resolver_set_fail
void ldns_resolver_set_fail(ldns_resolver *r, signed char b)
Whether or not to fail after one failed query.
ldns_resolver_igntc
signed char ldns_resolver_igntc(const ldns_resolver *r)
Does the resolver ignore the TC bit (truncated)
Definition: resolver.c:165
ldns_struct_resolver::_rtt
size_t * _rtt
Round trip time; 0 -> infinity.
Definition: resolver.h:70
ldns_resolver_incr_nameserver_count
void ldns_resolver_incr_nameserver_count(ldns_resolver *r)
Incremental the resolver&#39;s nameserver count.
Definition: resolver.c:523
rr.h
Contains the definition of ldns_rr and functions to manipulate those.
ldns_resolver_tsig_algorithm
char * ldns_resolver_tsig_algorithm(const ldns_resolver *r)
Return the tsig algorithm as used by the nameserver.
Definition: resolver.c:213
ldns_resolver_set_domain
void ldns_resolver_set_domain(ldns_resolver *r, ldns_rdf *rd)
Set the resolver&#39;s default domain.
Definition: resolver.c:545
ldns_resolver_pop_nameserver
ldns_rdf * ldns_resolver_pop_nameserver(ldns_resolver *r)
pop the last nameserver from the resolver.
Definition: resolver.c:250
ldns_struct_resolver::_usevc
signed char _usevc
Whether to use tcp or udp (tcp if the value is true)
Definition: resolver.h:101
ldns_struct_rr
Resource Record.
Definition: rr.h:299
ldns_resolver_set_dnssec
void ldns_resolver_set_dnssec(ldns_resolver *r, signed char b)
Whether the resolver uses DNSSEC.
ldns_resolver_fallback
signed char ldns_resolver_fallback(const ldns_resolver *r)
Get the truncation fallback status.
Definition: resolver.c:54
ldns_struct_resolver::_tsig_algorithm
char * _tsig_algorithm
TSIG signing algorithm.
Definition: resolver.h:140
ldns_resolver_new
ldns_resolver * ldns_resolver_new(void)
Create a new resolver structure.
Definition: resolver.c:608
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.
Definition: resolver.c:1057
ldns_resolver_random
signed char ldns_resolver_random(const ldns_resolver *r)
Does the resolver randomize the nameserver before usage.
Definition: resolver.c:225
ldns_resolver_fail
signed char ldns_resolver_fail(const ldns_resolver *r)
Does the resolver only try the first nameserver.
Definition: resolver.c:84
ldns_resolver_dec_nameserver_count
void ldns_resolver_dec_nameserver_count(ldns_resolver *r)
Decrement the resolver&#39;s nameserver count.
Definition: resolver.c:532
ldns_struct_resolver::_nameserver_count
size_t _nameserver_count
Number of nameservers in _nameservers.
Definition: resolver.h:67
error.h
Defines error numbers and functions to translate those to a readable string.
ldns_resolver_tsig_keyname
char * ldns_resolver_tsig_keyname(const ldns_resolver *r)
Return the tsig keyname as used by the nameserver.
Definition: resolver.c:207
ldns_struct_resolver::_retry
uint8_t _retry
Number of times to retry before giving up.
Definition: resolver.h:88
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.
Definition: resolver.c:138
ldns_struct_resolver::_debug
signed char _debug
Print debug information.
Definition: resolver.h:76
ldns_resolver_set_dnssec_anchors
void ldns_resolver_set_dnssec_anchors(ldns_resolver *r, ldns_rr_list *l)
Set the resolver&#39;s DNSSEC anchor list directly.
Definition: resolver.c:397
ldns_struct_resolver::_axfr_soa_count
int _axfr_soa_count
Count the number of LDNS_RR_TYPE_SOA RRs we have seen so far (the second one signifies the end of the...
Definition: resolver.h:121
ldns_resolver_port
uint16_t ldns_resolver_port(const ldns_resolver *r)
Get the port the resolver should use.
Definition: resolver.c:24
ldns_resolver_set_tsig_keydata
void ldns_resolver_set_tsig_keydata(ldns_resolver *r, char *tsig_keydata)
Set the tsig key data.
Definition: resolver.c:594
ldns_struct_resolver::_cur_axfr_pkt
ldns_pkt * _cur_axfr_pkt
Packet currently handled when doing part of an AXFR.
Definition: resolver.h:126
ldns_struct_resolver::_timeout
struct timeval _timeout
Timeout for socket connections.
Definition: resolver.h:111
ldns_struct_resolver::_nameservers
ldns_rdf ** _nameservers
Array of nameservers to query (IP addresses or dnames)
Definition: resolver.h:65
ldns_resolver_set_edns_udp_size
void ldns_resolver_set_edns_udp_size(ldns_resolver *r, uint16_t s)
Set maximum udp size.
Definition: resolver.c:373
ldns_resolver_usevc
signed char ldns_resolver_usevc(const ldns_resolver *r)
Does the resolver use tcp or udp.
Definition: resolver.c:171
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 ...
Definition: resolver.c:908
ldns_struct_resolver::_axfr_i
uint16_t _axfr_i
Counter for within the AXFR packets.
Definition: resolver.h:128
ldns_struct_resolver::_recursive
signed char _recursive
Wether or not to be recursive.
Definition: resolver.h:73
ldns_resolver_set_igntc
void ldns_resolver_set_igntc(ldns_resolver *r, signed char b)
Whether or not to ignore the TC bit.
ldns_struct_resolver::_defnames
signed char _defnames
If true append the default domain.
Definition: resolver.h:107
ldns_resolver_push_nameserver_rr_list
ldns_status ldns_resolver_push_nameserver_rr_list(ldns_resolver *r, ldns_rr_list *rrlist)
Push a new nameserver rr_list to the resolver.
Definition: resolver.c:351
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...
Definition: resolver.c:470
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.
Definition: resolver.c:506
ldns_resolver_ip6
uint8_t ldns_resolver_ip6(const ldns_resolver *r)
Does the resolver use ip6 or ip4.
Definition: resolver.c:60
ldns_resolver_set_tsig_keyname
void ldns_resolver_set_tsig_keyname(ldns_resolver *r, char *tsig_keyname)
Set the tsig key name.
Definition: resolver.c:580
ldns_struct_pkt
DNS packet.
Definition: packet.h:233
ldns_resolver_set_source
void ldns_resolver_set_source(ldns_resolver *r, ldns_rdf *s)
Set the source rdf (address) the resolver should use.
Definition: resolver.c:244
ldns_struct_resolver::_tsig_keyname
char * _tsig_keyname
Name of the key to use with TSIG, if _tsig_keyname and _tsig_keydata both contain values...
Definition: resolver.h:136
ldns_resolver_set_recursive
void ldns_resolver_set_recursive(ldns_resolver *r, signed char b)
Set the resolver recursion.
ldns_resolver_set_debug
void ldns_resolver_set_debug(ldns_resolver *r, signed char b)
Set the resolver debugging.
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.
Definition: resolver.c:666
ldns_resolver_retry
uint8_t ldns_resolver_retry(const ldns_resolver *r)
Get the number of retries.
Definition: resolver.c:42
ldns_resolver_set_tsig_algorithm
void ldns_resolver_set_tsig_algorithm(ldns_resolver *r, char *tsig_algorithm)
Set the tsig algorithm.
Definition: resolver.c:587
ldns_struct_resolver::_domain
ldns_rdf * _domain
Default domain to add to non fully qualified domain names.
Definition: resolver.h:79
ldns_resolver_debug
signed char ldns_resolver_debug(const ldns_resolver *r)
Get the debug status of the resolver.
Definition: resolver.c:72
ldns_status
enum ldns_enum_status ldns_status
Definition: error.h:131
ldns_resolver_set_timeout
void ldns_resolver_set_timeout(ldns_resolver *r, struct timeval timeout)
Set the resolver&#39;s socket time out when talking to remote hosts.
Definition: resolver.c:551
ldns_resolver_nameserver_count
size_t ldns_resolver_nameserver_count(const ldns_resolver *r)
How many nameserver are configured in the resolver.
Definition: resolver.c:114
ldns_resolver_push_searchlist
void ldns_resolver_push_searchlist(ldns_resolver *r, ldns_rdf *rd)
Push a new rd to the resolver&#39;s searchlist.
Definition: resolver.c:558
ldns_struct_resolver::_igntc
signed char _igntc
Whether to ignore the tc bit.
Definition: resolver.h:103
ldns_resolver_searchlist_count
size_t ldns_resolver_searchlist_count(const ldns_resolver *r)
Return the resolver&#39;s searchlist count.
Definition: resolver.c:231
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...
ldns_resolver_edns_udp_size
uint16_t ldns_resolver_edns_udp_size(const ldns_resolver *r)
Get the resolver&#39;s udp size.
Definition: resolver.c:36
ldns_resolver_defnames
signed char ldns_resolver_defnames(const ldns_resolver *r)
Does the resolver apply default domain name.
Definition: resolver.c:90
ldns_struct_resolver::_searchlist
ldns_rdf ** _searchlist
Searchlist array, add the names in this array if a query cannot be found.
Definition: resolver.h:82
ldns_resolver_domain
ldns_rdf * ldns_resolver_domain(const ldns_resolver *r)
What is the default dname to add to relative queries.
Definition: resolver.c:96
ldns_struct_resolver::_dnssec_cd
signed char _dnssec_cd
Whether to set the CD bit on DNSSEC requests.
Definition: resolver.h:97
ldns_struct_resolver::_random
signed char _random
Randomly choose a nameserver.
Definition: resolver.h:115
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.
ldns_struct_resolver::_source
ldns_rdf * _source
Source address to query from.
Definition: resolver.h:143
ldns_resolver_free
void ldns_resolver_free(ldns_resolver *res)
Frees the allocated space for this resolver.
Definition: resolver.c:939
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.
packet.h
Contains the definition of ldns_pkt and its parts, as well as functions to manipulate those...
ldns_struct_rdf
Resource record data field.
Definition: rdata.h:166
ldns_struct_resolver::_ip6
uint8_t _ip6
Whether to use ip6, 0->does not matter, 1 is IPv4, 2 is IPv6.
Definition: resolver.h:105
common.h
Common definitions for LDNS.
ldns_resolver_set_retrans
void ldns_resolver_set_retrans(ldns_resolver *r, uint8_t re)
Set the resolver retrans timeout (in seconds)
Definition: resolver.c:476
ldns_resolver_dnsrch
signed char ldns_resolver_dnsrch(const ldns_resolver *r)
Does the resolver apply search list.
Definition: resolver.c:78
ldns_axfr_complete
signed char ldns_axfr_complete(const ldns_resolver *resolver)
Returns true if the axfr transfer has completed (i.e.
Definition: resolver.c:1391
ldns_rr_type
enum ldns_enum_rr_type ldns_rr_type
Definition: rr.h:236
ldns_resolver_set_port
void ldns_resolver_set_port(ldns_resolver *r, uint16_t p)
Set the port the resolver should use.
Definition: resolver.c:238
ldns_struct_resolver::_dnsrch
signed char _dnsrch
If true apply the search list.
Definition: resolver.h:109
ldns_resolver_tsig_keydata
char * ldns_resolver_tsig_keydata(const ldns_resolver *r)
Return the tsig keydata as used by the nameserver.
Definition: resolver.c:219
ldns_resolver_set_nameservers
void ldns_resolver_set_nameservers(ldns_resolver *r, ldns_rdf **rd)
Set the resolver&#39;s nameserver count directly by using an rdf list.
Definition: resolver.c:488
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.
Definition: resolver.c:403
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.
Definition: resolver.c:1207
ldns_struct_resolver::_socket
int _socket
Keep some things to make AXFR possible.
Definition: resolver.h:117
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 uasable for i...
Definition: resolver.c:1398
ldns_resolver_set_rtt
void ldns_resolver_set_rtt(ldns_resolver *r, size_t *rtt)
Set round trip time for all nameservers.
Definition: resolver.c:500
ldns_resolver_set_random
void ldns_resolver_set_random(ldns_resolver *r, signed char b)
Should the nameserver list be randomized before each use.
ldns_resolver_dnssec_cd
signed char ldns_resolver_dnssec_cd(const ldns_resolver *r)
Does the resolver set the CD bit.
Definition: resolver.c:126
ldns_resolver_dnssec
signed char ldns_resolver_dnssec(const ldns_resolver *r)
Does the resolver do DNSSEC.
Definition: resolver.c:120
ldns_resolver_deep_free
void ldns_resolver_deep_free(ldns_resolver *res)
Frees the allocated space for this resolver and all it&#39;s data.
Definition: resolver.c:945
ldns_struct_resolver::_tsig_keydata
char * _tsig_keydata
Secret key data to use with TSIG, if _tsig_keyname and _tsig_keydata both contain values...
Definition: resolver.h:138
ldns_resolver_retrans
uint8_t ldns_resolver_retrans(const ldns_resolver *r)
Get the retransmit interval.
Definition: resolver.c:48
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.
Definition: resolver.c:672
ldns_resolver_rtt
size_t * ldns_resolver_rtt(const ldns_resolver *r)
Return the used round trip times for the nameservers.
Definition: resolver.c:177
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 a...
Definition: resolver.c:1024
ldns_struct_resolver::_fallback
signed char _fallback
Use new fallback mechanism (try EDNS, then do TCP)
Definition: resolver.h:92
ldns_resolver_set_ip6
void ldns_resolver_set_ip6(ldns_resolver *r, uint8_t i)
Whether the resolver uses ip6.
Definition: resolver.c:440