1 /* 2 * Please do not edit this file. 3 * It was generated using rpcgen. 4 */ 5 6 #include "amq.h" 7 #include "am.h" 8 #include <arpa/inet.h> 9 #include <unistd.h> 10 #include <stdio.h> 11 #include <stdlib.h>/* getenv, exit */ 12 #include <rpc/pmap_clnt.h> /* for pmap_unset */ 13 #include <string.h> /* strcmp */ 14 #include <netdb.h> 15 #include <signal.h> 16 #include <sys/ttycom.h>/* TIOCNOTTY */ 17 #ifdef __cplusplus 18 #include <sysent.h> /* getdtablesize, open */ 19 #endif /* __cplusplus */ 20 #include <memory.h> 21 #include <sys/socket.h> 22 #include <netinet/in.h> 23 #include <syslog.h> 24 #include <errno.h> 25 26 #ifdef __STDC__ 27 #define SIG_PF void(*)(int) 28 #endif 29 30 #ifdef DEBUG 31 #define RPC_SVC_FG 32 #endif 33 34 #define _RPCSVC_CLOSEDOWN 120 35 extern int _rpcpmstart; /* Started by a port monitor ? */ 36 extern int _rpcfdtype; /* Whether Stream or Datagram ? */ 37 38 39 void amq_program_57(struct svc_req *rqstp, SVCXPRT *transp); 40 41 void 42 amq_program_57(struct svc_req *rqstp, SVCXPRT *transp) 43 { 44 union { 45 amq_string amqproc_mnttree_57_arg; 46 amq_string amqproc_umnt_57_arg; 47 amq_setopt amqproc_setopt_57_arg; 48 } argument; 49 char *result; 50 xdrproc_t xdr_argument, xdr_result; 51 char *(*local)(char *, struct svc_req *); 52 extern SVCXPRT *lamqp; 53 54 if (transp != lamqp) { 55 struct sockaddr_in *fromsin = svc_getcaller(transp); 56 57 syslog(LOG_WARNING, 58 "non-local amq attempt (might be from %s)", 59 inet_ntoa(fromsin->sin_addr)); 60 svcerr_noproc(transp); 61 return; 62 } 63 64 switch (rqstp->rq_proc) { 65 case AMQPROC_NULL: 66 xdr_argument = (xdrproc_t) xdr_void; 67 xdr_result = (xdrproc_t) xdr_void; 68 local = (char *(*)(char *, struct svc_req *)) amqproc_null_57_svc; 69 break; 70 71 case AMQPROC_MNTTREE: 72 xdr_argument = (xdrproc_t) xdr_amq_string; 73 xdr_result = (xdrproc_t) xdr_amq_mount_tree_p; 74 local = (char *(*)(char *, struct svc_req *)) amqproc_mnttree_57_svc; 75 break; 76 77 case AMQPROC_UMNT: 78 xdr_argument = (xdrproc_t) xdr_amq_string; 79 xdr_result = (xdrproc_t) xdr_void; 80 local = (char *(*)(char *, struct svc_req *)) amqproc_umnt_57_svc; 81 break; 82 83 case AMQPROC_STATS: 84 xdr_argument = (xdrproc_t) xdr_void; 85 xdr_result = (xdrproc_t) xdr_amq_mount_stats; 86 local = (char *(*)(char *, struct svc_req *)) amqproc_stats_57_svc; 87 break; 88 89 case AMQPROC_EXPORT: 90 xdr_argument = (xdrproc_t) xdr_void; 91 xdr_result = (xdrproc_t) xdr_amq_mount_tree_list; 92 local = (char *(*)(char *, struct svc_req *)) amqproc_export_57_svc; 93 break; 94 95 case AMQPROC_SETOPT: 96 xdr_argument = (xdrproc_t) xdr_amq_setopt; 97 xdr_result = (xdrproc_t) xdr_int; 98 local = (char *(*)(char *, struct svc_req *)) amqproc_setopt_57_svc; 99 break; 100 101 case AMQPROC_GETMNTFS: 102 xdr_argument = (xdrproc_t) xdr_void; 103 xdr_result = (xdrproc_t) xdr_amq_mount_info_list; 104 local = (char *(*)(char *, struct svc_req *)) amqproc_getmntfs_57_svc; 105 break; 106 107 case AMQPROC_GETVERS: 108 xdr_argument = (xdrproc_t) xdr_void; 109 xdr_result = (xdrproc_t) xdr_amq_string; 110 local = (char *(*)(char *, struct svc_req *)) amqproc_getvers_57_svc; 111 break; 112 113 default: 114 svcerr_noproc(transp); 115 return; 116 } 117 (void) memset((char *)&argument, 0, sizeof (argument)); 118 if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) { 119 svcerr_decode(transp); 120 return; 121 } 122 result = (*local)((char *)&argument, rqstp); 123 if (result != NULL && !svc_sendreply(transp, xdr_result, result)) { 124 svcerr_systemerr(transp); 125 } 126 if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) { 127 plog(XLOG_FATAL, "unable to free rpc arguments in amqprog"); 128 going_down(1); 129 } 130 return; 131 } 132