9#ifndef TOR_CONGESTION_CONTROL_COMMON_H
10#define TOR_CONGESTION_CONTROL_COMMON_H
18#define TLS_RECORD_MAX_CELLS ((16 * 1024) / CELL_MAX_NETWORK_SIZE)
29 CC_PATH_ONION_SOS = 2,
35#define SBWS_ROUTE_LEN 2
38#define congestion_control_free(cc) \
39 FREE_AND_NULL(congestion_control_t, congestion_control_free_, cc)
72 const size_t msg_len);
90extern uint32_t or_conn_highwater;
91extern uint32_t or_conn_lowwater;
92extern int32_t cell_queue_high;
93extern int32_t cell_queue_low;
94extern uint8_t cc_sendme_inc;
100 return or_conn_highwater;
104static inline uint32_t
107 return or_conn_lowwater;
115 return cell_queue_high;
123 return cell_queue_low;
130 return cc_sendme_inc;
142static inline uint64_t
148 return (2*curr + (N-1)*prev)/(N+1);
161static inline uint64_t
164 uint64_t max =
MAX(a, b);
165 uint64_t min = MIN(a, b);
167 if (BUG(pct_max > 100)) {
171 return pct_max*max/100 + (100-pct_max)*min/100;
175#ifdef TOR_CONGESTION_CONTROL_COMMON_PRIVATE
180 uint64_t old_delta, uint64_t new_delta);
183 uint64_t timestamp_usec);
190extern bool is_monotime_clock_broken;
192void congestion_control_set_cc_enabled(
void);
193void congestion_control_set_cc_disabled(
void);
congestion_control_t * congestion_control_new(const circuit_params_t *params, cc_path_t path)
STATIC bool time_delta_stalled_or_jumped(const congestion_control_t *cc, uint64_t old_delta, uint64_t new_delta)
STATIC void enqueue_timestamp(smartlist_t *timestamps_u64, uint64_t timestamp_usec)
STATIC uint64_t congestion_control_update_circuit_rtt(congestion_control_t *cc, uint64_t now_usec)
static uint32_t or_conn_highwatermark(void)
bool congestion_control_validate_sendme_increment(uint8_t sendme_inc)
static uint64_t n_count_ewma(uint64_t curr, uint64_t prev, uint64_t N)
int sendme_get_inc_count(const circuit_t *, const crypt_path_t *)
void congestion_control_free_(congestion_control_t *cc)
char * congestion_control_get_control_port_fields(const origin_circuit_t *)
bool congestion_control_update_circuit_estimates(congestion_control_t *, const circuit_t *)
uint64_t congestion_control_get_num_clock_stalls(void)
uint64_t congestion_control_get_num_rtt_reset(void)
void congestion_control_note_cell_sent(congestion_control_t *cc, const circuit_t *circ, const crypt_path_t *cpath)
int congestion_control_get_package_window(const circuit_t *, const crypt_path_t *)
int congestion_control_build_ext_response(const circuit_params_t *our_params, const circuit_params_t *circ_params, uint8_t **msg_out, size_t *msg_len_out)
int congestion_control_parse_ext_request(const uint8_t *msg, const size_t msg_len)
static uint64_t percent_max_mix(uint64_t a, uint64_t b, uint8_t pct_max)
static uint8_t congestion_control_sendme_inc(void)
static uint32_t or_conn_lowwatermark(void)
int congestion_control_build_ext_request(uint8_t **msg_out, size_t *msg_len_out)
int congestion_control_parse_ext_response(const uint8_t *msg, const size_t msg_len, circuit_params_t *params_out)
bool congestion_control_enabled(void)
int congestion_control_dispatch_cc_alg(congestion_control_t *cc, circuit_t *circ)
bool circuit_sent_cell_for_sendme(const circuit_t *, const crypt_path_t *)
uint64_t cc_stats_circs_created
bool is_monotime_clock_reliable(void)
static int32_t cell_queue_highwatermark(void)
void congestion_control_new_consensus_params(const networkstatus_t *ns)
static int32_t cell_queue_lowwatermark(void)
Path structures for origin circuits.
Header file for onion_crypto.c.