networkstatus_st.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 NETWORKSTATUS_ST_H
  7. #define NETWORKSTATUS_ST_H
  8. #include "feature/nodelist/networkstatus_sr_info_st.h"
  9. /** Enumerates the possible seriousness values of a networkstatus document. */
  10. typedef enum networkstatus_type_t {
  11. NS_TYPE_VOTE,
  12. NS_TYPE_CONSENSUS,
  13. NS_TYPE_OPINION,
  14. } networkstatus_type_t;
  15. /** A common structure to hold a v3 network status vote, or a v3 network
  16. * status consensus. */
  17. struct networkstatus_t {
  18. networkstatus_type_t type; /**< Vote, consensus, or opinion? */
  19. consensus_flavor_t flavor; /**< If a consensus, what kind? */
  20. unsigned int has_measured_bws : 1;/**< True iff this networkstatus contains
  21. * measured= bandwidth values. */
  22. time_t published; /**< Vote only: Time when vote was written. */
  23. time_t valid_after; /**< Time after which this vote or consensus applies. */
  24. time_t fresh_until; /**< Time before which this is the most recent vote or
  25. * consensus. */
  26. time_t valid_until; /**< Time after which this vote or consensus should not
  27. * be used. */
  28. /** Consensus only: what method was used to produce this consensus? */
  29. int consensus_method;
  30. /** Vote only: what methods is this voter willing to use? */
  31. smartlist_t *supported_methods;
  32. /** List of 'package' lines describing hashes of downloadable packages */
  33. smartlist_t *package_lines;
  34. /** How long does this vote/consensus claim that authorities take to
  35. * distribute their votes to one another? */
  36. int vote_seconds;
  37. /** How long does this vote/consensus claim that authorities take to
  38. * distribute their consensus signatures to one another? */
  39. int dist_seconds;
  40. /** Comma-separated list of recommended client software, or NULL if this
  41. * voter has no opinion. */
  42. char *client_versions;
  43. char *server_versions;
  44. /** Lists of subprotocol versions which are _recommended_ for relays and
  45. * clients, or which are _require_ for relays and clients. Tor shouldn't
  46. * make any more network connections if a required protocol is missing.
  47. */
  48. char *recommended_relay_protocols;
  49. char *recommended_client_protocols;
  50. char *required_relay_protocols;
  51. char *required_client_protocols;
  52. /** List of flags that this vote/consensus applies to routers. If a flag is
  53. * not listed here, the voter has no opinion on what its value should be. */
  54. smartlist_t *known_flags;
  55. /** List of key=value strings for the parameters in this vote or
  56. * consensus, sorted by key. */
  57. smartlist_t *net_params;
  58. /** List of key=value strings for the bw weight parameters in the
  59. * consensus. */
  60. smartlist_t *weight_params;
  61. /** List of networkstatus_voter_info_t. For a vote, only one element
  62. * is included. For a consensus, one element is included for every voter
  63. * whose vote contributed to the consensus. */
  64. smartlist_t *voters;
  65. struct authority_cert_t *cert; /**< Vote only: the voter's certificate. */
  66. /** Digests of this document, as signed. */
  67. common_digests_t digests;
  68. /** A SHA3-256 digest of the document, not including signatures: used for
  69. * consensus diffs */
  70. uint8_t digest_sha3_as_signed[DIGEST256_LEN];
  71. /** List of router statuses, sorted by identity digest. For a vote,
  72. * the elements are vote_routerstatus_t; for a consensus, the elements
  73. * are routerstatus_t. */
  74. smartlist_t *routerstatus_list;
  75. /** If present, a map from descriptor digest to elements of
  76. * routerstatus_list. */
  77. digestmap_t *desc_digest_map;
  78. /** Contains the shared random protocol data from a vote or consensus. */
  79. networkstatus_sr_info_t sr_info;
  80. /** List of key=value strings from the headers of the bandwidth list file */
  81. smartlist_t *bw_file_headers;
  82. };
  83. #endif