*/
struct MeshPeer;
+#include "gnunet-service-mesh_connection.h"
+
/**
* Callback called when a queued message is sent.
*
* @param cls Closure.
* @param c Connection this message was on.
+ * @param type Type of message sent.
+ * @param fwd Was this a FWD going message?
+ * @param size Size of the message.
* @param wait Time spent waiting for core (only the time for THIS message)
*/
typedef void (*GMP_sent) (void *cls,
- struct MeshConnection *c,
+ struct MeshConnection *c, uint16_t type,
+ int fwd, size_t size,
struct GNUNET_TIME_Relative wait);
-#include "gnunet-service-mesh_connection.h"
-
-
/******************************************************************************/
/******************************** API ***********************************/
/******************************************************************************/
struct MeshPeer *
GMP_get_short (const GNUNET_PEER_Id peer);
+/**
+ * Try to establish a new connection to this peer (in its tunnel).
+ * If the peer doesn't have any path to it yet, try to get one.
+ * If the peer already has some path, send a CREATE CONNECTION towards it.
+ *
+ * @param peer Peer to connect to.
+ */
+void
+GMP_connect (struct MeshPeer *peer);
+
/**
* @brief Queue and pass message to core when possible.
*
+ * @param peer Peer towards which to queue the message.
* @param cls Closure (@c type dependant). It will be used by queue_send to
* build the message to be sent if not already prebuilt.
* @param type Type of the message, 0 for a raw message.
* @param c Connection this message belongs to (cannot be NULL).
* @param ch Channel this message belongs to, if applicable (otherwise NULL).
* @param fwd Is this a message going root->dest? (FWD ACK are NOT FWD!)
- * @param callback Function to be called once CORE has taken the message.
- * @param callback_cls Closure for @c callback.
+ * @param cont Continuation to be called once CORE has taken the message.
+ * @param cont_cls Closure for @c cont.
*/
void
-GMP_queue_add (void *cls, uint16_t type, size_t size,
- struct MeshConnection *c,
- struct MeshChannel *ch,
- int fwd,
- GMP_sent callback, void *callback_cls);
+GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type, size_t size,
+ struct MeshConnection *c, struct MeshChannel *ch, int fwd,
+ GMP_sent cont, void *cont_cls);
/**
* Cancel all queued messages to a peer that belong to a certain connection.
* @return GNUNET_OK on success.
*/
int
-GMP_add_connection (struct MeshPeer *peer, const struct MeshConnection *c);
+GMP_add_connection (struct MeshPeer *peer, struct MeshConnection *c);
/**
* Add the path to the peer and update the path used to reach it in case this
* @param confirmed Whether we know if the path works or not.
*/
void
-GMP_add_path_to_all (struct MeshPeerPath *p, int confirmed);
+GMP_add_path_to_all (const struct MeshPeerPath *p, int confirmed);
/**
* Remove a connection from a neighboring peer.
int
GMP_remove_connection (struct MeshPeer *peer, const struct MeshConnection *c);
+/**
+ * Start the DHT search for new paths towards the peer: we don't have
+ * enough good connections.
+ *
+ * @param peer Destination peer.
+ */
void
GMP_start_search (struct MeshPeer *peer);
+/**
+ * Stop the DHT search for new paths towards the peer: we already have
+ * enough good connections.
+ *
+ * @param peer Destination peer.
+ */
void
GMP_stop_search (struct MeshPeer *peer);
GNUNET_PEER_Id
GMP_get_short_id (const struct MeshPeer *peer);
+/**
+ * Get the tunnel towards a peer.
+ *
+ * @param peer Peer to get from.
+ *
+ * @return Tunnel towards peer.
+ */
+struct MeshTunnel3 *
+GMP_get_tunnel (const struct MeshPeer *peer);
+
/**
* Get the static string for a peer ID.
*