^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * NET Generic infrastructure for Network protocols.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Authors: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #ifndef _TIMEWAIT_SOCK_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define _TIMEWAIT_SOCK_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/bug.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <net/sock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct timewait_sock_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct kmem_cache *twsk_slab;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) char *twsk_slab_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) unsigned int twsk_obj_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) int (*twsk_unique)(struct sock *sk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) struct sock *sktw, void *twp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) void (*twsk_destructor)(struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) static inline int twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) if (sk->sk_prot->twsk_prot->twsk_unique != NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) return sk->sk_prot->twsk_prot->twsk_unique(sk, sktw, twp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) static inline void twsk_destructor(struct sock *sk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) if (sk->sk_prot->twsk_prot->twsk_destructor != NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) sk->sk_prot->twsk_prot->twsk_destructor(sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #endif /* _TIMEWAIT_SOCK_H */