]>
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( \
121 #define NSS_GETHOSTBYADDR_FALLBACKS(module) \
122 enum nss_status _nss_##module##_gethostbyaddr_r( \
123 const void* addr, socklen_t len, \
125 struct hostent *host, \
126 char *buffer, size_t buflen, \
127 int *errnop, int *h_errnop) { \
128 return _nss_##module##_gethostbyaddr2_r( \
137 #define NSS_GETPW_PROTOTYPES(module) \
138 enum nss_status _nss_##module##_getpwnam_r( \
140 struct passwd *pwd, \
141 char *buffer, size_t buflen, \
142 int *errnop) _public_; \
143 enum nss_status _nss_##module##_getpwuid_r( \
145 struct passwd *pwd, \
146 char *buffer, size_t buflen, \
147 int *errnop) _public_
149 #define NSS_GETGR_PROTOTYPES(module) \
150 enum nss_status _nss_##module##_getgrnam_r( \
153 char *buffer, size_t buflen, \
154 int *errnop) _public_; \
155 enum nss_status _nss_##module##_getgrgid_r( \
158 char *buffer, size_t buflen, \
159 int *errnop) _public_
161 typedef enum nss_status (*_nss_gethostbyname4_r_t
)(
163 struct gaih_addrtuple
**pat
,
164 char *buffer
, size_t buflen
,
165 int *errnop
, int *h_errnop
,
168 typedef enum nss_status (*_nss_gethostbyname3_r_t
)(
171 struct hostent
*result
,
172 char *buffer
, size_t buflen
,
173 int *errnop
, int *h_errnop
,
177 typedef enum nss_status (*_nss_gethostbyname2_r_t
)(
180 struct hostent
*result
,
181 char *buffer
, size_t buflen
,
182 int *errnop
, int *h_errnop
);
184 typedef enum nss_status (*_nss_gethostbyname_r_t
)(
186 struct hostent
*result
,
187 char *buffer
, size_t buflen
,
188 int *errnop
, int *h_errnop
);
190 typedef enum nss_status (*_nss_gethostbyaddr2_r_t
)(
191 const void* addr
, socklen_t len
,
193 struct hostent
*result
,
194 char *buffer
, size_t buflen
,
195 int *errnop
, int *h_errnop
,
197 typedef enum nss_status (*_nss_gethostbyaddr_r_t
)(
198 const void* addr
, socklen_t len
,
200 struct hostent
*host
,
201 char *buffer
, size_t buflen
,
202 int *errnop
, int *h_errnop
);