home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue2 / SDL.ARC / !unixlib / source / clib / netinet / h / ip_var < prev    next >
Encoding:
Text File  |  2004-09-05  |  4.5 KB  |  145 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /usr/local/cvsroot/gccsdk/unixlib/source/clib/netinet/ip_var.h,v $
  4.  * $Date: 2002/12/22 18:22:28 $
  5.  * $Revision: 1.4 $
  6.  * $State: Exp $
  7.  * $Author: admin $
  8.  *
  9.  ***************************************************************************/
  10.  
  11. #ifndef __NETINET_IP_VAR_H
  12. #define __NETINET_IP_VAR_H 1
  13.  
  14. /* Freenet programmers interface - netinet/ip_var.h - 23/5/95 */
  15. #ifndef __UNIXLIB_FEATURES_H
  16. #include <unixlib/features.h>
  17. #endif
  18.  
  19. #ifndef __UNIXLIB_TYPES_H
  20. #include <unixlib/types.h>
  21. #endif
  22.  
  23. #ifndef _NETINET_IN_H
  24. #include <netinet/in.h>
  25. #endif
  26.  
  27. __BEGIN_DECLS
  28.  
  29. /*
  30.  * Overlay for ip header used by other protocols (tcp, udp).
  31.  */
  32. struct ipovly {
  33.   __caddr_t    ih_next, ih_prev;    /* for protocol sequence q's */
  34.   __u_char    ih_x1;            /* (unused) */
  35.   __u_char    ih_pr;            /* protocol */
  36.   short        ih_len;            /* protocol length */
  37.   struct    in_addr ih_src;        /* source internet address */
  38.   struct    in_addr ih_dst;        /* destination internet address */
  39. };
  40.  
  41. /*
  42.  * Ip reassembly queue structure.  Each fragment
  43.  * being reassembled is attached to one of these structures.
  44.  * They are timed out after ipq_ttl drops to 0, and may also
  45.  * be reclaimed if memory becomes tight.
  46.  */
  47. struct ipq {
  48.   struct    ipq *next,*prev;    /* to other reass headers */
  49.   __u_char    ipq_ttl;        /* time for reass q to live */
  50.   __u_char    ipq_p;            /* protocol of this fragment */
  51.   __u_short    ipq_id;            /* sequence id for reassembly */
  52.   struct    ipasfrag *ipq_next,*ipq_prev;
  53.                     /* to ip headers of fragments */
  54.   struct    in_addr ipq_src,ipq_dst;
  55. };
  56.  
  57. /*
  58.  * Ip header, when holding a fragment.
  59.  *
  60.  * Note: ipf_next must be at same offset as ipq_next above
  61.  * Bitfields are necessary for the ARM C compiler in ANSI mode.
  62.  */
  63. struct    ipasfrag {
  64. #if BYTE_ORDER == LITTLE_ENDIAN
  65.   __u_int    ip_hl : 4;
  66.   __u_int    ip_v  : 4;
  67. #endif
  68. #if BYTE_ORDER == BIG_ENDIAN
  69.   __u_int    ip_v  : 4;
  70.   __u_int    ip_hl : 4;
  71. #endif
  72.   __u_int    ipf_mff : 8;        /* XXX overlays ip_tos: use low bit
  73.                      * to avoid destroying tos;
  74.                      * copied from (ip_off&IP_MF) */
  75.   __u_int    ip_len : 16;
  76.   __u_short    ip_id;
  77.   short        ip_off;
  78.   __u_char    ip_ttl;
  79.   __u_char    ip_p;
  80.   __u_short    ip_sum;
  81.   struct    ipasfrag *ipf_next;    /* next fragment */
  82.   struct    ipasfrag *ipf_prev;    /* previous fragment */
  83. };
  84.  
  85. /*
  86.  * Structure stored in mbuf in inpcb.ip_options
  87.  * and passed to ip_output when ip options are in use.
  88.  * The actual length of the options (including ipopt_dst)
  89.  * is in m_len.
  90.  */
  91. #define MAX_IPOPTLEN    40
  92.  
  93. struct ipoption {
  94.     struct    in_addr ipopt_dst;    /* first-hop dst if source routed */
  95.     char    ipopt_list[MAX_IPOPTLEN];    /* options proper */
  96. };
  97.  
  98. /*
  99.  * Structure attached to inpcb.ip_moptions and
  100.  * passed to ip_output when IP multicast options are in use.
  101.  */
  102. struct ip_moptions {
  103.   struct    ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */
  104.   __u_char    imo_multicast_ttl;    /* TTL for outgoing multicasts */
  105.   __u_char    imo_multicast_loop;    /* 1 => hear sends if a member */
  106.   __u_short    imo_num_memberships;    /* no. memberships this socket */
  107.   struct    in_multi *imo_membership[IP_MAX_MEMBERSHIPS];
  108. };
  109.  
  110. struct    ipstat {
  111.   __u_long    ips_total;        /* total packets received */
  112.   __u_long    ips_badsum;        /* checksum bad */
  113.   __u_long    ips_tooshort;        /* packet too short */
  114.   __u_long    ips_toosmall;        /* not enough data */
  115.   __u_long    ips_badhlen;        /* ip header length < data size */
  116.   __u_long    ips_badlen;        /* ip length < ip header length */
  117.   __u_long    ips_fragments;        /* fragments received */
  118.   __u_long    ips_fragdropped;    /* frags dropped (dups, out of space) */
  119.   __u_long    ips_fragtimeout;    /* fragments timed out */
  120.   __u_long    ips_forward;        /* packets forwarded */
  121.   __u_long    ips_cantforward;    /* packets rcvd for unreachable dest */
  122.   __u_long    ips_redirectsent;    /* packets forwarded on same net */
  123.   __u_long    ips_noproto;        /* unknown or unsupported protocol */
  124.   __u_long    ips_delivered;        /* datagrams delivered to upper level*/
  125.   __u_long    ips_localout;        /* total ip packets generated here */
  126.   __u_long    ips_odropped;        /* lost packets due to nobufs, etc. */
  127.   __u_long    ips_reassembled;    /* total packets reassembled ok */
  128.   __u_long    ips_fragmented;        /* datagrams sucessfully fragmented */
  129.   __u_long    ips_ofragments;        /* output fragments created */
  130.   __u_long    ips_cantfrag;        /* don't fragment flag was set, etc. */
  131.   __u_long    ips_badoptions;        /* error in option processing */
  132.   __u_long    ips_noroute;        /* packets discarded due to no route */
  133.   __u_long    ips_badvers;        /* ip version != 4 */
  134.   __u_long    ips_rawout;        /* total raw ip packets generated */
  135. };
  136.  
  137. /*
  138.  * Maximum size of the IP options for a packet
  139.  */
  140. #define    MAX_IPOPTLEN 40
  141.  
  142. __END_DECLS
  143.  
  144. #endif
  145.