Tor  0.4.4.0-alpha-dev
or_connection_st.h
Go to the documentation of this file.
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 /**
8  * @file or_connection_st.h
9  * @brief OR connection structure.
10  **/
11 
12 #ifndef OR_CONNECTION_ST_H
13 #define OR_CONNECTION_ST_H
14 
15 #include "core/or/connection_st.h"
17 
18 struct tor_tls_t;
19 
20 /** Subtype of connection_t for an "OR connection" -- that is, one that speaks
21  * cells over TLS. */
23  connection_t base_;
24 
25  /** Hash of the public RSA key for the other side's identity key, or zeroes
26  * if the other side hasn't shown us a valid identity key. */
28 
29  /** Extended ORPort connection identifier. */
31  /** This is the ClientHash value we expect to receive from the
32  * client during the Extended ORPort authentication protocol. We
33  * compute it upon receiving the ClientNoce from the client, and we
34  * compare it with the acual ClientHash value sent by the
35  * client. */
37  /** String carrying the name of the pluggable transport
38  * (e.g. "obfs2") that is obfuscating this connection. If no
39  * pluggable transports are used, it's NULL. */
41 
42  char *nickname; /**< Nickname of OR on other side (if any). */
43 
44  struct tor_tls_t *tls; /**< TLS connection state. */
45  int tls_error; /**< Last tor_tls error code. */
46  /** When we last used this conn for any client traffic. If not
47  * recent, we can rate limit it further. */
48 
49  /* Channel using this connection */
50  channel_tls_t *chan;
51 
52  tor_addr_t real_addr; /**< The actual address that this connection came from
53  * or went to. The <b>addr</b> field is prone to
54  * getting overridden by the address from the router
55  * descriptor matching <b>identity_digest</b>. */
56 
57  /** Should this connection be used for extending circuits to the server
58  * matching the <b>identity_digest</b> field? Set to true if we're pretty
59  * sure we aren't getting MITMed, either because we're connected to an
60  * address listed in a server descriptor, or because an authenticated
61  * NETINFO cell listed the address we're connected to as recognized. */
62  unsigned int is_canonical:1;
63 
64  /** True iff this is an outgoing connection. */
65  unsigned int is_outgoing:1;
66  unsigned int proxy_type:3; /**< One of PROXY_NONE...PROXY_HAPROXY */
67  unsigned int wide_circ_ids:1;
68  /** True iff this connection has had its bootstrap failure logged with
69  * control_event_bootstrap_problem. */
71  /** True iff this is a client connection and its address has been put in the
72  * geoip cache and handled by the DoS mitigation subsystem. We use this to
73  * insure we have a coherent count of concurrent connection. */
74  unsigned int tracked_for_dos_mitigation : 1;
75  /** True iff this connection is using a pluggable transport */
76  unsigned int is_pt : 1;
77 
78  uint16_t link_proto; /**< What protocol version are we using? 0 for
79  * "none negotiated yet." */
80  uint16_t idle_timeout; /**< How long can this connection sit with no
81  * circuits on it before we close it? Based on
82  * IDLE_CIRCUIT_TIMEOUT_{NON,}CANONICAL and
83  * on is_canonical, randomized. */
84  or_handshake_state_t *handshake_state; /**< If we are setting this connection
85  * up, state information to do so. */
86 
87  time_t timestamp_lastempty; /**< When was the outbuf last completely empty?*/
88 
89  token_bucket_rw_t bucket; /**< Used for rate limiting when the connection is
90  * in state CONN_OPEN. */
91 
92  /*
93  * Count the number of bytes flushed out on this orconn, and the number of
94  * bytes TLS actually sent - used for overhead estimation for scheduling.
95  */
96  uint64_t bytes_xmitted, bytes_xmitted_by_tls;
97 };
98 
99 #endif /* !defined(OR_CONNECTION_ST_H) */
or_connection_t::bucket
token_bucket_rw_t bucket
Definition: or_connection_st.h:89
or_connection_t::handshake_state
or_handshake_state_t * handshake_state
Definition: or_connection_st.h:84
tor_addr_t
Definition: address.h:68
or_connection_t::have_noted_bootstrap_problem
unsigned int have_noted_bootstrap_problem
Definition: or_connection_st.h:70
or_connection_t::is_canonical
unsigned int is_canonical
Definition: or_connection_st.h:62
token_bucket_rw_t
Definition: token_bucket.h:59
or_connection_t::is_pt
unsigned int is_pt
Definition: or_connection_st.h:76
or_connection_t::link_proto
uint16_t link_proto
Definition: or_connection_st.h:78
or_connection_t
Definition: or_connection_st.h:22
or_connection_t::chan
channel_tls_t * chan
Definition: or_connection_st.h:50
tor_tls_t
Definition: tortls_st.h:41
DIGEST_LEN
#define DIGEST_LEN
Definition: digest_sizes.h:20
or_connection_t::idle_timeout
uint16_t idle_timeout
Definition: or_connection_st.h:80
or_connection_t::ext_or_auth_correct_client_hash
char * ext_or_auth_correct_client_hash
Definition: or_connection_st.h:36
or_connection_t::is_outgoing
unsigned int is_outgoing
Definition: or_connection_st.h:65
or_connection_t::tls_error
int tls_error
Definition: or_connection_st.h:45
token_bucket.h
Headers for token_bucket.c.
connection_t
Definition: connection_st.h:45
or_connection_t::real_addr
tor_addr_t real_addr
Definition: or_connection_st.h:52
or_connection_t::ext_or_transport
char * ext_or_transport
Definition: or_connection_st.h:40
or_connection_t::proxy_type
unsigned int proxy_type
Definition: or_connection_st.h:66
connection_st.h
Base connection structure.
or_handshake_state_t
Definition: or_handshake_state_st.h:18
or_connection_t::ext_or_conn_id
char * ext_or_conn_id
Definition: or_connection_st.h:30
or_connection_t::timestamp_lastempty
time_t timestamp_lastempty
Definition: or_connection_st.h:87
or_connection_t::tracked_for_dos_mitigation
unsigned int tracked_for_dos_mitigation
Definition: or_connection_st.h:74
or_connection_t::tls
struct tor_tls_t * tls
Definition: or_connection_st.h:44
or_connection_t::identity_digest
char identity_digest[DIGEST_LEN]
Definition: or_connection_st.h:27
or_connection_t::nickname
char * nickname
Definition: or_connection_st.h:42