hs_dos.h 964 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* Copyright (c) 2019, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. /**
  4. * \file hs_dos.h
  5. * \brief Header file containing denial of service defenses for the HS
  6. * subsystem for all versions.
  7. **/
  8. #ifndef TOR_HS_DOS_H
  9. #define TOR_HS_DOS_H
  10. #include "core/or/or_circuit_st.h"
  11. #include "lib/evloop/token_bucket.h"
  12. #define HS_DOS_INTRODUCE_CELL_RATE_PER_SEC 25
  13. #define HS_DOS_INTRODUCE_CELL_BURST_PER_SEC 200
  14. bool hs_dos_can_send_intro2(or_circuit_t *s_intro_circ);
  15. /* Return the INTRODUCE2 cell rate per second. */
  16. static inline
  17. uint32_t hs_dos_get_intro2_rate(void)
  18. {
  19. return HS_DOS_INTRODUCE_CELL_RATE_PER_SEC;
  20. }
  21. /* Return the INTRODUCE2 cell burst per second. */
  22. static inline
  23. uint32_t hs_dos_get_intro2_burst(void)
  24. {
  25. return HS_DOS_INTRODUCE_CELL_BURST_PER_SEC;
  26. }
  27. #ifdef HS_DOS_PRIVATE
  28. #ifdef TOR_UNIT_TESTS
  29. #endif /* define(TOR_UNIT_TESTS) */
  30. #endif /* defined(HS_DOS_PRIVATE) */
  31. #endif /* !defined(TOR_HS_DOS_H) */