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