2 * Copyright (c) 2008 Isilon Inc http://www.isilon.com/
3 * Authors: Doug Rabson <dfr@rabson.org>
4 * Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 #include <sys/param.h>
29 #include <sys/systm.h>
31 #include <nlm/nlm_prot.h>
34 #include <sys/cdefs.h>
36 /*static char sccsid[] = "from: @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro";*/
37 /*static char sccsid[] = "from: * @(#)nlm_prot.x 2.1 88/08/01 4.0 RPCSRC";*/
38 __RCSID("$NetBSD: nlm_prot.x,v 1.6 2000/06/07 14:30:15 bouyer Exp $");
40 __FBSDID("$FreeBSD$");
42 void nlm_prog_0(struct svc_req
*rqstp
, SVCXPRT
*transp
);
43 void nlm_prog_1(struct svc_req
*rqstp
, SVCXPRT
*transp
);
44 void nlm_prog_3(struct svc_req
*rqstp
, SVCXPRT
*transp
);
45 void nlm_prog_4(struct svc_req
*rqstp
, SVCXPRT
*transp
);
48 nlm_prog_0(struct svc_req
*rqstp
, SVCXPRT
*transp
)
51 struct nlm_sm_status nlm_sm_notify_0_arg
;
55 xdrproc_t xdr_argument
, xdr_result
;
56 bool_t (*local
)(char *, void *, struct svc_req
*);
58 switch (rqstp
->rq_proc
) {
60 (void) svc_sendreply(rqstp
,
61 (xdrproc_t
) xdr_void
, (char *)NULL
);
66 xdr_argument
= (xdrproc_t
) xdr_nlm_sm_status
;
67 xdr_result
= (xdrproc_t
) xdr_void
;
68 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_sm_notify_0_svc
;
76 (void) memset((char *)&argument
, 0, sizeof (argument
));
77 if (!svc_getargs(rqstp
, xdr_argument
, (char *)(caddr_t
) &argument
)) {
82 retval
= (bool_t
) (*local
)((char *)&argument
, (void *)&result
, rqstp
);
83 if (retval
> 0 && !svc_sendreply(rqstp
, xdr_result
, (char *)&result
)) {
84 svcerr_systemerr(rqstp
);
86 if (!svc_freeargs(rqstp
, xdr_argument
, (char *)(caddr_t
) &argument
)) {
87 printf("unable to free arguments");
96 nlm_prog_1(struct svc_req
*rqstp
, SVCXPRT
*transp
)
99 struct nlm_testargs nlm_test_1_arg
;
100 struct nlm_lockargs nlm_lock_1_arg
;
101 struct nlm_cancargs nlm_cancel_1_arg
;
102 struct nlm_unlockargs nlm_unlock_1_arg
;
103 struct nlm_testargs nlm_granted_1_arg
;
104 struct nlm_testargs nlm_test_msg_1_arg
;
105 struct nlm_lockargs nlm_lock_msg_1_arg
;
106 struct nlm_cancargs nlm_cancel_msg_1_arg
;
107 struct nlm_unlockargs nlm_unlock_msg_1_arg
;
108 struct nlm_testargs nlm_granted_msg_1_arg
;
109 nlm_testres nlm_test_res_1_arg
;
110 nlm_res nlm_lock_res_1_arg
;
111 nlm_res nlm_cancel_res_1_arg
;
112 nlm_res nlm_unlock_res_1_arg
;
113 nlm_res nlm_granted_res_1_arg
;
116 nlm_testres nlm_test_1_res
;
117 nlm_res nlm_lock_1_res
;
118 nlm_res nlm_cancel_1_res
;
119 nlm_res nlm_unlock_1_res
;
120 nlm_res nlm_granted_1_res
;
123 xdrproc_t xdr_argument
, xdr_result
;
124 bool_t (*local
)(char *, void *, struct svc_req
*);
126 switch (rqstp
->rq_proc
) {
128 (void) svc_sendreply(rqstp
,
129 (xdrproc_t
) xdr_void
, (char *)NULL
);
134 xdr_argument
= (xdrproc_t
) xdr_nlm_testargs
;
135 xdr_result
= (xdrproc_t
) xdr_nlm_testres
;
136 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_test_1_svc
;
140 xdr_argument
= (xdrproc_t
) xdr_nlm_lockargs
;
141 xdr_result
= (xdrproc_t
) xdr_nlm_res
;
142 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_lock_1_svc
;
146 xdr_argument
= (xdrproc_t
) xdr_nlm_cancargs
;
147 xdr_result
= (xdrproc_t
) xdr_nlm_res
;
148 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_cancel_1_svc
;
152 xdr_argument
= (xdrproc_t
) xdr_nlm_unlockargs
;
153 xdr_result
= (xdrproc_t
) xdr_nlm_res
;
154 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_unlock_1_svc
;
158 xdr_argument
= (xdrproc_t
) xdr_nlm_testargs
;
159 xdr_result
= (xdrproc_t
) xdr_nlm_res
;
160 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_granted_1_svc
;
164 xdr_argument
= (xdrproc_t
) xdr_nlm_testargs
;
165 xdr_result
= (xdrproc_t
) xdr_void
;
166 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_test_msg_1_svc
;
170 xdr_argument
= (xdrproc_t
) xdr_nlm_lockargs
;
171 xdr_result
= (xdrproc_t
) xdr_void
;
172 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_lock_msg_1_svc
;
176 xdr_argument
= (xdrproc_t
) xdr_nlm_cancargs
;
177 xdr_result
= (xdrproc_t
) xdr_void
;
178 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_cancel_msg_1_svc
;
182 xdr_argument
= (xdrproc_t
) xdr_nlm_unlockargs
;
183 xdr_result
= (xdrproc_t
) xdr_void
;
184 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_unlock_msg_1_svc
;
187 case NLM_GRANTED_MSG
:
188 xdr_argument
= (xdrproc_t
) xdr_nlm_testargs
;
189 xdr_result
= (xdrproc_t
) xdr_void
;
190 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_granted_msg_1_svc
;
194 xdr_argument
= (xdrproc_t
) xdr_nlm_testres
;
195 xdr_result
= (xdrproc_t
) xdr_void
;
196 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_test_res_1_svc
;
200 xdr_argument
= (xdrproc_t
) xdr_nlm_res
;
201 xdr_result
= (xdrproc_t
) xdr_void
;
202 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_lock_res_1_svc
;
206 xdr_argument
= (xdrproc_t
) xdr_nlm_res
;
207 xdr_result
= (xdrproc_t
) xdr_void
;
208 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_cancel_res_1_svc
;
212 xdr_argument
= (xdrproc_t
) xdr_nlm_res
;
213 xdr_result
= (xdrproc_t
) xdr_void
;
214 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_unlock_res_1_svc
;
217 case NLM_GRANTED_RES
:
218 xdr_argument
= (xdrproc_t
) xdr_nlm_res
;
219 xdr_result
= (xdrproc_t
) xdr_void
;
220 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_granted_res_1_svc
;
224 svcerr_noproc(rqstp
);
228 (void) memset((char *)&argument
, 0, sizeof (argument
));
229 if (!svc_getargs(rqstp
, xdr_argument
, (char *)(caddr_t
) &argument
)) {
230 svcerr_decode(rqstp
);
234 retval
= (bool_t
) (*local
)((char *)&argument
, (void *)&result
, rqstp
);
235 if (retval
> 0 && !svc_sendreply(rqstp
, xdr_result
, (char *)&result
)) {
236 svcerr_systemerr(rqstp
);
238 if (!svc_freeargs(rqstp
, xdr_argument
, (char *)(caddr_t
) &argument
)) {
239 printf("unable to free arguments");
243 if (!nlm_prog_1_freeresult(transp
, xdr_result
, (caddr_t
) &result
))
244 printf("unable to free results");
250 nlm_prog_3(struct svc_req
*rqstp
, SVCXPRT
*transp
)
253 nlm_shareargs nlm_share_3_arg
;
254 nlm_shareargs nlm_unshare_3_arg
;
255 nlm_lockargs nlm_nm_lock_3_arg
;
256 nlm_notify nlm_free_all_3_arg
;
259 nlm_shareres nlm_share_3_res
;
260 nlm_shareres nlm_unshare_3_res
;
261 nlm_res nlm_nm_lock_3_res
;
264 xdrproc_t xdr_argument
, xdr_result
;
265 bool_t (*local
)(char *, void *, struct svc_req
*);
267 switch (rqstp
->rq_proc
) {
269 (void) svc_sendreply(rqstp
,
270 (xdrproc_t
) xdr_void
, (char *)NULL
);
283 case NLM_GRANTED_MSG
:
288 case NLM_GRANTED_RES
:
289 nlm_prog_1(rqstp
, transp
);
293 xdr_argument
= (xdrproc_t
) xdr_nlm_shareargs
;
294 xdr_result
= (xdrproc_t
) xdr_nlm_shareres
;
295 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_share_3_svc
;
299 xdr_argument
= (xdrproc_t
) xdr_nlm_shareargs
;
300 xdr_result
= (xdrproc_t
) xdr_nlm_shareres
;
301 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_unshare_3_svc
;
305 xdr_argument
= (xdrproc_t
) xdr_nlm_lockargs
;
306 xdr_result
= (xdrproc_t
) xdr_nlm_res
;
307 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_nm_lock_3_svc
;
311 xdr_argument
= (xdrproc_t
) xdr_nlm_notify
;
312 xdr_result
= (xdrproc_t
) xdr_void
;
313 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm_free_all_3_svc
;
317 svcerr_noproc(rqstp
);
321 (void) memset((char *)&argument
, 0, sizeof (argument
));
322 if (!svc_getargs(rqstp
, xdr_argument
, (char *)(caddr_t
) &argument
)) {
323 svcerr_decode(rqstp
);
327 retval
= (bool_t
) (*local
)((char *)&argument
, (void *)&result
, rqstp
);
328 if (retval
> 0 && !svc_sendreply(rqstp
, xdr_result
, (char *)&result
)) {
329 svcerr_systemerr(rqstp
);
331 if (!svc_freeargs(rqstp
, xdr_argument
, (char *)(caddr_t
) &argument
)) {
332 printf("unable to free arguments");
336 if (!nlm_prog_3_freeresult(transp
, xdr_result
, (caddr_t
) &result
))
337 printf("unable to free results");
343 nlm_prog_4(struct svc_req
*rqstp
, SVCXPRT
*transp
)
346 nlm4_testargs nlm4_test_4_arg
;
347 nlm4_lockargs nlm4_lock_4_arg
;
348 nlm4_cancargs nlm4_cancel_4_arg
;
349 nlm4_unlockargs nlm4_unlock_4_arg
;
350 nlm4_testargs nlm4_granted_4_arg
;
351 nlm4_testargs nlm4_test_msg_4_arg
;
352 nlm4_lockargs nlm4_lock_msg_4_arg
;
353 nlm4_cancargs nlm4_cancel_msg_4_arg
;
354 nlm4_unlockargs nlm4_unlock_msg_4_arg
;
355 nlm4_testargs nlm4_granted_msg_4_arg
;
356 nlm4_testres nlm4_test_res_4_arg
;
357 nlm4_res nlm4_lock_res_4_arg
;
358 nlm4_res nlm4_cancel_res_4_arg
;
359 nlm4_res nlm4_unlock_res_4_arg
;
360 nlm4_res nlm4_granted_res_4_arg
;
361 nlm4_shareargs nlm4_share_4_arg
;
362 nlm4_shareargs nlm4_unshare_4_arg
;
363 nlm4_lockargs nlm4_nm_lock_4_arg
;
364 nlm4_notify nlm4_free_all_4_arg
;
367 nlm4_testres nlm4_test_4_res
;
368 nlm4_res nlm4_lock_4_res
;
369 nlm4_res nlm4_cancel_4_res
;
370 nlm4_res nlm4_unlock_4_res
;
371 nlm4_res nlm4_granted_4_res
;
372 nlm4_shareres nlm4_share_4_res
;
373 nlm4_shareres nlm4_unshare_4_res
;
374 nlm4_res nlm4_nm_lock_4_res
;
377 xdrproc_t xdr_argument
, xdr_result
;
378 bool_t (*local
)(char *, void *, struct svc_req
*);
380 switch (rqstp
->rq_proc
) {
382 (void) svc_sendreply(rqstp
,
383 (xdrproc_t
) xdr_void
, (char *)NULL
);
388 xdr_argument
= (xdrproc_t
) xdr_nlm4_testargs
;
389 xdr_result
= (xdrproc_t
) xdr_nlm4_testres
;
390 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_test_4_svc
;
394 xdr_argument
= (xdrproc_t
) xdr_nlm4_lockargs
;
395 xdr_result
= (xdrproc_t
) xdr_nlm4_res
;
396 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_lock_4_svc
;
400 xdr_argument
= (xdrproc_t
) xdr_nlm4_cancargs
;
401 xdr_result
= (xdrproc_t
) xdr_nlm4_res
;
402 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_cancel_4_svc
;
406 xdr_argument
= (xdrproc_t
) xdr_nlm4_unlockargs
;
407 xdr_result
= (xdrproc_t
) xdr_nlm4_res
;
408 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_unlock_4_svc
;
412 xdr_argument
= (xdrproc_t
) xdr_nlm4_testargs
;
413 xdr_result
= (xdrproc_t
) xdr_nlm4_res
;
414 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_granted_4_svc
;
418 xdr_argument
= (xdrproc_t
) xdr_nlm4_testargs
;
419 xdr_result
= (xdrproc_t
) xdr_void
;
420 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_test_msg_4_svc
;
424 xdr_argument
= (xdrproc_t
) xdr_nlm4_lockargs
;
425 xdr_result
= (xdrproc_t
) xdr_void
;
426 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_lock_msg_4_svc
;
429 case NLM4_CANCEL_MSG
:
430 xdr_argument
= (xdrproc_t
) xdr_nlm4_cancargs
;
431 xdr_result
= (xdrproc_t
) xdr_void
;
432 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_cancel_msg_4_svc
;
435 case NLM4_UNLOCK_MSG
:
436 xdr_argument
= (xdrproc_t
) xdr_nlm4_unlockargs
;
437 xdr_result
= (xdrproc_t
) xdr_void
;
438 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_unlock_msg_4_svc
;
441 case NLM4_GRANTED_MSG
:
442 xdr_argument
= (xdrproc_t
) xdr_nlm4_testargs
;
443 xdr_result
= (xdrproc_t
) xdr_void
;
444 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_granted_msg_4_svc
;
448 xdr_argument
= (xdrproc_t
) xdr_nlm4_testres
;
449 xdr_result
= (xdrproc_t
) xdr_void
;
450 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_test_res_4_svc
;
454 xdr_argument
= (xdrproc_t
) xdr_nlm4_res
;
455 xdr_result
= (xdrproc_t
) xdr_void
;
456 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_lock_res_4_svc
;
459 case NLM4_CANCEL_RES
:
460 xdr_argument
= (xdrproc_t
) xdr_nlm4_res
;
461 xdr_result
= (xdrproc_t
) xdr_void
;
462 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_cancel_res_4_svc
;
465 case NLM4_UNLOCK_RES
:
466 xdr_argument
= (xdrproc_t
) xdr_nlm4_res
;
467 xdr_result
= (xdrproc_t
) xdr_void
;
468 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_unlock_res_4_svc
;
471 case NLM4_GRANTED_RES
:
472 xdr_argument
= (xdrproc_t
) xdr_nlm4_res
;
473 xdr_result
= (xdrproc_t
) xdr_void
;
474 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_granted_res_4_svc
;
478 xdr_argument
= (xdrproc_t
) xdr_nlm4_shareargs
;
479 xdr_result
= (xdrproc_t
) xdr_nlm4_shareres
;
480 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_share_4_svc
;
484 xdr_argument
= (xdrproc_t
) xdr_nlm4_shareargs
;
485 xdr_result
= (xdrproc_t
) xdr_nlm4_shareres
;
486 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_unshare_4_svc
;
490 xdr_argument
= (xdrproc_t
) xdr_nlm4_lockargs
;
491 xdr_result
= (xdrproc_t
) xdr_nlm4_res
;
492 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_nm_lock_4_svc
;
496 xdr_argument
= (xdrproc_t
) xdr_nlm4_notify
;
497 xdr_result
= (xdrproc_t
) xdr_void
;
498 local
= (bool_t (*) (char *, void *, struct svc_req
*))nlm4_free_all_4_svc
;
502 svcerr_noproc(rqstp
);
506 (void) memset((char *)&argument
, 0, sizeof (argument
));
507 if (!svc_getargs(rqstp
, xdr_argument
, (char *)(caddr_t
) &argument
)) {
508 svcerr_decode(rqstp
);
512 retval
= (bool_t
) (*local
)((char *)&argument
, (void *)&result
, rqstp
);
513 if (retval
> 0 && !svc_sendreply(rqstp
, xdr_result
, (char *)&result
)) {
514 svcerr_systemerr(rqstp
);
516 if (!svc_freeargs(rqstp
, xdr_argument
, (char *)(caddr_t
) &argument
)) {
517 printf("unable to free arguments");
521 if (!nlm_prog_4_freeresult(transp
, xdr_result
, (caddr_t
) &result
))
522 printf("unable to free results");