home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / bsd / netinet / ip_var.h < prev    next >
C/C++ Source or Header  |  1993-10-19  |  3KB  |  109 lines

  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_var.h    7.4 (Berkeley) 1/7/88
  13.  *
  14.  */
  15.  
  16. /*
  17.  * Overlay for ip header used by other protocols (tcp, udp).
  18.  */
  19. struct ipovly {
  20.     caddr_t    ih_next, ih_prev;    /* for protocol sequence q's */
  21.     u_char    ih_x1;            /* (unused) */
  22.     u_char    ih_pr;            /* protocol */
  23.     short    ih_len;            /* protocol length */
  24.     struct    in_addr ih_src;        /* source internet address */
  25.     struct    in_addr ih_dst;        /* destination internet address */
  26. };
  27.  
  28. /*
  29.  * Ip reassembly queue structure.  Each fragment
  30.  * being reassembled is attached to one of these structures.
  31.  * They are timed out after ipq_ttl drops to 0, and may also
  32.  * be reclaimed if memory becomes tight.
  33.  */
  34. struct ipq {
  35.     struct    ipq *next,*prev;    /* to other reass headers */
  36.     u_char    ipq_ttl;        /* time for reass q to live */
  37.     u_char    ipq_p;            /* protocol of this fragment */
  38.     u_short    ipq_id;            /* sequence id for reassembly */
  39.     struct    ipasfrag *ipq_next,*ipq_prev;
  40.                     /* to ip headers of fragments */
  41.     struct    in_addr ipq_src,ipq_dst;
  42. };
  43.  
  44. /*
  45.  * Ip header, when holding a fragment.
  46.  *
  47.  * Note: ipf_next must be at same offset as ipq_next above
  48.  */
  49. struct    ipasfrag {
  50. #if BYTE_ORDER == LITTLE_ENDIAN 
  51.     u_char    ip_hl:4,
  52.         ip_v:4;
  53. #endif
  54. #if BYTE_ORDER == BIG_ENDIAN 
  55.     u_char    ip_v:4,
  56.         ip_hl:4;
  57. #endif
  58.     u_char    ipf_mff;        /* copied from (ip_off&IP_MF) */
  59.     short    ip_len;
  60.     u_short    ip_id;
  61.     short    ip_off;
  62.     u_char    ip_ttl;
  63.     u_char    ip_p;
  64.     u_short    ip_sum;
  65.     struct    ipasfrag *ipf_next;    /* next fragment */
  66.     struct    ipasfrag *ipf_prev;    /* previous fragment */
  67. };
  68.  
  69. /*
  70.  * Structure stored in mbuf in inpcb.ip_options
  71.  * and passed to ip_output when ip options are in use.
  72.  * The actual length of the options (including ipopt_dst)
  73.  * is in m_len.
  74.  */
  75. #define MAX_IPOPTLEN    40
  76.  
  77. struct ipoption {
  78.     struct    in_addr ipopt_dst;    /* first-hop dst if source routed */
  79.     char    ipopt_list[MAX_IPOPTLEN];    /* options proper */
  80. };
  81.  
  82. struct    ipstat {
  83.     long    ips_total;        /* total packets received */
  84.     long    ips_badsum;        /* checksum bad */
  85.     long    ips_tooshort;        /* packet too short */
  86.     long    ips_toosmall;        /* not enough data */
  87.     long    ips_badhlen;        /* ip header length < data size */
  88.     long    ips_badlen;        /* ip length < ip header length */
  89.     long    ips_fragments;        /* fragments received */
  90.     long    ips_fragdropped;    /* frags dropped (dups, out of space) */
  91.     long    ips_fragtimeout;    /* fragments timed out */
  92.     long    ips_forward;        /* packets forwarded */
  93.     long    ips_cantforward;    /* packets rcvd for unreachable dest */
  94.     long    ips_redirectsent;    /* packets forwarded on same net */
  95. };
  96.  
  97. #ifdef    KERNEL
  98. /* flags passed to ip_output as last parameter */
  99. #define    IP_FORWARDING        0x1        /* most of ip header exists */
  100. #define    IP_ROUTETOIF        SO_DONTROUTE    /* bypass routing tables */
  101. #define    IP_ALLOWBROADCAST    SO_BROADCAST    /* can send broadcast packets */
  102.  
  103. struct    ipstat    ipstat;
  104. struct    ipq    ipq;            /* ip reass. queue */
  105. u_short    ip_id;                /* ip packet ctr, for ids */
  106.  
  107. struct    mbuf *ip_srcroute();
  108. #endif    KERNEL
  109.