diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-04-03 04:22:22 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-04-03 04:22:22 +0000 |
commit | 3af1191023a0e81dd727afd48396cf9cf7dd5672 (patch) | |
tree | 61ef7414a474aa9459c0538e39dbfb1cb9d7da17 /src | |
parent | 82cde03ddc2c28bfbca9d5dcc5ba6ba2f646066e (diff) | |
download | tor-3af1191023a0e81dd727afd48396cf9cf7dd5672.tar.gz tor-3af1191023a0e81dd727afd48396cf9cf7dd5672.zip |
Add func to generate,set,and send rend cookie
svn:r1469
Diffstat (limited to 'src')
-rw-r--r-- | src/or/or.h | 2 | ||||
-rw-r--r-- | src/or/rendclient.c | 21 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/or/or.h b/src/or/or.h index 692c155a00..ed82140344 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1027,6 +1027,8 @@ void rend_client_desc_fetched(char *query, int success); int rend_cmp_service_ids(char *one, char *two); int rend_parse_rendezvous_address(char *address); +int rend_client_send_establish_rendezvous(circuit_t *circ); + /********************************* rendcommon.c ***************************/ typedef struct rend_service_descriptor_t { diff --git a/src/or/rendclient.c b/src/or/rendclient.c index afaa4e2948..32b3b82541 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -12,6 +12,27 @@ rend_client_introcirc_is_ready(connection_t *apconn, circuit_t *circ) log_fn(LOG_WARN,"introcirc is ready"); } +int +rend_client_send_establish_rendezvous(circuit_t *circ) +{ + assert(circ->purpose == CIRCUIT_PURPOSE_C_ESTABLISH_REND); + log_fn(LOG_INFO, "Sending an ESTABLISH_RENDEZVOUS cell"); + + if (crypto_rand(REND_COOKIE_LEN, circ->rend_cookie)<0) { + log_fn(LOG_WARN, "Couldn't get random cookie"); + return -1; + } + if (connection_edge_send_command(NULL,circ, + RELAY_COMMAND_ESTABLISH_RENDEZVOUS, + circ->rend_cookie, REND_COOKIE_LEN, + circ->cpath->prev)<0) { + log_fn(LOG_WARN, "Couldn't send ESTABLISH_RENDEZVOUS cell"); + return -1; + } + + return 0; +} + /* send the rendezvous cell */ void rend_client_rendcirc_is_ready(connection_t *apconn, circuit_t *circ) |