1 | /* |
2 | * Copyright (c) 2010, Oracle America, Inc. |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions are |
6 | * met: |
7 | * |
8 | * * Redistributions of source code must retain the above copyright |
9 | * notice, this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above |
11 | * copyright notice, this list of conditions and the following |
12 | * disclaimer in the documentation and/or other materials |
13 | * provided with the distribution. |
14 | * * Neither the name of the "Oracle America, Inc." nor the names of its |
15 | * contributors may be used to endorse or promote products derived |
16 | * from this software without specific prior written permission. |
17 | * |
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
23 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
25 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
27 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | */ |
31 | |
32 | #ifndef __RPCSVC_YP_H__ |
33 | #define __RPCSVC_YP_H__ |
34 | |
35 | #include <features.h> |
36 | #include <rpc/rpc.h> |
37 | |
38 | #define YPMAXRECORD 1024 |
39 | #define YPMAXDOMAIN 64 |
40 | #define YPMAXMAP 64 |
41 | #define YPMAXPEER 64 |
42 | |
43 | enum ypstat { |
44 | YP_TRUE = 1, |
45 | YP_NOMORE = 2, |
46 | YP_FALSE = 0, |
47 | YP_NOMAP = -1, |
48 | YP_NODOM = -2, |
49 | YP_NOKEY = -3, |
50 | YP_BADOP = -4, |
51 | YP_BADDB = -5, |
52 | YP_YPERR = -6, |
53 | YP_BADARGS = -7, |
54 | YP_VERS = -8, |
55 | }; |
56 | typedef enum ypstat ypstat; |
57 | |
58 | enum ypxfrstat { |
59 | YPXFR_SUCC = 1, |
60 | YPXFR_AGE = 2, |
61 | YPXFR_NOMAP = -1, |
62 | YPXFR_NODOM = -2, |
63 | YPXFR_RSRC = -3, |
64 | YPXFR_RPC = -4, |
65 | YPXFR_MADDR = -5, |
66 | YPXFR_YPERR = -6, |
67 | YPXFR_BADARGS = -7, |
68 | YPXFR_DBM = -8, |
69 | YPXFR_FILE = -9, |
70 | YPXFR_SKEW = -10, |
71 | YPXFR_CLEAR = -11, |
72 | YPXFR_FORCE = -12, |
73 | YPXFR_XFRERR = -13, |
74 | YPXFR_REFUSED = -14, |
75 | }; |
76 | typedef enum ypxfrstat ypxfrstat; |
77 | |
78 | typedef char *domainname; |
79 | typedef char *mapname; |
80 | typedef char *peername; |
81 | |
82 | typedef struct { |
83 | u_int keydat_len; |
84 | char *keydat_val; |
85 | } keydat; |
86 | |
87 | typedef struct { |
88 | u_int valdat_len; |
89 | char *valdat_val; |
90 | } valdat; |
91 | |
92 | struct ypmap_parms { |
93 | domainname domain; |
94 | mapname map; |
95 | u_int ordernum; |
96 | peername peer; |
97 | }; |
98 | typedef struct ypmap_parms ypmap_parms; |
99 | |
100 | struct ypreq_key { |
101 | domainname domain; |
102 | mapname map; |
103 | keydat key; |
104 | }; |
105 | typedef struct ypreq_key ypreq_key; |
106 | |
107 | struct ypreq_nokey { |
108 | domainname domain; |
109 | mapname map; |
110 | }; |
111 | typedef struct ypreq_nokey ypreq_nokey; |
112 | |
113 | struct ypreq_xfr { |
114 | ypmap_parms map_parms; |
115 | u_int transid; |
116 | u_int prog; |
117 | u_int port; |
118 | }; |
119 | typedef struct ypreq_xfr ypreq_xfr; |
120 | |
121 | struct ypresp_val { |
122 | ypstat stat; |
123 | valdat val; |
124 | }; |
125 | typedef struct ypresp_val ypresp_val; |
126 | |
127 | struct ypresp_key_val { |
128 | ypstat stat; |
129 | #ifdef STUPID_SUN_BUG |
130 | /* This is the form as distributed by Sun. But even the Sun NIS |
131 | servers expect the values in the other order. So their |
132 | implementation somehow must change the order internally. We |
133 | don't want to follow this bad example since the user should be |
134 | able to use rpcgen on this file. */ |
135 | keydat key; |
136 | valdat val; |
137 | #else |
138 | valdat val; |
139 | keydat key; |
140 | #endif |
141 | }; |
142 | typedef struct ypresp_key_val ypresp_key_val; |
143 | |
144 | struct ypresp_master { |
145 | ypstat stat; |
146 | peername peer; |
147 | }; |
148 | typedef struct ypresp_master ypresp_master; |
149 | |
150 | struct ypresp_order { |
151 | ypstat stat; |
152 | u_int ordernum; |
153 | }; |
154 | typedef struct ypresp_order ypresp_order; |
155 | |
156 | struct ypresp_all { |
157 | bool_t more; |
158 | union { |
159 | ypresp_key_val val; |
160 | } ypresp_all_u; |
161 | }; |
162 | typedef struct ypresp_all ypresp_all; |
163 | |
164 | struct ypresp_xfr { |
165 | u_int transid; |
166 | ypxfrstat xfrstat; |
167 | }; |
168 | typedef struct ypresp_xfr ypresp_xfr; |
169 | |
170 | struct ypmaplist { |
171 | mapname map; |
172 | struct ypmaplist *next; |
173 | }; |
174 | typedef struct ypmaplist ypmaplist; |
175 | |
176 | struct ypresp_maplist { |
177 | ypstat stat; |
178 | ypmaplist *maps; |
179 | }; |
180 | typedef struct ypresp_maplist ypresp_maplist; |
181 | |
182 | enum yppush_status { |
183 | YPPUSH_SUCC = 1, |
184 | YPPUSH_AGE = 2, |
185 | YPPUSH_NOMAP = -1, |
186 | YPPUSH_NODOM = -2, |
187 | YPPUSH_RSRC = -3, |
188 | YPPUSH_RPC = -4, |
189 | YPPUSH_MADDR = -5, |
190 | YPPUSH_YPERR = -6, |
191 | YPPUSH_BADARGS = -7, |
192 | YPPUSH_DBM = -8, |
193 | YPPUSH_FILE = -9, |
194 | YPPUSH_SKEW = -10, |
195 | YPPUSH_CLEAR = -11, |
196 | YPPUSH_FORCE = -12, |
197 | YPPUSH_XFRERR = -13, |
198 | YPPUSH_REFUSED = -14, |
199 | }; |
200 | typedef enum yppush_status yppush_status; |
201 | |
202 | struct yppushresp_xfr { |
203 | u_int transid; |
204 | yppush_status status; |
205 | }; |
206 | typedef struct yppushresp_xfr yppushresp_xfr; |
207 | |
208 | enum ypbind_resptype { |
209 | YPBIND_SUCC_VAL = 1, |
210 | YPBIND_FAIL_VAL = 2, |
211 | }; |
212 | typedef enum ypbind_resptype ypbind_resptype; |
213 | |
214 | struct ypbind_binding { |
215 | char ypbind_binding_addr[4]; |
216 | char ypbind_binding_port[2]; |
217 | }; |
218 | typedef struct ypbind_binding ypbind_binding; |
219 | |
220 | struct ypbind_resp { |
221 | ypbind_resptype ypbind_status; |
222 | union { |
223 | u_int ypbind_error; |
224 | ypbind_binding ypbind_bindinfo; |
225 | } ypbind_resp_u; |
226 | }; |
227 | typedef struct ypbind_resp ypbind_resp; |
228 | |
229 | #define YPBIND_ERR_ERR 1 |
230 | #define YPBIND_ERR_NOSERV 2 |
231 | #define YPBIND_ERR_RESC 3 |
232 | |
233 | struct ypbind_setdom { |
234 | domainname ypsetdom_domain; |
235 | ypbind_binding ypsetdom_binding; |
236 | u_int ypsetdom_vers; |
237 | }; |
238 | typedef struct ypbind_setdom ypbind_setdom; |
239 | |
240 | __BEGIN_DECLS |
241 | |
242 | #define YPPROG 100004 |
243 | #define YPVERS 2 |
244 | |
245 | #define YPPROC_NULL 0 |
246 | extern void *ypproc_null_2 (void *, CLIENT *); |
247 | extern void *ypproc_null_2_svc (void *, struct svc_req *); |
248 | #define YPPROC_DOMAIN 1 |
249 | extern bool_t *ypproc_domain_2 (domainname *, CLIENT *); |
250 | extern bool_t *ypproc_domain_2_svc (domainname *, struct svc_req *); |
251 | #define YPPROC_DOMAIN_NONACK 2 |
252 | extern bool_t *ypproc_domain_nonack_2 (domainname *, CLIENT *); |
253 | extern bool_t *ypproc_domain_nonack_2_svc (domainname *, struct svc_req *); |
254 | #define YPPROC_MATCH 3 |
255 | extern ypresp_val *ypproc_match_2 (ypreq_key *, CLIENT *); |
256 | extern ypresp_val *ypproc_match_2_svc (ypreq_key *, struct svc_req *); |
257 | #define YPPROC_FIRST 4 |
258 | extern ypresp_key_val *ypproc_first_2 (ypreq_key *, CLIENT *); |
259 | extern ypresp_key_val *ypproc_first_2_svc (ypreq_key *, struct svc_req *); |
260 | #define YPPROC_NEXT 5 |
261 | extern ypresp_key_val *ypproc_next_2 (ypreq_key *, CLIENT *); |
262 | extern ypresp_key_val *ypproc_next_2_svc (ypreq_key *, struct svc_req *); |
263 | #define YPPROC_XFR 6 |
264 | extern ypresp_xfr *ypproc_xfr_2 (ypreq_xfr *, CLIENT *); |
265 | extern ypresp_xfr *ypproc_xfr_2_svc (ypreq_xfr *, struct svc_req *); |
266 | #define YPPROC_CLEAR 7 |
267 | extern void *ypproc_clear_2 (void *, CLIENT *); |
268 | extern void *ypproc_clear_2_svc (void *, struct svc_req *); |
269 | #define YPPROC_ALL 8 |
270 | extern ypresp_all *ypproc_all_2 (ypreq_nokey *, CLIENT *); |
271 | extern ypresp_all *ypproc_all_2_svc (ypreq_nokey *, struct svc_req *); |
272 | #define YPPROC_MASTER 9 |
273 | extern ypresp_master *ypproc_master_2 (ypreq_nokey *, CLIENT *); |
274 | extern ypresp_master *ypproc_master_2_svc (ypreq_nokey *, struct svc_req *); |
275 | #define YPPROC_ORDER 10 |
276 | extern ypresp_order *ypproc_order_2 (ypreq_nokey *, CLIENT *); |
277 | extern ypresp_order *ypproc_order_2_svc (ypreq_nokey *, struct svc_req *); |
278 | #define YPPROC_MAPLIST 11 |
279 | extern ypresp_maplist *ypproc_maplist_2 (domainname *, CLIENT *); |
280 | extern ypresp_maplist *ypproc_maplist_2_svc (domainname *, struct svc_req *); |
281 | extern int ypprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t); |
282 | |
283 | |
284 | #define YPPUSH_XFRRESPPROG (0x40000000) |
285 | #define YPPUSH_XFRRESPVERS 1 |
286 | |
287 | #define YPPUSHPROC_NULL 0 |
288 | extern void *yppushproc_null_1 (void *, CLIENT *); |
289 | extern void *yppushproc_null_1_svc (void *, struct svc_req *); |
290 | #define YPPUSHPROC_XFRRESP 1 |
291 | extern void *yppushproc_xfrresp_1 (yppushresp_xfr *, CLIENT *); |
292 | extern void *yppushproc_xfrresp_1_svc (yppushresp_xfr *, struct svc_req *); |
293 | extern int yppush_xfrrespprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); |
294 | |
295 | |
296 | #define YPBINDPROG 100007 |
297 | #define YPBINDVERS 2 |
298 | |
299 | #define YPBINDPROC_NULL 0 |
300 | extern void *ypbindproc_null_2 (void *, CLIENT *); |
301 | extern void *ypbindproc_null_2_svc (void *, struct svc_req *); |
302 | #define YPBINDPROC_DOMAIN 1 |
303 | extern ypbind_resp *ypbindproc_domain_2 (domainname *, CLIENT *); |
304 | extern ypbind_resp *ypbindproc_domain_2_svc (domainname *, struct svc_req *); |
305 | #define YPBINDPROC_SETDOM 2 |
306 | extern void *ypbindproc_setdom_2 (ypbind_setdom *, CLIENT *); |
307 | extern void *ypbindproc_setdom_2_svc (ypbind_setdom *, struct svc_req *); |
308 | extern int ypbindprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t); |
309 | |
310 | |
311 | extern bool_t xdr_ypstat (XDR *, ypstat*); |
312 | extern bool_t xdr_ypxfrstat (XDR *, ypxfrstat*); |
313 | extern bool_t xdr_domainname (XDR *, domainname*); |
314 | extern bool_t xdr_mapname (XDR *, mapname*); |
315 | extern bool_t xdr_peername (XDR *, peername*); |
316 | extern bool_t xdr_keydat (XDR *, keydat*); |
317 | extern bool_t xdr_valdat (XDR *, valdat*); |
318 | extern bool_t xdr_ypmap_parms (XDR *, ypmap_parms*); |
319 | extern bool_t xdr_ypreq_key (XDR *, ypreq_key*); |
320 | extern bool_t xdr_ypreq_nokey (XDR *, ypreq_nokey*); |
321 | extern bool_t xdr_ypreq_xfr (XDR *, ypreq_xfr*); |
322 | extern bool_t xdr_ypresp_val (XDR *, ypresp_val*); |
323 | extern bool_t xdr_ypresp_key_val (XDR *, ypresp_key_val*); |
324 | extern bool_t xdr_ypresp_master (XDR *, ypresp_master*); |
325 | extern bool_t xdr_ypresp_order (XDR *, ypresp_order*); |
326 | extern bool_t xdr_ypresp_all (XDR *, ypresp_all*); |
327 | extern bool_t xdr_ypresp_xfr (XDR *, ypresp_xfr*); |
328 | extern bool_t xdr_ypmaplist (XDR *, ypmaplist*); |
329 | extern bool_t xdr_ypresp_maplist (XDR *, ypresp_maplist*); |
330 | extern bool_t xdr_yppush_status (XDR *, yppush_status*); |
331 | extern bool_t xdr_yppushresp_xfr (XDR *, yppushresp_xfr*); |
332 | extern bool_t xdr_ypbind_resptype (XDR *, ypbind_resptype*); |
333 | extern bool_t xdr_ypbind_binding (XDR *, ypbind_binding*); |
334 | extern bool_t xdr_ypbind_resp (XDR *, ypbind_resp*); |
335 | extern bool_t xdr_ypbind_setdom (XDR *, ypbind_setdom*); |
336 | |
337 | __END_DECLS |
338 | |
339 | #endif /* !__RPCSVC_YP_H__ */ |
340 | |