+Thu Oct 24 17:20:11 1996 Barry Jaspan <bjaspan@mit.edu>
+
+ * Makefile.in, rpc_test_clnt.c, rpc_test_svc.c, rpc_test.h:
+ distribute generated rpc_test_* files instead of running rpcgen on
+ rpc_text.x [krb5-admin/133]
+
Wed Oct 16 16:13:13 1996 Barry Jaspan <bjaspan@mit.edu>
* rpc_test.0/expire.exp: add test for expired credentials
client.c server.c: rpc_test.h
-rpc_test.h rpc_test_clnt.c rpc_test_svc.c: rpc_test.x
- -rm -f rpc_test_clnt.c rpc_test_svc.c rpc_test.h
- -ln -s $(srcdir)/rpc_test.x .
- rpcgen -l rpc_test.x -o rpc_test_clnt.c
- rpcgen -m rpc_test.x -o rpc_test_svc.c
- rpcgen -h rpc_test.x -o rpc_test.h
-
-clean::
- rm -f rpc_test.h rpc_test_clnt.c rpc_test_svc.c
+# If rpc_test.h and rpc_test_*.c do not work on your system, you can
+# try using rpcgen by uncommenting these lines (be sure to uncomment
+# then in the generated not Makefile.in).
+# rpc_test.h rpc_test_clnt.c rpc_test_svc.c: rpc_test.x
+# -rm -f rpc_test_clnt.c rpc_test_svc.c rpc_test.h
+# -ln -s $(srcdir)/rpc_test.x .
+# rpcgen -l rpc_test.x -o rpc_test_clnt.c
+# rpcgen -m rpc_test.x -o rpc_test_svc.c
+# rpcgen -h rpc_test.x -o rpc_test.h
+#
+# clean::
+# rm -f rpc_test.h rpc_test_clnt.c rpc_test_svc.c
+#
check unit-test:: unit-test-setup unit-test-body unit-test-cleanup
--- /dev/null
+#ifndef _RPC_TEST_H_RPCGEN
+#define _RPC_TEST_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#define RPC_TEST_PROG ((unsigned long)(1000001))
+#define RPC_TEST_VERS_1 ((unsigned long)(1))
+#define RPC_TEST_ECHO ((unsigned long)(1))
+extern char ** rpc_test_echo_1();
+extern int rpc_test_prog_1_freeresult();
+
+#endif /* !_RPC_TEST_H_RPCGEN */
--- /dev/null
+#include "rpc_test.h"
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+char **
+rpc_test_echo_1(argp, clnt)
+ char **argp;
+ CLIENT *clnt;
+{
+ static char *clnt_res;
+
+ memset((char *)&clnt_res, 0, sizeof (clnt_res));
+ if (clnt_call(clnt, RPC_TEST_ECHO,
+ (xdrproc_t) xdr_wrapstring, (caddr_t) argp,
+ (xdrproc_t) xdr_wrapstring, (caddr_t) &clnt_res,
+ TIMEOUT) != RPC_SUCCESS) {
+ return (NULL);
+ }
+ return (&clnt_res);
+}
--- /dev/null
+#include "rpc_test.h"
+#include <stdio.h>
+#include <stdlib.h> /* getenv, exit */
+#include <sys/types.h>
+#include <syslog.h>
+
+/* States a server can be in wrt request */
+
+#define _IDLE 0
+#define _SERVED 1
+
+static int _rpcsvcstate = _IDLE; /* Set when a request is serviced */
+static int _rpcsvccount = 0; /* Number of requests being serviced */
+
+static
+void _msgout(msg)
+ char *msg;
+{
+ syslog(LOG_ERR, msg);
+}
+
+void
+rpc_test_prog_1(rqstp, transp)
+ struct svc_req *rqstp;
+ register SVCXPRT *transp;
+{
+ union {
+ char *rpc_test_echo_1_arg;
+ } argument;
+ char *result;
+ bool_t (*xdr_argument)(), (*xdr_result)();
+ char *(*local)();
+
+ _rpcsvccount++;
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply(transp, xdr_void,
+ (char *)NULL);
+ _rpcsvccount--;
+ _rpcsvcstate = _SERVED;
+ return;
+
+ case RPC_TEST_ECHO:
+ xdr_argument = xdr_wrapstring;
+ xdr_result = xdr_wrapstring;
+ local = (char *(*)()) rpc_test_echo_1;
+ break;
+
+ default:
+ svcerr_noproc(transp);
+ _rpcsvccount--;
+ _rpcsvcstate = _SERVED;
+ return;
+ }
+ (void) memset((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs(transp, xdr_argument, &argument)) {
+ svcerr_decode(transp);
+ _rpcsvccount--;
+ _rpcsvcstate = _SERVED;
+ return;
+ }
+ result = (*local)(&argument, rqstp);
+ if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
+ svcerr_systemerr(transp);
+ }
+ if (!svc_freeargs(transp, xdr_argument, &argument)) {
+ _msgout("unable to free arguments");
+ exit(1);
+ }
+ _rpcsvccount--;
+ _rpcsvcstate = _SERVED;
+ return;
+}