networkstatus_st.h 3.6 KB

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