/*
 * Please do not edit this file.
 * It was generated using rpcgen.
 */

#include "fep.h"
#include <stdio.h>
#include <stdlib.h>
#include <rpc/pmap_clnt.h>
#include <string.h>
#include <memory.h>
#include <sys/socket.h>
#include <netinet/in.h>

#ifndef SIG_PF
#define SIG_PF void(*)(int)
#endif
/* RPC SVC test */

static void
fep_program_32(struct svc_req *rqstp, register SVCXPRT *transp)
{
	union {
		int fep_getlineinfo_32_arg;
		int fep_getlineinfovalue_32_arg;
		fep_lineinfo fep_sendlineinfo_32_arg;
		fep_std_time fep_settime_32_arg;
		int fep_advancetime_32_arg;
		int fep_getschedule_32_arg;
		int fep_getschedulevalue_32_arg;
		fep_schedule fep_sendschedule_32_arg;
		fep_setschedule fep_setlinemgr_schedule_32_arg;
		int fep_free_schedule_32_arg;
		fep_lineop fep_idleline_32_arg;
		fep_lineop fep_modemsignals_32_arg;
		fep_reply_request fep_getreply_32_arg;
		fep_schedule fep_updateschedule_32_arg;
		int fep_getreport_32_arg;
		int fep_getreportvalue_32_arg;
		fep_report fep_sendreport_32_arg;
		fep_reply fep_reply_xfer_32_arg;
		int fep_set_debug_32_arg;
		fep_setschedule fep_setlmdebug_32_arg;
		int fep_initsystem_32_arg;
		init_form fep_initrealix_32_arg;
	} argument;
	char *result;
	xdrproc_t _xdr_argument, _xdr_result;
	char *(*local)(char *, struct svc_req *);

	switch (rqstp->rq_proc) {
	case NULLPROC:
		(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
		return;

	case FEP_GETLINEINFOCOUNT:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) fep_getlineinfocount_32_svc;
		break;

	case FEP_GETLINEINFO:
		_xdr_argument = (xdrproc_t) xdr_int;
		_xdr_result = (xdrproc_t) xdr_lineinfo_ret;
		local = (char *(*)(char *, struct svc_req *)) fep_getlineinfo_32_svc;
		break;

	case FEP_GETLINEINFOVALUE:
		_xdr_argument = (xdrproc_t) xdr_int;
		_xdr_result = (xdrproc_t) xdr_lineinfo_ret;
		local = (char *(*)(char *, struct svc_req *)) fep_getlineinfovalue_32_svc;
		break;

	case FEP_SENDLINEINFO:
		_xdr_argument = (xdrproc_t) xdr_fep_lineinfo;
		_xdr_result = (xdrproc_t) xdr_lineinfo_ret;
		local = (char *(*)(char *, struct svc_req *)) fep_sendlineinfo_32_svc;
		break;

	case FEP_GETTIME:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_std_time_ret;
		local = (char *(*)(char *, struct svc_req *)) fep_gettime_32_svc;
		break;

	case FEP_SETTIME:
		_xdr_argument = (xdrproc_t) xdr_fep_std_time;
		_xdr_result = (xdrproc_t) xdr_std_time_ret;
		local = (char *(*)(char *, struct svc_req *)) fep_settime_32_svc;
		break;

	case FEP_ADVANCETIME:
		_xdr_argument = (xdrproc_t) xdr_int;
		_xdr_result = (xdrproc_t) xdr_std_time_ret;
		local = (char *(*)(char *, struct svc_req *)) fep_advancetime_32_svc;
		break;

	case FEP_GETSCHEDULECOUNT:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) fep_getschedulecount_32_svc;
		break;

	case FEP_GETSCHEDULE:
		_xdr_argument = (xdrproc_t) xdr_int;
		_xdr_result = (xdrproc_t) xdr_schedule_ret;
		local = (char *(*)(char *, struct svc_req *)) fep_getschedule_32_svc;
		break;

	case FEP_GETSCHEDULEVALUE:
		_xdr_argument = (xdrproc_t) xdr_int;
		_xdr_result = (xdrproc_t) xdr_schedule_ret;
		local = (char *(*)(char *, struct svc_req *)) fep_getschedulevalue_32_svc;
		break;

	case FEP_SENDSCHEDULE:
		_xdr_argument = (xdrproc_t) xdr_fep_schedule;
		_xdr_result = (xdrproc_t) xdr_schedule_ret;
		local = (char *(*)(char *, struct svc_req *)) fep_sendschedule_32_svc;
		break;

	case FEP_SETLINEMGR_SCHEDULE:
		_xdr_argument = (xdrproc_t) xdr_fep_setschedule;
		_xdr_result = (xdrproc_t) xdr_errorstatus;
		local = (char *(*)(char *, struct svc_req *)) fep_setlinemgr_schedule_32_svc;
		break;

	case FEP_FREE_SCHEDULE:
		_xdr_argument = (xdrproc_t) xdr_int;
		_xdr_result = (xdrproc_t) xdr_errorstatus;
		local = (char *(*)(char *, struct svc_req *)) fep_free_schedule_32_svc;
		break;

	case FEP_IDLELINE:
		_xdr_argument = (xdrproc_t) xdr_fep_lineop;
		_xdr_result = (xdrproc_t) xdr_errorstatus;
		local = (char *(*)(char *, struct svc_req *)) fep_idleline_32_svc;
		break;

	case FEP_MODEMSIGNALS:
		_xdr_argument = (xdrproc_t) xdr_fep_lineop;
		_xdr_result = (xdrproc_t) xdr_errorstatus;
		local = (char *(*)(char *, struct svc_req *)) fep_modemsignals_32_svc;
		break;

	case FEP_GETREPLY:
		_xdr_argument = (xdrproc_t) xdr_fep_reply_request;
		_xdr_result = (xdrproc_t) xdr_reply_ret;
		local = (char *(*)(char *, struct svc_req *)) fep_getreply_32_svc;
		break;

	case FEP_CLEARREPLY:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_errorstatus;
		local = (char *(*)(char *, struct svc_req *)) fep_clearreply_32_svc;
		break;

	case FEP_UPDATESCHEDULE:
		_xdr_argument = (xdrproc_t) xdr_fep_schedule;
		_xdr_result = (xdrproc_t) xdr_schedule_ret;
		local = (char *(*)(char *, struct svc_req *)) fep_updateschedule_32_svc;
		break;

	case FEP_GETREPORTCOUNT:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) fep_getreportcount_32_svc;
		break;

	case FEP_GETREPORT:
		_xdr_argument = (xdrproc_t) xdr_int;
		_xdr_result = (xdrproc_t) xdr_report_ret;
		local = (char *(*)(char *, struct svc_req *)) fep_getreport_32_svc;
		break;

	case FEP_GETREPORTVALUE:
		_xdr_argument = (xdrproc_t) xdr_int;
		_xdr_result = (xdrproc_t) xdr_report_ret;
		local = (char *(*)(char *, struct svc_req *)) fep_getreportvalue_32_svc;
		break;

	case FEP_SENDREPORT:
		_xdr_argument = (xdrproc_t) xdr_fep_report;
		_xdr_result = (xdrproc_t) xdr_report_ret;
		local = (char *(*)(char *, struct svc_req *)) fep_sendreport_32_svc;
		break;

	case FEP_REPLY_XFER:
		_xdr_argument = (xdrproc_t) xdr_fep_reply;
		_xdr_result = (xdrproc_t) xdr_void;
		local = (char *(*)(char *, struct svc_req *)) fep_reply_xfer_32_svc;
		break;

	case FEP_SET_DEBUG:
		_xdr_argument = (xdrproc_t) xdr_int;
		_xdr_result = (xdrproc_t) xdr_errorstatus;
		local = (char *(*)(char *, struct svc_req *)) fep_set_debug_32_svc;
		break;

	case FEP_GET_STACK_LEFT:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) fep_get_stack_left_32_svc;
		break;

	case FEP_SETLMDEBUG:
		_xdr_argument = (xdrproc_t) xdr_fep_setschedule;
		_xdr_result = (xdrproc_t) xdr_errorstatus;
		local = (char *(*)(char *, struct svc_req *)) fep_setlmdebug_32_svc;
		break;

	case FEP_SHUTDOWN:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_errorstatus;
		local = (char *(*)(char *, struct svc_req *)) fep_shutdown_32_svc;
		break;

	case FEP_INITSYSTEM:
		_xdr_argument = (xdrproc_t) xdr_int;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) fep_initsystem_32_svc;
		break;

	case FEP_INITREALIX:
		_xdr_argument = (xdrproc_t) xdr_init_form;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (char *(*)(char *, struct svc_req *)) fep_initrealix_32_svc;
		break;

	default:
		svcerr_noproc (transp);
		return;
	}
	memset ((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		svcerr_decode (transp);
		return;
	}
	result = (*local)((char *)&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
		svcerr_systemerr (transp);
	}
	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
		fprintf (stderr, "%s", "unable to free arguments");
		exit (1);
	}
	return;
}

int main (int argc, char **argv)
{
	register SVCXPRT *transp;

	pmap_unset (FEP_PROGRAM, FEP_VERSION);

	transp = svcudp_create(RPC_ANYSOCK);
	if (transp == NULL) {
		fprintf (stderr, "%s", "cannot create udp service.");
		exit(1);
	}
	if (!svc_register(transp, FEP_PROGRAM, FEP_VERSION, fep_program_32, IPPROTO_UDP)) {
		fprintf (stderr, "%s", "unable to register (FEP_PROGRAM, FEP_VERSION, udp).");
		exit(1);
	}

	transp = svctcp_create(RPC_ANYSOCK, 0, 0);
	if (transp == NULL) {
		fprintf (stderr, "%s", "cannot create tcp service.");
		exit(1);
	}
	if (!svc_register(transp, FEP_PROGRAM, FEP_VERSION, fep_program_32, IPPROTO_TCP)) {
		fprintf (stderr, "%s", "unable to register (FEP_PROGRAM, FEP_VERSION, tcp).");
		exit(1);
	}

	svc_run ();
	fprintf (stderr, "%s", "svc_run returned");
	exit (1);
	/* NOTREACHED */
}
