aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/gnunet-service-cadet-new_core.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-20 10:08:07 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-20 10:08:07 +0100
commit7d96a8234bbd9d9a4dc431c52d92ebb604084c70 (patch)
treed2162b1006202ed154bf128293b9ec54fc38ac5e /src/cadet/gnunet-service-cadet-new_core.c
parentaedd5919e802370061850486c96da72b25df7f22 (diff)
downloadgnunet-7d96a8234bbd9d9a4dc431c52d92ebb604084c70.tar.gz
gnunet-7d96a8234bbd9d9a4dc431c52d92ebb604084c70.zip
more work on channel/tunnel logic
Diffstat (limited to 'src/cadet/gnunet-service-cadet-new_core.c')
-rw-r--r--src/cadet/gnunet-service-cadet-new_core.c79
1 files changed, 2 insertions, 77 deletions
diff --git a/src/cadet/gnunet-service-cadet-new_core.c b/src/cadet/gnunet-service-cadet-new_core.c
index 9ce4418de..a5d114b34 100644
--- a/src/cadet/gnunet-service-cadet-new_core.c
+++ b/src/cadet/gnunet-service-cadet-new_core.c
@@ -27,10 +27,7 @@
27 * All functions in this file should use the prefix GCO (Gnunet Cadet cOre (bottom)) 27 * All functions in this file should use the prefix GCO (Gnunet Cadet cOre (bottom))
28 * 28 *
29 * TODO: 29 * TODO:
30 * - pass encrypted ACK to connection (!) 30 * - Optimization: given BROKEN messages, destroy paths (?)
31 * - given BROKEN messages, destroy paths (?)
32 * -
33 * - handle POLL (if needed)
34 */ 31 */
35#include "platform.h" 32#include "platform.h"
36#include "gnunet-service-cadet-new_core.h" 33#include "gnunet-service-cadet-new_core.h"
@@ -422,8 +419,7 @@ handle_connection_create (void *cls,
422 &msg->cid.connection_of_tunnel); 419 &msg->cid.connection_of_tunnel);
423 if (NULL != cc) 420 if (NULL != cc)
424 { 421 {
425 /* Duplicate CREATE, likely our ACK got lost, retransmit the ACK! */ 422 GCC_handle_duplicate_create (cc);
426 GNUNET_break (0); // FIXME: not implemented!
427 return; 423 return;
428 } 424 }
429 425
@@ -604,68 +600,6 @@ handle_connection_destroy (void *cls,
604 600
605 601
606/** 602/**
607 * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_HOP_BY_HOP_ENCRYPTED_ACK.
608 *
609 * @param cls Closure (CadetPeer for neighbor that sent the message).
610 * @param msg Message itself.
611 */
612static void
613handle_hop_by_hop_encrypted_ack (void *cls,
614 const struct GNUNET_CADET_ConnectionEncryptedAckMessage *msg)
615{
616 struct CadetPeer *peer = cls;
617 struct CadetConnection *cc;
618
619 /* First, check if message belongs to a connection that ends here. */
620 cc = GNUNET_CONTAINER_multishortmap_get (connections,
621 &msg->cid.connection_of_tunnel);
622 if (NULL != cc)
623 {
624 /* verify message came from the right direction */
625 struct CadetPeerPath *path = GCC_get_path (cc);
626
627 if (peer !=
628 GCPP_get_peer_at_offset (path,
629 0))
630 {
631 /* received message from unexpected direction, ignore! */
632 GNUNET_break_op (0);
633 return;
634 }
635#if FIXME
636 GCC_handle_ack (peer,
637 msg);
638#endif
639 return;
640 }
641
642 /* We're just an intermediary peer, route the message along its path */
643 route_message (peer,
644 &msg->cid,
645 &msg->header);
646}
647
648
649/**
650 * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL
651 *
652 * @param cls Closure (CadetPeer for neighbor that sent the message).
653 * @param msg Message itself.
654 */
655static void
656handle_poll (void *cls,
657 const struct GNUNET_CADET_ConnectionHopByHopPollMessage *msg)
658{
659 struct CadetPeer *peer = cls;
660
661#if FIXME
662 GCC_handle_poll (peer,
663 msg);
664#endif
665}
666
667
668/**
669 * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX 603 * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX
670 * 604 *
671 * @param cls Closure (CadetPeer for neighbor that sent the message). 605 * @param cls Closure (CadetPeer for neighbor that sent the message).
@@ -755,7 +689,6 @@ handle_tunnel_encrypted (void *cls,
755 msg); 689 msg);
756 return; 690 return;
757 } 691 }
758
759 /* We're just an intermediary peer, route the message along its path */ 692 /* We're just an intermediary peer, route the message along its path */
760 route_message (peer, 693 route_message (peer,
761 &msg->cid, 694 &msg->cid,
@@ -855,14 +788,6 @@ GCO_init (const struct GNUNET_CONFIGURATION_Handle *c)
855 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 788 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY,
856 struct GNUNET_CADET_ConnectionDestroyMessage, 789 struct GNUNET_CADET_ConnectionDestroyMessage,
857 NULL), 790 NULL),
858 GNUNET_MQ_hd_fixed_size (hop_by_hop_encrypted_ack,
859 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK,
860 struct GNUNET_CADET_ConnectionEncryptedAckMessage,
861 NULL),
862 GNUNET_MQ_hd_fixed_size (poll,
863 GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL,
864 struct GNUNET_CADET_ConnectionHopByHopPollMessage,
865 NULL),
866 GNUNET_MQ_hd_fixed_size (tunnel_kx, 791 GNUNET_MQ_hd_fixed_size (tunnel_kx,
867 GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX, 792 GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX,
868 struct GNUNET_CADET_TunnelKeyExchangeMessage, 793 struct GNUNET_CADET_TunnelKeyExchangeMessage,