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
t_accept(int fd,int resfd,struct t_call * call)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 *
t_alloc(int fd,int struct_type,int fields)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
t_bind(int fd,struct t_bind * req,struct t_bind * ret)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
t_close(int fd)60 t_close(int fd)
61 {
62 	return (_tx_close(fd, TX_TLI_API));
63 }
64 
65 int
t_connect(int fd,struct t_call * sndcall,struct t_call * rcvcall)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
t_error(const char * s)76 t_error(const char *s)
77 {
78 	(void) _tx_error(s, TX_TLI_API);
79 }
80 
81 int
t_free(char * ptr,int struct_type)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
t_getinfo(int fd,struct t_info * info)93 t_getinfo(int fd, struct t_info *info)
94 {
95 	return (_tx_getinfo(fd, info, TX_TLI_API));
96 }
97 
98 int
t_getstate(int fd)99 t_getstate(int fd)
100 {
101 	return (_tx_getstate(fd, TX_TLI_API));
102 }
103 
104 int
t_listen(int fd,struct t_call * call)105 t_listen(int fd, struct t_call *call)
106 {
107 	return (_tx_listen(fd, call, TX_TLI_API));
108 }
109 
110 int
t_look(int fd)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
t_open(const char * path,int flags,struct t_info * info)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
t_optmgmt(int fd,struct t_optmgmt * req,struct t_optmgmt * ret)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
t_rcv(int fd,char * buf,unsigned int nbytes,int * flags)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
t_rcvconnect(int fd,struct t_call * call)140 t_rcvconnect(int fd, struct t_call *call)
141 {
142 	return (_tx_rcvconnect(fd, call, TX_TLI_API));
143 }
144 
145 int
t_rcvdis(int fd,struct t_discon * discon)146 t_rcvdis(int fd, struct t_discon *discon)
147 {
148 	return (_tx_rcvdis(fd, discon, TX_TLI_API));
149 }
150 
151 int
t_rcvrel(int fd)152 t_rcvrel(int fd)
153 {
154 	return (_tx_rcvrel(fd, TX_TLI_API));
155 }
156 
157 int
t_rcvudata(int fd,struct t_unitdata * unitdata,int * flags)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
t_rcvuderr(int fd,struct t_uderr * uderr)164 t_rcvuderr(int fd, struct t_uderr *uderr)
165 {
166 	return (_tx_rcvuderr(fd, uderr, TX_TLI_API));
167 }
168 
169 int
t_snd(int fd,char * buf,unsigned int nbytes,int flags)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
t_snddis(int fd,struct t_call * call)176 t_snddis(int fd, struct t_call *call)
177 {
178 	return (_tx_snddis(fd, call, TX_TLI_API));
179 }
180 
181 int
t_sndrel(int fd)182 t_sndrel(int fd)
183 {
184 	return (_tx_sndrel(fd, TX_TLI_API));
185 }
186 
187 int
t_sndudata(int fd,struct t_unitdata * unitdata)188 t_sndudata(int fd, struct t_unitdata *unitdata)
189 {
190 	return (_tx_sndudata(fd, unitdata, TX_TLI_API));
191 }
192 
193 char *
t_strerror(int errnum)194 t_strerror(int errnum)
195 {
196 	return (_tx_strerror(errnum, TX_TLI_API));
197 }
198 
199 int
t_sync(int fd)200 t_sync(int fd)
201 {
202 	return (_tx_sync(fd, TX_TLI_API));
203 }
204 
205 int
t_unbind(int fd)206 t_unbind(int fd)
207 {
208 	return (_tx_unbind(fd, TX_TLI_API));
209 }
210 
211 int
t_getname(int fd,struct netbuf * name,int type)212 t_getname(int fd, struct netbuf *name, int type)
213 {
214 	return (_tx_getname(fd, name, type, TX_TLI_API));
215 }
216