1 /* 2 * CDDL HEADER START 3 * 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. 8 * 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. 13 * 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] 19 * 20 * CDDL HEADER END 21 */ 22 23 /* 24 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 25 * Use is subject to license terms. 26 */ 27 28 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 29 /* All Rights Reserved */ 30 31 /* 32 * Portions of this source code were derived from Berkeley 33 * under license from the Regents of the University of 34 * California. 35 */ 36 37 #pragma ident "%Z%%M% %I% %E% SMI" 38 39 #include <rpc/rpc.h> 40 #include <netconfig.h> 41 #include "yp_b.h" 42 #include <rpcsvc/yp_prot.h> 43 #include <sys/types.h> 44 45 bool_t 46 xdr_ypbind_resptype(XDR *xdrs, ypbind_resptype *objp) 47 { 48 return (xdr_enum(xdrs, (enum_t *)objp)); 49 } 50 51 bool_t 52 xdr_ypbind_domain(XDR *xdrs, ypbind_domain *objp) 53 { 54 if (!xdr_string(xdrs, &objp->ypbind_domainname, YPMAXDOMAIN)) 55 return (FALSE); 56 return (xdr_rpcvers(xdrs, &objp->ypbind_vers)); 57 } 58 59 bool_t 60 xdr_ypbind_binding(XDR *xdrs, ypbind_binding *objp) 61 { 62 if (!xdr_pointer(xdrs, (char **)&objp->ypbind_nconf, 63 sizeof (struct netconfig), xdr_netconfig)) 64 return (FALSE); 65 if (!xdr_pointer(xdrs, (char **)&objp->ypbind_svcaddr, 66 sizeof (struct netbuf), xdr_netbuf)) 67 return (FALSE); 68 if (!xdr_string(xdrs, &objp->ypbind_servername, ~0)) 69 return (FALSE); 70 if (!xdr_rpcvers(xdrs, &objp->ypbind_hi_vers)) 71 return (FALSE); 72 return (xdr_rpcvers(xdrs, &objp->ypbind_lo_vers)); 73 } 74 75 bool_t 76 xdr_ypbind_resp(XDR *xdrs, ypbind_resp *objp) 77 { 78 if (!xdr_ypbind_resptype(xdrs, &objp->ypbind_status)) 79 return (FALSE); 80 switch (objp->ypbind_status) { 81 case YPBIND_FAIL_VAL: 82 if (!xdr_u_int(xdrs, &objp->ypbind_resp_u.ypbind_error)) 83 return (FALSE); 84 break; 85 case YPBIND_SUCC_VAL: 86 if (!xdr_pointer(xdrs, 87 (char **)&objp->ypbind_resp_u.ypbind_bindinfo, 88 sizeof (ypbind_binding), xdr_ypbind_binding)) 89 return (FALSE); 90 break; 91 default: 92 return (FALSE); 93 } 94 return (TRUE); 95 } 96 97 bool_t 98 xdr_ypbind_setdom(XDR *xdrs, ypbind_setdom *objp) 99 { 100 if (!xdr_string(xdrs, &objp->ypsetdom_domain, YPMAXDOMAIN)) 101 return (FALSE); 102 return (xdr_pointer(xdrs, (char **)&objp->ypsetdom_bindinfo, 103 sizeof (ypbind_binding), xdr_ypbind_binding)); 104 } 105