[or-cvs] Add func to generate,set,and send rend cookie

Nick Mathewson nickm at seul.org
Sat Apr 3 04:22:24 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv27475/src/or

Modified Files:
	or.h rendclient.c 
Log Message:
Add func to generate,set,and send rend cookie 

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.293
retrieving revision 1.294
diff -u -d -r1.293 -r1.294
--- or.h	3 Apr 2004 04:05:12 -0000	1.293
+++ or.h	3 Apr 2004 04:22:22 -0000	1.294
@@ -1027,6 +1027,8 @@
 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 {

Index: rendclient.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendclient.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- rendclient.c	3 Apr 2004 03:06:06 -0000	1.6
+++ rendclient.c	3 Apr 2004 04:22:22 -0000	1.7
@@ -12,6 +12,27 @@
   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)



More information about the tor-commits mailing list