Use Botan 2.12.1 for tests
[strongswan.git] / src / libstrongswan / networking / host_resolver.h
1 /*
2 * Copyright (C) 2012 Tobias Brunner
3 * HSR Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup host_resolver host_resolver
18 * @{ @ingroup networking
19 */
20
21 #ifndef HOST_RESOLVER_H_
22 #define HOST_RESOLVER_H_
23
24 #include "host.h"
25
26 typedef struct host_resolver_t host_resolver_t;
27
28 /**
29 * Resolve hosts by DNS name but do so in a separate thread (calling
30 * getaddrinfo(3) directly might block indefinitely, or at least a very long
31 * time if no DNS servers are reachable).
32 */
33 struct host_resolver_t {
34
35 /**
36 * Resolve host from the given DNS name.
37 *
38 * @param name name to lookup
39 * @param family requested address family
40 * @return resolved host or NULL if failed or canceled
41 */
42 host_t *(*resolve)(host_resolver_t *this, char *name, int family);
43
44 /**
45 * Flush the queue of queries. No new queries will be accepted afterwards.
46 */
47 void (*flush)(host_resolver_t *this);
48
49 /**
50 * Destroy a host_resolver_t.
51 */
52 void (*destroy)(host_resolver_t *this);
53 };
54
55 /**
56 * Create a host_resolver_t instance.
57 */
58 host_resolver_t *host_resolver_create();
59
60 #endif /** HOST_RESOLVER_H_ @}*/