mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-28 00:53:04 +01:00
Here we add a little bit of state to origin circuits, and set up the necessary functions for the circuit code to call in order to find guards, use guards, and decide when circuits can be used. There's also an incomplete function for the hard part of the circuit-maintenance code, where we figure out whether any waiting guards are ready to become usable. (This patch finally uses the handle.c code to make safe handles to entry_guard_t objects, so that we are allowed to free an entry_guard_t without checking whether any origin_circuit_t is holding a reference to it.)
80 lines
3.7 KiB
C
80 lines
3.7 KiB
C
/* Copyright (c) 2001 Matej Pfajfar.
|
|
* Copyright (c) 2001-2004, Roger Dingledine.
|
|
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
|
* Copyright (c) 2007-2016, The Tor Project, Inc. */
|
|
/* See LICENSE for licensing information */
|
|
|
|
/**
|
|
* \file circuitbuild.h
|
|
* \brief Header file for circuitbuild.c.
|
|
**/
|
|
|
|
#ifndef TOR_CIRCUITBUILD_H
|
|
#define TOR_CIRCUITBUILD_H
|
|
|
|
char *circuit_list_path(origin_circuit_t *circ, int verbose);
|
|
char *circuit_list_path_for_controller(origin_circuit_t *circ);
|
|
void circuit_log_path(int severity, unsigned int domain,
|
|
origin_circuit_t *circ);
|
|
void circuit_rep_hist_note_result(origin_circuit_t *circ);
|
|
origin_circuit_t *origin_circuit_init(uint8_t purpose, int flags);
|
|
origin_circuit_t *circuit_establish_circuit(uint8_t purpose,
|
|
extend_info_t *exit,
|
|
int flags);
|
|
struct circuit_guard_state_t *origin_circuit_get_guard_state(
|
|
origin_circuit_t *circ);
|
|
int circuit_handle_first_hop(origin_circuit_t *circ);
|
|
void circuit_n_chan_done(channel_t *chan, int status,
|
|
int close_origin_circuits);
|
|
int inform_testing_reachability(void);
|
|
int circuit_timeout_want_to_count_circ(origin_circuit_t *circ);
|
|
int circuit_send_next_onion_skin(origin_circuit_t *circ);
|
|
void circuit_note_clock_jumped(int seconds_elapsed);
|
|
int circuit_extend(cell_t *cell, circuit_t *circ);
|
|
int circuit_init_cpath_crypto(crypt_path_t *cpath, const char *key_data,
|
|
int reverse);
|
|
struct created_cell_t;
|
|
int circuit_finish_handshake(origin_circuit_t *circ,
|
|
const struct created_cell_t *created_cell);
|
|
int circuit_truncated(origin_circuit_t *circ, crypt_path_t *layer,
|
|
int reason);
|
|
int onionskin_answer(or_circuit_t *circ,
|
|
const struct created_cell_t *created_cell,
|
|
const char *keys,
|
|
const uint8_t *rend_circ_nonce);
|
|
int circuit_all_predicted_ports_handled(time_t now, int *need_uptime,
|
|
int *need_capacity);
|
|
|
|
int circuit_append_new_exit(origin_circuit_t *circ, extend_info_t *info);
|
|
int circuit_extend_to_new_exit(origin_circuit_t *circ, extend_info_t *info);
|
|
void onion_append_to_cpath(crypt_path_t **head_ptr, crypt_path_t *new_hop);
|
|
extend_info_t *extend_info_new(const char *nickname, const char *digest,
|
|
crypto_pk_t *onion_key,
|
|
const curve25519_public_key_t *curve25519_key,
|
|
const tor_addr_t *addr, uint16_t port);
|
|
extend_info_t *extend_info_from_node(const node_t *r, int for_direct_connect);
|
|
extend_info_t *extend_info_dup(extend_info_t *info);
|
|
void extend_info_free(extend_info_t *info);
|
|
int extend_info_addr_is_allowed(const tor_addr_t *addr);
|
|
int extend_info_supports_tap(const extend_info_t* ei);
|
|
int extend_info_supports_ntor(const extend_info_t* ei);
|
|
int circuit_can_use_tap(const origin_circuit_t *circ);
|
|
int circuit_has_usable_onion_key(const origin_circuit_t *circ);
|
|
int extend_info_has_preferred_onion_key(const extend_info_t* ei);
|
|
const node_t *build_state_get_exit_node(cpath_build_state_t *state);
|
|
const char *build_state_get_exit_nickname(cpath_build_state_t *state);
|
|
|
|
const node_t *choose_good_entry_server(uint8_t purpose,
|
|
cpath_build_state_t *state);
|
|
|
|
#ifdef CIRCUITBUILD_PRIVATE
|
|
STATIC circid_t get_unique_circ_id_by_chan(channel_t *chan);
|
|
#if defined(ENABLE_TOR2WEB_MODE) || defined(TOR_UNIT_TESTS)
|
|
STATIC const node_t *pick_tor2web_rendezvous_node(router_crn_flags_t flags,
|
|
const or_options_t *options);
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|