tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

congestion_control_flow.h (1615B)


      1 /* Copyright (c) 2019-2021, The Tor Project, Inc. */
      2 /* See LICENSE for licensing information */
      3 
      4 /**
      5 * \file congestion_control_flow.h
      6 * \brief APIs for stream flow control on congestion controlled circuits.
      7 **/
      8 
      9 #ifndef TOR_CONGESTION_CONTROL_FLOW_H
     10 #define TOR_CONGESTION_CONTROL_FLOW_H
     11 
     12 #include "core/or/crypt_path_st.h"
     13 #include "core/or/circuit_st.h"
     14 #include "core/or/edge_connection_st.h"
     15 
     16 struct relay_msg_t;
     17 
     18 void flow_control_new_consensus_params(const struct networkstatus_t *);
     19 
     20 bool circuit_process_stream_xoff(edge_connection_t *conn,
     21                                 const crypt_path_t *layer_hint);
     22 bool circuit_process_stream_xon(edge_connection_t *conn,
     23                                const crypt_path_t *layer_hint,
     24                                const struct relay_msg_t *msg);
     25 
     26 int flow_control_decide_xoff(edge_connection_t *stream);
     27 void flow_control_decide_xon(edge_connection_t *stream, size_t n_written);
     28 
     29 void flow_control_note_sent_data(edge_connection_t *stream, size_t len);
     30 
     31 bool edge_uses_flow_control(const edge_connection_t *stream);
     32 
     33 bool conn_uses_flow_control(connection_t *stream);
     34 
     35 /** Metricsport externs */
     36 extern uint64_t cc_stats_flow_num_xoff_sent;
     37 extern uint64_t cc_stats_flow_num_xon_sent;
     38 extern double cc_stats_flow_xoff_outbuf_ma;
     39 extern double cc_stats_flow_xon_outbuf_ma;
     40 
     41 /* Private section starts. */
     42 #ifdef TOR_CONGESTION_CONTROL_FLOW_PRIVATE
     43 
     44 /*
     45 * Unit tests declaractions.
     46 */
     47 #ifdef TOR_UNIT_TESTS
     48 
     49 #endif /* defined(TOR_UNIT_TESTS) */
     50 
     51 #endif /* defined(TOR_CONGESTION_CONTROL_FLOW_PRIVATE) */
     52 
     53 #endif /* !defined(TOR_CONGESTION_CONTROL_FLOW_H) */