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