home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / darwin / darwinx86.iso / usr / include / netinet / in_hostcache.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-30  |  4.0 KB  |  104 lines

  1. /*
  2.  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
  3.  *
  4.  * @APPLE_LICENSE_HEADER_START@
  5.  * 
  6.  * The contents of this file constitute Original Code as defined in and
  7.  * are subject to the Apple Public Source License Version 1.1 (the
  8.  * "License").  You may not use this file except in compliance with the
  9.  * License.  Please obtain a copy of the License at
  10.  * http://www.apple.com/publicsource and read it before using this file.
  11.  * 
  12.  * This Original Code and all software distributed under the License are
  13.  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  14.  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  15.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  16.  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
  17.  * License for the specific language governing rights and limitations
  18.  * under the License.
  19.  * 
  20.  * @APPLE_LICENSE_HEADER_END@
  21.  */
  22. /*
  23.  * Copyright 1997 Massachusetts Institute of Technology
  24.  *
  25.  * Permission to use, copy, modify, and distribute this software and
  26.  * its documentation for any purpose and without fee is hereby
  27.  * granted, provided that both the above copyright notice and this
  28.  * permission notice appear in all copies, that both the above
  29.  * copyright notice and this permission notice appear in all
  30.  * supporting documentation, and that the name of M.I.T. not be used
  31.  * in advertising or publicity pertaining to distribution of the
  32.  * software without specific, written prior permission.  M.I.T. makes
  33.  * no representations about the suitability of this software for any
  34.  * purpose.  It is provided "as is" without express or implied
  35.  * warranty.
  36.  * 
  37.  * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
  38.  * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
  39.  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  40.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
  41.  * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  42.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  43.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  44.  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  45.  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  46.  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  47.  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  48.  * SUCH DAMAGE.
  49.  *
  50.  */
  51.  
  52. #ifndef _NETINET_IN_HOSTCACHE_H
  53. #define    _NETINET_IN_HOSTCACHE_H    1
  54.  
  55. /*
  56.  * This file defines the particular structures contained in the host cache
  57.  * for the use of IP.
  58.  */
  59.  
  60. /*
  61.  * An IP host cache entry.  Note that we include the srtt/var here,
  62.  * with the expectation that it might be used to keep a persistent,
  63.  * cross-connection view of this statistic.
  64.  */
  65. struct in_hcentry {
  66.     struct    hcentry inhc_hc;
  67.     u_long    inhc_pmtu;
  68.     u_long    inhc_recvpipe;
  69.     u_long    inhc_sendpipe;
  70.     u_long    inhc_pksent;
  71.     u_long    inhc_flags;
  72.     u_long    inhc_ssthresh;
  73.     int    inhc_srtt;    /* VJ RTT estimator */
  74.     int    inhc_srttvar;    /* VJ */
  75.     u_int    inhc_rttmin;    /* VJ */
  76.     int    inhc_rxt;    /* TCP retransmit timeout */
  77.     u_long    inhc_cc;    /* deliberate type pun with tcp_cc */
  78.     u_long    inhc_ccsent;    /* as above */
  79.     u_short    inhc_mssopt;
  80. };
  81.  
  82. #define    inhc_addr(inhc)    ((struct sockaddr_in *)(inhc)->inhc_hc.hc_host)
  83.  
  84. /* Flags for inhc_flags... */
  85. #define    INHC_LOCAL    0x0001    /* this address is local */
  86. #define    INHC_BROADCAST    0x0002    /* this address is broadcast */
  87. #define    INHC_MULTICAST    0x0004    /* this address is multicast */
  88. #define    INHC_REDUCEDMTU    0x0008    /* we reduced the mtu via PMTU discovery */
  89.  
  90. #ifdef KERNEL
  91. /*
  92.  * inhc_alloc can block while adding a new entry to the cache;
  93.  * inhc_lookup will does not add new entries and so can be called
  94.  * in non-process context.
  95.  */
  96. struct    in_hcentry *inhc_alloc(struct sockaddr_in *sin);
  97. int    inhc_init(void);
  98. struct    in_hcentry *inhc_lookup(struct sockaddr_in *sin);
  99. #define    inhc_ref(inhc)    (hc_ref(&(inhc)->inhc_hc))
  100. #define    inhc_rele(inhc)    (hc_rele(&(inhc)->inhc_hc))
  101. #endif /* KERNEL */
  102.  
  103. #endif /* _NETINET_IN_HOSTCACHE_H */
  104.