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