1165139Syongari/*-
2165139Syongari * Copyright (c) 2002 Andre Oppermann, Internet Business Solutions AG
3165139Syongari * All rights reserved.
4165139Syongari *
5165139Syongari * Redistribution and use in source and binary forms, with or without
6165139Syongari * modification, are permitted provided that the following conditions
7165139Syongari * are met:
8165139Syongari * 1. Redistributions of source code must retain the above copyright
9165139Syongari *    notice, this list of conditions and the following disclaimer.
10165139Syongari * 2. Redistributions in binary form must reproduce the above copyright
11165139Syongari *    notice, this list of conditions and the following disclaimer in the
12165139Syongari *    documentation and/or other materials provided with the distribution.
13165139Syongari * 3. The name of the author may not be used to endorse or promote
14165139Syongari *    products derived from this software without specific prior written
15165139Syongari *    permission.
16165139Syongari *
17165139Syongari * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18165139Syongari * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19165139Syongari * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20165139Syongari * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21165139Syongari * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22165139Syongari * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23165139Syongari * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24165139Syongari * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25165139Syongari * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26165139Syongari * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27222232Syongari * SUCH DAMAGE.
28165139Syongari *
29165139Syongari * $FreeBSD$
30165139Syongari */
31165139Syongari
32165139Syongari/*
33165139Syongari * Many thanks to jlemon for basic structure of tcp_syncache which is being
34165139Syongari * followed here.
35165139Syongari */
36165139Syongari
37165139Syongari#ifndef _NETINET_TCP_HOSTCACHE_H_
38165139Syongari#define _NETINET_TCP_HOSTCACHE_H_
39165139Syongari
40165139SyongariTAILQ_HEAD(hc_qhead, hc_metrics);
41165139Syongari
42165139Syongaristruct hc_head {
43165139Syongari	struct hc_qhead	hch_bucket;
44165139Syongari	u_int		hch_length;
45165139Syongari	struct mtx	hch_mtx;
46165139Syongari};
47165139Syongari
48165139Syongaristruct hc_metrics {
49165139Syongari	/* housekeeping */
50165139Syongari	TAILQ_ENTRY(hc_metrics) rmx_q;
51165139Syongari	struct	hc_head *rmx_head; /* head of bucket tail queue */
52165139Syongari	struct	in_addr ip4;	/* IP address */
53165139Syongari	struct	in6_addr ip6;	/* IP6 address */
54165139Syongari	/* endpoint specific values for tcp */
55165139Syongari	u_long	rmx_mtu;	/* MTU for this path */
56165139Syongari	u_long	rmx_ssthresh;	/* outbound gateway buffer limit */
57165156Sbrueffer	u_long	rmx_rtt;	/* estimated round trip time */
58165156Sbrueffer	u_long	rmx_rttvar;	/* estimated rtt variance */
59165139Syongari	u_long	rmx_bandwidth;	/* estimated bandwidth */
60165139Syongari	u_long	rmx_cwnd;	/* congestion window */
61165139Syongari	u_long	rmx_sendpipe;	/* outbound delay-bandwidth product */
62165139Syongari	u_long	rmx_recvpipe;	/* inbound delay-bandwidth product */
63165139Syongari	/* TCP hostcache internal data */
64171130Sbrueffer	int	rmx_expire;	/* lifetime for object */
65165139Syongari	u_long	rmx_hits;	/* number of hits */
66165139Syongari	u_long	rmx_updates;	/* number of updates */
67165139Syongari};
68171130Sbrueffer
69165139Syongaristruct tcp_hostcache {
70165139Syongari	struct	hc_head *hashbase;
71165139Syongari	uma_zone_t zone;
72165139Syongari	u_int	hashsize;
73165139Syongari	u_int	hashmask;
74165139Syongari	u_int	bucket_limit;
75165139Syongari	u_int	cache_count;
76165139Syongari	u_int	cache_limit;
77165139Syongari	int	expire;
78165139Syongari	int	prune;
79165139Syongari	int	purgeall;
80165139Syongari};
81165139Syongari
82165139Syongari#endif /* !_NETINET_TCP_HOSTCACHE_H_*/
83165139Syongari