Merge branch 'tor-github/pr/415' into maint-0.3.5
[tor.git] / src / feature / rend / rend_intro_point_st.h
blob89fe5ef2b36960c89efeae22061a64de61e5a70e
1 /* Copyright (c) 2001 Matej Pfajfar.
2 * Copyright (c) 2001-2004, Roger Dingledine.
3 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4 * Copyright (c) 2007-2018, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
7 #ifndef REND_INTRO_POINT_ST_H
8 #define REND_INTRO_POINT_ST_H
10 struct replaycache_t;
11 struct crypto_pk_t;
13 /** Introduction point information. Used both in rend_service_t (on
14 * the service side) and in rend_service_descriptor_t (on both the
15 * client and service side). */
16 struct rend_intro_point_t {
17 extend_info_t *extend_info; /**< Extend info for connecting to this
18 * introduction point via a multi-hop path. */
19 struct crypto_pk_t *intro_key; /**< Introduction key that replaces the
20 * service key, if this descriptor is V2. */
22 /** (Client side only) Flag indicating that a timeout has occurred
23 * after sending an INTRODUCE cell to this intro point. After a
24 * timeout, an intro point should not be tried again during the same
25 * hidden service connection attempt, but it may be tried again
26 * during a future connection attempt. */
27 unsigned int timed_out : 1;
29 /** (Client side only) The number of times we have failed to build a
30 * circuit to this intro point for some reason other than our
31 * circuit-build timeout. See also MAX_INTRO_POINT_REACHABILITY_FAILURES. */
32 unsigned int unreachable_count : 3;
34 /** (Service side only) Flag indicating that this intro point was
35 * included in the last HS descriptor we generated. */
36 unsigned int listed_in_last_desc : 1;
38 /** (Service side only) A replay cache recording the RSA-encrypted parts
39 * of INTRODUCE2 cells this intro point's circuit has received. This is
40 * used to prevent replay attacks. */
41 struct replaycache_t *accepted_intro_rsa_parts;
43 /** (Service side only) Count of INTRODUCE2 cells accepted from this
44 * intro point.
46 int accepted_introduce2_count;
48 /** (Service side only) Maximum number of INTRODUCE2 cells that this IP
49 * will accept. This is a random value between
50 * INTRO_POINT_MIN_LIFETIME_INTRODUCTIONS and
51 * INTRO_POINT_MAX_LIFETIME_INTRODUCTIONS. */
52 int max_introductions;
54 /** (Service side only) The time at which this intro point was first
55 * published, or -1 if this intro point has not yet been
56 * published. */
57 time_t time_published;
59 /** (Service side only) The time at which this intro point should
60 * (start to) expire, or -1 if we haven't decided when this intro
61 * point should expire. */
62 time_t time_to_expire;
64 /** (Service side only) The amount of circuit creation we've made to this
65 * intro point. This is incremented every time we do a circuit relaunch on
66 * this object which is triggered when the circuit dies but the node is
67 * still in the consensus. After MAX_INTRO_POINT_CIRCUIT_RETRIES, we give
68 * up on it. */
69 unsigned int circuit_retries;
71 /** (Service side only) Set if this intro point has an established circuit
72 * and unset if it doesn't. */
73 unsigned int circuit_established:1;
76 #endif