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