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 * Copyright (c) 1986,1997 by Sun Microsystems, Inc. 24 * All rights reserved. 25 */ 26 27 #include <rpc/rpc.h> 28 #include <rpc/bootparam.h> 29 30 bool_t 31 xdr_bp_machine_name_t(XDR *xdrs, bp_machine_name_t *objp) 32 { 33 return (xdr_string(xdrs, objp, MAX_MACHINE_NAME)); 34 } 35 36 bool_t 37 xdr_bp_path_t(XDR *xdrs, bp_path_t *objp) 38 { 39 return (xdr_string(xdrs, objp, MAX_PATH_LEN)); 40 } 41 42 bool_t 43 xdr_bp_fileid_t(XDR *xdrs, bp_fileid_t *objp) 44 { 45 return (xdr_string(xdrs, objp, MAX_FILEID)); 46 } 47 48 bool_t 49 xdr_ip_addr_t(XDR *xdrs, ip_addr_t *objp) 50 { 51 if (!xdr_char(xdrs, &objp->net)) 52 return (FALSE); 53 if (!xdr_char(xdrs, &objp->host)) 54 return (FALSE); 55 if (!xdr_char(xdrs, &objp->lh)) 56 return (FALSE); 57 if (!xdr_char(xdrs, &objp->impno)) 58 return (FALSE); 59 return (TRUE); 60 } 61 62 static struct xdr_discrim choices[] = { 63 { IP_ADDR_TYPE, xdr_ip_addr_t }, 64 { __dontcare__, NULL } 65 }; 66 67 bool_t 68 xdr_bp_address(XDR *xdrs, bp_address *objp) 69 { 70 return (xdr_union(xdrs, (enum_t *)&objp->address_type, 71 (char *)&objp->bp_address, choices, (xdrproc_t)NULL)); 72 } 73 74 bool_t 75 xdr_bp_whoami_arg(XDR *xdrs, bp_whoami_arg *objp) 76 { 77 return (xdr_bp_address(xdrs, &objp->client_address)); 78 } 79 80 bool_t 81 xdr_bp_whoami_res(XDR *xdrs, bp_whoami_res *objp) 82 { 83 if (!xdr_bp_machine_name_t(xdrs, &objp->client_name)) 84 return (FALSE); 85 if (!xdr_bp_machine_name_t(xdrs, &objp->domain_name)) 86 return (FALSE); 87 if (!xdr_bp_address(xdrs, &objp->router_address)) 88 return (FALSE); 89 return (TRUE); 90 } 91 92 bool_t 93 xdr_bp_getfile_arg(XDR *xdrs, bp_getfile_arg *objp) 94 { 95 if (!xdr_bp_machine_name_t(xdrs, &objp->client_name)) 96 return (FALSE); 97 if (!xdr_bp_fileid_t(xdrs, &objp->file_id)) 98 return (FALSE); 99 return (TRUE); 100 } 101 102 bool_t 103 xdr_bp_getfile_res(XDR *xdrs, bp_getfile_res *objp) 104 { 105 if (!xdr_bp_machine_name_t(xdrs, &objp->server_name)) 106 return (FALSE); 107 if (!xdr_bp_address(xdrs, &objp->server_address)) 108 return (FALSE); 109 if (!xdr_bp_path_t(xdrs, &objp->server_path)) 110 return (FALSE); 111 return (TRUE); 112 } 113