]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/nss-util.h
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/>.
30 #define NSS_GETHOSTBYNAME_PROTOTYPES(module) \
31 enum nss_status _nss_##module##_gethostbyname4_r( \
33 struct gaih_addrtuple **pat, \
34 char *buffer, size_t buflen, \
35 int *errnop, int *h_errnop, \
36 int32_t *ttlp) _public_; \
37 enum nss_status _nss_##module##_gethostbyname3_r( \
40 struct hostent *host, \
41 char *buffer, size_t buflen, \
42 int *errnop, int *h_errnop, \
44 char **canonp) _public_; \
45 enum nss_status _nss_##module##_gethostbyname2_r( \
48 struct hostent *host, \
49 char *buffer, size_t buflen, \
50 int *errnop, int *h_errnop) _public_; \
51 enum nss_status _nss_##module##_gethostbyname_r( \
53 struct hostent *host, \
54 char *buffer, size_t buflen, \
55 int *errnop, int *h_errnop) _public_
57 #define NSS_GETHOSTBYADDR_PROTOTYPES(module) \
58 enum nss_status _nss_##module##_gethostbyaddr2_r( \
59 const void* addr, socklen_t len, \
61 struct hostent *host, \
62 char *buffer, size_t buflen, \
63 int *errnop, int *h_errnop, \
64 int32_t *ttlp) _public_; \
65 enum nss_status _nss_##module##_gethostbyaddr_r( \
66 const void* addr, socklen_t len, \
68 struct hostent *host, \
69 char *buffer, size_t buflen, \
70 int *errnop, int *h_errnop) _public_
72 #define NSS_GETHOSTBYNAME_FALLBACKS(module) \
73 enum nss_status _nss_##module##_gethostbyname2_r( \
76 struct hostent *host, \
77 char *buffer, size_t buflen, \
78 int *errnop, int *h_errnop) { \
79 return _nss_##module##_gethostbyname3_r( \
88 enum nss_status _nss_##module##_gethostbyname_r( \
90 struct hostent *host, \
91 char *buffer, size_t buflen, \
92 int *errnop, int *h_errnop) { \
93 enum nss_status ret = NSS_STATUS_NOTFOUND; \
95 if (_res.options & RES_USE_INET6) \
96 ret = _nss_##module##_gethostbyname3_r( \
104 if (ret == NSS_STATUS_NOTFOUND) \
105 ret = _nss_##module##_gethostbyname3_r( \
115 struct __useless_struct_to_allow_trailing_semicolon__
117 #define NSS_GETHOSTBYADDR_FALLBACKS(module) \
118 enum nss_status _nss_##module##_gethostbyaddr_r( \
119 const void* addr, socklen_t len, \
121 struct hostent *host, \
122 char *buffer, size_t buflen, \
123 int *errnop, int *h_errnop) { \
124 return _nss_##module##_gethostbyaddr2_r( \
132 struct __useless_struct_to_allow_trailing_semicolon__
134 #define NSS_GETPW_PROTOTYPES(module) \
135 enum nss_status _nss_##module##_getpwnam_r( \
137 struct passwd *pwd, \
138 char *buffer, size_t buflen, \
139 int *errnop) _public_; \
140 enum nss_status _nss_mymachines_getpwuid_r( \
142 struct passwd *pwd, \
143 char *buffer, size_t buflen, \
144 int *errnop) _public_
146 #define NSS_GETGR_PROTOTYPES(module) \
147 enum nss_status _nss_##module##_getgrnam_r( \
150 char *buffer, size_t buflen, \
151 int *errnop) _public_; \
152 enum nss_status _nss_##module##_getgrgid_r( \
155 char *buffer, size_t buflen, \
156 int *errnop) _public_