[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Extract rend_intro_point_t into its own header.



commit 990184da4976f98365ca7d98762e91a66f1d3009
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Fri Jun 15 12:23:06 2018 -0400

    Extract rend_intro_point_t into its own header.
---
 src/or/include.am            |  1 +
 src/or/or.h                  | 64 +-------------------------------------
 src/or/rend_intro_point_st.h | 74 ++++++++++++++++++++++++++++++++++++++++++++
 src/or/rendcache.c           |  1 +
 src/or/rendclient.c          |  1 +
 src/or/rendcommon.c          |  1 +
 src/or/rendservice.c         |  1 +
 src/or/routerparse.c         |  1 +
 src/test/rend_test_helpers.c |  1 +
 src/test/test.c              |  1 +
 src/test/test_hs.c           |  3 ++
 src/test/test_rendcache.c    |  1 +
 12 files changed, 87 insertions(+), 63 deletions(-)

diff --git a/src/or/include.am b/src/or/include.am
index 883366fc1..ede01c79e 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -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				\
diff --git a/src/or/or.h b/src/or/or.h
index e66bad5ab..41953806a 100644
--- a/src/or/or.h
+++ b/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 ***************************/
diff --git a/src/or/rend_intro_point_st.h b/src/or/rend_intro_point_st.h
new file mode 100644
index 000000000..934b6ea82
--- /dev/null
+++ b/src/or/rend_intro_point_st.h
@@ -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
+
diff --git a/src/or/rendcache.c b/src/or/rendcache.c
index 6dd49ee9c..093cbe7ce 100644
--- a/src/or/rendcache.c
+++ b/src/or/rendcache.c
@@ -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
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 1d12e1829..a48f83fa9 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -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(
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index b2d4b0949..2494311cb 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -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 */
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index e27e8c4fb..d82ea4789 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -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;
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index af11bc3d5..20a6f85a4 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -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"
 
diff --git a/src/test/rend_test_helpers.c b/src/test/rend_test_helpers.c
index 177935edf..fb2e4cf50 100644
--- a/src/test/rend_test_helpers.c
+++ b/src/test/rend_test_helpers.c
@@ -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
diff --git a/src/test/test.c b/src/test/test.c
index 040861560..4476319a4 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -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. */
diff --git a/src/test/test_hs.c b/src/test/test_hs.c
index 64448de51..0505285f3 100644
--- a/src/test/test_hs.c
+++ b/src/test/test_hs.c
@@ -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 */
diff --git a/src/test/test_rendcache.c b/src/test/test_rendcache.c
index f1e94eb02..b4b76df88 100644
--- a/src/test/test_rendcache.c
+++ b/src/test/test_rendcache.c
@@ -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"



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits