1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright 2014 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
28 #define NSS_GETHOSTBYNAME_PROTOTYPES(module) \
29 enum nss_status _nss_##module##_gethostbyname4_r( \
31 struct gaih_addrtuple **pat, \
32 char *buffer, size_t buflen, \
33 int *errnop, int *h_errnop, \
34 int32_t *ttlp) _public_; \
35 enum nss_status _nss_##module##_gethostbyname3_r( \
38 struct hostent *host, \
39 char *buffer, size_t buflen, \
40 int *errnop, int *h_errnop, \
42 char **canonp) _public_; \
43 enum nss_status _nss_##module##_gethostbyname2_r( \
46 struct hostent *host, \
47 char *buffer, size_t buflen, \
48 int *errnop, int *h_errnop) _public_; \
49 enum nss_status _nss_##module##_gethostbyname_r( \
51 struct hostent *host, \
52 char *buffer, size_t buflen, \
53 int *errnop, int *h_errnop) _public_
55 #define NSS_GETHOSTBYADDR_PROTOTYPES(module) \
56 enum nss_status _nss_##module##_gethostbyaddr2_r( \
57 const void* addr, socklen_t len, \
59 struct hostent *host, \
60 char *buffer, size_t buflen, \
61 int *errnop, int *h_errnop, \
62 int32_t *ttlp) _public_; \
63 enum nss_status _nss_##module##_gethostbyaddr_r( \
64 const void* addr, socklen_t len, \
66 struct hostent *host, \
67 char *buffer, size_t buflen, \
68 int *errnop, int *h_errnop) _public_
70 #define NSS_GETHOSTBYNAME_FALLBACKS(module) \
71 enum nss_status _nss_##module##_gethostbyname2_r( \
74 struct hostent *host, \
75 char *buffer, size_t buflen, \
76 int *errnop, int *h_errnop) { \
77 return _nss_##module##_gethostbyname3_r( \
86 enum nss_status _nss_##module##_gethostbyname_r( \
88 struct hostent *host, \
89 char *buffer, size_t buflen, \
90 int *errnop, int *h_errnop) { \
91 enum nss_status ret = NSS_STATUS_NOTFOUND; \
93 if (_res.options & RES_USE_INET6) \
94 ret = _nss_##module##_gethostbyname3_r( \
102 if (ret == NSS_STATUS_NOTFOUND) \
103 ret = _nss_##module##_gethostbyname3_r( \
114 #define NSS_GETHOSTBYADDR_FALLBACKS(module) \
115 enum nss_status _nss_##module##_gethostbyaddr_r( \
116 const void* addr, socklen_t len, \
118 struct hostent *host, \
119 char *buffer, size_t buflen, \
120 int *errnop, int *h_errnop) { \
121 return _nss_##module##_gethostbyaddr2_r( \