router.h 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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-2010, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file router.h
  8. * \brief Header file for router.c.
  9. **/
  10. #ifndef _TOR_ROUTER_H
  11. #define _TOR_ROUTER_H
  12. crypto_pk_env_t *get_onion_key(void);
  13. time_t get_onion_key_set_at(void);
  14. void set_identity_key(crypto_pk_env_t *k);
  15. crypto_pk_env_t *get_identity_key(void);
  16. int identity_key_is_set(void);
  17. authority_cert_t *get_my_v3_authority_cert(void);
  18. crypto_pk_env_t *get_my_v3_authority_signing_key(void);
  19. authority_cert_t *get_my_v3_legacy_cert(void);
  20. crypto_pk_env_t *get_my_v3_legacy_signing_key(void);
  21. void dup_onion_keys(crypto_pk_env_t **key, crypto_pk_env_t **last);
  22. void rotate_onion_key(void);
  23. crypto_pk_env_t *init_key_from_file(const char *fname, int generate,
  24. int severity);
  25. void v3_authority_check_key_expiry(void);
  26. int init_keys(void);
  27. int check_whether_orport_reachable(void);
  28. int check_whether_dirport_reachable(void);
  29. void consider_testing_reachability(int test_or, int test_dir);
  30. void router_orport_found_reachable(void);
  31. void router_dirport_found_reachable(void);
  32. void router_perform_bandwidth_test(int num_circs, time_t now);
  33. int authdir_mode(or_options_t *options);
  34. int authdir_mode_v1(or_options_t *options);
  35. int authdir_mode_v2(or_options_t *options);
  36. int authdir_mode_v3(or_options_t *options);
  37. int authdir_mode_any_main(or_options_t *options);
  38. int authdir_mode_any_nonhidserv(or_options_t *options);
  39. int authdir_mode_handles_descs(or_options_t *options, int purpose);
  40. int authdir_mode_publishes_statuses(or_options_t *options);
  41. int authdir_mode_tests_reachability(or_options_t *options);
  42. int authdir_mode_bridge(or_options_t *options);
  43. int server_mode(or_options_t *options);
  44. int advertised_server_mode(void);
  45. int proxy_mode(or_options_t *options);
  46. void consider_publishable_server(int force);
  47. int should_refuse_unknown_exits(or_options_t *options);
  48. void router_upload_dir_desc_to_dirservers(int force);
  49. void mark_my_descriptor_dirty_if_older_than(time_t when);
  50. void mark_my_descriptor_dirty(void);
  51. void check_descriptor_bandwidth_changed(time_t now);
  52. void check_descriptor_ipaddress_changed(time_t now);
  53. void router_new_address_suggestion(const char *suggestion,
  54. const dir_connection_t *d_conn);
  55. int router_compare_to_my_exit_policy(edge_connection_t *conn);
  56. int router_my_exit_policy_is_reject_star(void);
  57. const routerinfo_t *router_get_my_routerinfo(void);
  58. extrainfo_t *router_get_my_extrainfo(void);
  59. const char *router_get_my_descriptor(void);
  60. int router_digest_is_me(const char *digest);
  61. int router_extrainfo_digest_is_me(const char *digest);
  62. int router_is_me(const routerinfo_t *router);
  63. int router_fingerprint_is_me(const char *fp);
  64. int router_pick_published_address(or_options_t *options, uint32_t *addr);
  65. int router_rebuild_descriptor(int force);
  66. int router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router,
  67. crypto_pk_env_t *ident_key);
  68. int extrainfo_dump_to_string(char *s, size_t maxlen, extrainfo_t *extrainfo,
  69. crypto_pk_env_t *ident_key);
  70. int is_legal_nickname(const char *s);
  71. int is_legal_nickname_or_hexdigest(const char *s);
  72. int is_legal_hexdigest(const char *s);
  73. void router_get_verbose_nickname(char *buf, const routerinfo_t *router);
  74. void routerstatus_get_verbose_nickname(char *buf,
  75. const routerstatus_t *router);
  76. void router_reset_warnings(void);
  77. void router_reset_reachability(void);
  78. void router_free_all(void);
  79. const char *router_purpose_to_string(uint8_t p);
  80. uint8_t router_purpose_from_string(const char *s);
  81. #ifdef ROUTER_PRIVATE
  82. /* Used only by router.c and test.c */
  83. void get_platform_str(char *platform, size_t len);
  84. #endif
  85. #endif