routerparse.h 5.0 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-2015, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file routerparse.h
  8. * \brief Header file for routerparse.c.
  9. **/
  10. #ifndef TOR_ROUTERPARSE_H
  11. #define TOR_ROUTERPARSE_H
  12. int router_get_router_hash(const char *s, size_t s_len, char *digest);
  13. int router_get_dir_hash(const char *s, char *digest);
  14. int router_get_networkstatus_v3_hashes(const char *s, digests_t *digests);
  15. int router_get_extrainfo_hash(const char *s, size_t s_len, char *digest);
  16. #define DIROBJ_MAX_SIG_LEN 256
  17. char *router_get_dirobj_signature(const char *digest,
  18. size_t digest_len,
  19. const crypto_pk_t *private_key);
  20. int router_append_dirobj_signature(char *buf, size_t buf_len,
  21. const char *digest,
  22. size_t digest_len,
  23. crypto_pk_t *private_key);
  24. int router_parse_list_from_string(const char **s, const char *eos,
  25. smartlist_t *dest,
  26. saved_location_t saved_location,
  27. int is_extrainfo,
  28. int allow_annotations,
  29. const char *prepend_annotations,
  30. smartlist_t *invalid_digests_out);
  31. routerinfo_t *router_parse_entry_from_string(const char *s, const char *end,
  32. int cache_copy,
  33. int allow_annotations,
  34. const char *prepend_annotations,
  35. int *can_dl_again_out);
  36. extrainfo_t *extrainfo_parse_entry_from_string(const char *s, const char *end,
  37. int cache_copy, struct digest_ri_map_t *routermap,
  38. int *can_dl_again_out);
  39. MOCK_DECL(addr_policy_t *, router_parse_addr_policy_item_from_string,
  40. (const char *s, int assume_action));
  41. version_status_t tor_version_is_obsolete(const char *myversion,
  42. const char *versionlist);
  43. int tor_version_as_new_as(const char *platform, const char *cutoff);
  44. int tor_version_parse(const char *s, tor_version_t *out);
  45. int tor_version_compare(tor_version_t *a, tor_version_t *b);
  46. int tor_version_same_series(tor_version_t *a, tor_version_t *b);
  47. void sort_version_list(smartlist_t *lst, int remove_duplicates);
  48. void assert_addr_policy_ok(smartlist_t *t);
  49. void dump_distinct_digest_count(int severity);
  50. int compare_vote_routerstatus_entries(const void **_a, const void **_b);
  51. int networkstatus_verify_bw_weights(networkstatus_t *ns, int);
  52. networkstatus_t *networkstatus_parse_vote_from_string(const char *s,
  53. const char **eos_out,
  54. networkstatus_type_t ns_type);
  55. ns_detached_signatures_t *networkstatus_parse_detached_signatures(
  56. const char *s, const char *eos);
  57. smartlist_t *microdescs_parse_from_string(const char *s, const char *eos,
  58. int allow_annotations,
  59. saved_location_t where,
  60. smartlist_t *invalid_digests_out);
  61. authority_cert_t *authority_cert_parse_from_string(const char *s,
  62. const char **end_of_string);
  63. int rend_parse_v2_service_descriptor(rend_service_descriptor_t **parsed_out,
  64. char *desc_id_out,
  65. char **intro_points_encrypted_out,
  66. size_t *intro_points_encrypted_size_out,
  67. size_t *encoded_size_out,
  68. const char **next_out, const char *desc,
  69. int as_hsdir);
  70. int rend_decrypt_introduction_points(char **ipos_decrypted,
  71. size_t *ipos_decrypted_size,
  72. const char *descriptor_cookie,
  73. const char *ipos_encrypted,
  74. size_t ipos_encrypted_size);
  75. int rend_parse_introduction_points(rend_service_descriptor_t *parsed,
  76. const char *intro_points_encoded,
  77. size_t intro_points_encoded_size);
  78. int rend_parse_client_keys(strmap_t *parsed_clients, const char *str);
  79. #ifdef ROUTERPARSE_PRIVATE
  80. STATIC int routerstatus_parse_guardfraction(const char *guardfraction_str,
  81. networkstatus_t *vote,
  82. vote_routerstatus_t *vote_rs,
  83. routerstatus_t *rs);
  84. #endif
  85. #define ED_DESC_SIGNATURE_PREFIX "Tor router descriptor signature v1"
  86. #endif