Make UEFI boot-platform build again
[haiku.git] / headers / private / net / dns_resolver.h
blobd868ca03810d2ee735af568637f3c966ebbb60f9
1 /*
2 * Copyright 2012 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Paweł Dziepak, pdziepak@quarnos.org
7 */
8 #ifndef DNS_RESOLVER_H
9 #define DNS_RESOLVER_H
12 #include <netdb.h>
13 #include <stdlib.h>
15 #include <module.h>
18 #define DNS_RESOLVER_MODULE_NAME "network/dns_resolver/v1"
21 struct dns_resolver_module {
22 module_info module;
23 status_t (*getaddrinfo)(const char* node, const char* service,
24 const struct addrinfo* hints, struct addrinfo** res);
28 static inline int
29 kgetaddrinfo(const char* node, const char* service,
30 const struct addrinfo* hints, struct addrinfo** res)
32 dns_resolver_module* dns;
33 status_t result = get_module(DNS_RESOLVER_MODULE_NAME,
34 reinterpret_cast<module_info**>(&dns));
35 if (result != B_OK)
36 return result;
38 result = dns->getaddrinfo(node, service, hints, res);
40 put_module(DNS_RESOLVER_MODULE_NAME);
42 return result;
46 static inline void
47 kfreeaddrinfo(struct addrinfo* res)
49 free(res);
53 #define getaddrinfo kgetaddrinfo
54 #define freeaddrinfo kfreeaddrinfo
57 #endif // DNS_RESOLVER_H