xref: /onnv-gate/usr/src/uts/common/sys/tpicommon.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 2003 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef _SYS_TPICOMMON_H
28*0Sstevel@tonic-gate #define	_SYS_TPICOMMON_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #include <sys/feature_tests.h>
33*0Sstevel@tonic-gate 
34*0Sstevel@tonic-gate #ifdef	__cplusplus
35*0Sstevel@tonic-gate extern "C" {
36*0Sstevel@tonic-gate #endif
37*0Sstevel@tonic-gate 
38*0Sstevel@tonic-gate /*
39*0Sstevel@tonic-gate  * WARNING: This header should not ever be included directly by application
40*0Sstevel@tonic-gate  * programs. It exists so that common definitions can be included by other
41*0Sstevel@tonic-gate  * system header files which define a documented interface. The interfaces
42*0Sstevel@tonic-gate  * that share and expose the definitions in this file are:
43*0Sstevel@tonic-gate  *
44*0Sstevel@tonic-gate  *	(1) TLI interface <tiuser.h>  (which includes <sys/tiuser.h> which
45*0Sstevel@tonic-gate  *				   includes this file)
46*0Sstevel@tonic-gate  *	(2) XTI interface <xti.h>
47*0Sstevel@tonic-gate  *	(3) Kernel Streams TPI message based inteface <sys/tihdr.h>
48*0Sstevel@tonic-gate  */
49*0Sstevel@tonic-gate 
50*0Sstevel@tonic-gate 
51*0Sstevel@tonic-gate /*
52*0Sstevel@tonic-gate  * The following are "t_errno" error codes needed by both the kernel
53*0Sstevel@tonic-gate  * level transport providers and the user level interfaces.
54*0Sstevel@tonic-gate  */
55*0Sstevel@tonic-gate 
56*0Sstevel@tonic-gate #define	TBADADDR	1	/* Incorrect address format */
57*0Sstevel@tonic-gate #define	TBADOPT		2	/* Incorrect options format */
58*0Sstevel@tonic-gate #define	TACCES		3	/* Illegal permissions */
59*0Sstevel@tonic-gate #define	TBADF		4	/* Illegal file descriptor */
60*0Sstevel@tonic-gate #define	TNOADDR		5	/* Couldn't allocate address */
61*0Sstevel@tonic-gate #define	TOUTSTATE	6	/* Routine will place interface out of state */
62*0Sstevel@tonic-gate #define	TBADSEQ		7	/* Illegal called/calling sequence number */
63*0Sstevel@tonic-gate #define	TSYSERR		8	/* System error */
64*0Sstevel@tonic-gate #define	TLOOK		9	/* An event requires attention */
65*0Sstevel@tonic-gate #define	TBADDATA	10	/* Illegal amount of data */
66*0Sstevel@tonic-gate #define	TBUFOVFLW	11	/* Buffer not large enough */
67*0Sstevel@tonic-gate #define	TFLOW		12	/* Can't send message - (blocked) */
68*0Sstevel@tonic-gate #define	TNODATA		13	/* No message currently available */
69*0Sstevel@tonic-gate #define	TNODIS		14	/* Disconnect message not found */
70*0Sstevel@tonic-gate #define	TNOUDERR	15	/* Unitdata error message not found */
71*0Sstevel@tonic-gate #define	TBADFLAG	16	/* Incorrect flags specified */
72*0Sstevel@tonic-gate #define	TNOREL		17	/* Orderly release message not found */
73*0Sstevel@tonic-gate #define	TNOTSUPPORT	18	/* Primitive not supported by provider */
74*0Sstevel@tonic-gate #define	TSTATECHNG	19	/* State is in process of changing */
75*0Sstevel@tonic-gate /*
76*0Sstevel@tonic-gate  * Following new error codes added to namespace with introduction of XTI
77*0Sstevel@tonic-gate  */
78*0Sstevel@tonic-gate #define	TNOSTRUCTYPE	20	/* Unsupported structure type requested */
79*0Sstevel@tonic-gate #define	TBADNAME	21	/* Invalid transport provider name */
80*0Sstevel@tonic-gate #define	TBADQLEN	22	/* Listener queue length limit is zero */
81*0Sstevel@tonic-gate #define	TADDRBUSY	23	/* Transport address is in use */
82*0Sstevel@tonic-gate #define	TINDOUT		24	/* Outstanding connection indications */
83*0Sstevel@tonic-gate #define	TPROVMISMATCH	25
84*0Sstevel@tonic-gate 			/* Listener-acceptor transport provider mismatch */
85*0Sstevel@tonic-gate 
86*0Sstevel@tonic-gate #define	TRESQLEN	26
87*0Sstevel@tonic-gate /* Connection acceptor has listen queue length limit greater than zero */
88*0Sstevel@tonic-gate 
89*0Sstevel@tonic-gate #define	TRESADDR	27
90*0Sstevel@tonic-gate /* Connection acceptor-listener addresses not same but required by transport */
91*0Sstevel@tonic-gate 
92*0Sstevel@tonic-gate #define	TQFULL		28	/* Incoming connection queue is full */
93*0Sstevel@tonic-gate #define	TPROTO		29	/* Protocol error on transport primitive */
94*0Sstevel@tonic-gate 
95*0Sstevel@tonic-gate /*
96*0Sstevel@tonic-gate  * Service type defines - used with T_info_ack
97*0Sstevel@tonic-gate  */
98*0Sstevel@tonic-gate #define	T_COTS	   1	/* connection oriented transport service	*/
99*0Sstevel@tonic-gate #define	T_COTS_ORD 2	/* connection oriented w/ orderly release	*/
100*0Sstevel@tonic-gate #define	T_CLTS	   3	/* connectionless transport service		*/
101*0Sstevel@tonic-gate /*
102*0Sstevel@tonic-gate  * NOT FOR PUBLIC USE, Solaris internal only.
103*0Sstevel@tonic-gate  * This value of nc_semantics is strictly for use of Remote Direct
104*0Sstevel@tonic-gate  * Memory Access provider interfaces in Solaris only and not for
105*0Sstevel@tonic-gate  * general use. Do not use this value for general purpose user or
106*0Sstevel@tonic-gate  * kernel programming. If used the behavior is undefined.
107*0Sstevel@tonic-gate  * This is a PRIVATE interface to be used by Solaris kRPC only.
108*0Sstevel@tonic-gate  */
109*0Sstevel@tonic-gate #define	T_RDMA	   4	/* rdma transport service			*/
110*0Sstevel@tonic-gate 
111*0Sstevel@tonic-gate 
112*0Sstevel@tonic-gate /*
113*0Sstevel@tonic-gate  * The following are the flag definitions needed by the
114*0Sstevel@tonic-gate  * user level library routines.
115*0Sstevel@tonic-gate  */
116*0Sstevel@tonic-gate 
117*0Sstevel@tonic-gate /*
118*0Sstevel@tonic-gate  * flags for option management request primitives
119*0Sstevel@tonic-gate  * Note:
120*0Sstevel@tonic-gate  * - This namespace is distinct from the namespace for data
121*0Sstevel@tonic-gate  *   primitives.
122*0Sstevel@tonic-gate  * - Flags T_NEGOTIATE, T_CHECK, T_DEFAULT, T_CURRENT
123*0Sstevel@tonic-gate  *   are associated with an option request
124*0Sstevel@tonic-gate  * - Flags T_SUCCESS, T_FAILURE, T_PARTSUCCESS, T_READONLY,
125*0Sstevel@tonic-gate  *   T_NOTSUPPORT are associated with results of option request.
126*0Sstevel@tonic-gate  */
127*0Sstevel@tonic-gate #define	T_NEGOTIATE	0x004	/* set opts request	*/
128*0Sstevel@tonic-gate #define	T_CHECK		0x008	/* check opts request	*/
129*0Sstevel@tonic-gate #define	T_DEFAULT	0x010	/* get default opts request */
130*0Sstevel@tonic-gate #define	T_SUCCESS	0x020	/* successful result */
131*0Sstevel@tonic-gate #define	T_FAILURE	0x040	/* failure result */
132*0Sstevel@tonic-gate #define	T_CURRENT	0x080	/* get current options request */
133*0Sstevel@tonic-gate #define	T_PARTSUCCESS	0x100	/* partial success result */
134*0Sstevel@tonic-gate #define	T_READONLY	0x200	/* read-only result */
135*0Sstevel@tonic-gate #define	T_NOTSUPPORT	0x400	/* not supported result */
136*0Sstevel@tonic-gate 
137*0Sstevel@tonic-gate 
138*0Sstevel@tonic-gate /*
139*0Sstevel@tonic-gate  * General purpose defines - used in multiple options context.
140*0Sstevel@tonic-gate  * They (T_YES and T_NO) need to be bitwise distinct from T_GARBAGE
141*0Sstevel@tonic-gate  * used with TCP level options by XTI for historical XTI specification
142*0Sstevel@tonic-gate  * reasons.
143*0Sstevel@tonic-gate  * (T_GARBAGE declared in <sys/xti_inet.h> included by <xti.h>).
144*0Sstevel@tonic-gate  */
145*0Sstevel@tonic-gate #define	T_YES			1
146*0Sstevel@tonic-gate #define	T_NO			0
147*0Sstevel@tonic-gate 
148*0Sstevel@tonic-gate /*
149*0Sstevel@tonic-gate  * Values used with struct T_info_ack fields
150*0Sstevel@tonic-gate  */
151*0Sstevel@tonic-gate #define	T_INFINITE		-1
152*0Sstevel@tonic-gate #define	T_INVALID		-2
153*0Sstevel@tonic-gate 
154*0Sstevel@tonic-gate /*
155*0Sstevel@tonic-gate  * Constants used with option management "name" or "value" fields.
156*0Sstevel@tonic-gate  */
157*0Sstevel@tonic-gate 
158*0Sstevel@tonic-gate /*
159*0Sstevel@tonic-gate  * XTI defined value reserved for stating 'unspecified' value used
160*0Sstevel@tonic-gate  * in some option namespaces.
161*0Sstevel@tonic-gate  */
162*0Sstevel@tonic-gate #define	T_UNSPEC	(~0-2)	/* applicable to ulong_t, long, char */
163*0Sstevel@tonic-gate 
164*0Sstevel@tonic-gate /*
165*0Sstevel@tonic-gate  * XTI inspired option management defined an option name T_ALLOPT
166*0Sstevel@tonic-gate  * to imply all options of a certain level.
167*0Sstevel@tonic-gate  * No option name (for any level) should be defined with constant value of
168*0Sstevel@tonic-gate  * T_ALLOPT (0).
169*0Sstevel@tonic-gate  */
170*0Sstevel@tonic-gate #define	T_ALLOPT	0	/* all options at any level */
171*0Sstevel@tonic-gate 
172*0Sstevel@tonic-gate /*
173*0Sstevel@tonic-gate  * An option specification consists of an opthdr, followed by the value of
174*0Sstevel@tonic-gate  * the option.  An options buffer contains one or more options.  The len
175*0Sstevel@tonic-gate  * field of opthdr specifies the length of the option value in bytes.  This
176*0Sstevel@tonic-gate  * length must be a multiple of sizeof (t_scalar_t) (use OPTLEN macro).
177*0Sstevel@tonic-gate  * This is an antique definition which is used (unofficially) by TLI but
178*0Sstevel@tonic-gate  * superceded in XTI.
179*0Sstevel@tonic-gate  */
180*0Sstevel@tonic-gate /*
181*0Sstevel@tonic-gate  * The opthdr types are now t_uscalar_t - inspired by XTI
182*0Sstevel@tonic-gate  */
183*0Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
184*0Sstevel@tonic-gate struct opthdr {
185*0Sstevel@tonic-gate 	t_uscalar_t	level;	/* protocol level affected */
186*0Sstevel@tonic-gate 	t_uscalar_t	name;	/* option to modify */
187*0Sstevel@tonic-gate 	t_uscalar_t	len;	/* length of option value */
188*0Sstevel@tonic-gate };
189*0Sstevel@tonic-gate 
190*0Sstevel@tonic-gate #define	OPTLEN(x) ((((x) + sizeof (t_uscalar_t) - 1) / \
191*0Sstevel@tonic-gate 		    sizeof (t_uscalar_t)) * sizeof (t_uscalar_t))
192*0Sstevel@tonic-gate #define	OPTVAL(opt) ((char *)(opt + 1))
193*0Sstevel@tonic-gate #endif	/* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
194*0Sstevel@tonic-gate 
195*0Sstevel@tonic-gate #ifdef	__cplusplus
196*0Sstevel@tonic-gate }
197*0Sstevel@tonic-gate #endif
198*0Sstevel@tonic-gate 
199*0Sstevel@tonic-gate #endif	/* _SYS_TPICOMMON_H */
200