18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * NET Generic infrastructure for Network protocols. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Authors: Arnaldo Carvalho de Melo <acme@conectiva.com.br> 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci#ifndef _TIMEWAIT_SOCK_H 88c2ecf20Sopenharmony_ci#define _TIMEWAIT_SOCK_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/slab.h> 118c2ecf20Sopenharmony_ci#include <linux/bug.h> 128c2ecf20Sopenharmony_ci#include <net/sock.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_cistruct timewait_sock_ops { 158c2ecf20Sopenharmony_ci struct kmem_cache *twsk_slab; 168c2ecf20Sopenharmony_ci char *twsk_slab_name; 178c2ecf20Sopenharmony_ci unsigned int twsk_obj_size; 188c2ecf20Sopenharmony_ci int (*twsk_unique)(struct sock *sk, 198c2ecf20Sopenharmony_ci struct sock *sktw, void *twp); 208c2ecf20Sopenharmony_ci void (*twsk_destructor)(struct sock *sk); 218c2ecf20Sopenharmony_ci}; 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_cistatic inline int twsk_unique(struct sock *sk, struct sock *sktw, void *twp) 248c2ecf20Sopenharmony_ci{ 258c2ecf20Sopenharmony_ci if (sk->sk_prot->twsk_prot->twsk_unique != NULL) 268c2ecf20Sopenharmony_ci return sk->sk_prot->twsk_prot->twsk_unique(sk, sktw, twp); 278c2ecf20Sopenharmony_ci return 0; 288c2ecf20Sopenharmony_ci} 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_cistatic inline void twsk_destructor(struct sock *sk) 318c2ecf20Sopenharmony_ci{ 328c2ecf20Sopenharmony_ci if (sk->sk_prot->twsk_prot->twsk_destructor != NULL) 338c2ecf20Sopenharmony_ci sk->sk_prot->twsk_prot->twsk_destructor(sk); 348c2ecf20Sopenharmony_ci} 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#endif /* _TIMEWAIT_SOCK_H */ 37