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