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 */
7 /**
8  * \file circuitbuild.h
9  * \brief Header file for circuitbuild.c.
10  **/
18 int route_len_for_purpose(uint8_t purpose, extend_info_t *exit_ei);
19 char *circuit_list_path(origin_circuit_t *circ, int verbose);
21 void circuit_log_path(int severity, unsigned int domain,
22  origin_circuit_t *circ);
23 origin_circuit_t *origin_circuit_init(uint8_t purpose, int flags);
25  extend_info_t *exit,
26  int flags);
27 struct circuit_guard_state_t *origin_circuit_get_guard_state(
28  origin_circuit_t *circ);
30 void circuit_n_chan_done(channel_t *chan, int status,
31  int close_origin_circuits);
35 void circuit_note_clock_jumped(int64_t seconds_elapsed, bool was_idle);
36 int circuit_extend(cell_t *cell, circuit_t *circ);
37 struct created_cell_t;
39  const struct created_cell_t *created_cell);
40 int circuit_truncated(origin_circuit_t *circ, int reason);
42  const struct created_cell_t *created_cell,
43  const char *keys, size_t keys_len,
44  const uint8_t *rend_circ_nonce);
46  int *need_uptime,
47  int *need_capacity));
51 extend_info_t *extend_info_new(const char *nickname,
52  const char *rsa_id_digest,
53  const struct ed25519_public_key_t *ed_id,
54  crypto_pk_t *onion_key,
55  const struct curve25519_public_key_t *ntor_key,
56  const tor_addr_t *addr, uint16_t port);
57 extend_info_t *extend_info_from_node(const node_t *r, int for_direct_connect);
60 #define extend_info_free(info) \
61  FREE_AND_NULL(extend_info_t, extend_info_free_, (info))
63 int extend_info_supports_tap(const extend_info_t* ei);
64 int extend_info_supports_ntor(const extend_info_t* ei);
65 int circuit_can_use_tap(const origin_circuit_t *circ);
66 int circuit_has_usable_onion_key(const origin_circuit_t *circ);
67 int extend_info_has_preferred_onion_key(const extend_info_t* ei);
69 MOCK_DECL(const node_t *,
73 struct circuit_guard_state_t;
75 const node_t *choose_good_entry_server(uint8_t purpose,
76  cpath_build_state_t *state,
77  struct circuit_guard_state_t **guard_state_out);
82 STATIC int new_route_len(uint8_t purpose, extend_info_t *exit_ei,
83  const smartlist_t *nodes);
85  int direct));
89 STATIC int
91  int is_hs_v3_rp_circuit);
93 #endif /* defined(CIRCUITBUILD_PRIVATE) */
95 #endif /* !defined(TOR_CIRCUITBUILD_H) */
extend_info_t * extend_info_new(const char *nickname, const char *rsa_id_digest, const ed25519_public_key_t *ed_id, crypto_pk_t *onion_key, const curve25519_public_key_t *ntor_key, const tor_addr_t *addr, uint16_t port)
Definition: node_st.h:34
int circuit_append_new_exit(origin_circuit_t *circ, extend_info_t *info)
int circuit_send_next_onion_skin(origin_circuit_t *circ)
Definition: circuitbuild.c:937
void extend_info_free_(extend_info_t *info)
Definition: cell_st.h:17
int circuit_finish_handshake(origin_circuit_t *circ, const created_cell_t *reply)
STATIC int new_route_len(uint8_t purpose, extend_info_t *exit_ei, const smartlist_t *nodes)
void circuit_upgrade_circuits_from_guard_wait(void)
const uint8_t * build_state_get_exit_rsa_id(cpath_build_state_t *state)
char * circuit_list_path(origin_circuit_t *circ, int verbose)
Definition: circuitbuild.c:338
struct circuit_guard_state_t * origin_circuit_get_guard_state(origin_circuit_t *circ)
Definition: circuitbuild.c:508
STATIC int onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit_ei, int is_hs_v3_rp_circuit)
#define STATIC
Definition: testsupport.h:32
origin_circuit_t * circuit_establish_circuit(uint8_t purpose, extend_info_t *exit, int flags)
Definition: circuitbuild.c:479
int circuit_truncated(origin_circuit_t *circ, int reason)
char * circuit_list_path_for_controller(origin_circuit_t *circ)
Definition: circuitbuild.c:347
int circuit_timeout_want_to_count_circ(const origin_circuit_t *circ)
Definition: circuitbuild.c:841
int circuit_extend_to_new_exit(origin_circuit_t *circ, extend_info_t *info)
const char * build_state_get_exit_nickname(cpath_build_state_t *state)
STATIC circid_t get_unique_circ_id_by_chan(channel_t *chan)
Definition: circuitbuild.c:127
origin_circuit_t * origin_circuit_init(uint8_t purpose, int flags)
Definition: circuitbuild.c:453
void circuit_note_clock_jumped(int64_t seconds_elapsed, bool was_idle)
int onionskin_answer(or_circuit_t *circ, const created_cell_t *created_cell, const char *keys, size_t keys_len, const uint8_t *rend_circ_nonce)
int circuit_extend(cell_t *cell, circuit_t *circ)
int circuit_handle_first_hop(origin_circuit_t *circ)
Definition: circuitbuild.c:539
int extend_info_addr_is_allowed(const tor_addr_t *addr)
STATIC int count_acceptable_nodes(const smartlist_t *nodes, int direct)
int inform_testing_reachability(void)
Definition: circuitbuild.c:774
uint32_t circid_t
Definition: or.h:608
int circuit_all_predicted_ports_handled(time_t now, int *need_uptime, int *need_capacity)
extend_info_t * extend_info_dup(extend_info_t *info)
const node_t * build_state_get_exit_node(cpath_build_state_t *state)
#define MOCK_DECL(rv, funcname, arglist)
Definition: testsupport.h:127
void circuit_log_path(int severity, unsigned int domain, origin_circuit_t *circ)
Definition: circuitbuild.c:357
const node_t * choose_good_entry_server(uint8_t purpose, cpath_build_state_t *state, struct circuit_guard_state_t **guard_state_out)
void circuit_n_chan_done(channel_t *chan, int status, int close_origin_circuits)
Definition: circuitbuild.c:627
STATIC int onion_extend_cpath(origin_circuit_t *circ)
int route_len_for_purpose(uint8_t purpose, extend_info_t *exit_ei)
extend_info_t * extend_info_from_node(const node_t *r, int for_direct_connect)