Quiet -Wparentheses warnings.
[glibc/history.git] / nis / yp_xdr.c
blobf18916968732c131c14097e5fb5c08857e1337c7
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.
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;
45 return TRUE;
48 bool_t
49 xdr_domainname (XDR *xdrs, domainname *objp)
51 if (!xdr_string (xdrs, objp, ~0))
52 return FALSE;
53 return TRUE;
56 bool_t
57 xdr_mapname (XDR *xdrs, mapname *objp)
59 if (!xdr_string (xdrs, objp, ~0))
60 return FALSE;
61 return TRUE;
64 bool_t
65 xdr_peername (XDR *xdrs, peername *objp)
67 if (!xdr_string (xdrs, objp, ~0))
68 return FALSE;
69 return TRUE;
72 bool_t
73 xdr_keydat (XDR *xdrs, keydat *objp)
75 if (!xdr_bytes (xdrs, (char **) &objp->keydat_val,
76 (u_int *) &objp->keydat_len, ~0))
77 return FALSE;
78 return TRUE;
81 bool_t
82 xdr_valdat (XDR *xdrs, valdat *objp)
84 if (!xdr_bytes (xdrs, (char **) &objp->valdat_val,
85 (u_int *) &objp->valdat_len, ~0))
86 return FALSE;
87 return TRUE;
90 bool_t
91 xdr_ypmap_parms (XDR *xdrs, ypmap_parms *objp)
93 if (!xdr_domainname (xdrs, &objp->domain))
94 return FALSE;
95 if (!xdr_mapname (xdrs, &objp->map))
96 return FALSE;
97 if (!xdr_u_int (xdrs, &objp->ordernum))
98 return FALSE;
99 if (!xdr_peername (xdrs, &objp->peer))
100 return FALSE;
101 return TRUE;
104 bool_t
105 xdr_ypreq_key (XDR *xdrs, ypreq_key *objp)
107 if (!xdr_domainname (xdrs, &objp->domain))
108 return FALSE;
109 if (!xdr_mapname (xdrs, &objp->map))
110 return FALSE;
111 if (!xdr_keydat (xdrs, &objp->key))
112 return FALSE;
113 return TRUE;
116 bool_t
117 xdr_ypreq_nokey (XDR *xdrs, ypreq_nokey *objp)
119 if (!xdr_domainname (xdrs, &objp->domain))
120 return FALSE;
121 if (!xdr_mapname (xdrs, &objp->map))
122 return FALSE;
123 return TRUE;
126 bool_t
127 xdr_ypreq_xfr (XDR *xdrs, ypreq_xfr *objp)
129 if (!xdr_ypmap_parms (xdrs, &objp->map_parms))
130 return FALSE;
131 if (!xdr_u_int (xdrs, &objp->transid))
132 return FALSE;
133 if (!xdr_u_int (xdrs, &objp->prog))
134 return FALSE;
135 if (!xdr_u_int (xdrs, &objp->port))
136 return FALSE;
137 return TRUE;
140 bool_t
141 xdr_ypresp_val (XDR *xdrs, ypresp_val *objp)
143 if (!xdr_ypstat (xdrs, &objp->stat))
144 return FALSE;
145 if (!xdr_valdat (xdrs, &objp->val))
146 return FALSE;
147 return TRUE;
150 bool_t
151 xdr_ypresp_key_val (XDR *xdrs, ypresp_key_val *objp)
153 if (!xdr_ypstat (xdrs, &objp->stat))
154 return FALSE;
155 if (!xdr_valdat (xdrs, &objp->val))
156 return FALSE;
157 if (!xdr_keydat (xdrs, &objp->key))
158 return FALSE;
159 return TRUE;
162 bool_t
163 xdr_ypresp_master (XDR *xdrs, ypresp_master *objp)
165 if (!xdr_ypstat (xdrs, &objp->stat))
166 return FALSE;
167 if (!xdr_peername (xdrs, &objp->peer))
168 return FALSE;
169 return TRUE;
172 bool_t
173 xdr_ypresp_order (XDR *xdrs, ypresp_order *objp)
175 if (!xdr_ypstat (xdrs, &objp->stat))
176 return FALSE;
177 if (!xdr_u_int (xdrs, &objp->ordernum))
178 return FALSE;
179 return TRUE;
182 bool_t
183 xdr_ypresp_all (XDR *xdrs, ypresp_all *objp)
185 if (!xdr_bool (xdrs, &objp->more))
186 return FALSE;
187 switch (objp->more)
189 case TRUE:
190 if (!xdr_ypresp_key_val (xdrs, &objp->ypresp_all_u.val))
191 return FALSE;
192 break;
193 case FALSE:
194 break;
195 default:
196 return FALSE;
198 return TRUE;
201 bool_t
202 xdr_ypresp_xfr (XDR *xdrs, ypresp_xfr *objp)
204 if (!xdr_u_int (xdrs, &objp->transid))
205 return FALSE;
206 if (!xdr_ypxfrstat (xdrs, &objp->xfrstat))
207 return FALSE;
208 return TRUE;
211 bool_t
212 xdr_ypmaplist (XDR *xdrs, ypmaplist *objp)
214 if (!xdr_mapname (xdrs, &objp->map))
215 return FALSE;
216 if (!xdr_pointer (xdrs, (char **) &objp->next, sizeof (ypmaplist),
217 (xdrproc_t) xdr_ypmaplist))
218 return FALSE;
219 return TRUE;
222 bool_t
223 xdr_ypresp_maplist (XDR *xdrs, ypresp_maplist *objp)
225 if (!xdr_ypstat (xdrs, &objp->stat))
226 return FALSE;
227 if (!xdr_pointer (xdrs, (char **) &objp->maps, sizeof (ypmaplist),
228 (xdrproc_t) xdr_ypmaplist))
229 return FALSE;
230 return TRUE;
233 bool_t
234 xdr_yppush_status (XDR *xdrs, yppush_status *objp)
236 if (!xdr_enum (xdrs, (enum_t *) objp))
237 return FALSE;
238 return TRUE;
241 bool_t
242 xdr_yppushresp_xfr (XDR *xdrs, yppushresp_xfr *objp)
244 if (!xdr_u_int (xdrs, &objp->transid))
245 return FALSE;
246 if (!xdr_yppush_status (xdrs, &objp->status))
247 return FALSE;
248 return TRUE;
251 bool_t
252 xdr_ypbind_resptype (XDR *xdrs, ypbind_resptype *objp)
254 if (!xdr_enum (xdrs, (enum_t *) objp))
255 return FALSE;
256 return TRUE;
259 bool_t
260 xdr_ypbind_binding (XDR *xdrs, ypbind_binding *objp)
262 if (!xdr_opaque (xdrs, objp->ypbind_binding_addr, 4))
263 return FALSE;
264 if (!xdr_opaque (xdrs, objp->ypbind_binding_port, 2))
265 return FALSE;
266 return TRUE;
269 bool_t
270 xdr_ypbind_resp (XDR *xdrs, ypbind_resp *objp)
272 if (!xdr_ypbind_resptype (xdrs, &objp->ypbind_status))
273 return FALSE;
274 switch (objp->ypbind_status)
276 case YPBIND_FAIL_VAL:
277 if (!xdr_u_int (xdrs, &objp->ypbind_resp_u.ypbind_error))
278 return FALSE;
279 break;
280 case YPBIND_SUCC_VAL:
281 if (!xdr_ypbind_binding (xdrs, &objp->ypbind_resp_u.ypbind_bindinfo))
282 return FALSE;
283 break;
284 default:
285 return FALSE;
287 return TRUE;
290 bool_t
291 xdr_ypbind_setdom (XDR *xdrs, ypbind_setdom *objp)
293 if (!xdr_domainname (xdrs, &objp->ypsetdom_domain))
294 return FALSE;
295 if (!xdr_ypbind_binding (xdrs, &objp->ypsetdom_binding))
296 return FALSE;
297 if (!xdr_u_int (xdrs, &objp->ypsetdom_vers))
298 return FALSE;
299 return TRUE;