1 /*- 2 * Copyright (c) 1982, 1986, 1993 3 * The Regents of the University of California. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 4. Neither the name of the University nor the names of its contributors 15 * may be used to endorse or promote products derived from this software 16 * without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * @(#)ip.h 8.2 (Berkeley) 6/1/94 31 * $FreeBSD$ 32 */ 33 34 #ifndef TCPLP_NETINET_IP_H_ 35 #define TCPLP_NETINET_IP_H_ 36 37 #define IP_MAXPACKET 65535 /* maximum packet size */ 38 39 /* 40 * Definitions for IP type of service (ip_tos). 41 */ 42 #define IPTOS_LOWDELAY 0x10 43 #define IPTOS_THROUGHPUT 0x08 44 #define IPTOS_RELIABILITY 0x04 45 #define IPTOS_MINCOST 0x02 46 47 /* 48 * Definitions for IP precedence (also in ip_tos) (deprecated). 49 */ 50 #define IPTOS_PREC_NETCONTROL IPTOS_DSCP_CS7 51 #define IPTOS_PREC_INTERNETCONTROL IPTOS_DSCP_CS6 52 #define IPTOS_PREC_CRITIC_ECP IPTOS_DSCP_CS5 53 #define IPTOS_PREC_FLASHOVERRIDE IPTOS_DSCP_CS4 54 #define IPTOS_PREC_FLASH IPTOS_DSCP_CS3 55 #define IPTOS_PREC_IMMEDIATE IPTOS_DSCP_CS2 56 #define IPTOS_PREC_PRIORITY IPTOS_DSCP_CS1 57 #define IPTOS_PREC_ROUTINE IPTOS_DSCP_CS0 58 59 /* 60 * Definitions for DiffServ Codepoints as per RFC2474 and RFC5865. 61 */ 62 #define IPTOS_DSCP_CS0 0x00 63 #define IPTOS_DSCP_CS1 0x20 64 #define IPTOS_DSCP_AF11 0x28 65 #define IPTOS_DSCP_AF12 0x30 66 #define IPTOS_DSCP_AF13 0x38 67 #define IPTOS_DSCP_CS2 0x40 68 #define IPTOS_DSCP_AF21 0x48 69 #define IPTOS_DSCP_AF22 0x50 70 #define IPTOS_DSCP_AF23 0x58 71 #define IPTOS_DSCP_CS3 0x60 72 #define IPTOS_DSCP_AF31 0x68 73 #define IPTOS_DSCP_AF32 0x70 74 #define IPTOS_DSCP_AF33 0x78 75 #define IPTOS_DSCP_CS4 0x80 76 #define IPTOS_DSCP_AF41 0x88 77 #define IPTOS_DSCP_AF42 0x90 78 #define IPTOS_DSCP_AF43 0x98 79 #define IPTOS_DSCP_CS5 0xa0 80 #define IPTOS_DSCP_VA 0xb0 81 #define IPTOS_DSCP_EF 0xb8 82 #define IPTOS_DSCP_CS6 0xc0 83 #define IPTOS_DSCP_CS7 0xe0 84 85 /* 86 * ECN (Explicit Congestion Notification) codepoints in RFC3168 mapped to the 87 * lower 2 bits of the TOS field. 88 */ 89 #define IPTOS_ECN_NOTECT 0x00 /* not-ECT */ 90 #define IPTOS_ECN_ECT1 0x01 /* ECN-capable transport (1) */ 91 #define IPTOS_ECN_ECT0 0x02 /* ECN-capable transport (0) */ 92 #define IPTOS_ECN_CE 0x03 /* congestion experienced */ 93 #define IPTOS_ECN_MASK 0x03 /* ECN field mask */ 94 95 /* 96 * Definitions for options. 97 */ 98 #define IPOPT_COPIED(o) ((o)&0x80) 99 #define IPOPT_CLASS(o) ((o)&0x60) 100 #define IPOPT_NUMBER(o) ((o)&0x1f) 101 102 #define IPOPT_CONTROL 0x00 103 #define IPOPT_RESERVED1 0x20 104 #define IPOPT_DEBMEAS 0x40 105 #define IPOPT_RESERVED2 0x60 106 107 #define IPOPT_EOL 0 /* end of option list */ 108 #define IPOPT_NOP 1 /* no operation */ 109 110 #define IPOPT_RR 7 /* record packet route */ 111 #define IPOPT_TS 68 /* timestamp */ 112 #define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ 113 #define IPOPT_LSRR 131 /* loose source route */ 114 #define IPOPT_ESO 133 /* extended security */ 115 #define IPOPT_CIPSO 134 /* commerical security */ 116 #define IPOPT_SATID 136 /* satnet id */ 117 #define IPOPT_SSRR 137 /* strict source route */ 118 #define IPOPT_RA 148 /* router alert */ 119 120 /* 121 * Offsets to fields in options other than EOL and NOP. 122 */ 123 #define IPOPT_OPTVAL 0 /* option ID */ 124 #define IPOPT_OLEN 1 /* option length */ 125 #define IPOPT_OFFSET 2 /* offset within option */ 126 #define IPOPT_MINOFF 4 /* min value of above */ 127 128 /* Flag bits for ipt_flg. */ 129 #define IPOPT_TS_TSONLY 0 /* timestamps only */ 130 #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ 131 #define IPOPT_TS_PRESPEC 3 /* specified modules only */ 132 133 /* Bits for security (not byte swapped). */ 134 #define IPOPT_SECUR_UNCLASS 0x0000 135 #define IPOPT_SECUR_CONFID 0xf135 136 #define IPOPT_SECUR_EFTO 0x789a 137 #define IPOPT_SECUR_MMMM 0xbc4d 138 #define IPOPT_SECUR_RESTR 0xaf13 139 #define IPOPT_SECUR_SECRET 0xd788 140 #define IPOPT_SECUR_TOPSECRET 0x6bc5 141 142 /* 143 * Internet implementation parameters. 144 */ 145 #define MAXTTL 255 /* maximum time to live (seconds) */ 146 #define IPDEFTTL 64 /* default ttl, from RFC 1340 */ 147 #define IPFRAGTTL 60 /* time to live for frags, slowhz */ 148 #define IPTTLDEC 1 /* subtracted when forwarding */ 149 #define IP_MSS 576 /* default maximum segment size */ 150 151 #endif 152