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 #include "mt.h"
28*7c478bd9Sstevel@tonic-gate #include <xti.h>
29*7c478bd9Sstevel@tonic-gate #include <unistd.h>
30*7c478bd9Sstevel@tonic-gate #include <stropts.h>
31*7c478bd9Sstevel@tonic-gate #include <sys/stream.h>
32*7c478bd9Sstevel@tonic-gate #include "tx.h"
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate /*
35*7c478bd9Sstevel@tonic-gate  * Prefix: _xti_
36*7c478bd9Sstevel@tonic-gate  *
37*7c478bd9Sstevel@tonic-gate  * The _xti_ prefix is the default prefix for these functions. A function
38*7c478bd9Sstevel@tonic-gate  * having the _xti_ prefix means one of the following.
39*7c478bd9Sstevel@tonic-gate  *	a. This interface remains unchanged in all versions of XTI, starting
40*7c478bd9Sstevel@tonic-gate  *	   with the version of XTI in which it was first introduced.
41*7c478bd9Sstevel@tonic-gate  *	   Consequently there is no other entry point, with a different
42*7c478bd9Sstevel@tonic-gate  *	   prefix for this interface.
43*7c478bd9Sstevel@tonic-gate  *	b. This interface has changed subsequent to when it was first. This
44*7c478bd9Sstevel@tonic-gate  *	   function is meant for compatibility and provides the semantics of
45*7c478bd9Sstevel@tonic-gate  *	   the XTI version when it was first introduced.
46*7c478bd9Sstevel@tonic-gate  *
47*7c478bd9Sstevel@tonic-gate  * The _xti_xns5_ prefix is used for functions that provide XNS Issue 5
48*7c478bd9Sstevel@tonic-gate  * (UNIX98) semantics. It means the following.
49*7c478bd9Sstevel@tonic-gate  *	   The UNIX98 version of this interface has different semantics
50*7c478bd9Sstevel@tonic-gate  *	   as compared to UNIX95, and this function provides UNIX98 semantics
51*7c478bd9Sstevel@tonic-gate  *
52*7c478bd9Sstevel@tonic-gate  */
53*7c478bd9Sstevel@tonic-gate 
54*7c478bd9Sstevel@tonic-gate int
_xti_accept(int fd,int resfd,const struct t_call * call)55*7c478bd9Sstevel@tonic-gate _xti_accept(int fd, int resfd, const struct t_call *call)
56*7c478bd9Sstevel@tonic-gate {
57*7c478bd9Sstevel@tonic-gate 	return (_tx_accept(fd, resfd, call, TX_XTI_API));
58*7c478bd9Sstevel@tonic-gate }
59*7c478bd9Sstevel@tonic-gate 
60*7c478bd9Sstevel@tonic-gate int
_xti_xns5_accept(int fd,int resfd,const struct t_call * call)61*7c478bd9Sstevel@tonic-gate _xti_xns5_accept(int fd, int resfd, const struct t_call *call)
62*7c478bd9Sstevel@tonic-gate {
63*7c478bd9Sstevel@tonic-gate 	return (_tx_accept(fd, resfd, call, TX_XTI_XNS5_API));
64*7c478bd9Sstevel@tonic-gate }
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate void *
_xti_alloc(int fd,int struct_type,int fields)67*7c478bd9Sstevel@tonic-gate _xti_alloc(int fd, int struct_type, int fields)
68*7c478bd9Sstevel@tonic-gate {
69*7c478bd9Sstevel@tonic-gate 	return (_tx_alloc(fd, struct_type, fields, TX_XTI_API));
70*7c478bd9Sstevel@tonic-gate }
71*7c478bd9Sstevel@tonic-gate 
72*7c478bd9Sstevel@tonic-gate int
_xti_bind(int fd,const struct t_bind * req,struct t_bind * ret)73*7c478bd9Sstevel@tonic-gate _xti_bind(int fd, const struct t_bind *req, struct t_bind *ret)
74*7c478bd9Sstevel@tonic-gate {
75*7c478bd9Sstevel@tonic-gate 	return (_tx_bind(fd, req, ret, TX_XTI_API));
76*7c478bd9Sstevel@tonic-gate }
77*7c478bd9Sstevel@tonic-gate 
78*7c478bd9Sstevel@tonic-gate int
_xti_close(int fd)79*7c478bd9Sstevel@tonic-gate _xti_close(int fd)
80*7c478bd9Sstevel@tonic-gate {
81*7c478bd9Sstevel@tonic-gate 	return (_tx_close(fd, TX_XTI_API));
82*7c478bd9Sstevel@tonic-gate }
83*7c478bd9Sstevel@tonic-gate 
84*7c478bd9Sstevel@tonic-gate int
_xti_connect(int fd,const struct t_call * sndcall,struct t_call * rcvcall)85*7c478bd9Sstevel@tonic-gate _xti_connect(int fd, const struct t_call *sndcall, struct t_call *rcvcall)
86*7c478bd9Sstevel@tonic-gate {
87*7c478bd9Sstevel@tonic-gate 	return (_tx_connect(fd, sndcall, rcvcall, TX_XTI_API));
88*7c478bd9Sstevel@tonic-gate }
89*7c478bd9Sstevel@tonic-gate 
90*7c478bd9Sstevel@tonic-gate /*
91*7c478bd9Sstevel@tonic-gate  * Note: The TLI version of t_error has return type void. XTI has "int".
92*7c478bd9Sstevel@tonic-gate  * The spec probably needs to change to void *
93*7c478bd9Sstevel@tonic-gate  */
94*7c478bd9Sstevel@tonic-gate int
_xti_error(const char * errmsg)95*7c478bd9Sstevel@tonic-gate _xti_error(const char *errmsg)
96*7c478bd9Sstevel@tonic-gate {
97*7c478bd9Sstevel@tonic-gate 	return (_tx_error(errmsg, TX_XTI_API));
98*7c478bd9Sstevel@tonic-gate }
99*7c478bd9Sstevel@tonic-gate 
100*7c478bd9Sstevel@tonic-gate int
_xti_free(void * ptr,int struct_type)101*7c478bd9Sstevel@tonic-gate _xti_free(void *ptr, int struct_type)
102*7c478bd9Sstevel@tonic-gate {
103*7c478bd9Sstevel@tonic-gate 	return (_tx_free(ptr, struct_type, TX_XTI_API));
104*7c478bd9Sstevel@tonic-gate }
105*7c478bd9Sstevel@tonic-gate 
106*7c478bd9Sstevel@tonic-gate int
_xti_getinfo(int fd,struct t_info * info)107*7c478bd9Sstevel@tonic-gate _xti_getinfo(int fd, struct t_info *info)
108*7c478bd9Sstevel@tonic-gate {
109*7c478bd9Sstevel@tonic-gate 	return (_tx_getinfo(fd, info, TX_XTI_API));
110*7c478bd9Sstevel@tonic-gate }
111*7c478bd9Sstevel@tonic-gate 
112*7c478bd9Sstevel@tonic-gate int
_xti_getprotaddr(int fd,struct t_bind * boundaddr,struct t_bind * peeraddr)113*7c478bd9Sstevel@tonic-gate _xti_getprotaddr(int fd, struct t_bind *boundaddr, struct t_bind *peeraddr)
114*7c478bd9Sstevel@tonic-gate {
115*7c478bd9Sstevel@tonic-gate 	return (_tx_getprotaddr(fd, boundaddr, peeraddr, TX_XTI_API));
116*7c478bd9Sstevel@tonic-gate }
117*7c478bd9Sstevel@tonic-gate 
118*7c478bd9Sstevel@tonic-gate int
_xti_getstate(int fd)119*7c478bd9Sstevel@tonic-gate _xti_getstate(int fd)
120*7c478bd9Sstevel@tonic-gate {
121*7c478bd9Sstevel@tonic-gate 	return (_tx_getstate(fd, TX_XTI_API));
122*7c478bd9Sstevel@tonic-gate }
123*7c478bd9Sstevel@tonic-gate 
124*7c478bd9Sstevel@tonic-gate int
_xti_listen(int fd,struct t_call * call)125*7c478bd9Sstevel@tonic-gate _xti_listen(int fd, struct t_call *call)
126*7c478bd9Sstevel@tonic-gate {
127*7c478bd9Sstevel@tonic-gate 	return (_tx_listen(fd, call, TX_XTI_API));
128*7c478bd9Sstevel@tonic-gate }
129*7c478bd9Sstevel@tonic-gate 
130*7c478bd9Sstevel@tonic-gate int
_xti_look(int fd)131*7c478bd9Sstevel@tonic-gate _xti_look(int fd)
132*7c478bd9Sstevel@tonic-gate {
133*7c478bd9Sstevel@tonic-gate 	return (_tx_look(fd, TX_XTI_API));
134*7c478bd9Sstevel@tonic-gate }
135*7c478bd9Sstevel@tonic-gate 
136*7c478bd9Sstevel@tonic-gate int
_xti_open(const char * path,int flags,struct t_info * info)137*7c478bd9Sstevel@tonic-gate _xti_open(const char *path, int flags, struct t_info *info)
138*7c478bd9Sstevel@tonic-gate {
139*7c478bd9Sstevel@tonic-gate 	return (_tx_open(path, flags, info, TX_XTI_API));
140*7c478bd9Sstevel@tonic-gate }
141*7c478bd9Sstevel@tonic-gate 
142*7c478bd9Sstevel@tonic-gate int
_xti_optmgmt(int fd,const struct t_optmgmt * req,struct t_optmgmt * ret)143*7c478bd9Sstevel@tonic-gate _xti_optmgmt(int fd, const struct t_optmgmt *req, struct t_optmgmt *ret)
144*7c478bd9Sstevel@tonic-gate {
145*7c478bd9Sstevel@tonic-gate 	return (_tx_optmgmt(fd, req, ret, TX_XTI_API));
146*7c478bd9Sstevel@tonic-gate }
147*7c478bd9Sstevel@tonic-gate 
148*7c478bd9Sstevel@tonic-gate int
_xti_rcv(int fd,void * buf,unsigned int nbytes,int * flags)149*7c478bd9Sstevel@tonic-gate _xti_rcv(int fd, void *buf, unsigned int nbytes, int *flags)
150*7c478bd9Sstevel@tonic-gate {
151*7c478bd9Sstevel@tonic-gate 	return (_tx_rcv(fd, buf, nbytes, flags, TX_XTI_API));
152*7c478bd9Sstevel@tonic-gate }
153*7c478bd9Sstevel@tonic-gate 
154*7c478bd9Sstevel@tonic-gate int
_xti_rcvconnect(int fd,struct t_call * call)155*7c478bd9Sstevel@tonic-gate _xti_rcvconnect(int fd, struct t_call *call)
156*7c478bd9Sstevel@tonic-gate {
157*7c478bd9Sstevel@tonic-gate 	return (_tx_rcvconnect(fd, call, TX_XTI_API));
158*7c478bd9Sstevel@tonic-gate }
159*7c478bd9Sstevel@tonic-gate 
160*7c478bd9Sstevel@tonic-gate int
_xti_rcvdis(int fd,struct t_discon * discon)161*7c478bd9Sstevel@tonic-gate _xti_rcvdis(int fd, struct t_discon *discon)
162*7c478bd9Sstevel@tonic-gate {
163*7c478bd9Sstevel@tonic-gate 	return (_tx_rcvdis(fd, discon, TX_XTI_API));
164*7c478bd9Sstevel@tonic-gate }
165*7c478bd9Sstevel@tonic-gate 
166*7c478bd9Sstevel@tonic-gate int
_xti_rcvrel(int fd)167*7c478bd9Sstevel@tonic-gate _xti_rcvrel(int fd)
168*7c478bd9Sstevel@tonic-gate {
169*7c478bd9Sstevel@tonic-gate 	return (_tx_rcvrel(fd, TX_XTI_API));
170*7c478bd9Sstevel@tonic-gate }
171*7c478bd9Sstevel@tonic-gate 
172*7c478bd9Sstevel@tonic-gate int
_xti_rcvreldata(int fd,struct t_discon * discon)173*7c478bd9Sstevel@tonic-gate _xti_rcvreldata(int fd, struct t_discon *discon)
174*7c478bd9Sstevel@tonic-gate {
175*7c478bd9Sstevel@tonic-gate 	return (_tx_rcvreldata(fd, discon, TX_XTI_XNS5_API));
176*7c478bd9Sstevel@tonic-gate }
177*7c478bd9Sstevel@tonic-gate 
178*7c478bd9Sstevel@tonic-gate int
_xti_rcvudata(int fd,struct t_unitdata * unitdata,int * flags)179*7c478bd9Sstevel@tonic-gate _xti_rcvudata(int fd, struct t_unitdata *unitdata, int *flags)
180*7c478bd9Sstevel@tonic-gate {
181*7c478bd9Sstevel@tonic-gate 	return (_tx_rcvudata(fd, unitdata, flags, TX_XTI_API));
182*7c478bd9Sstevel@tonic-gate }
183*7c478bd9Sstevel@tonic-gate 
184*7c478bd9Sstevel@tonic-gate int
_xti_rcvuderr(int fd,struct t_uderr * uderr)185*7c478bd9Sstevel@tonic-gate _xti_rcvuderr(int fd, struct t_uderr *uderr)
186*7c478bd9Sstevel@tonic-gate {
187*7c478bd9Sstevel@tonic-gate 	return (_tx_rcvuderr(fd, uderr, TX_XTI_API));
188*7c478bd9Sstevel@tonic-gate }
189*7c478bd9Sstevel@tonic-gate 
190*7c478bd9Sstevel@tonic-gate int
_xti_rcvv(int fd,struct t_iovec * tiov,unsigned int tiovcount,int * flags)191*7c478bd9Sstevel@tonic-gate _xti_rcvv(int fd, struct t_iovec *tiov, unsigned int tiovcount, int *flags)
192*7c478bd9Sstevel@tonic-gate {
193*7c478bd9Sstevel@tonic-gate 	return (_tx_rcvv(fd, tiov, tiovcount, flags, TX_XTI_XNS5_API));
194*7c478bd9Sstevel@tonic-gate }
195*7c478bd9Sstevel@tonic-gate 
196*7c478bd9Sstevel@tonic-gate int
_xti_rcvvudata(int fd,struct t_unitdata * unitdata,struct t_iovec * tiov,unsigned int tiovcount,int * flags)197*7c478bd9Sstevel@tonic-gate _xti_rcvvudata(int fd, struct t_unitdata *unitdata, struct t_iovec *tiov,
198*7c478bd9Sstevel@tonic-gate     unsigned int tiovcount, int *flags)
199*7c478bd9Sstevel@tonic-gate {
200*7c478bd9Sstevel@tonic-gate 	return (_tx_rcvvudata(fd, unitdata, tiov, tiovcount, flags,
201*7c478bd9Sstevel@tonic-gate 	    TX_XTI_XNS5_API));
202*7c478bd9Sstevel@tonic-gate }
203*7c478bd9Sstevel@tonic-gate 
204*7c478bd9Sstevel@tonic-gate int
_xti_snd(int fd,void * buf,unsigned int nbytes,int flags)205*7c478bd9Sstevel@tonic-gate _xti_snd(int fd, void *buf, unsigned int nbytes, int flags)
206*7c478bd9Sstevel@tonic-gate {
207*7c478bd9Sstevel@tonic-gate 	return (_tx_snd(fd, buf, nbytes, flags, TX_XTI_API));
208*7c478bd9Sstevel@tonic-gate }
209*7c478bd9Sstevel@tonic-gate 
210*7c478bd9Sstevel@tonic-gate int
_xti_xns5_snd(int fd,void * buf,unsigned int nbytes,int flags)211*7c478bd9Sstevel@tonic-gate _xti_xns5_snd(int fd, void *buf, unsigned int nbytes, int flags)
212*7c478bd9Sstevel@tonic-gate {
213*7c478bd9Sstevel@tonic-gate 	return (_tx_snd(fd, buf, nbytes, flags, TX_XTI_XNS5_API));
214*7c478bd9Sstevel@tonic-gate }
215*7c478bd9Sstevel@tonic-gate 
216*7c478bd9Sstevel@tonic-gate int
_xti_snddis(int fd,const struct t_call * call)217*7c478bd9Sstevel@tonic-gate _xti_snddis(int fd, const struct t_call *call)
218*7c478bd9Sstevel@tonic-gate {
219*7c478bd9Sstevel@tonic-gate 	return (_tx_snddis(fd, call, TX_XTI_API));
220*7c478bd9Sstevel@tonic-gate 
221*7c478bd9Sstevel@tonic-gate }
222*7c478bd9Sstevel@tonic-gate 
223*7c478bd9Sstevel@tonic-gate int
_xti_sndrel(int fd)224*7c478bd9Sstevel@tonic-gate _xti_sndrel(int fd)
225*7c478bd9Sstevel@tonic-gate {
226*7c478bd9Sstevel@tonic-gate 	return (_tx_sndrel(fd, TX_XTI_API));
227*7c478bd9Sstevel@tonic-gate }
228*7c478bd9Sstevel@tonic-gate 
229*7c478bd9Sstevel@tonic-gate int
_xti_sndreldata(int fd,struct t_discon * discon)230*7c478bd9Sstevel@tonic-gate _xti_sndreldata(int fd, struct t_discon *discon)
231*7c478bd9Sstevel@tonic-gate {
232*7c478bd9Sstevel@tonic-gate 	return (_tx_sndreldata(fd, discon, TX_XTI_XNS5_API));
233*7c478bd9Sstevel@tonic-gate }
234*7c478bd9Sstevel@tonic-gate 
235*7c478bd9Sstevel@tonic-gate int
_xti_sndudata(int fd,const struct t_unitdata * unitdata)236*7c478bd9Sstevel@tonic-gate _xti_sndudata(int fd, const struct t_unitdata *unitdata)
237*7c478bd9Sstevel@tonic-gate {
238*7c478bd9Sstevel@tonic-gate 	return (_tx_sndudata(fd, unitdata, TX_XTI_API));
239*7c478bd9Sstevel@tonic-gate }
240*7c478bd9Sstevel@tonic-gate 
241*7c478bd9Sstevel@tonic-gate int
_xti_sndv(int fd,const struct t_iovec * tiov,unsigned int tiovcount,int flags)242*7c478bd9Sstevel@tonic-gate _xti_sndv(int fd, const struct t_iovec *tiov, unsigned int tiovcount, int flags)
243*7c478bd9Sstevel@tonic-gate {
244*7c478bd9Sstevel@tonic-gate 	return (_tx_sndv(fd, tiov, tiovcount, flags, TX_XTI_XNS5_API));
245*7c478bd9Sstevel@tonic-gate }
246*7c478bd9Sstevel@tonic-gate 
247*7c478bd9Sstevel@tonic-gate int
_xti_sndvudata(int fd,struct t_unitdata * unitdata,struct t_iovec * tiov,unsigned int tiovcount)248*7c478bd9Sstevel@tonic-gate _xti_sndvudata(int fd, struct t_unitdata *unitdata, struct t_iovec *tiov,
249*7c478bd9Sstevel@tonic-gate     unsigned int tiovcount)
250*7c478bd9Sstevel@tonic-gate {
251*7c478bd9Sstevel@tonic-gate 	return (_tx_sndvudata(fd, unitdata, tiov, tiovcount, TX_XTI_XNS5_API));
252*7c478bd9Sstevel@tonic-gate }
253*7c478bd9Sstevel@tonic-gate 
254*7c478bd9Sstevel@tonic-gate const char *
_xti_strerror(int errnum)255*7c478bd9Sstevel@tonic-gate _xti_strerror(int errnum)
256*7c478bd9Sstevel@tonic-gate {
257*7c478bd9Sstevel@tonic-gate 	return (_tx_strerror(errnum, TX_XTI_API));
258*7c478bd9Sstevel@tonic-gate }
259*7c478bd9Sstevel@tonic-gate 
260*7c478bd9Sstevel@tonic-gate int
_xti_sync(int fd)261*7c478bd9Sstevel@tonic-gate _xti_sync(int fd)
262*7c478bd9Sstevel@tonic-gate {
263*7c478bd9Sstevel@tonic-gate 	return (_tx_sync(fd, TX_XTI_API));
264*7c478bd9Sstevel@tonic-gate }
265*7c478bd9Sstevel@tonic-gate 
266*7c478bd9Sstevel@tonic-gate int
_xti_sysconf(int name)267*7c478bd9Sstevel@tonic-gate _xti_sysconf(int name)
268*7c478bd9Sstevel@tonic-gate {
269*7c478bd9Sstevel@tonic-gate 	return (_tx_sysconf(name, TX_XTI_XNS5_API));
270*7c478bd9Sstevel@tonic-gate }
271*7c478bd9Sstevel@tonic-gate 
272*7c478bd9Sstevel@tonic-gate int
_xti_unbind(int fd)273*7c478bd9Sstevel@tonic-gate _xti_unbind(int fd)
274*7c478bd9Sstevel@tonic-gate {
275*7c478bd9Sstevel@tonic-gate 	return (_tx_unbind(fd, TX_XTI_API));
276*7c478bd9Sstevel@tonic-gate }
277