xref: /illumos-gate/usr/src/uts/common/sys/xti_inet.h (revision b4203d75)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*	Copyright (c) 1996-1998 Sun Microsystems, Inc.	*/
23*b4203d75SMarcel Telka /*	  All Rights Reserved	*/
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate /*
267c478bd9Sstevel@tonic-gate  * This is a private header file. Applications should not directly include
277c478bd9Sstevel@tonic-gate  * this file. Instead they should include <xti_inet.h>
287c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifndef _SYS_XTI_INET_H
317c478bd9Sstevel@tonic-gate #define	_SYS_XTI_INET_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include <sys/types.h>
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
367c478bd9Sstevel@tonic-gate extern "C" {
377c478bd9Sstevel@tonic-gate #endif
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate /*
407c478bd9Sstevel@tonic-gate  * This is a private header file. Applications should not directly include
417c478bd9Sstevel@tonic-gate  * this file. Instead they should include <xti_inet.h>
427c478bd9Sstevel@tonic-gate  */
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate #if !defined(_XPG5)
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate /*
477c478bd9Sstevel@tonic-gate  * INTERNET SPECIFIC ENVIRONMENT
487c478bd9Sstevel@tonic-gate  *
497c478bd9Sstevel@tonic-gate  * Note:
507c478bd9Sstevel@tonic-gate  * Unfortunately, XTI specification test assertions require exposing in
517c478bd9Sstevel@tonic-gate  * headers options that are not implemented. They also require exposing
527c478bd9Sstevel@tonic-gate  * Internet and OSI related options as part of inclusion of <xti.h>
537c478bd9Sstevel@tonic-gate  *
547c478bd9Sstevel@tonic-gate  * Also XTI specification intrudes on <netinet/in.h> TCP_ and IP_ namespaces
557c478bd9Sstevel@tonic-gate  * and sometimes redefines the semantics or types of some options with a
567c478bd9Sstevel@tonic-gate  * different history in that namespace. The name and binary value are exposed
577c478bd9Sstevel@tonic-gate  * but option semantics may be different from what is in XTI spec and we defer
587c478bd9Sstevel@tonic-gate  * to the <netinet/in.h> precedent.
597c478bd9Sstevel@tonic-gate  *
607c478bd9Sstevel@tonic-gate  * New applications should not use these constants. These are meant
617c478bd9Sstevel@tonic-gate  * for compatibility with older applications.
627c478bd9Sstevel@tonic-gate  */
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate /*
657c478bd9Sstevel@tonic-gate  * TCP level
667c478bd9Sstevel@tonic-gate  */
677c478bd9Sstevel@tonic-gate #define	INET_TCP	6 /* must be same as IPPROTO_TCP in <netinet/in.h> */
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate /*
707c478bd9Sstevel@tonic-gate  * TCP level options
717c478bd9Sstevel@tonic-gate  */
727c478bd9Sstevel@tonic-gate #ifndef TCP_NODELAY
737c478bd9Sstevel@tonic-gate #define	TCP_NODELAY	0x1	/* must be same as <netinet/tcp.h> */
747c478bd9Sstevel@tonic-gate #endif
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate #ifndef TCP_MAXSEG
777c478bd9Sstevel@tonic-gate #define	TCP_MAXSEG	0x2	/* must be same as <netinet/tcp.h> */
787c478bd9Sstevel@tonic-gate #endif
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate #ifndef TCP_KEEPALIVE
817c478bd9Sstevel@tonic-gate #define	TCP_KEEPALIVE	0x8	/* must be same as <netinet/tcp.h> */
827c478bd9Sstevel@tonic-gate #endif
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG5) */
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate /*
877c478bd9Sstevel@tonic-gate  * New applications must not use the constants defined above. Instead
887c478bd9Sstevel@tonic-gate  * they must use the constants with the T_ prefix defined below. The
897c478bd9Sstevel@tonic-gate  * constants without the T_ prefix are meant for compatibility with
907c478bd9Sstevel@tonic-gate  * older applications.
917c478bd9Sstevel@tonic-gate  */
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate /*
947c478bd9Sstevel@tonic-gate  * TCP level
957c478bd9Sstevel@tonic-gate  */
967c478bd9Sstevel@tonic-gate #define	T_INET_TCP	6
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate #define	T_TCP_NODELAY	0x1	/* Don't delay packets to coalesce */
997c478bd9Sstevel@tonic-gate #define	T_TCP_MAXSEG	0x2	/* Get maximum segment size */
1007c478bd9Sstevel@tonic-gate #define	T_TCP_KEEPALIVE	0x8	/* check, if connections are alive */
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate /*
1037c478bd9Sstevel@tonic-gate  * Structure used with TCP_KEEPALIVE option.
1047c478bd9Sstevel@tonic-gate  */
1057c478bd9Sstevel@tonic-gate struct t_kpalive {
1067c478bd9Sstevel@tonic-gate 	t_scalar_t	kp_onoff;	/* option on/off */
1077c478bd9Sstevel@tonic-gate 	t_scalar_t	kp_timeout;	/* timeout in minutes */
1087c478bd9Sstevel@tonic-gate };
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate #if !defined(_XPG5)
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate /*
1147c478bd9Sstevel@tonic-gate  * New applications must not use the constants defined below. Instead they
1157c478bd9Sstevel@tonic-gate  * must use the corresponding T_prefix constants. The constants without the
1167c478bd9Sstevel@tonic-gate  * T_ prefix are supported for legacy applications.
1177c478bd9Sstevel@tonic-gate  */
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate #define	T_GARBAGE		0x02 /* send garbage byte */
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate /*
1227c478bd9Sstevel@tonic-gate  * UDP level
1237c478bd9Sstevel@tonic-gate  */
1247c478bd9Sstevel@tonic-gate #define	INET_UDP	17 /* must be same as IPPROTO_UDP in <netinet/in.h> */
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate /*
1287c478bd9Sstevel@tonic-gate  * UDP level Options
1297c478bd9Sstevel@tonic-gate  */
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate #ifndef UDP_CHECKSUM
1327c478bd9Sstevel@tonic-gate #define	UDP_CHECKSUM	0x0600	/* must be same as in <netinet/udp.h> */
1337c478bd9Sstevel@tonic-gate #endif
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate /*
1367c478bd9Sstevel@tonic-gate  * IP level
1377c478bd9Sstevel@tonic-gate  */
1387c478bd9Sstevel@tonic-gate #define	INET_IP	0	/* must be same as IPPROTO_IP in <netinet/in.h> */
1397c478bd9Sstevel@tonic-gate 
1407c478bd9Sstevel@tonic-gate /*
1417c478bd9Sstevel@tonic-gate  * IP level Options
1427c478bd9Sstevel@tonic-gate  */
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate #ifndef IP_OPTIONS
1457c478bd9Sstevel@tonic-gate #define	IP_OPTIONS	0x1	/* must be same as <netinet/in.h> */
1467c478bd9Sstevel@tonic-gate #endif
1477c478bd9Sstevel@tonic-gate 
1487c478bd9Sstevel@tonic-gate #ifndef IP_TOS
1497c478bd9Sstevel@tonic-gate #define	IP_TOS		0x3	/* must be same as <netinet/in.h> */
1507c478bd9Sstevel@tonic-gate #endif
1517c478bd9Sstevel@tonic-gate 
1527c478bd9Sstevel@tonic-gate #ifndef IP_TTL
1537c478bd9Sstevel@tonic-gate #define	IP_TTL		0x4	/* must be same as <netinet/in.h> */
1547c478bd9Sstevel@tonic-gate #endif
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate /*
1577c478bd9Sstevel@tonic-gate  * following also added to <netinet/in.h> and be in sync to keep namespace
1587c478bd9Sstevel@tonic-gate  * sane
1597c478bd9Sstevel@tonic-gate  */
1607c478bd9Sstevel@tonic-gate 
1617c478bd9Sstevel@tonic-gate #ifndef IP_REUSEADDR
1627c478bd9Sstevel@tonic-gate #define	IP_REUSEADDR	0x104	/* allow local address reuse */
1637c478bd9Sstevel@tonic-gate #endif
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate #ifndef IP_DONTROUTE
1667c478bd9Sstevel@tonic-gate #define	IP_DONTROUTE	0x105	/* just use interface addresses */
1677c478bd9Sstevel@tonic-gate #endif
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate #ifndef IP_BROADCAST
1707c478bd9Sstevel@tonic-gate #define	IP_BROADCAST	0x106	/* permit sending of broadcast msgs */
1717c478bd9Sstevel@tonic-gate #endif
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG5) */
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate /*
1767c478bd9Sstevel@tonic-gate  * New applications should use the T_ prefix constants below
1777c478bd9Sstevel@tonic-gate  */
1787c478bd9Sstevel@tonic-gate 
1797c478bd9Sstevel@tonic-gate /*
1807c478bd9Sstevel@tonic-gate  * UDP level
1817c478bd9Sstevel@tonic-gate  */
1827c478bd9Sstevel@tonic-gate #define	T_INET_UDP	17
1837c478bd9Sstevel@tonic-gate 
1847c478bd9Sstevel@tonic-gate /*
1857c478bd9Sstevel@tonic-gate  * UDP level Options
1867c478bd9Sstevel@tonic-gate  */
1877c478bd9Sstevel@tonic-gate #define	T_UDP_CHECKSUM	0x0600	/* Checksum computation */
1887c478bd9Sstevel@tonic-gate 
1897c478bd9Sstevel@tonic-gate /*
1907c478bd9Sstevel@tonic-gate  * IP level
1917c478bd9Sstevel@tonic-gate  */
1927c478bd9Sstevel@tonic-gate #define	T_INET_IP	0
1937c478bd9Sstevel@tonic-gate 
1947c478bd9Sstevel@tonic-gate /*
1957c478bd9Sstevel@tonic-gate  * IP level Options
1967c478bd9Sstevel@tonic-gate  */
1977c478bd9Sstevel@tonic-gate #define	T_IP_TTL	0x4	/* IP per packet time to live */
1987c478bd9Sstevel@tonic-gate #define	T_IP_REUSEADDR	0x104	/* allow local address reuse */
1997c478bd9Sstevel@tonic-gate #define	T_IP_DONTROUTE	0x105	/* just use interface addresses */
2007c478bd9Sstevel@tonic-gate #define	T_IP_BROADCAST	0x106	/* permit sending of broadcast msgs */
2017c478bd9Sstevel@tonic-gate #define	T_IP_OPTIONS	0x107	/* IP per-packet options */
2027c478bd9Sstevel@tonic-gate #define	T_IP_TOS	0x108	/* IP per packet type of service */
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate /*
2057c478bd9Sstevel@tonic-gate  * IP_TOS precedence level
2067c478bd9Sstevel@tonic-gate  */
2077c478bd9Sstevel@tonic-gate #define	T_ROUTINE			0
2087c478bd9Sstevel@tonic-gate #define	T_PRIORITY			1
2097c478bd9Sstevel@tonic-gate #define	T_IMMEDIATE			2
2107c478bd9Sstevel@tonic-gate #define	T_FLASH				3
2117c478bd9Sstevel@tonic-gate #define	T_OVERRIDEFLASH			4
2127c478bd9Sstevel@tonic-gate #define	T_CRITIC_ECP			5
2137c478bd9Sstevel@tonic-gate #define	T_INETCONTROL			6
2147c478bd9Sstevel@tonic-gate #define	T_NETCONTROL			7
2157c478bd9Sstevel@tonic-gate 
2167c478bd9Sstevel@tonic-gate 
2177c478bd9Sstevel@tonic-gate /*
2187c478bd9Sstevel@tonic-gate  * IP_TOS type of service
2197c478bd9Sstevel@tonic-gate  */
2207c478bd9Sstevel@tonic-gate #define	T_NOTOS		0
2217c478bd9Sstevel@tonic-gate #define	T_LDELAY	(1<<4)
2227c478bd9Sstevel@tonic-gate #define	T_HITHRPT	(1<<3)
2237c478bd9Sstevel@tonic-gate #define	T_HIREL		(1<<2)
2247c478bd9Sstevel@tonic-gate #define	T_LOCOST	(1<<1)
2257c478bd9Sstevel@tonic-gate 
2267c478bd9Sstevel@tonic-gate #define	SET_TOS(prec, tos)	((0x7 & (prec)) << 5 | (0x1e & (tos)))
2277c478bd9Sstevel@tonic-gate 
2287c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2297c478bd9Sstevel@tonic-gate }
2307c478bd9Sstevel@tonic-gate #endif
2317c478bd9Sstevel@tonic-gate 
2327c478bd9Sstevel@tonic-gate #endif	/* _SYS_XTI_INET_H */
233