Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/tcp_fastopen.h
Show All 25 Lines | |||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef _TCP_FASTOPEN_H_ | #ifndef _TCP_FASTOPEN_H_ | ||||
#define _TCP_FASTOPEN_H_ | #define _TCP_FASTOPEN_H_ | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
#include "opt_inet.h" | |||||
#define TCP_FASTOPEN_COOKIE_LEN 8 /* SipHash24 64-bit output */ | #define TCP_FASTOPEN_COOKIE_LEN 8 /* SipHash24 64-bit output */ | ||||
#ifdef TCP_RFC7413 | |||||
VNET_DECLARE(unsigned int, tcp_fastopen_client_enable); | VNET_DECLARE(unsigned int, tcp_fastopen_client_enable); | ||||
#define V_tcp_fastopen_client_enable VNET(tcp_fastopen_client_enable) | #define V_tcp_fastopen_client_enable VNET(tcp_fastopen_client_enable) | ||||
VNET_DECLARE(unsigned int, tcp_fastopen_server_enable); | VNET_DECLARE(unsigned int, tcp_fastopen_server_enable); | ||||
#define V_tcp_fastopen_server_enable VNET(tcp_fastopen_server_enable) | #define V_tcp_fastopen_server_enable VNET(tcp_fastopen_server_enable) | ||||
#else | |||||
#define V_tcp_fastopen_client_enable 0 | |||||
#define V_tcp_fastopen_server_enable 0 | |||||
#endif /* TCP_RFC7413 */ | |||||
union tcp_fastopen_ip_addr { | union tcp_fastopen_ip_addr { | ||||
struct in_addr v4; | struct in_addr v4; | ||||
struct in6_addr v6; | struct in6_addr v6; | ||||
}; | }; | ||||
struct tcp_fastopen_ccache_entry { | struct tcp_fastopen_ccache_entry { | ||||
TAILQ_ENTRY(tcp_fastopen_ccache_entry) cce_link; | TAILQ_ENTRY(tcp_fastopen_ccache_entry) cce_link; | ||||
Show All 20 Lines | struct tcp_fastopen_ccache { | ||||
uma_zone_t zone; | uma_zone_t zone; | ||||
struct tcp_fastopen_ccache_bucket *base; | struct tcp_fastopen_ccache_bucket *base; | ||||
unsigned int bucket_limit; | unsigned int bucket_limit; | ||||
unsigned int buckets; | unsigned int buckets; | ||||
unsigned int mask; | unsigned int mask; | ||||
uint32_t secret; | uint32_t secret; | ||||
}; | }; | ||||
#ifdef TCP_RFC7413 | |||||
void tcp_fastopen_init(void); | void tcp_fastopen_init(void); | ||||
void tcp_fastopen_destroy(void); | void tcp_fastopen_destroy(void); | ||||
unsigned int *tcp_fastopen_alloc_counter(void); | unsigned int *tcp_fastopen_alloc_counter(void); | ||||
void tcp_fastopen_decrement_counter(unsigned int *); | void tcp_fastopen_decrement_counter(unsigned int *); | ||||
int tcp_fastopen_check_cookie(struct in_conninfo *, uint8_t *, unsigned int, | int tcp_fastopen_check_cookie(struct in_conninfo *, uint8_t *, unsigned int, | ||||
uint64_t *); | uint64_t *); | ||||
void tcp_fastopen_connect(struct tcpcb *); | void tcp_fastopen_connect(struct tcpcb *); | ||||
void tcp_fastopen_disable_path(struct tcpcb *); | void tcp_fastopen_disable_path(struct tcpcb *); | ||||
void tcp_fastopen_update_cache(struct tcpcb *, uint16_t, uint8_t, | void tcp_fastopen_update_cache(struct tcpcb *, uint16_t, uint8_t, | ||||
uint8_t *); | uint8_t *); | ||||
#else | |||||
#define tcp_fastopen_init() ((void)0) | |||||
#define tcp_fastopen_destroy() ((void)0) | |||||
#define tcp_fastopen_alloc_counter() NULL | |||||
#define tcp_fastopen_decrement_counter(c) ((void)0) | |||||
#define tcp_fastopen_check_cookie(i, c, l, lc) (-1) | |||||
#define tcp_fastopen_connect(t) ((void)0) | |||||
#define tcp_fastopen_disable_path(t) ((void)0) | |||||
#define tcp_fastopen_update_cache(t, m, l, c) ((void)0) | |||||
#endif /* TCP_RFC7413 */ | |||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
#endif /* _TCP_FASTOPEN_H_ */ | #endif /* _TCP_FASTOPEN_H_ */ |