Tor  0.4.4.0-alpha-dev
or_circuit_st.h
1 /* Copyright (c) 2001 Matej Pfajfar.
2  * Copyright (c) 2001-2004, Roger Dingledine.
3  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4  * Copyright (c) 2007-2020, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 #ifndef OR_CIRCUIT_ST_H
8 #define OR_CIRCUIT_ST_H
9 
10 #include "core/or/or.h"
11 
12 #include "core/or/circuit_st.h"
13 #include "core/or/crypt_path_st.h"
14 
16 
17 struct onion_queue_t;
18 
19 /** An or_circuit_t holds information needed to implement a circuit at an
20  * OR. */
21 struct or_circuit_t {
22  circuit_t base_;
23 
24  /** Pointer to an entry on the onion queue, if this circuit is waiting for a
25  * chance to give an onionskin to a cpuworker. Used only in onion.c */
27  /** Pointer to a workqueue entry, if this circuit has given an onionskin to
28  * a cpuworker and is waiting for a response. Used to decide whether it is
29  * safe to free a circuit or if it is still in use by a cpuworker. */
31 
32  /** The circuit_id used in the previous (backward) hop of this circuit. */
34  /** Queue of cells waiting to be transmitted on p_conn. */
36  /** The channel that is previous in this circuit. */
38  /** Linked list of Exit streams associated with this circuit. */
40  /** Linked list of Exit streams associated with this circuit that are
41  * still being resolved. */
43 
44  /** Cryptographic state used for encrypting and authenticating relay
45  * cells to and from this hop. */
47 
48  /** Points to spliced circuit if purpose is REND_ESTABLISHED, and circuit
49  * is not marked for close. */
51 
52  /** Stores KH for the handshake. */
53  char rend_circ_nonce[DIGEST_LEN];/* KH in tor-spec.txt */
54 
55  /** How many more relay_early cells can we send on this circuit, according
56  * to the specification? */
57  unsigned int remaining_relay_early_cells : 4;
58 
59  /* We have already received an INTRODUCE1 cell on this circuit. */
60  unsigned int already_received_introduce1 : 1;
61 
62  /** If set, this circuit carries HS traffic. Consider it in any HS
63  * statistics. */
65 
66  /** Number of cells that were removed from circuit queue; reset every
67  * time when writing buffer stats to disk. */
68  uint32_t processed_cells;
69 
70  /** Total time in milliseconds that cells spent in both app-ward and
71  * exit-ward queues of this circuit; reset every time when writing
72  * buffer stats to disk. */
74 
75  /** If set, the DoS defenses are enabled on this circuit meaning that the
76  * introduce2_bucket is initialized and used. */
78 
79  /** INTRODUCE2 cell bucket controlling how much can go on this circuit. Only
80  * used if this is a service introduction circuit at the intro point
81  * (purpose = CIRCUIT_PURPOSE_INTRO_POINT). */
83 };
84 
85 #endif /* !defined(OR_CIRCUIT_ST_H) */
86 
workqueue_entry_t
Definition: workqueue.c:95
or_circuit_t::rend_circ_nonce
char rend_circ_nonce[DIGEST_LEN]
Definition: or_circuit_st.h:53
relay_crypto_t
Definition: relay_crypto_st.h:19
or_circuit_t::p_chan_cells
cell_queue_t p_chan_cells
Definition: or_circuit_st.h:35
or_circuit_t::p_chan
channel_t * p_chan
Definition: or_circuit_st.h:37
crypt_path_st.h
Path structures for origin circuits.
DIGEST_LEN
#define DIGEST_LEN
Definition: digest_sizes.h:20
token_bucket_ctr_t
Definition: token_bucket.h:110
or_circuit_t::resolving_streams
edge_connection_t * resolving_streams
Definition: or_circuit_st.h:42
or_circuit_t::remaining_relay_early_cells
unsigned int remaining_relay_early_cells
Definition: or_circuit_st.h:57
or_circuit_t::onionqueue_entry
struct onion_queue_t * onionqueue_entry
Definition: or_circuit_st.h:26
or_circuit_t::n_streams
edge_connection_t * n_streams
Definition: or_circuit_st.h:39
or_circuit_t::introduce2_dos_defense_enabled
unsigned int introduce2_dos_defense_enabled
Definition: or_circuit_st.h:77
circuit_t
Definition: circuit_st.h:61
token_bucket.h
Headers for token_bucket.c.
cell_queue_t
Definition: cell_queue_st.h:28
or_circuit_t::rend_splice
struct or_circuit_t * rend_splice
Definition: or_circuit_st.h:50
channel_t
Definition: channel.h:181
or_circuit_t::introduce2_bucket
token_bucket_ctr_t introduce2_bucket
Definition: or_circuit_st.h:82
or_circuit_t::circuit_carries_hs_traffic_stats
unsigned int circuit_carries_hs_traffic_stats
Definition: or_circuit_st.h:64
or_circuit_t::processed_cells
uint32_t processed_cells
Definition: or_circuit_st.h:68
edge_connection_t
Definition: edge_connection_st.h:21
or_circuit_t::workqueue_entry
struct workqueue_entry_t * workqueue_entry
Definition: or_circuit_st.h:30
circuit_st.h
Base circuit structure.
or_circuit_t
Definition: or_circuit_st.h:21
or_circuit_t::p_circ_id
circid_t p_circ_id
Definition: or_circuit_st.h:33
or_circuit_t::total_cell_waiting_time
uint64_t total_cell_waiting_time
Definition: or_circuit_st.h:73
or_circuit_t::crypto
relay_crypto_t crypto
Definition: or_circuit_st.h:46
onion_queue_t
Definition: onion_queue.c:41
circid_t
uint32_t circid_t
Definition: or.h:608
or.h
Master header file for Tor-specific functionality.