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-2013, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
9 * \brief Header file for circuituse.c.
12 #ifndef TOR_CIRCUITUSE_H
13 #define TOR_CIRCUITUSE_H
15 void circuit_expire_building(void);
16 void circuit_remove_handled_ports(smartlist_t
*needed_ports
);
17 int circuit_stream_is_being_handled(entry_connection_t
*conn
, uint16_t port
,
19 void circuit_log_ancient_one_hop_circuits(int age
);
21 int circuit_conforms_to_options(const origin_circuit_t
*circ
,
22 const or_options_t
*options
);
24 void circuit_build_needed_circs(time_t now
);
25 void circuit_expire_old_circs_as_needed(time_t now
);
26 void circuit_detach_stream(circuit_t
*circ
, edge_connection_t
*conn
);
28 void circuit_expire_old_circuits_serverside(time_t now
);
30 void reset_bandwidth_test(void);
31 int circuit_enough_testing_circs(void);
33 void circuit_has_opened(origin_circuit_t
*circ
);
34 void circuit_try_attaching_streams(origin_circuit_t
*circ
);
35 void circuit_build_failed(origin_circuit_t
*circ
);
37 /** Flag to set when a circuit should have only a single hop. */
38 #define CIRCLAUNCH_ONEHOP_TUNNEL (1<<0)
39 /** Flag to set when a circuit needs to be built of high-uptime nodes */
40 #define CIRCLAUNCH_NEED_UPTIME (1<<1)
41 /** Flag to set when a circuit needs to be built of high-capacity nodes */
42 #define CIRCLAUNCH_NEED_CAPACITY (1<<2)
43 /** Flag to set when the last hop of a circuit doesn't need to be an
45 #define CIRCLAUNCH_IS_INTERNAL (1<<3)
46 origin_circuit_t
*circuit_launch_by_extend_info(uint8_t purpose
,
49 origin_circuit_t
*circuit_launch(uint8_t purpose
, int flags
);
50 void circuit_reset_failure_count(int timeout
);
51 int connection_ap_handshake_attach_chosen_circuit(entry_connection_t
*conn
,
52 origin_circuit_t
*circ
,
54 int connection_ap_handshake_attach_circuit(entry_connection_t
*conn
);
56 void circuit_change_purpose(circuit_t
*circ
, uint8_t new_purpose
);
58 int hostname_in_track_host_exits(const or_options_t
*options
,
60 void mark_circuit_unusable_for_new_conns(origin_circuit_t
*circ
);