1*663afb9bSAndroid Build Coastguard Worker /* 2*663afb9bSAndroid Build Coastguard Worker * Copyright (c) 2006-2007 Niels Provos <[email protected]> 3*663afb9bSAndroid Build Coastguard Worker * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4*663afb9bSAndroid Build Coastguard Worker * 5*663afb9bSAndroid Build Coastguard Worker * Redistribution and use in source and binary forms, with or without 6*663afb9bSAndroid Build Coastguard Worker * modification, are permitted provided that the following conditions 7*663afb9bSAndroid Build Coastguard Worker * are met: 8*663afb9bSAndroid Build Coastguard Worker * 1. Redistributions of source code must retain the above copyright 9*663afb9bSAndroid Build Coastguard Worker * notice, this list of conditions and the following disclaimer. 10*663afb9bSAndroid Build Coastguard Worker * 2. Redistributions in binary form must reproduce the above copyright 11*663afb9bSAndroid Build Coastguard Worker * notice, this list of conditions and the following disclaimer in the 12*663afb9bSAndroid Build Coastguard Worker * documentation and/or other materials provided with the distribution. 13*663afb9bSAndroid Build Coastguard Worker * 3. The name of the author may not be used to endorse or promote products 14*663afb9bSAndroid Build Coastguard Worker * derived from this software without specific prior written permission. 15*663afb9bSAndroid Build Coastguard Worker * 16*663afb9bSAndroid Build Coastguard Worker * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17*663afb9bSAndroid Build Coastguard Worker * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18*663afb9bSAndroid Build Coastguard Worker * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19*663afb9bSAndroid Build Coastguard Worker * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20*663afb9bSAndroid Build Coastguard Worker * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21*663afb9bSAndroid Build Coastguard Worker * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22*663afb9bSAndroid Build Coastguard Worker * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23*663afb9bSAndroid Build Coastguard Worker * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24*663afb9bSAndroid Build Coastguard Worker * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25*663afb9bSAndroid Build Coastguard Worker * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26*663afb9bSAndroid Build Coastguard Worker */ 27*663afb9bSAndroid Build Coastguard Worker #ifndef EVENT2_DNS_COMPAT_H_INCLUDED_ 28*663afb9bSAndroid Build Coastguard Worker #define EVENT2_DNS_COMPAT_H_INCLUDED_ 29*663afb9bSAndroid Build Coastguard Worker 30*663afb9bSAndroid Build Coastguard Worker /** @file event2/dns_compat.h 31*663afb9bSAndroid Build Coastguard Worker 32*663afb9bSAndroid Build Coastguard Worker Potentially non-threadsafe versions of the functions in dns.h: provided 33*663afb9bSAndroid Build Coastguard Worker only for backwards compatibility. 34*663afb9bSAndroid Build Coastguard Worker 35*663afb9bSAndroid Build Coastguard Worker 36*663afb9bSAndroid Build Coastguard Worker */ 37*663afb9bSAndroid Build Coastguard Worker 38*663afb9bSAndroid Build Coastguard Worker #ifdef __cplusplus 39*663afb9bSAndroid Build Coastguard Worker extern "C" { 40*663afb9bSAndroid Build Coastguard Worker #endif 41*663afb9bSAndroid Build Coastguard Worker 42*663afb9bSAndroid Build Coastguard Worker #include <event2/event-config.h> 43*663afb9bSAndroid Build Coastguard Worker #ifdef EVENT__HAVE_SYS_TYPES_H 44*663afb9bSAndroid Build Coastguard Worker #include <sys/types.h> 45*663afb9bSAndroid Build Coastguard Worker #endif 46*663afb9bSAndroid Build Coastguard Worker #ifdef EVENT__HAVE_SYS_TIME_H 47*663afb9bSAndroid Build Coastguard Worker #include <sys/time.h> 48*663afb9bSAndroid Build Coastguard Worker #endif 49*663afb9bSAndroid Build Coastguard Worker 50*663afb9bSAndroid Build Coastguard Worker /* For int types. */ 51*663afb9bSAndroid Build Coastguard Worker #include <event2/util.h> 52*663afb9bSAndroid Build Coastguard Worker #include <event2/visibility.h> 53*663afb9bSAndroid Build Coastguard Worker 54*663afb9bSAndroid Build Coastguard Worker /** 55*663afb9bSAndroid Build Coastguard Worker Initialize the asynchronous DNS library. 56*663afb9bSAndroid Build Coastguard Worker 57*663afb9bSAndroid Build Coastguard Worker This function initializes support for non-blocking name resolution by 58*663afb9bSAndroid Build Coastguard Worker calling evdns_resolv_conf_parse() on UNIX and 59*663afb9bSAndroid Build Coastguard Worker evdns_config_windows_nameservers() on Windows. 60*663afb9bSAndroid Build Coastguard Worker 61*663afb9bSAndroid Build Coastguard Worker @deprecated This function is deprecated because it always uses the current 62*663afb9bSAndroid Build Coastguard Worker event base, and is easily confused by multiple calls to event_init(), and 63*663afb9bSAndroid Build Coastguard Worker so is not safe for multithreaded use. Additionally, it allocates a global 64*663afb9bSAndroid Build Coastguard Worker structure that only one thread can use. The replacement is 65*663afb9bSAndroid Build Coastguard Worker evdns_base_new(). 66*663afb9bSAndroid Build Coastguard Worker 67*663afb9bSAndroid Build Coastguard Worker @return 0 if successful, or -1 if an error occurred 68*663afb9bSAndroid Build Coastguard Worker @see evdns_shutdown() 69*663afb9bSAndroid Build Coastguard Worker */ 70*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 71*663afb9bSAndroid Build Coastguard Worker int evdns_init(void); 72*663afb9bSAndroid Build Coastguard Worker 73*663afb9bSAndroid Build Coastguard Worker struct evdns_base; 74*663afb9bSAndroid Build Coastguard Worker /** 75*663afb9bSAndroid Build Coastguard Worker Return the global evdns_base created by event_init() and used by the other 76*663afb9bSAndroid Build Coastguard Worker deprecated functions. 77*663afb9bSAndroid Build Coastguard Worker 78*663afb9bSAndroid Build Coastguard Worker @deprecated This function is deprecated because use of the global 79*663afb9bSAndroid Build Coastguard Worker evdns_base is error-prone. 80*663afb9bSAndroid Build Coastguard Worker */ 81*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 82*663afb9bSAndroid Build Coastguard Worker struct evdns_base *evdns_get_global_base(void); 83*663afb9bSAndroid Build Coastguard Worker 84*663afb9bSAndroid Build Coastguard Worker /** 85*663afb9bSAndroid Build Coastguard Worker Shut down the asynchronous DNS resolver and terminate all active requests. 86*663afb9bSAndroid Build Coastguard Worker 87*663afb9bSAndroid Build Coastguard Worker If the 'fail_requests' option is enabled, all active requests will return 88*663afb9bSAndroid Build Coastguard Worker an empty result with the error flag set to DNS_ERR_SHUTDOWN. Otherwise, 89*663afb9bSAndroid Build Coastguard Worker the requests will be silently discarded. 90*663afb9bSAndroid Build Coastguard Worker 91*663afb9bSAndroid Build Coastguard Worker @deprecated This function is deprecated because it does not allow the 92*663afb9bSAndroid Build Coastguard Worker caller to specify which evdns_base it applies to. The recommended 93*663afb9bSAndroid Build Coastguard Worker function is evdns_base_shutdown(). 94*663afb9bSAndroid Build Coastguard Worker 95*663afb9bSAndroid Build Coastguard Worker @param fail_requests if zero, active requests will be aborted; if non-zero, 96*663afb9bSAndroid Build Coastguard Worker active requests will return DNS_ERR_SHUTDOWN. 97*663afb9bSAndroid Build Coastguard Worker @see evdns_init() 98*663afb9bSAndroid Build Coastguard Worker */ 99*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 100*663afb9bSAndroid Build Coastguard Worker void evdns_shutdown(int fail_requests); 101*663afb9bSAndroid Build Coastguard Worker 102*663afb9bSAndroid Build Coastguard Worker /** 103*663afb9bSAndroid Build Coastguard Worker Add a nameserver. 104*663afb9bSAndroid Build Coastguard Worker 105*663afb9bSAndroid Build Coastguard Worker The address should be an IPv4 address in network byte order. 106*663afb9bSAndroid Build Coastguard Worker The type of address is chosen so that it matches in_addr.s_addr. 107*663afb9bSAndroid Build Coastguard Worker 108*663afb9bSAndroid Build Coastguard Worker @deprecated This function is deprecated because it does not allow the 109*663afb9bSAndroid Build Coastguard Worker caller to specify which evdns_base it applies to. The recommended 110*663afb9bSAndroid Build Coastguard Worker function is evdns_base_nameserver_add(). 111*663afb9bSAndroid Build Coastguard Worker 112*663afb9bSAndroid Build Coastguard Worker @param address an IP address in network byte order 113*663afb9bSAndroid Build Coastguard Worker @return 0 if successful, or -1 if an error occurred 114*663afb9bSAndroid Build Coastguard Worker @see evdns_nameserver_ip_add() 115*663afb9bSAndroid Build Coastguard Worker */ 116*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 117*663afb9bSAndroid Build Coastguard Worker int evdns_nameserver_add(unsigned long int address); 118*663afb9bSAndroid Build Coastguard Worker 119*663afb9bSAndroid Build Coastguard Worker /** 120*663afb9bSAndroid Build Coastguard Worker Get the number of configured nameservers. 121*663afb9bSAndroid Build Coastguard Worker 122*663afb9bSAndroid Build Coastguard Worker This returns the number of configured nameservers (not necessarily the 123*663afb9bSAndroid Build Coastguard Worker number of running nameservers). This is useful for double-checking 124*663afb9bSAndroid Build Coastguard Worker whether our calls to the various nameserver configuration functions 125*663afb9bSAndroid Build Coastguard Worker have been successful. 126*663afb9bSAndroid Build Coastguard Worker 127*663afb9bSAndroid Build Coastguard Worker @deprecated This function is deprecated because it does not allow the 128*663afb9bSAndroid Build Coastguard Worker caller to specify which evdns_base it applies to. The recommended 129*663afb9bSAndroid Build Coastguard Worker function is evdns_base_count_nameservers(). 130*663afb9bSAndroid Build Coastguard Worker 131*663afb9bSAndroid Build Coastguard Worker @return the number of configured nameservers 132*663afb9bSAndroid Build Coastguard Worker @see evdns_nameserver_add() 133*663afb9bSAndroid Build Coastguard Worker */ 134*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 135*663afb9bSAndroid Build Coastguard Worker int evdns_count_nameservers(void); 136*663afb9bSAndroid Build Coastguard Worker 137*663afb9bSAndroid Build Coastguard Worker /** 138*663afb9bSAndroid Build Coastguard Worker Remove all configured nameservers, and suspend all pending resolves. 139*663afb9bSAndroid Build Coastguard Worker 140*663afb9bSAndroid Build Coastguard Worker Resolves will not necessarily be re-attempted until evdns_resume() is called. 141*663afb9bSAndroid Build Coastguard Worker 142*663afb9bSAndroid Build Coastguard Worker @deprecated This function is deprecated because it does not allow the 143*663afb9bSAndroid Build Coastguard Worker caller to specify which evdns_base it applies to. The recommended 144*663afb9bSAndroid Build Coastguard Worker function is evdns_base_clear_nameservers_and_suspend(). 145*663afb9bSAndroid Build Coastguard Worker 146*663afb9bSAndroid Build Coastguard Worker @return 0 if successful, or -1 if an error occurred 147*663afb9bSAndroid Build Coastguard Worker @see evdns_resume() 148*663afb9bSAndroid Build Coastguard Worker */ 149*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 150*663afb9bSAndroid Build Coastguard Worker int evdns_clear_nameservers_and_suspend(void); 151*663afb9bSAndroid Build Coastguard Worker 152*663afb9bSAndroid Build Coastguard Worker /** 153*663afb9bSAndroid Build Coastguard Worker Resume normal operation and continue any suspended resolve requests. 154*663afb9bSAndroid Build Coastguard Worker 155*663afb9bSAndroid Build Coastguard Worker Re-attempt resolves left in limbo after an earlier call to 156*663afb9bSAndroid Build Coastguard Worker evdns_clear_nameservers_and_suspend(). 157*663afb9bSAndroid Build Coastguard Worker 158*663afb9bSAndroid Build Coastguard Worker @deprecated This function is deprecated because it does not allow the 159*663afb9bSAndroid Build Coastguard Worker caller to specify which evdns_base it applies to. The recommended 160*663afb9bSAndroid Build Coastguard Worker function is evdns_base_resume(). 161*663afb9bSAndroid Build Coastguard Worker 162*663afb9bSAndroid Build Coastguard Worker @return 0 if successful, or -1 if an error occurred 163*663afb9bSAndroid Build Coastguard Worker @see evdns_clear_nameservers_and_suspend() 164*663afb9bSAndroid Build Coastguard Worker */ 165*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 166*663afb9bSAndroid Build Coastguard Worker int evdns_resume(void); 167*663afb9bSAndroid Build Coastguard Worker 168*663afb9bSAndroid Build Coastguard Worker /** 169*663afb9bSAndroid Build Coastguard Worker Add a nameserver. 170*663afb9bSAndroid Build Coastguard Worker 171*663afb9bSAndroid Build Coastguard Worker This wraps the evdns_nameserver_add() function by parsing a string as an IP 172*663afb9bSAndroid Build Coastguard Worker address and adds it as a nameserver. 173*663afb9bSAndroid Build Coastguard Worker 174*663afb9bSAndroid Build Coastguard Worker @deprecated This function is deprecated because it does not allow the 175*663afb9bSAndroid Build Coastguard Worker caller to specify which evdns_base it applies to. The recommended 176*663afb9bSAndroid Build Coastguard Worker function is evdns_base_nameserver_ip_add(). 177*663afb9bSAndroid Build Coastguard Worker 178*663afb9bSAndroid Build Coastguard Worker @return 0 if successful, or -1 if an error occurred 179*663afb9bSAndroid Build Coastguard Worker @see evdns_nameserver_add() 180*663afb9bSAndroid Build Coastguard Worker */ 181*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 182*663afb9bSAndroid Build Coastguard Worker int evdns_nameserver_ip_add(const char *ip_as_string); 183*663afb9bSAndroid Build Coastguard Worker 184*663afb9bSAndroid Build Coastguard Worker /** 185*663afb9bSAndroid Build Coastguard Worker Lookup an A record for a given name. 186*663afb9bSAndroid Build Coastguard Worker 187*663afb9bSAndroid Build Coastguard Worker @deprecated This function is deprecated because it does not allow the 188*663afb9bSAndroid Build Coastguard Worker caller to specify which evdns_base it applies to. The recommended 189*663afb9bSAndroid Build Coastguard Worker function is evdns_base_resolve_ipv4(). 190*663afb9bSAndroid Build Coastguard Worker 191*663afb9bSAndroid Build Coastguard Worker @param name a DNS hostname 192*663afb9bSAndroid Build Coastguard Worker @param flags either 0, or DNS_QUERY_NO_SEARCH to disable searching for this query. 193*663afb9bSAndroid Build Coastguard Worker @param callback a callback function to invoke when the request is completed 194*663afb9bSAndroid Build Coastguard Worker @param ptr an argument to pass to the callback function 195*663afb9bSAndroid Build Coastguard Worker @return 0 if successful, or -1 if an error occurred 196*663afb9bSAndroid Build Coastguard Worker @see evdns_resolve_ipv6(), evdns_resolve_reverse(), evdns_resolve_reverse_ipv6() 197*663afb9bSAndroid Build Coastguard Worker */ 198*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 199*663afb9bSAndroid Build Coastguard Worker int evdns_resolve_ipv4(const char *name, int flags, evdns_callback_type callback, void *ptr); 200*663afb9bSAndroid Build Coastguard Worker 201*663afb9bSAndroid Build Coastguard Worker /** 202*663afb9bSAndroid Build Coastguard Worker Lookup an AAAA record for a given name. 203*663afb9bSAndroid Build Coastguard Worker 204*663afb9bSAndroid Build Coastguard Worker @param name a DNS hostname 205*663afb9bSAndroid Build Coastguard Worker @param flags either 0, or DNS_QUERY_NO_SEARCH to disable searching for this query. 206*663afb9bSAndroid Build Coastguard Worker @param callback a callback function to invoke when the request is completed 207*663afb9bSAndroid Build Coastguard Worker @param ptr an argument to pass to the callback function 208*663afb9bSAndroid Build Coastguard Worker @return 0 if successful, or -1 if an error occurred 209*663afb9bSAndroid Build Coastguard Worker @see evdns_resolve_ipv4(), evdns_resolve_reverse(), evdns_resolve_reverse_ipv6() 210*663afb9bSAndroid Build Coastguard Worker */ 211*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 212*663afb9bSAndroid Build Coastguard Worker int evdns_resolve_ipv6(const char *name, int flags, evdns_callback_type callback, void *ptr); 213*663afb9bSAndroid Build Coastguard Worker 214*663afb9bSAndroid Build Coastguard Worker struct in_addr; 215*663afb9bSAndroid Build Coastguard Worker struct in6_addr; 216*663afb9bSAndroid Build Coastguard Worker 217*663afb9bSAndroid Build Coastguard Worker /** 218*663afb9bSAndroid Build Coastguard Worker Lookup a PTR record for a given IP address. 219*663afb9bSAndroid Build Coastguard Worker 220*663afb9bSAndroid Build Coastguard Worker @deprecated This function is deprecated because it does not allow the 221*663afb9bSAndroid Build Coastguard Worker caller to specify which evdns_base it applies to. The recommended 222*663afb9bSAndroid Build Coastguard Worker function is evdns_base_resolve_reverse(). 223*663afb9bSAndroid Build Coastguard Worker 224*663afb9bSAndroid Build Coastguard Worker @param in an IPv4 address 225*663afb9bSAndroid Build Coastguard Worker @param flags either 0, or DNS_QUERY_NO_SEARCH to disable searching for this query. 226*663afb9bSAndroid Build Coastguard Worker @param callback a callback function to invoke when the request is completed 227*663afb9bSAndroid Build Coastguard Worker @param ptr an argument to pass to the callback function 228*663afb9bSAndroid Build Coastguard Worker @return 0 if successful, or -1 if an error occurred 229*663afb9bSAndroid Build Coastguard Worker @see evdns_resolve_reverse_ipv6() 230*663afb9bSAndroid Build Coastguard Worker */ 231*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 232*663afb9bSAndroid Build Coastguard Worker int evdns_resolve_reverse(const struct in_addr *in, int flags, evdns_callback_type callback, void *ptr); 233*663afb9bSAndroid Build Coastguard Worker 234*663afb9bSAndroid Build Coastguard Worker /** 235*663afb9bSAndroid Build Coastguard Worker Lookup a PTR record for a given IPv6 address. 236*663afb9bSAndroid Build Coastguard Worker 237*663afb9bSAndroid Build Coastguard Worker @deprecated This function is deprecated because it does not allow the 238*663afb9bSAndroid Build Coastguard Worker caller to specify which evdns_base it applies to. The recommended 239*663afb9bSAndroid Build Coastguard Worker function is evdns_base_resolve_reverse_ipv6(). 240*663afb9bSAndroid Build Coastguard Worker 241*663afb9bSAndroid Build Coastguard Worker @param in an IPv6 address 242*663afb9bSAndroid Build Coastguard Worker @param flags either 0, or DNS_QUERY_NO_SEARCH to disable searching for this query. 243*663afb9bSAndroid Build Coastguard Worker @param callback a callback function to invoke when the request is completed 244*663afb9bSAndroid Build Coastguard Worker @param ptr an argument to pass to the callback function 245*663afb9bSAndroid Build Coastguard Worker @return 0 if successful, or -1 if an error occurred 246*663afb9bSAndroid Build Coastguard Worker @see evdns_resolve_reverse_ipv6() 247*663afb9bSAndroid Build Coastguard Worker */ 248*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 249*663afb9bSAndroid Build Coastguard Worker int evdns_resolve_reverse_ipv6(const struct in6_addr *in, int flags, evdns_callback_type callback, void *ptr); 250*663afb9bSAndroid Build Coastguard Worker 251*663afb9bSAndroid Build Coastguard Worker /** 252*663afb9bSAndroid Build Coastguard Worker Set the value of a configuration option. 253*663afb9bSAndroid Build Coastguard Worker 254*663afb9bSAndroid Build Coastguard Worker The currently available configuration options are: 255*663afb9bSAndroid Build Coastguard Worker 256*663afb9bSAndroid Build Coastguard Worker ndots, timeout, max-timeouts, max-inflight, and attempts 257*663afb9bSAndroid Build Coastguard Worker 258*663afb9bSAndroid Build Coastguard Worker @deprecated This function is deprecated because it does not allow the 259*663afb9bSAndroid Build Coastguard Worker caller to specify which evdns_base it applies to. The recommended 260*663afb9bSAndroid Build Coastguard Worker function is evdns_base_set_option(). 261*663afb9bSAndroid Build Coastguard Worker 262*663afb9bSAndroid Build Coastguard Worker @param option the name of the configuration option to be modified 263*663afb9bSAndroid Build Coastguard Worker @param val the value to be set 264*663afb9bSAndroid Build Coastguard Worker @param flags Ignored. 265*663afb9bSAndroid Build Coastguard Worker @return 0 if successful, or -1 if an error occurred 266*663afb9bSAndroid Build Coastguard Worker */ 267*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 268*663afb9bSAndroid Build Coastguard Worker int evdns_set_option(const char *option, const char *val, int flags); 269*663afb9bSAndroid Build Coastguard Worker 270*663afb9bSAndroid Build Coastguard Worker /** 271*663afb9bSAndroid Build Coastguard Worker Parse a resolv.conf file. 272*663afb9bSAndroid Build Coastguard Worker 273*663afb9bSAndroid Build Coastguard Worker The 'flags' parameter determines what information is parsed from the 274*663afb9bSAndroid Build Coastguard Worker resolv.conf file. See the man page for resolv.conf for the format of this 275*663afb9bSAndroid Build Coastguard Worker file. 276*663afb9bSAndroid Build Coastguard Worker 277*663afb9bSAndroid Build Coastguard Worker The following directives are not parsed from the file: sortlist, rotate, 278*663afb9bSAndroid Build Coastguard Worker no-check-names, inet6, debug. 279*663afb9bSAndroid Build Coastguard Worker 280*663afb9bSAndroid Build Coastguard Worker If this function encounters an error, the possible return values are: 1 = 281*663afb9bSAndroid Build Coastguard Worker failed to open file, 2 = failed to stat file, 3 = file too large, 4 = out of 282*663afb9bSAndroid Build Coastguard Worker memory, 5 = short read from file, 6 = no nameservers listed in the file 283*663afb9bSAndroid Build Coastguard Worker 284*663afb9bSAndroid Build Coastguard Worker @deprecated This function is deprecated because it does not allow the 285*663afb9bSAndroid Build Coastguard Worker caller to specify which evdns_base it applies to. The recommended 286*663afb9bSAndroid Build Coastguard Worker function is evdns_base_resolv_conf_parse(). 287*663afb9bSAndroid Build Coastguard Worker 288*663afb9bSAndroid Build Coastguard Worker @param flags any of DNS_OPTION_NAMESERVERS|DNS_OPTION_SEARCH|DNS_OPTION_MISC| 289*663afb9bSAndroid Build Coastguard Worker DNS_OPTIONS_ALL 290*663afb9bSAndroid Build Coastguard Worker @param filename the path to the resolv.conf file 291*663afb9bSAndroid Build Coastguard Worker @return 0 if successful, or various positive error codes if an error 292*663afb9bSAndroid Build Coastguard Worker occurred (see above) 293*663afb9bSAndroid Build Coastguard Worker @see resolv.conf(3), evdns_config_windows_nameservers() 294*663afb9bSAndroid Build Coastguard Worker */ 295*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 296*663afb9bSAndroid Build Coastguard Worker int evdns_resolv_conf_parse(int flags, const char *const filename); 297*663afb9bSAndroid Build Coastguard Worker 298*663afb9bSAndroid Build Coastguard Worker /** 299*663afb9bSAndroid Build Coastguard Worker Clear the list of search domains. 300*663afb9bSAndroid Build Coastguard Worker 301*663afb9bSAndroid Build Coastguard Worker @deprecated This function is deprecated because it does not allow the 302*663afb9bSAndroid Build Coastguard Worker caller to specify which evdns_base it applies to. The recommended 303*663afb9bSAndroid Build Coastguard Worker function is evdns_base_search_clear(). 304*663afb9bSAndroid Build Coastguard Worker */ 305*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 306*663afb9bSAndroid Build Coastguard Worker void evdns_search_clear(void); 307*663afb9bSAndroid Build Coastguard Worker 308*663afb9bSAndroid Build Coastguard Worker /** 309*663afb9bSAndroid Build Coastguard Worker Add a domain to the list of search domains 310*663afb9bSAndroid Build Coastguard Worker 311*663afb9bSAndroid Build Coastguard Worker @deprecated This function is deprecated because it does not allow the 312*663afb9bSAndroid Build Coastguard Worker caller to specify which evdns_base it applies to. The recommended 313*663afb9bSAndroid Build Coastguard Worker function is evdns_base_search_add(). 314*663afb9bSAndroid Build Coastguard Worker 315*663afb9bSAndroid Build Coastguard Worker @param domain the domain to be added to the search list 316*663afb9bSAndroid Build Coastguard Worker */ 317*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 318*663afb9bSAndroid Build Coastguard Worker void evdns_search_add(const char *domain); 319*663afb9bSAndroid Build Coastguard Worker 320*663afb9bSAndroid Build Coastguard Worker /** 321*663afb9bSAndroid Build Coastguard Worker Set the 'ndots' parameter for searches. 322*663afb9bSAndroid Build Coastguard Worker 323*663afb9bSAndroid Build Coastguard Worker Sets the number of dots which, when found in a name, causes 324*663afb9bSAndroid Build Coastguard Worker the first query to be without any search domain. 325*663afb9bSAndroid Build Coastguard Worker 326*663afb9bSAndroid Build Coastguard Worker @deprecated This function is deprecated because it does not allow the 327*663afb9bSAndroid Build Coastguard Worker caller to specify which evdns_base it applies to. The recommended 328*663afb9bSAndroid Build Coastguard Worker function is evdns_base_search_ndots_set(). 329*663afb9bSAndroid Build Coastguard Worker 330*663afb9bSAndroid Build Coastguard Worker @param ndots the new ndots parameter 331*663afb9bSAndroid Build Coastguard Worker */ 332*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 333*663afb9bSAndroid Build Coastguard Worker void evdns_search_ndots_set(const int ndots); 334*663afb9bSAndroid Build Coastguard Worker 335*663afb9bSAndroid Build Coastguard Worker /** 336*663afb9bSAndroid Build Coastguard Worker As evdns_server_new_with_base. 337*663afb9bSAndroid Build Coastguard Worker 338*663afb9bSAndroid Build Coastguard Worker @deprecated This function is deprecated because it does not allow the 339*663afb9bSAndroid Build Coastguard Worker caller to specify which even_base it uses. The recommended 340*663afb9bSAndroid Build Coastguard Worker function is evdns_add_server_port_with_base(). 341*663afb9bSAndroid Build Coastguard Worker 342*663afb9bSAndroid Build Coastguard Worker */ 343*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 344*663afb9bSAndroid Build Coastguard Worker struct evdns_server_port * 345*663afb9bSAndroid Build Coastguard Worker evdns_add_server_port(evutil_socket_t socket, int flags, 346*663afb9bSAndroid Build Coastguard Worker evdns_request_callback_fn_type callback, void *user_data); 347*663afb9bSAndroid Build Coastguard Worker 348*663afb9bSAndroid Build Coastguard Worker #ifdef _WIN32 349*663afb9bSAndroid Build Coastguard Worker EVENT2_EXPORT_SYMBOL 350*663afb9bSAndroid Build Coastguard Worker int evdns_config_windows_nameservers(void); 351*663afb9bSAndroid Build Coastguard Worker #define EVDNS_CONFIG_WINDOWS_NAMESERVERS_IMPLEMENTED 352*663afb9bSAndroid Build Coastguard Worker #endif 353*663afb9bSAndroid Build Coastguard Worker 354*663afb9bSAndroid Build Coastguard Worker #ifdef __cplusplus 355*663afb9bSAndroid Build Coastguard Worker } 356*663afb9bSAndroid Build Coastguard Worker #endif 357*663afb9bSAndroid Build Coastguard Worker 358*663afb9bSAndroid Build Coastguard Worker #endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */ 359