]>
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
16 #define NSS_SIGNALS_BLOCK SIGALRM,SIGVTALRM,SIGPIPE,SIGCHLD,SIGTSTP,SIGIO,SIGHUP,SIGUSR1,SIGUSR2,SIGPROF,SIGURG,SIGWINCH
18 #ifndef DEPRECATED_RES_USE_INET6
19 # define DEPRECATED_RES_USE_INET6 0x00002000
22 #define NSS_GETHOSTBYNAME_PROTOTYPES(module) \
23 enum nss_status _nss_##module##_gethostbyname4_r( \
25 struct gaih_addrtuple **pat, \
26 char *buffer, size_t buflen, \
27 int *errnop, int *h_errnop, \
28 int32_t *ttlp) _public_; \
29 enum nss_status _nss_##module##_gethostbyname3_r( \
32 struct hostent *host, \
33 char *buffer, size_t buflen, \
34 int *errnop, int *h_errnop, \
36 char **canonp) _public_; \
37 enum nss_status _nss_##module##_gethostbyname2_r( \
40 struct hostent *host, \
41 char *buffer, size_t buflen, \
42 int *errnop, int *h_errnop) _public_; \
43 enum nss_status _nss_##module##_gethostbyname_r( \
45 struct hostent *host, \
46 char *buffer, size_t buflen, \
47 int *errnop, int *h_errnop) _public_
49 #define NSS_GETHOSTBYADDR_PROTOTYPES(module) \
50 enum nss_status _nss_##module##_gethostbyaddr2_r( \
51 const void* addr, socklen_t len, \
53 struct hostent *host, \
54 char *buffer, size_t buflen, \
55 int *errnop, int *h_errnop, \
56 int32_t *ttlp) _public_; \
57 enum nss_status _nss_##module##_gethostbyaddr_r( \
58 const void* addr, socklen_t len, \
60 struct hostent *host, \
61 char *buffer, size_t buflen, \
62 int *errnop, int *h_errnop) _public_
64 #define NSS_GETHOSTBYNAME_FALLBACKS(module) \
65 enum nss_status _nss_##module##_gethostbyname2_r( \
68 struct hostent *host, \
69 char *buffer, size_t buflen, \
70 int *errnop, int *h_errnop) { \
71 return _nss_##module##_gethostbyname3_r( \
80 enum nss_status _nss_##module##_gethostbyname_r( \
82 struct hostent *host, \
83 char *buffer, size_t buflen, \
84 int *errnop, int *h_errnop) { \
85 enum nss_status ret = NSS_STATUS_NOTFOUND; \
87 if (_res.options & DEPRECATED_RES_USE_INET6) \
88 ret = _nss_##module##_gethostbyname3_r( \
96 if (ret == NSS_STATUS_NOTFOUND) \
97 ret = _nss_##module##_gethostbyname3_r( \
108 #define NSS_GETHOSTBYADDR_FALLBACKS(module) \
109 enum nss_status _nss_##module##_gethostbyaddr_r( \
110 const void* addr, socklen_t len, \
112 struct hostent *host, \
113 char *buffer, size_t buflen, \
114 int *errnop, int *h_errnop) { \
115 return _nss_##module##_gethostbyaddr2_r( \
124 #define NSS_GETPW_PROTOTYPES(module) \
125 enum nss_status _nss_##module##_getpwnam_r( \
127 struct passwd *pwd, \
128 char *buffer, size_t buflen, \
129 int *errnop) _public_; \
130 enum nss_status _nss_##module##_getpwuid_r( \
132 struct passwd *pwd, \
133 char *buffer, size_t buflen, \
134 int *errnop) _public_
136 #define NSS_GETGR_PROTOTYPES(module) \
137 enum nss_status _nss_##module##_getgrnam_r( \
140 char *buffer, size_t buflen, \
141 int *errnop) _public_; \
142 enum nss_status _nss_##module##_getgrgid_r( \
145 char *buffer, size_t buflen, \
146 int *errnop) _public_
148 typedef enum nss_status (*_nss_gethostbyname4_r_t
)(
150 struct gaih_addrtuple
**pat
,
151 char *buffer
, size_t buflen
,
152 int *errnop
, int *h_errnop
,
155 typedef enum nss_status (*_nss_gethostbyname3_r_t
)(
158 struct hostent
*result
,
159 char *buffer
, size_t buflen
,
160 int *errnop
, int *h_errnop
,
164 typedef enum nss_status (*_nss_gethostbyname2_r_t
)(
167 struct hostent
*result
,
168 char *buffer
, size_t buflen
,
169 int *errnop
, int *h_errnop
);
171 typedef enum nss_status (*_nss_gethostbyname_r_t
)(
173 struct hostent
*result
,
174 char *buffer
, size_t buflen
,
175 int *errnop
, int *h_errnop
);
177 typedef enum nss_status (*_nss_gethostbyaddr2_r_t
)(
178 const void* addr
, socklen_t len
,
180 struct hostent
*result
,
181 char *buffer
, size_t buflen
,
182 int *errnop
, int *h_errnop
,
184 typedef enum nss_status (*_nss_gethostbyaddr_r_t
)(
185 const void* addr
, socklen_t len
,
187 struct hostent
*host
,
188 char *buffer
, size_t buflen
,
189 int *errnop
, int *h_errnop
);