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

#include "gncRpc.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

void
gncrpc_prog_1(struct svc_req *rqstp, register SVCXPRT *transp)
{
	union {
		gncrpc_book_begin_args gncrpc_book_begin_1_arg;
		gncrpc_ptr gncrpc_book_load_1_arg;
		gncrpc_ptr gncrpc_book_end_1_arg;
		gncrpc_backend_guid gncrpc_account_begin_edit_1_arg;
		gncrpc_commit_acct_args gncrpc_account_commit_edit_1_arg;
		gncrpc_backend_guid gncrpc_account_rollback_edit_1_arg;
		gncrpc_backend_guid gncrpc_txn_begin_edit_1_arg;
		gncrpc_commit_txn_args gncrpc_txn_commit_edit_1_arg;
		gncrpc_backend_guid gncrpc_txn_rollback_edit_1_arg;
		gncrpc_query_args gncrpc_run_query_1_arg;
		gncrpc_sync1_args gncrpc_sync1_1_arg;
		gncrpc_sync2_args gncrpc_sync2_1_arg;
		gncrpc_get_txns_args gncrpc_get_txns_1_arg;
	} argument;
	union {
		int gncrpc_version_1_res;
		int gncrpc_book_begin_1_res;
		gncrpc_book_load_ret gncrpc_book_load_1_res;
		int gncrpc_book_end_1_res;
		int gncrpc_account_begin_edit_1_res;
		int gncrpc_account_commit_edit_1_res;
		int gncrpc_account_rollback_edit_1_res;
		int gncrpc_txn_begin_edit_1_res;
		int gncrpc_txn_commit_edit_1_res;
		int gncrpc_txn_rollback_edit_1_res;
		gncrpc_query_ret gncrpc_run_query_1_res;
		gncrpc_sync1_ret gncrpc_sync1_1_res;
		int gncrpc_sync2_1_res;
		gncrpc_get_txns_ret gncrpc_get_txns_1_res;
	} result;
	bool_t retval;
	xdrproc_t _xdr_argument, _xdr_result;
	bool_t (*local)(char *, void *, struct svc_req *);

	switch (rqstp->rq_proc) {
	case gncrpc_version:
		_xdr_argument = (xdrproc_t) xdr_void;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (bool_t (*) (char *, void *,  struct svc_req *))gncrpc_version_1_svc;
		break;

	case gncrpc_book_begin:
		_xdr_argument = (xdrproc_t) xdr_gncrpc_book_begin_args;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (bool_t (*) (char *, void *,  struct svc_req *))gncrpc_book_begin_1_svc;
		break;

	case gncrpc_book_load:
		_xdr_argument = (xdrproc_t) xdr_gncrpc_ptr;
		_xdr_result = (xdrproc_t) xdr_gncrpc_book_load_ret;
		local = (bool_t (*) (char *, void *,  struct svc_req *))gncrpc_book_load_1_svc;
		break;

	case gncrpc_book_end:
		_xdr_argument = (xdrproc_t) xdr_gncrpc_ptr;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (bool_t (*) (char *, void *,  struct svc_req *))gncrpc_book_end_1_svc;
		break;

	case gncrpc_account_begin_edit:
		_xdr_argument = (xdrproc_t) xdr_gncrpc_backend_guid;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (bool_t (*) (char *, void *,  struct svc_req *))gncrpc_account_begin_edit_1_svc;
		break;

	case gncrpc_account_commit_edit:
		_xdr_argument = (xdrproc_t) xdr_gncrpc_commit_acct_args;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (bool_t (*) (char *, void *,  struct svc_req *))gncrpc_account_commit_edit_1_svc;
		break;

	case gncrpc_account_rollback_edit:
		_xdr_argument = (xdrproc_t) xdr_gncrpc_backend_guid;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (bool_t (*) (char *, void *,  struct svc_req *))gncrpc_account_rollback_edit_1_svc;
		break;

	case gncrpc_txn_begin_edit:
		_xdr_argument = (xdrproc_t) xdr_gncrpc_backend_guid;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (bool_t (*) (char *, void *,  struct svc_req *))gncrpc_txn_begin_edit_1_svc;
		break;

	case gncrpc_txn_commit_edit:
		_xdr_argument = (xdrproc_t) xdr_gncrpc_commit_txn_args;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (bool_t (*) (char *, void *,  struct svc_req *))gncrpc_txn_commit_edit_1_svc;
		break;

	case gncrpc_txn_rollback_edit:
		_xdr_argument = (xdrproc_t) xdr_gncrpc_backend_guid;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (bool_t (*) (char *, void *,  struct svc_req *))gncrpc_txn_rollback_edit_1_svc;
		break;

	case gncrpc_run_query:
		_xdr_argument = (xdrproc_t) xdr_gncrpc_query_args;
		_xdr_result = (xdrproc_t) xdr_gncrpc_query_ret;
		local = (bool_t (*) (char *, void *,  struct svc_req *))gncrpc_run_query_1_svc;
		break;

	case gncrpc_sync1:
		_xdr_argument = (xdrproc_t) xdr_gncrpc_sync1_args;
		_xdr_result = (xdrproc_t) xdr_gncrpc_sync1_ret;
		local = (bool_t (*) (char *, void *,  struct svc_req *))gncrpc_sync1_1_svc;
		break;

	case gncrpc_sync2:
		_xdr_argument = (xdrproc_t) xdr_gncrpc_sync2_args;
		_xdr_result = (xdrproc_t) xdr_int;
		local = (bool_t (*) (char *, void *,  struct svc_req *))gncrpc_sync2_1_svc;
		break;

	case gncrpc_get_txns:
		_xdr_argument = (xdrproc_t) xdr_gncrpc_get_txns_args;
		_xdr_result = (xdrproc_t) xdr_gncrpc_get_txns_ret;
		local = (bool_t (*) (char *, void *,  struct svc_req *))gncrpc_get_txns_1_svc;
		break;

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

	return;
}
