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