#include <stdio.h>
#include <rpc/rpc.h>
#include "windows.h"
void windowdispatch();
main()
{
int num;
num = svc_create(windowdispatch, WINDOWPROG, WINDOWVERS,
"CIRCUIT_V");
if (num == 0) {
fprintf(stderr, "can't create an RPC server\n");
exit(1);
}
svc_run(); /* Never returns */
fprintf(stderr, "should never reach this point\n");
}
void
windowdispatch(rqstp, transp)
struct svc_req *rqstp;
SVCXPRT *transp;
{
char *s = NULL;
switch (rqstp->rq_proc) {
case NULLPROC:
if (!svc_sendreply(transp, xdr_void, 0))
fprintf(stderr, "can't reply to RPC call\n");
return;
case RENDERSTRING:
if (!svc_getargs(transp, xdr_wrapstring, &s)) {
fprintf(stderr, "can't decode arguments\n");
/* Tell caller an error occurred */
svcerr_decode(transp);
break;
}
/* Code here to render the string s */
if (!svc_sendreply(transp, xdr_void, (caddr_t) NULL))
fprintf(stderr, "can't reply to RPC call\n");
break;
case RENDERSTRING_BATCHED:
if (!svc_getargs(transp, xdr_wrapstring, &s)) {
fprintf(stderr, "can't decode arguments\n");
/* Be silent in the face of protocol errors */
break;
}
/* Code here to render string s, but send no reply! */
break;
default:
svcerr_noproc(transp);
return;
}
/* Now free string allocated while decoding arguments */
svc_freeargs(transp, xdr_wrapstring, &s);
}
|