1 /*********************************************************************
2 * RPC for the Windows NT Operating System
3 * 1993 by Martin F. Gergeleit
4 * Users may use, copy or modify Sun RPC for the Windows NT Operating
5 * System according to the Sun copyright below.
7 * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO
8 * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE
9 * USE OF. USE ENTIRELY AT YOUR OWN RISK!!!
10 *********************************************************************/
12 /* @(#)svc_raw.c 2.1 88/07/29 4.0 RPCSRC */
14 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
15 * unrestricted use provided that this legend is included on all tape
16 * media and as a part of the software program in whole or part. Users
17 * may copy or modify Sun RPC without charge, but are not authorized
18 * to license or distribute it to anyone else except as part of a product or
19 * program developed by the user.
21 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
22 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
25 * Sun RPC is provided with no support and without any obligation on the
26 * part of Sun Microsystems, Inc. to assist in its use, correction,
27 * modification or enhancement.
29 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
30 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
31 * OR ANY PART THEREOF.
33 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
34 * or profits or other special, indirect and consequential damages, even if
35 * Sun has been advised of the possibility of such damages.
37 * Sun Microsystems, Inc.
39 * Mountain View, California 94043
41 #if !defined(lint) && defined(SCCSIDS)
42 static char sccsid[] = "@(#)svc_raw.c 1.15 87/08/11 Copyr 1984 Sun Micro";
46 * svc_raw.c, This a toy for simple testing and timing.
47 * Interface to create an rpc client and server in the same UNIX process.
48 * This lets us similate rpc and get rpc (round trip) overhead, without
49 * any interference from the kernal.
51 * Copyright (C) 1984, Sun Microsystems, Inc.
58 * This is the "network" that we will be moving data over
60 static struct svcraw_private {
61 char _raw_buf[UDPMSGSIZE];
64 char verf_body[MAX_AUTH_BYTES];
67 static bool_t svcraw_recv();
68 static enum xprt_stat svcraw_stat();
69 static bool_t svcraw_getargs();
70 static bool_t svcraw_reply();
71 static bool_t svcraw_freeargs();
72 static void svcraw_destroy();
74 static struct xp_ops server_ops = {
86 register struct svcraw_private *srp = svcraw_private;
89 srp = (struct svcraw_private *)calloc(1, sizeof (*srp));
93 srp->server.xp_sock = 0;
94 srp->server.xp_port = 0;
95 srp->server.xp_ops = &server_ops;
96 srp->server.xp_verf.oa_base = srp->verf_body;
97 xdrmem_create(&srp->xdr_stream, srp->_raw_buf, UDPMSGSIZE, XDR_FREE);
98 return (&srp->server);
101 static enum xprt_stat
109 svcraw_recv(xprt, msg)
113 register struct svcraw_private *srp = svcraw_private;
118 xdrs = &srp->xdr_stream;
119 xdrs->x_op = XDR_DECODE;
121 if (! xdr_callmsg(xdrs, msg))
127 svcraw_reply(xprt, msg)
131 register struct svcraw_private *srp = svcraw_private;
136 xdrs = &srp->xdr_stream;
137 xdrs->x_op = XDR_ENCODE;
139 if (! xdr_replymsg(xdrs, msg))
141 (void)XDR_GETPOS(xdrs); /* called just for overhead */
146 svcraw_getargs(xprt, xdr_args, args_ptr)
151 register struct svcraw_private *srp = svcraw_private;
155 return ((*xdr_args)(&srp->xdr_stream, args_ptr));
159 svcraw_freeargs(xprt, xdr_args, args_ptr)
164 register struct svcraw_private *srp = svcraw_private;
169 xdrs = &srp->xdr_stream;
170 xdrs->x_op = XDR_FREE;
171 return ((*xdr_args)(xdrs, args_ptr));