1 /* $NetBSD: amq_clnt.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */ 2 3 /* 4 * Copyright (c) 1997-2009 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_clnt.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 53 static struct timeval TIMEOUT = {ALLOWED_MOUNT_TIME, 0}; 54 55 56 voidp 57 amqproc_null_1(voidp argp, CLIENT *clnt) 58 { 59 static char res; 60 61 memset((char *) &res, 0, sizeof(res)); 62 if (clnt_call(clnt, AMQPROC_NULL, 63 (XDRPROC_T_TYPE) xdr_void, argp, 64 (XDRPROC_T_TYPE) xdr_void, &res, TIMEOUT) 65 != RPC_SUCCESS) { 66 return (NULL); 67 } 68 return ((voidp) &res); 69 } 70 71 72 amq_mount_tree_p * 73 amqproc_mnttree_1(amq_string *argp, CLIENT *clnt) 74 { 75 static amq_mount_tree_p res; 76 77 memset((char *) &res, 0, sizeof(res)); 78 if (clnt_call(clnt, AMQPROC_MNTTREE, 79 (XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) argp, 80 (XDRPROC_T_TYPE) xdr_amq_mount_tree_p, (SVC_IN_ARG_TYPE) &res, 81 TIMEOUT) != RPC_SUCCESS) { 82 return (NULL); 83 } 84 return (&res); 85 } 86 87 88 voidp 89 amqproc_umnt_1(amq_string *argp, CLIENT *clnt) 90 { 91 static char res; 92 93 memset((char *) &res, 0, sizeof(res)); 94 if (clnt_call(clnt, AMQPROC_UMNT, 95 (XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) argp, 96 (XDRPROC_T_TYPE) xdr_void, &res, 97 TIMEOUT) != RPC_SUCCESS) { 98 return (NULL); 99 } 100 return ((voidp) &res); 101 } 102 103 104 amq_sync_umnt * 105 amqproc_sync_umnt_1(amq_string *argp, CLIENT *clnt) 106 { 107 static amq_sync_umnt res; 108 enum clnt_stat rv; 109 110 memset((char *) &res, 0, sizeof(res)); 111 if ((rv = clnt_call(clnt, AMQPROC_SYNC_UMNT, 112 (XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) argp, 113 (XDRPROC_T_TYPE) xdr_amq_sync_umnt, &res, 114 TIMEOUT)) != RPC_SUCCESS) { 115 return (NULL); 116 } 117 return &res; 118 } 119 120 121 amq_mount_stats * 122 amqproc_stats_1(voidp argp, CLIENT *clnt) 123 { 124 static amq_mount_stats res; 125 126 memset((char *) &res, 0, sizeof(res)); 127 if (clnt_call(clnt, AMQPROC_STATS, 128 (XDRPROC_T_TYPE) xdr_void, argp, 129 (XDRPROC_T_TYPE) xdr_amq_mount_stats, 130 (SVC_IN_ARG_TYPE) &res, 131 TIMEOUT) != RPC_SUCCESS) { 132 return (NULL); 133 } 134 return (&res); 135 } 136 137 138 amq_mount_tree_list * 139 amqproc_export_1(voidp argp, CLIENT *clnt) 140 { 141 static amq_mount_tree_list res; 142 143 memset((char *) &res, 0, sizeof(res)); 144 if (clnt_call(clnt, AMQPROC_EXPORT, 145 (XDRPROC_T_TYPE) xdr_void, argp, 146 (XDRPROC_T_TYPE) xdr_amq_mount_tree_list, 147 (SVC_IN_ARG_TYPE) &res, TIMEOUT) != RPC_SUCCESS) { 148 return (NULL); 149 } 150 return (&res); 151 } 152 153 154 int * 155 amqproc_setopt_1(amq_setopt *argp, CLIENT *clnt) 156 { 157 static int res; 158 159 memset((char *) &res, 0, sizeof(res)); 160 if (clnt_call(clnt, AMQPROC_SETOPT, (XDRPROC_T_TYPE) xdr_amq_setopt, 161 (SVC_IN_ARG_TYPE) argp, (XDRPROC_T_TYPE) xdr_int, 162 (SVC_IN_ARG_TYPE) &res, TIMEOUT) != RPC_SUCCESS) { 163 return (NULL); 164 } 165 return (&res); 166 } 167 168 169 amq_mount_info_list * 170 amqproc_getmntfs_1(voidp argp, CLIENT *clnt) 171 { 172 static amq_mount_info_list res; 173 174 memset((char *) &res, 0, sizeof(res)); 175 if (clnt_call(clnt, AMQPROC_GETMNTFS, (XDRPROC_T_TYPE) xdr_void, argp, 176 (XDRPROC_T_TYPE) xdr_amq_mount_info_list, 177 (SVC_IN_ARG_TYPE) &res, TIMEOUT) != RPC_SUCCESS) { 178 return (NULL); 179 } 180 return (&res); 181 } 182 183 184 int * 185 amqproc_mount_1(voidp argp, CLIENT *clnt) 186 { 187 static int res; 188 189 memset((char *) &res, 0, sizeof(res)); 190 if (clnt_call(clnt, AMQPROC_MOUNT, (XDRPROC_T_TYPE) xdr_amq_string, argp, 191 (XDRPROC_T_TYPE) xdr_int, (SVC_IN_ARG_TYPE) &res, 192 TIMEOUT) != RPC_SUCCESS) { 193 return (NULL); 194 } 195 return (&res); 196 } 197 198 199 amq_string * 200 amqproc_getvers_1(voidp argp, CLIENT *clnt) 201 { 202 static amq_string res; 203 204 memset((char *) &res, 0, sizeof(res)); 205 if (clnt_call(clnt, AMQPROC_GETVERS, (XDRPROC_T_TYPE) xdr_void, argp, 206 (XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) &res, 207 TIMEOUT) != RPC_SUCCESS) { 208 return (NULL); 209 } 210 return (&res); 211 } 212 213 214 int * 215 amqproc_getpid_1(voidp argp, CLIENT *clnt) 216 { 217 static int res; 218 219 memset((char *) &res, 0, sizeof(res)); 220 if (clnt_call(clnt, AMQPROC_GETPID, (XDRPROC_T_TYPE) xdr_void, argp, 221 (XDRPROC_T_TYPE) xdr_int, (SVC_IN_ARG_TYPE) &res, 222 TIMEOUT) != RPC_SUCCESS) { 223 return (NULL); 224 } 225 return (&res); 226 } 227 228 229 amq_string * 230 amqproc_pawd_1(amq_string *argp, CLIENT *clnt) 231 { 232 static amq_string res; 233 234 memset((char *) &res, 0, sizeof(res)); 235 if (clnt_call(clnt, AMQPROC_PAWD, 236 (XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) argp, 237 (XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) &res, 238 TIMEOUT) != RPC_SUCCESS) { 239 return (NULL); 240 } 241 return (&res); 242 } 243