routerparse.h 4.6 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-2014, 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. 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_supports_microdescriptors(const char *platform);
  44. int tor_version_as_new_as(const char *platform, const char *cutoff);
  45. int tor_version_parse(const char *s, tor_version_t *out);
  46. int tor_version_compare(tor_version_t *a, tor_version_t *b);
  47. int tor_version_same_series(tor_version_t *a, tor_version_t *b);
  48. void sort_version_list(smartlist_t *lst, int remove_duplicates);
  49. void assert_addr_policy_ok(smartlist_t *t);
  50. void dump_distinct_digest_count(int severity);
  51. int compare_vote_routerstatus_entries(const void **_a, const void **_b);
  52. int networkstatus_verify_bw_weights(networkstatus_t *ns, int);
  53. networkstatus_t *networkstatus_parse_vote_from_string(const char *s,
  54. const char **eos_out,
  55. networkstatus_type_t ns_type);
  56. ns_detached_signatures_t *networkstatus_parse_detached_signatures(
  57. const char *s, const char *eos);
  58. smartlist_t *microdescs_parse_from_string(const char *s, const char *eos,
  59. int allow_annotations,
  60. saved_location_t where,
  61. smartlist_t *invalid_digests_out);
  62. authority_cert_t *authority_cert_parse_from_string(const char *s,
  63. const char **end_of_string);
  64. int rend_parse_v2_service_descriptor(rend_service_descriptor_t **parsed_out,
  65. char *desc_id_out,
  66. char **intro_points_encrypted_out,
  67. size_t *intro_points_encrypted_size_out,
  68. size_t *encoded_size_out,
  69. const char **next_out, const char *desc);
  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. #endif