1dfdcada3SDoug Rabson /*- 2*fe267a55SPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3*fe267a55SPedro F. Giffuni * 4dfdcada3SDoug Rabson * Copyright (c) 2008 Isilon Inc http://www.isilon.com/ 5dfdcada3SDoug Rabson * Authors: Doug Rabson <dfr@rabson.org> 6dfdcada3SDoug Rabson * Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org> 7dfdcada3SDoug Rabson * 8dfdcada3SDoug Rabson * Redistribution and use in source and binary forms, with or without 9dfdcada3SDoug Rabson * modification, are permitted provided that the following conditions 10dfdcada3SDoug Rabson * are met: 11dfdcada3SDoug Rabson * 1. Redistributions of source code must retain the above copyright 12dfdcada3SDoug Rabson * notice, this list of conditions and the following disclaimer. 13dfdcada3SDoug Rabson * 2. Redistributions in binary form must reproduce the above copyright 14dfdcada3SDoug Rabson * notice, this list of conditions and the following disclaimer in the 15dfdcada3SDoug Rabson * documentation and/or other materials provided with the distribution. 16dfdcada3SDoug Rabson * 17dfdcada3SDoug Rabson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18dfdcada3SDoug Rabson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19dfdcada3SDoug Rabson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20dfdcada3SDoug Rabson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21dfdcada3SDoug Rabson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22dfdcada3SDoug Rabson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23dfdcada3SDoug Rabson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24dfdcada3SDoug Rabson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25dfdcada3SDoug Rabson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26dfdcada3SDoug Rabson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27dfdcada3SDoug Rabson * SUCH DAMAGE. 28dfdcada3SDoug Rabson */ 29dfdcada3SDoug Rabson 30dfdcada3SDoug Rabson #include <sys/param.h> 31dfdcada3SDoug Rabson #include <sys/systm.h> 32dfdcada3SDoug Rabson 33ee31b83aSDoug Rabson #include <nlm/nlm_prot.h> 34ee31b83aSDoug Rabson #include <nlm/nlm.h> 35dfdcada3SDoug Rabson 36dfdcada3SDoug Rabson #include <sys/cdefs.h> 37dfdcada3SDoug Rabson #ifndef lint 38dfdcada3SDoug Rabson /*static char sccsid[] = "from: @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro";*/ 39dfdcada3SDoug Rabson /*static char sccsid[] = "from: * @(#)nlm_prot.x 2.1 88/08/01 4.0 RPCSRC";*/ 40dfdcada3SDoug Rabson __RCSID("$NetBSD: nlm_prot.x,v 1.6 2000/06/07 14:30:15 bouyer Exp $"); 41dfdcada3SDoug Rabson #endif /* not lint */ 42dfdcada3SDoug Rabson __FBSDID("$FreeBSD$"); 43dfdcada3SDoug Rabson 44dfdcada3SDoug Rabson void nlm_prog_0(struct svc_req *rqstp, SVCXPRT *transp); 45dfdcada3SDoug Rabson void nlm_prog_1(struct svc_req *rqstp, SVCXPRT *transp); 46dfdcada3SDoug Rabson void nlm_prog_3(struct svc_req *rqstp, SVCXPRT *transp); 47dfdcada3SDoug Rabson void nlm_prog_4(struct svc_req *rqstp, SVCXPRT *transp); 48dfdcada3SDoug Rabson 49dfdcada3SDoug Rabson void 50dfdcada3SDoug Rabson nlm_prog_0(struct svc_req *rqstp, SVCXPRT *transp) 51dfdcada3SDoug Rabson { 52dfdcada3SDoug Rabson union { 53dfdcada3SDoug Rabson struct nlm_sm_status nlm_sm_notify_0_arg; 54dfdcada3SDoug Rabson } argument; 55dfdcada3SDoug Rabson char result; 56dfdcada3SDoug Rabson bool_t retval; 57dfdcada3SDoug Rabson xdrproc_t xdr_argument, xdr_result; 58dfdcada3SDoug Rabson bool_t (*local)(char *, void *, struct svc_req *); 59dfdcada3SDoug Rabson 60dfdcada3SDoug Rabson switch (rqstp->rq_proc) { 61dfdcada3SDoug Rabson case NULLPROC: 62a9148abdSDoug Rabson (void) svc_sendreply(rqstp, 63dfdcada3SDoug Rabson (xdrproc_t) xdr_void, (char *)NULL); 64a9148abdSDoug Rabson svc_freereq(rqstp); 65dfdcada3SDoug Rabson return; 66dfdcada3SDoug Rabson 67dfdcada3SDoug Rabson case NLM_SM_NOTIFY: 68dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_sm_status; 69dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 70dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_sm_notify_0_svc; 71dfdcada3SDoug Rabson break; 72dfdcada3SDoug Rabson 73dfdcada3SDoug Rabson default: 74a9148abdSDoug Rabson svcerr_noproc(rqstp); 75a9148abdSDoug Rabson svc_freereq(rqstp); 76dfdcada3SDoug Rabson return; 77dfdcada3SDoug Rabson } 78dfdcada3SDoug Rabson (void) memset((char *)&argument, 0, sizeof (argument)); 79a9148abdSDoug Rabson if (!svc_getargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) { 80a9148abdSDoug Rabson svcerr_decode(rqstp); 81a9148abdSDoug Rabson svc_freereq(rqstp); 82dfdcada3SDoug Rabson return; 83dfdcada3SDoug Rabson } 84dfdcada3SDoug Rabson retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp); 85a9148abdSDoug Rabson if (retval > 0 && !svc_sendreply(rqstp, xdr_result, (char *)&result)) { 86a9148abdSDoug Rabson svcerr_systemerr(rqstp); 87dfdcada3SDoug Rabson } 88a9148abdSDoug Rabson if (!svc_freeargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) { 89dfdcada3SDoug Rabson printf("unable to free arguments"); 90dfdcada3SDoug Rabson //exit(1); 91dfdcada3SDoug Rabson } 926f978a84SDoug Rabson svc_freereq(rqstp); 93dfdcada3SDoug Rabson 94dfdcada3SDoug Rabson return; 95dfdcada3SDoug Rabson } 96dfdcada3SDoug Rabson 97dfdcada3SDoug Rabson void 98dfdcada3SDoug Rabson nlm_prog_1(struct svc_req *rqstp, SVCXPRT *transp) 99dfdcada3SDoug Rabson { 100dfdcada3SDoug Rabson union { 101dfdcada3SDoug Rabson struct nlm_testargs nlm_test_1_arg; 102dfdcada3SDoug Rabson struct nlm_lockargs nlm_lock_1_arg; 103dfdcada3SDoug Rabson struct nlm_cancargs nlm_cancel_1_arg; 104dfdcada3SDoug Rabson struct nlm_unlockargs nlm_unlock_1_arg; 105dfdcada3SDoug Rabson struct nlm_testargs nlm_granted_1_arg; 106dfdcada3SDoug Rabson struct nlm_testargs nlm_test_msg_1_arg; 107dfdcada3SDoug Rabson struct nlm_lockargs nlm_lock_msg_1_arg; 108dfdcada3SDoug Rabson struct nlm_cancargs nlm_cancel_msg_1_arg; 109dfdcada3SDoug Rabson struct nlm_unlockargs nlm_unlock_msg_1_arg; 110dfdcada3SDoug Rabson struct nlm_testargs nlm_granted_msg_1_arg; 111dfdcada3SDoug Rabson nlm_testres nlm_test_res_1_arg; 112dfdcada3SDoug Rabson nlm_res nlm_lock_res_1_arg; 113dfdcada3SDoug Rabson nlm_res nlm_cancel_res_1_arg; 114dfdcada3SDoug Rabson nlm_res nlm_unlock_res_1_arg; 115dfdcada3SDoug Rabson nlm_res nlm_granted_res_1_arg; 116dfdcada3SDoug Rabson } argument; 117dfdcada3SDoug Rabson union { 118dfdcada3SDoug Rabson nlm_testres nlm_test_1_res; 119dfdcada3SDoug Rabson nlm_res nlm_lock_1_res; 120dfdcada3SDoug Rabson nlm_res nlm_cancel_1_res; 121dfdcada3SDoug Rabson nlm_res nlm_unlock_1_res; 122dfdcada3SDoug Rabson nlm_res nlm_granted_1_res; 123dfdcada3SDoug Rabson } result; 124dfdcada3SDoug Rabson bool_t retval; 125dfdcada3SDoug Rabson xdrproc_t xdr_argument, xdr_result; 126dfdcada3SDoug Rabson bool_t (*local)(char *, void *, struct svc_req *); 127dfdcada3SDoug Rabson 128dfdcada3SDoug Rabson switch (rqstp->rq_proc) { 129dfdcada3SDoug Rabson case NULLPROC: 130a9148abdSDoug Rabson (void) svc_sendreply(rqstp, 131dfdcada3SDoug Rabson (xdrproc_t) xdr_void, (char *)NULL); 132a9148abdSDoug Rabson svc_freereq(rqstp); 133dfdcada3SDoug Rabson return; 134dfdcada3SDoug Rabson 135dfdcada3SDoug Rabson case NLM_TEST: 136dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_testargs; 137dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_nlm_testres; 138dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_test_1_svc; 139dfdcada3SDoug Rabson break; 140dfdcada3SDoug Rabson 141dfdcada3SDoug Rabson case NLM_LOCK: 142dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_lockargs; 143dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_nlm_res; 144dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_lock_1_svc; 145dfdcada3SDoug Rabson break; 146dfdcada3SDoug Rabson 147dfdcada3SDoug Rabson case NLM_CANCEL: 148dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_cancargs; 149dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_nlm_res; 150dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_cancel_1_svc; 151dfdcada3SDoug Rabson break; 152dfdcada3SDoug Rabson 153dfdcada3SDoug Rabson case NLM_UNLOCK: 154dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_unlockargs; 155dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_nlm_res; 156dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_unlock_1_svc; 157dfdcada3SDoug Rabson break; 158dfdcada3SDoug Rabson 159dfdcada3SDoug Rabson case NLM_GRANTED: 160dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_testargs; 161dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_nlm_res; 162dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_granted_1_svc; 163dfdcada3SDoug Rabson break; 164dfdcada3SDoug Rabson 165dfdcada3SDoug Rabson case NLM_TEST_MSG: 166dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_testargs; 167dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 168dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_test_msg_1_svc; 169dfdcada3SDoug Rabson break; 170dfdcada3SDoug Rabson 171dfdcada3SDoug Rabson case NLM_LOCK_MSG: 172dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_lockargs; 173dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 174dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_lock_msg_1_svc; 175dfdcada3SDoug Rabson break; 176dfdcada3SDoug Rabson 177dfdcada3SDoug Rabson case NLM_CANCEL_MSG: 178dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_cancargs; 179dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 180dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_cancel_msg_1_svc; 181dfdcada3SDoug Rabson break; 182dfdcada3SDoug Rabson 183dfdcada3SDoug Rabson case NLM_UNLOCK_MSG: 184dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_unlockargs; 185dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 186dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_unlock_msg_1_svc; 187dfdcada3SDoug Rabson break; 188dfdcada3SDoug Rabson 189dfdcada3SDoug Rabson case NLM_GRANTED_MSG: 190dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_testargs; 191dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 192dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_granted_msg_1_svc; 193dfdcada3SDoug Rabson break; 194dfdcada3SDoug Rabson 195dfdcada3SDoug Rabson case NLM_TEST_RES: 196dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_testres; 197dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 198dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_test_res_1_svc; 199dfdcada3SDoug Rabson break; 200dfdcada3SDoug Rabson 201dfdcada3SDoug Rabson case NLM_LOCK_RES: 202dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_res; 203dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 204dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_lock_res_1_svc; 205dfdcada3SDoug Rabson break; 206dfdcada3SDoug Rabson 207dfdcada3SDoug Rabson case NLM_CANCEL_RES: 208dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_res; 209dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 210dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_cancel_res_1_svc; 211dfdcada3SDoug Rabson break; 212dfdcada3SDoug Rabson 213dfdcada3SDoug Rabson case NLM_UNLOCK_RES: 214dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_res; 215dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 216dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_unlock_res_1_svc; 217dfdcada3SDoug Rabson break; 218dfdcada3SDoug Rabson 219dfdcada3SDoug Rabson case NLM_GRANTED_RES: 220dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_res; 221dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 222dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_granted_res_1_svc; 223dfdcada3SDoug Rabson break; 224dfdcada3SDoug Rabson 225dfdcada3SDoug Rabson default: 226a9148abdSDoug Rabson svcerr_noproc(rqstp); 227a9148abdSDoug Rabson svc_freereq(rqstp); 228dfdcada3SDoug Rabson return; 229dfdcada3SDoug Rabson } 230dfdcada3SDoug Rabson (void) memset((char *)&argument, 0, sizeof (argument)); 231a9148abdSDoug Rabson if (!svc_getargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) { 232a9148abdSDoug Rabson svcerr_decode(rqstp); 233a9148abdSDoug Rabson svc_freereq(rqstp); 234dfdcada3SDoug Rabson return; 235dfdcada3SDoug Rabson } 236dfdcada3SDoug Rabson retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp); 237a9148abdSDoug Rabson if (retval > 0 && !svc_sendreply(rqstp, xdr_result, (char *)&result)) { 238a9148abdSDoug Rabson svcerr_systemerr(rqstp); 239dfdcada3SDoug Rabson } 240a9148abdSDoug Rabson if (!svc_freeargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) { 241dfdcada3SDoug Rabson printf("unable to free arguments"); 242dfdcada3SDoug Rabson //exit(1); 243dfdcada3SDoug Rabson } 244a9148abdSDoug Rabson svc_freereq(rqstp); 245dfdcada3SDoug Rabson if (!nlm_prog_1_freeresult(transp, xdr_result, (caddr_t) &result)) 246dfdcada3SDoug Rabson printf("unable to free results"); 247dfdcada3SDoug Rabson 248dfdcada3SDoug Rabson return; 249dfdcada3SDoug Rabson } 250dfdcada3SDoug Rabson 251dfdcada3SDoug Rabson void 252dfdcada3SDoug Rabson nlm_prog_3(struct svc_req *rqstp, SVCXPRT *transp) 253dfdcada3SDoug Rabson { 254dfdcada3SDoug Rabson union { 255dfdcada3SDoug Rabson nlm_shareargs nlm_share_3_arg; 256dfdcada3SDoug Rabson nlm_shareargs nlm_unshare_3_arg; 257dfdcada3SDoug Rabson nlm_lockargs nlm_nm_lock_3_arg; 258dfdcada3SDoug Rabson nlm_notify nlm_free_all_3_arg; 259dfdcada3SDoug Rabson } argument; 260dfdcada3SDoug Rabson union { 261dfdcada3SDoug Rabson nlm_shareres nlm_share_3_res; 262dfdcada3SDoug Rabson nlm_shareres nlm_unshare_3_res; 263dfdcada3SDoug Rabson nlm_res nlm_nm_lock_3_res; 264dfdcada3SDoug Rabson } result; 265dfdcada3SDoug Rabson bool_t retval; 266dfdcada3SDoug Rabson xdrproc_t xdr_argument, xdr_result; 267dfdcada3SDoug Rabson bool_t (*local)(char *, void *, struct svc_req *); 268dfdcada3SDoug Rabson 269dfdcada3SDoug Rabson switch (rqstp->rq_proc) { 270dfdcada3SDoug Rabson case NULLPROC: 271a9148abdSDoug Rabson (void) svc_sendreply(rqstp, 272dfdcada3SDoug Rabson (xdrproc_t) xdr_void, (char *)NULL); 273a9148abdSDoug Rabson svc_freereq(rqstp); 274dfdcada3SDoug Rabson return; 275dfdcada3SDoug Rabson 276dfdcada3SDoug Rabson case NLM_TEST: 277dfdcada3SDoug Rabson case NLM_LOCK: 278dfdcada3SDoug Rabson case NLM_CANCEL: 279dfdcada3SDoug Rabson case NLM_UNLOCK: 280dfdcada3SDoug Rabson case NLM_GRANTED: 281dfdcada3SDoug Rabson case NLM_TEST_MSG: 282dfdcada3SDoug Rabson case NLM_LOCK_MSG: 283dfdcada3SDoug Rabson case NLM_CANCEL_MSG: 284dfdcada3SDoug Rabson case NLM_UNLOCK_MSG: 285dfdcada3SDoug Rabson case NLM_GRANTED_MSG: 286dfdcada3SDoug Rabson case NLM_TEST_RES: 287dfdcada3SDoug Rabson case NLM_LOCK_RES: 288dfdcada3SDoug Rabson case NLM_CANCEL_RES: 289dfdcada3SDoug Rabson case NLM_UNLOCK_RES: 290dfdcada3SDoug Rabson case NLM_GRANTED_RES: 291dfdcada3SDoug Rabson nlm_prog_1(rqstp, transp); 292dfdcada3SDoug Rabson return; 293dfdcada3SDoug Rabson 294dfdcada3SDoug Rabson case NLM_SHARE: 295dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_shareargs; 296dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_nlm_shareres; 297dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_share_3_svc; 298dfdcada3SDoug Rabson break; 299dfdcada3SDoug Rabson 300dfdcada3SDoug Rabson case NLM_UNSHARE: 301dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_shareargs; 302dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_nlm_shareres; 303dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_unshare_3_svc; 304dfdcada3SDoug Rabson break; 305dfdcada3SDoug Rabson 306dfdcada3SDoug Rabson case NLM_NM_LOCK: 307dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_lockargs; 308dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_nlm_res; 309dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_nm_lock_3_svc; 310dfdcada3SDoug Rabson break; 311dfdcada3SDoug Rabson 312dfdcada3SDoug Rabson case NLM_FREE_ALL: 313dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm_notify; 314dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 315dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm_free_all_3_svc; 316dfdcada3SDoug Rabson break; 317dfdcada3SDoug Rabson 318dfdcada3SDoug Rabson default: 319a9148abdSDoug Rabson svcerr_noproc(rqstp); 320a9148abdSDoug Rabson svc_freereq(rqstp); 321dfdcada3SDoug Rabson return; 322dfdcada3SDoug Rabson } 323dfdcada3SDoug Rabson (void) memset((char *)&argument, 0, sizeof (argument)); 324a9148abdSDoug Rabson if (!svc_getargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) { 325a9148abdSDoug Rabson svcerr_decode(rqstp); 326a9148abdSDoug Rabson svc_freereq(rqstp); 327dfdcada3SDoug Rabson return; 328dfdcada3SDoug Rabson } 329dfdcada3SDoug Rabson retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp); 330a9148abdSDoug Rabson if (retval > 0 && !svc_sendreply(rqstp, xdr_result, (char *)&result)) { 331a9148abdSDoug Rabson svcerr_systemerr(rqstp); 332dfdcada3SDoug Rabson } 333a9148abdSDoug Rabson if (!svc_freeargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) { 334dfdcada3SDoug Rabson printf("unable to free arguments"); 335dfdcada3SDoug Rabson //exit(1); 336dfdcada3SDoug Rabson } 337a9148abdSDoug Rabson svc_freereq(rqstp); 338dfdcada3SDoug Rabson if (!nlm_prog_3_freeresult(transp, xdr_result, (caddr_t) &result)) 339dfdcada3SDoug Rabson printf("unable to free results"); 340dfdcada3SDoug Rabson 341dfdcada3SDoug Rabson return; 342dfdcada3SDoug Rabson } 343dfdcada3SDoug Rabson 344dfdcada3SDoug Rabson void 345dfdcada3SDoug Rabson nlm_prog_4(struct svc_req *rqstp, SVCXPRT *transp) 346dfdcada3SDoug Rabson { 347dfdcada3SDoug Rabson union { 348dfdcada3SDoug Rabson nlm4_testargs nlm4_test_4_arg; 349dfdcada3SDoug Rabson nlm4_lockargs nlm4_lock_4_arg; 350dfdcada3SDoug Rabson nlm4_cancargs nlm4_cancel_4_arg; 351dfdcada3SDoug Rabson nlm4_unlockargs nlm4_unlock_4_arg; 352dfdcada3SDoug Rabson nlm4_testargs nlm4_granted_4_arg; 353dfdcada3SDoug Rabson nlm4_testargs nlm4_test_msg_4_arg; 354dfdcada3SDoug Rabson nlm4_lockargs nlm4_lock_msg_4_arg; 355dfdcada3SDoug Rabson nlm4_cancargs nlm4_cancel_msg_4_arg; 356dfdcada3SDoug Rabson nlm4_unlockargs nlm4_unlock_msg_4_arg; 357dfdcada3SDoug Rabson nlm4_testargs nlm4_granted_msg_4_arg; 358dfdcada3SDoug Rabson nlm4_testres nlm4_test_res_4_arg; 359dfdcada3SDoug Rabson nlm4_res nlm4_lock_res_4_arg; 360dfdcada3SDoug Rabson nlm4_res nlm4_cancel_res_4_arg; 361dfdcada3SDoug Rabson nlm4_res nlm4_unlock_res_4_arg; 362dfdcada3SDoug Rabson nlm4_res nlm4_granted_res_4_arg; 363dfdcada3SDoug Rabson nlm4_shareargs nlm4_share_4_arg; 364dfdcada3SDoug Rabson nlm4_shareargs nlm4_unshare_4_arg; 365dfdcada3SDoug Rabson nlm4_lockargs nlm4_nm_lock_4_arg; 366dfdcada3SDoug Rabson nlm4_notify nlm4_free_all_4_arg; 367dfdcada3SDoug Rabson } argument; 368dfdcada3SDoug Rabson union { 369dfdcada3SDoug Rabson nlm4_testres nlm4_test_4_res; 370dfdcada3SDoug Rabson nlm4_res nlm4_lock_4_res; 371dfdcada3SDoug Rabson nlm4_res nlm4_cancel_4_res; 372dfdcada3SDoug Rabson nlm4_res nlm4_unlock_4_res; 373dfdcada3SDoug Rabson nlm4_res nlm4_granted_4_res; 374dfdcada3SDoug Rabson nlm4_shareres nlm4_share_4_res; 375dfdcada3SDoug Rabson nlm4_shareres nlm4_unshare_4_res; 376dfdcada3SDoug Rabson nlm4_res nlm4_nm_lock_4_res; 377dfdcada3SDoug Rabson } result; 378dfdcada3SDoug Rabson bool_t retval; 379dfdcada3SDoug Rabson xdrproc_t xdr_argument, xdr_result; 380dfdcada3SDoug Rabson bool_t (*local)(char *, void *, struct svc_req *); 381dfdcada3SDoug Rabson 382dfdcada3SDoug Rabson switch (rqstp->rq_proc) { 383dfdcada3SDoug Rabson case NULLPROC: 384a9148abdSDoug Rabson (void) svc_sendreply(rqstp, 385dfdcada3SDoug Rabson (xdrproc_t) xdr_void, (char *)NULL); 386a9148abdSDoug Rabson svc_freereq(rqstp); 387dfdcada3SDoug Rabson return; 388dfdcada3SDoug Rabson 389dfdcada3SDoug Rabson case NLM4_TEST: 390dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_testargs; 391dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_nlm4_testres; 392dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_test_4_svc; 393dfdcada3SDoug Rabson break; 394dfdcada3SDoug Rabson 395dfdcada3SDoug Rabson case NLM4_LOCK: 396dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_lockargs; 397dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_nlm4_res; 398dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_lock_4_svc; 399dfdcada3SDoug Rabson break; 400dfdcada3SDoug Rabson 401dfdcada3SDoug Rabson case NLM4_CANCEL: 402dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_cancargs; 403dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_nlm4_res; 404dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_cancel_4_svc; 405dfdcada3SDoug Rabson break; 406dfdcada3SDoug Rabson 407dfdcada3SDoug Rabson case NLM4_UNLOCK: 408dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_unlockargs; 409dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_nlm4_res; 410dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_unlock_4_svc; 411dfdcada3SDoug Rabson break; 412dfdcada3SDoug Rabson 413dfdcada3SDoug Rabson case NLM4_GRANTED: 414dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_testargs; 415dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_nlm4_res; 416dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_granted_4_svc; 417dfdcada3SDoug Rabson break; 418dfdcada3SDoug Rabson 419dfdcada3SDoug Rabson case NLM4_TEST_MSG: 420dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_testargs; 421dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 422dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_test_msg_4_svc; 423dfdcada3SDoug Rabson break; 424dfdcada3SDoug Rabson 425dfdcada3SDoug Rabson case NLM4_LOCK_MSG: 426dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_lockargs; 427dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 428dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_lock_msg_4_svc; 429dfdcada3SDoug Rabson break; 430dfdcada3SDoug Rabson 431dfdcada3SDoug Rabson case NLM4_CANCEL_MSG: 432dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_cancargs; 433dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 434dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_cancel_msg_4_svc; 435dfdcada3SDoug Rabson break; 436dfdcada3SDoug Rabson 437dfdcada3SDoug Rabson case NLM4_UNLOCK_MSG: 438dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_unlockargs; 439dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 440dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_unlock_msg_4_svc; 441dfdcada3SDoug Rabson break; 442dfdcada3SDoug Rabson 443dfdcada3SDoug Rabson case NLM4_GRANTED_MSG: 444dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_testargs; 445dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 446dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_granted_msg_4_svc; 447dfdcada3SDoug Rabson break; 448dfdcada3SDoug Rabson 449dfdcada3SDoug Rabson case NLM4_TEST_RES: 450dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_testres; 451dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 452dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_test_res_4_svc; 453dfdcada3SDoug Rabson break; 454dfdcada3SDoug Rabson 455dfdcada3SDoug Rabson case NLM4_LOCK_RES: 456dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_res; 457dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 458dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_lock_res_4_svc; 459dfdcada3SDoug Rabson break; 460dfdcada3SDoug Rabson 461dfdcada3SDoug Rabson case NLM4_CANCEL_RES: 462dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_res; 463dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 464dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_cancel_res_4_svc; 465dfdcada3SDoug Rabson break; 466dfdcada3SDoug Rabson 467dfdcada3SDoug Rabson case NLM4_UNLOCK_RES: 468dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_res; 469dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 470dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_unlock_res_4_svc; 471dfdcada3SDoug Rabson break; 472dfdcada3SDoug Rabson 473dfdcada3SDoug Rabson case NLM4_GRANTED_RES: 474dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_res; 475dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 476dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_granted_res_4_svc; 477dfdcada3SDoug Rabson break; 478dfdcada3SDoug Rabson 479dfdcada3SDoug Rabson case NLM4_SHARE: 480dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_shareargs; 481dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_nlm4_shareres; 482dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_share_4_svc; 483dfdcada3SDoug Rabson break; 484dfdcada3SDoug Rabson 485dfdcada3SDoug Rabson case NLM4_UNSHARE: 486dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_shareargs; 487dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_nlm4_shareres; 488dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_unshare_4_svc; 489dfdcada3SDoug Rabson break; 490dfdcada3SDoug Rabson 491dfdcada3SDoug Rabson case NLM4_NM_LOCK: 492dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_lockargs; 493dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_nlm4_res; 494dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_nm_lock_4_svc; 495dfdcada3SDoug Rabson break; 496dfdcada3SDoug Rabson 497dfdcada3SDoug Rabson case NLM4_FREE_ALL: 498dfdcada3SDoug Rabson xdr_argument = (xdrproc_t) xdr_nlm4_notify; 499dfdcada3SDoug Rabson xdr_result = (xdrproc_t) xdr_void; 500dfdcada3SDoug Rabson local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_free_all_4_svc; 501dfdcada3SDoug Rabson break; 502dfdcada3SDoug Rabson 503dfdcada3SDoug Rabson default: 504a9148abdSDoug Rabson svcerr_noproc(rqstp); 505a9148abdSDoug Rabson svc_freereq(rqstp); 506dfdcada3SDoug Rabson return; 507dfdcada3SDoug Rabson } 508dfdcada3SDoug Rabson (void) memset((char *)&argument, 0, sizeof (argument)); 509a9148abdSDoug Rabson if (!svc_getargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) { 510a9148abdSDoug Rabson svcerr_decode(rqstp); 511a9148abdSDoug Rabson svc_freereq(rqstp); 512dfdcada3SDoug Rabson return; 513dfdcada3SDoug Rabson } 514dfdcada3SDoug Rabson retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp); 515a9148abdSDoug Rabson if (retval > 0 && !svc_sendreply(rqstp, xdr_result, (char *)&result)) { 516a9148abdSDoug Rabson svcerr_systemerr(rqstp); 517dfdcada3SDoug Rabson } 518a9148abdSDoug Rabson if (!svc_freeargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) { 519dfdcada3SDoug Rabson printf("unable to free arguments"); 520dfdcada3SDoug Rabson //exit(1); 521dfdcada3SDoug Rabson } 522a9148abdSDoug Rabson svc_freereq(rqstp); 523dfdcada3SDoug Rabson if (!nlm_prog_4_freeresult(transp, xdr_result, (caddr_t) &result)) 524dfdcada3SDoug Rabson printf("unable to free results"); 525dfdcada3SDoug Rabson 526dfdcada3SDoug Rabson return; 527dfdcada3SDoug Rabson } 528