source: tmcsimulator/branches/fep_client_cpp/fep_svc.c @ 69

Revision 69, 8.2 KB checked in by jtorres, 9 years ago (diff)

checking in

Line 
1/*
2 * Please do not edit this file.
3 * It was generated using rpcgen.
4 */
5
6#include "fep.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/* RPC SVC test */
19
20static void
21fep_program_32(struct svc_req *rqstp, register SVCXPRT *transp)
22{
23        union {
24                int fep_getlineinfo_32_arg;
25                int fep_getlineinfovalue_32_arg;
26                fep_lineinfo fep_sendlineinfo_32_arg;
27                fep_std_time fep_settime_32_arg;
28                int fep_advancetime_32_arg;
29                int fep_getschedule_32_arg;
30                int fep_getschedulevalue_32_arg;
31                fep_schedule fep_sendschedule_32_arg;
32                fep_setschedule fep_setlinemgr_schedule_32_arg;
33                int fep_free_schedule_32_arg;
34                fep_lineop fep_idleline_32_arg;
35                fep_lineop fep_modemsignals_32_arg;
36                fep_reply_request fep_getreply_32_arg;
37                fep_schedule fep_updateschedule_32_arg;
38                int fep_getreport_32_arg;
39                int fep_getreportvalue_32_arg;
40                fep_report fep_sendreport_32_arg;
41                fep_reply fep_reply_xfer_32_arg;
42                int fep_set_debug_32_arg;
43                fep_setschedule fep_setlmdebug_32_arg;
44                int fep_initsystem_32_arg;
45                init_form fep_initrealix_32_arg;
46        } argument;
47        char *result;
48        xdrproc_t _xdr_argument, _xdr_result;
49        char *(*local)(char *, struct svc_req *);
50
51        switch (rqstp->rq_proc) {
52        case NULLPROC:
53                (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
54                return;
55
56        case FEP_GETLINEINFOCOUNT:
57                _xdr_argument = (xdrproc_t) xdr_void;
58                _xdr_result = (xdrproc_t) xdr_int;
59                local = (char *(*)(char *, struct svc_req *)) fep_getlineinfocount_32_svc;
60                break;
61
62        case FEP_GETLINEINFO:
63                _xdr_argument = (xdrproc_t) xdr_int;
64                _xdr_result = (xdrproc_t) xdr_lineinfo_ret;
65                local = (char *(*)(char *, struct svc_req *)) fep_getlineinfo_32_svc;
66                break;
67
68        case FEP_GETLINEINFOVALUE:
69                _xdr_argument = (xdrproc_t) xdr_int;
70                _xdr_result = (xdrproc_t) xdr_lineinfo_ret;
71                local = (char *(*)(char *, struct svc_req *)) fep_getlineinfovalue_32_svc;
72                break;
73
74        case FEP_SENDLINEINFO:
75                _xdr_argument = (xdrproc_t) xdr_fep_lineinfo;
76                _xdr_result = (xdrproc_t) xdr_lineinfo_ret;
77                local = (char *(*)(char *, struct svc_req *)) fep_sendlineinfo_32_svc;
78                break;
79
80        case FEP_GETTIME:
81                _xdr_argument = (xdrproc_t) xdr_void;
82                _xdr_result = (xdrproc_t) xdr_std_time_ret;
83                local = (char *(*)(char *, struct svc_req *)) fep_gettime_32_svc;
84                break;
85
86        case FEP_SETTIME:
87                _xdr_argument = (xdrproc_t) xdr_fep_std_time;
88                _xdr_result = (xdrproc_t) xdr_std_time_ret;
89                local = (char *(*)(char *, struct svc_req *)) fep_settime_32_svc;
90                break;
91
92        case FEP_ADVANCETIME:
93                _xdr_argument = (xdrproc_t) xdr_int;
94                _xdr_result = (xdrproc_t) xdr_std_time_ret;
95                local = (char *(*)(char *, struct svc_req *)) fep_advancetime_32_svc;
96                break;
97
98        case FEP_GETSCHEDULECOUNT:
99                _xdr_argument = (xdrproc_t) xdr_void;
100                _xdr_result = (xdrproc_t) xdr_int;
101                local = (char *(*)(char *, struct svc_req *)) fep_getschedulecount_32_svc;
102                break;
103
104        case FEP_GETSCHEDULE:
105                _xdr_argument = (xdrproc_t) xdr_int;
106                _xdr_result = (xdrproc_t) xdr_schedule_ret;
107                local = (char *(*)(char *, struct svc_req *)) fep_getschedule_32_svc;
108                break;
109
110        case FEP_GETSCHEDULEVALUE:
111                _xdr_argument = (xdrproc_t) xdr_int;
112                _xdr_result = (xdrproc_t) xdr_schedule_ret;
113                local = (char *(*)(char *, struct svc_req *)) fep_getschedulevalue_32_svc;
114                break;
115
116        case FEP_SENDSCHEDULE:
117                _xdr_argument = (xdrproc_t) xdr_fep_schedule;
118                _xdr_result = (xdrproc_t) xdr_schedule_ret;
119                local = (char *(*)(char *, struct svc_req *)) fep_sendschedule_32_svc;
120                break;
121
122        case FEP_SETLINEMGR_SCHEDULE:
123                _xdr_argument = (xdrproc_t) xdr_fep_setschedule;
124                _xdr_result = (xdrproc_t) xdr_errorstatus;
125                local = (char *(*)(char *, struct svc_req *)) fep_setlinemgr_schedule_32_svc;
126                break;
127
128        case FEP_FREE_SCHEDULE:
129                _xdr_argument = (xdrproc_t) xdr_int;
130                _xdr_result = (xdrproc_t) xdr_errorstatus;
131                local = (char *(*)(char *, struct svc_req *)) fep_free_schedule_32_svc;
132                break;
133
134        case FEP_IDLELINE:
135                _xdr_argument = (xdrproc_t) xdr_fep_lineop;
136                _xdr_result = (xdrproc_t) xdr_errorstatus;
137                local = (char *(*)(char *, struct svc_req *)) fep_idleline_32_svc;
138                break;
139
140        case FEP_MODEMSIGNALS:
141                _xdr_argument = (xdrproc_t) xdr_fep_lineop;
142                _xdr_result = (xdrproc_t) xdr_errorstatus;
143                local = (char *(*)(char *, struct svc_req *)) fep_modemsignals_32_svc;
144                break;
145
146        case FEP_GETREPLY:
147                _xdr_argument = (xdrproc_t) xdr_fep_reply_request;
148                _xdr_result = (xdrproc_t) xdr_reply_ret;
149                local = (char *(*)(char *, struct svc_req *)) fep_getreply_32_svc;
150                break;
151
152        case FEP_CLEARREPLY:
153                _xdr_argument = (xdrproc_t) xdr_void;
154                _xdr_result = (xdrproc_t) xdr_errorstatus;
155                local = (char *(*)(char *, struct svc_req *)) fep_clearreply_32_svc;
156                break;
157
158        case FEP_UPDATESCHEDULE:
159                _xdr_argument = (xdrproc_t) xdr_fep_schedule;
160                _xdr_result = (xdrproc_t) xdr_schedule_ret;
161                local = (char *(*)(char *, struct svc_req *)) fep_updateschedule_32_svc;
162                break;
163
164        case FEP_GETREPORTCOUNT:
165                _xdr_argument = (xdrproc_t) xdr_void;
166                _xdr_result = (xdrproc_t) xdr_int;
167                local = (char *(*)(char *, struct svc_req *)) fep_getreportcount_32_svc;
168                break;
169
170        case FEP_GETREPORT:
171                _xdr_argument = (xdrproc_t) xdr_int;
172                _xdr_result = (xdrproc_t) xdr_report_ret;
173                local = (char *(*)(char *, struct svc_req *)) fep_getreport_32_svc;
174                break;
175
176        case FEP_GETREPORTVALUE:
177                _xdr_argument = (xdrproc_t) xdr_int;
178                _xdr_result = (xdrproc_t) xdr_report_ret;
179                local = (char *(*)(char *, struct svc_req *)) fep_getreportvalue_32_svc;
180                break;
181
182        case FEP_SENDREPORT:
183                _xdr_argument = (xdrproc_t) xdr_fep_report;
184                _xdr_result = (xdrproc_t) xdr_report_ret;
185                local = (char *(*)(char *, struct svc_req *)) fep_sendreport_32_svc;
186                break;
187
188        case FEP_REPLY_XFER:
189                _xdr_argument = (xdrproc_t) xdr_fep_reply;
190                _xdr_result = (xdrproc_t) xdr_void;
191                local = (char *(*)(char *, struct svc_req *)) fep_reply_xfer_32_svc;
192                break;
193
194        case FEP_SET_DEBUG:
195                _xdr_argument = (xdrproc_t) xdr_int;
196                _xdr_result = (xdrproc_t) xdr_errorstatus;
197                local = (char *(*)(char *, struct svc_req *)) fep_set_debug_32_svc;
198                break;
199
200        case FEP_GET_STACK_LEFT:
201                _xdr_argument = (xdrproc_t) xdr_void;
202                _xdr_result = (xdrproc_t) xdr_int;
203                local = (char *(*)(char *, struct svc_req *)) fep_get_stack_left_32_svc;
204                break;
205
206        case FEP_SETLMDEBUG:
207                _xdr_argument = (xdrproc_t) xdr_fep_setschedule;
208                _xdr_result = (xdrproc_t) xdr_errorstatus;
209                local = (char *(*)(char *, struct svc_req *)) fep_setlmdebug_32_svc;
210                break;
211
212        case FEP_SHUTDOWN:
213                _xdr_argument = (xdrproc_t) xdr_void;
214                _xdr_result = (xdrproc_t) xdr_errorstatus;
215                local = (char *(*)(char *, struct svc_req *)) fep_shutdown_32_svc;
216                break;
217
218        case FEP_INITSYSTEM:
219                _xdr_argument = (xdrproc_t) xdr_int;
220                _xdr_result = (xdrproc_t) xdr_int;
221                local = (char *(*)(char *, struct svc_req *)) fep_initsystem_32_svc;
222                break;
223
224        case FEP_INITREALIX:
225                _xdr_argument = (xdrproc_t) xdr_init_form;
226                _xdr_result = (xdrproc_t) xdr_int;
227                local = (char *(*)(char *, struct svc_req *)) fep_initrealix_32_svc;
228                break;
229
230        default:
231                svcerr_noproc (transp);
232                return;
233        }
234        memset ((char *)&argument, 0, sizeof (argument));
235        if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
236                svcerr_decode (transp);
237                return;
238        }
239        result = (*local)((char *)&argument, rqstp);
240        if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
241                svcerr_systemerr (transp);
242        }
243        if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
244                fprintf (stderr, "%s", "unable to free arguments");
245                exit (1);
246        }
247        return;
248}
249
250int main (int argc, char **argv)
251{
252        register SVCXPRT *transp;
253
254        pmap_unset (FEP_PROGRAM, FEP_VERSION);
255
256        transp = svcudp_create(RPC_ANYSOCK);
257        if (transp == NULL) {
258                fprintf (stderr, "%s", "cannot create udp service.");
259                exit(1);
260        }
261        if (!svc_register(transp, FEP_PROGRAM, FEP_VERSION, fep_program_32, IPPROTO_UDP)) {
262                fprintf (stderr, "%s", "unable to register (FEP_PROGRAM, FEP_VERSION, udp).");
263                exit(1);
264        }
265
266        transp = svctcp_create(RPC_ANYSOCK, 0, 0);
267        if (transp == NULL) {
268                fprintf (stderr, "%s", "cannot create tcp service.");
269                exit(1);
270        }
271        if (!svc_register(transp, FEP_PROGRAM, FEP_VERSION, fep_program_32, IPPROTO_TCP)) {
272                fprintf (stderr, "%s", "unable to register (FEP_PROGRAM, FEP_VERSION, tcp).");
273                exit(1);
274        }
275
276        svc_run ();
277        fprintf (stderr, "%s", "svc_run returned");
278        exit (1);
279        /* NOTREACHED */
280}
Note: See TracBrowser for help on using the repository browser.