]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/nss-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 This file is part of systemd.
7 Copyright 2014 Lennart Poettering
9 systemd is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public License
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
29 #define NSS_SIGNALS_BLOCK SIGALRM,SIGVTALRM,SIGPIPE,SIGCHLD,SIGTSTP,SIGIO,SIGHUP,SIGUSR1,SIGUSR2,SIGPROF,SIGURG,SIGWINCH
31 #ifndef DEPRECATED_RES_USE_INET6
32 # define DEPRECATED_RES_USE_INET6 0x00002000
35 #define NSS_GETHOSTBYNAME_PROTOTYPES(module) \
36 enum nss_status _nss_##module##_gethostbyname4_r( \
38 struct gaih_addrtuple **pat, \
39 char *buffer, size_t buflen, \
40 int *errnop, int *h_errnop, \
41 int32_t *ttlp) _public_; \
42 enum nss_status _nss_##module##_gethostbyname3_r( \
45 struct hostent *host, \
46 char *buffer, size_t buflen, \
47 int *errnop, int *h_errnop, \
49 char **canonp) _public_; \
50 enum nss_status _nss_##module##_gethostbyname2_r( \
53 struct hostent *host, \
54 char *buffer, size_t buflen, \
55 int *errnop, int *h_errnop) _public_; \
56 enum nss_status _nss_##module##_gethostbyname_r( \
58 struct hostent *host, \
59 char *buffer, size_t buflen, \
60 int *errnop, int *h_errnop) _public_
62 #define NSS_GETHOSTBYADDR_PROTOTYPES(module) \
63 enum nss_status _nss_##module##_gethostbyaddr2_r( \
64 const void* addr, socklen_t len, \
66 struct hostent *host, \
67 char *buffer, size_t buflen, \
68 int *errnop, int *h_errnop, \
69 int32_t *ttlp) _public_; \
70 enum nss_status _nss_##module##_gethostbyaddr_r( \
71 const void* addr, socklen_t len, \
73 struct hostent *host, \
74 char *buffer, size_t buflen, \
75 int *errnop, int *h_errnop) _public_
77 #define NSS_GETHOSTBYNAME_FALLBACKS(module) \
78 enum nss_status _nss_##module##_gethostbyname2_r( \
81 struct hostent *host, \
82 char *buffer, size_t buflen, \
83 int *errnop, int *h_errnop) { \
84 return _nss_##module##_gethostbyname3_r( \
93 enum nss_status _nss_##module##_gethostbyname_r( \
95 struct hostent *host, \
96 char *buffer, size_t buflen, \
97 int *errnop, int *h_errnop) { \
98 enum nss_status ret = NSS_STATUS_NOTFOUND; \
100 if (_res.options & DEPRECATED_RES_USE_INET6) \
101 ret = _nss_##module##_gethostbyname3_r( \
109 if (ret == NSS_STATUS_NOTFOUND) \
110 ret = _nss_##module##_gethostbyname3_r( \
120 struct __useless_struct_to_allow_trailing_semicolon__
122 #define NSS_GETHOSTBYADDR_FALLBACKS(module) \
123 enum nss_status _nss_##module##_gethostbyaddr_r( \
124 const void* addr, socklen_t len, \
126 struct hostent *host, \
127 char *buffer, size_t buflen, \
128 int *errnop, int *h_errnop) { \
129 return _nss_##module##_gethostbyaddr2_r( \
137 struct __useless_struct_to_allow_trailing_semicolon__
139 #define NSS_GETPW_PROTOTYPES(module) \
140 enum nss_status _nss_##module##_getpwnam_r( \
142 struct passwd *pwd, \
143 char *buffer, size_t buflen, \
144 int *errnop) _public_; \
145 enum nss_status _nss_##module##_getpwuid_r( \
147 struct passwd *pwd, \
148 char *buffer, size_t buflen, \
149 int *errnop) _public_
151 #define NSS_GETGR_PROTOTYPES(module) \
152 enum nss_status _nss_##module##_getgrnam_r( \
155 char *buffer, size_t buflen, \
156 int *errnop) _public_; \
157 enum nss_status _nss_##module##_getgrgid_r( \
160 char *buffer, size_t buflen, \
161 int *errnop) _public_
163 typedef enum nss_status (*_nss_gethostbyname4_r_t
)(
165 struct gaih_addrtuple
**pat
,
166 char *buffer
, size_t buflen
,
167 int *errnop
, int *h_errnop
,
170 typedef enum nss_status (*_nss_gethostbyname3_r_t
)(
173 struct hostent
*result
,
174 char *buffer
, size_t buflen
,
175 int *errnop
, int *h_errnop
,
179 typedef enum nss_status (*_nss_gethostbyname2_r_t
)(
182 struct hostent
*result
,
183 char *buffer
, size_t buflen
,
184 int *errnop
, int *h_errnop
);
186 typedef enum nss_status (*_nss_gethostbyname_r_t
)(
188 struct hostent
*result
,
189 char *buffer
, size_t buflen
,
190 int *errnop
, int *h_errnop
);
192 typedef enum nss_status (*_nss_gethostbyaddr2_r_t
)(
193 const void* addr
, socklen_t len
,
195 struct hostent
*result
,
196 char *buffer
, size_t buflen
,
197 int *errnop
, int *h_errnop
,
199 typedef enum nss_status (*_nss_gethostbyaddr_r_t
)(
200 const void* addr
, socklen_t len
,
202 struct hostent
*host
,
203 char *buffer
, size_t buflen
,
204 int *errnop
, int *h_errnop
);