Subversion Repositories f9daq

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
145 f9daq 1
/*
2
 * Please do not edit this file.
3
 * It was generated using rpcgen.
4
 */
5
 
6
#include "vxi11.h"
7
#include <stdio.h>
8
#include <stdlib.h>
9
#include <rpc/pmap_clnt.h>
10
#include <string.h>
11
#include <memory.h>
12
#include <sys/socket.h>
13
#include <netinet/in.h>
14
 
15
#ifndef SIG_PF
16
#define SIG_PF void(*)(int)
17
#endif
18
 
19
static void
20
device_async_1(struct svc_req *rqstp, register SVCXPRT *transp)
21
{
22
        union {
23
                Device_Link device_abort_1_arg;
24
        } argument;
25
        union {
26
                Device_Error device_abort_1_res;
27
        } result;
28
        bool_t retval;
29
        xdrproc_t _xdr_argument, _xdr_result;
30
        bool_t (*local)(char *, void *, struct svc_req *);
31
 
32
        switch (rqstp->rq_proc) {
33
        case NULLPROC:
34
                (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
35
                return;
36
 
37
        case device_abort:
38
                _xdr_argument = (xdrproc_t) xdr_Device_Link;
39
                _xdr_result = (xdrproc_t) xdr_Device_Error;
40
                local = (bool_t (*) (char *, void *,  struct svc_req *))device_abort_1_svc;
41
                break;
42
 
43
        default:
44
                svcerr_noproc (transp);
45
                return;
46
        }
47
        memset ((char *)&argument, 0, sizeof (argument));
48
        if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
49
                svcerr_decode (transp);
50
                return;
51
        }
52
        retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
53
        if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
54
                svcerr_systemerr (transp);
55
        }
56
        if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
57
                fprintf (stderr, "%s", "unable to free arguments");
58
                exit (1);
59
        }
60
        if (!device_async_1_freeresult (transp, _xdr_result, (caddr_t) &result))
61
                fprintf (stderr, "%s", "unable to free results");
62
 
63
        return;
64
}
65
 
66
static void
67
device_core_1(struct svc_req *rqstp, register SVCXPRT *transp)
68
{
69
        union {
70
                Create_LinkParms create_link_1_arg;
71
                Device_WriteParms device_write_1_arg;
72
                Device_ReadParms device_read_1_arg;
73
                Device_GenericParms device_readstb_1_arg;
74
                Device_GenericParms device_trigger_1_arg;
75
                Device_GenericParms device_clear_1_arg;
76
                Device_GenericParms device_remote_1_arg;
77
                Device_GenericParms device_local_1_arg;
78
                Device_LockParms device_lock_1_arg;
79
                Device_Link device_unlock_1_arg;
80
                Device_EnableSrqParms device_enable_srq_1_arg;
81
                Device_DocmdParms device_docmd_1_arg;
82
                Device_Link destroy_link_1_arg;
83
                Device_RemoteFunc create_intr_chan_1_arg;
84
        } argument;
85
        union {
86
                Create_LinkResp create_link_1_res;
87
                Device_WriteResp device_write_1_res;
88
                Device_ReadResp device_read_1_res;
89
                Device_ReadStbResp device_readstb_1_res;
90
                Device_Error device_trigger_1_res;
91
                Device_Error device_clear_1_res;
92
                Device_Error device_remote_1_res;
93
                Device_Error device_local_1_res;
94
                Device_Error device_lock_1_res;
95
                Device_Error device_unlock_1_res;
96
                Device_Error device_enable_srq_1_res;
97
                Device_DocmdResp device_docmd_1_res;
98
                Device_Error destroy_link_1_res;
99
                Device_Error create_intr_chan_1_res;
100
                Device_Error destroy_intr_chan_1_res;
101
        } result;
102
        bool_t retval;
103
        xdrproc_t _xdr_argument, _xdr_result;
104
        bool_t (*local)(char *, void *, struct svc_req *);
105
 
106
        switch (rqstp->rq_proc) {
107
        case NULLPROC:
108
                (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
109
                return;
110
 
111
        case create_link:
112
                _xdr_argument = (xdrproc_t) xdr_Create_LinkParms;
113
                _xdr_result = (xdrproc_t) xdr_Create_LinkResp;
114
                local = (bool_t (*) (char *, void *,  struct svc_req *))create_link_1_svc;
115
                break;
116
 
117
        case device_write:
118
                _xdr_argument = (xdrproc_t) xdr_Device_WriteParms;
119
                _xdr_result = (xdrproc_t) xdr_Device_WriteResp;
120
                local = (bool_t (*) (char *, void *,  struct svc_req *))device_write_1_svc;
121
                break;
122
 
123
        case device_read:
124
                _xdr_argument = (xdrproc_t) xdr_Device_ReadParms;
125
                _xdr_result = (xdrproc_t) xdr_Device_ReadResp;
126
                local = (bool_t (*) (char *, void *,  struct svc_req *))device_read_1_svc;
127
                break;
128
 
129
        case device_readstb:
130
                _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
131
                _xdr_result = (xdrproc_t) xdr_Device_ReadStbResp;
132
                local = (bool_t (*) (char *, void *,  struct svc_req *))device_readstb_1_svc;
133
                break;
134
 
135
        case device_trigger:
136
                _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
137
                _xdr_result = (xdrproc_t) xdr_Device_Error;
138
                local = (bool_t (*) (char *, void *,  struct svc_req *))device_trigger_1_svc;
139
                break;
140
 
141
        case device_clear:
142
                _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
143
                _xdr_result = (xdrproc_t) xdr_Device_Error;
144
                local = (bool_t (*) (char *, void *,  struct svc_req *))device_clear_1_svc;
145
                break;
146
 
147
        case device_remote:
148
                _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
149
                _xdr_result = (xdrproc_t) xdr_Device_Error;
150
                local = (bool_t (*) (char *, void *,  struct svc_req *))device_remote_1_svc;
151
                break;
152
 
153
        case device_local:
154
                _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
155
                _xdr_result = (xdrproc_t) xdr_Device_Error;
156
                local = (bool_t (*) (char *, void *,  struct svc_req *))device_local_1_svc;
157
                break;
158
 
159
        case device_lock:
160
                _xdr_argument = (xdrproc_t) xdr_Device_LockParms;
161
                _xdr_result = (xdrproc_t) xdr_Device_Error;
162
                local = (bool_t (*) (char *, void *,  struct svc_req *))device_lock_1_svc;
163
                break;
164
 
165
        case device_unlock:
166
                _xdr_argument = (xdrproc_t) xdr_Device_Link;
167
                _xdr_result = (xdrproc_t) xdr_Device_Error;
168
                local = (bool_t (*) (char *, void *,  struct svc_req *))device_unlock_1_svc;
169
                break;
170
 
171
        case device_enable_srq:
172
                _xdr_argument = (xdrproc_t) xdr_Device_EnableSrqParms;
173
                _xdr_result = (xdrproc_t) xdr_Device_Error;
174
                local = (bool_t (*) (char *, void *,  struct svc_req *))device_enable_srq_1_svc;
175
                break;
176
 
177
        case device_docmd:
178
                _xdr_argument = (xdrproc_t) xdr_Device_DocmdParms;
179
                _xdr_result = (xdrproc_t) xdr_Device_DocmdResp;
180
                local = (bool_t (*) (char *, void *,  struct svc_req *))device_docmd_1_svc;
181
                break;
182
 
183
        case destroy_link:
184
                _xdr_argument = (xdrproc_t) xdr_Device_Link;
185
                _xdr_result = (xdrproc_t) xdr_Device_Error;
186
                local = (bool_t (*) (char *, void *,  struct svc_req *))destroy_link_1_svc;
187
                break;
188
 
189
        case create_intr_chan:
190
                _xdr_argument = (xdrproc_t) xdr_Device_RemoteFunc;
191
                _xdr_result = (xdrproc_t) xdr_Device_Error;
192
                local = (bool_t (*) (char *, void *,  struct svc_req *))create_intr_chan_1_svc;
193
                break;
194
 
195
        case destroy_intr_chan:
196
                _xdr_argument = (xdrproc_t) xdr_void;
197
                _xdr_result = (xdrproc_t) xdr_Device_Error;
198
                local = (bool_t (*) (char *, void *,  struct svc_req *))destroy_intr_chan_1_svc;
199
                break;
200
 
201
        default:
202
                svcerr_noproc (transp);
203
                return;
204
        }
205
        memset ((char *)&argument, 0, sizeof (argument));
206
        if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
207
                svcerr_decode (transp);
208
                return;
209
        }
210
        retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
211
        if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
212
                svcerr_systemerr (transp);
213
        }
214
        if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
215
                fprintf (stderr, "%s", "unable to free arguments");
216
                exit (1);
217
        }
218
        if (!device_core_1_freeresult (transp, _xdr_result, (caddr_t) &result))
219
                fprintf (stderr, "%s", "unable to free results");
220
 
221
        return;
222
}
223
 
224
static void
225
device_intr_1(struct svc_req *rqstp, register SVCXPRT *transp)
226
{
227
        union {
228
                Device_SrqParms device_intr_srq_1_arg;
229
        } argument;
230
        union {
231
        } result;
232
        bool_t retval;
233
        xdrproc_t _xdr_argument, _xdr_result;
234
        bool_t (*local)(char *, void *, struct svc_req *);
235
 
236
        switch (rqstp->rq_proc) {
237
        case NULLPROC:
238
                (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
239
                return;
240
 
241
        case device_intr_srq:
242
                _xdr_argument = (xdrproc_t) xdr_Device_SrqParms;
243
                _xdr_result = (xdrproc_t) xdr_void;
244
                local = (bool_t (*) (char *, void *,  struct svc_req *))device_intr_srq_1_svc;
245
                break;
246
 
247
        default:
248
                svcerr_noproc (transp);
249
                return;
250
        }
251
        memset ((char *)&argument, 0, sizeof (argument));
252
        if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
253
                svcerr_decode (transp);
254
                return;
255
        }
256
        retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
257
        if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
258
                svcerr_systemerr (transp);
259
        }
260
        if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
261
                fprintf (stderr, "%s", "unable to free arguments");
262
                exit (1);
263
        }
264
        if (!device_intr_1_freeresult (transp, _xdr_result, (caddr_t) &result))
265
                fprintf (stderr, "%s", "unable to free results");
266
 
267
        return;
268
}
269
 
270
int
271
main (int argc, char **argv)
272
{
273
        register SVCXPRT *transp;
274
 
275
        pmap_unset (DEVICE_ASYNC, DEVICE_ASYNC_VERSION);
276
        pmap_unset (DEVICE_CORE, DEVICE_CORE_VERSION);
277
        pmap_unset (DEVICE_INTR, DEVICE_INTR_VERSION);
278
 
279
        transp = svcudp_create(RPC_ANYSOCK);
280
        if (transp == NULL) {
281
                fprintf (stderr, "%s", "cannot create udp service.");
282
                exit(1);
283
        }
284
        if (!svc_register(transp, DEVICE_ASYNC, DEVICE_ASYNC_VERSION, device_async_1, IPPROTO_UDP)) {
285
                fprintf (stderr, "%s", "unable to register (DEVICE_ASYNC, DEVICE_ASYNC_VERSION, udp).");
286
                exit(1);
287
        }
288
        if (!svc_register(transp, DEVICE_CORE, DEVICE_CORE_VERSION, device_core_1, IPPROTO_UDP)) {
289
                fprintf (stderr, "%s", "unable to register (DEVICE_CORE, DEVICE_CORE_VERSION, udp).");
290
                exit(1);
291
        }
292
        if (!svc_register(transp, DEVICE_INTR, DEVICE_INTR_VERSION, device_intr_1, IPPROTO_UDP)) {
293
                fprintf (stderr, "%s", "unable to register (DEVICE_INTR, DEVICE_INTR_VERSION, udp).");
294
                exit(1);
295
        }
296
 
297
        transp = svctcp_create(RPC_ANYSOCK, 0, 0);
298
        if (transp == NULL) {
299
                fprintf (stderr, "%s", "cannot create tcp service.");
300
                exit(1);
301
        }
302
        if (!svc_register(transp, DEVICE_ASYNC, DEVICE_ASYNC_VERSION, device_async_1, IPPROTO_TCP)) {
303
                fprintf (stderr, "%s", "unable to register (DEVICE_ASYNC, DEVICE_ASYNC_VERSION, tcp).");
304
                exit(1);
305
        }
306
        if (!svc_register(transp, DEVICE_CORE, DEVICE_CORE_VERSION, device_core_1, IPPROTO_TCP)) {
307
                fprintf (stderr, "%s", "unable to register (DEVICE_CORE, DEVICE_CORE_VERSION, tcp).");
308
                exit(1);
309
        }
310
        if (!svc_register(transp, DEVICE_INTR, DEVICE_INTR_VERSION, device_intr_1, IPPROTO_TCP)) {
311
                fprintf (stderr, "%s", "unable to register (DEVICE_INTR, DEVICE_INTR_VERSION, tcp).");
312
                exit(1);
313
        }
314
 
315
        svc_run ();
316
        fprintf (stderr, "%s", "svc_run returned");
317
        exit (1);
318
        /* NOTREACHED */
319
}