conflux_util.h File Reference

Header file for conflux_util.c. More...

Go to the source code of this file.


static bool CIRCUIT_IS_CONFLUX (const circuit_t *circ)
int circuit_get_package_window (circuit_t *circ, const crypt_path_t *cpath)
bool conflux_can_send (conflux_t *cfx)
bool edge_uses_cpath (const edge_connection_t *conn, const crypt_path_t *cpath)
crypt_path_tconflux_get_destination_hop (circuit_t *circ)
bool conflux_validate_source_hop (circuit_t *in_circ, crypt_path_t *layer_hint)
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 *, edge_connection_t *)
void conflux_update_half_streams (origin_circuit_t *, smartlist_t *)
void conflux_update_n_streams (or_circuit_t *, edge_connection_t *)
void conflux_update_resolving_streams (or_circuit_t *, edge_connection_t *)
void conflux_sync_circ_fields (conflux_t *cfx, origin_circuit_t *ref_circ)
void conflux_validate_stream_lists (const conflux_t *cfx)
void conflux_validate_legs (const conflux_t *cfx)

Detailed Description

Header file for conflux_util.c.

Definition in file conflux_util.h.

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.


static bool CIRCUIT_IS_CONFLUX ( const circuit_t circ)

Definition at line 20 of file conflux_util.h.

◆ 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.