2019-05-29 14:05:16 -04:00
|
|
|
/* Copyright (c) 2019, The Tor Project, Inc. */
|
|
|
|
/* See LICENSE for licensing information */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \file hs_dos.h
|
|
|
|
* \brief Header file containing denial of service defenses for the HS
|
|
|
|
* subsystem for all versions.
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef TOR_HS_DOS_H
|
|
|
|
#define TOR_HS_DOS_H
|
|
|
|
|
|
|
|
#include "core/or/or_circuit_st.h"
|
|
|
|
|
2019-06-11 08:28:13 -04:00
|
|
|
#include "feature/nodelist/networkstatus_st.h"
|
2019-05-29 14:05:16 -04:00
|
|
|
|
2019-06-11 08:28:13 -04:00
|
|
|
/* Init */
|
|
|
|
void hs_dos_init(void);
|
|
|
|
|
|
|
|
/* Consensus. */
|
|
|
|
void hs_dos_consensus_has_changed(const networkstatus_t *ns);
|
2019-05-29 14:05:16 -04:00
|
|
|
|
2019-08-12 12:32:38 -04:00
|
|
|
/* Introduction Point. */
|
2019-05-29 14:05:16 -04:00
|
|
|
bool hs_dos_can_send_intro2(or_circuit_t *s_intro_circ);
|
2019-08-20 08:35:21 -04:00
|
|
|
void hs_dos_setup_default_intro2_defenses(or_circuit_t *circ);
|
2019-05-29 14:05:16 -04:00
|
|
|
|
2019-10-31 13:57:14 -04:00
|
|
|
/* Statistics. */
|
|
|
|
uint64_t hs_dos_get_intro2_rejected_count(void);
|
|
|
|
|
2019-05-29 14:05:16 -04:00
|
|
|
#ifdef HS_DOS_PRIVATE
|
|
|
|
|
|
|
|
#ifdef TOR_UNIT_TESTS
|
|
|
|
|
2019-08-20 08:52:34 -04:00
|
|
|
STATIC uint32_t get_intro2_enable_consensus_param(const networkstatus_t *ns);
|
|
|
|
STATIC uint32_t get_intro2_rate_consensus_param(const networkstatus_t *ns);
|
|
|
|
STATIC uint32_t get_intro2_burst_consensus_param(const networkstatus_t *ns);
|
|
|
|
|
2019-09-16 13:27:42 -04:00
|
|
|
#endif /* defined(TOR_UNIT_TESTS) */
|
2019-05-29 14:05:16 -04:00
|
|
|
|
|
|
|
#endif /* defined(HS_DOS_PRIVATE) */
|
|
|
|
|
|
|
|
#endif /* !defined(TOR_HS_DOS_H) */
|