1: /*
   2:  * Copyright (c) 1982, 1986 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)ip_icmp.h	7.1 (Berkeley) 6/5/86
   7:  */
   8: 
   9: /*
  10:  * Interface Control Message Protocol Definitions.
  11:  * Per RFC 792, September 1981.
  12:  */
  13: 
  14: /*
  15:  * Structure of an icmp header.
  16:  */
  17: struct icmp {
  18:     u_char  icmp_type;      /* type of message, see below */
  19:     u_char  icmp_code;      /* type sub code */
  20:     u_short icmp_cksum;     /* ones complement cksum of struct */
  21:     union {
  22:         u_char ih_pptr;         /* ICMP_PARAMPROB */
  23:         struct in_addr ih_gwaddr;   /* ICMP_REDIRECT */
  24:         struct ih_idseq {
  25:             n_short icd_id;
  26:             n_short icd_seq;
  27:         } ih_idseq;
  28:         int ih_void;
  29:     } icmp_hun;
  30: #define icmp_pptr   icmp_hun.ih_pptr
  31: #define icmp_gwaddr icmp_hun.ih_gwaddr
  32: #define icmp_id     icmp_hun.ih_idseq.icd_id
  33: #define icmp_seq    icmp_hun.ih_idseq.icd_seq
  34: #define icmp_void   icmp_hun.ih_void
  35:     union {
  36:         struct id_ts {
  37:             n_time its_otime;
  38:             n_time its_rtime;
  39:             n_time its_ttime;
  40:         } id_ts;
  41:         struct id_ip  {
  42:             struct ip idi_ip;
  43:             /* options and then 64 bits of data */
  44:         } id_ip;
  45:         u_long  id_mask;
  46:         char    id_data[1];
  47:     } icmp_dun;
  48: #define icmp_otime  icmp_dun.id_ts.its_otime
  49: #define icmp_rtime  icmp_dun.id_ts.its_rtime
  50: #define icmp_ttime  icmp_dun.id_ts.its_ttime
  51: #define icmp_ip     icmp_dun.id_ip.idi_ip
  52: #define icmp_mask   icmp_dun.id_mask
  53: #define icmp_data   icmp_dun.id_data
  54: };
  55: 
  56: /*
  57:  * Lower bounds on packet lengths for various types.
  58:  * For the error advice packets must first insure that the
  59:  * packet is large enought to contain the returned ip header.
  60:  * Only then can we do the check to see if 64 bits of packet
  61:  * data have been returned, since we need to check the returned
  62:  * ip header length.
  63:  */
  64: #define ICMP_MINLEN 8               /* abs minimum */
  65: #define ICMP_TSLEN  (8 + 3 * sizeof (n_time))   /* timestamp */
  66: #define ICMP_MASKLEN    12              /* address mask */
  67: #define ICMP_ADVLENMIN  (8 + sizeof (struct ip) + 8)    /* min */
  68: #define ICMP_ADVLEN(p)  (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
  69:     /* N.B.: must separately check that ip_hl >= 5 */
  70: 
  71: /*
  72:  * Definition of type and code field values.
  73:  */
  74: #define ICMP_ECHOREPLY      0       /* echo reply */
  75: #define ICMP_UNREACH        3       /* dest unreachable, codes: */
  76: #define     ICMP_UNREACH_NET    0       /* bad net */
  77: #define     ICMP_UNREACH_HOST   1       /* bad host */
  78: #define     ICMP_UNREACH_PROTOCOL   2       /* bad protocol */
  79: #define     ICMP_UNREACH_PORT   3       /* bad port */
  80: #define     ICMP_UNREACH_NEEDFRAG   4       /* IP_DF caused drop */
  81: #define     ICMP_UNREACH_SRCFAIL    5       /* src route failed */
  82: #define ICMP_SOURCEQUENCH   4       /* packet lost, slow down */
  83: #define ICMP_REDIRECT       5       /* shorter route, codes: */
  84: #define     ICMP_REDIRECT_NET   0       /* for network */
  85: #define     ICMP_REDIRECT_HOST  1       /* for host */
  86: #define     ICMP_REDIRECT_TOSNET    2       /* for tos and net */
  87: #define     ICMP_REDIRECT_TOSHOST   3       /* for tos and host */
  88: #define ICMP_ECHO       8       /* echo service */
  89: #define ICMP_TIMXCEED       11      /* time exceeded, code: */
  90: #define     ICMP_TIMXCEED_INTRANS   0       /* ttl==0 in transit */
  91: #define     ICMP_TIMXCEED_REASS 1       /* ttl==0 in reass */
  92: #define ICMP_PARAMPROB      12      /* ip header bad */
  93: #define ICMP_TSTAMP     13      /* timestamp request */
  94: #define ICMP_TSTAMPREPLY    14      /* timestamp reply */
  95: #define ICMP_IREQ       15      /* information request */
  96: #define ICMP_IREQREPLY      16      /* information reply */
  97: #define ICMP_MASKREQ        17      /* address mask request */
  98: #define ICMP_MASKREPLY      18      /* address mask reply */
  99: 
 100: #define ICMP_MAXTYPE        18

Defined struct's

icmp defined in line 17; used 12 times
id_ip defined in line 41; never used
id_ts defined in line 36; never used
ih_idseq defined in line 24; never used

Defined macros

ICMP_ADVLEN defined in line 68; used 2 times
ICMP_ADVLENMIN defined in line 67; used 3 times
ICMP_ECHO defined in line 88; never used
ICMP_ECHOREPLY defined in line 74; used 1 times
ICMP_IREQ defined in line 95; never used
ICMP_IREQREPLY defined in line 96; used 2 times
ICMP_MASKLEN defined in line 66; used 1 times
ICMP_MASKREPLY defined in line 98; never used
ICMP_MASKREQ defined in line 97; never used
ICMP_MAXTYPE defined in line 100; used 2 times
ICMP_MINLEN defined in line 64; used 2 times
ICMP_REDIRECT_HOST defined in line 85; used 2 times
ICMP_REDIRECT_TOSHOST defined in line 87; never used
ICMP_REDIRECT_TOSNET defined in line 86; used 1 times
ICMP_SOURCEQUENCH defined in line 82; used 1 times
ICMP_TIMXCEED defined in line 89; used 1 times
ICMP_TIMXCEED_INTRANS defined in line 90; used 1 times
ICMP_TIMXCEED_REASS defined in line 91; never used
ICMP_TSLEN defined in line 65; used 1 times
ICMP_TSTAMP defined in line 93; never used
ICMP_TSTAMPREPLY defined in line 94; used 1 times
ICMP_UNREACH_HOST defined in line 77; used 1 times
ICMP_UNREACH_NEEDFRAG defined in line 80; used 1 times
ICMP_UNREACH_NET defined in line 76; used 2 times
ICMP_UNREACH_PROTOCOL defined in line 78; never used
ICMP_UNREACH_SRCFAIL defined in line 81; used 3 times
icmp_data defined in line 53; never used
icmp_gwaddr defined in line 31; used 3 times
icmp_id defined in line 32; never used
icmp_ip defined in line 51; used 12 times
icmp_mask defined in line 52; used 1 times
icmp_otime defined in line 48; never used
icmp_pptr defined in line 30; used 1 times
icmp_rtime defined in line 49; used 2 times
icmp_seq defined in line 33; never used
icmp_ttime defined in line 50; used 1 times
icmp_void defined in line 34; used 1 times

Usage of this include

Last modified: 1986-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1170
Valid CSS Valid XHTML 1.0 Strict