Tor  0.4.5.0-alpha-dev
connection.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 connection.h
9  * \brief Header file for connection.c.
10  **/
11 
12 #ifndef TOR_CONNECTION_H
13 #define TOR_CONNECTION_H
14 
16 #include "lib/log/log.h"
17 
18 #ifdef HAVE_SYS_SOCKET_H
19 #include <sys/socket.h>
20 #endif
21 
23 struct connection_t;
24 struct dir_connection_t;
25 struct or_connection_t;
26 struct edge_connection_t;
27 struct entry_connection_t;
29 struct port_cfg_t;
30 struct tor_addr_t;
31 struct or_options_t;
32 
35  const struct connection_t *);
36 
37 struct buf_t;
38 
39 #define CONN_TYPE_MIN_ 3
40 /** Type for sockets listening for OR connections. */
41 #define CONN_TYPE_OR_LISTENER 3
42 /** A bidirectional TLS connection transmitting a sequence of cells.
43  * May be from an OR to an OR, or from an OP to an OR. */
44 #define CONN_TYPE_OR 4
45 /** A TCP connection from an onion router to a stream's destination. */
46 #define CONN_TYPE_EXIT 5
47 /** Type for sockets listening for SOCKS connections. */
48 #define CONN_TYPE_AP_LISTENER 6
49 /** A SOCKS proxy connection from the user application to the onion
50  * proxy. */
51 #define CONN_TYPE_AP 7
52 /** Type for sockets listening for HTTP connections to the directory server. */
53 #define CONN_TYPE_DIR_LISTENER 8
54 /** Type for HTTP connections to the directory server. */
55 #define CONN_TYPE_DIR 9
56 /* Type 10 is unused. */
57 /** Type for listening for connections from user interface process. */
58 #define CONN_TYPE_CONTROL_LISTENER 11
59 /** Type for connections from user interface process. */
60 #define CONN_TYPE_CONTROL 12
61 /** Type for sockets listening for transparent connections redirected by pf or
62  * netfilter. */
63 #define CONN_TYPE_AP_TRANS_LISTENER 13
64 /** Type for sockets listening for transparent connections redirected by
65  * natd. */
66 #define CONN_TYPE_AP_NATD_LISTENER 14
67 /** Type for sockets listening for DNS requests. */
68 #define CONN_TYPE_AP_DNS_LISTENER 15
69 
70 /** Type for connections from the Extended ORPort. */
71 #define CONN_TYPE_EXT_OR 16
72 /** Type for sockets listening for Extended ORPort connections. */
73 #define CONN_TYPE_EXT_OR_LISTENER 17
74 /** Type for sockets listening for HTTP CONNECT tunnel connections. */
75 #define CONN_TYPE_AP_HTTP_CONNECT_LISTENER 18
76 
77 #define CONN_TYPE_MAX_ 19
78 /* !!!! If _CONN_TYPE_MAX is ever over 31, we must grow the type field in
79  * struct connection_t. */
80 
81 /* Proxy client handshake states */
82 /* We use a proxy but we haven't even connected to it yet. */
83 #define PROXY_INFANT 1
84 /* We use an HTTP proxy and we've sent the CONNECT command. */
85 #define PROXY_HTTPS_WANT_CONNECT_OK 2
86 /* We use a SOCKS4 proxy and we've sent the CONNECT command. */
87 #define PROXY_SOCKS4_WANT_CONNECT_OK 3
88 /* We use a SOCKS5 proxy and we try to negotiate without
89  any authentication . */
90 #define PROXY_SOCKS5_WANT_AUTH_METHOD_NONE 4
91 /* We use a SOCKS5 proxy and we try to negotiate with
92  Username/Password authentication . */
93 #define PROXY_SOCKS5_WANT_AUTH_METHOD_RFC1929 5
94 /* We use a SOCKS5 proxy and we just sent our credentials. */
95 #define PROXY_SOCKS5_WANT_AUTH_RFC1929_OK 6
96 /* We use a SOCKS5 proxy and we just sent our CONNECT command. */
97 #define PROXY_SOCKS5_WANT_CONNECT_OK 7
98 /* We use an HAPROXY proxy and we just sent the proxy header. */
99 #define PROXY_HAPROXY_WAIT_FOR_FLUSH 8
100 /* We use a proxy and we CONNECTed successfully!. */
101 #define PROXY_CONNECTED 9
102 
103 /** State for any listener connection. */
104 #define LISTENER_STATE_READY 0
105 
106 /**
107  * This struct associates an old listener connection to be replaced
108  * by new connection described by port configuration. Only used when
109  * moving listeners to/from wildcard IP address.
110  */
111 typedef struct
112 {
113  struct connection_t *old_conn; /* Old listener connection to be replaced */
114  const struct port_cfg_t *new_port; /* New port configuration */
116 
117 const char *conn_type_to_string(int type);
118 const char *conn_state_to_string(int type, int state);
120 
121 const char *connection_describe(const connection_t *conn);
122 const char *connection_describe_peer(const connection_t *conn);
123 
124 struct dir_connection_t *dir_connection_new(int socket_family);
125 struct or_connection_t *or_connection_new(int type, int socket_family);
126 struct edge_connection_t *edge_connection_new(int type, int socket_family);
127 struct entry_connection_t *entry_connection_new(int type, int socket_family);
128 struct control_connection_t *control_connection_new(int socket_family);
130  int socket_family);
133  const struct listener_connection_t *listener);
134 void connection_link_connections(struct connection_t *conn_a,
135  struct connection_t *conn_b);
136 MOCK_DECL(void,connection_free_,(struct connection_t *conn));
137 #define connection_free(conn) \
138  FREE_AND_NULL(struct connection_t, connection_free_, (conn))
139 void connection_free_all(void);
141 void connection_close_immediate(struct connection_t *conn);
142 void connection_mark_for_close_(struct connection_t *conn,
143  int line, const char *file);
145  (struct connection_t *conn, int line, const char *file));
146 
147 #define connection_mark_for_close(c) \
148  connection_mark_for_close_((c), __LINE__, SHORT_FILE__)
149 #define connection_mark_for_close_internal(c) \
150  connection_mark_for_close_internal_((c), __LINE__, SHORT_FILE__)
151 
152 /**
153  * Mark 'c' for close, but try to hold it open until all the data is written.
154  * Use the _internal versions of connection_mark_for_close; this should be
155  * called when you either are sure that if this is an or_connection_t the
156  * controlling channel has been notified (e.g. with
157  * connection_or_notify_error()), or you actually are the
158  * connection_or_close_for_error() or connection_or_close_normally function.
159  * For all other cases, use connection_mark_and_flush() instead, which
160  * checks for struct or_connection_t properly, instead. See below.
161  */
162 #define connection_mark_and_flush_internal_(c,line,file) \
163  do { \
164  struct connection_t *tmp_conn__ = (c); \
165  connection_mark_for_close_internal_(tmp_conn__, (line), (file)); \
166  tmp_conn__->hold_open_until_flushed = 1; \
167  } while (0)
168 
169 #define connection_mark_and_flush_internal(c) \
170  connection_mark_and_flush_internal_((c), __LINE__, SHORT_FILE__)
171 
172 /**
173  * Mark 'c' for close, but try to hold it open until all the data is written.
174  */
175 #define connection_mark_and_flush_(c,line,file) \
176  do { \
177  struct connection_t *tmp_conn_ = (c); \
178  if (tmp_conn_->type == CONN_TYPE_OR) { \
179  log_warn(LD_CHANNEL | LD_BUG, \
180  "Something tried to close (and flush) an or_connection_t" \
181  " without going through channels at %s:%d", \
182  file, line); \
183  connection_or_close_for_error(TO_OR_CONN(tmp_conn_), 1); \
184  } else { \
185  connection_mark_and_flush_internal_(c, line, file); \
186  } \
187  } while (0)
188 
189 #define connection_mark_and_flush(c) \
190  connection_mark_and_flush_((c), __LINE__, SHORT_FILE__)
191 
192 void connection_expire_held_open(void);
193 
194 int connection_connect(struct connection_t *conn, const char *address,
195  const struct tor_addr_t *addr,
196  uint16_t port, int *socket_error);
197 
198 #ifdef HAVE_SYS_UN_H
199 
200 int connection_connect_unix(struct connection_t *conn, const char *socket_path,
201  int *socket_error);
202 
203 #endif /* defined(HAVE_SYS_UN_H) */
204 
205 /** Maximum size of information that we can fit into SOCKS5 username
206  or password fields. */
207 #define MAX_SOCKS5_AUTH_FIELD_SIZE 255
208 
209 /** Total maximum size of information that we can fit into SOCKS5
210  username and password fields. */
211 #define MAX_SOCKS5_AUTH_SIZE_TOTAL 2*MAX_SOCKS5_AUTH_FIELD_SIZE
212 
213 int connection_proxy_connect(struct connection_t *conn, int type);
215 void log_failed_proxy_connection(struct connection_t *conn);
216 int get_proxy_addrport(struct tor_addr_t *addr, uint16_t *port,
217  int *proxy_type,
218  int *is_pt_out, const struct connection_t *conn);
219 
220 int retry_all_listeners(struct smartlist_t *new_conns,
221  int close_all_noncontrol);
222 
225 
226 ssize_t connection_bucket_write_limit(struct connection_t *conn, time_t now);
227 bool connection_dir_is_global_write_low(const struct connection_t *conn,
228  size_t attempt);
229 void connection_bucket_init(void);
230 void connection_bucket_adjust(const struct or_options_t *options);
231 void connection_bucket_refill_all(time_t now,
232  uint32_t now_ts);
234  bool is_global_bw);
236  bool is_global_bw);
239 
240 int connection_handle_read(struct connection_t *conn);
241 
242 int connection_buf_get_bytes(char *string, size_t len,
243  struct connection_t *conn);
244 int connection_buf_get_line(struct connection_t *conn, char *data,
245  size_t *data_len);
247  char **headers_out, size_t max_headerlen,
248  char **body_out, size_t *body_used,
249  size_t max_bodylen, int force_complete);
250 
251 int connection_wants_to_flush(struct connection_t *conn);
252 int connection_outbuf_too_full(struct connection_t *conn);
253 int connection_handle_write(struct connection_t *conn, int force);
254 int connection_flush(struct connection_t *conn);
255 
257  (const char *string, size_t len, struct connection_t *conn,
258  int zlib));
259 /* DOCDOC connection_write_to_buf */
260 static void connection_buf_add(const char *string, size_t len,
261  struct connection_t *conn);
262 void connection_dir_buf_add(const char *string, size_t len,
263  struct dir_connection_t *dir_conn, int done);
264 static inline void
265 connection_buf_add(const char *string, size_t len, struct connection_t *conn)
266 {
267  connection_write_to_buf_impl_(string, len, conn, 0);
268 }
269 void connection_buf_add_compress(const char *string, size_t len,
270  struct dir_connection_t *conn, int done);
271 void connection_buf_add_buf(struct connection_t *conn, struct buf_t *buf);
272 
273 size_t connection_get_inbuf_len(struct connection_t *conn);
274 size_t connection_get_outbuf_len(struct connection_t *conn);
275 struct connection_t *connection_get_by_global_id(uint64_t id);
276 
280  (int type,
281  const struct tor_addr_t *addr,
282  uint16_t port, int purpose));
285  int type, int state,
286  const char *rendquery);
287 struct smartlist_t *connection_list_by_type_state(int type, int state);
288 struct smartlist_t *connection_list_by_type_purpose(int type, int purpose);
290  int purpose,
291  const char *resource);
293  int purpose,
294  const char *resource,
295  int state);
296 
297 #define CONN_LEN_AND_FREE_TEMPLATE(sl) \
298  STMT_BEGIN \
299  int len = smartlist_len(sl); \
300  smartlist_free(sl); \
301  return len; \
302  STMT_END
303 
304 /** Return a count of directory connections that are fetching the item
305  * described by <b>purpose</b>/<b>resource</b>. */
306 static inline int
308  int purpose,
309  const char *resource)
310 {
312  purpose,
313  resource);
314  CONN_LEN_AND_FREE_TEMPLATE(conns);
315 }
316 
317 /** Return a count of directory connections that are fetching the item
318  * described by <b>purpose</b>/<b>resource</b>/<b>state</b>. */
319 static inline int
321  int purpose,
322  const char *resource,
323  int state)
324 {
325  struct smartlist_t *conns =
327  purpose,
328  resource,
329  state);
330  CONN_LEN_AND_FREE_TEMPLATE(conns);
331 }
332 
333 #undef CONN_LEN_AND_FREE_TEMPLATE
334 
335 int any_other_active_or_conns(const struct or_connection_t *this_conn);
336 
337 /* || 0 is for -Wparentheses-equality (-Wall?) appeasement under clang */
338 #define connection_speaks_cells(conn) (((conn)->type == CONN_TYPE_OR) || 0)
339 int connection_is_listener(struct connection_t *conn);
340 int connection_state_is_open(struct connection_t *conn);
342 
343 char *alloc_http_authenticator(const char *authenticator);
344 
345 void assert_connection_ok(struct connection_t *conn, time_t now);
347 void connection_dump_buffer_mem_stats(int severity);
348 
350  (const struct connection_t *conn, long apparent_skew, int trusted,
351  log_domain_mask_t domain, const char *received,
352  const char *source));
353 
354 int connection_is_moribund(struct connection_t *conn);
355 void connection_check_oos(int n_socks, int failed);
356 
357 /** Execute the statement <b>stmt</b>, which may log events concerning the
358  * connection <b>conn</b>. To prevent infinite loops, disable log messages
359  * being sent to controllers if <b>conn</b> is a control connection.
360  *
361  * Stmt must not contain any return or goto statements.
362  */
363 #define CONN_LOG_PROTECT(conn, stmt) \
364  STMT_BEGIN \
365  int _log_conn_is_control; \
366  tor_assert(conn); \
367  _log_conn_is_control = (conn->type == CONN_TYPE_CONTROL); \
368  if (_log_conn_is_control) \
369  disable_control_logging(); \
370  STMT_BEGIN stmt; STMT_END; \
371  if (_log_conn_is_control) \
372  enable_control_logging(); \
373  STMT_END
374 
375 #ifdef CONNECTION_PRIVATE
376 STATIC void connection_free_minimal(struct connection_t *conn);
377 
378 /* Used only by connection.c and test*.c */
380  (struct connection_t *conn,
381  const struct sockaddr *sa,
382  socklen_t sa_len,
383  const struct sockaddr *bindaddr,
384  socklen_t bindaddr_len,
385  int *socket_error));
386 MOCK_DECL(STATIC void, kill_conn_list_for_oos, (struct smartlist_t *conns));
387 MOCK_DECL(STATIC struct smartlist_t *, pick_oos_victims, (int n));
388 
389 #endif /* defined(CONNECTION_PRIVATE) */
390 
391 #endif /* !defined(TOR_CONNECTION_H) */
alloc_http_authenticator
char * alloc_http_authenticator(const char *authenticator)
Definition: connection.c:4971
connection_flush
int connection_flush(struct connection_t *conn)
Definition: connection.c:4544
retry_all_listeners
int retry_all_listeners(struct smartlist_t *new_conns, int close_all_noncontrol)
Definition: connection.c:3174
connection_describe_peer
const char * connection_describe_peer(const connection_t *conn)
Definition: connection.c:515
connection_t::purpose
unsigned int purpose
Definition: connection_st.h:51
connection_get_by_type
struct connection_t * connection_get_by_type(int type)
Definition: connection.c:4763
tor_addr_t
Definition: address.h:69
connection_bucket_adjust
void connection_bucket_adjust(const or_options_t *options)
Definition: connection.c:3735
connection_t::address
char * address
Definition: connection_st.h:166
connection_describe
const char * connection_describe(const connection_t *conn)
Definition: connection.c:530
CONST_TO_LISTENER_CONN
const listener_connection_t * CONST_TO_LISTENER_CONN(const connection_t *c)
Definition: connection.c:244
dir_connection_new
struct dir_connection_t * dir_connection_new(int socket_family)
Definition: connection.c:548
connection_close_immediate
void connection_close_immediate(struct connection_t *conn)
Definition: connection.c:1033
connection_wants_to_flush
int connection_wants_to_flush(struct connection_t *conn)
Definition: connection.c:4204
connection_read_bw_exhausted
void connection_read_bw_exhausted(struct connection_t *conn, bool is_global_bw)
Definition: connection.c:3627
connection_read_proxy_handshake
int connection_read_proxy_handshake(struct connection_t *conn)
Definition: connection.c:2874
assert_connection_ok
void assert_connection_ok(struct connection_t *conn, time_t now)
Definition: connection.c:5537
log_failed_proxy_connection
void log_failed_proxy_connection(struct connection_t *conn)
Definition: connection.c:5740
listener_connection_new
struct listener_connection_t * listener_connection_new(int type, int socket_family)
Definition: connection.c:631
connection_mark_for_close_internal_
void connection_mark_for_close_internal_(struct connection_t *conn, int line, const char *file)
Definition: connection.c:1107
connection_bucket_init
void connection_bucket_init(void)
Definition: connection.c:3710
connection_write_to_buf_impl_
void connection_write_to_buf_impl_(const char *string, size_t len, struct connection_t *conn, int zlib)
Definition: connection.c:4620
connection_mark_all_noncontrol_connections
void connection_mark_all_noncontrol_connections(void)
Definition: connection.c:3289
connection_new
struct connection_t * connection_new(int type, int socket_family)
Definition: connection.c:643
connection_dir_count_by_purpose_resource_and_state
static int connection_dir_count_by_purpose_resource_and_state(int purpose, const char *resource, int state)
Definition: connection.h:320
or_connection_t
Definition: or_connection_st.h:22
connection_t::port
uint16_t port
Definition: connection_st.h:146
listener_connection_t
Definition: listener_connection_st.h:18
connection_check_oos
void connection_check_oos(int n_socks, int failed)
Definition: connection.c:5404
connection_get_by_type_nonlinked
struct connection_t * connection_get_by_type_nonlinked(int type)
Definition: connection.c:4782
connection_about_to_close_connection
void connection_about_to_close_connection(struct connection_t *conn)
Definition: connection.c:1002
TO_LISTENER_CONN
struct listener_connection_t * TO_LISTENER_CONN(struct connection_t *)
Definition: connection.c:231
connection_or_nonopen_was_started_here
int connection_or_nonopen_was_started_here(struct or_connection_t *conn)
Definition: connection_or.c:1746
connection_fetch_from_buf_http
int connection_fetch_from_buf_http(struct connection_t *conn, char **headers_out, size_t max_headerlen, char **body_out, size_t *body_used, size_t max_bodylen, int force_complete)
Definition: connection.c:4193
edge_connection_new
struct edge_connection_t * edge_connection_new(int type, int socket_family)
Definition: connection.c:608
or_connection_new
struct or_connection_t * or_connection_new(int type, int socket_family)
Definition: connection.c:563
listener_replacement_t
Definition: connection.h:112
connection_dir_is_global_write_low
bool connection_dir_is_global_write_low(const connection_t *conn, size_t attempt)
Definition: connection.c:3486
connection_is_listener
int connection_is_listener(struct connection_t *conn)
Definition: connection.c:4909
connection_outbuf_too_full
int connection_outbuf_too_full(struct connection_t *conn)
Definition: connection.c:4214
kill_conn_list_for_oos
STATIC void kill_conn_list_for_oos(smartlist_t *conns)
Definition: connection.c:5366
port_cfg_t
Definition: port_cfg_st.h:19
connection_link_connections
void connection_link_connections(struct connection_t *conn_a, struct connection_t *conn_b)
Definition: connection.c:732
log_domain_mask_t
uint64_t log_domain_mask_t
Definition: logging_types.h:21
connection_buf_get_line
int connection_buf_get_line(struct connection_t *conn, char *data, size_t *data_len)
Definition: connection.c:4184
connection_bucket_write_limit
ssize_t connection_bucket_write_limit(struct connection_t *conn, time_t now)
Definition: connection.c:3436
connection_consider_empty_read_buckets
void connection_consider_empty_read_buckets(struct connection_t *conn)
Definition: connection.c:3653
connection_write_bw_exhausted
void connection_write_bw_exhausted(struct connection_t *conn, bool is_global_bw)
Definition: connection.c:3642
connection_mark_for_close_
void connection_mark_for_close_(struct connection_t *conn, int line, const char *file)
Definition: connection.c:1066
connection_dump_buffer_mem_stats
void connection_dump_buffer_mem_stats(int severity)
Definition: connection.c:5488
connection_t::addr
tor_addr_t addr
Definition: connection_st.h:145
MOCK_DECL
#define MOCK_DECL(rv, funcname, arglist)
Definition: testsupport.h:127
connection_free_minimal
STATIC void connection_free_minimal(connection_t *conn)
Definition: connection.c:764
clock_skew_warning
void clock_skew_warning(const connection_t *conn, long apparent_skew, int trusted, log_domain_mask_t domain, const char *received, const char *source)
Definition: connection.c:5825
connection_state_is_open
int connection_state_is_open(struct connection_t *conn)
Definition: connection.c:4928
conn_listener_type_supports_af_unix
int conn_listener_type_supports_af_unix(int type)
Definition: connection.c:746
connection_t
Definition: connection_st.h:45
connection_t::type
unsigned int type
Definition: connection_st.h:50
connection_get_by_type_state
struct connection_t * connection_get_by_type_state(int type, int state)
Definition: connection.c:4772
connection_mark_all_noncontrol_listeners
void connection_mark_all_noncontrol_listeners(void)
Definition: connection.c:3275
connection_init_accepted_conn
int connection_init_accepted_conn(connection_t *conn, const listener_connection_t *listener)
Definition: connection.c:2062
connection_state_is_connecting
int connection_state_is_connecting(struct connection_t *conn)
Definition: connection.c:4948
connection_free_
void connection_free_(struct connection_t *conn)
Definition: connection.c:950
connection_connect
int connection_connect(connection_t *conn, const char *address, const tor_addr_t *addr, uint16_t port, int *socket_error)
Definition: connection.c:2367
entry_connection_new
struct entry_connection_t * entry_connection_new(int type, int socket_family)
Definition: connection.c:589
get_proxy_addrport
int get_proxy_addrport(tor_addr_t *addr, uint16_t *port, int *proxy_type, int *is_pt_out, const connection_t *conn)
Definition: connection.c:5679
connection_proxy_connect
int connection_proxy_connect(struct connection_t *conn, int type)
Definition: connection.c:2721
connection_buf_get_bytes
int connection_buf_get_bytes(char *string, size_t len, struct connection_t *conn)
Definition: connection.c:4177
connection_expire_held_open
void connection_expire_held_open(void)
Definition: connection.c:1149
log.h
Headers for log.c.
connection_dir_count_by_purpose_and_resource
static int connection_dir_count_by_purpose_and_resource(int purpose, const char *resource)
Definition: connection.h:307
connection_connect_sockaddr
STATIC int connection_connect_sockaddr(connection_t *conn, const struct sockaddr *sa, socklen_t sa_len, const struct sockaddr *bindaddr, socklen_t bindaddr_len, int *socket_error)
Definition: connection.c:2134
connection_dir_list_by_purpose_resource_and_state
struct smartlist_t * connection_dir_list_by_purpose_resource_and_state(int purpose, const char *resource, int state)
Definition: connection.c:4862
pick_oos_victims
STATIC smartlist_t * pick_oos_victims(int n)
Definition: connection.c:5273
connection_is_moribund
int connection_is_moribund(struct connection_t *conn)
Definition: connection.c:5387
control_connection_t
Definition: control_connection_st.h:19
edge_connection_t
Definition: edge_connection_st.h:21
connection_consider_empty_write_buckets
void connection_consider_empty_write_buckets(struct connection_t *conn)
Definition: connection.c:3682
connection_get_by_type_state_rendquery
struct connection_t * connection_get_by_type_state_rendquery(int type, int state, const char *rendquery)
Definition: connection.c:4792
connection_dir_list_by_purpose_and_resource
struct smartlist_t * connection_dir_list_by_purpose_and_resource(int purpose, const char *resource)
Definition: connection.c:4844
connection_t::socket_family
int socket_family
Definition: connection_st.h:111
connection_buf_add_buf
void connection_buf_add_buf(struct connection_t *conn, struct buf_t *buf)
Definition: connection.c:4676
smartlist_core.h
Top-level declarations for the smartlist_t dynamic array type.
connection_t::state
uint8_t state
Definition: connection_st.h:49
connection_dir_buf_add
void connection_dir_buf_add(const char *string, size_t len, struct dir_connection_t *dir_conn, int done)
Definition: connection.c:4652
or_options_t
Definition: or_options_st.h:45
STATIC
#define STATIC
Definition: testsupport.h:32
dir_connection_t
Definition: dir_connection_st.h:21
control_connection_new
struct control_connection_t * control_connection_new(int socket_family)
Definition: connection.c:619
entry_connection_t
Definition: entry_connection_st.h:19
connection_get_by_type_addr_port_purpose
connection_t * connection_get_by_type_addr_port_purpose(int type, const tor_addr_t *addr, uint16_t port, int purpose)
Definition: connection.c:4742
conn_state_to_string
const char * conn_state_to_string(int type, int state)
Definition: connection.c:297
conn_type_to_string
const char * conn_type_to_string(int type)
Definition: connection.c:265
connection_free_all
void connection_free_all(void)
Definition: connection.c:5781
smartlist_t
Definition: smartlist_core.h:26
port_cfg_t::type
uint8_t type
Definition: port_cfg_st.h:23
connection_get_by_global_id
struct connection_t * connection_get_by_global_id(uint64_t id)
Definition: connection.c:4755
any_other_active_or_conns
int any_other_active_or_conns(const or_connection_t *this_conn)
Definition: connection.c:4893