BSD 4_4 release
[unix-history] / usr / src / usr.sbin / amd / rpcx / amq_svc.c
CommitLineData
d848bc15 1/*
d848bc15
KM
2 * Copyright (c) 1990 Jan-Simon Pendry
3 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
ad787160
C
4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. All rights reserved.
d848bc15
KM
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Jan-Simon Pendry at Imperial College, London.
9 *
ad787160
C
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
d848bc15 25 *
ad787160
C
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)amq_svc.c 8.1 (Berkeley) 6/6/93
8d2991d5 39 *
332f0791 40 * $Id: amq_svc.c,v 5.2.2.1 1992/02/09 15:09:26 jsp beta $
8d2991d5 41 *
d848bc15
KM
42 */
43
44#include "am.h"
45#include "amq.h"
46extern bool_t xdr_amq_mount_info_qelem();
47
48void
49amq_program_1(rqstp, transp)
50 struct svc_req *rqstp;
51 SVCXPRT *transp;
52{
53 union {
54 amq_string amqproc_mnttree_1_arg;
55 amq_string amqproc_umnt_1_arg;
56 amq_setopt amqproc_setopt_1_arg;
2f619045 57 amq_string amqproc_mount_1_arg;
d848bc15
KM
58 } argument;
59 char *result;
60 bool_t (*xdr_argument)(), (*xdr_result)();
61 char *(*local)();
62
63 switch (rqstp->rq_proc) {
64 case AMQPROC_NULL:
65 xdr_argument = xdr_void;
66 xdr_result = xdr_void;
67 local = (char *(*)()) amqproc_null_1;
68 break;
69
70 case AMQPROC_MNTTREE:
71 xdr_argument = xdr_amq_string;
72 xdr_result = xdr_amq_mount_tree_p;
73 local = (char *(*)()) amqproc_mnttree_1;
74 break;
75
76 case AMQPROC_UMNT:
77 xdr_argument = xdr_amq_string;
78 xdr_result = xdr_void;
79 local = (char *(*)()) amqproc_umnt_1;
80 break;
81
82 case AMQPROC_STATS:
83 xdr_argument = xdr_void;
84 xdr_result = xdr_amq_mount_stats;
85 local = (char *(*)()) amqproc_stats_1;
86 break;
87
88 case AMQPROC_EXPORT:
89 xdr_argument = xdr_void;
90 xdr_result = xdr_amq_mount_tree_list;
91 local = (char *(*)()) amqproc_export_1;
92 break;
93
94 case AMQPROC_SETOPT:
95 xdr_argument = xdr_amq_setopt;
96 xdr_result = xdr_int;
97 local = (char *(*)()) amqproc_setopt_1;
98 break;
99
100 case AMQPROC_GETMNTFS:
101 xdr_argument = xdr_void;
102 xdr_result = xdr_amq_mount_info_qelem;
103 local = (char *(*)()) amqproc_getmntfs_1;
104 break;
105
2f619045
JSP
106 case AMQPROC_MOUNT:
107 xdr_argument = xdr_amq_string;
108 xdr_result = xdr_int;
109 local = (char *(*)()) amqproc_mount_1;
110 break;
111
112 case AMQPROC_GETVERS:
113 xdr_argument = xdr_void;
114 xdr_result = xdr_amq_string;
115 local = (char *(*)()) amqproc_getvers_1;
116 break;
117
d848bc15
KM
118 default:
119 svcerr_noproc(transp);
120 return;
121 }
122 bzero((char *)&argument, sizeof(argument));
123 if (!svc_getargs(transp, xdr_argument, &argument)) {
124 svcerr_decode(transp);
125 return;
126 }
127 result = (*local)(&argument, rqstp);
128 if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
129 svcerr_systemerr(transp);
130 }
131 if (!svc_freeargs(transp, xdr_argument, &argument)) {
132 plog(XLOG_FATAL, "unable to free rpc arguments in amqprog_1");
133 going_down(1);
134 }
135}
136