xref: /onnv-gate/usr/src/uts/common/sys/xti_inet.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 /*	Copyright (c) 1996-1998 Sun Microsystems, Inc.	*/
23*0Sstevel@tonic-gate /*	  All Rights Reserved  	*/
24*0Sstevel@tonic-gate 
25*0Sstevel@tonic-gate /*
26*0Sstevel@tonic-gate  * This is a private header file. Applications should not directly include
27*0Sstevel@tonic-gate  * this file. Instead they should include <xti_inet.h>
28*0Sstevel@tonic-gate  */
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #ifndef _SYS_XTI_INET_H
31*0Sstevel@tonic-gate #define	_SYS_XTI_INET_H
32*0Sstevel@tonic-gate 
33*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
34*0Sstevel@tonic-gate 
35*0Sstevel@tonic-gate #include <sys/types.h>
36*0Sstevel@tonic-gate 
37*0Sstevel@tonic-gate #ifdef	__cplusplus
38*0Sstevel@tonic-gate extern "C" {
39*0Sstevel@tonic-gate #endif
40*0Sstevel@tonic-gate 
41*0Sstevel@tonic-gate /*
42*0Sstevel@tonic-gate  * This is a private header file. Applications should not directly include
43*0Sstevel@tonic-gate  * this file. Instead they should include <xti_inet.h>
44*0Sstevel@tonic-gate  */
45*0Sstevel@tonic-gate 
46*0Sstevel@tonic-gate #if !defined(_XPG5)
47*0Sstevel@tonic-gate 
48*0Sstevel@tonic-gate /*
49*0Sstevel@tonic-gate  * INTERNET SPECIFIC ENVIRONMENT
50*0Sstevel@tonic-gate  *
51*0Sstevel@tonic-gate  * Note:
52*0Sstevel@tonic-gate  * Unfortunately, XTI specification test assertions require exposing in
53*0Sstevel@tonic-gate  * headers options that are not implemented. They also require exposing
54*0Sstevel@tonic-gate  * Internet and OSI related options as part of inclusion of <xti.h>
55*0Sstevel@tonic-gate  *
56*0Sstevel@tonic-gate  * Also XTI specification intrudes on <netinet/in.h> TCP_ and IP_ namespaces
57*0Sstevel@tonic-gate  * and sometimes redefines the semantics or types of some options with a
58*0Sstevel@tonic-gate  * different history in that namespace. The name and binary value are exposed
59*0Sstevel@tonic-gate  * but option semantics may be different from what is in XTI spec and we defer
60*0Sstevel@tonic-gate  * to the <netinet/in.h> precedent.
61*0Sstevel@tonic-gate  *
62*0Sstevel@tonic-gate  * New applications should not use these constants. These are meant
63*0Sstevel@tonic-gate  * for compatibility with older applications.
64*0Sstevel@tonic-gate  */
65*0Sstevel@tonic-gate 
66*0Sstevel@tonic-gate /*
67*0Sstevel@tonic-gate  * TCP level
68*0Sstevel@tonic-gate  */
69*0Sstevel@tonic-gate #define	INET_TCP	6 /* must be same as IPPROTO_TCP in <netinet/in.h> */
70*0Sstevel@tonic-gate 
71*0Sstevel@tonic-gate /*
72*0Sstevel@tonic-gate  * TCP level options
73*0Sstevel@tonic-gate  */
74*0Sstevel@tonic-gate #ifndef TCP_NODELAY
75*0Sstevel@tonic-gate #define	TCP_NODELAY	0x1	/* must be same as <netinet/tcp.h> */
76*0Sstevel@tonic-gate #endif
77*0Sstevel@tonic-gate 
78*0Sstevel@tonic-gate #ifndef TCP_MAXSEG
79*0Sstevel@tonic-gate #define	TCP_MAXSEG	0x2	/* must be same as <netinet/tcp.h> */
80*0Sstevel@tonic-gate #endif
81*0Sstevel@tonic-gate 
82*0Sstevel@tonic-gate #ifndef TCP_KEEPALIVE
83*0Sstevel@tonic-gate #define	TCP_KEEPALIVE	0x8	/* must be same as <netinet/tcp.h> */
84*0Sstevel@tonic-gate #endif
85*0Sstevel@tonic-gate 
86*0Sstevel@tonic-gate #endif /* !defined(_XPG5) */
87*0Sstevel@tonic-gate 
88*0Sstevel@tonic-gate /*
89*0Sstevel@tonic-gate  * New applications must not use the constants defined above. Instead
90*0Sstevel@tonic-gate  * they must use the constants with the T_ prefix defined below. The
91*0Sstevel@tonic-gate  * constants without the T_ prefix are meant for compatibility with
92*0Sstevel@tonic-gate  * older applications.
93*0Sstevel@tonic-gate  */
94*0Sstevel@tonic-gate 
95*0Sstevel@tonic-gate /*
96*0Sstevel@tonic-gate  * TCP level
97*0Sstevel@tonic-gate  */
98*0Sstevel@tonic-gate #define	T_INET_TCP	6
99*0Sstevel@tonic-gate 
100*0Sstevel@tonic-gate #define	T_TCP_NODELAY	0x1	/* Don't delay packets to coalesce */
101*0Sstevel@tonic-gate #define	T_TCP_MAXSEG	0x2	/* Get maximum segment size */
102*0Sstevel@tonic-gate #define	T_TCP_KEEPALIVE	0x8	/* check, if connections are alive */
103*0Sstevel@tonic-gate 
104*0Sstevel@tonic-gate /*
105*0Sstevel@tonic-gate  * Structure used with TCP_KEEPALIVE option.
106*0Sstevel@tonic-gate  */
107*0Sstevel@tonic-gate struct t_kpalive {
108*0Sstevel@tonic-gate 	t_scalar_t	kp_onoff;	/* option on/off */
109*0Sstevel@tonic-gate 	t_scalar_t	kp_timeout;	/* timeout in minutes */
110*0Sstevel@tonic-gate };
111*0Sstevel@tonic-gate 
112*0Sstevel@tonic-gate 
113*0Sstevel@tonic-gate #if !defined(_XPG5)
114*0Sstevel@tonic-gate 
115*0Sstevel@tonic-gate /*
116*0Sstevel@tonic-gate  * New applications must not use the constants defined below. Instead they
117*0Sstevel@tonic-gate  * must use the corresponding T_prefix constants. The constants without the
118*0Sstevel@tonic-gate  * T_ prefix are supported for legacy applications.
119*0Sstevel@tonic-gate  */
120*0Sstevel@tonic-gate 
121*0Sstevel@tonic-gate #define	T_GARBAGE		0x02 /* send garbage byte */
122*0Sstevel@tonic-gate 
123*0Sstevel@tonic-gate /*
124*0Sstevel@tonic-gate  * UDP level
125*0Sstevel@tonic-gate  */
126*0Sstevel@tonic-gate #define	INET_UDP	17 /* must be same as IPPROTO_UDP in <netinet/in.h> */
127*0Sstevel@tonic-gate 
128*0Sstevel@tonic-gate 
129*0Sstevel@tonic-gate /*
130*0Sstevel@tonic-gate  * UDP level Options
131*0Sstevel@tonic-gate  */
132*0Sstevel@tonic-gate 
133*0Sstevel@tonic-gate #ifndef UDP_CHECKSUM
134*0Sstevel@tonic-gate #define	UDP_CHECKSUM	0x0600	/* must be same as in <netinet/udp.h> */
135*0Sstevel@tonic-gate #endif
136*0Sstevel@tonic-gate 
137*0Sstevel@tonic-gate /*
138*0Sstevel@tonic-gate  * IP level
139*0Sstevel@tonic-gate  */
140*0Sstevel@tonic-gate #define	INET_IP	0	/* must be same as IPPROTO_IP in <netinet/in.h> */
141*0Sstevel@tonic-gate 
142*0Sstevel@tonic-gate /*
143*0Sstevel@tonic-gate  * IP level Options
144*0Sstevel@tonic-gate  */
145*0Sstevel@tonic-gate 
146*0Sstevel@tonic-gate #ifndef IP_OPTIONS
147*0Sstevel@tonic-gate #define	IP_OPTIONS	0x1	/* must be same as <netinet/in.h> */
148*0Sstevel@tonic-gate #endif
149*0Sstevel@tonic-gate 
150*0Sstevel@tonic-gate #ifndef IP_TOS
151*0Sstevel@tonic-gate #define	IP_TOS		0x3	/* must be same as <netinet/in.h> */
152*0Sstevel@tonic-gate #endif
153*0Sstevel@tonic-gate 
154*0Sstevel@tonic-gate #ifndef IP_TTL
155*0Sstevel@tonic-gate #define	IP_TTL		0x4	/* must be same as <netinet/in.h> */
156*0Sstevel@tonic-gate #endif
157*0Sstevel@tonic-gate 
158*0Sstevel@tonic-gate /*
159*0Sstevel@tonic-gate  * following also added to <netinet/in.h> and be in sync to keep namespace
160*0Sstevel@tonic-gate  * sane
161*0Sstevel@tonic-gate  */
162*0Sstevel@tonic-gate 
163*0Sstevel@tonic-gate #ifndef IP_REUSEADDR
164*0Sstevel@tonic-gate #define	IP_REUSEADDR	0x104	/* allow local address reuse */
165*0Sstevel@tonic-gate #endif
166*0Sstevel@tonic-gate 
167*0Sstevel@tonic-gate #ifndef IP_DONTROUTE
168*0Sstevel@tonic-gate #define	IP_DONTROUTE	0x105	/* just use interface addresses */
169*0Sstevel@tonic-gate #endif
170*0Sstevel@tonic-gate 
171*0Sstevel@tonic-gate #ifndef IP_BROADCAST
172*0Sstevel@tonic-gate #define	IP_BROADCAST	0x106	/* permit sending of broadcast msgs */
173*0Sstevel@tonic-gate #endif
174*0Sstevel@tonic-gate 
175*0Sstevel@tonic-gate #endif /* !defined(_XPG5) */
176*0Sstevel@tonic-gate 
177*0Sstevel@tonic-gate /*
178*0Sstevel@tonic-gate  * New applications should use the T_ prefix constants below
179*0Sstevel@tonic-gate  */
180*0Sstevel@tonic-gate 
181*0Sstevel@tonic-gate /*
182*0Sstevel@tonic-gate  * UDP level
183*0Sstevel@tonic-gate  */
184*0Sstevel@tonic-gate #define	T_INET_UDP	17
185*0Sstevel@tonic-gate 
186*0Sstevel@tonic-gate /*
187*0Sstevel@tonic-gate  * UDP level Options
188*0Sstevel@tonic-gate  */
189*0Sstevel@tonic-gate #define	T_UDP_CHECKSUM	0x0600	/* Checksum computation */
190*0Sstevel@tonic-gate 
191*0Sstevel@tonic-gate /*
192*0Sstevel@tonic-gate  * IP level
193*0Sstevel@tonic-gate  */
194*0Sstevel@tonic-gate #define	T_INET_IP	0
195*0Sstevel@tonic-gate 
196*0Sstevel@tonic-gate /*
197*0Sstevel@tonic-gate  * IP level Options
198*0Sstevel@tonic-gate  */
199*0Sstevel@tonic-gate #define	T_IP_TTL	0x4	/* IP per packet time to live */
200*0Sstevel@tonic-gate #define	T_IP_REUSEADDR	0x104	/* allow local address reuse */
201*0Sstevel@tonic-gate #define	T_IP_DONTROUTE	0x105	/* just use interface addresses */
202*0Sstevel@tonic-gate #define	T_IP_BROADCAST	0x106	/* permit sending of broadcast msgs */
203*0Sstevel@tonic-gate #define	T_IP_OPTIONS	0x107	/* IP per-packet options */
204*0Sstevel@tonic-gate #define	T_IP_TOS	0x108	/* IP per packet type of service */
205*0Sstevel@tonic-gate 
206*0Sstevel@tonic-gate /*
207*0Sstevel@tonic-gate  * IP_TOS precedence level
208*0Sstevel@tonic-gate  */
209*0Sstevel@tonic-gate #define	T_ROUTINE			0
210*0Sstevel@tonic-gate #define	T_PRIORITY			1
211*0Sstevel@tonic-gate #define	T_IMMEDIATE			2
212*0Sstevel@tonic-gate #define	T_FLASH				3
213*0Sstevel@tonic-gate #define	T_OVERRIDEFLASH			4
214*0Sstevel@tonic-gate #define	T_CRITIC_ECP			5
215*0Sstevel@tonic-gate #define	T_INETCONTROL			6
216*0Sstevel@tonic-gate #define	T_NETCONTROL			7
217*0Sstevel@tonic-gate 
218*0Sstevel@tonic-gate 
219*0Sstevel@tonic-gate /*
220*0Sstevel@tonic-gate  * IP_TOS type of service
221*0Sstevel@tonic-gate  */
222*0Sstevel@tonic-gate #define	T_NOTOS		0
223*0Sstevel@tonic-gate #define	T_LDELAY	(1<<4)
224*0Sstevel@tonic-gate #define	T_HITHRPT	(1<<3)
225*0Sstevel@tonic-gate #define	T_HIREL		(1<<2)
226*0Sstevel@tonic-gate #define	T_LOCOST	(1<<1)
227*0Sstevel@tonic-gate 
228*0Sstevel@tonic-gate #define	SET_TOS(prec, tos)	((0x7 & (prec)) << 5 | (0x1e & (tos)))
229*0Sstevel@tonic-gate 
230*0Sstevel@tonic-gate #ifdef	__cplusplus
231*0Sstevel@tonic-gate }
232*0Sstevel@tonic-gate #endif
233*0Sstevel@tonic-gate 
234*0Sstevel@tonic-gate #endif	/* _SYS_XTI_INET_H */
235