comm: add -Wall
[unleashed.git] / usr / src / cmd / ypcmd / ypv1_xdr.c
blobb713709dc7f0e493ef772eacfff0c7b92cbf573b
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright (c) 1995 Sun Microsystems, Inc
24 * All rights reserved.
28 * This contains the xdr functions needed by ypserv and the NIS
29 * administrative tools to support the previous version of the NIS protocol.
30 * Note that many "old" xdr functions are called, with the assumption that
31 * they have not changed between the v1 protocol (which this module exists
32 * to support) and the current v2 protocol.
35 #include <rpc/rpc.h>
36 #include <rpcsvc/yp_prot.h>
37 #include "ypv1_prot.h"
38 #include <rpcsvc/ypclnt.h>
39 typedef struct xdr_discrim XDR_DISCRIM;
41 extern bool xdr_ypreq_key();
42 extern bool xdr_ypreq_nokey();
43 extern bool xdr_ypresp_val();
44 extern bool xdr_ypresp_key_val();
45 extern bool xdr_ypmap_parms();
49 * Serializes/deserializes a yprequest structure.
51 bool
52 _xdr_yprequest(XDR *xdrs, struct yprequest *ps)
54 XDR_DISCRIM yprequest_arms[4];
56 yprequest_arms[0].value = (int)YPREQ_KEY;
57 yprequest_arms[1].value = (int)YPREQ_NOKEY;
58 yprequest_arms[2].value = (int)YPREQ_KEY;
59 yprequest_arms[3].value = __dontcare__;
60 yprequest_arms[0].proc = (xdrproc_t)xdr_ypreq_key;
61 yprequest_arms[1].proc = (xdrproc_t)xdr_ypreq_nokey;
62 yprequest_arms[2].proc = (xdrproc_t)xdr_ypmap_parms;
63 yprequest_arms[3].proc = (xdrproc_t)0;
65 return (xdr_union(xdrs,
66 (int *)&ps->yp_reqtype,
67 (char *)&ps->yp_reqbody,
68 yprequest_arms, 0));
72 * Serializes/deserializes a ypresponse structure.
74 bool
75 _xdr_ypresponse(XDR *xdrs, struct ypresponse *ps)
77 XDR_DISCRIM ypresponse_arms[4];
79 ypresponse_arms[0].value = (int)YPRESP_VAL;
80 ypresponse_arms[1].value = (int)YPRESP_KEY_VAL;
81 ypresponse_arms[2].value = (int)YPRESP_MAP_PARMS;
82 ypresponse_arms[3].value = __dontcare__;
83 ypresponse_arms[0].proc = (xdrproc_t)xdr_ypresp_val;
84 ypresponse_arms[1].proc = (xdrproc_t)xdr_ypresp_key_val;
85 ypresponse_arms[2].proc = (xdrproc_t)xdr_ypmap_parms;
86 ypresponse_arms[3].proc = (xdrproc_t)0;
88 return (xdr_union(xdrs,
89 (int *)&ps->yp_resptype,
90 (char *)&ps->yp_respbody,
91 ypresponse_arms, 0));
94 /* XXX - Excess baggage? - georgn */
95 #if 0
97 * Serializes/deserializes a ypbind_oldsetdom structure.
99 bool
100 _xdr_ypbind_oldsetdom(XDR *xdrs, struct ypbind_setdom *ps)
102 char *domain = ps->ypsetdom_domain;
104 return (xdr_ypdomain_wrap_string(xdrs, &domain) &&
105 xdr_yp_binding(xdrs, &ps->ypsetdom_binding));
107 #endif