xref: /onnv-gate/usr/src/uts/common/sys/tiuser.h (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 (c) 1984, 1986, 1987, 1988, 1989 AT&T
24*0Sstevel@tonic-gate  * All Rights Reserved
25*0Sstevel@tonic-gate  *
26*0Sstevel@tonic-gate  */
27*0Sstevel@tonic-gate 
28*0Sstevel@tonic-gate /*
29*0Sstevel@tonic-gate  * Copyright 2002 Sun Microsystems, Inc.  All rights reserved.
30*0Sstevel@tonic-gate  * Use is subject to license terms.
31*0Sstevel@tonic-gate  */
32*0Sstevel@tonic-gate 
33*0Sstevel@tonic-gate #ifndef _SYS_TIUSER_H
34*0Sstevel@tonic-gate #define	_SYS_TIUSER_H
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
37*0Sstevel@tonic-gate 
38*0Sstevel@tonic-gate #include <sys/types.h>
39*0Sstevel@tonic-gate /*
40*0Sstevel@tonic-gate  * The following include file has declarations needed by both the kernel
41*0Sstevel@tonic-gate  * level transport providers and the user level library.
42*0Sstevel@tonic-gate  */
43*0Sstevel@tonic-gate #include <sys/tpicommon.h>
44*0Sstevel@tonic-gate 
45*0Sstevel@tonic-gate #ifdef	__cplusplus
46*0Sstevel@tonic-gate extern "C" {
47*0Sstevel@tonic-gate #endif
48*0Sstevel@tonic-gate 
49*0Sstevel@tonic-gate 
50*0Sstevel@tonic-gate /*
51*0Sstevel@tonic-gate  * The following are the events returned by t_look
52*0Sstevel@tonic-gate  */
53*0Sstevel@tonic-gate #define	T_LISTEN	0x0001	/* connection indication received	*/
54*0Sstevel@tonic-gate #define	T_CONNECT	0x0002	/* connect confirmation received	*/
55*0Sstevel@tonic-gate #define	T_DATA		0x0004	/* normal data received			*/
56*0Sstevel@tonic-gate #define	T_EXDATA	0x0008	/* expedited data received		*/
57*0Sstevel@tonic-gate #define	T_DISCONNECT	0x0010	/* disconnect received			*/
58*0Sstevel@tonic-gate #define	T_ERROR		0x0020	/* fatal error occurred			*/
59*0Sstevel@tonic-gate #define	T_UDERR		0x0040	/* data gram error indication		*/
60*0Sstevel@tonic-gate #define	T_ORDREL	0x0080	/* orderly release indication		*/
61*0Sstevel@tonic-gate #define	T_EVENTS	0x00ff	/* event mask				*/
62*0Sstevel@tonic-gate 
63*0Sstevel@tonic-gate /*
64*0Sstevel@tonic-gate  * Flags for data primitives.
65*0Sstevel@tonic-gate  */
66*0Sstevel@tonic-gate #define	T_MORE		0x001	/* more data		*/
67*0Sstevel@tonic-gate #define	T_EXPEDITED	0x002	/* expedited data	*/
68*0Sstevel@tonic-gate 
69*0Sstevel@tonic-gate 
70*0Sstevel@tonic-gate /*
71*0Sstevel@tonic-gate  * protocol specific service limits
72*0Sstevel@tonic-gate  */
73*0Sstevel@tonic-gate 
74*0Sstevel@tonic-gate struct t_info {
75*0Sstevel@tonic-gate 	t_scalar_t addr;	/* size of protocol address		*/
76*0Sstevel@tonic-gate 	t_scalar_t options;	/* size of protocol options		*/
77*0Sstevel@tonic-gate 	t_scalar_t tsdu;	/* size of max transport service data unit */
78*0Sstevel@tonic-gate 	t_scalar_t etsdu;	/* size of max expedited tsdu		*/
79*0Sstevel@tonic-gate 	t_scalar_t connect;	/* max data for connection primitives	*/
80*0Sstevel@tonic-gate 	t_scalar_t discon;	/* max data for disconnect primitives	*/
81*0Sstevel@tonic-gate 	t_scalar_t servtype;	/* provider service type		*/
82*0Sstevel@tonic-gate };
83*0Sstevel@tonic-gate 
84*0Sstevel@tonic-gate /*
85*0Sstevel@tonic-gate  * netbuf structure
86*0Sstevel@tonic-gate  */
87*0Sstevel@tonic-gate 
88*0Sstevel@tonic-gate struct netbuf {
89*0Sstevel@tonic-gate 	unsigned int	maxlen;
90*0Sstevel@tonic-gate 	unsigned int	len;
91*0Sstevel@tonic-gate 	char		*buf;
92*0Sstevel@tonic-gate };
93*0Sstevel@tonic-gate 
94*0Sstevel@tonic-gate #ifdef _SYSCALL32
95*0Sstevel@tonic-gate struct netbuf32 {
96*0Sstevel@tonic-gate 	uint32_t	maxlen;
97*0Sstevel@tonic-gate 	uint32_t	len;
98*0Sstevel@tonic-gate 	caddr32_t	buf;
99*0Sstevel@tonic-gate };
100*0Sstevel@tonic-gate #endif /* _SYSCALL32 */
101*0Sstevel@tonic-gate 
102*0Sstevel@tonic-gate /*
103*0Sstevel@tonic-gate  * t_bind - format of the address and options arguments of bind
104*0Sstevel@tonic-gate  */
105*0Sstevel@tonic-gate 
106*0Sstevel@tonic-gate struct t_bind {
107*0Sstevel@tonic-gate 	struct netbuf	addr;
108*0Sstevel@tonic-gate 	unsigned int	qlen;
109*0Sstevel@tonic-gate };
110*0Sstevel@tonic-gate 
111*0Sstevel@tonic-gate /*
112*0Sstevel@tonic-gate  * options management
113*0Sstevel@tonic-gate  */
114*0Sstevel@tonic-gate struct t_optmgmt {
115*0Sstevel@tonic-gate 	struct netbuf	opt;
116*0Sstevel@tonic-gate 	t_scalar_t	flags;
117*0Sstevel@tonic-gate };
118*0Sstevel@tonic-gate 
119*0Sstevel@tonic-gate /*
120*0Sstevel@tonic-gate  * disconnect structure
121*0Sstevel@tonic-gate  */
122*0Sstevel@tonic-gate struct t_discon {
123*0Sstevel@tonic-gate 	struct netbuf	udata;		/* user data		*/
124*0Sstevel@tonic-gate 	int		reason;		/* reason code		*/
125*0Sstevel@tonic-gate 	int		sequence;	/* sequence number	*/
126*0Sstevel@tonic-gate };
127*0Sstevel@tonic-gate 
128*0Sstevel@tonic-gate /*
129*0Sstevel@tonic-gate  * call structure
130*0Sstevel@tonic-gate  */
131*0Sstevel@tonic-gate struct t_call {
132*0Sstevel@tonic-gate 	struct netbuf	addr;		/*  address		*/
133*0Sstevel@tonic-gate 	struct netbuf	opt;		/* options		*/
134*0Sstevel@tonic-gate 	struct netbuf	udata;		/* user data		*/
135*0Sstevel@tonic-gate 	int		sequence;	/* sequence number	*/
136*0Sstevel@tonic-gate };
137*0Sstevel@tonic-gate 
138*0Sstevel@tonic-gate /*
139*0Sstevel@tonic-gate  * data gram structure
140*0Sstevel@tonic-gate  */
141*0Sstevel@tonic-gate struct t_unitdata {
142*0Sstevel@tonic-gate 	struct netbuf	addr;		/*  address		*/
143*0Sstevel@tonic-gate 	struct netbuf	opt;		/* options		*/
144*0Sstevel@tonic-gate 	struct netbuf	udata;		/* user data		*/
145*0Sstevel@tonic-gate };
146*0Sstevel@tonic-gate 
147*0Sstevel@tonic-gate /*
148*0Sstevel@tonic-gate  * unitdata error
149*0Sstevel@tonic-gate  */
150*0Sstevel@tonic-gate struct t_uderr {
151*0Sstevel@tonic-gate 	struct netbuf	addr;		/* address		*/
152*0Sstevel@tonic-gate 	struct netbuf	opt;		/* options 		*/
153*0Sstevel@tonic-gate 	t_scalar_t	error;		/* error code		*/
154*0Sstevel@tonic-gate };
155*0Sstevel@tonic-gate 
156*0Sstevel@tonic-gate /*
157*0Sstevel@tonic-gate  * The following are structure types used when dynamically
158*0Sstevel@tonic-gate  * allocating the above structures via t_structalloc().
159*0Sstevel@tonic-gate  */
160*0Sstevel@tonic-gate #define	T_BIND		1		/* struct t_bind	*/
161*0Sstevel@tonic-gate #define	T_OPTMGMT	2		/* struct t_optmgmt	*/
162*0Sstevel@tonic-gate #define	T_CALL		3		/* struct t_call	*/
163*0Sstevel@tonic-gate #define	T_DIS		4		/* struct t_discon	*/
164*0Sstevel@tonic-gate #define	T_UNITDATA	5		/* struct t_unitdata	*/
165*0Sstevel@tonic-gate #define	T_UDERROR	6		/* struct t_uderr	*/
166*0Sstevel@tonic-gate #define	T_INFO		7		/* struct t_info	*/
167*0Sstevel@tonic-gate 
168*0Sstevel@tonic-gate /*
169*0Sstevel@tonic-gate  * The following bits specify which fields of the above
170*0Sstevel@tonic-gate  * structures should be allocated by t_structalloc().
171*0Sstevel@tonic-gate  */
172*0Sstevel@tonic-gate #define	T_ADDR	0x01			/* address		*/
173*0Sstevel@tonic-gate #define	T_OPT	0x02			/* options		*/
174*0Sstevel@tonic-gate #define	T_UDATA	0x04			/* user data		*/
175*0Sstevel@tonic-gate #define	T_ALL	0x07			/* all the above	*/
176*0Sstevel@tonic-gate 
177*0Sstevel@tonic-gate /*
178*0Sstevel@tonic-gate  * the following are the states for the user
179*0Sstevel@tonic-gate  */
180*0Sstevel@tonic-gate 
181*0Sstevel@tonic-gate #define	T_UNINIT	0		/* uninitialized		*/
182*0Sstevel@tonic-gate #define	T_UNBND		1		/* unbound			*/
183*0Sstevel@tonic-gate #define	T_IDLE		2		/* idle				*/
184*0Sstevel@tonic-gate #define	T_OUTCON	3		/* outgoing connection pending 	*/
185*0Sstevel@tonic-gate #define	T_INCON		4		/* incoming connection pending	*/
186*0Sstevel@tonic-gate #define	T_DATAXFER	5		/* data transfer		*/
187*0Sstevel@tonic-gate #define	T_OUTREL	6		/* outgoing release pending	*/
188*0Sstevel@tonic-gate #define	T_INREL		7		/* incoming release pending	*/
189*0Sstevel@tonic-gate #define	T_BADSTATE	8		/* illegal state */
190*0Sstevel@tonic-gate 
191*0Sstevel@tonic-gate /*
192*0Sstevel@tonic-gate  * Flags for t_getname.
193*0Sstevel@tonic-gate  */
194*0Sstevel@tonic-gate #define	LOCALNAME	0
195*0Sstevel@tonic-gate #define	REMOTENAME	1
196*0Sstevel@tonic-gate 
197*0Sstevel@tonic-gate #if defined(__STDC__)
198*0Sstevel@tonic-gate 
199*0Sstevel@tonic-gate extern int t_accept(int fildes, int resfd, struct t_call *call);
200*0Sstevel@tonic-gate extern char *t_alloc(int fildes, int struct_type, int fields);
201*0Sstevel@tonic-gate extern int t_bind(int fildes, struct t_bind *req, struct t_bind *ret);
202*0Sstevel@tonic-gate extern int t_close(int fildes);
203*0Sstevel@tonic-gate extern int t_connect(int fildes, struct t_call *sndcall,
204*0Sstevel@tonic-gate 		    struct t_call *rcvcall);
205*0Sstevel@tonic-gate extern void t_error(const char *errmsg);
206*0Sstevel@tonic-gate extern int t_free(char *ptr, int struct_type);
207*0Sstevel@tonic-gate extern int t_getinfo(int fildes, struct t_info *info);
208*0Sstevel@tonic-gate extern int t_getname(int fildes, struct netbuf *name, int type);
209*0Sstevel@tonic-gate extern int t_getstate(int fildes);
210*0Sstevel@tonic-gate extern int t_listen(int fildes, struct t_call *call);
211*0Sstevel@tonic-gate extern int t_look(int fildes);
212*0Sstevel@tonic-gate extern int t_open(const char *path, int oflag, struct t_info *info);
213*0Sstevel@tonic-gate extern int t_optmgmt(int fildes, struct t_optmgmt *req,
214*0Sstevel@tonic-gate 		    struct t_optmgmt *ret);
215*0Sstevel@tonic-gate extern int t_rcv(int fildes, char *buf, unsigned nbytes, int *flags);
216*0Sstevel@tonic-gate extern int t_rcvconnect(int fildes, struct t_call *call);
217*0Sstevel@tonic-gate extern int t_rcvdis(int fildes, struct t_discon *discon);
218*0Sstevel@tonic-gate extern int t_rcvrel(int fildes);
219*0Sstevel@tonic-gate extern int t_rcvudata(int fildes, struct t_unitdata *unitdata, int *flags);
220*0Sstevel@tonic-gate extern int t_rcvuderr(int fildes, struct t_uderr *uderr);
221*0Sstevel@tonic-gate extern int t_snd(int fildes, char *buf, unsigned nbytes, int flags);
222*0Sstevel@tonic-gate extern int t_snddis(int fildes, struct t_call *call);
223*0Sstevel@tonic-gate extern int t_sndrel(int fildes);
224*0Sstevel@tonic-gate extern int t_sndudata(int fildes, struct t_unitdata *unitdata);
225*0Sstevel@tonic-gate extern char *t_strerror(int errnum);
226*0Sstevel@tonic-gate extern int t_sync(int fildes);
227*0Sstevel@tonic-gate extern int t_unbind(int fildes);
228*0Sstevel@tonic-gate 
229*0Sstevel@tonic-gate /*
230*0Sstevel@tonic-gate  *	N.B.:  this interface is deprecated.  Use t_strerror() instead.
231*0Sstevel@tonic-gate  */
232*0Sstevel@tonic-gate extern char *t_errlist[];
233*0Sstevel@tonic-gate extern int t_nerr;
234*0Sstevel@tonic-gate 
235*0Sstevel@tonic-gate #endif /* __STDC__ */
236*0Sstevel@tonic-gate 
237*0Sstevel@tonic-gate #ifdef	__cplusplus
238*0Sstevel@tonic-gate }
239*0Sstevel@tonic-gate #endif
240*0Sstevel@tonic-gate 
241*0Sstevel@tonic-gate #endif	/* _SYS_TIUSER_H */
242