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