tor  master
Public Member Functions | Data Fields
circuit_t Struct Reference

#include <or.h>

Collaboration diagram for circuit_t:
Collaboration graph
[legend]

Public Member Functions

 HT_ENTRY (circuit_t) hs_circuitmap_node
 

Data Fields

uint32_t magic
 
channel_tn_chan
 
circid_t n_circ_id
 
circuitmux_tn_mux
 
cell_queue_t n_chan_cells
 
extend_info_tn_hop
 
unsigned int streams_blocked_on_n_chan: 1
 
unsigned int streams_blocked_on_p_chan: 1
 
unsigned int p_delete_pending: 1
 
unsigned int n_delete_pending: 1
 
unsigned int received_destroy: 1
 
uint8_t state
 
uint8_t purpose
 
int package_window
 
int deliver_window
 
uint32_t age_tmp
 
struct create_cell_tn_chan_create_cell
 
struct timeval timestamp_began
 
struct timeval timestamp_created
 
time_t timestamp_dirty
 
uint16_t marked_for_close
 
const char * marked_for_close_file
 
int marked_for_close_reason
 
int marked_for_close_orig_reason
 
uint64_t dirreq_id
 
int global_circuitlist_idx
 
smartlist_ttesting_cell_stats
 
hs_token_t * hs_token
 

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.

Member Function Documentation

◆ HT_ENTRY()

HT_ENTRY ( circuit_t  )

Hashtable node: used to look up the circuit by its HS token using the HS circuitmap.

Field Documentation

◆ age_tmp

uint32_t age_tmp

Temporary field used during circuits_handle_oom.

◆ deliver_window

int deliver_window

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.

◆ dirreq_id

uint64_t dirreq_id

Unique ID for measuring tunneled network status requests.

◆ global_circuitlist_idx

int global_circuitlist_idx

Index in smartlist of all circuits (global_circuitlist).

◆ hs_token

hs_token_t* hs_token

If set, points to an HS token that this circuit might be carrying. Used by the HS circuitmap.

◆ magic

uint32_t magic

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

◆ marked_for_close

uint16_t marked_for_close

Should we close this circuit at the end of the main loop? (If true, holds the line number where this circuit was marked.)

◆ marked_for_close_file

const char* marked_for_close_file

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

◆ marked_for_close_orig_reason

int marked_for_close_orig_reason

As marked_for_close_reason, but reflects the underlying reason for closing this circuit.

◆ marked_for_close_reason

int marked_for_close_reason

For what reason (See END_CIRC_REASON...) is this circuit being closed? This field is set in circuit_mark_for_close and used later in circuit_about_to_free.

◆ n_chan

channel_t* n_chan

The channel that is next in this circuit.

◆ n_chan_cells

cell_queue_t n_chan_cells

Queue of cells waiting to be transmitted on n_chan

◆ n_chan_create_cell

struct create_cell_t* n_chan_create_cell

For storage while n_chan is pending (state CIRCUIT_STATE_CHAN_WAIT).

◆ n_circ_id

circid_t n_circ_id

The circuit_id used in the next (forward) hop of this circuit; this is unique to n_chan, but this ordered pair is globally unique:

(n_chan->global_identifier, n_circ_id)

◆ n_delete_pending

unsigned int n_delete_pending

True iff we have queued a delete forwards on this circuit, but not put it on the output buffer.

◆ n_hop

extend_info_t* n_hop

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

◆ n_mux

circuitmux_t* n_mux

Circuit mux associated with n_chan to which this circuit is attached; NULL if we have no n_chan.

◆ p_delete_pending

unsigned int p_delete_pending

True iff we have queued a delete backwards on this circuit, but not put it on the output buffer.

◆ package_window

int package_window

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?

◆ purpose

uint8_t purpose

Why are we creating this circuit?

◆ received_destroy

unsigned int received_destroy

True iff this circuit has received a DESTROY cell in either direction

◆ state

uint8_t state

Current status of this circuit.

◆ streams_blocked_on_n_chan

unsigned int streams_blocked_on_n_chan

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

◆ streams_blocked_on_p_chan

unsigned int streams_blocked_on_p_chan

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

◆ testing_cell_stats

smartlist_t* testing_cell_stats

Various statistics about cells being added to or removed from this circuit's queues; used only if CELL_STATS events are enabled and cleared after being sent to control port.

◆ timestamp_began

struct timeval timestamp_began

When did circuit construction actually begin (ie send the CREATE cell or begin cannibalization).

Note: This timer will get reset if we decide to cannibalize a circuit. It may also get reset during certain phases of hidden service circuit use.

We keep this timestamp with a higher resolution than most so that the circuit-build-time tracking code can get millisecond resolution.

◆ timestamp_created

struct timeval timestamp_created

This timestamp marks when the init_circuit_base constructor ran.

◆ timestamp_dirty

time_t timestamp_dirty

When the circuit was first used, or 0 if the circuit is clean.

XXXX Note that some code will artificially adjust this value backward in time in order to indicate that a circuit shouldn't be used for new streams, but that it can stay alive as long as it has streams on it. That's a kludge we should fix.

XXX The CBT code uses this field to record when HS-related circuits entered certain states. This usage probably won't interfere with this field's primary purpose, but we should document it more thoroughly to make sure of that.

XXX The SocksPort option KeepaliveIsolateSOCKSAuth will artificially adjust this value forward each time a suitable stream is attached to an already constructed circuit, potentially keeping the circuit alive indefinitely.


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