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