Tor 0.4.9.0-alpha-dev
Macros | Functions
conflux_util.c File Reference

Conflux utility functions for stream blocking and management. More...

#include "core/or/or.h"
#include "core/or/circuit_st.h"
#include "core/or/sendme.h"
#include "core/or/congestion_control_common.h"
#include "core/or/congestion_control_st.h"
#include "core/or/circuitlist.h"
#include "core/or/origin_circuit_st.h"
#include "core/or/or_circuit_st.h"
#include "core/or/conflux.h"
#include "core/or/conflux_params.h"
#include "core/or/conflux_util.h"
#include "core/or/conflux_pool.h"
#include "core/or/conflux_st.h"
#include "lib/time/compat_time.h"
#include "app/config/config.h"

Go to the source code of this file.

Functions

int circuit_get_package_window (circuit_t *circ, const crypt_path_t *cpath)
 
bool conflux_can_send (conflux_t *cfx)
 
crypt_path_tconflux_get_destination_hop (circuit_t *circ)
 
bool conflux_validate_source_hop (circuit_t *in_circ, crypt_path_t *layer_hint)
 
bool edge_uses_cpath (const edge_connection_t *conn, const crypt_path_t *cpath)
 
uint64_t edge_get_max_rtt (const edge_connection_t *stream)
 
bool relay_crypt_from_last_hop (const origin_circuit_t *circ, const crypt_path_t *layer_hint)
 
void conflux_update_p_streams (origin_circuit_t *circ, edge_connection_t *stream)
 
void conflux_sync_circ_fields (conflux_t *cfx, origin_circuit_t *ref_circ)
 
void conflux_update_n_streams (or_circuit_t *circ, edge_connection_t *stream)
 
void conflux_update_resolving_streams (or_circuit_t *circ, edge_connection_t *stream)
 
void conflux_update_half_streams (origin_circuit_t *circ, smartlist_t *half_streams)
 
void conflux_validate_stream_lists (const conflux_t *cfx)
 
void conflux_validate_legs (const conflux_t *cfx)
 

Detailed Description

Conflux utility functions for stream blocking and management.

Definition in file conflux_util.c.

Macro Definition Documentation

◆ TOR_CONFLUX_PRIVATE

#define TOR_CONFLUX_PRIVATE

Definition at line 9 of file conflux_util.c.

Function Documentation

◆ circuit_get_package_window()

int circuit_get_package_window ( circuit_t circ,
const crypt_path_t cpath 
)

This is a utility function that returns the package window circuit, regardless of if it has a conflux pair or not.

Definition at line 33 of file conflux_util.c.

◆ conflux_can_send()

bool conflux_can_send ( conflux_t cfx)

Returns true if conflux can send a data cell.

Used to decide if we should block streams or not, for proccess_sendme_cell(), circuit_resume_edge_reading(), circuit_consider_stop_edge_reading(), circuit_resume_edge_reading_helper(), channel_flush_from_first_active_circuit()

Definition at line 99 of file conflux_util.c.

Referenced by set_block_state_for_streams().

◆ conflux_get_destination_hop()

crypt_path_t * conflux_get_destination_hop ( circuit_t circ)

For a given conflux circuit, return the cpath of the destination.

The cpath destination is the last hop of the circuit, or NULL if the circuit is a non-origin circuit.

Definition at line 122 of file conflux_util.c.

Referenced by conflux_validate_source_hop().

◆ conflux_sync_circ_fields()

void conflux_sync_circ_fields ( conflux_t cfx,
origin_circuit_t ref_circ 
)

Sync the next_stream_id, timestamp_dirty, and circuit_idle_timeout fields of a conflux set to the values in a particular circuit.

This is called upon link, and whenever one of these fields changes on ref_circ. The ref_circ values are copied to all other circuits in the conflux set.

Definition at line 302 of file conflux_util.c.

Referenced by connection_ap_handshake_attach_chosen_circuit(), and mark_circuit_unusable_for_new_conns().

◆ conflux_update_half_streams()

void conflux_update_half_streams ( origin_circuit_t circ,
smartlist_t half_streams 
)

Update the half_streams list on all circuits in the conflux

Definition at line 355 of file conflux_util.c.

◆ conflux_update_n_streams()

void conflux_update_n_streams ( or_circuit_t circ,
edge_connection_t stream 
)

Update the head of the n_streams list on all circuits in the conflux set.

Definition at line 324 of file conflux_util.c.

◆ conflux_update_p_streams()

void conflux_update_p_streams ( origin_circuit_t circ,
edge_connection_t stream 
)

Update the head of the n_streams list on all circuits in the conflux set.

Definition at line 280 of file conflux_util.c.

Referenced by circuit_detach_stream().

◆ conflux_update_resolving_streams()

void conflux_update_resolving_streams ( or_circuit_t circ,
edge_connection_t stream 
)

Update the head of the resolving_streams list on all circuits in the conflux set.

Definition at line 340 of file conflux_util.c.

◆ conflux_validate_legs()

void conflux_validate_legs ( const conflux_t cfx)

Validate the conflux set has two legs, and both circuits have no nonce, and for origin circuits, the purpose is CONFLUX_PURPOSE_LINKED.

Definition at line 405 of file conflux_util.c.

Referenced by conflux_decide_next_circ(), and conflux_process_cell().

◆ conflux_validate_source_hop()

bool conflux_validate_source_hop ( circuit_t in_circ,
crypt_path_t layer_hint 
)

Validates that the source of a cell is from the last hop of the circuit for origin circuits, and that there are no further hops for non-origin circuits.

Definition at line 145 of file conflux_util.c.

◆ conflux_validate_stream_lists()

void conflux_validate_stream_lists ( const conflux_t cfx)

Helper function that emits non-fatal asserts if the stream lists or next_stream_id is out of sync between any of the conflux legs.

Definition at line 373 of file conflux_util.c.

◆ edge_get_max_rtt()

uint64_t edge_get_max_rtt ( const edge_connection_t stream)

Returns the max RTT for the circuit that carries this stream, as observed by congestion control. For conflux circuits, we return the max RTT across all circuits.

Definition at line 208 of file conflux_util.c.

◆ edge_uses_cpath()

bool edge_uses_cpath ( const edge_connection_t conn,
const crypt_path_t cpath 
)

Returns true if the edge connection uses the given cpath.

If there is a conflux object, we inspect all the last hops of the conflux circuits.

Definition at line 172 of file conflux_util.c.

Referenced by circuit_resume_edge_reading_helper(), and relay_lookup_conn().

◆ relay_crypt_from_last_hop()

bool relay_crypt_from_last_hop ( const origin_circuit_t circ,
const crypt_path_t layer_hint 
)

Return true iff our decryption layer_hint is from the last hop in a circuit.

Definition at line 242 of file conflux_util.c.