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