]>
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 #ifndef DEPRECATED_RES_USE_INET6
31 # define DEPRECATED_RES_USE_INET6 0x00002000
34 #define NSS_GETHOSTBYNAME_PROTOTYPES(module) \
35 enum nss_status _nss_##module##_gethostbyname4_r( \
37 struct gaih_addrtuple **pat, \
38 char *buffer, size_t buflen, \
39 int *errnop, int *h_errnop, \
40 int32_t *ttlp) _public_; \
41 enum nss_status _nss_##module##_gethostbyname3_r( \
44 struct hostent *host, \
45 char *buffer, size_t buflen, \
46 int *errnop, int *h_errnop, \
48 char **canonp) _public_; \
49 enum nss_status _nss_##module##_gethostbyname2_r( \
52 struct hostent *host, \
53 char *buffer, size_t buflen, \
54 int *errnop, int *h_errnop) _public_; \
55 enum nss_status _nss_##module##_gethostbyname_r( \
57 struct hostent *host, \
58 char *buffer, size_t buflen, \
59 int *errnop, int *h_errnop) _public_
61 #define NSS_GETHOSTBYADDR_PROTOTYPES(module) \
62 enum nss_status _nss_##module##_gethostbyaddr2_r( \
63 const void* addr, socklen_t len, \
65 struct hostent *host, \
66 char *buffer, size_t buflen, \
67 int *errnop, int *h_errnop, \
68 int32_t *ttlp) _public_; \
69 enum nss_status _nss_##module##_gethostbyaddr_r( \
70 const void* addr, socklen_t len, \
72 struct hostent *host, \
73 char *buffer, size_t buflen, \
74 int *errnop, int *h_errnop) _public_
76 #define NSS_GETHOSTBYNAME_FALLBACKS(module) \
77 enum nss_status _nss_##module##_gethostbyname2_r( \
80 struct hostent *host, \
81 char *buffer, size_t buflen, \
82 int *errnop, int *h_errnop) { \
83 return _nss_##module##_gethostbyname3_r( \
92 enum nss_status _nss_##module##_gethostbyname_r( \
94 struct hostent *host, \
95 char *buffer, size_t buflen, \
96 int *errnop, int *h_errnop) { \
97 enum nss_status ret = NSS_STATUS_NOTFOUND; \
99 if (_res.options & DEPRECATED_RES_USE_INET6) \
100 ret = _nss_##module##_gethostbyname3_r( \
108 if (ret == NSS_STATUS_NOTFOUND) \
109 ret = _nss_##module##_gethostbyname3_r( \
119 struct __useless_struct_to_allow_trailing_semicolon__
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( \
136 struct __useless_struct_to_allow_trailing_semicolon__
138 #define NSS_GETPW_PROTOTYPES(module) \
139 enum nss_status _nss_##module##_getpwnam_r( \
141 struct passwd *pwd, \
142 char *buffer, size_t buflen, \
143 int *errnop) _public_; \
144 enum nss_status _nss_##module##_getpwuid_r( \
146 struct passwd *pwd, \
147 char *buffer, size_t buflen, \
148 int *errnop) _public_
150 #define NSS_GETGR_PROTOTYPES(module) \
151 enum nss_status _nss_##module##_getgrnam_r( \
154 char *buffer, size_t buflen, \
155 int *errnop) _public_; \
156 enum nss_status _nss_##module##_getgrgid_r( \
159 char *buffer, size_t buflen, \
160 int *errnop) _public_
162 typedef enum nss_status (*_nss_gethostbyname4_r_t
)(
164 struct gaih_addrtuple
**pat
,
165 char *buffer
, size_t buflen
,
166 int *errnop
, int *h_errnop
,
169 typedef enum nss_status (*_nss_gethostbyname3_r_t
)(
172 struct hostent
*result
,
173 char *buffer
, size_t buflen
,
174 int *errnop
, int *h_errnop
,
178 typedef enum nss_status (*_nss_gethostbyname2_r_t
)(
181 struct hostent
*result
,
182 char *buffer
, size_t buflen
,
183 int *errnop
, int *h_errnop
);
185 typedef enum nss_status (*_nss_gethostbyname_r_t
)(
187 struct hostent
*result
,
188 char *buffer
, size_t buflen
,
189 int *errnop
, int *h_errnop
);
191 typedef enum nss_status (*_nss_gethostbyaddr2_r_t
)(
192 const void* addr
, socklen_t len
,
194 struct hostent
*result
,
195 char *buffer
, size_t buflen
,
196 int *errnop
, int *h_errnop
,
198 typedef enum nss_status (*_nss_gethostbyaddr_r_t
)(
199 const void* addr
, socklen_t len
,
201 struct hostent
*host
,
202 char *buffer
, size_t buflen
,
203 int *errnop
, int *h_errnop
);