xref: /onnv-gate/usr/src/lib/libbc/inc/include/nettli/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 /*	from S5R3 sys/tiuser.h	10.2.1.1" */
23*0Sstevel@tonic-gate 
24*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
25*0Sstevel@tonic-gate 
26*0Sstevel@tonic-gate /*	Copyright (c) 1984 AT&T	*/
27*0Sstevel@tonic-gate /*	  All Rights Reserved  	*/
28*0Sstevel@tonic-gate 
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate /* #ident	"@(#)kern-port:sys/tiuser.h	10.2.1.1" */
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifndef _nettli_tiuser_h
33*0Sstevel@tonic-gate #define _nettli_tiuser_h
34*0Sstevel@tonic-gate 
35*0Sstevel@tonic-gate /*
36*0Sstevel@tonic-gate  * The following are the error codes needed by both the kernel
37*0Sstevel@tonic-gate  * level transport providers and the user level library.
38*0Sstevel@tonic-gate  */
39*0Sstevel@tonic-gate #define	TBADADDR		1	/* incorrect addr format         */
40*0Sstevel@tonic-gate #define	TBADOPT			2	/* incorrect option format       */
41*0Sstevel@tonic-gate #define	TACCES			3	/* incorrect permissions         */
42*0Sstevel@tonic-gate #define TBADF			4	/* illegal transport fd	         */
43*0Sstevel@tonic-gate #define TNOADDR			5	/* couldn't allocate addr        */
44*0Sstevel@tonic-gate #define TOUTSTATE	        6	/* out of state                  */
45*0Sstevel@tonic-gate #define TBADSEQ		        7       /* bad call sequnce number       */
46*0Sstevel@tonic-gate #define TSYSERR			8	/* system error              */
47*0Sstevel@tonic-gate #define TLOOK		        9	/* event requires attention  */
48*0Sstevel@tonic-gate #define TBADDATA	       10	/* illegal amount of data    */
49*0Sstevel@tonic-gate #define TBUFOVFLW	       11       /* buffer not large enough   */
50*0Sstevel@tonic-gate #define TFLOW		       12 	/* flow control		     */
51*0Sstevel@tonic-gate #define	TNODATA		       13	/* no data		     */
52*0Sstevel@tonic-gate #define TNODIS		       14	/* discon_ind not found on q */
53*0Sstevel@tonic-gate #define TNOUDERR	       15	/* unitdata error not found  */
54*0Sstevel@tonic-gate #define TBADFLAG	       16       /* bad flags                 */
55*0Sstevel@tonic-gate #define TNOREL		       17       /* no ord rel found on q     */
56*0Sstevel@tonic-gate #define TNOTSUPPORT	       18       /* primitive not supported   */
57*0Sstevel@tonic-gate #define TSTATECHNG	       19	/* state is in process of changing */
58*0Sstevel@tonic-gate 
59*0Sstevel@tonic-gate /*
60*0Sstevel@tonic-gate  * The following are the events returned by t_look
61*0Sstevel@tonic-gate  */
62*0Sstevel@tonic-gate #define T_LISTEN	0x0001 	/* connection indication received */
63*0Sstevel@tonic-gate #define T_CONNECT	0x0002	/* connect confirmation received  */
64*0Sstevel@tonic-gate #define T_DATA		0x0004	/* normal data received           */
65*0Sstevel@tonic-gate #define	T_EXDATA	0x0008	/* expedited data received        */
66*0Sstevel@tonic-gate #define T_DISCONNECT	0x0010	/* disconnect received            */
67*0Sstevel@tonic-gate #define T_ERROR		0x0020	/* fatal error occurred		  */
68*0Sstevel@tonic-gate #define T_UDERR	 	0x0040	/* data gram error indication     */
69*0Sstevel@tonic-gate #define T_ORDREL	0x0080	/* orderly release indication     */
70*0Sstevel@tonic-gate #define T_EVENTS	0x00ff	/* event mask	                  */
71*0Sstevel@tonic-gate 
72*0Sstevel@tonic-gate /*
73*0Sstevel@tonic-gate  * The following are the flag definitions needed by the
74*0Sstevel@tonic-gate  * user level library routines.
75*0Sstevel@tonic-gate  */
76*0Sstevel@tonic-gate 
77*0Sstevel@tonic-gate #define T_MORE		0x001		/* more data        */
78*0Sstevel@tonic-gate #define T_EXPEDITED	0x002		/* expedited data   */
79*0Sstevel@tonic-gate #define T_NEGOTIATE	0x004		/* set opts         */
80*0Sstevel@tonic-gate #define T_CHECK		0x008		/* check opts       */
81*0Sstevel@tonic-gate #define T_DEFAULT	0x010		/* get default opts */
82*0Sstevel@tonic-gate #define T_SUCCESS	0x020		/* successful       */
83*0Sstevel@tonic-gate #define T_FAILURE	0x040		/* failure          */
84*0Sstevel@tonic-gate 
85*0Sstevel@tonic-gate /*
86*0Sstevel@tonic-gate  * protocol specific service limits
87*0Sstevel@tonic-gate  */
88*0Sstevel@tonic-gate 
89*0Sstevel@tonic-gate struct t_info {
90*0Sstevel@tonic-gate 	long addr;	/* size of protocol address                */
91*0Sstevel@tonic-gate 	long options;	/* size of protocol options                */
92*0Sstevel@tonic-gate 	long tsdu;	/* size of max transport service data unit */
93*0Sstevel@tonic-gate 	long etsdu;	/* size of max expedited tsdu              */
94*0Sstevel@tonic-gate 	long connect;	/* max data for connection primitives      */
95*0Sstevel@tonic-gate 	long discon;	/* max data for disconnect primitives      */
96*0Sstevel@tonic-gate 	long servtype;	/* provider service type		   */
97*0Sstevel@tonic-gate };
98*0Sstevel@tonic-gate 
99*0Sstevel@tonic-gate /*
100*0Sstevel@tonic-gate  * Service type defines
101*0Sstevel@tonic-gate  */
102*0Sstevel@tonic-gate #define T_COTS	   01	/* connection oriented transport service  */
103*0Sstevel@tonic-gate #define T_COTS_ORD 02	/* connection oriented w/ orderly release */
104*0Sstevel@tonic-gate #define T_CLTS	   03	/* connectionless transport service       */
105*0Sstevel@tonic-gate 
106*0Sstevel@tonic-gate /*
107*0Sstevel@tonic-gate  * netbuf structure
108*0Sstevel@tonic-gate  */
109*0Sstevel@tonic-gate 
110*0Sstevel@tonic-gate struct netbuf {
111*0Sstevel@tonic-gate 	unsigned int maxlen;
112*0Sstevel@tonic-gate 	unsigned int len;
113*0Sstevel@tonic-gate 	char *buf;
114*0Sstevel@tonic-gate };
115*0Sstevel@tonic-gate 
116*0Sstevel@tonic-gate /*
117*0Sstevel@tonic-gate  * t_bind - format of the addres and options arguments of bind
118*0Sstevel@tonic-gate  */
119*0Sstevel@tonic-gate 
120*0Sstevel@tonic-gate struct t_bind {
121*0Sstevel@tonic-gate 	struct netbuf	addr;
122*0Sstevel@tonic-gate 	unsigned	qlen;
123*0Sstevel@tonic-gate };
124*0Sstevel@tonic-gate 
125*0Sstevel@tonic-gate /*
126*0Sstevel@tonic-gate  * options management
127*0Sstevel@tonic-gate  */
128*0Sstevel@tonic-gate struct t_optmgmt {
129*0Sstevel@tonic-gate 	struct netbuf	opt;
130*0Sstevel@tonic-gate 	long		flags;
131*0Sstevel@tonic-gate };
132*0Sstevel@tonic-gate 
133*0Sstevel@tonic-gate /*
134*0Sstevel@tonic-gate  * disconnect structure
135*0Sstevel@tonic-gate  */
136*0Sstevel@tonic-gate struct t_discon {
137*0Sstevel@tonic-gate 	struct netbuf udata;		/* user data          */
138*0Sstevel@tonic-gate 	int reason;			/* reason code        */
139*0Sstevel@tonic-gate 	int sequence;			/* sequence number    */
140*0Sstevel@tonic-gate };
141*0Sstevel@tonic-gate 
142*0Sstevel@tonic-gate /*
143*0Sstevel@tonic-gate  * call structure
144*0Sstevel@tonic-gate  */
145*0Sstevel@tonic-gate struct t_call {
146*0Sstevel@tonic-gate 	struct netbuf addr;		/*  address           */
147*0Sstevel@tonic-gate 	struct netbuf opt;		/* options	      */
148*0Sstevel@tonic-gate 	struct netbuf udata;		/* user data          */
149*0Sstevel@tonic-gate 	int sequence;			/* sequence number    */
150*0Sstevel@tonic-gate };
151*0Sstevel@tonic-gate 
152*0Sstevel@tonic-gate /*
153*0Sstevel@tonic-gate  * data gram structure
154*0Sstevel@tonic-gate  */
155*0Sstevel@tonic-gate struct t_unitdata {
156*0Sstevel@tonic-gate 	struct netbuf addr;		/*  address           */
157*0Sstevel@tonic-gate 	struct netbuf opt;		/* options	      */
158*0Sstevel@tonic-gate 	struct netbuf udata;		/* user data          */
159*0Sstevel@tonic-gate };
160*0Sstevel@tonic-gate 
161*0Sstevel@tonic-gate /*
162*0Sstevel@tonic-gate  * unitdata error
163*0Sstevel@tonic-gate  */
164*0Sstevel@tonic-gate struct t_uderr {
165*0Sstevel@tonic-gate 	struct netbuf addr;		/* address		*/
166*0Sstevel@tonic-gate 	struct netbuf opt;		/* options 		*/
167*0Sstevel@tonic-gate 	long	      error;		/* error code		*/
168*0Sstevel@tonic-gate };
169*0Sstevel@tonic-gate 
170*0Sstevel@tonic-gate /*
171*0Sstevel@tonic-gate  * The following are structure types used when dynamically
172*0Sstevel@tonic-gate  * allocating the above structures via t_structalloc().
173*0Sstevel@tonic-gate  */
174*0Sstevel@tonic-gate #define T_BIND		1		/* struct t_bind	*/
175*0Sstevel@tonic-gate #define T_OPTMGMT	2		/* struct t_optmgmt	*/
176*0Sstevel@tonic-gate #define T_CALL		3		/* struct t_call	*/
177*0Sstevel@tonic-gate #define T_DIS		4		/* struct t_discon	*/
178*0Sstevel@tonic-gate #define T_UNITDATA	5		/* struct t_unitdata	*/
179*0Sstevel@tonic-gate #define T_UDERROR	6		/* struct t_uderr	*/
180*0Sstevel@tonic-gate #define T_INFO		7		/* struct t_info	*/
181*0Sstevel@tonic-gate 
182*0Sstevel@tonic-gate /*
183*0Sstevel@tonic-gate  * The following bits specify which fields of the above
184*0Sstevel@tonic-gate  * structures should be allocated by t_structalloc().
185*0Sstevel@tonic-gate  */
186*0Sstevel@tonic-gate #define T_ADDR	0x01			/* address   */
187*0Sstevel@tonic-gate #define T_OPT	0x02			/* options   */
188*0Sstevel@tonic-gate #define T_UDATA	0x04			/* user data */
189*0Sstevel@tonic-gate #define T_ALL	0x07			/* all the above */
190*0Sstevel@tonic-gate 
191*0Sstevel@tonic-gate 
192*0Sstevel@tonic-gate /*
193*0Sstevel@tonic-gate  * the following are the states for the user
194*0Sstevel@tonic-gate  */
195*0Sstevel@tonic-gate 
196*0Sstevel@tonic-gate #define T_UNINIT	0		/* uninitialized  		*/
197*0Sstevel@tonic-gate #define T_UNBND		1		/* unbound 	      		*/
198*0Sstevel@tonic-gate #define T_IDLE		2		/* idle				*/
199*0Sstevel@tonic-gate #define	T_OUTCON	3		/* outgoing connection pending 	*/
200*0Sstevel@tonic-gate #define T_INCON		4		/* incoming connection pending  */
201*0Sstevel@tonic-gate #define T_DATAXFER	5		/* data transfer		*/
202*0Sstevel@tonic-gate #define T_OUTREL        6               /* outgoing release pending     */
203*0Sstevel@tonic-gate #define T_INREL		7		/* incoming release pending     */
204*0Sstevel@tonic-gate 
205*0Sstevel@tonic-gate #define T_NOSTATES 	8
206*0Sstevel@tonic-gate 
207*0Sstevel@tonic-gate 
208*0Sstevel@tonic-gate 
209*0Sstevel@tonic-gate #define ROUNDUP(X)	((X + 0x03)&~0x03)
210*0Sstevel@tonic-gate 
211*0Sstevel@tonic-gate /*
212*0Sstevel@tonic-gate  * Macro for converting signal number to a mask suitable for
213*0Sstevel@tonic-gate  * sigblock().
214*0Sstevel@tonic-gate  */
215*0Sstevel@tonic-gate #define sigmask(m)	(1 << ((m)-1))
216*0Sstevel@tonic-gate 
217*0Sstevel@tonic-gate #endif /*!_nettli_tiuser_h*/
218