]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Ticket 40872: Add conflux helper functions for control port info
authorMike Perry <mikeperry-git@torproject.org>
Thu, 21 Nov 2024 17:06:26 +0000 (17:06 +0000)
committerMike Perry <mikeperry-git@torproject.org>
Mon, 3 Mar 2025 16:37:01 +0000 (16:37 +0000)
src/core/or/conflux_util.c
src/core/or/conflux_util.h

index 4277424ec8b4d9f41448e7a0c609e0d45cedbc22..935c6d2f7da4d695cd7537aeefdddda0c3512ba8 100644 (file)
@@ -442,3 +442,30 @@ conflux_validate_legs(const conflux_t *cfx)
     conflux_log_set(LOG_PROTOCOL_WARN, cfx, is_client);
   }
 }
+
+/** Return the nonce for a circuit, for use on the control port */
+const uint8_t *
+conflux_get_nonce(const circuit_t *circ)
+{
+  if (circ->conflux_pending_nonce) {
+    return circ->conflux_pending_nonce;
+  } else if (circ->conflux) {
+    return circ->conflux->nonce;
+  } else {
+    return NULL;
+  }
+}
+
+/** Return the conflux RTT for a circuit, for use on the control port */
+uint64_t
+conflux_get_circ_rtt(const circuit_t *circ)
+{
+  if (circ->conflux) {
+    conflux_leg_t *leg = conflux_get_leg(circ->conflux, circ);
+    tor_assert(leg);
+    return leg->circ_rtts_usec;
+  } else {
+    return 0;
+  }
+}
+
index c556ae184857ebf0b5f511c8b32674ba2f2d8da3..501ce61d82e88bc31a997be8521f9cbe3446e02d 100644 (file)
@@ -34,6 +34,9 @@ CIRCUIT_IS_CONFLUX(const circuit_t *circ)
   }
 }
 
+const uint8_t *conflux_get_nonce(const circuit_t *circ);
+uint64_t conflux_get_circ_rtt(const circuit_t *circ);
+
 int circuit_get_package_window(circuit_t *circ,
                                const crypt_path_t *cpath);
 bool conflux_can_send(conflux_t *cfx);