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 this notice is preserved and that due credit is given
   7:  * to the University of California at Berkeley. The name of the University
   8:  * may not be used to endorse or promote products derived from this
   9:  * software without specific prior written permission. This software
  10:  * is provided ``as is'' without express or implied warranty.
  11:  *
  12:  *	@(#)ip.h	7.6.1.2 (2.11BSD) 1995/10/09
  13:  */
  14: #ifndef BYTE_ORDER
  15: /*
  16:  * Definitions for byte order,
  17:  * according to byte significance from low address to high.
  18:  */
  19: #define LITTLE_ENDIAN   1234    /* least-significant byte first (vax) */
  20: #define BIG_ENDIAN  4321    /* most-significant byte first (IBM, net) */
  21: #define PDP_ENDIAN  3412    /* LSB first in word, MSW first in long (pdp) */
  22: 
  23: #ifdef vax
  24: #define BYTE_ORDER  LITTLE_ENDIAN
  25: #else
  26: #ifdef pdp11
  27: #define BYTE_ORDER  PDP_ENDIAN
  28: #else
  29: #define BYTE_ORDER  BIG_ENDIAN  /* mc68000, tahoe, most others */
  30: #endif
  31: #endif
  32: #endif BYTE_ORDER
  33: 
  34: /*
  35:  * Definitions for internet protocol version 4.
  36:  * Per RFC 791, September 1981.
  37:  */
  38: #define IPVERSION   4
  39: 
  40: /*
  41:  * Structure of an internet header, naked of options.
  42:  *
  43:  * We declare ip_len and ip_off to be short, rather than u_short
  44:  * pragmatically since otherwise unsigned comparisons can result
  45:  * against negative integers quite easily, and fail in subtle ways.
  46:  */
  47: struct ip {
  48: #if BYTE_ORDER == LITTLE_ENDIAN
  49:     u_char  ip_hl:4,        /* header length */
  50:         ip_v:4;         /* version */
  51: #endif
  52: #if BYTE_ORDER == BIG_ENDIAN
  53:     u_char  ip_v:4,         /* version */
  54:         ip_hl:4;        /* header length */
  55: #endif
  56: #if BYTE_ORDER == PDP_ENDIAN
  57:     u_int   ip_hl:4,        /* header length */
  58:         ip_v:4;         /* version */
  59: #endif
  60:     u_char  ip_tos;         /* type of service */
  61:     short   ip_len;         /* total length */
  62:     u_short ip_id;          /* identification */
  63:     short   ip_off;         /* fragment offset field */
  64: #define IP_DF 0x4000            /* dont fragment flag */
  65: #define IP_MF 0x2000            /* more fragments flag */
  66:     u_char  ip_ttl;         /* time to live */
  67:     u_char  ip_p;           /* protocol */
  68:     u_short ip_sum;         /* checksum */
  69:     struct  in_addr ip_src,ip_dst;  /* source and dest address */
  70: };
  71: 
  72: #define IP_MAXPACKET    65535L      /* maximum packet size */
  73: 
  74: /*
  75:  * Definitions for options.
  76:  */
  77: #define IPOPT_COPIED(o)     ((o)&0x80)
  78: #define IPOPT_CLASS(o)      ((o)&0x60)
  79: #define IPOPT_NUMBER(o)     ((o)&0x1f)
  80: 
  81: #define IPOPT_CONTROL       0x00
  82: #define IPOPT_RESERVED1     0x20
  83: #define IPOPT_DEBMEAS       0x40
  84: #define IPOPT_RESERVED2     0x60
  85: 
  86: #define IPOPT_EOL       0       /* end of option list */
  87: #define IPOPT_NOP       1       /* no operation */
  88: 
  89: #define IPOPT_RR        7       /* record packet route */
  90: #define IPOPT_TS        68      /* timestamp */
  91: #define IPOPT_SECURITY      130     /* provide s,c,h,tcc */
  92: #define IPOPT_LSRR      131     /* loose source route */
  93: #define IPOPT_SATID     136     /* satnet id */
  94: #define IPOPT_SSRR      137     /* strict source route */
  95: 
  96: /*
  97:  * Offsets to fields in options other than EOL and NOP.
  98:  */
  99: #define IPOPT_OPTVAL        0       /* option ID */
 100: #define IPOPT_OLEN      1       /* option length */
 101: #define IPOPT_OFFSET        2       /* offset within option */
 102: #define IPOPT_MINOFF        4       /* min value of above */
 103: 
 104: /*
 105:  * Time stamp option structure.
 106:  */
 107: struct  ip_timestamp {
 108:     u_char  ipt_code;       /* IPOPT_TS */
 109:     u_char  ipt_len;        /* size of structure (variable) */
 110:     u_char  ipt_ptr;        /* index of current entry */
 111: #if BYTE_ORDER == LITTLE_ENDIAN
 112:     u_char  ipt_flg:4,      /* flags, see below */
 113:         ipt_oflw:4;     /* overflow counter */
 114: #endif
 115: #if BYTE_ORDER == BIG_ENDIAN
 116:     u_char  ipt_oflw:4,     /* overflow counter */
 117:         ipt_flg:4;      /* flags, see below */
 118: #endif
 119: #if BYTE_ORDER == PDP_ENDIAN
 120:     u_char  ipt_flg:4,      /* flags, see below */
 121:         ipt_oflw:4;     /* overflow counter */
 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    2       /* 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 IPDEFTTL    64      /* default ttl, from RFC 1340 */
 151: #define IPFRAGTTL   60      /* time to live for frags, slowhz */
 152: #define IPTTLDEC    1       /* subtracted when forwarding */
 153: 
 154: #define IP_MSS      576     /* default maximum segment size */

Defined struct's

ip defined in line 47; used 264 times
ip_timestamp defined in line 107; used 4 times
ipt_ta defined in line 125; never used

Defined union's

ipt_timestamp defined in line 123; never used

Defined macros

BIG_ENDIAN defined in line 20; used 3 times
BYTE_ORDER defined in line 29; used 7 times
IPDEFTTL defined in line 150; used 1 times
IPFRAGTTL defined in line 151; used 1 times
IPOPT_CLASS defined in line 78; never used
IPOPT_CONTROL defined in line 81; never used
IPOPT_COPIED defined in line 77; used 1 times
IPOPT_DEBMEAS defined in line 83; never used
IPOPT_LSRR defined in line 92; never used
IPOPT_NUMBER defined in line 79; never used
IPOPT_RESERVED1 defined in line 82; never used
IPOPT_RESERVED2 defined in line 84; never used
IPOPT_RR defined in line 89; used 1 times
IPOPT_SATID defined in line 93; never used
IPOPT_SECURITY defined in line 91; never used
IPOPT_SECUR_CONFID defined in line 139; never used
IPOPT_SECUR_EFTO defined in line 140; never used
IPOPT_SECUR_MMMM defined in line 141; never used
IPOPT_SECUR_RESTR defined in line 142; never used
IPOPT_SECUR_SECRET defined in line 143; never used
IPOPT_SECUR_TOPSECRET defined in line 144; never used
IPOPT_SECUR_UNCLASS defined in line 138; never used
IPOPT_SSRR defined in line 94; used 2 times
IPOPT_TS defined in line 90; never used
IPOPT_TS_PRESPEC defined in line 135; never used
IPOPT_TS_TSANDADDR defined in line 134; never used
IPOPT_TS_TSONLY defined in line 133; never used
IPTTLDEC defined in line 152; used 2 times
IPVERSION defined in line 38; used 1 times
IP_MAXPACKET defined in line 72; never used
IP_MSS defined in line 154; never used
LITTLE_ENDIAN defined in line 19; used 3 times
PDP_ENDIAN defined in line 21; used 3 times

Usage of this include

ip.h used 40 times
Last modified: 1995-10-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 881
Valid CSS Valid XHTML 1.0 Strict