#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <netdb.h>
#include <string.h>
#include <syslog.h>
#include <rpcsvc/yp.h>
#include "yppush.h"
#ifdef DEBUG
#define RPC_SVC_FG
#endif
#define _RPCSVC_CLOSEDOWN 120
int _rpcpmstart;
int _rpcfdtype;
int _rpcsvcdirty;
static
void _msgout(char *msg)
{
#ifdef RPC_SVC_FG
if (_rpcpmstart)
syslog(LOG_ERR, "%s", msg);
else
(void) fprintf(stderr, "%s\n", msg);
#else
syslog(LOG_ERR, "%s", msg);
#endif
}
void
yppush_xfrrespprog_1(struct svc_req *rqstp, SVCXPRT *transp)
{
union argument {
int fill;
} argument;
char *result;
xdrproc_t xdr_argument, xdr_result;
char *(*local)(union argument *, struct svc_req *);
_rpcsvcdirty = 1;
switch (rqstp->rq_proc) {
case YPPUSHPROC_NULL:
xdr_argument = xdr_void;
xdr_result = xdr_void;
local = (char *(*)(union argument *, struct svc_req *))
yppushproc_null_1_svc;
break;
case YPPUSHPROC_XFRRESP:
xdr_argument = xdr_yppushresp_xfr;
xdr_result = xdr_void;
local = (char *(*)(union argument *, struct svc_req *))
yppushproc_xfrresp_1_svc;
break;
default:
svcerr_noproc(transp);
_rpcsvcdirty = 0;
exit(1);
return;
}
(void) memset(&argument, 0, sizeof(argument));
if (!svc_getargs(transp, xdr_argument, (caddr_t)&argument)) {
svcerr_decode(transp);
_rpcsvcdirty = 0;
exit(1);
return;
}
result = (*local)(&argument, rqstp);
if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
svcerr_systemerr(transp);
}
if (!svc_freeargs(transp, xdr_argument, (caddr_t)&argument)) {
_msgout("unable to free arguments");
exit(1);
}
_rpcsvcdirty = 0;
if (rqstp->rq_proc!=YPPUSHPROC_NULL)
exit(0);
}