libevent: event2/dns_compat.h Source File

libevent 2.1.12 Event notification library

dns_compat.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2006-2007 Niels Provos <provos@citi.umich.edu>
3 * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27#ifndef EVENT2_DNS_COMPAT_H_INCLUDED_
28#define EVENT2_DNS_COMPAT_H_INCLUDED_
29
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42#include <event2/event-config.h>
43#ifdef EVENT__HAVE_SYS_TYPES_H
44#include <sys/types.h>
45#endif
46#ifdef EVENT__HAVE_SYS_TIME_H
47#include <sys/time.h>
48#endif
49
50/* For int types. */
51#include <event2/util.h>
52#include <event2/visibility.h>
53
70EVENT2_EXPORT_SYMBOL
71 int evdns_init(void);
72
73struct evdns_base;
81EVENT2_EXPORT_SYMBOL
82 struct evdns_base *evdns_get_global_base(void);
83
99EVENT2_EXPORT_SYMBOL
100 void evdns_shutdown(int fail_requests);
101
116EVENT2_EXPORT_SYMBOL
117 int evdns_nameserver_add(unsigned long int address);
118
134EVENT2_EXPORT_SYMBOL
135 int evdns_count_nameservers(void);
136
149EVENT2_EXPORT_SYMBOL
150 int evdns_clear_nameservers_and_suspend(void);
151
165EVENT2_EXPORT_SYMBOL
166 int evdns_resume(void);
167
181EVENT2_EXPORT_SYMBOL
182 int evdns_nameserver_ip_add(const char *ip_as_string);
183
198EVENT2_EXPORT_SYMBOL
199 int evdns_resolve_ipv4(const char *name, int flags, evdns_callback_type callback, void *ptr);
200
211EVENT2_EXPORT_SYMBOL
212 int evdns_resolve_ipv6(const char *name, int flags, evdns_callback_type callback, void *ptr);
213
214struct in_addr;
215struct in6_addr;
216
231EVENT2_EXPORT_SYMBOL
232 int evdns_resolve_reverse(const struct in_addr *in, int flags, evdns_callback_type callback, void *ptr);
233
248EVENT2_EXPORT_SYMBOL
249 int evdns_resolve_reverse_ipv6(const struct in6_addr *in, int flags, evdns_callback_type callback, void *ptr);
250
267EVENT2_EXPORT_SYMBOL
268 int evdns_set_option(const char *option, const char *val, int flags);
269
295EVENT2_EXPORT_SYMBOL
296 int evdns_resolv_conf_parse(int flags, const char *const filename);
297
305EVENT2_EXPORT_SYMBOL
306 void evdns_search_clear(void);
307
317EVENT2_EXPORT_SYMBOL
318 void evdns_search_add(const char *domain);
319
332EVENT2_EXPORT_SYMBOL
333 void evdns_search_ndots_set(const int ndots);
334
343EVENT2_EXPORT_SYMBOL
344struct evdns_server_port *
345evdns_add_server_port(evutil_socket_t socket, int flags,
346 evdns_request_callback_fn_type callback, void *user_data);
347
348#ifdef _WIN32
349EVENT2_EXPORT_SYMBOL
350int evdns_config_windows_nameservers(void);
351#define EVDNS_CONFIG_WINDOWS_NAMESERVERS_IMPLEMENTED
352#endif
353
354#ifdef __cplusplus
355}
356#endif
357
358#endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
evdns_request_callback_fn_type
void(* evdns_request_callback_fn_type)(struct evdns_server_request *, void *)
A callback to implement a DNS server.
Definition: dns.h:620
evdns_callback_type
void(* evdns_callback_type)(int result, char type, int count, int ttl, void *addresses, void *arg)
The callback that contains the results from a lookup.
Definition: dns.h:229
evdns_get_global_base
EVENT2_EXPORT_SYMBOL struct evdns_base * evdns_get_global_base(void)
Return the global evdns_base created by event_init() and used by the other deprecated functions.
evdns_search_ndots_set
EVENT2_EXPORT_SYMBOL void evdns_search_ndots_set(const int ndots)
Set the 'ndots' parameter for searches.
evdns_count_nameservers
EVENT2_EXPORT_SYMBOL int evdns_count_nameservers(void)
Get the number of configured nameservers.
evdns_resolve_ipv6
EVENT2_EXPORT_SYMBOL int evdns_resolve_ipv6(const char *name, int flags, evdns_callback_type callback, void *ptr)
Lookup an AAAA record for a given name.
evdns_set_option
EVENT2_EXPORT_SYMBOL int evdns_set_option(const char *option, const char *val, int flags)
Set the value of a configuration option.
evdns_resolve_reverse
EVENT2_EXPORT_SYMBOL int evdns_resolve_reverse(const struct in_addr *in, int flags, evdns_callback_type callback, void *ptr)
Lookup a PTR record for a given IP address.
evdns_resolve_ipv4
EVENT2_EXPORT_SYMBOL int evdns_resolve_ipv4(const char *name, int flags, evdns_callback_type callback, void *ptr)
Lookup an A record for a given name.
evdns_resolve_reverse_ipv6
EVENT2_EXPORT_SYMBOL int evdns_resolve_reverse_ipv6(const struct in6_addr *in, int flags, evdns_callback_type callback, void *ptr)
Lookup a PTR record for a given IPv6 address.
evdns_shutdown
EVENT2_EXPORT_SYMBOL void evdns_shutdown(int fail_requests)
Shut down the asynchronous DNS resolver and terminate all active requests.
evdns_resolv_conf_parse
EVENT2_EXPORT_SYMBOL int evdns_resolv_conf_parse(int flags, const char *const filename)
Parse a resolv.conf file.
evdns_clear_nameservers_and_suspend
EVENT2_EXPORT_SYMBOL int evdns_clear_nameservers_and_suspend(void)
Remove all configured nameservers, and suspend all pending resolves.
evdns_add_server_port
EVENT2_EXPORT_SYMBOL struct evdns_server_port * evdns_add_server_port(evutil_socket_t socket, int flags, evdns_request_callback_fn_type callback, void *user_data)
As evdns_server_new_with_base.
evdns_search_clear
EVENT2_EXPORT_SYMBOL void evdns_search_clear(void)
Clear the list of search domains.
evdns_resume
EVENT2_EXPORT_SYMBOL int evdns_resume(void)
Resume normal operation and continue any suspended resolve requests.
evdns_nameserver_ip_add
EVENT2_EXPORT_SYMBOL int evdns_nameserver_ip_add(const char *ip_as_string)
Add a nameserver.
evdns_init
EVENT2_EXPORT_SYMBOL int evdns_init(void)
Initialize the asynchronous DNS library.
evdns_search_add
EVENT2_EXPORT_SYMBOL void evdns_search_add(const char *domain)
Add a domain to the list of search domains.
evdns_nameserver_add
EVENT2_EXPORT_SYMBOL int evdns_nameserver_add(unsigned long int address)
Add a nameserver.
util.h
Common convenience functions for cross-platform portability and related socket manipulations.
evutil_socket_t
#define evutil_socket_t
A type wide enough to hold the output of "socket()" or "accept()".
Definition: util.h:310