xref: /illumos-gate/usr/src/lib/libnsl/nsl/tli_wrappers.c (revision 9164a50bf932130cbb5097a16f6986873ce0e6e5)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #include "mt.h"
28 #include <tiuser.h>
29 #include <unistd.h>
30 #include <stropts.h>
31 
32 /*
33  * TLI_WRAPPERS is defined below, before inclusion of "tx.h". This is
34  * done so that the function prototypes and associated data structure
35  * definitions of new interfaces introduced in XNS 5 are not seen
36  * in this file.
37  */
38 #define	TLI_WRAPPERS
39 #include "tx.h"
40 
41 int
42 t_accept(int fd, int resfd, struct t_call *call)
43 {
44 	return (_tx_accept(fd, resfd, call, TX_TLI_API));
45 }
46 
47 char *
48 t_alloc(int fd, int struct_type, int fields)
49 {
50 	return (_tx_alloc(fd, struct_type, fields, TX_TLI_API));
51 }
52 
53 int
54 t_bind(int fd, struct t_bind *req, struct t_bind *ret)
55 {
56 	return (_tx_bind(fd, req, ret, TX_TLI_API));
57 }
58 
59 int
60 t_close(int fd)
61 {
62 	return (_tx_close(fd, TX_TLI_API));
63 }
64 
65 int
66 t_connect(int fd, struct t_call *sndcall, struct t_call *rcvcall)
67 {
68 	return (_tx_connect(fd, sndcall, rcvcall, TX_TLI_API));
69 }
70 
71 /*
72  * Note t_error() return type changed by XTI to be char *. The spec should
73  * probably be fixed to make it void *
74  */
75 void
76 t_error(const char *s)
77 {
78 	(void) _tx_error(s, TX_TLI_API);
79 }
80 
81 int
82 t_free(char *ptr, int struct_type)
83 {
84 	return (_tx_free(ptr, struct_type, TX_TLI_API));
85 }
86 
87 /*
88  * Note: The "struct t_info" parameter here refers to XTI one which
89  * added a field. The implmentation should not reference it. The applications
90  * will pass the shorter TLI one.
91  */
92 int
93 t_getinfo(int fd, struct t_info *info)
94 {
95 	return (_tx_getinfo(fd, info, TX_TLI_API));
96 }
97 
98 int
99 t_getstate(int fd)
100 {
101 	return (_tx_getstate(fd, TX_TLI_API));
102 }
103 
104 int
105 t_listen(int fd, struct t_call *call)
106 {
107 	return (_tx_listen(fd, call, TX_TLI_API));
108 }
109 
110 int
111 t_look(int fd)
112 {
113 	return (_tx_look(fd, TX_TLI_API));
114 }
115 
116 /*
117  * Note: The "struct t_info" parameter here refers to XTI one which
118  * added a field. The implmentation should not reference it. The applications
119  * will pass the shorter TLI one.
120  */
121 int
122 t_open(const char *path, int flags, struct t_info *info)
123 {
124 	return (_tx_open(path, flags, info, TX_TLI_API));
125 }
126 
127 int
128 t_optmgmt(int fd, struct t_optmgmt *req, struct t_optmgmt *ret)
129 {
130 	return (_tx_optmgmt(fd, req, ret, TX_TLI_API));
131 }
132 
133 int
134 t_rcv(int fd, char *buf, unsigned int nbytes, int *flags)
135 {
136 	return (_tx_rcv(fd, buf, nbytes, flags, TX_TLI_API));
137 }
138 
139 int
140 t_rcvconnect(int fd, struct t_call *call)
141 {
142 	return (_tx_rcvconnect(fd, call, TX_TLI_API));
143 }
144 
145 int
146 t_rcvdis(int fd, struct t_discon *discon)
147 {
148 	return (_tx_rcvdis(fd, discon, TX_TLI_API));
149 }
150 
151 int
152 t_rcvrel(int fd)
153 {
154 	return (_tx_rcvrel(fd, TX_TLI_API));
155 }
156 
157 int
158 t_rcvudata(int fd, struct t_unitdata *unitdata, int *flags)
159 {
160 	return (_tx_rcvudata(fd, unitdata, flags, TX_TLI_API));
161 }
162 
163 int
164 t_rcvuderr(int fd, struct t_uderr *uderr)
165 {
166 	return (_tx_rcvuderr(fd, uderr, TX_TLI_API));
167 }
168 
169 int
170 t_snd(int fd, char *buf, unsigned int nbytes, int flags)
171 {
172 	return (_tx_snd(fd, buf, nbytes, flags, TX_TLI_API));
173 }
174 
175 int
176 t_snddis(int fd, struct t_call *call)
177 {
178 	return (_tx_snddis(fd, call, TX_TLI_API));
179 }
180 
181 int
182 t_sndrel(int fd)
183 {
184 	return (_tx_sndrel(fd, TX_TLI_API));
185 }
186 
187 int
188 t_sndudata(int fd, struct t_unitdata *unitdata)
189 {
190 	return (_tx_sndudata(fd, unitdata, TX_TLI_API));
191 }
192 
193 char *
194 t_strerror(int errnum)
195 {
196 	return (_tx_strerror(errnum, TX_TLI_API));
197 }
198 
199 int
200 t_sync(int fd)
201 {
202 	return (_tx_sync(fd, TX_TLI_API));
203 }
204 
205 int
206 t_unbind(int fd)
207 {
208 	return (_tx_unbind(fd, TX_TLI_API));
209 }
210 
211 int
212 t_getname(int fd, struct netbuf *name, int type)
213 {
214 	return (_tx_getname(fd, name, type, TX_TLI_API));
215 }
216