1292706Spkelsey/*-
2292706Spkelsey * Copyright (c) 2015 Patrick Kelsey
3292706Spkelsey * All rights reserved.
4292706Spkelsey *
5292706Spkelsey * Redistribution and use in source and binary forms, with or without
6292706Spkelsey * modification, are permitted provided that the following conditions
7292706Spkelsey * are met:
8292706Spkelsey * 1. Redistributions of source code must retain the above copyright
9292706Spkelsey *    notice, this list of conditions and the following disclaimer.
10292706Spkelsey * 2. Redistributions in binary form must reproduce the above copyright
11292706Spkelsey *    notice, this list of conditions and the following disclaimer in the
12292706Spkelsey *    documentation and/or other materials provided with the distribution.
13292706Spkelsey *
14292706Spkelsey * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15292706Spkelsey * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16292706Spkelsey * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17292706Spkelsey * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18292706Spkelsey * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19292706Spkelsey * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20292706Spkelsey * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21292706Spkelsey * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22292706Spkelsey * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23292706Spkelsey * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24292706Spkelsey * SUCH DAMAGE.
25292706Spkelsey *
26292706Spkelsey * $FreeBSD$
27292706Spkelsey */
28292706Spkelsey
29292706Spkelsey#ifndef _TCP_FASTOPEN_H_
30292706Spkelsey#define _TCP_FASTOPEN_H_
31292706Spkelsey
32292706Spkelsey#ifdef _KERNEL
33292706Spkelsey
34292706Spkelsey#define	TCP_FASTOPEN_COOKIE_LEN	8	/* tied to SipHash24 64-bit output */
35292706Spkelsey
36292706SpkelseyVNET_DECLARE(unsigned int, tcp_fastopen_enabled);
37292706Spkelsey#define	V_tcp_fastopen_enabled	VNET(tcp_fastopen_enabled)
38292706Spkelsey
39292706Spkelseyvoid	tcp_fastopen_init(void);
40292706Spkelseyvoid	tcp_fastopen_destroy(void);
41292706Spkelseyunsigned int *tcp_fastopen_alloc_counter(void);
42292706Spkelseyvoid	tcp_fastopen_decrement_counter(unsigned int *counter);
43292706Spkelseyint	tcp_fastopen_check_cookie(struct in_conninfo *inc, uint8_t *cookie,
44292706Spkelsey	    unsigned int len, uint64_t *latest_cookie);
45292706Spkelsey#endif /* _KERNEL */
46292706Spkelsey
47292706Spkelsey#endif /* _TCP_FASTOPEN_H_ */
48