routerstatus_st.h 3.8 KB

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