Annotation of 43BSDTahoe/sys/netinet/ip.h, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.