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