]>
git.proxmox.com Git - systemd.git/blob - src/shared/nss-util.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright 2014 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
31 #define NSS_GETHOSTBYNAME_PROTOTYPES(module) \
32 enum nss_status _nss_##module##_gethostbyname4_r( \
34 struct gaih_addrtuple **pat, \
35 char *buffer, size_t buflen, \
36 int *errnop, int *h_errnop, \
37 int32_t *ttlp) _public_; \
38 enum nss_status _nss_##module##_gethostbyname3_r( \
41 struct hostent *host, \
42 char *buffer, size_t buflen, \
43 int *errnop, int *h_errnop, \
45 char **canonp) _public_; \
46 enum nss_status _nss_##module##_gethostbyname2_r( \
49 struct hostent *host, \
50 char *buffer, size_t buflen, \
51 int *errnop, int *h_errnop) _public_; \
52 enum nss_status _nss_##module##_gethostbyname_r( \
54 struct hostent *host, \
55 char *buffer, size_t buflen, \
56 int *errnop, int *h_errnop) _public_
58 #define NSS_GETHOSTBYADDR_PROTOTYPES(module) \
59 enum nss_status _nss_##module##_gethostbyaddr2_r( \
60 const void* addr, socklen_t len, \
62 struct hostent *host, \
63 char *buffer, size_t buflen, \
64 int *errnop, int *h_errnop, \
65 int32_t *ttlp) _public_; \
66 enum nss_status _nss_##module##_gethostbyaddr_r( \
67 const void* addr, socklen_t len, \
69 struct hostent *host, \
70 char *buffer, size_t buflen, \
71 int *errnop, int *h_errnop) _public_
73 #define NSS_GETHOSTBYNAME_FALLBACKS(module) \
74 enum nss_status _nss_##module##_gethostbyname2_r( \
77 struct hostent *host, \
78 char *buffer, size_t buflen, \
79 int *errnop, int *h_errnop) { \
80 return _nss_##module##_gethostbyname3_r( \
89 enum nss_status _nss_##module##_gethostbyname_r( \
91 struct hostent *host, \
92 char *buffer, size_t buflen, \
93 int *errnop, int *h_errnop) { \
94 enum nss_status ret = NSS_STATUS_NOTFOUND; \
96 if (_res.options & RES_USE_INET6) \
97 ret = _nss_##module##_gethostbyname3_r( \
105 if (ret == NSS_STATUS_NOTFOUND) \
106 ret = _nss_##module##_gethostbyname3_r( \
116 struct __useless_struct_to_allow_trailing_semicolon__
118 #define NSS_GETHOSTBYADDR_FALLBACKS(module) \
119 enum nss_status _nss_##module##_gethostbyaddr_r( \
120 const void* addr, socklen_t len, \
122 struct hostent *host, \
123 char *buffer, size_t buflen, \
124 int *errnop, int *h_errnop) { \
125 return _nss_##module##_gethostbyaddr2_r( \
133 struct __useless_struct_to_allow_trailing_semicolon__
135 #define NSS_GETPW_PROTOTYPES(module) \
136 enum nss_status _nss_##module##_getpwnam_r( \
138 struct passwd *pwd, \
139 char *buffer, size_t buflen, \
140 int *errnop) _public_; \
141 enum nss_status _nss_mymachines_getpwuid_r( \
143 struct passwd *pwd, \
144 char *buffer, size_t buflen, \
145 int *errnop) _public_
147 #define NSS_GETGR_PROTOTYPES(module) \
148 enum nss_status _nss_##module##_getgrnam_r( \
151 char *buffer, size_t buflen, \
152 int *errnop) _public_; \
153 enum nss_status _nss_##module##_getgrgid_r( \
156 char *buffer, size_t buflen, \
157 int *errnop) _public_