Tor  0.4.3.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-2019, 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. */
37  channel_t *p_chan;
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 
Base circuit structure.
Path structures for origin circuits.
unsigned int introduce2_dos_defense_enabled
Definition: or_circuit_st.h:77
relay_crypto_t crypto
Definition: or_circuit_st.h:46
struct or_circuit_t * rend_splice
Definition: or_circuit_st.h:50
uint32_t processed_cells
Definition: or_circuit_st.h:68
cell_queue_t p_chan_cells
Definition: or_circuit_st.h:35
unsigned int circuit_carries_hs_traffic_stats
Definition: or_circuit_st.h:64
#define DIGEST_LEN
Definition: digest_sizes.h:20
Master header file for Tor-specific functionality.
circid_t p_circ_id
Definition: or_circuit_st.h:33
char rend_circ_nonce[DIGEST_LEN]
Definition: or_circuit_st.h:53
Headers for token_bucket.c.
struct onion_queue_t * onionqueue_entry
Definition: or_circuit_st.h:26
unsigned int remaining_relay_early_cells
Definition: or_circuit_st.h:57
edge_connection_t * n_streams
Definition: or_circuit_st.h:39
channel_t * p_chan
Definition: or_circuit_st.h:37
Definition: workqueue.c:95
edge_connection_t * resolving_streams
Definition: or_circuit_st.h:42
uint32_t circid_t
Definition: or.h:608
struct workqueue_entry_s * workqueue_entry
Definition: or_circuit_st.h:30
uint64_t total_cell_waiting_time
Definition: or_circuit_st.h:73
token_bucket_ctr_t introduce2_bucket
Definition: or_circuit_st.h:82