mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Extract routerinfo_t into its own header.
I was expecting this to be much worse.
This commit is contained in:
parent
9d6276bca8
commit
ed0731c7de
@ -28,6 +28,7 @@
|
||||
#include "transports.h"
|
||||
|
||||
#include "node_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/** Information about a configured bridge. Currently this just matches the
|
||||
|
@ -63,6 +63,7 @@
|
||||
#include "or_connection_st.h"
|
||||
#include "or_handshake_certs_st.h"
|
||||
#include "or_handshake_state_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
|
||||
/** How many CELL_PADDING cells have we received, ever? */
|
||||
uint64_t stats_n_padding_cells_processed = 0;
|
||||
|
@ -71,6 +71,7 @@
|
||||
#include "or_circuit_st.h"
|
||||
#include "origin_circuit_st.h"
|
||||
#include "microdesc_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
static channel_t * channel_connect_for_circuit(const tor_addr_t *addr,
|
||||
|
@ -119,6 +119,7 @@
|
||||
#include "listener_connection_st.h"
|
||||
#include "or_connection_st.h"
|
||||
#include "port_cfg_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "socks_request_st.h"
|
||||
|
||||
static connection_t *connection_listener_new(
|
||||
|
@ -64,6 +64,7 @@
|
||||
#include "or_connection_st.h"
|
||||
#include "or_handshake_certs_st.h"
|
||||
#include "or_handshake_state_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
|
||||
static int connection_tls_finish_handshake(or_connection_t *conn);
|
||||
static int connection_or_launch_v3_or_handshake(or_connection_t *conn);
|
||||
|
@ -94,6 +94,7 @@
|
||||
#include "rend_authorized_client_st.h"
|
||||
#include "rend_encoded_v2_service_descriptor_st.h"
|
||||
#include "rend_service_descriptor_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerlist_st.h"
|
||||
#include "socks_request_st.h"
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "networkstatus_voter_info_st.h"
|
||||
#include "node_st.h"
|
||||
#include "ns_detached_signatures_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerlist_st.h"
|
||||
#include "vote_microdesc_hash_st.h"
|
||||
#include "vote_routerstatus_st.h"
|
||||
|
@ -61,6 +61,7 @@
|
||||
#include "networkstatus_st.h"
|
||||
#include "node_st.h"
|
||||
#include "rend_service_descriptor_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
|
||||
/**
|
||||
* \file directory.c
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "extrainfo_st.h"
|
||||
#include "microdesc_st.h"
|
||||
#include "node_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerlist_st.h"
|
||||
#include "tor_version_st.h"
|
||||
#include "vote_routerstatus_st.h"
|
||||
|
@ -296,6 +296,7 @@ ORHEADERS = \
|
||||
src/or/rephist.h \
|
||||
src/or/replaycache.h \
|
||||
src/or/router.h \
|
||||
src/or/routerinfo_st.h \
|
||||
src/or/routerkeys.h \
|
||||
src/or/routerlist.h \
|
||||
src/or/routerlist_st.h \
|
||||
|
@ -126,6 +126,7 @@
|
||||
#include "networkstatus_st.h"
|
||||
#include "or_connection_st.h"
|
||||
#include "port_cfg_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "socks_request_st.h"
|
||||
|
||||
#ifdef HAVE_SYSTEMD
|
||||
|
@ -82,6 +82,7 @@
|
||||
#include "networkstatus_voter_info_st.h"
|
||||
#include "ns_detached_signatures_st.h"
|
||||
#include "node_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerlist_st.h"
|
||||
#include "vote_microdesc_hash_st.h"
|
||||
#include "vote_routerstatus_st.h"
|
||||
|
@ -72,6 +72,7 @@
|
||||
#include "microdesc_st.h"
|
||||
#include "networkstatus_st.h"
|
||||
#include "node_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerlist_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
|
95
src/or/or.h
95
src/or/or.h
@ -1599,100 +1599,7 @@ typedef struct protover_summary_flags_t {
|
||||
unsigned int supports_v3_rendezvous_point: 1;
|
||||
} protover_summary_flags_t;
|
||||
|
||||
/** Information about another onion router in the network. */
|
||||
typedef struct {
|
||||
signed_descriptor_t cache_info;
|
||||
char *nickname; /**< Human-readable OR name. */
|
||||
|
||||
uint32_t addr; /**< IPv4 address of OR, in host order. */
|
||||
uint16_t or_port; /**< Port for TLS connections. */
|
||||
uint16_t dir_port; /**< Port for HTTP directory connections. */
|
||||
|
||||
/** A router's IPv6 address, if it has one. */
|
||||
/* XXXXX187 Actually these should probably be part of a list of addresses,
|
||||
* not just a special case. Use abstractions to access these; don't do it
|
||||
* directly. */
|
||||
tor_addr_t ipv6_addr;
|
||||
uint16_t ipv6_orport;
|
||||
|
||||
crypto_pk_t *onion_pkey; /**< Public RSA key for onions. */
|
||||
crypto_pk_t *identity_pkey; /**< Public RSA key for signing. */
|
||||
/** Public curve25519 key for onions */
|
||||
curve25519_public_key_t *onion_curve25519_pkey;
|
||||
/** What's the earliest expiration time on all the certs in this
|
||||
* routerinfo? */
|
||||
time_t cert_expiration_time;
|
||||
|
||||
char *platform; /**< What software/operating system is this OR using? */
|
||||
|
||||
char *protocol_list; /**< Encoded list of subprotocol versions supported
|
||||
* by this OR */
|
||||
|
||||
/* link info */
|
||||
uint32_t bandwidthrate; /**< How many bytes does this OR add to its token
|
||||
* bucket per second? */
|
||||
uint32_t bandwidthburst; /**< How large is this OR's token bucket? */
|
||||
/** How many bytes/s is this router known to handle? */
|
||||
uint32_t bandwidthcapacity;
|
||||
smartlist_t *exit_policy; /**< What streams will this OR permit
|
||||
* to exit on IPv4? NULL for 'reject *:*'. */
|
||||
/** What streams will this OR permit to exit on IPv6?
|
||||
* NULL for 'reject *:*' */
|
||||
struct short_policy_t *ipv6_exit_policy;
|
||||
long uptime; /**< How many seconds the router claims to have been up */
|
||||
smartlist_t *declared_family; /**< Nicknames of router which this router
|
||||
* claims are its family. */
|
||||
char *contact_info; /**< Declared contact info for this router. */
|
||||
unsigned int is_hibernating:1; /**< Whether the router claims to be
|
||||
* hibernating */
|
||||
unsigned int caches_extra_info:1; /**< Whether the router says it caches and
|
||||
* serves extrainfo documents. */
|
||||
unsigned int allow_single_hop_exits:1; /**< Whether the router says
|
||||
* it allows single hop exits. */
|
||||
|
||||
unsigned int wants_to_be_hs_dir:1; /**< True iff this router claims to be
|
||||
* a hidden service directory. */
|
||||
unsigned int policy_is_reject_star:1; /**< True iff the exit policy for this
|
||||
* router rejects everything. */
|
||||
/** True if, after we have added this router, we should re-launch
|
||||
* tests for it. */
|
||||
unsigned int needs_retest_if_added:1;
|
||||
|
||||
/** True iff this router included "tunnelled-dir-server" in its descriptor,
|
||||
* implying it accepts tunnelled directory requests, or it advertised
|
||||
* dir_port > 0. */
|
||||
unsigned int supports_tunnelled_dir_requests:1;
|
||||
|
||||
/** Used during voting to indicate that we should not include an entry for
|
||||
* this routerinfo. Used only during voting. */
|
||||
unsigned int omit_from_vote:1;
|
||||
|
||||
/** Flags to summarize the protocol versions for this routerinfo_t. */
|
||||
protover_summary_flags_t pv;
|
||||
|
||||
/** Tor can use this router for general positions in circuits; we got it
|
||||
* from a directory server as usual, or we're an authority and a server
|
||||
* uploaded it. */
|
||||
#define ROUTER_PURPOSE_GENERAL 0
|
||||
/** Tor should avoid using this router for circuit-building: we got it
|
||||
* from a controller. If the controller wants to use it, it'll have to
|
||||
* ask for it by identity. */
|
||||
#define ROUTER_PURPOSE_CONTROLLER 1
|
||||
/** Tor should use this router only for bridge positions in circuits: we got
|
||||
* it via a directory request from the bridge itself, or a bridge
|
||||
* authority. */
|
||||
#define ROUTER_PURPOSE_BRIDGE 2
|
||||
/** Tor should not use this router; it was marked in cached-descriptors with
|
||||
* a purpose we didn't recognize. */
|
||||
#define ROUTER_PURPOSE_UNKNOWN 255
|
||||
|
||||
/** In what way did we find out about this router? One of ROUTER_PURPOSE_*.
|
||||
* Routers of different purposes are kept segregated and used for different
|
||||
* things; see notes on ROUTER_PURPOSE_* macros above.
|
||||
*/
|
||||
uint8_t purpose;
|
||||
} routerinfo_t;
|
||||
|
||||
typedef struct routerinfo_t routerinfo_t;
|
||||
typedef struct extrainfo_t extrainfo_t;
|
||||
typedef struct routerstatus_t routerstatus_t;
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "microdesc_st.h"
|
||||
#include "node_st.h"
|
||||
#include "port_cfg_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/** Policy that addresses for incoming SOCKS connections must match. */
|
||||
|
@ -87,6 +87,7 @@
|
||||
#include "entry_connection_st.h"
|
||||
#include "or_circuit_st.h"
|
||||
#include "origin_circuit_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "socks_request_st.h"
|
||||
|
||||
static edge_connection_t *relay_lookup_conn(circuit_t *circ, cell_t *cell,
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "node_st.h"
|
||||
#include "origin_circuit_st.h"
|
||||
#include "port_cfg_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
|
||||
/**
|
||||
* \file router.c
|
||||
|
105
src/or/routerinfo_st.h
Normal file
105
src/or/routerinfo_st.h
Normal file
@ -0,0 +1,105 @@
|
||||
/* Copyright (c) 2001 Matej Pfajfar.
|
||||
* Copyright (c) 2001-2004, Roger Dingledine.
|
||||
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
||||
* Copyright (c) 2007-2017, The Tor Project, Inc. */
|
||||
/* See LICENSE for licensing information */
|
||||
|
||||
#ifndef ROUTERINFO_ST_H
|
||||
#define ROUTERINFO_ST_H
|
||||
|
||||
/** Information about another onion router in the network. */
|
||||
struct routerinfo_t {
|
||||
signed_descriptor_t cache_info;
|
||||
char *nickname; /**< Human-readable OR name. */
|
||||
|
||||
uint32_t addr; /**< IPv4 address of OR, in host order. */
|
||||
uint16_t or_port; /**< Port for TLS connections. */
|
||||
uint16_t dir_port; /**< Port for HTTP directory connections. */
|
||||
|
||||
/** A router's IPv6 address, if it has one. */
|
||||
/* XXXXX187 Actually these should probably be part of a list of addresses,
|
||||
* not just a special case. Use abstractions to access these; don't do it
|
||||
* directly. */
|
||||
tor_addr_t ipv6_addr;
|
||||
uint16_t ipv6_orport;
|
||||
|
||||
crypto_pk_t *onion_pkey; /**< Public RSA key for onions. */
|
||||
crypto_pk_t *identity_pkey; /**< Public RSA key for signing. */
|
||||
/** Public curve25519 key for onions */
|
||||
curve25519_public_key_t *onion_curve25519_pkey;
|
||||
/** What's the earliest expiration time on all the certs in this
|
||||
* routerinfo? */
|
||||
time_t cert_expiration_time;
|
||||
|
||||
char *platform; /**< What software/operating system is this OR using? */
|
||||
|
||||
char *protocol_list; /**< Encoded list of subprotocol versions supported
|
||||
* by this OR */
|
||||
|
||||
/* link info */
|
||||
uint32_t bandwidthrate; /**< How many bytes does this OR add to its token
|
||||
* bucket per second? */
|
||||
uint32_t bandwidthburst; /**< How large is this OR's token bucket? */
|
||||
/** How many bytes/s is this router known to handle? */
|
||||
uint32_t bandwidthcapacity;
|
||||
smartlist_t *exit_policy; /**< What streams will this OR permit
|
||||
* to exit on IPv4? NULL for 'reject *:*'. */
|
||||
/** What streams will this OR permit to exit on IPv6?
|
||||
* NULL for 'reject *:*' */
|
||||
struct short_policy_t *ipv6_exit_policy;
|
||||
long uptime; /**< How many seconds the router claims to have been up */
|
||||
smartlist_t *declared_family; /**< Nicknames of router which this router
|
||||
* claims are its family. */
|
||||
char *contact_info; /**< Declared contact info for this router. */
|
||||
unsigned int is_hibernating:1; /**< Whether the router claims to be
|
||||
* hibernating */
|
||||
unsigned int caches_extra_info:1; /**< Whether the router says it caches and
|
||||
* serves extrainfo documents. */
|
||||
unsigned int allow_single_hop_exits:1; /**< Whether the router says
|
||||
* it allows single hop exits. */
|
||||
|
||||
unsigned int wants_to_be_hs_dir:1; /**< True iff this router claims to be
|
||||
* a hidden service directory. */
|
||||
unsigned int policy_is_reject_star:1; /**< True iff the exit policy for this
|
||||
* router rejects everything. */
|
||||
/** True if, after we have added this router, we should re-launch
|
||||
* tests for it. */
|
||||
unsigned int needs_retest_if_added:1;
|
||||
|
||||
/** True iff this router included "tunnelled-dir-server" in its descriptor,
|
||||
* implying it accepts tunnelled directory requests, or it advertised
|
||||
* dir_port > 0. */
|
||||
unsigned int supports_tunnelled_dir_requests:1;
|
||||
|
||||
/** Used during voting to indicate that we should not include an entry for
|
||||
* this routerinfo. Used only during voting. */
|
||||
unsigned int omit_from_vote:1;
|
||||
|
||||
/** Flags to summarize the protocol versions for this routerinfo_t. */
|
||||
protover_summary_flags_t pv;
|
||||
|
||||
/** Tor can use this router for general positions in circuits; we got it
|
||||
* from a directory server as usual, or we're an authority and a server
|
||||
* uploaded it. */
|
||||
#define ROUTER_PURPOSE_GENERAL 0
|
||||
/** Tor should avoid using this router for circuit-building: we got it
|
||||
* from a controller. If the controller wants to use it, it'll have to
|
||||
* ask for it by identity. */
|
||||
#define ROUTER_PURPOSE_CONTROLLER 1
|
||||
/** Tor should use this router only for bridge positions in circuits: we got
|
||||
* it via a directory request from the bridge itself, or a bridge
|
||||
* authority. */
|
||||
#define ROUTER_PURPOSE_BRIDGE 2
|
||||
/** Tor should not use this router; it was marked in cached-descriptors with
|
||||
* a purpose we didn't recognize. */
|
||||
#define ROUTER_PURPOSE_UNKNOWN 255
|
||||
|
||||
/** In what way did we find out about this router? One of ROUTER_PURPOSE_*.
|
||||
* Routers of different purposes are kept segregated and used for different
|
||||
* things; see notes on ROUTER_PURPOSE_* macros above.
|
||||
*/
|
||||
uint8_t purpose;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -133,6 +133,7 @@
|
||||
#include "networkstatus_st.h"
|
||||
#include "networkstatus_voter_info_st.h"
|
||||
#include "node_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerlist_st.h"
|
||||
#include "vote_routerstatus_st.h"
|
||||
|
||||
|
@ -91,6 +91,7 @@
|
||||
#include "rend_authorized_client_st.h"
|
||||
#include "rend_intro_point_st.h"
|
||||
#include "rend_service_descriptor_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerlist_st.h"
|
||||
#include "tor_version_st.h"
|
||||
#include "vote_microdesc_hash_st.h"
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "routerset.h"
|
||||
|
||||
#include "node_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/** Return a new empty routerset. */
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include "hs_service.h"
|
||||
#include "dos.h"
|
||||
|
||||
#include "routerinfo_st.h"
|
||||
|
||||
static void log_accounting(const time_t now, const or_options_t *options);
|
||||
#include "geoip.h"
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "microdesc_st.h"
|
||||
#include "networkstatus_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
#include "test.h"
|
||||
|
@ -46,6 +46,7 @@
|
||||
|
||||
#include "dir_server_st.h"
|
||||
#include "port_cfg_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
|
||||
static void
|
||||
test_config_addressmap(void *arg)
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "entry_connection_st.h"
|
||||
#include "node_st.h"
|
||||
#include "or_connection_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "socks_request_st.h"
|
||||
|
||||
static void * test_conn_get_basic_setup(const struct testcase_t *tc);
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "networkstatus_voter_info_st.h"
|
||||
#include "ns_detached_signatures_st.h"
|
||||
#include "port_cfg_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerlist_st.h"
|
||||
#include "tor_version_st.h"
|
||||
#include "vote_microdesc_hash_st.h"
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "authority_cert_st.h"
|
||||
#include "networkstatus_st.h"
|
||||
#include "networkstatus_voter_info_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "vote_microdesc_hash_st.h"
|
||||
#include "vote_routerstatus_st.h"
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "dir_server_st.h"
|
||||
#include "networkstatus_st.h"
|
||||
#include "rend_encoded_v2_service_descriptor_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerlist_st.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "networkstatus_st.h"
|
||||
#include "node_st.h"
|
||||
#include "origin_circuit_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
#include "test_helpers.h"
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "node_st.h"
|
||||
#include "rend_encoded_v2_service_descriptor_st.h"
|
||||
#include "rend_intro_point_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
|
||||
#include "test_helpers.h"
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "microdesc_st.h"
|
||||
#include "networkstatus_st.h"
|
||||
#include "node_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/** Test the validation of HS v3 addresses */
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include "networkstatus_st.h"
|
||||
#include "node_st.h"
|
||||
#include "origin_circuit_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
|
||||
/* Trunnel */
|
||||
#include "hs/cell_establish_intro.h"
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "microdesc_st.h"
|
||||
#include "networkstatus_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
#include "test.h"
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "microdesc_st.h"
|
||||
#include "networkstatus_st.h"
|
||||
#include "node_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
#include "test.h"
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "node_st.h"
|
||||
#include "port_cfg_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/* Helper: assert that short_policy parses and writes back out as itself,
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "rend_encoded_v2_service_descriptor_st.h"
|
||||
#include "rend_intro_point_st.h"
|
||||
#include "rend_service_descriptor_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
|
||||
#include "rend_test_helpers.h"
|
||||
#include "log_test_helpers.h"
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include "router.h"
|
||||
#include "routerlist.h"
|
||||
|
||||
#include "routerinfo_st.h"
|
||||
|
||||
/* Test suite stuff */
|
||||
#include "test.h"
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nodelist.h"
|
||||
|
||||
#include "node_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
#include "test.h"
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "statefile.h"
|
||||
|
||||
#include "origin_circuit_st.h"
|
||||
#include "routerinfo_st.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user