Merge commit '7e3488dc6cdcb0c04e1ce167a1a3bfef83b5f2e0'
[unleashed.git] / include / sys / xti_inet.h
blob503e79595c3836a72635edf29d36bc201b2d4278
1 /*
2 * CDDL HEADER START
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.
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.
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]
20 * CDDL HEADER END
22 /* Copyright (c) 1996-1998 Sun Microsystems, Inc. */
23 /* All Rights Reserved */
26 * This is a private header file. Applications should not directly include
27 * this file. Instead they should include <xti_inet.h>
30 #ifndef _SYS_XTI_INET_H
31 #define _SYS_XTI_INET_H
33 #include <sys/types.h>
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
40 * This is a private header file. Applications should not directly include
41 * this file. Instead they should include <xti_inet.h>
44 #if !defined(_XPG5)
47 * INTERNET SPECIFIC ENVIRONMENT
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>
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.
60 * New applications should not use these constants. These are meant
61 * for compatibility with older applications.
65 * TCP level
67 #define INET_TCP 6 /* must be same as IPPROTO_TCP in <netinet/in.h> */
70 * TCP level options
72 #ifndef TCP_NODELAY
73 #define TCP_NODELAY 0x1 /* must be same as <netinet/tcp.h> */
74 #endif
76 #ifndef TCP_MAXSEG
77 #define TCP_MAXSEG 0x2 /* must be same as <netinet/tcp.h> */
78 #endif
80 #ifndef TCP_KEEPALIVE
81 #define TCP_KEEPALIVE 0x8 /* must be same as <netinet/tcp.h> */
82 #endif
84 #endif /* !defined(_XPG5) */
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.
94 * TCP level
96 #define T_INET_TCP 6
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 */
103 * Structure used with TCP_KEEPALIVE option.
105 struct t_kpalive {
106 t_scalar_t kp_onoff; /* option on/off */
107 t_scalar_t kp_timeout; /* timeout in minutes */
111 #if !defined(_XPG5)
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.
119 #define T_GARBAGE 0x02 /* send garbage byte */
122 * UDP level
124 #define INET_UDP 17 /* must be same as IPPROTO_UDP in <netinet/in.h> */
128 * UDP level Options
131 #ifndef UDP_CHECKSUM
132 #define UDP_CHECKSUM 0x0600 /* must be same as in <netinet/udp.h> */
133 #endif
136 * IP level
138 #define INET_IP 0 /* must be same as IPPROTO_IP in <netinet/in.h> */
141 * IP level Options
144 #ifndef IP_OPTIONS
145 #define IP_OPTIONS 0x1 /* must be same as <netinet/in.h> */
146 #endif
148 #ifndef IP_TOS
149 #define IP_TOS 0x3 /* must be same as <netinet/in.h> */
150 #endif
152 #ifndef IP_TTL
153 #define IP_TTL 0x4 /* must be same as <netinet/in.h> */
154 #endif
157 * following also added to <netinet/in.h> and be in sync to keep namespace
158 * sane
161 #ifndef IP_REUSEADDR
162 #define IP_REUSEADDR 0x104 /* allow local address reuse */
163 #endif
165 #ifndef IP_DONTROUTE
166 #define IP_DONTROUTE 0x105 /* just use interface addresses */
167 #endif
169 #ifndef IP_BROADCAST
170 #define IP_BROADCAST 0x106 /* permit sending of broadcast msgs */
171 #endif
173 #endif /* !defined(_XPG5) */
176 * New applications should use the T_ prefix constants below
180 * UDP level
182 #define T_INET_UDP 17
185 * UDP level Options
187 #define T_UDP_CHECKSUM 0x0600 /* Checksum computation */
190 * IP level
192 #define T_INET_IP 0
195 * IP level Options
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 */
205 * IP_TOS precedence level
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
218 * IP_TOS type of service
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)
226 #define SET_TOS(prec, tos) ((0x7 & (prec)) << 5 | (0x1e & (tos)))
228 #ifdef __cplusplus
230 #endif
232 #endif /* _SYS_XTI_INET_H */