mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-14 07:03:44 +01:00
Move dir_server_t into its own header.
This commit is contained in:
parent
df9a3fe86f
commit
2a574d11ac
54
src/or/dir_server_st.h
Normal file
54
src/or/dir_server_st.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/* 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 DIR_SERVER_ST_H
|
||||||
|
#define DIR_SERVER_ST_H
|
||||||
|
|
||||||
|
#include "torint.h"
|
||||||
|
#include "or.h"
|
||||||
|
|
||||||
|
/** Represents information about a single trusted or fallback directory
|
||||||
|
* server. */
|
||||||
|
typedef struct dir_server_t {
|
||||||
|
char *description;
|
||||||
|
char *nickname;
|
||||||
|
char *address; /**< Hostname. */
|
||||||
|
/* XX/teor - why do we duplicate the address and port fields here and in
|
||||||
|
* fake_status? Surely we could just use fake_status (#17867). */
|
||||||
|
tor_addr_t ipv6_addr; /**< IPv6 address if present; AF_UNSPEC if not */
|
||||||
|
uint32_t addr; /**< IPv4 address. */
|
||||||
|
uint16_t dir_port; /**< Directory port. */
|
||||||
|
uint16_t or_port; /**< OR port: Used for tunneling connections. */
|
||||||
|
uint16_t ipv6_orport; /**< OR port corresponding to ipv6_addr. */
|
||||||
|
double weight; /** Weight used when selecting this node at random */
|
||||||
|
char digest[DIGEST_LEN]; /**< Digest of identity key. */
|
||||||
|
char v3_identity_digest[DIGEST_LEN]; /**< Digest of v3 (authority only,
|
||||||
|
* high-security) identity key. */
|
||||||
|
|
||||||
|
unsigned int is_running:1; /**< True iff we think this server is running. */
|
||||||
|
unsigned int is_authority:1; /**< True iff this is a directory authority
|
||||||
|
* of some kind. */
|
||||||
|
|
||||||
|
/** True iff this server has accepted the most recent server descriptor
|
||||||
|
* we tried to upload to it. */
|
||||||
|
unsigned int has_accepted_serverdesc:1;
|
||||||
|
|
||||||
|
/** What kind of authority is this? (Bitfield.) */
|
||||||
|
dirinfo_type_t type;
|
||||||
|
|
||||||
|
time_t addr_current_at; /**< When was the document that we derived the
|
||||||
|
* address information from published? */
|
||||||
|
|
||||||
|
routerstatus_t fake_status; /**< Used when we need to pass this trusted
|
||||||
|
* dir_server_t to
|
||||||
|
* directory_request_set_routerstatus.
|
||||||
|
* as a routerstatus_t. Not updated by the
|
||||||
|
* router-status management code!
|
||||||
|
**/
|
||||||
|
} dir_server_t;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -28,6 +28,8 @@
|
|||||||
#include "dirauth/mode.h"
|
#include "dirauth/mode.h"
|
||||||
#include "dirauth/shared_random_state.h"
|
#include "dirauth/shared_random_state.h"
|
||||||
|
|
||||||
|
#include "dir_server_st.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file dirvote.c
|
* \file dirvote.c
|
||||||
* \brief Functions to compute directory consensus, and schedule voting.
|
* \brief Functions to compute directory consensus, and schedule voting.
|
||||||
|
@ -53,6 +53,8 @@
|
|||||||
#include "dirauth/mode.h"
|
#include "dirauth/mode.h"
|
||||||
#include "dirauth/shared_random.h"
|
#include "dirauth/shared_random.h"
|
||||||
|
|
||||||
|
#include "dir_server_st.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file directory.c
|
* \file directory.c
|
||||||
* \brief Code to send and fetch information from directory authorities and
|
* \brief Code to send and fetch information from directory authorities and
|
||||||
|
@ -206,6 +206,7 @@ ORHEADERS = \
|
|||||||
src/or/cpuworker.h \
|
src/or/cpuworker.h \
|
||||||
src/or/directory.h \
|
src/or/directory.h \
|
||||||
src/or/dirserv.h \
|
src/or/dirserv.h \
|
||||||
|
src/or/dir_server_st.h \
|
||||||
src/or/dns.h \
|
src/or/dns.h \
|
||||||
src/or/dns_structs.h \
|
src/or/dns_structs.h \
|
||||||
src/or/dnsserv.h \
|
src/or/dnsserv.h \
|
||||||
|
@ -74,6 +74,8 @@
|
|||||||
#include "dirauth/mode.h"
|
#include "dirauth/mode.h"
|
||||||
#include "dirauth/shared_random.h"
|
#include "dirauth/shared_random.h"
|
||||||
|
|
||||||
|
#include "dir_server_st.h"
|
||||||
|
|
||||||
/** Most recently received and validated v3 "ns"-flavored consensus network
|
/** Most recently received and validated v3 "ns"-flavored consensus network
|
||||||
* status. */
|
* status. */
|
||||||
STATIC networkstatus_t *current_ns_consensus = NULL;
|
STATIC networkstatus_t *current_ns_consensus = NULL;
|
||||||
|
@ -68,6 +68,8 @@
|
|||||||
|
|
||||||
#include "dirauth/mode.h"
|
#include "dirauth/mode.h"
|
||||||
|
|
||||||
|
#include "dir_server_st.h"
|
||||||
|
|
||||||
static void nodelist_drop_node(node_t *node, int remove_from_ht);
|
static void nodelist_drop_node(node_t *node, int remove_from_ht);
|
||||||
#define node_free(val) \
|
#define node_free(val) \
|
||||||
FREE_AND_NULL(node_t, node_free_, (val))
|
FREE_AND_NULL(node_t, node_free_, (val))
|
||||||
|
40
src/or/or.h
40
src/or/or.h
@ -5314,45 +5314,7 @@ typedef struct rend_service_descriptor_t {
|
|||||||
|
|
||||||
/********************************* routerlist.c ***************************/
|
/********************************* routerlist.c ***************************/
|
||||||
|
|
||||||
/** Represents information about a single trusted or fallback directory
|
typedef struct dir_server_t dir_server_t;
|
||||||
* server. */
|
|
||||||
typedef struct dir_server_t {
|
|
||||||
char *description;
|
|
||||||
char *nickname;
|
|
||||||
char *address; /**< Hostname. */
|
|
||||||
/* XX/teor - why do we duplicate the address and port fields here and in
|
|
||||||
* fake_status? Surely we could just use fake_status (#17867). */
|
|
||||||
tor_addr_t ipv6_addr; /**< IPv6 address if present; AF_UNSPEC if not */
|
|
||||||
uint32_t addr; /**< IPv4 address. */
|
|
||||||
uint16_t dir_port; /**< Directory port. */
|
|
||||||
uint16_t or_port; /**< OR port: Used for tunneling connections. */
|
|
||||||
uint16_t ipv6_orport; /**< OR port corresponding to ipv6_addr. */
|
|
||||||
double weight; /** Weight used when selecting this node at random */
|
|
||||||
char digest[DIGEST_LEN]; /**< Digest of identity key. */
|
|
||||||
char v3_identity_digest[DIGEST_LEN]; /**< Digest of v3 (authority only,
|
|
||||||
* high-security) identity key. */
|
|
||||||
|
|
||||||
unsigned int is_running:1; /**< True iff we think this server is running. */
|
|
||||||
unsigned int is_authority:1; /**< True iff this is a directory authority
|
|
||||||
* of some kind. */
|
|
||||||
|
|
||||||
/** True iff this server has accepted the most recent server descriptor
|
|
||||||
* we tried to upload to it. */
|
|
||||||
unsigned int has_accepted_serverdesc:1;
|
|
||||||
|
|
||||||
/** What kind of authority is this? (Bitfield.) */
|
|
||||||
dirinfo_type_t type;
|
|
||||||
|
|
||||||
time_t addr_current_at; /**< When was the document that we derived the
|
|
||||||
* address information from published? */
|
|
||||||
|
|
||||||
routerstatus_t fake_status; /**< Used when we need to pass this trusted
|
|
||||||
* dir_server_t to
|
|
||||||
* directory_request_set_routerstatus.
|
|
||||||
* as a routerstatus_t. Not updated by the
|
|
||||||
* router-status management code!
|
|
||||||
**/
|
|
||||||
} dir_server_t;
|
|
||||||
|
|
||||||
#define RELAY_REQUIRED_MIN_BANDWIDTH (75*1024)
|
#define RELAY_REQUIRED_MIN_BANDWIDTH (75*1024)
|
||||||
#define BRIDGE_REQUIRED_MIN_BANDWIDTH (50*1024)
|
#define BRIDGE_REQUIRED_MIN_BANDWIDTH (50*1024)
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "geoip.h"
|
#include "geoip.h"
|
||||||
#include "ht.h"
|
#include "ht.h"
|
||||||
|
|
||||||
|
#include "dir_server_st.h"
|
||||||
#include "port_cfg_st.h"
|
#include "port_cfg_st.h"
|
||||||
|
|
||||||
/** Policy that addresses for incoming SOCKS connections must match. */
|
/** Policy that addresses for incoming SOCKS connections must match. */
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#include "dirauth/mode.h"
|
#include "dirauth/mode.h"
|
||||||
|
|
||||||
|
#include "dir_server_st.h"
|
||||||
#include "port_cfg_st.h"
|
#include "port_cfg_st.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -125,6 +125,8 @@
|
|||||||
#include "dirauth/dirvote.h"
|
#include "dirauth/dirvote.h"
|
||||||
#include "dirauth/mode.h"
|
#include "dirauth/mode.h"
|
||||||
|
|
||||||
|
#include "dir_server_st.h"
|
||||||
|
|
||||||
// #define DEBUG_ROUTERLIST
|
// #define DEBUG_ROUTERLIST
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
@ -43,6 +43,8 @@
|
|||||||
#include "statefile.h"
|
#include "statefile.h"
|
||||||
|
|
||||||
#include "test_helpers.h"
|
#include "test_helpers.h"
|
||||||
|
|
||||||
|
#include "dir_server_st.h"
|
||||||
#include "port_cfg_st.h"
|
#include "port_cfg_st.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -34,6 +34,8 @@
|
|||||||
#include "log_test_helpers.h"
|
#include "log_test_helpers.h"
|
||||||
#include "voting_schedule.h"
|
#include "voting_schedule.h"
|
||||||
|
|
||||||
|
#include "dir_server_st.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/* For mkdir() */
|
/* For mkdir() */
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
#include "shared_random_client.h"
|
#include "shared_random_client.h"
|
||||||
#include "voting_schedule.h"
|
#include "voting_schedule.h"
|
||||||
|
|
||||||
|
#include "dir_server_st.h"
|
||||||
|
|
||||||
static authority_cert_t *mock_cert;
|
static authority_cert_t *mock_cert;
|
||||||
|
|
||||||
static authority_cert_t *
|
static authority_cert_t *
|
||||||
|
Loading…
Reference in New Issue
Block a user