home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilss / sockets / include / netinet / h / ip_var < prev    next >
Encoding:
Text File  |  1995-01-11  |  3.8 KB  |  109 lines

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