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 /* 24 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 25 * Use is subject to license terms. 26 */ 27 28 #pragma ident "%Z%%M% %I% %E% SMI" 29 30 /* 31 * These functions are documented in the SVID as being part of libnsl. 32 * They are also defined as macros in various RPC header files. To 33 * ensure that these interfaces exist as functions, we've created this 34 * (we hope unused) file. 35 */ 36 37 #include <rpc/rpc.h> 38 #include <sys/types.h> 39 #include <synch.h> 40 41 #undef auth_destroy 42 #undef clnt_call 43 #undef clnt_send 44 #undef clnt_control 45 #undef clnt_destroy 46 #undef clnt_freeres 47 #undef clnt_geterr 48 #undef svc_destroy 49 #undef svc_freeargs 50 #undef svc_getargs 51 #undef svc_getrpccaller 52 #undef xdr_destroy 53 #undef xdr_getpos 54 #undef xdr_inline 55 #undef xdr_setpos 56 57 extern int __svc_versquiet_get(); 58 extern void __svc_versquiet_off(); 59 extern void __svc_versquiet_on(); 60 61 void 62 auth_destroy(AUTH *auth) 63 { 64 ((*((auth)->ah_ops->ah_destroy))(auth)); 65 } 66 67 enum clnt_stat 68 clnt_call(CLIENT *cl, uint32_t proc, xdrproc_t xargs, caddr_t argsp, 69 xdrproc_t xres, caddr_t resp, struct timeval timeout) 70 { 71 return ((*(cl)->cl_ops->cl_call)(cl, proc, xargs, argsp, xres, resp, 72 timeout)); 73 } 74 75 enum clnt_stat 76 clnt_send(CLIENT *cl, uint32_t proc, xdrproc_t xargs, caddr_t argsp) 77 { 78 return ((*(cl)->cl_ops->cl_send)(cl, proc, xargs, argsp)); 79 } 80 81 bool_t 82 clnt_control(CLIENT *cl, uint_t rq, char *in) 83 { 84 return ((*(cl)->cl_ops->cl_control)(cl, rq, in)); 85 } 86 87 void 88 clnt_destroy(CLIENT *cl) 89 { 90 ((*(cl)->cl_ops->cl_destroy)(cl)); 91 } 92 93 bool_t 94 clnt_freeres(CLIENT *cl, xdrproc_t xres, caddr_t resp) 95 { 96 return ((*(cl)->cl_ops->cl_freeres)(cl, xres, resp)); 97 } 98 99 void 100 clnt_geterr(CLIENT *cl, struct rpc_err *errp) 101 { 102 (*(cl)->cl_ops->cl_geterr)(cl, errp); 103 } 104 105 bool_t 106 svc_control(SVCXPRT *xprt, const uint_t rq, void *in) 107 { 108 switch (rq) { 109 case SVCGET_VERSQUIET: 110 *((int *)in) = __svc_versquiet_get(xprt); 111 return (TRUE); 112 case SVCSET_VERSQUIET: 113 if (*((int *)in) == 0) 114 __svc_versquiet_off(xprt); 115 else 116 __svc_versquiet_on(xprt); 117 return (TRUE); 118 default: 119 return ((*(xprt)->xp_ops->xp_control)(xprt, rq, in)); 120 } 121 } 122 123 void 124 svc_destroy(SVCXPRT *xprt) 125 { 126 (*(xprt)->xp_ops->xp_destroy)(xprt); 127 } 128 129 bool_t 130 svc_freeargs(SVCXPRT *xprt, xdrproc_t xargs, char *argsp) 131 { 132 return ((*(xprt)->xp_ops->xp_freeargs)(xprt, xargs, argsp)); 133 } 134 135 bool_t 136 svc_getargs(SVCXPRT *xprt, xdrproc_t xargs, char *argsp) 137 { 138 return ((*(xprt)->xp_ops->xp_getargs)(xprt, xargs, argsp)); 139 } 140 141 struct netbuf * 142 svc_getrpccaller(SVCXPRT *xprt) 143 { 144 return (&(xprt)->xp_rtaddr); 145 } 146 147 void 148 xdr_destroy(XDR *xdrs) 149 { 150 (*(xdrs)->x_ops->x_destroy)(xdrs); 151 } 152 153 uint_t 154 xdr_getpos(XDR *xdrs) 155 { 156 return ((*(xdrs)->x_ops->x_getpostn)(xdrs)); 157 } 158 159 rpc_inline_t * 160 xdr_inline(XDR *xdrs, int len) 161 { 162 return ((*(xdrs)->x_ops->x_inline)(xdrs, len)); 163 } 164 165 bool_t 166 xdr_setpos(XDR *xdrs, uint_t pos) 167 { 168 return ((*(xdrs)->x_ops->x_setpostn)(xdrs, pos)); 169 } 170