xref: /illumos-gate/usr/src/lib/libnsl/rpc/svid_funcs.c (revision 1da57d55)
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 /*
297c478bd9Sstevel@tonic-gate  *	These functions are documented in the SVID as being part of libnsl.
307c478bd9Sstevel@tonic-gate  *	They are also defined as macros in various RPC header files.  To
317c478bd9Sstevel@tonic-gate  *	ensure that these interfaces exist as functions, we've created this
327c478bd9Sstevel@tonic-gate  *	(we hope unused) file.
337c478bd9Sstevel@tonic-gate  */
347c478bd9Sstevel@tonic-gate 
35*e8031f0aSraf #include "mt.h"
367c478bd9Sstevel@tonic-gate #include <rpc/rpc.h>
377c478bd9Sstevel@tonic-gate #include <sys/types.h>
387c478bd9Sstevel@tonic-gate #include <synch.h>
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #undef	auth_destroy
417c478bd9Sstevel@tonic-gate #undef	clnt_call
427c478bd9Sstevel@tonic-gate #undef  clnt_send
437c478bd9Sstevel@tonic-gate #undef	clnt_control
447c478bd9Sstevel@tonic-gate #undef	clnt_destroy
457c478bd9Sstevel@tonic-gate #undef	clnt_freeres
467c478bd9Sstevel@tonic-gate #undef	clnt_geterr
477c478bd9Sstevel@tonic-gate #undef	svc_destroy
487c478bd9Sstevel@tonic-gate #undef	svc_freeargs
497c478bd9Sstevel@tonic-gate #undef	svc_getargs
507c478bd9Sstevel@tonic-gate #undef	svc_getrpccaller
517c478bd9Sstevel@tonic-gate #undef	xdr_destroy
527c478bd9Sstevel@tonic-gate #undef	xdr_getpos
537c478bd9Sstevel@tonic-gate #undef	xdr_inline
547c478bd9Sstevel@tonic-gate #undef	xdr_setpos
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate extern int __svc_versquiet_get();
577c478bd9Sstevel@tonic-gate extern void __svc_versquiet_off();
587c478bd9Sstevel@tonic-gate extern void __svc_versquiet_on();
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate void
auth_destroy(AUTH * auth)6161961e0fSrobinson auth_destroy(AUTH *auth)
627c478bd9Sstevel@tonic-gate {
637c478bd9Sstevel@tonic-gate 	((*((auth)->ah_ops->ah_destroy))(auth));
647c478bd9Sstevel@tonic-gate }
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate enum clnt_stat
clnt_call(CLIENT * cl,uint32_t proc,xdrproc_t xargs,caddr_t argsp,xdrproc_t xres,caddr_t resp,struct timeval timeout)6761961e0fSrobinson clnt_call(CLIENT *cl, uint32_t proc, xdrproc_t xargs, caddr_t argsp,
6861961e0fSrobinson 			xdrproc_t xres, caddr_t resp, struct timeval timeout)
697c478bd9Sstevel@tonic-gate {
7061961e0fSrobinson 	return ((*(cl)->cl_ops->cl_call)(cl, proc, xargs, argsp, xres, resp,
7161961e0fSrobinson 		timeout));
727c478bd9Sstevel@tonic-gate }
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate enum clnt_stat
clnt_send(CLIENT * cl,uint32_t proc,xdrproc_t xargs,caddr_t argsp)7561961e0fSrobinson clnt_send(CLIENT *cl, uint32_t proc, xdrproc_t xargs, caddr_t argsp)
767c478bd9Sstevel@tonic-gate {
7761961e0fSrobinson 	return ((*(cl)->cl_ops->cl_send)(cl, proc, xargs, argsp));
787c478bd9Sstevel@tonic-gate }
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate bool_t
clnt_control(CLIENT * cl,uint_t rq,char * in)8161961e0fSrobinson clnt_control(CLIENT *cl, uint_t rq, char *in)
827c478bd9Sstevel@tonic-gate {
8361961e0fSrobinson 	return ((*(cl)->cl_ops->cl_control)(cl, rq, in));
847c478bd9Sstevel@tonic-gate }
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate void
clnt_destroy(CLIENT * cl)8761961e0fSrobinson clnt_destroy(CLIENT *cl)
887c478bd9Sstevel@tonic-gate {
897c478bd9Sstevel@tonic-gate 	((*(cl)->cl_ops->cl_destroy)(cl));
907c478bd9Sstevel@tonic-gate }
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate bool_t
clnt_freeres(CLIENT * cl,xdrproc_t xres,caddr_t resp)9361961e0fSrobinson clnt_freeres(CLIENT *cl, xdrproc_t xres, caddr_t resp)
947c478bd9Sstevel@tonic-gate {
9561961e0fSrobinson 	return ((*(cl)->cl_ops->cl_freeres)(cl, xres, resp));
967c478bd9Sstevel@tonic-gate }
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate void
clnt_geterr(CLIENT * cl,struct rpc_err * errp)9961961e0fSrobinson clnt_geterr(CLIENT *cl, struct rpc_err *errp)
1007c478bd9Sstevel@tonic-gate {
1017c478bd9Sstevel@tonic-gate 	(*(cl)->cl_ops->cl_geterr)(cl, errp);
1027c478bd9Sstevel@tonic-gate }
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate bool_t
svc_control(SVCXPRT * xprt,const uint_t rq,void * in)10561961e0fSrobinson svc_control(SVCXPRT *xprt, const uint_t rq, void *in)
1067c478bd9Sstevel@tonic-gate {
1077c478bd9Sstevel@tonic-gate 	switch (rq) {
1087c478bd9Sstevel@tonic-gate 	case SVCGET_VERSQUIET:
1097c478bd9Sstevel@tonic-gate 		*((int *)in) = __svc_versquiet_get(xprt);
11061961e0fSrobinson 		return (TRUE);
1117c478bd9Sstevel@tonic-gate 	case SVCSET_VERSQUIET:
1127c478bd9Sstevel@tonic-gate 		if (*((int *)in) == 0)
1137c478bd9Sstevel@tonic-gate 			__svc_versquiet_off(xprt);
1147c478bd9Sstevel@tonic-gate 		else
1157c478bd9Sstevel@tonic-gate 			__svc_versquiet_on(xprt);
11661961e0fSrobinson 		return (TRUE);
1177c478bd9Sstevel@tonic-gate 	default:
11861961e0fSrobinson 		return ((*(xprt)->xp_ops->xp_control)(xprt, rq, in));
1197c478bd9Sstevel@tonic-gate 	}
1207c478bd9Sstevel@tonic-gate }
1217c478bd9Sstevel@tonic-gate 
1227c478bd9Sstevel@tonic-gate void
svc_destroy(SVCXPRT * xprt)12361961e0fSrobinson svc_destroy(SVCXPRT *xprt)
1247c478bd9Sstevel@tonic-gate {
1257c478bd9Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_destroy)(xprt);
1267c478bd9Sstevel@tonic-gate }
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate bool_t
svc_freeargs(SVCXPRT * xprt,xdrproc_t xargs,char * argsp)12961961e0fSrobinson svc_freeargs(SVCXPRT *xprt, xdrproc_t xargs, char *argsp)
1307c478bd9Sstevel@tonic-gate {
13161961e0fSrobinson 	return ((*(xprt)->xp_ops->xp_freeargs)(xprt, xargs, argsp));
1327c478bd9Sstevel@tonic-gate }
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate bool_t
svc_getargs(SVCXPRT * xprt,xdrproc_t xargs,char * argsp)13561961e0fSrobinson svc_getargs(SVCXPRT *xprt, xdrproc_t xargs, char *argsp)
1367c478bd9Sstevel@tonic-gate {
13761961e0fSrobinson 	return ((*(xprt)->xp_ops->xp_getargs)(xprt, xargs, argsp));
1387c478bd9Sstevel@tonic-gate }
1397c478bd9Sstevel@tonic-gate 
1407c478bd9Sstevel@tonic-gate struct netbuf *
svc_getrpccaller(SVCXPRT * xprt)14161961e0fSrobinson svc_getrpccaller(SVCXPRT *xprt)
1427c478bd9Sstevel@tonic-gate {
14361961e0fSrobinson 	return (&(xprt)->xp_rtaddr);
1447c478bd9Sstevel@tonic-gate }
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate void
xdr_destroy(XDR * xdrs)14761961e0fSrobinson xdr_destroy(XDR *xdrs)
1487c478bd9Sstevel@tonic-gate {
1497c478bd9Sstevel@tonic-gate 	(*(xdrs)->x_ops->x_destroy)(xdrs);
1507c478bd9Sstevel@tonic-gate }
1517c478bd9Sstevel@tonic-gate 
1527c478bd9Sstevel@tonic-gate uint_t
xdr_getpos(XDR * xdrs)15361961e0fSrobinson xdr_getpos(XDR *xdrs)
1547c478bd9Sstevel@tonic-gate {
15561961e0fSrobinson 	return ((*(xdrs)->x_ops->x_getpostn)(xdrs));
1567c478bd9Sstevel@tonic-gate }
1577c478bd9Sstevel@tonic-gate 
1587c478bd9Sstevel@tonic-gate rpc_inline_t *
xdr_inline(XDR * xdrs,int len)15961961e0fSrobinson xdr_inline(XDR *xdrs, int len)
1607c478bd9Sstevel@tonic-gate {
16161961e0fSrobinson 	return ((*(xdrs)->x_ops->x_inline)(xdrs, len));
1627c478bd9Sstevel@tonic-gate }
1637c478bd9Sstevel@tonic-gate 
1647c478bd9Sstevel@tonic-gate bool_t
xdr_setpos(XDR * xdrs,uint_t pos)16561961e0fSrobinson xdr_setpos(XDR *xdrs, uint_t pos)
1667c478bd9Sstevel@tonic-gate {
16761961e0fSrobinson 	return ((*(xdrs)->x_ops->x_setpostn)(xdrs, pos));
1687c478bd9Sstevel@tonic-gate }
169