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