xref: /titanic_52/usr/src/lib/libnsl/rpc/svid_funcs.c (revision e8031f0a8ed0e45c6d8847c5e09424e66fd34a4b)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
2261961e0fSrobinson 
237c478bd9Sstevel@tonic-gate /*
24*e8031f0aSraf  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
2561961e0fSrobinson  * Use is subject to license terms.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate /*
317c478bd9Sstevel@tonic-gate  *	These functions are documented in the SVID as being part of libnsl.
327c478bd9Sstevel@tonic-gate  *	They are also defined as macros in various RPC header files.  To
337c478bd9Sstevel@tonic-gate  *	ensure that these interfaces exist as functions, we've created this
347c478bd9Sstevel@tonic-gate  *	(we hope unused) file.
357c478bd9Sstevel@tonic-gate  */
367c478bd9Sstevel@tonic-gate 
37*e8031f0aSraf #include "mt.h"
387c478bd9Sstevel@tonic-gate #include <rpc/rpc.h>
397c478bd9Sstevel@tonic-gate #include <sys/types.h>
407c478bd9Sstevel@tonic-gate #include <synch.h>
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #undef	auth_destroy
437c478bd9Sstevel@tonic-gate #undef	clnt_call
447c478bd9Sstevel@tonic-gate #undef  clnt_send
457c478bd9Sstevel@tonic-gate #undef	clnt_control
467c478bd9Sstevel@tonic-gate #undef	clnt_destroy
477c478bd9Sstevel@tonic-gate #undef	clnt_freeres
487c478bd9Sstevel@tonic-gate #undef	clnt_geterr
497c478bd9Sstevel@tonic-gate #undef	svc_destroy
507c478bd9Sstevel@tonic-gate #undef	svc_freeargs
517c478bd9Sstevel@tonic-gate #undef	svc_getargs
527c478bd9Sstevel@tonic-gate #undef	svc_getrpccaller
537c478bd9Sstevel@tonic-gate #undef	xdr_destroy
547c478bd9Sstevel@tonic-gate #undef	xdr_getpos
557c478bd9Sstevel@tonic-gate #undef	xdr_inline
567c478bd9Sstevel@tonic-gate #undef	xdr_setpos
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate extern int __svc_versquiet_get();
597c478bd9Sstevel@tonic-gate extern void __svc_versquiet_off();
607c478bd9Sstevel@tonic-gate extern void __svc_versquiet_on();
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate void
6361961e0fSrobinson auth_destroy(AUTH *auth)
647c478bd9Sstevel@tonic-gate {
657c478bd9Sstevel@tonic-gate 	((*((auth)->ah_ops->ah_destroy))(auth));
667c478bd9Sstevel@tonic-gate }
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate enum clnt_stat
6961961e0fSrobinson clnt_call(CLIENT *cl, uint32_t proc, xdrproc_t xargs, caddr_t argsp,
7061961e0fSrobinson 			xdrproc_t xres, caddr_t resp, struct timeval timeout)
717c478bd9Sstevel@tonic-gate {
7261961e0fSrobinson 	return ((*(cl)->cl_ops->cl_call)(cl, proc, xargs, argsp, xres, resp,
7361961e0fSrobinson 		timeout));
747c478bd9Sstevel@tonic-gate }
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate enum clnt_stat
7761961e0fSrobinson clnt_send(CLIENT *cl, uint32_t proc, xdrproc_t xargs, caddr_t argsp)
787c478bd9Sstevel@tonic-gate {
7961961e0fSrobinson 	return ((*(cl)->cl_ops->cl_send)(cl, proc, xargs, argsp));
807c478bd9Sstevel@tonic-gate }
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate bool_t
8361961e0fSrobinson clnt_control(CLIENT *cl, uint_t rq, char *in)
847c478bd9Sstevel@tonic-gate {
8561961e0fSrobinson 	return ((*(cl)->cl_ops->cl_control)(cl, rq, in));
867c478bd9Sstevel@tonic-gate }
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate void
8961961e0fSrobinson clnt_destroy(CLIENT *cl)
907c478bd9Sstevel@tonic-gate {
917c478bd9Sstevel@tonic-gate 	((*(cl)->cl_ops->cl_destroy)(cl));
927c478bd9Sstevel@tonic-gate }
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate bool_t
9561961e0fSrobinson clnt_freeres(CLIENT *cl, xdrproc_t xres, caddr_t resp)
967c478bd9Sstevel@tonic-gate {
9761961e0fSrobinson 	return ((*(cl)->cl_ops->cl_freeres)(cl, xres, resp));
987c478bd9Sstevel@tonic-gate }
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate void
10161961e0fSrobinson clnt_geterr(CLIENT *cl, struct rpc_err *errp)
1027c478bd9Sstevel@tonic-gate {
1037c478bd9Sstevel@tonic-gate 	(*(cl)->cl_ops->cl_geterr)(cl, errp);
1047c478bd9Sstevel@tonic-gate }
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate bool_t
10761961e0fSrobinson svc_control(SVCXPRT *xprt, const uint_t rq, void *in)
1087c478bd9Sstevel@tonic-gate {
1097c478bd9Sstevel@tonic-gate 	switch (rq) {
1107c478bd9Sstevel@tonic-gate 	case SVCGET_VERSQUIET:
1117c478bd9Sstevel@tonic-gate 		*((int *)in) = __svc_versquiet_get(xprt);
11261961e0fSrobinson 		return (TRUE);
1137c478bd9Sstevel@tonic-gate 	case SVCSET_VERSQUIET:
1147c478bd9Sstevel@tonic-gate 		if (*((int *)in) == 0)
1157c478bd9Sstevel@tonic-gate 			__svc_versquiet_off(xprt);
1167c478bd9Sstevel@tonic-gate 		else
1177c478bd9Sstevel@tonic-gate 			__svc_versquiet_on(xprt);
11861961e0fSrobinson 		return (TRUE);
1197c478bd9Sstevel@tonic-gate 	default:
12061961e0fSrobinson 		return ((*(xprt)->xp_ops->xp_control)(xprt, rq, in));
1217c478bd9Sstevel@tonic-gate 	}
1227c478bd9Sstevel@tonic-gate }
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate void
12561961e0fSrobinson svc_destroy(SVCXPRT *xprt)
1267c478bd9Sstevel@tonic-gate {
1277c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_destroy)(xprt);
1287c478bd9Sstevel@tonic-gate }
1297c478bd9Sstevel@tonic-gate 
1307c478bd9Sstevel@tonic-gate bool_t
13161961e0fSrobinson svc_freeargs(SVCXPRT *xprt, xdrproc_t xargs, char *argsp)
1327c478bd9Sstevel@tonic-gate {
13361961e0fSrobinson 	return ((*(xprt)->xp_ops->xp_freeargs)(xprt, xargs, argsp));
1347c478bd9Sstevel@tonic-gate }
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate bool_t
13761961e0fSrobinson svc_getargs(SVCXPRT *xprt, xdrproc_t xargs, char *argsp)
1387c478bd9Sstevel@tonic-gate {
13961961e0fSrobinson 	return ((*(xprt)->xp_ops->xp_getargs)(xprt, xargs, argsp));
1407c478bd9Sstevel@tonic-gate }
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate struct netbuf *
14361961e0fSrobinson svc_getrpccaller(SVCXPRT *xprt)
1447c478bd9Sstevel@tonic-gate {
14561961e0fSrobinson 	return (&(xprt)->xp_rtaddr);
1467c478bd9Sstevel@tonic-gate }
1477c478bd9Sstevel@tonic-gate 
1487c478bd9Sstevel@tonic-gate void
14961961e0fSrobinson xdr_destroy(XDR *xdrs)
1507c478bd9Sstevel@tonic-gate {
1517c478bd9Sstevel@tonic-gate 	(*(xdrs)->x_ops->x_destroy)(xdrs);
1527c478bd9Sstevel@tonic-gate }
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate uint_t
15561961e0fSrobinson xdr_getpos(XDR *xdrs)
1567c478bd9Sstevel@tonic-gate {
15761961e0fSrobinson 	return ((*(xdrs)->x_ops->x_getpostn)(xdrs));
1587c478bd9Sstevel@tonic-gate }
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate rpc_inline_t *
16161961e0fSrobinson xdr_inline(XDR *xdrs, int len)
1627c478bd9Sstevel@tonic-gate {
16361961e0fSrobinson 	return ((*(xdrs)->x_ops->x_inline)(xdrs, len));
1647c478bd9Sstevel@tonic-gate }
1657c478bd9Sstevel@tonic-gate 
1667c478bd9Sstevel@tonic-gate bool_t
16761961e0fSrobinson xdr_setpos(XDR *xdrs, uint_t pos)
1687c478bd9Sstevel@tonic-gate {
16961961e0fSrobinson 	return ((*(xdrs)->x_ops->x_setpostn)(xdrs, pos));
1707c478bd9Sstevel@tonic-gate }
171