tcp_hostcache.h revision 185420
1185420Szec/*- 2185420Szec * Copyright (c) 2002 Andre Oppermann, Internet Business Solutions AG 3185420Szec * All rights reserved. 4185420Szec * 5185420Szec * Redistribution and use in source and binary forms, with or without 6185420Szec * modification, are permitted provided that the following conditions 7185420Szec * are met: 8185420Szec * 1. Redistributions of source code must retain the above copyright 9185420Szec * notice, this list of conditions and the following disclaimer. 10185420Szec * 2. Redistributions in binary form must reproduce the above copyright 11185420Szec * notice, this list of conditions and the following disclaimer in the 12185420Szec * documentation and/or other materials provided with the distribution. 13185420Szec * 3. The name of the author may not be used to endorse or promote 14185420Szec * products derived from this software without specific prior written 15185420Szec * permission. 16185420Szec * 17185420Szec * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18185420Szec * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19185420Szec * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20185420Szec * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21185420Szec * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22185420Szec * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23185420Szec * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24185420Szec * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25185420Szec * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26185420Szec * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27185420Szec * SUCH DAMAGE. 28185420Szec * 29185420Szec * $FreeBSD: head/sys/netinet/tcp_hostcache.h 185420 2008-11-28 23:39:25Z zec $ 30185420Szec */ 31185420Szec 32185420Szec/* 33185420Szec * Many thanks to jlemon for basic structure of tcp_syncache which is being 34185420Szec * followed here. 35185420Szec */ 36185420Szec 37185420Szec#ifndef _NETINET_TCP_HOSTCACHE_H_ 38185420Szec#define _NETINET_TCP_HOSTCACHE_H_ 39185420Szec 40185420SzecTAILQ_HEAD(hc_qhead, hc_metrics); 41185420Szec 42185420Szecstruct hc_head { 43185420Szec struct hc_qhead hch_bucket; 44185420Szec u_int hch_length; 45185420Szec struct mtx hch_mtx; 46185420Szec}; 47185420Szec 48185420Szecstruct hc_metrics { 49185420Szec /* housekeeping */ 50185420Szec TAILQ_ENTRY(hc_metrics) rmx_q; 51185420Szec struct hc_head *rmx_head; /* head of bucket tail queue */ 52185420Szec struct in_addr ip4; /* IP address */ 53185420Szec struct in6_addr ip6; /* IP6 address */ 54185420Szec /* endpoint specific values for tcp */ 55185420Szec u_long rmx_mtu; /* MTU for this path */ 56185420Szec u_long rmx_ssthresh; /* outbound gateway buffer limit */ 57185420Szec u_long rmx_rtt; /* estimated round trip time */ 58185420Szec u_long rmx_rttvar; /* estimated rtt variance */ 59185420Szec u_long rmx_bandwidth; /* estimated bandwidth */ 60185420Szec u_long rmx_cwnd; /* congestion window */ 61185420Szec u_long rmx_sendpipe; /* outbound delay-bandwidth product */ 62185420Szec u_long rmx_recvpipe; /* inbound delay-bandwidth product */ 63185420Szec /* TCP hostcache internal data */ 64185420Szec int rmx_expire; /* lifetime for object */ 65185420Szec u_long rmx_hits; /* number of hits */ 66185420Szec u_long rmx_updates; /* number of updates */ 67185420Szec}; 68185420Szec 69185420Szecstruct tcp_hostcache { 70185420Szec struct hc_head *hashbase; 71185420Szec uma_zone_t zone; 72185420Szec u_int hashsize; 73185420Szec u_int hashmask; 74185420Szec u_int bucket_limit; 75185420Szec u_int cache_count; 76185420Szec u_int cache_limit; 77185420Szec int expire; 78185420Szec int prune; 79185420Szec int purgeall; 80185420Szec}; 81185420Szec 82185420Szec#endif /* !_NETINET_TCP_HOSTCACHE_H_*/ 83