routerinfo_st.h (5013B)
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 routerinfo_st.h 9 * @brief Router descriptor structure. 10 **/ 11 12 #ifndef ROUTERINFO_ST_H 13 #define ROUTERINFO_ST_H 14 15 #include "feature/nodelist/signed_descriptor_st.h" 16 17 struct curve25519_public_key_t; 18 struct smartlist_t; 19 20 /** Information about another onion router in the network. */ 21 struct routerinfo_t { 22 signed_descriptor_t cache_info; 23 char *nickname; /**< Human-readable OR name. */ 24 25 /** A router's IPv4 address. */ 26 tor_addr_t ipv4_addr; 27 uint16_t ipv4_orport; 28 uint16_t ipv4_dirport; 29 30 /** A router's IPv6 address, if it has one. */ 31 tor_addr_t ipv6_addr; 32 uint16_t ipv6_orport; 33 34 /** 35 * Public RSA TAP key for onions, ASN.1 encoded. We store this 36 * in its encoded format since storing it as a crypto_pk_t uses 37 * significantly more memory. 38 * 39 * This may be absent. 40 */ 41 char *tap_onion_pkey; 42 /** Length of onion_pkey, in bytes. */ 43 size_t tap_onion_pkey_len; 44 45 crypto_pk_t *identity_pkey; /**< Public RSA key for signing. */ 46 /** Public curve25519 key for onions */ 47 struct curve25519_public_key_t *onion_curve25519_pkey; 48 /** What's the earliest expiration time on all the certs in this 49 * routerinfo? */ 50 time_t cert_expiration_time; 51 52 char *platform; /**< What software/operating system is this OR using? */ 53 54 char *protocol_list; /**< Encoded list of subprotocol versions supported 55 * by this OR */ 56 57 /* link info */ 58 uint32_t bandwidthrate; /**< How many bytes does this OR add to its token 59 * bucket per second? */ 60 uint32_t bandwidthburst; /**< How large is this OR's token bucket? */ 61 /** How many bytes/s is this router known to handle? */ 62 uint32_t bandwidthcapacity; 63 smartlist_t *exit_policy; /**< What streams will this OR permit 64 * to exit on IPv4? NULL for 'reject *:*'. */ 65 /** What streams will this OR permit to exit on IPv6? 66 * NULL for 'reject *:*' */ 67 struct short_policy_t *ipv6_exit_policy; 68 long uptime; /**< How many seconds the router claims to have been up */ 69 smartlist_t *declared_family; /**< Nicknames of router which this router 70 * claims are its family. */ 71 /** A list of strings representing router family IDs. 72 * May be null. Extracted from family-certs. 73 * (Happy families only.) */ 74 struct smartlist_t *family_ids; 75 char *contact_info; /**< Declared contact info for this router. */ 76 unsigned int is_hibernating:1; /**< Whether the router claims to be 77 * hibernating */ 78 unsigned int caches_extra_info:1; /**< Whether the router says it caches and 79 * serves extrainfo documents. */ 80 unsigned int allow_single_hop_exits:1; /**< Whether the router says 81 * it allows single hop exits. */ 82 83 unsigned int wants_to_be_hs_dir:1; /**< True iff this router claims to be 84 * a hidden service directory. */ 85 unsigned int policy_is_reject_star:1; /**< True iff the exit policy for this 86 * router rejects everything. */ 87 /** True if, after we have added this router, we should re-launch 88 * tests for it. */ 89 unsigned int needs_retest_if_added:1; 90 91 /** True iff this router included "tunnelled-dir-server" in its descriptor, 92 * implying it accepts tunnelled directory requests, or it advertised 93 * dir_port > 0. */ 94 unsigned int supports_tunnelled_dir_requests:1; 95 96 /** Used during voting to indicate that we should not include an entry for 97 * this routerinfo. Used only during voting. */ 98 unsigned int omit_from_vote:1; 99 100 /** Flags to summarize the protocol versions for this routerinfo_t. */ 101 protover_summary_flags_t pv; 102 103 /** Tor can use this router for general positions in circuits; we got it 104 * from a directory server as usual, or we're an authority and a server 105 * uploaded it. */ 106 #define ROUTER_PURPOSE_GENERAL 0 107 /** Tor should avoid using this router for circuit-building: we got it 108 * from a controller. If the controller wants to use it, it'll have to 109 * ask for it by identity. */ 110 #define ROUTER_PURPOSE_CONTROLLER 1 111 /** Tor should use this router only for bridge positions in circuits: we got 112 * it via a directory request from the bridge itself, or a bridge 113 * authority. */ 114 #define ROUTER_PURPOSE_BRIDGE 2 115 /** Tor should not use this router; it was marked in cached-descriptors with 116 * a purpose we didn't recognize. */ 117 #define ROUTER_PURPOSE_UNKNOWN 255 118 119 /** In what way did we find out about this router? One of ROUTER_PURPOSE_*. 120 * Routers of different purposes are kept segregated and used for different 121 * things; see notes on ROUTER_PURPOSE_* macros above. 122 */ 123 uint8_t purpose; 124 }; 125 126 #endif /* !defined(ROUTERINFO_ST_H) */