(dl_main): Fixtypo.
[glibc.git] / nis / yp_xdr.c
blobe6477be778b603bd6db7fdc52e4b3ce6dc94f4c8
1 /*
2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3 * unrestricted use provided that this legend is included on all tape
4 * media and as a part of the software program in whole or part. Users
5 * may copy or modify Sun RPC without charge, but are not authorized
6 * to license or distribute it to anyone else except as part of a product or
7 * program developed by the user.
8 *
9 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
13 * Sun RPC is provided with no support and without any obligation on the
14 * part of Sun Microsystems, Inc. to assist in its use, correction,
15 * modification or enhancement.
17 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19 * OR ANY PART THEREOF.
21 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22 * or profits or other special, indirect and consequential damages, even if
23 * Sun has been advised of the possibility of such damages.
25 * Sun Microsystems, Inc.
26 * 2550 Garcia Avenue
27 * Mountain View, California 94043
30 #include <rpcsvc/yp.h>
32 bool_t
33 xdr_ypstat (XDR *xdrs, ypstat *objp)
35 if (!xdr_enum(xdrs, (enum_t *)objp))
36 return (FALSE);
37 return (TRUE);
40 bool_t
41 xdr_ypxfrstat(XDR *xdrs, ypxfrstat *objp)
43 if (!xdr_enum(xdrs, (enum_t *)objp)) {
44 return (FALSE);
46 return (TRUE);
49 bool_t
50 xdr_domainname(XDR *xdrs, domainname *objp)
52 if (!xdr_string(xdrs, objp, YPMAXDOMAIN)) {
53 return (FALSE);
55 return (TRUE);
58 bool_t
59 xdr_mapname(XDR *xdrs, mapname *objp)
61 if (!xdr_string(xdrs, objp, YPMAXMAP)) {
62 return (FALSE);
64 return (TRUE);
67 bool_t
68 xdr_peername(XDR *xdrs, peername *objp)
70 if (!xdr_string(xdrs, objp, YPMAXPEER)) {
71 return (FALSE);
73 return (TRUE);
76 bool_t
77 xdr_keydat(XDR *xdrs, keydat *objp)
79 if (!xdr_bytes(xdrs, (char **)&objp->keydat_val, (u_int *)&objp->keydat_len, YPMAXRECORD)) {
80 return (FALSE);
82 return (TRUE);
85 bool_t
86 xdr_valdat(XDR *xdrs, valdat *objp)
88 if (!xdr_bytes(xdrs, (char **)&objp->valdat_val, (u_int *)&objp->valdat_len, YPMAXRECORD)) {
89 return (FALSE);
91 return (TRUE);
94 bool_t
95 xdr_ypmap_parms(XDR *xdrs, ypmap_parms *objp)
97 if (!xdr_domainname(xdrs, &objp->domain)) {
98 return (FALSE);
100 if (!xdr_mapname(xdrs, &objp->map)) {
101 return (FALSE);
103 if (!xdr_u_int(xdrs, &objp->ordernum)) {
104 return (FALSE);
106 if (!xdr_peername(xdrs, &objp->peer)) {
107 return (FALSE);
109 return (TRUE);
112 bool_t
113 xdr_ypreq_key(XDR *xdrs, ypreq_key *objp)
115 if (!xdr_domainname(xdrs, &objp->domain)) {
116 return (FALSE);
118 if (!xdr_mapname(xdrs, &objp->map)) {
119 return (FALSE);
121 if (!xdr_keydat(xdrs, &objp->key)) {
122 return (FALSE);
124 return (TRUE);
127 bool_t
128 xdr_ypreq_nokey(XDR *xdrs, ypreq_nokey *objp)
130 if (!xdr_domainname(xdrs, &objp->domain)) {
131 return (FALSE);
133 if (!xdr_mapname(xdrs, &objp->map)) {
134 return (FALSE);
136 return (TRUE);
139 bool_t
140 xdr_ypreq_xfr(XDR *xdrs, ypreq_xfr *objp)
142 if (!xdr_ypmap_parms(xdrs, &objp->map_parms)) {
143 return (FALSE);
145 if (!xdr_u_int(xdrs, &objp->transid)) {
146 return (FALSE);
148 if (!xdr_u_int(xdrs, &objp->prog)) {
149 return (FALSE);
151 if (!xdr_u_int(xdrs, &objp->port)) {
152 return (FALSE);
154 return (TRUE);
157 bool_t
158 xdr_ypresp_val(XDR *xdrs, ypresp_val *objp)
160 if (!xdr_ypstat(xdrs, &objp->stat)) {
161 return (FALSE);
163 if (!xdr_valdat(xdrs, &objp->val)) {
164 return (FALSE);
166 return (TRUE);
169 bool_t
170 xdr_ypresp_key_val(XDR *xdrs, ypresp_key_val *objp)
172 if (!xdr_ypstat(xdrs, &objp->stat)) {
173 return (FALSE);
175 if (!xdr_valdat(xdrs, &objp->val)) {
176 return (FALSE);
178 if (!xdr_keydat(xdrs, &objp->key)) {
179 return (FALSE);
181 return (TRUE);
184 bool_t
185 xdr_ypresp_master(XDR *xdrs, ypresp_master *objp)
187 if (!xdr_ypstat(xdrs, &objp->stat)) {
188 return (FALSE);
190 if (!xdr_peername(xdrs, &objp->peer)) {
191 return (FALSE);
193 return (TRUE);
196 bool_t
197 xdr_ypresp_order(XDR *xdrs, ypresp_order *objp)
199 if (!xdr_ypstat(xdrs, &objp->stat)) {
200 return (FALSE);
202 if (!xdr_u_int(xdrs, &objp->ordernum)) {
203 return (FALSE);
205 return (TRUE);
208 bool_t
209 xdr_ypresp_all(XDR *xdrs, ypresp_all *objp)
211 if (!xdr_bool(xdrs, &objp->more)) {
212 return (FALSE);
214 switch (objp->more) {
215 case TRUE:
216 if (!xdr_ypresp_key_val(xdrs, &objp->ypresp_all_u.val)) {
217 return (FALSE);
219 break;
220 case FALSE:
221 break;
222 default:
223 return (FALSE);
225 return (TRUE);
228 bool_t
229 xdr_ypresp_xfr(XDR *xdrs, ypresp_xfr *objp)
231 if (!xdr_u_int(xdrs, &objp->transid)) {
232 return (FALSE);
234 if (!xdr_ypxfrstat(xdrs, &objp->xfrstat)) {
235 return (FALSE);
237 return (TRUE);
240 bool_t
241 xdr_ypmaplist(XDR *xdrs, ypmaplist *objp)
243 if (!xdr_mapname(xdrs, &objp->map)) {
244 return (FALSE);
246 if (!xdr_pointer(xdrs, (char **)&objp->next, sizeof(ypmaplist), (xdrproc_t)xdr_ypmaplist)) {
247 return (FALSE);
249 return (TRUE);
252 bool_t
253 xdr_ypresp_maplist(XDR *xdrs, ypresp_maplist *objp)
255 if (!xdr_ypstat(xdrs, &objp->stat)) {
256 return (FALSE);
258 if (!xdr_pointer(xdrs, (char **)&objp->maps, sizeof(ypmaplist), (xdrproc_t)xdr_ypmaplist)) {
259 return (FALSE);
261 return (TRUE);
264 bool_t
265 xdr_yppush_status(XDR *xdrs, yppush_status *objp)
267 if (!xdr_enum(xdrs, (enum_t *)objp)) {
268 return (FALSE);
270 return (TRUE);
273 bool_t
274 xdr_yppushresp_xfr(XDR *xdrs, yppushresp_xfr *objp)
276 if (!xdr_u_int(xdrs, &objp->transid)) {
277 return (FALSE);
279 if (!xdr_yppush_status(xdrs, &objp->status)) {
280 return (FALSE);
282 return (TRUE);
285 bool_t
286 xdr_ypbind_resptype(XDR *xdrs, ypbind_resptype *objp)
288 if (!xdr_enum(xdrs, (enum_t *)objp)) {
289 return (FALSE);
291 return (TRUE);
294 bool_t
295 xdr_ypbind_binding(XDR *xdrs, ypbind_binding *objp)
297 if (!xdr_opaque(xdrs, objp->ypbind_binding_addr, 4)) {
298 return (FALSE);
300 if (!xdr_opaque(xdrs, objp->ypbind_binding_port, 2)) {
301 return (FALSE);
303 return (TRUE);
306 bool_t
307 xdr_ypbind_resp(XDR *xdrs, ypbind_resp *objp)
309 if (!xdr_ypbind_resptype(xdrs, &objp->ypbind_status)) {
310 return (FALSE);
312 switch (objp->ypbind_status) {
313 case YPBIND_FAIL_VAL:
314 if (!xdr_u_int(xdrs, &objp->ypbind_resp_u.ypbind_error)) {
315 return (FALSE);
317 break;
318 case YPBIND_SUCC_VAL:
319 if (!xdr_ypbind_binding(xdrs, &objp->ypbind_resp_u.ypbind_bindinfo)) {
320 return (FALSE);
322 break;
323 default:
324 return (FALSE);
326 return (TRUE);
329 bool_t
330 xdr_ypbind_setdom(XDR *xdrs, ypbind_setdom *objp)
332 if (!xdr_domainname(xdrs, &objp->ypsetdom_domain)) {
333 return (FALSE);
335 if (!xdr_ypbind_binding(xdrs, &objp->ypsetdom_binding)) {
336 return (FALSE);
338 if (!xdr_u_int(xdrs, &objp->ypsetdom_vers)) {
339 return (FALSE);
341 return (TRUE);