home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (c) 1998 The Santa Cruz Operation, Inc.. All Rights Reserved.
- *
- * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE
- * SANTA CRUZ OPERATION INC.
- *
- * The copyright notice above does not evidence any actual or intended
- * publication of such source code.
- */
-
- /*
- * Copyrighted as an unpublished work.
- * (c) Copyright 1987-1995 Computer Associates International, Inc.
- * All rights reserved.
- *
- * RESTRICTED RIGHTS
- *
- * These programs are supplied under a license. They may be used,
- * disclosed, and/or copied only as permitted under such license
- * agreement. Any copy must contain the above copyright notice and
- * this restricted rights notice. Use, copying, and/or disclosure
- * of the programs is strictly prohibited unless otherwise provided
- * in the license agreement.
- */
- /*
- * Copyright (c) 1982-1995
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
- #ident "@(#)ip.h 1.5"
- #ident "$Header$"
-
- #ifndef __netinet_ip_h
- #define __netinet_ip_h
-
- #ifdef _KERNEL_HEADERS
- #include <net/inet/ip_f.h>
- #else /* !_KERNEL_HEADERS */
- #include <netinet/ip_f.h>
- #endif /* _KERNEL_HEADERS */
-
- /*
- * Definitions for internet protocol version 4. Per RFC 791, September 1981.
- */
- #define IPVERSION 4
-
- /*
- * Definitions for IP type of service (ip_tos)
- */
- #define IPTOS_LOWDELAY 0x10
- #define IPTOS_THROUGHPUT 0x08
- #define IPTOS_RELIABILITY 0x04
- #define IPTOS_MONETARY 0x02
- #define IPTOS_RESERVED2 0x01
- #define IPTOS_NONE 0x00
-
- /*
- * Definitions for IP precedence (also in ip_tos) (hopefully unused)
- */
- #define IPTOS_PREC_NETCONTROL 0xe0
- #define IPTOS_PREC_INTERNETCONTROL 0xc0
- #define IPTOS_PREC_CRITIC_ECP 0xa0
- #define IPTOS_PREC_FLASHOVERRIDE 0x80
- #define IPTOS_PREC_FLASH 0x60
- #define IPTOS_PREC_IMMEDIATE 0x40
- #define IPTOS_PREC_PRIORITY 0x20
- #define IPTOS_PREC_ROUTINE 0x00
-
- #define IPPREC(x) ((u_char) (x) & 0xe0)
- #define IPTOS(x) ((u_char) (x) & 0x1c)
-
- #if defined(TOSNAMES)
- struct ip_tosval {
- char *tv_name;
- u_char tv_val;
- } ip_tosvals[] = {
- "none", IPTOS_NONE,
- "delay", IPTOS_LOWDELAY,
- "throughput", IPTOS_THROUGHPUT,
- "reliability", IPTOS_RELIABILITY,
- "monetary", IPTOS_MONETARY,
- "reserved2", IPTOS_RESERVED2
- };
-
- int n_iptosvals = (sizeof(ip_tosvals) / sizeof(struct ip_tosval));
- struct ip_tosval ip_precvals[] = {
- "netcontrol", IPTOS_PREC_NETCONTROL,
- "internetcontrol", IPTOS_PREC_INTERNETCONTROL,
- "crtic/ecp", IPTOS_PREC_CRITIC_ECP,
- "flashoverride", IPTOS_PREC_FLASHOVERRIDE,
- "flash", IPTOS_PREC_FLASH,
- "immediate", IPTOS_PREC_IMMEDIATE,
- "priority", IPTOS_PREC_PRIORITY,
- "routine", IPTOS_PREC_ROUTINE,
- };
- int n_ipprecvals = (sizeof(ip_precvals) / sizeof(struct ip_tosval));
- #endif /* TOSNAMES */
-
- #define IP_MAXPACKET 65535 /* maximum packet size */
- /*
- * Definitions for options.
- */
- #define IPOPT_COPIED(o) ((o)&0x80)
- #define IPOPT_CLASS(o) ((o)&0x60)
- #define IPOPT_NUMBER(o) ((o)&0x1f)
-
- #define IPOPT_CONTROL 0x00
- #define IPOPT_RESERVED1 0x20
- #define IPOPT_DEBMEAS 0x40
- #define IPOPT_RESERVED2 0x60
-
- #define IPOPT_EOL 0 /* end of option list */
- #define IPOPT_NOP 1 /* no operation */
-
- #define IPOPT_RR 7 /* record packet route */
- #define IPOPT_TS 68 /* timestamp */
- #define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
- #define IPOPT_LSRR 131 /* loose source route */
- #define IPOPT_SATID 136 /* satnet id */
- #define IPOPT_SSRR 137 /* strict source route */
- #define IPOPT_RA 148 /* router alert */
-
- /*
- * Offsets to fields in options other than EOL and NOP.
- */
- #define IPOPT_OPTVAL 0 /* option ID */
- #define IPOPT_OLEN 1 /* option length */
- #define IPOPT_OFFSET 2 /* offset within option */
- #define IPOPT_MINOFF 4 /* min value of above */
-
- /* flag bits for ipt_flg */
- #define IPOPT_TS_TSONLY 0 /* timestamps only */
- #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
- #define IPOPT_TS_PRESPEC 2 /* specified modules only */
-
- /* bits for security (not byte swapped) */
- #define IPOPT_SECUR_UNCLASS 0x0000
- #define IPOPT_SECUR_CONFID 0xf135
- #define IPOPT_SECUR_EFTO 0x789a
- #define IPOPT_SECUR_MMMM 0xbc4d
- #define IPOPT_SECUR_RESTR 0xaf13
- #define IPOPT_SECUR_SECRET 0xd788
- #define IPOPT_SECUR_TOPSECRET 0x6bc5
-
- /*
- * Maximum size of any reasonable combination of IP options (RFC791).
- */
- #define IP_OPTIONS_OPT_MAXSZ \
- ( 1 + 1 /* end of opt list, no operation */ \
- + 11 /* basic security */ \
- + 255*3 /* loose source routing, ext security, record route */ \
- + 4 /* stream id */ \
- + 255*2 /* strict source routing, timestamp */ \
- + 4*8 ) /* reasonable value to align each option to 4 octet boundary */
-
- /*
- * Internet implementation parameters.
- */
- #define MAXTTL 255 /* maximum time to live (seconds) */
- #define IPFRAGTTL 60 /* time to live for frags, slowhz */
- #define IPTTLDEC 1 /* subtracted when forwarding */
-
- #define IP_MINMTU 68 /* RFC 791 minimum MTU */
- #define IP_MSS 576 /* default maximum segment size */
-
- #if !defined(GBITS)
- #define GBITS(x,p,n) (((x)>>(p+1-n)) &~(~0<<n))
- #endif
-
- #if !defined(SBITS)
- #define SBITS(x,p,n,v) (x)=((((v)&~(~0<<n))<<(p+1-n))|\
- ((x)&~((~(~0<<n))<<(p+1-n))));
- #endif
-
- #endif /* __netinet_ip_h */
-