xref: /titanic_51/usr/src/lib/libnsl/rpc/svid_funcs.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1991, 1997, 2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 /*
30  *	These functions are documented in the SVID as being part of libnsl.
31  *	They are also defined as macros in various RPC header files.  To
32  *	ensure that these interfaces exist as functions, we've created this
33  *	(we hope unused) file.
34  */
35 
36 #include <rpc/rpc.h>
37 #include <sys/types.h>
38 #include <rpc/trace.h>
39 #include <synch.h>
40 
41 /* LINTLIBRARY */
42 
43 #undef	auth_destroy
44 #undef	clnt_call
45 #undef  clnt_send
46 #undef	clnt_control
47 #undef	clnt_destroy
48 #undef	clnt_freeres
49 #undef	clnt_geterr
50 #undef	svc_destroy
51 #undef	svc_freeargs
52 #undef	svc_getargs
53 #undef	svc_getrpccaller
54 #undef	xdr_destroy
55 #undef	xdr_getpos
56 #undef	xdr_inline
57 #undef	xdr_setpos
58 
59 extern int __svc_versquiet_get();
60 extern void __svc_versquiet_off();
61 extern void __svc_versquiet_on();
62 
63 void
64 auth_destroy(auth)
65 	AUTH	*auth;
66 {
67 	trace1(TR_auth_destroy, 0);
68 	((*((auth)->ah_ops->ah_destroy))(auth));
69 	trace1(TR_auth_destroy, 1);
70 }
71 
72 enum clnt_stat
73 clnt_call(cl, proc, xargs, argsp, xres, resp, timeout)
74 	CLIENT		*cl;
75 	uint32_t	proc;
76 	xdrproc_t	xargs;
77 	caddr_t		argsp;
78 	xdrproc_t	xres;
79 	caddr_t		resp;
80 	struct timeval	timeout;
81 {
82 	enum clnt_stat dummy;
83 
84 	trace2(TR_clnt_call, 0, proc);
85 	dummy = (*(cl)->cl_ops->cl_call)(cl, proc, xargs, argsp, xres, resp,
86 		timeout);
87 	trace2(TR_clnt_call, 1, proc);
88 	return (dummy);
89 }
90 
91 enum clnt_stat
92 clnt_send(cl, proc, xargs, argsp)
93 	CLIENT		*cl;
94 	uint32_t	proc;
95 	xdrproc_t	xargs;
96 	caddr_t		argsp;
97 {
98 	enum clnt_stat dummy;
99 
100 	dummy = (*(cl)->cl_ops->cl_send)(cl, proc, xargs, argsp);
101 	return (dummy);
102 }
103 
104 bool_t
105 clnt_control(cl, rq, in)
106 	CLIENT	*cl;
107 	uint_t	rq;
108 	char	*in;
109 {
110 	bool_t dummy;
111 
112 	trace2(TR_clnt_control, 0, rq);
113 	dummy = (*(cl)->cl_ops->cl_control)(cl, rq, in);
114 	trace2(TR_clnt_control, 1, rq);
115 	return (dummy);
116 }
117 
118 
119 void
120 clnt_destroy(cl)
121 	CLIENT	*cl;
122 {
123 	trace2(TR_clnt_destroy, 0, cl);
124 	((*(cl)->cl_ops->cl_destroy)(cl));
125 	trace2(TR_clnt_destroy, 1, cl);
126 }
127 
128 bool_t
129 clnt_freeres(cl, xres, resp)
130 	CLIENT		*cl;
131 	xdrproc_t	xres;
132 	caddr_t		resp;
133 {
134 	bool_t dummy;
135 
136 	trace2(TR_clnt_freeres, 0, cl);
137 	dummy = (*(cl)->cl_ops->cl_freeres)(cl, xres, resp);
138 	trace2(TR_clnt_freeres, 1, cl);
139 	return (dummy);
140 }
141 
142 void
143 clnt_geterr(cl, errp)
144 	CLIENT		*cl;
145 	struct rpc_err	*errp;
146 {
147 	trace2(TR_clnt_geterr, 0, cl);
148 	(*(cl)->cl_ops->cl_geterr)(cl, errp);
149 	trace2(TR_clnt_geterr, 1, cl);
150 }
151 
152 bool_t
153 svc_control(xprt, rq, in)
154 	SVCXPRT		*xprt;
155 	const uint_t	rq;
156 	void		*in;
157 {
158 	bool_t retval;
159 
160 	trace2(TR_svc_control, 0, rq);
161 	switch (rq) {
162 	case SVCGET_VERSQUIET:
163 		*((int *)in) = __svc_versquiet_get(xprt);
164 		retval = TRUE;
165 		break;
166 
167 	case SVCSET_VERSQUIET:
168 		if (*((int *)in) == 0)
169 			__svc_versquiet_off(xprt);
170 		else
171 			__svc_versquiet_on(xprt);
172 		retval = TRUE;
173 		break;
174 
175 	default:
176 		retval = (*(xprt)->xp_ops->xp_control)(xprt, rq, in);
177 	}
178 	trace3(TR_svc_control, 1, rq, retval);
179 	return (retval);
180 }
181 
182 void
183 svc_destroy(xprt)
184 	SVCXPRT	*xprt;
185 {
186 	trace1(TR_svc_destroy, 0);
187 	(*(xprt)->xp_ops->xp_destroy)(xprt);
188 	trace1(TR_svc_destroy, 1);
189 }
190 
191 bool_t
192 svc_freeargs(xprt, xargs, argsp)
193 	SVCXPRT		*xprt;
194 	xdrproc_t	xargs;
195 	char		*argsp;
196 {
197 	bool_t dummy;
198 
199 	trace1(TR_svc_freeargs, 0);
200 	dummy = (*(xprt)->xp_ops->xp_freeargs)(xprt, xargs, argsp);
201 	trace1(TR_svc_freeargs, 1);
202 	return (dummy);
203 }
204 
205 bool_t
206 svc_getargs(xprt, xargs, argsp)
207 	SVCXPRT		*xprt;
208 	xdrproc_t	xargs;
209 	char		*argsp;
210 {
211 	bool_t dummy;
212 
213 	trace1(TR_svc_getargs, 0);
214 	dummy = (*(xprt)->xp_ops->xp_getargs)(xprt, xargs, argsp);
215 	trace1(TR_svc_getargs, 1);
216 	return (dummy);
217 }
218 
219 struct netbuf *
220 svc_getrpccaller(xprt)
221 	SVCXPRT	*xprt;
222 {
223 	struct netbuf *dummy;
224 
225 	trace1(TR_svc_getrpccaller, 0);
226 	dummy = &(xprt)->xp_rtaddr;
227 	trace1(TR_svc_getrpccaller, 1);
228 	return (dummy);
229 }
230 
231 void
232 xdr_destroy(xdrs)
233 	XDR	*xdrs;
234 {
235 	trace1(TR_xdr_destroy, 0);
236 	(*(xdrs)->x_ops->x_destroy)(xdrs);
237 	trace1(TR_xdr_destroy, 1);
238 }
239 
240 uint_t
241 xdr_getpos(xdrs)
242 	XDR	*xdrs;
243 {
244 	uint_t dummy;
245 
246 	trace1(TR_xdr_getpos, 0);
247 	dummy = (*(xdrs)->x_ops->x_getpostn)(xdrs);
248 	trace1(TR_xdr_getpos, 1);
249 	return (dummy);
250 }
251 
252 rpc_inline_t *
253 xdr_inline(xdrs, len)
254 	XDR	*xdrs;
255 	int	len;
256 {
257 	rpc_inline_t *dummy;
258 
259 	trace2(TR_xdr_inline, 0, len);
260 	dummy = (*(xdrs)->x_ops->x_inline)(xdrs, len);
261 	trace2(TR_xdr_inline, 1, len);
262 	return (dummy);
263 }
264 
265 bool_t
266 xdr_setpos(xdrs, pos)
267 	XDR	*xdrs;
268 	uint_t	pos;
269 {
270 	bool_t dummy;
271 
272 	trace2(TR_xdr_setpos, 0, pos);
273 	dummy = (*(xdrs)->x_ops->x_setpostn)(xdrs, pos);
274 	trace2(TR_xdr_setpos, 1, pos);
275 	return (dummy);
276 }
277