mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Extract routerstatus_t into its own header.
This commit is contained in:
parent
00f1d1653e
commit
def1f20e1f
@ -28,6 +28,7 @@
|
||||
#include "transports.h"
|
||||
|
||||
#include "node_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/** Information about a configured bridge. Currently this just matches the
|
||||
* ones in the torrc file, but one day we may be able to learn about new
|
||||
|
@ -70,6 +70,7 @@
|
||||
#include "node_st.h"
|
||||
#include "or_circuit_st.h"
|
||||
#include "origin_circuit_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
static channel_t * channel_connect_for_circuit(const tor_addr_t *addr,
|
||||
uint16_t port,
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "torint.h"
|
||||
#include "or.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/** Represents information about a single trusted or fallback directory
|
||||
* server. */
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "networkstatus_st.h"
|
||||
#include "node_st.h"
|
||||
#include "origin_circuit_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/* Trunnel */
|
||||
#include "ed25519_cert.h"
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nodelist.h"
|
||||
|
||||
#include "node_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/* Send on the control port the "HS_DESC REQUESTED [...]" event.
|
||||
*
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "networkstatus_st.h"
|
||||
#include "node_st.h"
|
||||
#include "origin_circuit_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/* Trunnel */
|
||||
#include "ed25519_cert.h"
|
||||
|
@ -301,6 +301,7 @@ ORHEADERS = \
|
||||
src/or/routerkeys.h \
|
||||
src/or/routerset.h \
|
||||
src/or/routerparse.h \
|
||||
src/or/routerstatus_st.h \
|
||||
src/or/scheduler.h \
|
||||
src/or/server_port_cfg_st.h \
|
||||
src/or/shared_random_client.h \
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "networkstatus_st.h"
|
||||
#include "node_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/** A data structure to hold a bunch of cached microdescriptors. There are
|
||||
* two active files in the cache: a "cache file" that we mmap, and a "journal
|
||||
|
@ -72,6 +72,7 @@
|
||||
#include "networkstatus_st.h"
|
||||
#include "node_st.h"
|
||||
#include "routerlist_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
static void nodelist_drop_node(node_t *node, int remove_from_ht);
|
||||
#define node_free(val) \
|
||||
|
68
src/or/or.h
68
src/or/or.h
@ -1694,73 +1694,7 @@ typedef struct {
|
||||
} routerinfo_t;
|
||||
|
||||
typedef struct extrainfo_t extrainfo_t;
|
||||
|
||||
/** Contents of a single router entry in a network status object.
|
||||
*/
|
||||
typedef struct routerstatus_t {
|
||||
time_t published_on; /**< When was this router published? */
|
||||
char nickname[MAX_NICKNAME_LEN+1]; /**< The nickname this router says it
|
||||
* has. */
|
||||
char identity_digest[DIGEST_LEN]; /**< Digest of the router's identity
|
||||
* key. */
|
||||
/** Digest of the router's most recent descriptor or microdescriptor.
|
||||
* If it's a descriptor, we only use the first DIGEST_LEN bytes. */
|
||||
char descriptor_digest[DIGEST256_LEN];
|
||||
uint32_t addr; /**< IPv4 address for this router, in host order. */
|
||||
uint16_t or_port; /**< IPv4 OR port for this router. */
|
||||
uint16_t dir_port; /**< Directory port for this router. */
|
||||
tor_addr_t ipv6_addr; /**< IPv6 address for this router. */
|
||||
uint16_t ipv6_orport; /**< IPv6 OR port for this router. */
|
||||
unsigned int is_authority:1; /**< True iff this router is an authority. */
|
||||
unsigned int is_exit:1; /**< True iff this router is a good exit. */
|
||||
unsigned int is_stable:1; /**< True iff this router stays up a long time. */
|
||||
unsigned int is_fast:1; /**< True iff this router has good bandwidth. */
|
||||
/** True iff this router is called 'running' in the consensus. We give it
|
||||
* this funny name so that we don't accidentally use this bit as a view of
|
||||
* whether we think the router is *currently* running. If that's what you
|
||||
* want to know, look at is_running in node_t. */
|
||||
unsigned int is_flagged_running:1;
|
||||
unsigned int is_named:1; /**< True iff "nickname" belongs to this router. */
|
||||
unsigned int is_unnamed:1; /**< True iff "nickname" belongs to another
|
||||
* router. */
|
||||
unsigned int is_valid:1; /**< True iff this router isn't invalid. */
|
||||
unsigned int is_possible_guard:1; /**< True iff this router would be a good
|
||||
* choice as an entry guard. */
|
||||
unsigned int is_bad_exit:1; /**< True iff this node is a bad choice for
|
||||
* an exit node. */
|
||||
unsigned int is_hs_dir:1; /**< True iff this router is a v2-or-later hidden
|
||||
* service directory. */
|
||||
unsigned int is_v2_dir:1; /** True iff this router publishes an open DirPort
|
||||
* or it claims to accept tunnelled dir requests.
|
||||
*/
|
||||
|
||||
unsigned int has_bandwidth:1; /**< The vote/consensus had bw info */
|
||||
unsigned int has_exitsummary:1; /**< The vote/consensus had exit summaries */
|
||||
unsigned int bw_is_unmeasured:1; /**< This is a consensus entry, with
|
||||
* the Unmeasured flag set. */
|
||||
|
||||
/** Flags to summarize the protocol versions for this routerstatus_t. */
|
||||
protover_summary_flags_t pv;
|
||||
|
||||
uint32_t bandwidth_kb; /**< Bandwidth (capacity) of the router as reported in
|
||||
* the vote/consensus, in kilobytes/sec. */
|
||||
|
||||
/** The consensus has guardfraction information for this router. */
|
||||
unsigned int has_guardfraction:1;
|
||||
/** The guardfraction value of this router. */
|
||||
uint32_t guardfraction_percentage;
|
||||
|
||||
char *exitsummary; /**< exit policy summary -
|
||||
* XXX weasel: this probably should not stay a string. */
|
||||
|
||||
/* ---- The fields below aren't derived from the networkstatus; they
|
||||
* hold local information only. */
|
||||
|
||||
time_t last_dir_503_at; /**< When did this router last tell us that it
|
||||
* was too busy to serve directory info? */
|
||||
download_status_t dl_status;
|
||||
|
||||
} routerstatus_t;
|
||||
typedef struct routerstatus_t routerstatus_t;
|
||||
|
||||
/** A single entry in a parsed policy summary, describing a range of ports. */
|
||||
typedef struct short_policy_entry_t {
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "dir_server_st.h"
|
||||
#include "node_st.h"
|
||||
#include "port_cfg_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/** Policy that addresses for incoming SOCKS connections must match. */
|
||||
static smartlist_t *socks_policy = NULL;
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "origin_circuit_st.h"
|
||||
#include "rend_intro_point_st.h"
|
||||
#include "rend_service_descriptor_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
static extend_info_t *rend_client_get_random_intro_impl(
|
||||
const rend_cache_entry_t *rend_query,
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "rend_encoded_v2_service_descriptor_st.h"
|
||||
#include "rend_intro_point_st.h"
|
||||
#include "rend_service_descriptor_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/** Return 0 if one and two are the same service ids, else -1 or 1 */
|
||||
int
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "rend_encoded_v2_service_descriptor_st.h"
|
||||
#include "rend_intro_point_st.h"
|
||||
#include "rend_service_descriptor_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
struct rend_service_t;
|
||||
static origin_circuit_t *find_intro_circuit(rend_intro_point_t *intro,
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "routerset.h"
|
||||
|
||||
#include "node_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/** Return a new empty routerset. */
|
||||
routerset_t *
|
||||
|
78
src/or/routerstatus_st.h
Normal file
78
src/or/routerstatus_st.h
Normal file
@ -0,0 +1,78 @@
|
||||
/* 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 ROUTERSTATUS_ST_H
|
||||
#define ROUTERSTATUS_ST_H
|
||||
|
||||
/** Contents of a single router entry in a network status object.
|
||||
*/
|
||||
struct routerstatus_t {
|
||||
time_t published_on; /**< When was this router published? */
|
||||
char nickname[MAX_NICKNAME_LEN+1]; /**< The nickname this router says it
|
||||
* has. */
|
||||
char identity_digest[DIGEST_LEN]; /**< Digest of the router's identity
|
||||
* key. */
|
||||
/** Digest of the router's most recent descriptor or microdescriptor.
|
||||
* If it's a descriptor, we only use the first DIGEST_LEN bytes. */
|
||||
char descriptor_digest[DIGEST256_LEN];
|
||||
uint32_t addr; /**< IPv4 address for this router, in host order. */
|
||||
uint16_t or_port; /**< IPv4 OR port for this router. */
|
||||
uint16_t dir_port; /**< Directory port for this router. */
|
||||
tor_addr_t ipv6_addr; /**< IPv6 address for this router. */
|
||||
uint16_t ipv6_orport; /**< IPv6 OR port for this router. */
|
||||
unsigned int is_authority:1; /**< True iff this router is an authority. */
|
||||
unsigned int is_exit:1; /**< True iff this router is a good exit. */
|
||||
unsigned int is_stable:1; /**< True iff this router stays up a long time. */
|
||||
unsigned int is_fast:1; /**< True iff this router has good bandwidth. */
|
||||
/** True iff this router is called 'running' in the consensus. We give it
|
||||
* this funny name so that we don't accidentally use this bit as a view of
|
||||
* whether we think the router is *currently* running. If that's what you
|
||||
* want to know, look at is_running in node_t. */
|
||||
unsigned int is_flagged_running:1;
|
||||
unsigned int is_named:1; /**< True iff "nickname" belongs to this router. */
|
||||
unsigned int is_unnamed:1; /**< True iff "nickname" belongs to another
|
||||
* router. */
|
||||
unsigned int is_valid:1; /**< True iff this router isn't invalid. */
|
||||
unsigned int is_possible_guard:1; /**< True iff this router would be a good
|
||||
* choice as an entry guard. */
|
||||
unsigned int is_bad_exit:1; /**< True iff this node is a bad choice for
|
||||
* an exit node. */
|
||||
unsigned int is_hs_dir:1; /**< True iff this router is a v2-or-later hidden
|
||||
* service directory. */
|
||||
unsigned int is_v2_dir:1; /** True iff this router publishes an open DirPort
|
||||
* or it claims to accept tunnelled dir requests.
|
||||
*/
|
||||
|
||||
unsigned int has_bandwidth:1; /**< The vote/consensus had bw info */
|
||||
unsigned int has_exitsummary:1; /**< The vote/consensus had exit summaries */
|
||||
unsigned int bw_is_unmeasured:1; /**< This is a consensus entry, with
|
||||
* the Unmeasured flag set. */
|
||||
|
||||
/** Flags to summarize the protocol versions for this routerstatus_t. */
|
||||
protover_summary_flags_t pv;
|
||||
|
||||
uint32_t bandwidth_kb; /**< Bandwidth (capacity) of the router as reported in
|
||||
* the vote/consensus, in kilobytes/sec. */
|
||||
|
||||
/** The consensus has guardfraction information for this router. */
|
||||
unsigned int has_guardfraction:1;
|
||||
/** The guardfraction value of this router. */
|
||||
uint32_t guardfraction_percentage;
|
||||
|
||||
char *exitsummary; /**< exit policy summary -
|
||||
* XXX weasel: this probably should not stay a string. */
|
||||
|
||||
/* ---- The fields below aren't derived from the networkstatus; they
|
||||
* hold local information only. */
|
||||
|
||||
time_t last_dir_503_at; /**< When did this router last tell us that it
|
||||
* was too busy to serve directory info? */
|
||||
download_status_t dl_status;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -7,6 +7,8 @@
|
||||
#ifndef VOTE_ROUTERSTATUS_ST_H
|
||||
#define VOTE_ROUTERSTATUS_ST_H
|
||||
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/** The claim about a single router, made in a vote. */
|
||||
struct vote_routerstatus_t {
|
||||
routerstatus_t status; /**< Underlying 'status' object for this router.
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "torcert.h"
|
||||
|
||||
#include "networkstatus_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "networkstatus_st.h"
|
||||
#include "origin_circuit_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/* Test suite stuff */
|
||||
#include "log_test_helpers.h"
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "networkstatus_st.h"
|
||||
#include "or_connection_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
int channelpadding_get_netflow_inactive_timeout_ms(channel_t *chan);
|
||||
int64_t channelpadding_compute_time_until_pad_for_netflow(channel_t *chan);
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "networkstatus_st.h"
|
||||
#include "or_connection_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
#include "test.h"
|
||||
#include "log_test_helpers.h"
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "networkstatus_st.h"
|
||||
#include "node_st.h"
|
||||
#include "origin_circuit_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
#include "test_helpers.h"
|
||||
#include "log_test_helpers.h"
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
#include "networkstatus_st.h"
|
||||
#include "node_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/** Test the validation of HS v3 addresses */
|
||||
static void
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "nodelist.h"
|
||||
|
||||
#include "node_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
#include "test_helpers.h"
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "torcert.h"
|
||||
|
||||
#include "networkstatus_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "networkstatus_st.h"
|
||||
#include "node_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "node_st.h"
|
||||
#include "port_cfg_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
/* Helper: assert that short_policy parses and writes back out as itself,
|
||||
or as <b>expected</b> if that's provided. */
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "dir_connection_st.h"
|
||||
#include "networkstatus_st.h"
|
||||
#include "node_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
#include "test.h"
|
||||
#include "test_dir_common.h"
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nodelist.h"
|
||||
|
||||
#include "node_st.h"
|
||||
#include "routerstatus_st.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user