routerstatus_st.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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-2017, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. #ifndef ROUTERSTATUS_ST_H
  7. #define ROUTERSTATUS_ST_H
  8. /** Contents of a single router entry in a network status object.
  9. */
  10. struct routerstatus_t {
  11. time_t published_on; /**< When was this router published? */
  12. char nickname[MAX_NICKNAME_LEN+1]; /**< The nickname this router says it
  13. * has. */
  14. char identity_digest[DIGEST_LEN]; /**< Digest of the router's identity
  15. * key. */
  16. /** Digest of the router's most recent descriptor or microdescriptor.
  17. * If it's a descriptor, we only use the first DIGEST_LEN bytes. */
  18. char descriptor_digest[DIGEST256_LEN];
  19. uint32_t addr; /**< IPv4 address for this router, in host order. */
  20. uint16_t or_port; /**< IPv4 OR port for this router. */
  21. uint16_t dir_port; /**< Directory port for this router. */
  22. tor_addr_t ipv6_addr; /**< IPv6 address for this router. */
  23. uint16_t ipv6_orport; /**< IPv6 OR port for this router. */
  24. unsigned int is_authority:1; /**< True iff this router is an authority. */
  25. unsigned int is_exit:1; /**< True iff this router is a good exit. */
  26. unsigned int is_stable:1; /**< True iff this router stays up a long time. */
  27. unsigned int is_fast:1; /**< True iff this router has good bandwidth. */
  28. /** True iff this router is called 'running' in the consensus. We give it
  29. * this funny name so that we don't accidentally use this bit as a view of
  30. * whether we think the router is *currently* running. If that's what you
  31. * want to know, look at is_running in node_t. */
  32. unsigned int is_flagged_running:1;
  33. unsigned int is_named:1; /**< True iff "nickname" belongs to this router. */
  34. unsigned int is_unnamed:1; /**< True iff "nickname" belongs to another
  35. * router. */
  36. unsigned int is_valid:1; /**< True iff this router isn't invalid. */
  37. unsigned int is_possible_guard:1; /**< True iff this router would be a good
  38. * choice as an entry guard. */
  39. unsigned int is_bad_exit:1; /**< True iff this node is a bad choice for
  40. * an exit node. */
  41. unsigned int is_hs_dir:1; /**< True iff this router is a v2-or-later hidden
  42. * service directory. */
  43. unsigned int is_v2_dir:1; /** True iff this router publishes an open DirPort
  44. * or it claims to accept tunnelled dir requests.
  45. */
  46. unsigned int has_bandwidth:1; /**< The vote/consensus had bw info */
  47. unsigned int has_exitsummary:1; /**< The vote/consensus had exit summaries */
  48. unsigned int bw_is_unmeasured:1; /**< This is a consensus entry, with
  49. * the Unmeasured flag set. */
  50. /** Flags to summarize the protocol versions for this routerstatus_t. */
  51. protover_summary_flags_t pv;
  52. uint32_t bandwidth_kb; /**< Bandwidth (capacity) of the router as reported in
  53. * the vote/consensus, in kilobytes/sec. */
  54. /** The consensus has guardfraction information for this router. */
  55. unsigned int has_guardfraction:1;
  56. /** The guardfraction value of this router. */
  57. uint32_t guardfraction_percentage;
  58. char *exitsummary; /**< exit policy summary -
  59. * XXX weasel: this probably should not stay a string. */
  60. /* ---- The fields below aren't derived from the networkstatus; they
  61. * hold local information only. */
  62. time_t last_dir_503_at; /**< When did this router last tell us that it
  63. * was too busy to serve directory info? */
  64. download_status_t dl_status;
  65. };
  66. #endif