1
/* Copyright (c) 1996, 1997, 1999, 2001, 2003 Thorsten Kukuk
2
Author: Thorsten Kukuk <kukuk@suse.de>
4
The YP Server is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License
6
version 2 as published by the Free Software Foundation.
8
The YP Server is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
General Public License for more details.
13
You should have received a copy of the GNU General Public
14
License along with the YP Server; see the file COPYING. If
15
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
16
Cambridge, MA 02139, USA. */
33
ypstat (*encoder) (char *, int, char **, int *, char **, int *);
34
int (*decoder) (int, char *, int, char *, int, char *);
38
} *xdr_ypall_callback;
42
xdr_keydat (XDR *xdrs, keydat *objp)
44
if (!xdr_bytes (xdrs, (char **) &objp->keydat_val,
45
(u_int *) &objp->keydat_len, ~0))
51
xdr_valdat (XDR *xdrs, valdat *objp)
53
if (!xdr_bytes (xdrs, (char **) &objp->valdat_val,
54
(u_int *) &objp->valdat_len, ~0))
60
xdr_ypresp_val (XDR *xdrs, ypresp_val *objp)
62
if (!xdr_ypstat (xdrs, &objp->stat))
64
if (!xdr_valdat (xdrs, &objp->val))
70
xdr_ypresp_key_val (XDR *xdrs, ypresp_key_val *objp)
72
if (!xdr_ypstat (xdrs, &objp->stat))
75
if (!xdr_valdat (xdrs, &objp->val))
78
if (!xdr_keydat (xdrs, &objp->key))
85
xdr_ypresp_order (XDR *xdrs, ypresp_order *objp)
87
if (!xdr_ypstat (xdrs, &objp->stat))
89
if (!xdr_u_int (xdrs, &objp->ordernum))
95
xdr_ypbind_setdom (XDR *xdrs, ypbind_setdom *objp)
97
if (!xdr_domainname (xdrs, &objp->ypsetdom_domain))
100
if (!xdr_ypbind_binding (xdrs, &objp->ypsetdom_binding))
103
if (!xdr_u_int (xdrs, &objp->ypsetdom_vers))
110
xdr_ypreq_key (XDR *xdrs, ypreq_key *objp)
112
if (!xdr_domainname (xdrs, &objp->domain))
115
if (!xdr_mapname (xdrs, &objp->map))
118
if (!xdr_keydat (xdrs, &objp->key))
125
ypxfr_xdr_ypresp_all (XDR *xdrs, ypresp_all *objp)
129
if (xdrs->x_op == XDR_DECODE)
133
int s = objp->ypresp_all_u.val.stat;
134
memset (objp, '\0', sizeof (*objp));
135
objp->ypresp_all_u.val.stat = s;
136
if (!xdr_bool (xdrs, &objp->more))
142
if (!xdr_ypresp_key_val (xdrs, &objp->ypresp_all_u.val))
144
printf ("xdr_ypresp_key_val failed\n");
150
CallAgain = (*(xdr_ypall_callback->foreach.decoder))
151
(objp->ypresp_all_u.val.stat,
152
objp->ypresp_all_u.val.key.keydat_val,
153
objp->ypresp_all_u.val.key.keydat_len,
154
objp->ypresp_all_u.val.val.valdat_val,
155
objp->ypresp_all_u.val.val.valdat_len,
156
xdr_ypall_callback->data);
162
xdr_free ((xdrproc_t) ypxfr_xdr_ypresp_all, (char *) objp);
165
else if (xdrs->x_op == XDR_ENCODE)
169
if (!xdr_bool (xdrs, &(objp->more)))
172
if (!xdr_ypresp_key_val (xdrs, &objp->ypresp_all_u.val))
174
printf ("xdr_ypresp_key_val failed\n");
177
if (objp->ypresp_all_u.val.stat != YP_TRUE)
180
if (!xdr_bool (xdrs, &(objp->more)))
185
objp->ypresp_all_u.val.stat =
186
(*(xdr_ypall_callback->foreach.encoder))
187
(objp->ypresp_all_u.val.key.keydat_val,
188
objp->ypresp_all_u.val.key.keydat_len,
189
&(objp->ypresp_all_u.val.key.keydat_val),
190
(int *) &(objp->ypresp_all_u.val.key.keydat_len),
191
&(objp->ypresp_all_u.val.val.valdat_val),
192
(int *) &(objp->ypresp_all_u.val.val.valdat_len));
199
/* Default timeout can be changed using clnt_control() */
200
static struct timeval TIMEOUT = { 25, 0 };
203
ypproc_all_2 (ypreq_nokey *argp, ypresp_all *clnt_res, CLIENT *clnt)
205
memset(clnt_res, 0, sizeof(ypresp_all));
206
return (clnt_call(clnt, YPPROC_ALL,
207
(xdrproc_t) xdr_ypreq_nokey, (caddr_t) argp,
208
(xdrproc_t) ypxfr_xdr_ypresp_all, (caddr_t) clnt_res,