xref: /illumos-gate/usr/src/lib/libnsl/nsl/tli_wrappers.c (revision 581cede61ac9c14d8d4ea452562a567189eead78)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #include "mt.h"
30 #include <tiuser.h>
31 #include <unistd.h>
32 #include <stropts.h>
33 
34 /*
35  * TLI_WRAPPERS is defined below, before inclusion of "tx.h". This is
36  * done so that the function prototypes and associated data structure
37  * definitions of new interfaces introduced in XNS 5 are not seen
38  * in this file.
39  */
40 #define	TLI_WRAPPERS
41 #include "tx.h"
42 
43 int
44 t_accept(int fd, int resfd, struct t_call *call)
45 {
46 	return (_tx_accept(fd, resfd, call, TX_TLI_API));
47 }
48 
49 char *
50 t_alloc(int fd, int struct_type, int fields)
51 {
52 	return (_tx_alloc(fd, struct_type, fields, TX_TLI_API));
53 }
54 
55 int
56 t_bind(int fd, struct t_bind *req, struct t_bind *ret)
57 {
58 	return (_tx_bind(fd, req, ret, TX_TLI_API));
59 }
60 
61 int
62 t_close(int fd)
63 {
64 	return (_tx_close(fd, TX_TLI_API));
65 }
66 
67 int
68 t_connect(int fd, struct t_call *sndcall, struct t_call *rcvcall)
69 {
70 	return (_tx_connect(fd, sndcall, rcvcall, TX_TLI_API));
71 }
72 
73 /*
74  * Note t_error() return type changed by XTI to be char *. The spec should
75  * probably be fixed to make it void *
76  */
77 void
78 t_error(const char *s)
79 {
80 	(void) _tx_error(s, TX_TLI_API);
81 }
82 
83 int
84 t_free(char *ptr, int struct_type)
85 {
86 	return (_tx_free(ptr, struct_type, TX_TLI_API));
87 }
88 
89 /*
90  * Note: The "struct t_info" parameter here refers to XTI one which
91  * added a field. The implmentation should not reference it. The applications
92  * will pass the shorter TLI one.
93  */
94 int
95 t_getinfo(int fd, struct t_info *info)
96 {
97 	return (_tx_getinfo(fd, info, TX_TLI_API));
98 }
99 
100 int
101 t_getstate(int fd)
102 {
103 	return (_tx_getstate(fd, TX_TLI_API));
104 }
105 
106 int
107 t_listen(int fd, struct t_call *call)
108 {
109 	return (_tx_listen(fd, call, TX_TLI_API));
110 }
111 
112 int
113 t_look(int fd)
114 {
115 	return (_tx_look(fd, TX_TLI_API));
116 }
117 
118 /*
119  * Note: The "struct t_info" parameter here refers to XTI one which
120  * added a field. The implmentation should not reference it. The applications
121  * will pass the shorter TLI one.
122  */
123 int
124 t_open(const char *path, int flags, struct t_info *info)
125 {
126 	return (_tx_open(path, flags, info, TX_TLI_API));
127 }
128 
129 int
130 t_optmgmt(int fd, struct t_optmgmt *req, struct t_optmgmt *ret)
131 {
132 	return (_tx_optmgmt(fd, req, ret, TX_TLI_API));
133 }
134 
135 int
136 t_rcv(int fd, char *buf, unsigned int nbytes, int *flags)
137 {
138 	return (_tx_rcv(fd, buf, nbytes, flags, TX_TLI_API));
139 }
140 
141 int
142 t_rcvconnect(int fd, struct t_call *call)
143 {
144 	return (_tx_rcvconnect(fd, call, TX_TLI_API));
145 }
146 
147 int
148 t_rcvdis(int fd, struct t_discon *discon)
149 {
150 	return (_tx_rcvdis(fd, discon, TX_TLI_API));
151 }
152 
153 int
154 t_rcvrel(int fd)
155 {
156 	return (_tx_rcvrel(fd, TX_TLI_API));
157 }
158 
159 int
160 t_rcvudata(int fd, struct t_unitdata *unitdata, int *flags)
161 {
162 	return (_tx_rcvudata(fd, unitdata, flags, TX_TLI_API));
163 }
164 
165 int
166 t_rcvuderr(int fd, struct t_uderr *uderr)
167 {
168 	return (_tx_rcvuderr(fd, uderr, TX_TLI_API));
169 }
170 
171 int
172 t_snd(int fd, char *buf, unsigned int nbytes, int flags)
173 {
174 	return (_tx_snd(fd, buf, nbytes, flags, TX_TLI_API));
175 }
176 
177 int
178 t_snddis(int fd, struct t_call *call)
179 {
180 	return (_tx_snddis(fd, call, TX_TLI_API));
181 }
182 
183 int
184 t_sndrel(int fd)
185 {
186 	return (_tx_sndrel(fd, TX_TLI_API));
187 }
188 
189 int
190 t_sndudata(int fd, struct t_unitdata *unitdata)
191 {
192 	return (_tx_sndudata(fd, unitdata, TX_TLI_API));
193 }
194 
195 char *
196 t_strerror(int errnum)
197 {
198 	return (_tx_strerror(errnum, TX_TLI_API));
199 }
200 
201 int
202 t_sync(int fd)
203 {
204 	return (_tx_sync(fd, TX_TLI_API));
205 }
206 
207 int
208 t_unbind(int fd)
209 {
210 	return (_tx_unbind(fd, TX_TLI_API));
211 }
212 
213 int
214 t_getname(int fd, struct netbuf *name, int type)
215 {
216 	return (_tx_getname(fd, name, type, TX_TLI_API));
217 }
218