|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1982, 1986 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution is only permitted until one year after the first shipment ! 6: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and ! 7: * binary forms are permitted provided that: (1) source distributions retain ! 8: * this entire copyright notice and comment, and (2) distributions including ! 9: * binaries display the following acknowledgement: This product includes ! 10: * software developed by the University of California, Berkeley and its ! 11: * contributors'' in the documentation or other materials provided with the ! 12: * distribution and in all advertising materials mentioning features or use ! 13: * of this software. Neither the name of the University nor the names of ! 14: * its contributors may be used to endorse or promote products derived from ! 15: * this software without specific prior written permission. ! 16: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 17: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 18: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 19: * ! 20: * @(#)ip.h 7.10 (Berkeley) 6/28/90 ! 21: */ ! 22: ! 23: /* ! 24: * Definitions for internet protocol version 4. ! 25: * Per RFC 791, September 1981. ! 26: */ ! 27: #define IPVERSION 4 ! 28: ! 29: /* ! 30: * Structure of an internet header, naked of options. ! 31: * ! 32: * We declare ip_len and ip_off to be short, rather than u_short ! 33: * pragmatically since otherwise unsigned comparisons can result ! 34: * against negative integers quite easily, and fail in subtle ways. ! 35: */ ! 36: struct ip { ! 37: #if BYTE_ORDER == LITTLE_ENDIAN ! 38: u_char ip_hl:4, /* header length */ ! 39: ip_v:4; /* version */ ! 40: #endif ! 41: #if BYTE_ORDER == BIG_ENDIAN ! 42: u_char ip_v:4, /* version */ ! 43: ip_hl:4; /* header length */ ! 44: #endif ! 45: u_char ip_tos; /* type of service */ ! 46: short ip_len; /* total length */ ! 47: u_short ip_id; /* identification */ ! 48: short ip_off; /* fragment offset field */ ! 49: #define IP_DF 0x4000 /* dont fragment flag */ ! 50: #define IP_MF 0x2000 /* more fragments flag */ ! 51: u_char ip_ttl; /* time to live */ ! 52: u_char ip_p; /* protocol */ ! 53: u_short ip_sum; /* checksum */ ! 54: struct in_addr ip_src,ip_dst; /* source and dest address */ ! 55: }; ! 56: ! 57: #define IP_MAXPACKET 65535 /* maximum packet size */ ! 58: ! 59: /* ! 60: * Definitions for IP type of service (ip_tos) ! 61: */ ! 62: #define IPTOS_LOWDELAY 0x10 ! 63: #define IPTOS_THROUGHPUT 0x08 ! 64: #define IPTOS_RELIABILITY 0x04 ! 65: ! 66: /* ! 67: * Definitions for IP precedence (also in ip_tos) (hopefully unused) ! 68: */ ! 69: #define IPTOS_PREC_NETCONTROL 0xe0 ! 70: #define IPTOS_PREC_INTERNETCONTROL 0xc0 ! 71: #define IPTOS_PREC_CRITIC_ECP 0xa0 ! 72: #define IPTOS_PREC_FLASHOVERRIDE 0x80 ! 73: #define IPTOS_PREC_FLASH 0x60 ! 74: #define IPTOS_PREC_IMMEDIATE 0x40 ! 75: #define IPTOS_PREC_PRIORITY 0x20 ! 76: #define IPTOS_PREC_ROUTINE 0x10 ! 77: ! 78: /* ! 79: * Definitions for options. ! 80: */ ! 81: #define IPOPT_COPIED(o) ((o)&0x80) ! 82: #define IPOPT_CLASS(o) ((o)&0x60) ! 83: #define IPOPT_NUMBER(o) ((o)&0x1f) ! 84: ! 85: #define IPOPT_CONTROL 0x00 ! 86: #define IPOPT_RESERVED1 0x20 ! 87: #define IPOPT_DEBMEAS 0x40 ! 88: #define IPOPT_RESERVED2 0x60 ! 89: ! 90: #define IPOPT_EOL 0 /* end of option list */ ! 91: #define IPOPT_NOP 1 /* no operation */ ! 92: ! 93: #define IPOPT_RR 7 /* record packet route */ ! 94: #define IPOPT_TS 68 /* timestamp */ ! 95: #define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ ! 96: #define IPOPT_LSRR 131 /* loose source route */ ! 97: #define IPOPT_SATID 136 /* satnet id */ ! 98: #define IPOPT_SSRR 137 /* strict source route */ ! 99: ! 100: /* ! 101: * Offsets to fields in options other than EOL and NOP. ! 102: */ ! 103: #define IPOPT_OPTVAL 0 /* option ID */ ! 104: #define IPOPT_OLEN 1 /* option length */ ! 105: #define IPOPT_OFFSET 2 /* offset within option */ ! 106: #define IPOPT_MINOFF 4 /* min value of above */ ! 107: ! 108: /* ! 109: * Time stamp option structure. ! 110: */ ! 111: struct ip_timestamp { ! 112: u_char ipt_code; /* IPOPT_TS */ ! 113: u_char ipt_len; /* size of structure (variable) */ ! 114: u_char ipt_ptr; /* index of current entry */ ! 115: #if BYTE_ORDER == LITTLE_ENDIAN ! 116: u_char ipt_flg:4, /* flags, see below */ ! 117: ipt_oflw:4; /* overflow counter */ ! 118: #endif ! 119: #if BYTE_ORDER == BIG_ENDIAN ! 120: u_char ipt_oflw:4, /* overflow counter */ ! 121: ipt_flg:4; /* flags, see below */ ! 122: #endif ! 123: union ipt_timestamp { ! 124: n_long ipt_time[1]; ! 125: struct ipt_ta { ! 126: struct in_addr ipt_addr; ! 127: n_long ipt_time; ! 128: } ipt_ta[1]; ! 129: } ipt_timestamp; ! 130: }; ! 131: ! 132: /* flag bits for ipt_flg */ ! 133: #define IPOPT_TS_TSONLY 0 /* timestamps only */ ! 134: #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ ! 135: #define IPOPT_TS_PRESPEC 3 /* specified modules only */ ! 136: ! 137: /* bits for security (not byte swapped) */ ! 138: #define IPOPT_SECUR_UNCLASS 0x0000 ! 139: #define IPOPT_SECUR_CONFID 0xf135 ! 140: #define IPOPT_SECUR_EFTO 0x789a ! 141: #define IPOPT_SECUR_MMMM 0xbc4d ! 142: #define IPOPT_SECUR_RESTR 0xaf13 ! 143: #define IPOPT_SECUR_SECRET 0xd788 ! 144: #define IPOPT_SECUR_TOPSECRET 0x6bc5 ! 145: ! 146: /* ! 147: * Internet implementation parameters. ! 148: */ ! 149: #define MAXTTL 255 /* maximum time to live (seconds) */ ! 150: #define IPFRAGTTL 60 /* time to live for frags, slowhz */ ! 151: #define IPTTLDEC 1 /* subtracted when forwarding */ ! 152: ! 153: #define IP_MSS 576 /* default maximum segment size */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.