aboutsummaryrefslogtreecommitdiff
path: root/src/or/hs_cell.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-07-21 13:57:10 -0400
committerDavid Goulet <dgoulet@torproject.org>2017-08-24 13:03:28 -0400
commitb91693f7c3099c691d0e5dbb60ac55df14b7bd68 (patch)
tree9bdff12a287841022fe79830276c8c6a087fd38f /src/or/hs_cell.c
parent6eb125d14bf69e9dad427fe4b1005477177acc04 (diff)
downloadtor-b91693f7c3099c691d0e5dbb60ac55df14b7bd68.tar.gz
tor-b91693f7c3099c691d0e5dbb60ac55df14b7bd68.zip
prop224: Build ESTABLISH_RENDEZVOUS cell and logic
Add a function to build the cell. Add a the logic to send the cell when the rendezvous circuit opens. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/hs_cell.c')
-rw-r--r--src/or/hs_cell.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/or/hs_cell.c b/src/or/hs_cell.c
index 889cf7749b..64e164c061 100644
--- a/src/or/hs_cell.c
+++ b/src/or/hs_cell.c
@@ -847,3 +847,20 @@ hs_cell_build_introduce1(const hs_cell_introduce1_data_t *data,
return cell_len;
}
+/* Build an ESTABLISH_RENDEZVOUS cell from the given rendezvous_cookie. The
+ * encoded cell is put in cell_out which must be of at least
+ * RELAY_PAYLOAD_SIZE. On success, the encoded length is returned and the
+ * caller should clear up the content of the cell.
+ *
+ * This function can't fail. */
+ssize_t
+hs_cell_build_establish_rendezvous(const uint8_t *rendezvous_cookie,
+ uint8_t *cell_out)
+{
+ tor_assert(rendezvous_cookie);
+ tor_assert(cell_out);
+
+ memcpy(cell_out, rendezvous_cookie, HS_REND_COOKIE_LEN);
+ return HS_REND_COOKIE_LEN;
+}
+