router.h 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. void router_upload_dir_desc_to_dirservers(int force);
  48. void mark_my_descriptor_dirty_if_older_than(time_t when);
  49. void mark_my_descriptor_dirty(void);
  50. void check_descriptor_bandwidth_changed(time_t now);
  51. void check_descriptor_ipaddress_changed(time_t now);
  52. void router_new_address_suggestion(const char *suggestion,
  53. const dir_connection_t *d_conn);
  54. int router_compare_to_my_exit_policy(edge_connection_t *conn);
  55. routerinfo_t *router_get_my_routerinfo(void);
  56. extrainfo_t *router_get_my_extrainfo(void);
  57. const char *router_get_my_descriptor(void);
  58. int router_digest_is_me(const char *digest);
  59. int router_extrainfo_digest_is_me(const char *digest);
  60. int router_is_me(routerinfo_t *router);
  61. int router_fingerprint_is_me(const char *fp);
  62. int router_pick_published_address(or_options_t *options, uint32_t *addr);
  63. int router_rebuild_descriptor(int force);
  64. int router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router,
  65. crypto_pk_env_t *ident_key);
  66. int extrainfo_dump_to_string(char *s, size_t maxlen, extrainfo_t *extrainfo,
  67. crypto_pk_env_t *ident_key);
  68. int is_legal_nickname(const char *s);
  69. int is_legal_nickname_or_hexdigest(const char *s);
  70. int is_legal_hexdigest(const char *s);
  71. void router_get_verbose_nickname(char *buf, const routerinfo_t *router);
  72. void routerstatus_get_verbose_nickname(char *buf,
  73. const routerstatus_t *router);
  74. void router_reset_warnings(void);
  75. void router_reset_reachability(void);
  76. void router_free_all(void);
  77. const char *router_purpose_to_string(uint8_t p);
  78. uint8_t router_purpose_from_string(const char *s);
  79. #ifdef ROUTER_PRIVATE
  80. /* Used only by router.c and test.c */
  81. void get_platform_str(char *platform, size_t len);
  82. #endif
  83. #endif