xref: /onnv-gate/usr/src/lib/libnsl/rpc/svid_funcs.c (revision 1219:f89f56c2d9ac)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
22132Srobinson 
230Sstevel@tonic-gate /*
24*1219Sraf  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
25132Srobinson  * Use is subject to license terms.
260Sstevel@tonic-gate  */
270Sstevel@tonic-gate 
280Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
290Sstevel@tonic-gate 
300Sstevel@tonic-gate /*
310Sstevel@tonic-gate  *	These functions are documented in the SVID as being part of libnsl.
320Sstevel@tonic-gate  *	They are also defined as macros in various RPC header files.  To
330Sstevel@tonic-gate  *	ensure that these interfaces exist as functions, we've created this
340Sstevel@tonic-gate  *	(we hope unused) file.
350Sstevel@tonic-gate  */
360Sstevel@tonic-gate 
37*1219Sraf #include "mt.h"
380Sstevel@tonic-gate #include <rpc/rpc.h>
390Sstevel@tonic-gate #include <sys/types.h>
400Sstevel@tonic-gate #include <synch.h>
410Sstevel@tonic-gate 
420Sstevel@tonic-gate #undef	auth_destroy
430Sstevel@tonic-gate #undef	clnt_call
440Sstevel@tonic-gate #undef  clnt_send
450Sstevel@tonic-gate #undef	clnt_control
460Sstevel@tonic-gate #undef	clnt_destroy
470Sstevel@tonic-gate #undef	clnt_freeres
480Sstevel@tonic-gate #undef	clnt_geterr
490Sstevel@tonic-gate #undef	svc_destroy
500Sstevel@tonic-gate #undef	svc_freeargs
510Sstevel@tonic-gate #undef	svc_getargs
520Sstevel@tonic-gate #undef	svc_getrpccaller
530Sstevel@tonic-gate #undef	xdr_destroy
540Sstevel@tonic-gate #undef	xdr_getpos
550Sstevel@tonic-gate #undef	xdr_inline
560Sstevel@tonic-gate #undef	xdr_setpos
570Sstevel@tonic-gate 
580Sstevel@tonic-gate extern int __svc_versquiet_get();
590Sstevel@tonic-gate extern void __svc_versquiet_off();
600Sstevel@tonic-gate extern void __svc_versquiet_on();
610Sstevel@tonic-gate 
620Sstevel@tonic-gate void
auth_destroy(AUTH * auth)63132Srobinson auth_destroy(AUTH *auth)
640Sstevel@tonic-gate {
650Sstevel@tonic-gate 	((*((auth)->ah_ops->ah_destroy))(auth));
660Sstevel@tonic-gate }
670Sstevel@tonic-gate 
680Sstevel@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)69132Srobinson clnt_call(CLIENT *cl, uint32_t proc, xdrproc_t xargs, caddr_t argsp,
70132Srobinson 			xdrproc_t xres, caddr_t resp, struct timeval timeout)
710Sstevel@tonic-gate {
72132Srobinson 	return ((*(cl)->cl_ops->cl_call)(cl, proc, xargs, argsp, xres, resp,
73132Srobinson 		timeout));
740Sstevel@tonic-gate }
750Sstevel@tonic-gate 
760Sstevel@tonic-gate enum clnt_stat
clnt_send(CLIENT * cl,uint32_t proc,xdrproc_t xargs,caddr_t argsp)77132Srobinson clnt_send(CLIENT *cl, uint32_t proc, xdrproc_t xargs, caddr_t argsp)
780Sstevel@tonic-gate {
79132Srobinson 	return ((*(cl)->cl_ops->cl_send)(cl, proc, xargs, argsp));
800Sstevel@tonic-gate }
810Sstevel@tonic-gate 
820Sstevel@tonic-gate bool_t
clnt_control(CLIENT * cl,uint_t rq,char * in)83132Srobinson clnt_control(CLIENT *cl, uint_t rq, char *in)
840Sstevel@tonic-gate {
85132Srobinson 	return ((*(cl)->cl_ops->cl_control)(cl, rq, in));
860Sstevel@tonic-gate }
870Sstevel@tonic-gate 
880Sstevel@tonic-gate void
clnt_destroy(CLIENT * cl)89132Srobinson clnt_destroy(CLIENT *cl)
900Sstevel@tonic-gate {
910Sstevel@tonic-gate 	((*(cl)->cl_ops->cl_destroy)(cl));
920Sstevel@tonic-gate }
930Sstevel@tonic-gate 
940Sstevel@tonic-gate bool_t
clnt_freeres(CLIENT * cl,xdrproc_t xres,caddr_t resp)95132Srobinson clnt_freeres(CLIENT *cl, xdrproc_t xres, caddr_t resp)
960Sstevel@tonic-gate {
97132Srobinson 	return ((*(cl)->cl_ops->cl_freeres)(cl, xres, resp));
980Sstevel@tonic-gate }
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate void
clnt_geterr(CLIENT * cl,struct rpc_err * errp)101132Srobinson clnt_geterr(CLIENT *cl, struct rpc_err *errp)
1020Sstevel@tonic-gate {
1030Sstevel@tonic-gate 	(*(cl)->cl_ops->cl_geterr)(cl, errp);
1040Sstevel@tonic-gate }
1050Sstevel@tonic-gate 
1060Sstevel@tonic-gate bool_t
svc_control(SVCXPRT * xprt,const uint_t rq,void * in)107132Srobinson svc_control(SVCXPRT *xprt, const uint_t rq, void *in)
1080Sstevel@tonic-gate {
1090Sstevel@tonic-gate 	switch (rq) {
1100Sstevel@tonic-gate 	case SVCGET_VERSQUIET:
1110Sstevel@tonic-gate 		*((int *)in) = __svc_versquiet_get(xprt);
112132Srobinson 		return (TRUE);
1130Sstevel@tonic-gate 	case SVCSET_VERSQUIET:
1140Sstevel@tonic-gate 		if (*((int *)in) == 0)
1150Sstevel@tonic-gate 			__svc_versquiet_off(xprt);
1160Sstevel@tonic-gate 		else
1170Sstevel@tonic-gate 			__svc_versquiet_on(xprt);
118132Srobinson 		return (TRUE);
1190Sstevel@tonic-gate 	default:
120132Srobinson 		return ((*(xprt)->xp_ops->xp_control)(xprt, rq, in));
1210Sstevel@tonic-gate 	}
1220Sstevel@tonic-gate }
1230Sstevel@tonic-gate 
1240Sstevel@tonic-gate void
svc_destroy(SVCXPRT * xprt)125132Srobinson svc_destroy(SVCXPRT *xprt)
1260Sstevel@tonic-gate {
1270Sstevel@tonic-gate 	(*(xprt)->xp_ops->xp_destroy)(xprt);
1280Sstevel@tonic-gate }
1290Sstevel@tonic-gate 
1300Sstevel@tonic-gate bool_t
svc_freeargs(SVCXPRT * xprt,xdrproc_t xargs,char * argsp)131132Srobinson svc_freeargs(SVCXPRT *xprt, xdrproc_t xargs, char *argsp)
1320Sstevel@tonic-gate {
133132Srobinson 	return ((*(xprt)->xp_ops->xp_freeargs)(xprt, xargs, argsp));
1340Sstevel@tonic-gate }
1350Sstevel@tonic-gate 
1360Sstevel@tonic-gate bool_t
svc_getargs(SVCXPRT * xprt,xdrproc_t xargs,char * argsp)137132Srobinson svc_getargs(SVCXPRT *xprt, xdrproc_t xargs, char *argsp)
1380Sstevel@tonic-gate {
139132Srobinson 	return ((*(xprt)->xp_ops->xp_getargs)(xprt, xargs, argsp));
1400Sstevel@tonic-gate }
1410Sstevel@tonic-gate 
1420Sstevel@tonic-gate struct netbuf *
svc_getrpccaller(SVCXPRT * xprt)143132Srobinson svc_getrpccaller(SVCXPRT *xprt)
1440Sstevel@tonic-gate {
145132Srobinson 	return (&(xprt)->xp_rtaddr);
1460Sstevel@tonic-gate }
1470Sstevel@tonic-gate 
1480Sstevel@tonic-gate void
xdr_destroy(XDR * xdrs)149132Srobinson xdr_destroy(XDR *xdrs)
1500Sstevel@tonic-gate {
1510Sstevel@tonic-gate 	(*(xdrs)->x_ops->x_destroy)(xdrs);
1520Sstevel@tonic-gate }
1530Sstevel@tonic-gate 
1540Sstevel@tonic-gate uint_t
xdr_getpos(XDR * xdrs)155132Srobinson xdr_getpos(XDR *xdrs)
1560Sstevel@tonic-gate {
157132Srobinson 	return ((*(xdrs)->x_ops->x_getpostn)(xdrs));
1580Sstevel@tonic-gate }
1590Sstevel@tonic-gate 
1600Sstevel@tonic-gate rpc_inline_t *
xdr_inline(XDR * xdrs,int len)161132Srobinson xdr_inline(XDR *xdrs, int len)
1620Sstevel@tonic-gate {
163132Srobinson 	return ((*(xdrs)->x_ops->x_inline)(xdrs, len));
1640Sstevel@tonic-gate }
1650Sstevel@tonic-gate 
1660Sstevel@tonic-gate bool_t
xdr_setpos(XDR * xdrs,uint_t pos)167132Srobinson xdr_setpos(XDR *xdrs, uint_t pos)
1680Sstevel@tonic-gate {
169132Srobinson 	return ((*(xdrs)->x_ops->x_setpostn)(xdrs, pos));
1700Sstevel@tonic-gate }
171