|
| 1 | +/* |
| 2 | + * Please do not edit this file. |
| 3 | + * It was generated using rpcgen. |
| 4 | + */ |
| 5 | + |
| 6 | +#include "dir.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 | +dirprog_1(struct svc_req *rqstp, register SVCXPRT *transp) |
| 21 | +{ |
| 22 | +union { |
| 23 | +nametype readdir_1_arg; |
| 24 | +} argument; |
| 25 | +char *result; |
| 26 | +xdrproc_t _xdr_argument, _xdr_result; |
| 27 | +char *(*local)(char *, struct svc_req *); |
| 28 | + |
| 29 | +switch (rqstp->rq_proc) { |
| 30 | +case NULLPROC: |
| 31 | +(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL); |
| 32 | +return; |
| 33 | + |
| 34 | +case READDIR: |
| 35 | +_xdr_argument = (xdrproc_t) xdr_nametype; |
| 36 | +_xdr_result = (xdrproc_t) xdr_readdir_res; |
| 37 | +local = (char *(*)(char *, struct svc_req *)) readdir_1_svc; |
| 38 | +break; |
| 39 | + |
| 40 | +default: |
| 41 | +svcerr_noproc (transp); |
| 42 | +return; |
| 43 | +} |
| 44 | +memset ((char *)&argument, 0, sizeof (argument)); |
| 45 | +if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { |
| 46 | +svcerr_decode (transp); |
| 47 | +return; |
| 48 | +} |
| 49 | +result = (*local)((char *)&argument, rqstp); |
| 50 | +if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) { |
| 51 | +svcerr_systemerr (transp); |
| 52 | +} |
| 53 | +if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { |
| 54 | +fprintf (stderr, "%s", "unable to free arguments"); |
| 55 | +exit (1); |
| 56 | +} |
| 57 | +return; |
| 58 | +} |
| 59 | + |
| 60 | +int |
| 61 | +main (int argc, char **argv) |
| 62 | +{ |
| 63 | +register SVCXPRT *transp; |
| 64 | + |
| 65 | +pmap_unset (DIRPROG, DIRVERS); |
| 66 | + |
| 67 | +transp = svcudp_create(RPC_ANYSOCK); |
| 68 | +if (transp == NULL) { |
| 69 | +fprintf (stderr, "%s", "cannot create udp service."); |
| 70 | +exit(1); |
| 71 | +} |
| 72 | +if (!svc_register(transp, DIRPROG, DIRVERS, dirprog_1, IPPROTO_UDP)) { |
| 73 | +fprintf (stderr, "%s", "unable to register (DIRPROG, DIRVERS, udp)."); |
| 74 | +exit(1); |
| 75 | +} |
| 76 | + |
| 77 | +transp = svctcp_create(RPC_ANYSOCK, 0, 0); |
| 78 | +if (transp == NULL) { |
| 79 | +fprintf (stderr, "%s", "cannot create tcp service."); |
| 80 | +exit(1); |
| 81 | +} |
| 82 | +if (!svc_register(transp, DIRPROG, DIRVERS, dirprog_1, IPPROTO_TCP)) { |
| 83 | +fprintf (stderr, "%s", "unable to register (DIRPROG, DIRVERS, tcp)."); |
| 84 | +exit(1); |
| 85 | +} |
| 86 | + |
| 87 | +svc_run (); |
| 88 | +fprintf (stderr, "%s", "svc_run returned"); |
| 89 | +exit (1); |
| 90 | +/* NOTREACHED */ |
| 91 | +} |
0 commit comments