1/* 2 * Copyright (c) 2002-2008 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23/* 24 * Please do not edit this file. 25 * It was generated using rpcgen. 26 */ 27 28#include "sm_inter.h" 29#include <sys/ioctl.h> 30#include <fcntl.h> 31#include <stdio.h> 32#include <stdlib.h> 33#include <unistd.h> 34#include <oncrpc/pmap_clnt.h> 35#include <string.h> 36#include <netdb.h> 37#include <signal.h> 38#include <sys/ttycom.h> 39#ifdef __cplusplus 40#include <sysent.h> 41#endif /* __cplusplus */ 42#include <memory.h> 43#include <sys/socket.h> 44#include <netinet/in.h> 45#include <syslog.h> 46 47#include "statd.h" 48 49#ifdef __STDC__ 50#define SIG_PF void(*)(int) 51#endif 52 53#ifdef DEBUG 54#define RPC_SVC_FG 55#endif 56 57#define _RPCSVC_CLOSEDOWN 120 58#ifndef lint 59/*static char sccsid[] = "from: @(#)sm_inter.x 1.7 87/06/24 Copyr 1987 Sun Micro";*/ 60/*static char sccsid[] = "from: @(#)sm_inter.x 2.2 88/08/01 4.0 RPCSRC";*/ 61__unused static char rcsid[] = "$Id: sm_inter_svc.c,v 1.3 2006/02/07 06:22:34 lindak Exp $"; 62#endif /* not lint */ 63 64void sm_prog_1(struct svc_req *rqstp, SVCXPRT *transp); 65 66void 67sm_prog_1(struct svc_req *rqstp, SVCXPRT *transp) 68{ 69 union { 70 struct sm_name sm_stat_1_arg; 71 struct mon sm_mon_1_arg; 72 struct mon_id sm_unmon_1_arg; 73 struct my_id sm_unmon_all_1_arg; 74 struct stat_chge sm_notify_1_arg; 75 } argument; 76 char *result; 77 xdrproc_t xdr_argument, xdr_result; 78 char *(*local)(char *, struct svc_req *); 79 80 switch (rqstp->rq_proc) { 81 case NULLPROC: 82 (void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL); 83 return; 84 85 case SM_STAT: 86 xdr_argument = (xdrproc_t) xdr_sm_name; 87 xdr_result = (xdrproc_t) xdr_sm_stat_res; 88 local = (char *(*)(char *, struct svc_req *)) sm_stat_1_svc; 89 break; 90 91 case SM_MON: 92 xdr_argument = (xdrproc_t) xdr_mon; 93 xdr_result = (xdrproc_t) xdr_sm_stat_res; 94 local = (char *(*)(char *, struct svc_req *)) sm_mon_1_svc; 95 break; 96 97 case SM_UNMON: 98 xdr_argument = (xdrproc_t) xdr_mon_id; 99 xdr_result = (xdrproc_t) xdr_sm_stat; 100 local = (char *(*)(char *, struct svc_req *)) sm_unmon_1_svc; 101 break; 102 103 case SM_UNMON_ALL: 104 xdr_argument = (xdrproc_t) xdr_my_id; 105 xdr_result = (xdrproc_t) xdr_sm_stat; 106 local = (char *(*)(char *, struct svc_req *)) sm_unmon_all_1_svc; 107 break; 108 109 case SM_SIMU_CRASH: 110 xdr_argument = (xdrproc_t) xdr_void; 111 xdr_result = (xdrproc_t) xdr_void; 112 local = (char *(*)(char *, struct svc_req *)) sm_simu_crash_1_svc; 113 break; 114 115 case SM_NOTIFY: 116 xdr_argument = (xdrproc_t) xdr_stat_chge; 117 xdr_result = (xdrproc_t) xdr_void; 118 local = (char *(*)(char *, struct svc_req *)) sm_notify_1_svc; 119 break; 120 121 default: 122 svcerr_noproc(transp); 123 return; 124 } 125 (void) memset((char *)&argument, 0, sizeof (argument)); 126 if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) { 127 svcerr_decode(transp); 128 return; 129 } 130 result = (*local)((char *)&argument, rqstp); 131 if (result != NULL && !svc_sendreply(transp, xdr_result, result)) { 132 svcerr_systemerr(transp); 133 } 134 if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) { 135 log(LOG_ERR, "unable to free arguments"); 136 exit(1); 137 } 138 return; 139} 140