1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
/* Copyright (C) 2014 Thorsten Kukuk
Author: Thorsten Kukuk <kukuk@suse.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rpc/rpc.h>
#include "yp.h"
xdr_ypall_cb_t xdr_ypall_cb;
bool_t
xdr_ypresp_maplist (XDR *xdrs, ypresp_maplist *objp)
{
char **tp;
if (!xdr_ypstat (xdrs, &objp->status))
return FALSE;
/* Prevent gcc warning about alias violation. */
tp = (void *) &objp->list;
return xdr_pointer (xdrs, tp, sizeof (ypmaplist), (xdrproc_t) xdr_ypmaplist);
}
bool_t
xdr_ypresp_all(XDR *xdrs, ypresp_all *objp)
{
if (xdrs->x_op == XDR_ENCODE)
{
while (1)
{
if (xdr_bool(xdrs, &objp->more) == FALSE ||
xdr_ypresp_key_val(xdrs, &objp->ypresp_all_u.val) == FALSE)
{
if (xdr_ypall_cb.u.close != NULL)
(*(xdr_ypall_cb.u.close))(xdr_ypall_cb.data);
xdr_ypall_cb.data = NULL;
return FALSE;
}
if ((objp->ypresp_all_u.val.status != YP_TRUE) ||
(*xdr_ypall_cb.u.encode)(&objp->ypresp_all_u.val,
xdr_ypall_cb.data) != YP_TRUE)
{
objp->more = FALSE;
if (xdr_ypall_cb.u.close != NULL)
(*(xdr_ypall_cb.u.close))(xdr_ypall_cb.data);
xdr_ypall_cb.data = NULL;
if (!xdr_bool(xdrs, &objp->more))
return FALSE;
return TRUE;
}
}
}
#ifdef NOTYET /* This code isn't needed in the server */
else if (xdrs->x_op == XDR_DECODE)
{
int more = 0;
while (1)
{
if (!xdr_bool(xdrs, &objp->more))
return FALSE;
switch (objp->more)
{
case TRUE:
if (!xdr_ypresp_key_val(xdrs, &objp->ypresp_all_u.val))
return FALSE;
if (more == 0)
more = (*xdr_ypall_callback->foreach.decoder)
(&objp->ypresp_all_u.val, xdr_ypall_callback->data);
break;
case FALSE:
return TRUE;
default:
return FALSE;
}
}
return FALSE;
}
#endif
return TRUE;
}
|