mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
Extract rend_intro_point_t into its own header.
This commit is contained in:
parent
22e9c64738
commit
990184da49
@ -279,6 +279,7 @@ ORHEADERS = \
|
||||
src/or/rendcommon.h \
|
||||
src/or/rendmid.h \
|
||||
src/or/rendservice.h \
|
||||
src/or/rend_intro_point_st.h \
|
||||
src/or/rend_service_descriptor_st.h \
|
||||
src/or/rephist.h \
|
||||
src/or/replaycache.h \
|
||||
|
64
src/or/or.h
64
src/or/or.h
@ -4082,69 +4082,7 @@ typedef struct rend_encoded_v2_service_descriptor_t {
|
||||
* lifetime so this is a hard limit on the amount of time we do that. */
|
||||
#define MAX_INTRO_POINT_CIRCUIT_RETRIES 3
|
||||
|
||||
/** Introduction point information. Used both in rend_service_t (on
|
||||
* the service side) and in rend_service_descriptor_t (on both the
|
||||
* client and service side). */
|
||||
typedef struct rend_intro_point_t {
|
||||
extend_info_t *extend_info; /**< Extend info for connecting to this
|
||||
* introduction point via a multi-hop path. */
|
||||
crypto_pk_t *intro_key; /**< Introduction key that replaces the service
|
||||
* key, if this descriptor is V2. */
|
||||
|
||||
/** (Client side only) Flag indicating that a timeout has occurred
|
||||
* after sending an INTRODUCE cell to this intro point. After a
|
||||
* timeout, an intro point should not be tried again during the same
|
||||
* hidden service connection attempt, but it may be tried again
|
||||
* during a future connection attempt. */
|
||||
unsigned int timed_out : 1;
|
||||
|
||||
/** (Client side only) The number of times we have failed to build a
|
||||
* circuit to this intro point for some reason other than our
|
||||
* circuit-build timeout. See also MAX_INTRO_POINT_REACHABILITY_FAILURES. */
|
||||
unsigned int unreachable_count : 3;
|
||||
|
||||
/** (Service side only) Flag indicating that this intro point was
|
||||
* included in the last HS descriptor we generated. */
|
||||
unsigned int listed_in_last_desc : 1;
|
||||
|
||||
/** (Service side only) A replay cache recording the RSA-encrypted parts
|
||||
* of INTRODUCE2 cells this intro point's circuit has received. This is
|
||||
* used to prevent replay attacks. */
|
||||
replaycache_t *accepted_intro_rsa_parts;
|
||||
|
||||
/** (Service side only) Count of INTRODUCE2 cells accepted from this
|
||||
* intro point.
|
||||
*/
|
||||
int accepted_introduce2_count;
|
||||
|
||||
/** (Service side only) Maximum number of INTRODUCE2 cells that this IP
|
||||
* will accept. This is a random value between
|
||||
* INTRO_POINT_MIN_LIFETIME_INTRODUCTIONS and
|
||||
* INTRO_POINT_MAX_LIFETIME_INTRODUCTIONS. */
|
||||
int max_introductions;
|
||||
|
||||
/** (Service side only) The time at which this intro point was first
|
||||
* published, or -1 if this intro point has not yet been
|
||||
* published. */
|
||||
time_t time_published;
|
||||
|
||||
/** (Service side only) The time at which this intro point should
|
||||
* (start to) expire, or -1 if we haven't decided when this intro
|
||||
* point should expire. */
|
||||
time_t time_to_expire;
|
||||
|
||||
/** (Service side only) The amount of circuit creation we've made to this
|
||||
* intro point. This is incremented every time we do a circuit relaunch on
|
||||
* this object which is triggered when the circuit dies but the node is
|
||||
* still in the consensus. After MAX_INTRO_POINT_CIRCUIT_RETRIES, we give
|
||||
* up on it. */
|
||||
unsigned int circuit_retries;
|
||||
|
||||
/** (Service side only) Set if this intro point has an established circuit
|
||||
* and unset if it doesn't. */
|
||||
unsigned int circuit_established:1;
|
||||
} rend_intro_point_t;
|
||||
|
||||
typedef struct rend_intro_point_t rend_intro_point_t;
|
||||
typedef struct rend_service_descriptor_t rend_service_descriptor_t;
|
||||
|
||||
/********************************* routerlist.c ***************************/
|
||||
|
74
src/or/rend_intro_point_st.h
Normal file
74
src/or/rend_intro_point_st.h
Normal file
@ -0,0 +1,74 @@
|
||||
/* 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 REND_INTRO_POINT_ST_H
|
||||
#define REND_INTRO_POINT_ST_H
|
||||
|
||||
/** Introduction point information. Used both in rend_service_t (on
|
||||
* the service side) and in rend_service_descriptor_t (on both the
|
||||
* client and service side). */
|
||||
struct rend_intro_point_t {
|
||||
extend_info_t *extend_info; /**< Extend info for connecting to this
|
||||
* introduction point via a multi-hop path. */
|
||||
crypto_pk_t *intro_key; /**< Introduction key that replaces the service
|
||||
* key, if this descriptor is V2. */
|
||||
|
||||
/** (Client side only) Flag indicating that a timeout has occurred
|
||||
* after sending an INTRODUCE cell to this intro point. After a
|
||||
* timeout, an intro point should not be tried again during the same
|
||||
* hidden service connection attempt, but it may be tried again
|
||||
* during a future connection attempt. */
|
||||
unsigned int timed_out : 1;
|
||||
|
||||
/** (Client side only) The number of times we have failed to build a
|
||||
* circuit to this intro point for some reason other than our
|
||||
* circuit-build timeout. See also MAX_INTRO_POINT_REACHABILITY_FAILURES. */
|
||||
unsigned int unreachable_count : 3;
|
||||
|
||||
/** (Service side only) Flag indicating that this intro point was
|
||||
* included in the last HS descriptor we generated. */
|
||||
unsigned int listed_in_last_desc : 1;
|
||||
|
||||
/** (Service side only) A replay cache recording the RSA-encrypted parts
|
||||
* of INTRODUCE2 cells this intro point's circuit has received. This is
|
||||
* used to prevent replay attacks. */
|
||||
replaycache_t *accepted_intro_rsa_parts;
|
||||
|
||||
/** (Service side only) Count of INTRODUCE2 cells accepted from this
|
||||
* intro point.
|
||||
*/
|
||||
int accepted_introduce2_count;
|
||||
|
||||
/** (Service side only) Maximum number of INTRODUCE2 cells that this IP
|
||||
* will accept. This is a random value between
|
||||
* INTRO_POINT_MIN_LIFETIME_INTRODUCTIONS and
|
||||
* INTRO_POINT_MAX_LIFETIME_INTRODUCTIONS. */
|
||||
int max_introductions;
|
||||
|
||||
/** (Service side only) The time at which this intro point was first
|
||||
* published, or -1 if this intro point has not yet been
|
||||
* published. */
|
||||
time_t time_published;
|
||||
|
||||
/** (Service side only) The time at which this intro point should
|
||||
* (start to) expire, or -1 if we haven't decided when this intro
|
||||
* point should expire. */
|
||||
time_t time_to_expire;
|
||||
|
||||
/** (Service side only) The amount of circuit creation we've made to this
|
||||
* intro point. This is incremented every time we do a circuit relaunch on
|
||||
* this object which is triggered when the circuit dies but the node is
|
||||
* still in the consensus. After MAX_INTRO_POINT_CIRCUIT_RETRIES, we give
|
||||
* up on it. */
|
||||
unsigned int circuit_retries;
|
||||
|
||||
/** (Service side only) Set if this intro point has an established circuit
|
||||
* and unset if it doesn't. */
|
||||
unsigned int circuit_established:1;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "routerparse.h"
|
||||
#include "rendcommon.h"
|
||||
|
||||
#include "rend_intro_point_st.h"
|
||||
#include "rend_service_descriptor_st.h"
|
||||
|
||||
/** Map from service id (as generated by rend_get_service_id) to
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "dir_connection_st.h"
|
||||
#include "entry_connection_st.h"
|
||||
#include "origin_circuit_st.h"
|
||||
#include "rend_intro_point_st.h"
|
||||
#include "rend_service_descriptor_st.h"
|
||||
|
||||
static extend_info_t *rend_client_get_random_intro_impl(
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "cpath_build_state_st.h"
|
||||
#include "crypt_path_st.h"
|
||||
#include "origin_circuit_st.h"
|
||||
#include "rend_intro_point_st.h"
|
||||
#include "rend_service_descriptor_st.h"
|
||||
|
||||
/** Return 0 if one and two are the same service ids, else -1 or 1 */
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "crypt_path_reference_st.h"
|
||||
#include "edge_connection_st.h"
|
||||
#include "origin_circuit_st.h"
|
||||
#include "rend_intro_point_st.h"
|
||||
#include "rend_service_descriptor_st.h"
|
||||
|
||||
struct rend_service_t;
|
||||
|
@ -81,6 +81,7 @@
|
||||
|
||||
#include "dirauth/dirvote.h"
|
||||
|
||||
#include "rend_intro_point_st.h"
|
||||
#include "rend_service_descriptor_st.h"
|
||||
#include "tor_version_st.h"
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "rendcommon.h"
|
||||
#include "rend_test_helpers.h"
|
||||
|
||||
#include "rend_intro_point_st.h"
|
||||
#include "rend_service_descriptor_st.h"
|
||||
|
||||
void
|
||||
|
@ -63,6 +63,7 @@ double fabs(double x);
|
||||
#include "crypto_curve25519.h"
|
||||
|
||||
#include "or_circuit_st.h"
|
||||
#include "rend_intro_point_st.h"
|
||||
#include "rend_service_descriptor_st.h"
|
||||
|
||||
/** Run unit tests for the onion handshake code. */
|
||||
|
@ -21,6 +21,9 @@
|
||||
#include "rendservice.h"
|
||||
#include "routerset.h"
|
||||
#include "circuitbuild.h"
|
||||
|
||||
#include "rend_intro_point_st.h"
|
||||
|
||||
#include "test_helpers.h"
|
||||
|
||||
/* mock ID digest and longname for node that's in nodelist */
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "config.h"
|
||||
#include "hs_common.h"
|
||||
|
||||
#include "rend_intro_point_st.h"
|
||||
#include "rend_service_descriptor_st.h"
|
||||
|
||||
#include "rend_test_helpers.h"
|
||||
|
Loading…
Reference in New Issue
Block a user