summaryrefslogtreecommitdiff
path: root/src/cadet/gnunet-service-cadet-new_connection.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-17 14:20:59 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-17 14:20:59 +0100
commit23c86a4ca5d1cd879550cd07afed4869475fb765 (patch)
treea8eace7b55bcbf3545e1590c7868f52b6b6dfeb4 /src/cadet/gnunet-service-cadet-new_connection.c
parent500842f42c4e51c4c5fc3c1cdfc1c1f7166b2d0d (diff)
downloadgnunet-23c86a4ca5d1cd879550cd07afed4869475fb765.tar.gz
gnunet-23c86a4ca5d1cd879550cd07afed4869475fb765.zip
importing KX logic, integrating encryption logic
Diffstat (limited to 'src/cadet/gnunet-service-cadet-new_connection.c')
-rw-r--r--src/cadet/gnunet-service-cadet-new_connection.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/cadet/gnunet-service-cadet-new_connection.c b/src/cadet/gnunet-service-cadet-new_connection.c
index 1f31331a5..6a9c210b8 100644
--- a/src/cadet/gnunet-service-cadet-new_connection.c
+++ b/src/cadet/gnunet-service-cadet-new_connection.c
@@ -21,7 +21,8 @@
21 21
22/** 22/**
23 * @file cadet/gnunet-service-cadet-new_connection.c 23 * @file cadet/gnunet-service-cadet-new_connection.c
24 * @brief 24 * @brief management of CORE-level end-to-end connections; establishes
25 * end-to-end routes and transmits messages along the route
25 * @author Bartlomiej Polot 26 * @author Bartlomiej Polot
26 * @author Christian Grothoff 27 * @author Christian Grothoff
27 */ 28 */
@@ -88,6 +89,11 @@ struct CadetConnection
88 struct CadetPeer *destination; 89 struct CadetPeer *destination;
89 90
90 /** 91 /**
92 * Which tunnel is using this connection?
93 */
94 struct CadetTConnection *ct;
95
96 /**
91 * Path we are using to our destination. 97 * Path we are using to our destination.
92 */ 98 */
93 struct CadetPeerPath *path; 99 struct CadetPeerPath *path;
@@ -231,6 +237,19 @@ GCC_get_h (const struct CadetConnection *cc)
231 237
232 238
233/** 239/**
240 * Return the tunnel associated with this connection.
241 *
242 * @param cc connection to query
243 * @return corresponding entry in the tunnel's connection list
244 */
245struct CadetTConnection *
246GCC_get_ct (struct CadetConnection *cc)
247{
248 return cc->ct;
249}
250
251
252/**
234 * An ACK was received for this connection, process it. 253 * An ACK was received for this connection, process it.
235 * 254 *
236 * @param cc the connection that got the ACK. 255 * @param cc the connection that got the ACK.
@@ -355,6 +374,7 @@ manage_first_hop_mq (void *cls,
355 * 374 *
356 * @param destination where to go 375 * @param destination where to go
357 * @param path which path to take (may not be the full path) 376 * @param path which path to take (may not be the full path)
377 * @param ct tunnel that uses the connection
358 * @param ready_cb function to call when ready to transmit 378 * @param ready_cb function to call when ready to transmit
359 * @param ready_cb_cls closure for @a cb 379 * @param ready_cb_cls closure for @a cb
360 * @return handle to the connection 380 * @return handle to the connection
@@ -362,6 +382,7 @@ manage_first_hop_mq (void *cls,
362struct CadetConnection * 382struct CadetConnection *
363GCC_create (struct CadetPeer *destination, 383GCC_create (struct CadetPeer *destination,
364 struct CadetPeerPath *path, 384 struct CadetPeerPath *path,
385 struct CadetTConnection *ct,
365 GNUNET_SCHEDULER_TaskCallback ready_cb, 386 GNUNET_SCHEDULER_TaskCallback ready_cb,
366 void *ready_cb_cls) 387 void *ready_cb_cls)
367{ 388{
@@ -373,6 +394,7 @@ GCC_create (struct CadetPeer *destination,
373 destination); 394 destination);
374 GNUNET_assert (UINT_MAX > off); 395 GNUNET_assert (UINT_MAX > off);
375 cc = GNUNET_new (struct CadetConnection); 396 cc = GNUNET_new (struct CadetConnection);
397 cc->ct = ct;
376 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, 398 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
377 &cc->cid, 399 &cc->cid,
378 sizeof (cc->cid)); 400 sizeof (cc->cid));