* All functions in this file should use the prefix GCO (Gnunet Cadet cOre (bottom))
*
* TODO:
- * - pass encrypted ACK to connection (!)
- * - given BROKEN messages, destroy paths (?)
- * -
- * - handle POLL (if needed)
+ * - Optimization: given BROKEN messages, destroy paths (?)
*/
#include "platform.h"
#include "gnunet-service-cadet-new_core.h"
#include "gnunet_core_service.h"
#include "cadet_protocol.h"
+
+#define LOG(level, ...) GNUNET_log_from(level,"cadet-cor",__VA_ARGS__)
+
+
/**
* Number of messages we are willing to buffer per route.
*/
&msg->cid.connection_of_tunnel);
if (NULL != cc)
{
- /* Duplicate CREATE, likely our ACK got lost, retransmit the ACK! */
- GNUNET_break (0); // FIXME: not implemented!
+ GCC_handle_duplicate_create (cc);
return;
}
- path = GCPP_get_path_from_route (path_length,
+ path = GCPP_get_path_from_route (path_length - 1,
pids);
origin = GCP_get (&pids[0],
GNUNET_YES);
*/
static void
handle_connection_create_ack (void *cls,
- const struct GNUNET_CADET_ConnectionCreateMessageAckMessage *msg)
+ const struct GNUNET_CADET_ConnectionCreateAckMessage *msg)
{
struct CadetPeer *peer = cls;
struct CadetConnection *cc;
GNUNET_break_op (0);
return;
}
- GCC_handle_connection_ack (cc);
+ GCC_handle_connection_create_ack (cc);
return;
}
}
-/**
- * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_HOP_BY_HOP_ENCRYPTED_ACK.
- *
- * @param cls Closure (CadetPeer for neighbor that sent the message).
- * @param msg Message itself.
- */
-static void
-handle_hop_by_hop_encrypted_ack (void *cls,
- const struct GNUNET_CADET_ConnectionEncryptedAckMessage *msg)
-{
- struct CadetPeer *peer = cls;
- struct CadetConnection *cc;
-
- /* First, check if message belongs to a connection that ends here. */
- cc = GNUNET_CONTAINER_multishortmap_get (connections,
- &msg->cid.connection_of_tunnel);
- if (NULL != cc)
- {
- /* verify message came from the right direction */
- struct CadetPeerPath *path = GCC_get_path (cc);
-
- if (peer !=
- GCPP_get_peer_at_offset (path,
- 0))
- {
- /* received message from unexpected direction, ignore! */
- GNUNET_break_op (0);
- return;
- }
-#if FIXME
- GCC_handle_ack (peer,
- msg);
-#endif
- return;
- }
-
- /* We're just an intermediary peer, route the message along its path */
- route_message (peer,
- &msg->cid,
- &msg->header);
-}
-
-
-/**
- * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL
- *
- * @param cls Closure (CadetPeer for neighbor that sent the message).
- * @param msg Message itself.
- */
-static void
-handle_poll (void *cls,
- const struct GNUNET_CADET_ConnectionHopByHopPollMessage *msg)
-{
- struct CadetPeer *peer = cls;
-
-#if FIXME
- GCC_handle_poll (peer,
- msg);
-#endif
-}
-
-
/**
* Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX
*
msg);
return;
}
-
/* We're just an intermediary peer, route the message along its path */
route_message (peer,
&msg->cid,
NULL),
GNUNET_MQ_hd_fixed_size (connection_create_ack,
GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK,
- struct GNUNET_CADET_ConnectionCreateMessageAckMessage,
+ struct GNUNET_CADET_ConnectionCreateAckMessage,
NULL),
GNUNET_MQ_hd_fixed_size (connection_broken,
GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN,
GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY,
struct GNUNET_CADET_ConnectionDestroyMessage,
NULL),
- GNUNET_MQ_hd_fixed_size (hop_by_hop_encrypted_ack,
- GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK,
- struct GNUNET_CADET_ConnectionEncryptedAckMessage,
- NULL),
- GNUNET_MQ_hd_fixed_size (poll,
- GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL,
- struct GNUNET_CADET_ConnectionHopByHopPollMessage,
- NULL),
GNUNET_MQ_hd_fixed_size (tunnel_kx,
GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX,
struct GNUNET_CADET_TunnelKeyExchangeMessage,