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