]>
Commit | Line | Data |
---|---|---|
c9fdc26e LP |
1 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ |
2 | ||
3 | #pragma once | |
4 | ||
5 | /*** | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2014 Lennart Poettering | |
9 | ||
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. | |
14 | ||
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. | |
19 | ||
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/>. | |
22 | ***/ | |
23 | ||
24 | #include <nss.h> | |
25 | #include <netdb.h> | |
26 | ||
27 | #define NSS_GETHOSTBYNAME_PROTOTYPES(module) \ | |
28 | enum nss_status _nss_##module##_gethostbyname4_r( \ | |
29 | const char *name, \ | |
30 | struct gaih_addrtuple **pat, \ | |
31 | char *buffer, size_t buflen, \ | |
32 | int *errnop, int *h_errnop, \ | |
33 | int32_t *ttlp) _public_; \ | |
34 | enum nss_status _nss_##module##_gethostbyname3_r( \ | |
35 | const char *name, \ | |
36 | int af, \ | |
37 | struct hostent *host, \ | |
38 | char *buffer, size_t buflen, \ | |
39 | int *errnop, int *h_errnop, \ | |
40 | int32_t *ttlp, \ | |
41 | char **canonp) _public_; \ | |
42 | enum nss_status _nss_##module##_gethostbyname2_r( \ | |
43 | const char *name, \ | |
44 | int af, \ | |
45 | struct hostent *host, \ | |
46 | char *buffer, size_t buflen, \ | |
47 | int *errnop, int *h_errnop) _public_; \ | |
48 | enum nss_status _nss_##module##_gethostbyname_r( \ | |
49 | const char *name, \ | |
50 | struct hostent *host, \ | |
51 | char *buffer, size_t buflen, \ | |
52 | int *errnop, int *h_errnop) _public_ | |
53 | ||
54 | #define NSS_GETHOSTBYADDR_PROTOTYPES(module) \ | |
55 | enum nss_status _nss_##module##_gethostbyaddr2_r( \ | |
56 | const void* addr, socklen_t len, \ | |
57 | int af, \ | |
58 | struct hostent *host, \ | |
59 | char *buffer, size_t buflen, \ | |
60 | int *errnop, int *h_errnop, \ | |
61 | int32_t *ttlp) _public_; \ | |
62 | enum nss_status _nss_##module##_gethostbyaddr_r( \ | |
63 | const void* addr, socklen_t len, \ | |
64 | int af, \ | |
65 | struct hostent *host, \ | |
66 | char *buffer, size_t buflen, \ | |
67 | int *errnop, int *h_errnop) _public_ | |
68 | ||
69 | #define NSS_GETHOSTBYNAME_FALLBACKS(module) \ | |
70 | enum nss_status _nss_##module##_gethostbyname2_r( \ | |
71 | const char *name, \ | |
72 | int af, \ | |
73 | struct hostent *host, \ | |
74 | char *buffer, size_t buflen, \ | |
75 | int *errnop, int *h_errnop) { \ | |
76 | return _nss_##module##_gethostbyname3_r( \ | |
77 | name, \ | |
78 | af, \ | |
79 | host, \ | |
80 | buffer, buflen, \ | |
81 | errnop, h_errnop, \ | |
82 | NULL, \ | |
83 | NULL); \ | |
84 | } \ | |
85 | enum nss_status _nss_##module##_gethostbyname_r( \ | |
86 | const char *name, \ | |
87 | struct hostent *host, \ | |
88 | char *buffer, size_t buflen, \ | |
89 | int *errnop, int *h_errnop) { \ | |
90 | return _nss_##module##_gethostbyname3_r( \ | |
91 | name, \ | |
92 | AF_UNSPEC, \ | |
93 | host, \ | |
94 | buffer, buflen, \ | |
95 | errnop, h_errnop, \ | |
96 | NULL, \ | |
97 | NULL); \ | |
98 | } | |
99 | ||
100 | #define NSS_GETHOSTBYADDR_FALLBACKS(module) \ | |
101 | enum nss_status _nss_##module##_gethostbyaddr_r( \ | |
102 | const void* addr, socklen_t len, \ | |
103 | int af, \ | |
104 | struct hostent *host, \ | |
105 | char *buffer, size_t buflen, \ | |
106 | int *errnop, int *h_errnop) { \ | |
107 | return _nss_##module##_gethostbyaddr2_r( \ | |
108 | addr, len, \ | |
109 | af, \ | |
110 | host, \ | |
111 | buffer, buflen, \ | |
112 | errnop, h_errnop, \ | |
113 | NULL); \ | |
114 | } |