Tor  0.4.7.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-2021, 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  /** True iff this circuit was made with a CREATE_FAST cell, or a CREATE[2]
67  * cell with a TAP handshake. If this is the case and this is a rend circuit,
68  * this is a v2 circuit, otherwise if this is a rend circuit it's a v3
69  * circuit. */
71 
72  /** Number of cells that were removed from circuit queue; reset every
73  * time when writing buffer stats to disk. */
74  uint32_t processed_cells;
75 
76  /** Total time in milliseconds that cells spent in both app-ward and
77  * exit-ward queues of this circuit; reset every time when writing
78  * buffer stats to disk. */
80 
81  /** If set, the DoS defenses are enabled on this circuit meaning that the
82  * introduce2_bucket is initialized and used. */
84  /** If set, the DoS defenses were explicitly enabled through the
85  * ESTABLISH_INTRO cell extension. If unset, the consensus is used to learn
86  * if the defenses can be enabled or not. */
88 
89  /** INTRODUCE2 cell bucket controlling how much can go on this circuit. Only
90  * used if this is a service introduction circuit at the intro point
91  * (purpose = CIRCUIT_PURPOSE_INTRO_POINT). */
93 };
94 
95 #endif /* !defined(OR_CIRCUIT_ST_H) */
96 
Base circuit structure.
Path structures for origin circuits.
#define DIGEST_LEN
Definition: digest_sizes.h:20
Master header file for Tor-specific functionality.
uint32_t circid_t
Definition: or.h:489
edge_connection_t * resolving_streams
Definition: or_circuit_st.h:42
struct onion_queue_t * onionqueue_entry
Definition: or_circuit_st.h:26
uint64_t total_cell_waiting_time
Definition: or_circuit_st.h:79
unsigned int circuit_carries_hs_traffic_stats
Definition: or_circuit_st.h:64
channel_t * p_chan
Definition: or_circuit_st.h:37
unsigned int remaining_relay_early_cells
Definition: or_circuit_st.h:57
struct workqueue_entry_t * workqueue_entry
Definition: or_circuit_st.h:30
unsigned int introduce2_dos_defense_enabled
Definition: or_circuit_st.h:83
circid_t p_circ_id
Definition: or_circuit_st.h:33
bool used_legacy_circuit_handshake
Definition: or_circuit_st.h:70
cell_queue_t p_chan_cells
Definition: or_circuit_st.h:35
unsigned int introduce2_dos_defense_explicit
Definition: or_circuit_st.h:87
token_bucket_ctr_t introduce2_bucket
Definition: or_circuit_st.h:92
struct or_circuit_t * rend_splice
Definition: or_circuit_st.h:50
edge_connection_t * n_streams
Definition: or_circuit_st.h:39
uint32_t processed_cells
Definition: or_circuit_st.h:74
char rend_circ_nonce[DIGEST_LEN]
Definition: or_circuit_st.h:53
relay_crypto_t crypto
Definition: or_circuit_st.h:46
Definition: workqueue.c:95
Headers for token_bucket.c.