routerparse.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. int find_single_ipv6_orport(const smartlist_t *list,
  49. tor_addr_t *addr_out,
  50. uint16_t *port_out);
  51. void routerparse_init(void);
  52. void routerparse_free_all(void);
  53. #ifdef ROUTERPARSE_PRIVATE
  54. STATIC int routerstatus_parse_guardfraction(const char *guardfraction_str,
  55. networkstatus_t *vote,
  56. vote_routerstatus_t *vote_rs,
  57. routerstatus_t *rs);
  58. struct memarea_t;
  59. STATIC routerstatus_t *routerstatus_parse_entry_from_string(
  60. struct memarea_t *area,
  61. const char **s, smartlist_t *tokens,
  62. networkstatus_t *vote,
  63. vote_routerstatus_t *vote_rs,
  64. int consensus_method,
  65. consensus_flavor_t flav);
  66. STATIC void summarize_protover_flags(protover_summary_flags_t *out,
  67. const char *protocols,
  68. const char *version);
  69. #endif /* defined(ROUTERPARSE_PRIVATE) */
  70. #define ED_DESC_SIGNATURE_PREFIX "Tor router descriptor signature v1"
  71. #endif /* !defined(TOR_ROUTERPARSE_H) */