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