]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/nss-util.h
4 This file is part of systemd.
6 Copyright 2014 Lennart Poettering
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
28 #define NSS_SIGNALS_BLOCK SIGALRM,SIGVTALRM,SIGPIPE,SIGCHLD,SIGTSTP,SIGIO,SIGHUP,SIGUSR1,SIGUSR2,SIGPROF,SIGURG,SIGWINCH
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_##module##_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_
158 typedef enum nss_status (*_nss_gethostbyname4_r_t
)(
160 struct gaih_addrtuple
**pat
,
161 char *buffer
, size_t buflen
,
162 int *errnop
, int *h_errnop
,
165 typedef enum nss_status (*_nss_gethostbyname3_r_t
)(
168 struct hostent
*result
,
169 char *buffer
, size_t buflen
,
170 int *errnop
, int *h_errnop
,
174 typedef enum nss_status (*_nss_gethostbyname2_r_t
)(
177 struct hostent
*result
,
178 char *buffer
, size_t buflen
,
179 int *errnop
, int *h_errnop
);
181 typedef enum nss_status (*_nss_gethostbyname_r_t
)(
183 struct hostent
*result
,
184 char *buffer
, size_t buflen
,
185 int *errnop
, int *h_errnop
);
187 typedef enum nss_status (*_nss_gethostbyaddr2_r_t
)(
188 const void* addr
, socklen_t len
,
190 struct hostent
*result
,
191 char *buffer
, size_t buflen
,
192 int *errnop
, int *h_errnop
,
194 typedef enum nss_status (*_nss_gethostbyaddr_r_t
)(
195 const void* addr
, socklen_t len
,
197 struct hostent
*host
,
198 char *buffer
, size_t buflen
,
199 int *errnop
, int *h_errnop
);