xref: /titanic_51/usr/src/lib/libnsl/nsl/xti_wrappers.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 1996-2003 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*7c478bd9Sstevel@tonic-gate 
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #include "mt.h"
31*7c478bd9Sstevel@tonic-gate #include <xti.h>
32*7c478bd9Sstevel@tonic-gate #include <unistd.h>
33*7c478bd9Sstevel@tonic-gate #include <stropts.h>
34*7c478bd9Sstevel@tonic-gate #include <sys/stream.h>
35*7c478bd9Sstevel@tonic-gate #include "tx.h"
36*7c478bd9Sstevel@tonic-gate 
37*7c478bd9Sstevel@tonic-gate /*
38*7c478bd9Sstevel@tonic-gate  * Prefix: _xti_
39*7c478bd9Sstevel@tonic-gate  *
40*7c478bd9Sstevel@tonic-gate  * The _xti_ prefix is the default prefix for these functions. A function
41*7c478bd9Sstevel@tonic-gate  * having the _xti_ prefix means one of the following.
42*7c478bd9Sstevel@tonic-gate  *	a. This interface remains unchanged in all versions of XTI, starting
43*7c478bd9Sstevel@tonic-gate  *	   with the version of XTI in which it was first introduced.
44*7c478bd9Sstevel@tonic-gate  *	   Consequently there is no other entry point, with a different
45*7c478bd9Sstevel@tonic-gate  *	   prefix for this interface.
46*7c478bd9Sstevel@tonic-gate  *	b. This interface has changed subsequent to when it was first. This
47*7c478bd9Sstevel@tonic-gate  *	   function is meant for compatibility and provides the semantics of
48*7c478bd9Sstevel@tonic-gate  *	   the XTI version when it was first introduced.
49*7c478bd9Sstevel@tonic-gate  *
50*7c478bd9Sstevel@tonic-gate  * The _xti_xns5_ prefix is used for functions that provide XNS Issue 5
51*7c478bd9Sstevel@tonic-gate  * (UNIX98) semantics. It means the following.
52*7c478bd9Sstevel@tonic-gate  *	   The UNIX98 version of this interface has different semantics
53*7c478bd9Sstevel@tonic-gate  *	   as compared to UNIX95, and this function provides UNIX98 semantics
54*7c478bd9Sstevel@tonic-gate  *
55*7c478bd9Sstevel@tonic-gate  */
56*7c478bd9Sstevel@tonic-gate 
57*7c478bd9Sstevel@tonic-gate int
58*7c478bd9Sstevel@tonic-gate _xti_accept(int fd, int resfd, const struct t_call *call)
59*7c478bd9Sstevel@tonic-gate {
60*7c478bd9Sstevel@tonic-gate 	return (_tx_accept(fd, resfd, call, TX_XTI_API));
61*7c478bd9Sstevel@tonic-gate }
62*7c478bd9Sstevel@tonic-gate 
63*7c478bd9Sstevel@tonic-gate int
64*7c478bd9Sstevel@tonic-gate _xti_xns5_accept(int fd, int resfd, const struct t_call *call)
65*7c478bd9Sstevel@tonic-gate {
66*7c478bd9Sstevel@tonic-gate 	return (_tx_accept(fd, resfd, call, TX_XTI_XNS5_API));
67*7c478bd9Sstevel@tonic-gate }
68*7c478bd9Sstevel@tonic-gate 
69*7c478bd9Sstevel@tonic-gate void *
70*7c478bd9Sstevel@tonic-gate _xti_alloc(int fd, int struct_type, int fields)
71*7c478bd9Sstevel@tonic-gate {
72*7c478bd9Sstevel@tonic-gate 	return (_tx_alloc(fd, struct_type, fields, TX_XTI_API));
73*7c478bd9Sstevel@tonic-gate }
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate int
76*7c478bd9Sstevel@tonic-gate _xti_bind(int fd, const struct t_bind *req, struct t_bind *ret)
77*7c478bd9Sstevel@tonic-gate {
78*7c478bd9Sstevel@tonic-gate 	return (_tx_bind(fd, req, ret, TX_XTI_API));
79*7c478bd9Sstevel@tonic-gate }
80*7c478bd9Sstevel@tonic-gate 
81*7c478bd9Sstevel@tonic-gate int
82*7c478bd9Sstevel@tonic-gate _xti_close(int fd)
83*7c478bd9Sstevel@tonic-gate {
84*7c478bd9Sstevel@tonic-gate 	return (_tx_close(fd, TX_XTI_API));
85*7c478bd9Sstevel@tonic-gate }
86*7c478bd9Sstevel@tonic-gate 
87*7c478bd9Sstevel@tonic-gate int
88*7c478bd9Sstevel@tonic-gate _xti_connect(int fd, const struct t_call *sndcall, struct t_call *rcvcall)
89*7c478bd9Sstevel@tonic-gate {
90*7c478bd9Sstevel@tonic-gate 	return (_tx_connect(fd, sndcall, rcvcall, TX_XTI_API));
91*7c478bd9Sstevel@tonic-gate }
92*7c478bd9Sstevel@tonic-gate 
93*7c478bd9Sstevel@tonic-gate /*
94*7c478bd9Sstevel@tonic-gate  * Note: The TLI version of t_error has return type void. XTI has "int".
95*7c478bd9Sstevel@tonic-gate  * The spec probably needs to change to void *
96*7c478bd9Sstevel@tonic-gate  */
97*7c478bd9Sstevel@tonic-gate int
98*7c478bd9Sstevel@tonic-gate _xti_error(const char *errmsg)
99*7c478bd9Sstevel@tonic-gate {
100*7c478bd9Sstevel@tonic-gate 	return (_tx_error(errmsg, TX_XTI_API));
101*7c478bd9Sstevel@tonic-gate }
102*7c478bd9Sstevel@tonic-gate 
103*7c478bd9Sstevel@tonic-gate int
104*7c478bd9Sstevel@tonic-gate _xti_free(void *ptr, int struct_type)
105*7c478bd9Sstevel@tonic-gate {
106*7c478bd9Sstevel@tonic-gate 	return (_tx_free(ptr, struct_type, TX_XTI_API));
107*7c478bd9Sstevel@tonic-gate }
108*7c478bd9Sstevel@tonic-gate 
109*7c478bd9Sstevel@tonic-gate int
110*7c478bd9Sstevel@tonic-gate _xti_getinfo(int fd, struct t_info *info)
111*7c478bd9Sstevel@tonic-gate {
112*7c478bd9Sstevel@tonic-gate 	return (_tx_getinfo(fd, info, TX_XTI_API));
113*7c478bd9Sstevel@tonic-gate }
114*7c478bd9Sstevel@tonic-gate 
115*7c478bd9Sstevel@tonic-gate int
116*7c478bd9Sstevel@tonic-gate _xti_getprotaddr(int fd, struct t_bind *boundaddr, struct t_bind *peeraddr)
117*7c478bd9Sstevel@tonic-gate {
118*7c478bd9Sstevel@tonic-gate 	return (_tx_getprotaddr(fd, boundaddr, peeraddr, TX_XTI_API));
119*7c478bd9Sstevel@tonic-gate }
120*7c478bd9Sstevel@tonic-gate 
121*7c478bd9Sstevel@tonic-gate int
122*7c478bd9Sstevel@tonic-gate _xti_getstate(int fd)
123*7c478bd9Sstevel@tonic-gate {
124*7c478bd9Sstevel@tonic-gate 	return (_tx_getstate(fd, TX_XTI_API));
125*7c478bd9Sstevel@tonic-gate }
126*7c478bd9Sstevel@tonic-gate 
127*7c478bd9Sstevel@tonic-gate int
128*7c478bd9Sstevel@tonic-gate _xti_listen(int fd, struct t_call *call)
129*7c478bd9Sstevel@tonic-gate {
130*7c478bd9Sstevel@tonic-gate 	return (_tx_listen(fd, call, TX_XTI_API));
131*7c478bd9Sstevel@tonic-gate }
132*7c478bd9Sstevel@tonic-gate 
133*7c478bd9Sstevel@tonic-gate int
134*7c478bd9Sstevel@tonic-gate _xti_look(int fd)
135*7c478bd9Sstevel@tonic-gate {
136*7c478bd9Sstevel@tonic-gate 	return (_tx_look(fd, TX_XTI_API));
137*7c478bd9Sstevel@tonic-gate }
138*7c478bd9Sstevel@tonic-gate 
139*7c478bd9Sstevel@tonic-gate int
140*7c478bd9Sstevel@tonic-gate _xti_open(const char *path, int flags, struct t_info *info)
141*7c478bd9Sstevel@tonic-gate {
142*7c478bd9Sstevel@tonic-gate 	return (_tx_open(path, flags, info, TX_XTI_API));
143*7c478bd9Sstevel@tonic-gate }
144*7c478bd9Sstevel@tonic-gate 
145*7c478bd9Sstevel@tonic-gate int
146*7c478bd9Sstevel@tonic-gate _xti_optmgmt(int fd, const struct t_optmgmt *req, struct t_optmgmt *ret)
147*7c478bd9Sstevel@tonic-gate {
148*7c478bd9Sstevel@tonic-gate 	return (_tx_optmgmt(fd, req, ret, TX_XTI_API));
149*7c478bd9Sstevel@tonic-gate }
150*7c478bd9Sstevel@tonic-gate 
151*7c478bd9Sstevel@tonic-gate int
152*7c478bd9Sstevel@tonic-gate _xti_rcv(int fd, void *buf, unsigned int nbytes, int *flags)
153*7c478bd9Sstevel@tonic-gate {
154*7c478bd9Sstevel@tonic-gate 	return (_tx_rcv(fd, buf, nbytes, flags, TX_XTI_API));
155*7c478bd9Sstevel@tonic-gate }
156*7c478bd9Sstevel@tonic-gate 
157*7c478bd9Sstevel@tonic-gate int
158*7c478bd9Sstevel@tonic-gate _xti_rcvconnect(int fd, struct t_call *call)
159*7c478bd9Sstevel@tonic-gate {
160*7c478bd9Sstevel@tonic-gate 	return (_tx_rcvconnect(fd, call, TX_XTI_API));
161*7c478bd9Sstevel@tonic-gate }
162*7c478bd9Sstevel@tonic-gate 
163*7c478bd9Sstevel@tonic-gate int
164*7c478bd9Sstevel@tonic-gate _xti_rcvdis(int fd, struct t_discon *discon)
165*7c478bd9Sstevel@tonic-gate {
166*7c478bd9Sstevel@tonic-gate 	return (_tx_rcvdis(fd, discon, TX_XTI_API));
167*7c478bd9Sstevel@tonic-gate }
168*7c478bd9Sstevel@tonic-gate 
169*7c478bd9Sstevel@tonic-gate int
170*7c478bd9Sstevel@tonic-gate _xti_rcvrel(int fd)
171*7c478bd9Sstevel@tonic-gate {
172*7c478bd9Sstevel@tonic-gate 	return (_tx_rcvrel(fd, TX_XTI_API));
173*7c478bd9Sstevel@tonic-gate }
174*7c478bd9Sstevel@tonic-gate 
175*7c478bd9Sstevel@tonic-gate int
176*7c478bd9Sstevel@tonic-gate _xti_rcvreldata(int fd, struct t_discon *discon)
177*7c478bd9Sstevel@tonic-gate {
178*7c478bd9Sstevel@tonic-gate 	return (_tx_rcvreldata(fd, discon, TX_XTI_XNS5_API));
179*7c478bd9Sstevel@tonic-gate }
180*7c478bd9Sstevel@tonic-gate 
181*7c478bd9Sstevel@tonic-gate int
182*7c478bd9Sstevel@tonic-gate _xti_rcvudata(int fd, struct t_unitdata *unitdata, int *flags)
183*7c478bd9Sstevel@tonic-gate {
184*7c478bd9Sstevel@tonic-gate 	return (_tx_rcvudata(fd, unitdata, flags, TX_XTI_API));
185*7c478bd9Sstevel@tonic-gate }
186*7c478bd9Sstevel@tonic-gate 
187*7c478bd9Sstevel@tonic-gate int
188*7c478bd9Sstevel@tonic-gate _xti_rcvuderr(int fd, struct t_uderr *uderr)
189*7c478bd9Sstevel@tonic-gate {
190*7c478bd9Sstevel@tonic-gate 	return (_tx_rcvuderr(fd, uderr, TX_XTI_API));
191*7c478bd9Sstevel@tonic-gate }
192*7c478bd9Sstevel@tonic-gate 
193*7c478bd9Sstevel@tonic-gate int
194*7c478bd9Sstevel@tonic-gate _xti_rcvv(int fd, struct t_iovec *tiov, unsigned int tiovcount, int *flags)
195*7c478bd9Sstevel@tonic-gate {
196*7c478bd9Sstevel@tonic-gate 	return (_tx_rcvv(fd, tiov, tiovcount, flags, TX_XTI_XNS5_API));
197*7c478bd9Sstevel@tonic-gate }
198*7c478bd9Sstevel@tonic-gate 
199*7c478bd9Sstevel@tonic-gate int
200*7c478bd9Sstevel@tonic-gate _xti_rcvvudata(int fd, struct t_unitdata *unitdata, struct t_iovec *tiov,
201*7c478bd9Sstevel@tonic-gate     unsigned int tiovcount, int *flags)
202*7c478bd9Sstevel@tonic-gate {
203*7c478bd9Sstevel@tonic-gate 	return (_tx_rcvvudata(fd, unitdata, tiov, tiovcount, flags,
204*7c478bd9Sstevel@tonic-gate 	    TX_XTI_XNS5_API));
205*7c478bd9Sstevel@tonic-gate }
206*7c478bd9Sstevel@tonic-gate 
207*7c478bd9Sstevel@tonic-gate int
208*7c478bd9Sstevel@tonic-gate _xti_snd(int fd, void *buf, unsigned int nbytes, int flags)
209*7c478bd9Sstevel@tonic-gate {
210*7c478bd9Sstevel@tonic-gate 	return (_tx_snd(fd, buf, nbytes, flags, TX_XTI_API));
211*7c478bd9Sstevel@tonic-gate }
212*7c478bd9Sstevel@tonic-gate 
213*7c478bd9Sstevel@tonic-gate int
214*7c478bd9Sstevel@tonic-gate _xti_xns5_snd(int fd, void *buf, unsigned int nbytes, int flags)
215*7c478bd9Sstevel@tonic-gate {
216*7c478bd9Sstevel@tonic-gate 	return (_tx_snd(fd, buf, nbytes, flags, TX_XTI_XNS5_API));
217*7c478bd9Sstevel@tonic-gate }
218*7c478bd9Sstevel@tonic-gate 
219*7c478bd9Sstevel@tonic-gate int
220*7c478bd9Sstevel@tonic-gate _xti_snddis(int fd, const struct t_call *call)
221*7c478bd9Sstevel@tonic-gate {
222*7c478bd9Sstevel@tonic-gate 	return (_tx_snddis(fd, call, TX_XTI_API));
223*7c478bd9Sstevel@tonic-gate 
224*7c478bd9Sstevel@tonic-gate }
225*7c478bd9Sstevel@tonic-gate 
226*7c478bd9Sstevel@tonic-gate int
227*7c478bd9Sstevel@tonic-gate _xti_sndrel(int fd)
228*7c478bd9Sstevel@tonic-gate {
229*7c478bd9Sstevel@tonic-gate 	return (_tx_sndrel(fd, TX_XTI_API));
230*7c478bd9Sstevel@tonic-gate }
231*7c478bd9Sstevel@tonic-gate 
232*7c478bd9Sstevel@tonic-gate int
233*7c478bd9Sstevel@tonic-gate _xti_sndreldata(int fd, struct t_discon *discon)
234*7c478bd9Sstevel@tonic-gate {
235*7c478bd9Sstevel@tonic-gate 	return (_tx_sndreldata(fd, discon, TX_XTI_XNS5_API));
236*7c478bd9Sstevel@tonic-gate }
237*7c478bd9Sstevel@tonic-gate 
238*7c478bd9Sstevel@tonic-gate int
239*7c478bd9Sstevel@tonic-gate _xti_sndudata(int fd, const struct t_unitdata *unitdata)
240*7c478bd9Sstevel@tonic-gate {
241*7c478bd9Sstevel@tonic-gate 	return (_tx_sndudata(fd, unitdata, TX_XTI_API));
242*7c478bd9Sstevel@tonic-gate }
243*7c478bd9Sstevel@tonic-gate 
244*7c478bd9Sstevel@tonic-gate int
245*7c478bd9Sstevel@tonic-gate _xti_sndv(int fd, const struct t_iovec *tiov, unsigned int tiovcount, int flags)
246*7c478bd9Sstevel@tonic-gate {
247*7c478bd9Sstevel@tonic-gate 	return (_tx_sndv(fd, tiov, tiovcount, flags, TX_XTI_XNS5_API));
248*7c478bd9Sstevel@tonic-gate }
249*7c478bd9Sstevel@tonic-gate 
250*7c478bd9Sstevel@tonic-gate int
251*7c478bd9Sstevel@tonic-gate _xti_sndvudata(int fd, struct t_unitdata *unitdata, struct t_iovec *tiov,
252*7c478bd9Sstevel@tonic-gate     unsigned int tiovcount)
253*7c478bd9Sstevel@tonic-gate {
254*7c478bd9Sstevel@tonic-gate 	return (_tx_sndvudata(fd, unitdata, tiov, tiovcount, TX_XTI_XNS5_API));
255*7c478bd9Sstevel@tonic-gate }
256*7c478bd9Sstevel@tonic-gate 
257*7c478bd9Sstevel@tonic-gate const char *
258*7c478bd9Sstevel@tonic-gate _xti_strerror(int errnum)
259*7c478bd9Sstevel@tonic-gate {
260*7c478bd9Sstevel@tonic-gate 	return (_tx_strerror(errnum, TX_XTI_API));
261*7c478bd9Sstevel@tonic-gate }
262*7c478bd9Sstevel@tonic-gate 
263*7c478bd9Sstevel@tonic-gate int
264*7c478bd9Sstevel@tonic-gate _xti_sync(int fd)
265*7c478bd9Sstevel@tonic-gate {
266*7c478bd9Sstevel@tonic-gate 	return (_tx_sync(fd, TX_XTI_API));
267*7c478bd9Sstevel@tonic-gate }
268*7c478bd9Sstevel@tonic-gate 
269*7c478bd9Sstevel@tonic-gate int
270*7c478bd9Sstevel@tonic-gate _xti_sysconf(int name)
271*7c478bd9Sstevel@tonic-gate {
272*7c478bd9Sstevel@tonic-gate 	return (_tx_sysconf(name, TX_XTI_XNS5_API));
273*7c478bd9Sstevel@tonic-gate }
274*7c478bd9Sstevel@tonic-gate 
275*7c478bd9Sstevel@tonic-gate int
276*7c478bd9Sstevel@tonic-gate _xti_unbind(int fd)
277*7c478bd9Sstevel@tonic-gate {
278*7c478bd9Sstevel@tonic-gate 	return (_tx_unbind(fd, TX_XTI_API));
279*7c478bd9Sstevel@tonic-gate }
280