1 .TH "event2/dns_compat.h" 3 "Tue Jan 27 2015" "libevent" \" -*- nroff -*-
7 Potentially non-threadsafe versions of the functions in \fBdns\&.h\fP: provided only for backwards compatibility\&.
12 \fC#include <event2/event-config\&.h>\fP
14 \fC#include <event2/util\&.h>\fP
21 .RI "struct evdns_server_port * \fBevdns_add_server_port\fP (\fBevutil_socket_t\fP socket, int flags, \fBevdns_request_callback_fn_type\fP callback, void *user_data)"
23 .RI "\fIAs evdns_server_new_with_base\&. \fP"
25 .RI "int \fBevdns_clear_nameservers_and_suspend\fP (void)"
27 .RI "\fIRemove all configured nameservers, and suspend all pending resolves\&. \fP"
29 .RI "int \fBevdns_count_nameservers\fP (void)"
31 .RI "\fIGet the number of configured nameservers\&. \fP"
33 .RI "struct evdns_base * \fBevdns_get_global_base\fP (void)"
35 .RI "\fIReturn the global evdns_base created by \fBevent_init()\fP and used by the other deprecated functions\&. \fP"
37 .RI "int \fBevdns_init\fP (void)"
39 .RI "\fIInitialize the asynchronous DNS library\&. \fP"
41 .RI "int \fBevdns_nameserver_add\fP (unsigned long int address)"
43 .RI "\fIAdd a nameserver\&. \fP"
45 .RI "int \fBevdns_nameserver_ip_add\fP (const char *ip_as_string)"
47 .RI "\fIAdd a nameserver\&. \fP"
49 .RI "int \fBevdns_resolv_conf_parse\fP (int flags, const char *const filename)"
51 .RI "\fIParse a resolv\&.conf file\&. \fP"
53 .RI "int \fBevdns_resolve_ipv4\fP (const char *name, int flags, \fBevdns_callback_type\fP callback, void *ptr)"
55 .RI "\fILookup an A record for a given name\&. \fP"
57 .RI "int \fBevdns_resolve_ipv6\fP (const char *name, int flags, \fBevdns_callback_type\fP callback, void *ptr)"
59 .RI "\fILookup an AAAA record for a given name\&. \fP"
61 .RI "int \fBevdns_resolve_reverse\fP (const struct in_addr *in, int flags, \fBevdns_callback_type\fP callback, void *ptr)"
63 .RI "\fILookup a PTR record for a given IP address\&. \fP"
65 .RI "int \fBevdns_resolve_reverse_ipv6\fP (const struct in6_addr *in, int flags, \fBevdns_callback_type\fP callback, void *ptr)"
67 .RI "\fILookup a PTR record for a given IPv6 address\&. \fP"
69 .RI "int \fBevdns_resume\fP (void)"
71 .RI "\fIResume normal operation and continue any suspended resolve requests\&. \fP"
73 .RI "void \fBevdns_search_add\fP (const char *domain)"
75 .RI "\fIAdd a domain to the list of search domains\&. \fP"
77 .RI "void \fBevdns_search_clear\fP (void)"
79 .RI "\fIClear the list of search domains\&. \fP"
81 .RI "void \fBevdns_search_ndots_set\fP (const int ndots)"
83 .RI "\fISet the 'ndots' parameter for searches\&. \fP"
85 .RI "int \fBevdns_set_option\fP (const char *option, const char *val, int flags)"
87 .RI "\fISet the value of a configuration option\&. \fP"
89 .RI "void \fBevdns_shutdown\fP (int fail_requests)"
91 .RI "\fIShut down the asynchronous DNS resolver and terminate all active requests\&. \fP"
93 .SH "Detailed Description"
95 Potentially non-threadsafe versions of the functions in \fBdns\&.h\fP: provided only for backwards compatibility\&.
98 .SH "Function Documentation"
100 .SS "struct evdns_server_port* evdns_add_server_port (\fBevutil_socket_t\fPsocket, intflags, \fBevdns_request_callback_fn_type\fPcallback, void *user_data)"
103 As evdns_server_new_with_base\&.
107 This function is deprecated because it does not allow the caller to specify which even_base it uses\&. The recommended function is \fBevdns_add_server_port_with_base()\fP\&.
111 .SS "int evdns_clear_nameservers_and_suspend (void)"
114 Remove all configured nameservers, and suspend all pending resolves\&. Resolves will not necessarily be re-attempted until \fBevdns_resume()\fP is called\&.
118 This function is deprecated because it does not allow the caller to specify which evdns_base it applies to\&. The recommended function is \fBevdns_base_clear_nameservers_and_suspend()\fP\&.
124 0 if successful, or -1 if an error occurred
133 .SS "int evdns_count_nameservers (void)"
136 Get the number of configured nameservers\&. This returns the number of configured nameservers (not necessarily the number of running nameservers)\&. This is useful for double-checking whether our calls to the various nameserver configuration functions have been successful\&.
140 This function is deprecated because it does not allow the caller to specify which evdns_base it applies to\&. The recommended function is \fBevdns_base_count_nameservers()\fP\&.
146 the number of configured nameservers
151 \fBevdns_nameserver_add()\fP
155 .SS "struct evdns_base* evdns_get_global_base (void)"
158 Return the global evdns_base created by \fBevent_init()\fP and used by the other deprecated functions\&.
162 This function is deprecated because use of the global evdns_base is error-prone\&.
166 .SS "int evdns_init (void)"
169 Initialize the asynchronous DNS library\&. This function initializes support for non-blocking name resolution by calling \fBevdns_resolv_conf_parse()\fP on UNIX and evdns_config_windows_nameservers() on Windows\&.
173 This function is deprecated because it always uses the current event base, and is easily confused by multiple calls to \fBevent_init()\fP, and so is not safe for multithreaded use\&. Additionally, it allocates a global structure that only one thread can use\&. The replacement is \fBevdns_base_new()\fP\&.
179 0 if successful, or -1 if an error occurred
184 \fBevdns_shutdown()\fP
188 .SS "int evdns_nameserver_add (unsigned long intaddress)"
191 Add a nameserver\&. The address should be an IPv4 address in network byte order\&. The type of address is chosen so that it matches in_addr\&.s_addr\&.
195 This function is deprecated because it does not allow the caller to specify which evdns_base it applies to\&. The recommended function is \fBevdns_base_nameserver_add()\fP\&.
201 \fIaddress\fP an IP address in network byte order
206 0 if successful, or -1 if an error occurred
211 \fBevdns_nameserver_ip_add()\fP
215 .SS "int evdns_nameserver_ip_add (const char *ip_as_string)"
218 Add a nameserver\&. This wraps the \fBevdns_nameserver_add()\fP function by parsing a string as an IP address and adds it as a nameserver\&.
222 This function is deprecated because it does not allow the caller to specify which evdns_base it applies to\&. The recommended function is \fBevdns_base_nameserver_ip_add()\fP\&.
228 0 if successful, or -1 if an error occurred
233 \fBevdns_nameserver_add()\fP
237 .SS "int evdns_resolv_conf_parse (intflags, const char *constfilename)"
240 Parse a resolv\&.conf file\&. The 'flags' parameter determines what information is parsed from the resolv\&.conf file\&. See the man page for resolv\&.conf for the format of this file\&.
242 The following directives are not parsed from the file: sortlist, rotate, no-check-names, inet6, debug\&.
244 If this function encounters an error, the possible return values are: 1 = failed to open file, 2 = failed to stat file, 3 = file too large, 4 = out of memory, 5 = short read from file, 6 = no nameservers listed in the file
248 This function is deprecated because it does not allow the caller to specify which evdns_base it applies to\&. The recommended function is \fBevdns_base_resolv_conf_parse()\fP\&.
254 \fIflags\fP any of DNS_OPTION_NAMESERVERS|DNS_OPTION_SEARCH|DNS_OPTION_MISC| DNS_OPTIONS_ALL
256 \fIfilename\fP the path to the resolv\&.conf file
261 0 if successful, or various positive error codes if an error occurred (see above)
266 resolv\&.conf(3), evdns_config_windows_nameservers()
270 .SS "int evdns_resolve_ipv4 (const char *name, intflags, \fBevdns_callback_type\fPcallback, void *ptr)"
273 Lookup an A record for a given name\&.
277 This function is deprecated because it does not allow the caller to specify which evdns_base it applies to\&. The recommended function is \fBevdns_base_resolve_ipv4()\fP\&.
283 \fIname\fP a DNS hostname
285 \fIflags\fP either 0, or DNS_QUERY_NO_SEARCH to disable searching for this query\&.
287 \fIcallback\fP a callback function to invoke when the request is completed
289 \fIptr\fP an argument to pass to the callback function
294 0 if successful, or -1 if an error occurred
299 \fBevdns_resolve_ipv6()\fP, \fBevdns_resolve_reverse()\fP, \fBevdns_resolve_reverse_ipv6()\fP
303 .SS "int evdns_resolve_ipv6 (const char *name, intflags, \fBevdns_callback_type\fPcallback, void *ptr)"
306 Lookup an AAAA record for a given name\&.
310 \fIname\fP a DNS hostname
312 \fIflags\fP either 0, or DNS_QUERY_NO_SEARCH to disable searching for this query\&.
314 \fIcallback\fP a callback function to invoke when the request is completed
316 \fIptr\fP an argument to pass to the callback function
321 0 if successful, or -1 if an error occurred
326 \fBevdns_resolve_ipv4()\fP, \fBevdns_resolve_reverse()\fP, \fBevdns_resolve_reverse_ipv6()\fP
330 .SS "int evdns_resolve_reverse (const struct in_addr *in, intflags, \fBevdns_callback_type\fPcallback, void *ptr)"
333 Lookup a PTR record for a given IP address\&.
337 This function is deprecated because it does not allow the caller to specify which evdns_base it applies to\&. The recommended function is \fBevdns_base_resolve_reverse()\fP\&.
343 \fIin\fP an IPv4 address
345 \fIflags\fP either 0, or DNS_QUERY_NO_SEARCH to disable searching for this query\&.
347 \fIcallback\fP a callback function to invoke when the request is completed
349 \fIptr\fP an argument to pass to the callback function
354 0 if successful, or -1 if an error occurred
359 \fBevdns_resolve_reverse_ipv6()\fP
363 .SS "int evdns_resolve_reverse_ipv6 (const struct in6_addr *in, intflags, \fBevdns_callback_type\fPcallback, void *ptr)"
366 Lookup a PTR record for a given IPv6 address\&.
370 This function is deprecated because it does not allow the caller to specify which evdns_base it applies to\&. The recommended function is \fBevdns_base_resolve_reverse_ipv6()\fP\&.
376 \fIin\fP an IPv6 address
378 \fIflags\fP either 0, or DNS_QUERY_NO_SEARCH to disable searching for this query\&.
380 \fIcallback\fP a callback function to invoke when the request is completed
382 \fIptr\fP an argument to pass to the callback function
387 0 if successful, or -1 if an error occurred
392 \fBevdns_resolve_reverse_ipv6()\fP
396 .SS "int evdns_resume (void)"
399 Resume normal operation and continue any suspended resolve requests\&. Re-attempt resolves left in limbo after an earlier call to \fBevdns_clear_nameservers_and_suspend()\fP\&.
403 This function is deprecated because it does not allow the caller to specify which evdns_base it applies to\&. The recommended function is \fBevdns_base_resume()\fP\&.
409 0 if successful, or -1 if an error occurred
414 \fBevdns_clear_nameservers_and_suspend()\fP
418 .SS "void evdns_search_add (const char *domain)"
421 Add a domain to the list of search domains\&.
425 This function is deprecated because it does not allow the caller to specify which evdns_base it applies to\&. The recommended function is \fBevdns_base_search_add()\fP\&.
431 \fIdomain\fP the domain to be added to the search list
435 .SS "void evdns_search_clear (void)"
438 Clear the list of search domains\&.
442 This function is deprecated because it does not allow the caller to specify which evdns_base it applies to\&. The recommended function is \fBevdns_base_search_clear()\fP\&.
446 .SS "void evdns_search_ndots_set (const intndots)"
449 Set the 'ndots' parameter for searches\&. Sets the number of dots which, when found in a name, causes the first query to be without any search domain\&.
453 This function is deprecated because it does not allow the caller to specify which evdns_base it applies to\&. The recommended function is \fBevdns_base_search_ndots_set()\fP\&.
459 \fIndots\fP the new ndots parameter
463 .SS "int evdns_set_option (const char *option, const char *val, intflags)"
466 Set the value of a configuration option\&. The currently available configuration options are:
468 ndots, timeout, max-timeouts, max-inflight, and attempts
472 This function is deprecated because it does not allow the caller to specify which evdns_base it applies to\&. The recommended function is \fBevdns_base_set_option()\fP\&.
478 \fIoption\fP the name of the configuration option to be modified
480 \fIval\fP the value to be set
482 \fIflags\fP Ignored\&.
487 0 if successful, or -1 if an error occurred
491 .SS "void evdns_shutdown (intfail_requests)"
494 Shut down the asynchronous DNS resolver and terminate all active requests\&. If the 'fail_requests' option is enabled, all active requests will return an empty result with the error flag set to DNS_ERR_SHUTDOWN\&. Otherwise, the requests will be silently discarded\&.
498 This function is deprecated because it does not allow the caller to specify which evdns_base it applies to\&. The recommended function is evdns_base_shutdown()\&.
504 \fIfail_requests\fP if zero, active requests will be aborted; if non-zero, active requests will return DNS_ERR_SHUTDOWN\&.
515 Generated automatically by Doxygen for libevent from the source code\&.