aboutsummaryrefslogtreecommitdiff
path: root/src/or/or.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-07-26 19:05:41 +0000
committerNick Mathewson <nickm@torproject.org>2006-07-26 19:05:41 +0000
commite61d28dfb8f2936b8024f1cb4d3ad8ecf1cd25b5 (patch)
treee5e1a34aa6f63717ddcb75087bd1ec8f93939ce5 /src/or/or.h
parenta88ec48a39e5531fa80a0b5d5ec42dd31f268b67 (diff)
downloadtor-e61d28dfb8f2936b8024f1cb4d3ad8ecf1cd25b5.tar
tor-e61d28dfb8f2936b8024f1cb4d3ad8ecf1cd25b5.tar.gz
r6903@Kushana: nickm | 2006-07-25 18:22:48 -0400
No circuit can be both an intro point and a rend point, so we can merge both the cookie and the pk digest into one "rend_token" field for or circuits. This saves another 20 bytes per or circuit. svn:r6904
Diffstat (limited to 'src/or/or.h')
-rw-r--r--src/or/or.h35
1 files changed, 24 insertions, 11 deletions
diff --git a/src/or/or.h b/src/or/or.h
index d70039eea..2f49e8c1f 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1110,16 +1110,6 @@ typedef struct circuit_t {
const char *marked_for_close_file; /**< For debugging: in which file was this
* circuit marked for close? */
- /** The rend_pk_digest field holds a hash of location-hidden service's
- * PK if purpose is INTRO_POINT or S_ESTABLISH_INTRO or S_RENDEZVOUSING.
- */
- char rend_pk_digest[DIGEST_LEN];
-
- /** Holds rendezvous cookie if purpose is REND_POINT_WAITING or
- * C_ESTABLISH_REND. Filled with zeroes otherwise.
- */
- char rend_cookie[REND_COOKIE_LEN];
-
/** Quasi-global identifier for this circuit; used for control.c */
/* XXXX NM This can get re-used after 2**32 circuits. */
uint32_t global_identifier;
@@ -1148,6 +1138,16 @@ typedef struct origin_circuit_t {
*/
crypt_path_t *cpath;
+ /** The rend_pk_digest field holds a hash of location-hidden service's
+ * PK if purpose is S_ESTABLISH_INTRO or S_RENDEZVOUSING.
+ */
+ char rend_pk_digest[DIGEST_LEN];
+
+ /** Holds rendezvous cookie if purpose is C_ESTABLISH_REND. Filled with
+ * zeroes otherwise.
+ */
+ char rend_cookie[REND_COOKIE_LEN];
+
/**
* The rend_query field holds the y portion of y.onion (nul-terminated)
* if purpose is C_INTRODUCING or C_ESTABLISH_REND, or is a C_GENERAL
@@ -1189,6 +1189,18 @@ typedef struct or_circuit_t {
* is not marked for close. */
struct or_circuit_t *rend_splice;
+#if REND_COOKIE_LEN >= DIGEST_LEN
+#define REND_TOKEN_LEN REND_COOKIE_LEN
+#else
+#define REND_TOKEN_LEN DIGEST_LEN
+#endif
+
+ /** A hash of location-hidden service's PK if purpose is INTRO_POINT, or a
+ * rendezvous cookie if purpose is REND_POINT_WAITING or
+ * C_ESTABLISH_REND. Filled with zeroes otherwise.
+ */
+ char rend_token[REND_TOKEN_LEN];
+
char handshake_digest[DIGEST_LEN]; /**< Stores KH for intermediate hops. */
} or_circuit_t;
@@ -1594,9 +1606,10 @@ void circuit_unlink_all_from_or_conn(connection_t *conn, int reason);
circuit_t *circuit_get_by_global_id(uint32_t id);
origin_circuit_t *circuit_get_by_rend_query_and_purpose(const char *rend_query,
uint8_t purpose);
-circuit_t *circuit_get_next_by_pk_and_purpose(circuit_t *start,
+origin_circuit_t *circuit_get_next_by_pk_and_purpose(origin_circuit_t *start,
const char *digest, uint8_t purpose);
or_circuit_t *circuit_get_rendezvous(const char *cookie);
+or_circuit_t *circuit_get_intro_point(const char *digest);
origin_circuit_t *circuit_find_to_cannibalize(uint8_t purpose,
extend_info_t *info,
int need_uptime,