2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2008 Isilon Inc http://www.isilon.com/
5 * Authors: Doug Rabson <dfr@rabson.org>
6 * Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 #include <sys/param.h>
31 #include <sys/systm.h>
33 #include <nlm/nlm_prot.h>
36 #include <sys/cdefs.h>
38 /*static char sccsid[] = "from: @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro";*/
39 /*static char sccsid[] = "from: * @(#)nlm_prot.x 2.1 88/08/01 4.0 RPCSRC";*/
40 __RCSID("$NetBSD: nlm_prot.x,v 1.6 2000/06/07 14:30:15 bouyer Exp $");
42 __FBSDID("$FreeBSD$");
44 void nlm_prog_0(struct svc_req *rqstp, SVCXPRT *transp);
45 void nlm_prog_1(struct svc_req *rqstp, SVCXPRT *transp);
46 void nlm_prog_3(struct svc_req *rqstp, SVCXPRT *transp);
47 void nlm_prog_4(struct svc_req *rqstp, SVCXPRT *transp);
50 nlm_prog_0(struct svc_req *rqstp, SVCXPRT *transp)
53 struct nlm_sm_status nlm_sm_notify_0_arg;
57 xdrproc_t xdr_argument, xdr_result;
58 bool_t (*local)(char *, void *, struct svc_req *);
60 switch (rqstp->rq_proc) {
62 (void) svc_sendreply(rqstp,
63 (xdrproc_t) xdr_void, (char *)NULL);
68 xdr_argument = (xdrproc_t) xdr_nlm_sm_status;
69 xdr_result = (xdrproc_t) xdr_void;
70 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_sm_notify_0_svc;
78 (void) memset((char *)&argument, 0, sizeof (argument));
79 if (!svc_getargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) {
84 retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
85 if (retval > 0 && !svc_sendreply(rqstp, xdr_result, (char *)&result)) {
86 svcerr_systemerr(rqstp);
88 if (!svc_freeargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) {
89 printf("unable to free arguments");
98 nlm_prog_1(struct svc_req *rqstp, SVCXPRT *transp)
101 struct nlm_testargs nlm_test_1_arg;
102 struct nlm_lockargs nlm_lock_1_arg;
103 struct nlm_cancargs nlm_cancel_1_arg;
104 struct nlm_unlockargs nlm_unlock_1_arg;
105 struct nlm_testargs nlm_granted_1_arg;
106 struct nlm_testargs nlm_test_msg_1_arg;
107 struct nlm_lockargs nlm_lock_msg_1_arg;
108 struct nlm_cancargs nlm_cancel_msg_1_arg;
109 struct nlm_unlockargs nlm_unlock_msg_1_arg;
110 struct nlm_testargs nlm_granted_msg_1_arg;
111 nlm_testres nlm_test_res_1_arg;
112 nlm_res nlm_lock_res_1_arg;
113 nlm_res nlm_cancel_res_1_arg;
114 nlm_res nlm_unlock_res_1_arg;
115 nlm_res nlm_granted_res_1_arg;
118 nlm_testres nlm_test_1_res;
119 nlm_res nlm_lock_1_res;
120 nlm_res nlm_cancel_1_res;
121 nlm_res nlm_unlock_1_res;
122 nlm_res nlm_granted_1_res;
125 xdrproc_t xdr_argument, xdr_result;
126 bool_t (*local)(char *, void *, struct svc_req *);
128 switch (rqstp->rq_proc) {
130 (void) svc_sendreply(rqstp,
131 (xdrproc_t) xdr_void, (char *)NULL);
136 xdr_argument = (xdrproc_t) xdr_nlm_testargs;
137 xdr_result = (xdrproc_t) xdr_nlm_testres;
138 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_test_1_svc;
142 xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
143 xdr_result = (xdrproc_t) xdr_nlm_res;
144 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_lock_1_svc;
148 xdr_argument = (xdrproc_t) xdr_nlm_cancargs;
149 xdr_result = (xdrproc_t) xdr_nlm_res;
150 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_cancel_1_svc;
154 xdr_argument = (xdrproc_t) xdr_nlm_unlockargs;
155 xdr_result = (xdrproc_t) xdr_nlm_res;
156 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_unlock_1_svc;
160 xdr_argument = (xdrproc_t) xdr_nlm_testargs;
161 xdr_result = (xdrproc_t) xdr_nlm_res;
162 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_granted_1_svc;
166 xdr_argument = (xdrproc_t) xdr_nlm_testargs;
167 xdr_result = (xdrproc_t) xdr_void;
168 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_test_msg_1_svc;
172 xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
173 xdr_result = (xdrproc_t) xdr_void;
174 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_lock_msg_1_svc;
178 xdr_argument = (xdrproc_t) xdr_nlm_cancargs;
179 xdr_result = (xdrproc_t) xdr_void;
180 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_cancel_msg_1_svc;
184 xdr_argument = (xdrproc_t) xdr_nlm_unlockargs;
185 xdr_result = (xdrproc_t) xdr_void;
186 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_unlock_msg_1_svc;
189 case NLM_GRANTED_MSG:
190 xdr_argument = (xdrproc_t) xdr_nlm_testargs;
191 xdr_result = (xdrproc_t) xdr_void;
192 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_granted_msg_1_svc;
196 xdr_argument = (xdrproc_t) xdr_nlm_testres;
197 xdr_result = (xdrproc_t) xdr_void;
198 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_test_res_1_svc;
202 xdr_argument = (xdrproc_t) xdr_nlm_res;
203 xdr_result = (xdrproc_t) xdr_void;
204 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_lock_res_1_svc;
208 xdr_argument = (xdrproc_t) xdr_nlm_res;
209 xdr_result = (xdrproc_t) xdr_void;
210 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_cancel_res_1_svc;
214 xdr_argument = (xdrproc_t) xdr_nlm_res;
215 xdr_result = (xdrproc_t) xdr_void;
216 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_unlock_res_1_svc;
219 case NLM_GRANTED_RES:
220 xdr_argument = (xdrproc_t) xdr_nlm_res;
221 xdr_result = (xdrproc_t) xdr_void;
222 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_granted_res_1_svc;
226 svcerr_noproc(rqstp);
230 (void) memset((char *)&argument, 0, sizeof (argument));
231 if (!svc_getargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) {
232 svcerr_decode(rqstp);
236 retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
237 if (retval > 0 && !svc_sendreply(rqstp, xdr_result, (char *)&result)) {
238 svcerr_systemerr(rqstp);
240 if (!svc_freeargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) {
241 printf("unable to free arguments");
245 if (!nlm_prog_1_freeresult(transp, xdr_result, (caddr_t) &result))
246 printf("unable to free results");
252 nlm_prog_3(struct svc_req *rqstp, SVCXPRT *transp)
255 nlm_shareargs nlm_share_3_arg;
256 nlm_shareargs nlm_unshare_3_arg;
257 nlm_lockargs nlm_nm_lock_3_arg;
258 nlm_notify nlm_free_all_3_arg;
261 nlm_shareres nlm_share_3_res;
262 nlm_shareres nlm_unshare_3_res;
263 nlm_res nlm_nm_lock_3_res;
266 xdrproc_t xdr_argument, xdr_result;
267 bool_t (*local)(char *, void *, struct svc_req *);
269 switch (rqstp->rq_proc) {
271 (void) svc_sendreply(rqstp,
272 (xdrproc_t) xdr_void, (char *)NULL);
285 case NLM_GRANTED_MSG:
290 case NLM_GRANTED_RES:
291 nlm_prog_1(rqstp, transp);
295 xdr_argument = (xdrproc_t) xdr_nlm_shareargs;
296 xdr_result = (xdrproc_t) xdr_nlm_shareres;
297 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_share_3_svc;
301 xdr_argument = (xdrproc_t) xdr_nlm_shareargs;
302 xdr_result = (xdrproc_t) xdr_nlm_shareres;
303 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_unshare_3_svc;
307 xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
308 xdr_result = (xdrproc_t) xdr_nlm_res;
309 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_nm_lock_3_svc;
313 xdr_argument = (xdrproc_t) xdr_nlm_notify;
314 xdr_result = (xdrproc_t) xdr_void;
315 local = (bool_t (*) (char *, void *, struct svc_req *))nlm_free_all_3_svc;
319 svcerr_noproc(rqstp);
323 (void) memset((char *)&argument, 0, sizeof (argument));
324 if (!svc_getargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) {
325 svcerr_decode(rqstp);
329 retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
330 if (retval > 0 && !svc_sendreply(rqstp, xdr_result, (char *)&result)) {
331 svcerr_systemerr(rqstp);
333 if (!svc_freeargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) {
334 printf("unable to free arguments");
338 if (!nlm_prog_3_freeresult(transp, xdr_result, (caddr_t) &result))
339 printf("unable to free results");
345 nlm_prog_4(struct svc_req *rqstp, SVCXPRT *transp)
348 nlm4_testargs nlm4_test_4_arg;
349 nlm4_lockargs nlm4_lock_4_arg;
350 nlm4_cancargs nlm4_cancel_4_arg;
351 nlm4_unlockargs nlm4_unlock_4_arg;
352 nlm4_testargs nlm4_granted_4_arg;
353 nlm4_testargs nlm4_test_msg_4_arg;
354 nlm4_lockargs nlm4_lock_msg_4_arg;
355 nlm4_cancargs nlm4_cancel_msg_4_arg;
356 nlm4_unlockargs nlm4_unlock_msg_4_arg;
357 nlm4_testargs nlm4_granted_msg_4_arg;
358 nlm4_testres nlm4_test_res_4_arg;
359 nlm4_res nlm4_lock_res_4_arg;
360 nlm4_res nlm4_cancel_res_4_arg;
361 nlm4_res nlm4_unlock_res_4_arg;
362 nlm4_res nlm4_granted_res_4_arg;
363 nlm4_shareargs nlm4_share_4_arg;
364 nlm4_shareargs nlm4_unshare_4_arg;
365 nlm4_lockargs nlm4_nm_lock_4_arg;
366 nlm4_notify nlm4_free_all_4_arg;
369 nlm4_testres nlm4_test_4_res;
370 nlm4_res nlm4_lock_4_res;
371 nlm4_res nlm4_cancel_4_res;
372 nlm4_res nlm4_unlock_4_res;
373 nlm4_res nlm4_granted_4_res;
374 nlm4_shareres nlm4_share_4_res;
375 nlm4_shareres nlm4_unshare_4_res;
376 nlm4_res nlm4_nm_lock_4_res;
379 xdrproc_t xdr_argument, xdr_result;
380 bool_t (*local)(char *, void *, struct svc_req *);
382 switch (rqstp->rq_proc) {
384 (void) svc_sendreply(rqstp,
385 (xdrproc_t) xdr_void, (char *)NULL);
390 xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
391 xdr_result = (xdrproc_t) xdr_nlm4_testres;
392 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_test_4_svc;
396 xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
397 xdr_result = (xdrproc_t) xdr_nlm4_res;
398 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_lock_4_svc;
402 xdr_argument = (xdrproc_t) xdr_nlm4_cancargs;
403 xdr_result = (xdrproc_t) xdr_nlm4_res;
404 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_cancel_4_svc;
408 xdr_argument = (xdrproc_t) xdr_nlm4_unlockargs;
409 xdr_result = (xdrproc_t) xdr_nlm4_res;
410 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_unlock_4_svc;
414 xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
415 xdr_result = (xdrproc_t) xdr_nlm4_res;
416 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_granted_4_svc;
420 xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
421 xdr_result = (xdrproc_t) xdr_void;
422 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_test_msg_4_svc;
426 xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
427 xdr_result = (xdrproc_t) xdr_void;
428 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_lock_msg_4_svc;
431 case NLM4_CANCEL_MSG:
432 xdr_argument = (xdrproc_t) xdr_nlm4_cancargs;
433 xdr_result = (xdrproc_t) xdr_void;
434 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_cancel_msg_4_svc;
437 case NLM4_UNLOCK_MSG:
438 xdr_argument = (xdrproc_t) xdr_nlm4_unlockargs;
439 xdr_result = (xdrproc_t) xdr_void;
440 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_unlock_msg_4_svc;
443 case NLM4_GRANTED_MSG:
444 xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
445 xdr_result = (xdrproc_t) xdr_void;
446 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_granted_msg_4_svc;
450 xdr_argument = (xdrproc_t) xdr_nlm4_testres;
451 xdr_result = (xdrproc_t) xdr_void;
452 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_test_res_4_svc;
456 xdr_argument = (xdrproc_t) xdr_nlm4_res;
457 xdr_result = (xdrproc_t) xdr_void;
458 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_lock_res_4_svc;
461 case NLM4_CANCEL_RES:
462 xdr_argument = (xdrproc_t) xdr_nlm4_res;
463 xdr_result = (xdrproc_t) xdr_void;
464 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_cancel_res_4_svc;
467 case NLM4_UNLOCK_RES:
468 xdr_argument = (xdrproc_t) xdr_nlm4_res;
469 xdr_result = (xdrproc_t) xdr_void;
470 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_unlock_res_4_svc;
473 case NLM4_GRANTED_RES:
474 xdr_argument = (xdrproc_t) xdr_nlm4_res;
475 xdr_result = (xdrproc_t) xdr_void;
476 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_granted_res_4_svc;
480 xdr_argument = (xdrproc_t) xdr_nlm4_shareargs;
481 xdr_result = (xdrproc_t) xdr_nlm4_shareres;
482 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_share_4_svc;
486 xdr_argument = (xdrproc_t) xdr_nlm4_shareargs;
487 xdr_result = (xdrproc_t) xdr_nlm4_shareres;
488 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_unshare_4_svc;
492 xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
493 xdr_result = (xdrproc_t) xdr_nlm4_res;
494 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_nm_lock_4_svc;
498 xdr_argument = (xdrproc_t) xdr_nlm4_notify;
499 xdr_result = (xdrproc_t) xdr_void;
500 local = (bool_t (*) (char *, void *, struct svc_req *))nlm4_free_all_4_svc;
504 svcerr_noproc(rqstp);
508 (void) memset((char *)&argument, 0, sizeof (argument));
509 if (!svc_getargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) {
510 svcerr_decode(rqstp);
514 retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
515 if (retval > 0 && !svc_sendreply(rqstp, xdr_result, (char *)&result)) {
516 svcerr_systemerr(rqstp);
518 if (!svc_freeargs(rqstp, xdr_argument, (char *)(caddr_t) &argument)) {
519 printf("unable to free arguments");
523 if (!nlm_prog_4_freeresult(transp, xdr_result, (caddr_t) &result))
524 printf("unable to free results");