routerparse.h 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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-2018, 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. #include "core/or/versions.h"
  13. enum networkstatus_type_t;
  14. int router_get_router_hash(const char *s, size_t s_len, char *digest);
  15. int router_get_networkstatus_v3_hashes(const char *s,
  16. common_digests_t *digests);
  17. int router_get_networkstatus_v3_signed_boundaries(const char *s,
  18. const char **start_out,
  19. const char **end_out);
  20. int router_get_networkstatus_v3_sha3_as_signed(uint8_t *digest_out,
  21. const char *s);
  22. int router_get_extrainfo_hash(const char *s, size_t s_len, char *digest);
  23. int router_parse_list_from_string(const char **s, const char *eos,
  24. smartlist_t *dest,
  25. saved_location_t saved_location,
  26. int is_extrainfo,
  27. int allow_annotations,
  28. const char *prepend_annotations,
  29. smartlist_t *invalid_digests_out);
  30. routerinfo_t *router_parse_entry_from_string(const char *s, const char *end,
  31. int cache_copy,
  32. int allow_annotations,
  33. const char *prepend_annotations,
  34. int *can_dl_again_out);
  35. struct digest_ri_map_t;
  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, int *malformed_list));
  41. int compare_vote_routerstatus_entries(const void **_a, const void **_b);
  42. int networkstatus_verify_bw_weights(networkstatus_t *ns, int);
  43. networkstatus_t *networkstatus_parse_vote_from_string(const char *s,
  44. const char **eos_out,
  45. enum networkstatus_type_t ns_type);
  46. ns_detached_signatures_t *networkstatus_parse_detached_signatures(
  47. const char *s, const char *eos);
  48. smartlist_t *microdescs_parse_from_string(const char *s, const char *eos,
  49. int allow_annotations,
  50. saved_location_t where,
  51. smartlist_t *invalid_digests_out);
  52. void routerparse_init(void);
  53. void routerparse_free_all(void);
  54. #ifdef ROUTERPARSE_PRIVATE
  55. STATIC int routerstatus_parse_guardfraction(const char *guardfraction_str,
  56. networkstatus_t *vote,
  57. vote_routerstatus_t *vote_rs,
  58. routerstatus_t *rs);
  59. struct memarea_t;
  60. STATIC routerstatus_t *routerstatus_parse_entry_from_string(
  61. struct memarea_t *area,
  62. const char **s, smartlist_t *tokens,
  63. networkstatus_t *vote,
  64. vote_routerstatus_t *vote_rs,
  65. int consensus_method,
  66. consensus_flavor_t flav);
  67. STATIC void summarize_protover_flags(protover_summary_flags_t *out,
  68. const char *protocols,
  69. const char *version);
  70. #endif /* defined(ROUTERPARSE_PRIVATE) */
  71. #define ED_DESC_SIGNATURE_PREFIX "Tor router descriptor signature v1"
  72. #endif /* !defined(TOR_ROUTERPARSE_H) */