circuitbuild.h 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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-2016, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file circuitbuild.h
  8. * \brief Header file for circuitbuild.c.
  9. **/
  10. #ifndef TOR_CIRCUITBUILD_H
  11. #define TOR_CIRCUITBUILD_H
  12. char *circuit_list_path(origin_circuit_t *circ, int verbose);
  13. char *circuit_list_path_for_controller(origin_circuit_t *circ);
  14. void circuit_log_path(int severity, unsigned int domain,
  15. origin_circuit_t *circ);
  16. void circuit_rep_hist_note_result(origin_circuit_t *circ);
  17. origin_circuit_t *origin_circuit_init(uint8_t purpose, int flags);
  18. origin_circuit_t *circuit_establish_circuit(uint8_t purpose,
  19. extend_info_t *exit,
  20. int flags);
  21. struct circuit_guard_state_t *origin_circuit_get_guard_state(
  22. origin_circuit_t *circ);
  23. int circuit_handle_first_hop(origin_circuit_t *circ);
  24. void circuit_n_chan_done(channel_t *chan, int status,
  25. int close_origin_circuits);
  26. int inform_testing_reachability(void);
  27. int circuit_timeout_want_to_count_circ(origin_circuit_t *circ);
  28. int circuit_send_next_onion_skin(origin_circuit_t *circ);
  29. void circuit_note_clock_jumped(int seconds_elapsed);
  30. int circuit_extend(cell_t *cell, circuit_t *circ);
  31. int circuit_init_cpath_crypto(crypt_path_t *cpath, const char *key_data,
  32. int reverse);
  33. struct created_cell_t;
  34. int circuit_finish_handshake(origin_circuit_t *circ,
  35. const struct created_cell_t *created_cell);
  36. int circuit_truncated(origin_circuit_t *circ, crypt_path_t *layer,
  37. int reason);
  38. int onionskin_answer(or_circuit_t *circ,
  39. const struct created_cell_t *created_cell,
  40. const char *keys,
  41. const uint8_t *rend_circ_nonce);
  42. MOCK_DECL(int, circuit_all_predicted_ports_handled, (time_t now,
  43. int *need_uptime,
  44. int *need_capacity));
  45. int circuit_append_new_exit(origin_circuit_t *circ, extend_info_t *info);
  46. int circuit_extend_to_new_exit(origin_circuit_t *circ, extend_info_t *info);
  47. void onion_append_to_cpath(crypt_path_t **head_ptr, crypt_path_t *new_hop);
  48. extend_info_t *extend_info_new(const char *nickname,
  49. const char *rsa_id_digest,
  50. const ed25519_public_key_t *ed_id,
  51. crypto_pk_t *onion_key,
  52. const curve25519_public_key_t *ntor_key,
  53. const tor_addr_t *addr, uint16_t port);
  54. extend_info_t *extend_info_from_node(const node_t *r, int for_direct_connect);
  55. extend_info_t *extend_info_dup(extend_info_t *info);
  56. void extend_info_free(extend_info_t *info);
  57. int extend_info_addr_is_allowed(const tor_addr_t *addr);
  58. int extend_info_supports_tap(const extend_info_t* ei);
  59. int extend_info_supports_ntor(const extend_info_t* ei);
  60. int circuit_can_use_tap(const origin_circuit_t *circ);
  61. int circuit_has_usable_onion_key(const origin_circuit_t *circ);
  62. int extend_info_has_preferred_onion_key(const extend_info_t* ei);
  63. const uint8_t *build_state_get_exit_rsa_id(cpath_build_state_t *state);
  64. const node_t *build_state_get_exit_node(cpath_build_state_t *state);
  65. const char *build_state_get_exit_nickname(cpath_build_state_t *state);
  66. struct circuit_guard_state_t;
  67. const node_t *choose_good_entry_server(uint8_t purpose,
  68. cpath_build_state_t *state,
  69. struct circuit_guard_state_t **guard_state_out);
  70. void circuit_upgrade_circuits_from_guard_wait(void);
  71. #ifdef CIRCUITBUILD_PRIVATE
  72. STATIC circid_t get_unique_circ_id_by_chan(channel_t *chan);
  73. #if defined(ENABLE_TOR2WEB_MODE) || defined(TOR_UNIT_TESTS)
  74. STATIC const node_t *pick_tor2web_rendezvous_node(router_crn_flags_t flags,
  75. const or_options_t *options);
  76. #endif
  77. #endif
  78. #endif