eventdns.h 2.56 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* This software is Public Domain. To view a copy of the public domain dedication,
 * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
 *
 * I ask and expect, but do not require, that all derivative works contain an
 * attribution similar to:
 * 	Parts developed by Adam Langley <agl@imperialviolet.org>
 *
 * You may wish to replace the word "Parts" with something else depending on
 * the amount of original code.
 *
 * (Derivative works does not include programs which link against, run or include
 * the source verbatim in their source distributions)
 */

#ifndef EVENTDNS_H
#define EVENTDNS_H

19
/* Error codes 0-5 are as described in RFC 1035. */
20
#define DNS_ERR_NONE 0
21
/* The name server was unable to interpret the query */
22
#define DNS_ERR_FORMAT 1
23
24
/* The name server was unable to process this query due to a problem with the
 * name server */
25
#define DNS_ERR_SERVERFAILED 2
26
/* The domain name does not exist */
27
#define DNS_ERR_NOTEXIST 3
28
/* The name server does not support the requested kind of query */
29
#define DNS_ERR_NOTIMPL 4
30
31
/* The name server refuses to reform the specified operation for policy
 * reasons */
32
#define DNS_ERR_REFUSED 5
33
/* The reply was truncated or ill-formated */
34
#define DNS_ERR_TRUNCATED 65
35
/* An unknown error occurred */
36
#define DNS_ERR_UNKNOWN 66
37
/* Communication with the server timed out */
38
39
40
#define DNS_ERR_TIMEOUT 67

#define DNS_IPv4_A 1
41
#define DNS_PTR 2
42
43
44
45
46
47
48
49

#define DNS_QUERY_NO_SEARCH 1

#define DNS_OPTION_SEARCH 1
#define DNS_OPTION_NAMESERVERS 2
#define DNS_OPTION_MISC 4
#define DNS_OPTIONS_ALL 7

50
typedef void (*evdns_callback_type) (int result, char type, int count, int ttl, void *addresses, void *arg);
51

52
53
54
55
56
57
58
int evdns_init(void);
int evdns_nameserver_add(unsigned long int address);
int evdns_count_nameservers(void);
int evdns_clear_nameservers_and_suspend(void);
int evdns_resume(void);
int evdns_nameserver_ip_add(const char *ip_as_string);
int evdns_resolve_ipv4(const char *name, int flags, evdns_callback_type callback, void *ptr);
59
struct in_addr;
60
61
int evdns_resolve_reverse(struct in_addr *addr, int flags, evdns_callback_type callback, void *ptr);
int evdns_resolv_conf_parse(int flags, const char *);
62
#ifdef MS_WINDOWS
63
int evdns_config_windows_nameservers(void);
64
#endif
65
66
67
void evdns_search_clear(void);
void evdns_search_add(const char *domain);
void evdns_search_ndots_set(const int ndots);
68

69
70
typedef void (*evdns_debug_log_fn_type)(int warn, const char *msg);
void evdns_set_log_fn(evdns_debug_log_fn_type fn);
71

72
73
74
#define DNS_NO_SEARCH 1

#endif  // !EVENTDNS_H