Add func to generate,set,and send rend cookie

svn:r1469
This commit is contained in:
Nick Mathewson 2004-04-03 04:22:22 +00:00
parent 82cde03ddc
commit 3af1191023
2 changed files with 23 additions and 0 deletions

View File

@ -1027,6 +1027,8 @@ void rend_client_desc_fetched(char *query, int success);
int rend_cmp_service_ids(char *one, char *two); int rend_cmp_service_ids(char *one, char *two);
int rend_parse_rendezvous_address(char *address); int rend_parse_rendezvous_address(char *address);
int rend_client_send_establish_rendezvous(circuit_t *circ);
/********************************* rendcommon.c ***************************/ /********************************* rendcommon.c ***************************/
typedef struct rend_service_descriptor_t { typedef struct rend_service_descriptor_t {

View File

@ -12,6 +12,27 @@ rend_client_introcirc_is_ready(connection_t *apconn, circuit_t *circ)
log_fn(LOG_WARN,"introcirc is ready"); 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 */ /* send the rendezvous cell */
void void
rend_client_rendcirc_is_ready(connection_t *apconn, circuit_t *circ) rend_client_rendcirc_is_ready(connection_t *apconn, circuit_t *circ)