circuit_t Struct Reference

#include <or.h>


Data Fields

uint32_t magic
cell_queue_t n_conn_cells
or_connection_tn_conn
circid_t n_circ_id
extend_info_tn_hop
unsigned int streams_blocked_on_n_conn: 1
unsigned int streams_blocked_on_p_conn: 1
uint8_t state
uint8_t purpose
int package_window
int deliver_window
char * n_conn_onionskin
time_t timestamp_created
time_t timestamp_dirty
struct timeval highres_created
uint16_t marked_for_close
const char * marked_for_close_file
struct circuit_tnext_active_on_n_conn
struct circuit_tprev_active_on_n_conn
struct circuit_tnext
uint64_t dirreq_id
cell_ewma_t n_cell_ewma


Detailed Description

A circuit is a path over the onion routing network. Applications can connect to one end of the circuit, and can create exit connections at the other end of the circuit. AP and exit connections have only one circuit associated with them (and thus these connection types are closed when the circuit is closed), whereas OR connections multiplex many circuits at once, and stay standing even when there are no circuits running over them.

A circuit_t structure can fill one of two roles. First, a or_circuit_t links two connections together: either an edge connection and an OR connection, or two OR connections. (When joined to an OR connection, a circuit_t affects only cells sent to a particular circID on that connection. When joined to an edge connection, a circuit_t affects all data.)

Second, an origin_circuit_t holds the cipher keys and state for sending data along a given circuit. At the OP, it has a sequence of ciphers, each of which is shared with a single OR along the circuit. Separate ciphers are used for data going "forward" (away from the OP) and "backward" (towards the OP). At the OR, a circuit has only two stream ciphers: one for data going forward, and one for data going backward.


Field Documentation

uint32_t circuit_t::magic

For memory and type debugging: must equal ORIGIN_CIRCUIT_MAGIC or OR_CIRCUIT_MAGIC.

Referenced by assert_circuit_ok(), circuit_free(), circuit_get_by_edge_conn(), or_circuit_new(), origin_circuit_new(), TO_OR_CIRCUIT(), and TO_ORIGIN_CIRCUIT().

The hop to which we want to extend this circuit. Should be NULL if the circuit has attached to a connection.

Referenced by assert_circuit_ok(), circuit_dump_by_conn(), circuit_extend(), circuit_free(), and circuit_handle_first_hop().

True iff we are waiting for n_conn_cells to become less full before allowing p_streams to add any more cells. (Origin circuit only.)

Referenced by append_cell_to_circuit_queue(), connection_or_flush_from_first_active_circuit(), and set_streams_blocked_on_circ().

True iff we are waiting for p_conn_cells to become less full before allowing n_streams to add any more cells. (OR circuit only.)

Referenced by append_cell_to_circuit_queue(), connection_or_flush_from_first_active_circuit(), and set_streams_blocked_on_circ().

Why are we creating this circuit?

Referenced by _circuit_mark_for_close(), assert_circuit_ok(), circuit_build_failed(), circuit_enough_testing_circs(), circuit_expire_building(), circuit_expire_old_circuits_clientside(), circuit_find_to_cannibalize(), circuit_get_by_rend_query_and_purpose(), circuit_get_by_rend_token_and_purpose(), circuit_get_next_by_pk_and_purpose(), circuit_get_open_circ_or_launch(), circuit_is_acceptable(), circuit_is_better(), circuit_launch_by_extend_info(), circuit_predict_and_launch_new(), circuit_receive_relay_cell(), circuit_stream_is_being_handled(), command_process_create_cell(), connection_ap_expire_beginning(), connection_ap_handshake_attach_circuit(), connection_ap_handshake_send_begin(), connection_ap_handshake_send_resolve(), connection_edge_end(), connection_edge_process_relay_cell(), connection_exit_begin_conn(), control_event_circuit_status(), count_established_intro_points(), getinfo_helper_events(), handle_control_setcircuitpurpose(), onion_extend_cpath(), onion_pick_cpath_exit(), origin_circuit_init(), relay_send_command_from_edge(), relay_send_end_cell_from_edge(), rend_client_introcirc_has_opened(), rend_client_introduction_acked(), rend_client_receive_rendezvous(), rend_client_rendcirc_has_opened(), rend_client_rendezvous_acked(), rend_client_send_establish_rendezvous(), rend_client_send_introduction(), rend_mid_establish_intro(), rend_mid_establish_rendezvous(), rend_mid_introduce(), rend_mid_rendezvous(), rend_service_intro_established(), rend_service_intro_has_opened(), rend_service_introduce(), rend_service_relaunch_rendezvous(), rend_service_rendezvous_has_opened(), rend_service_set_connection_addr_port(), rend_service_update_descriptor(), and warn_if_last_router_excluded().

How many relay data cells can we package (read from edge streams) on this circuit before we receive a circuit-level sendme cell asking for more?

Referenced by assert_circuit_ok(), circuit_consider_stop_edge_reading(), connection_edge_package_raw_inbuf(), connection_edge_process_relay_cell(), and init_circuit_base().

How many relay data cells will we deliver (write to edge streams) on this circuit? When deliver_window gets low, we send some circuit-level sendme cells to indicate that we're willing to accept more.

Referenced by assert_circuit_ok(), circuit_consider_sending_sendme(), connection_edge_process_relay_cell(), and init_circuit_base().

For storage while n_conn is pending (state CIRCUIT_STATE_OR_WAIT). When defined, it is always length ONIONSKIN_CHALLENGE_LEN.

Referenced by assert_circuit_ok(), circuit_extend(), circuit_free(), and circuit_set_state().

struct timeval circuit_t::highres_created [read]

When exactly was the circuit created?

Referenced by circuit_send_next_onion_skin(), and init_circuit_base().

For debugging: in which file was this circuit marked for close?

Referenced by _circuit_mark_for_close().

Next circuit in the doubly-linked ring of circuits waiting to add cells to n_conn. NULL if we have no cells pending, or if we're not linked to an OR connection.

Referenced by circuit_set_n_circid_orconn(), and next_circ_on_conn_p().

Previous circuit in the doubly-linked ring of circuits waiting to add cells to n_conn. NULL if we have no cells pending, or if we're not linked to an OR connection.

Referenced by prev_circ_on_conn_p().

struct circuit_t* circuit_t::next [read]

Unique ID for measuring tunneled network status requests.

Referenced by connection_edge_process_relay_cell(), connection_exit_begin_conn(), and relay_send_command_from_edge().

The EWMA count for the number of cells flushed from the n_conn_cells queue. Used to determine which circuit to flush from next.

Referenced by assert_active_circuits_ok(), init_circuit_base(), make_circuit_active_on_conn(), and make_circuit_inactive_on_conn().


The documentation for this struct was generated from the following file:

Generated on Tue May 25 00:31:08 2010 for tor by  doxygen 1.5.6