amq_xdr.c revision 119679
1/* 2 * Copyright (c) 1997-2003 Erez Zadok 3 * Copyright (c) 1990 Jan-Simon Pendry 4 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine 5 * Copyright (c) 1990 The Regents of the University of California. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by 9 * Jan-Simon Pendry at Imperial College, London. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 3. All advertising materials mentioning features or use of this software 20 * must display the following acknowledgment: 21 * This product includes software developed by the University of 22 * California, Berkeley and its contributors. 23 * 4. Neither the name of the University nor the names of its contributors 24 * may be used to endorse or promote products derived from this software 25 * without specific prior written permission. 26 * 27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * %W% (Berkeley) %G% 40 * 41 * $Id: amq_xdr.c,v 1.3.2.3 2002/12/27 22:44:46 ezk Exp $ 42 * 43 */ 44 45#ifdef HAVE_CONFIG_H 46# include <config.h> 47#endif /* HAVE_CONFIG_H */ 48#include <am_defs.h> 49#include <amq.h> 50 51 52bool_t 53xdr_time_type(XDR *xdrs, time_type *objp) 54{ 55 if (!xdr_long(xdrs, (long *) objp)) { 56 return (FALSE); 57 } 58 return (TRUE); 59} 60 61 62bool_t 63xdr_amq_mount_tree(XDR *xdrs, amq_mount_tree *objp) 64{ 65 66 if (!xdr_amq_string(xdrs, &objp->mt_mountinfo)) { 67 return (FALSE); 68 } 69 70 if (!xdr_amq_string(xdrs, &objp->mt_directory)) { 71 return (FALSE); 72 } 73 74 if (!xdr_amq_string(xdrs, &objp->mt_mountpoint)) { 75 return (FALSE); 76 } 77 78 if (!xdr_amq_string(xdrs, &objp->mt_type)) { 79 return (FALSE); 80 } 81 82 if (!xdr_time_type(xdrs, &objp->mt_mounttime)) { 83 return (FALSE); 84 } 85 86 if (!xdr_u_short(xdrs, &objp->mt_mountuid)) { 87 return (FALSE); 88 } 89 90 if (!xdr_int(xdrs, &objp->mt_getattr)) { 91 return (FALSE); 92 } 93 94 if (!xdr_int(xdrs, &objp->mt_lookup)) { 95 return (FALSE); 96 } 97 98 if (!xdr_int(xdrs, &objp->mt_readdir)) { 99 return (FALSE); 100 } 101 102 if (!xdr_int(xdrs, &objp->mt_readlink)) { 103 return (FALSE); 104 } 105 106 if (!xdr_int(xdrs, &objp->mt_statfs)) { 107 return (FALSE); 108 } 109 110 if (!xdr_pointer(xdrs, (char **) &objp->mt_next, sizeof(amq_mount_tree), (XDRPROC_T_TYPE) xdr_amq_mount_tree)) { 111 return (FALSE); 112 } 113 114 if (!xdr_pointer(xdrs, (char **) &objp->mt_child, sizeof(amq_mount_tree), (XDRPROC_T_TYPE) xdr_amq_mount_tree)) { 115 return (FALSE); 116 } 117 118 return (TRUE); 119} 120 121 122bool_t 123xdr_amq_mount_tree_p(XDR *xdrs, amq_mount_tree_p *objp) 124{ 125 if (!xdr_pointer(xdrs, (char **) objp, sizeof(amq_mount_tree), (XDRPROC_T_TYPE) xdr_amq_mount_tree)) { 126 return (FALSE); 127 } 128 return (TRUE); 129} 130 131 132bool_t 133xdr_amq_mount_info(XDR *xdrs, amq_mount_info *objp) 134{ 135 136 if (!xdr_amq_string(xdrs, &objp->mi_type)) { 137 return (FALSE); 138 } 139 140 if (!xdr_amq_string(xdrs, &objp->mi_mountpt)) { 141 return (FALSE); 142 } 143 144 if (!xdr_amq_string(xdrs, &objp->mi_mountinfo)) { 145 return (FALSE); 146 } 147 148 if (!xdr_amq_string(xdrs, &objp->mi_fserver)) { 149 return (FALSE); 150 } 151 152 if (!xdr_int(xdrs, &objp->mi_error)) { 153 return (FALSE); 154 } 155 156 if (!xdr_int(xdrs, &objp->mi_refc)) { 157 return (FALSE); 158 } 159 160 if (!xdr_int(xdrs, &objp->mi_up)) { 161 return (FALSE); 162 } 163 164 return (TRUE); 165} 166 167 168bool_t 169xdr_amq_mount_info_list(XDR *xdrs, amq_mount_info_list *objp) 170{ 171 if (!xdr_array(xdrs, 172 (char **) &objp->amq_mount_info_list_val, 173 (u_int *) &objp->amq_mount_info_list_len, 174 ~0, 175 sizeof(amq_mount_info), 176 (XDRPROC_T_TYPE) xdr_amq_mount_info)) { 177 return (FALSE); 178 } 179 return (TRUE); 180} 181 182 183bool_t 184xdr_amq_mount_tree_list(XDR *xdrs, amq_mount_tree_list *objp) 185{ 186 if (!xdr_array(xdrs, 187 (char **) &objp->amq_mount_tree_list_val, 188 (u_int *) &objp->amq_mount_tree_list_len, 189 ~0, 190 sizeof(amq_mount_tree_p), 191 (XDRPROC_T_TYPE) xdr_amq_mount_tree_p)) { 192 return (FALSE); 193 } 194 return (TRUE); 195} 196 197 198bool_t 199xdr_amq_mount_stats(XDR *xdrs, amq_mount_stats *objp) 200{ 201 202 if (!xdr_int(xdrs, &objp->as_drops)) { 203 return (FALSE); 204 } 205 206 if (!xdr_int(xdrs, &objp->as_stale)) { 207 return (FALSE); 208 } 209 210 if (!xdr_int(xdrs, &objp->as_mok)) { 211 return (FALSE); 212 } 213 214 if (!xdr_int(xdrs, &objp->as_merr)) { 215 return (FALSE); 216 } 217 218 if (!xdr_int(xdrs, &objp->as_uerr)) { 219 return (FALSE); 220 } 221 222 return (TRUE); 223} 224 225 226bool_t 227xdr_amq_opt(XDR *xdrs, amq_opt *objp) 228{ 229 if (!xdr_enum(xdrs, (enum_t *) objp)) { 230 return (FALSE); 231 } 232 return (TRUE); 233} 234 235 236bool_t 237xdr_amq_setopt(XDR *xdrs, amq_setopt *objp) 238{ 239 240 if (!xdr_amq_opt(xdrs, &objp->as_opt)) { 241 return (FALSE); 242 } 243 244 if (!xdr_amq_string(xdrs, &objp->as_str)) { 245 return (FALSE); 246 } 247 248 return (TRUE); 249} 250 251 252bool_t 253xdr_pri_free(XDRPROC_T_TYPE xdr_args, caddr_t args_ptr) 254{ 255 XDR xdr; 256 257 xdr.x_op = XDR_FREE; 258 return ((*xdr_args) (&xdr, (caddr_t *) args_ptr)); 259} 260