timewait_sock.h 925 B

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