routerparse.h 3.8 KB

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