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