*/
struct MeshPeer;
+/**
+ * Struct containing info about a queued transmission to this peer
+ */
+struct MeshPeerQueue;
+
#include "gnunet-service-mesh_connection.h"
/**
void
GMP_connect (struct MeshPeer *peer);
+/**
+ * Free a transmission that was already queued with all resources
+ * associated to the request.
+ *
+ * @param queue Queue handler to cancel.
+ * @param clear_cls Is it necessary to free associated cls?
+ */
+void
+GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls);
+
/**
* @brief Queue and pass message to core when possible.
*
* @param type Type of the message, 0 for a raw message.
* @param size Size of the 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 cont Continuation to be called once CORE has taken the message.
* @param cont_cls Closure for @c cont.
+ *
+ * @return Handle to cancel the message before it is sent. Once cont is called
+ * message has been sent and therefore the handle is no longer valid.
*/
-void
+struct MeshPeerQueue *
GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type, size_t size,
- struct MeshConnection *c, struct MeshChannel *ch, int fwd,
+ struct MeshConnection *c, int fwd,
GMP_sent cont, void *cont_cls);
/**
*
* @param peer Peer to check.
*
- * @return GNUNET_YES if there is a direct connection.
+ * @return #GNUNET_YES if there is a direct connection.
*/
int
GMP_is_neighbor (const struct MeshPeer *peer);
* Add the path to the peer and update the path used to reach it in case this
* is the shortest.
*
- * @param peer_info Destination peer to add the path to.
+ * @param peer Destination peer to add the path to.
* @param path New path to add. Last peer must be the peer in arg 1.
* Path will be either used of freed if already known.
* @param trusted Do we trust that this path is real?
+ *
+ * @return path if path was taken, pointer to existing duplicate if exists
+ * NULL on error.
*/
-void
+struct MeshPeerPath *
GMP_add_path (struct MeshPeer *peer, struct MeshPeerPath *p, int trusted);
/**
* @param path New path to add after being inversed.
* Path will be either used or freed.
* @param trusted Do we trust that this path is real?
+ *
+ * @return path if path was taken, pointer to existing duplicate if exists
+ * NULL on error.
*/
-void
+struct MeshPeerPath *
GMP_add_path_to_origin (struct MeshPeer *peer,
struct MeshPeerPath *path,
int trusted);
void
GMP_add_path_to_all (const struct MeshPeerPath *p, int confirmed);
+/**
+ * Remove any path to the peer that has the extact same peers as the one given.
+ *
+ * @param peer Peer to remove the path from.
+ * @param path Path to remove. Is always destroyed .
+ */
+void
+GMP_remove_path (struct MeshPeer *peer, struct MeshPeerPath *path);
+
/**
* Remove a connection from a neighboring peer.
*
struct MeshTunnel3 *
GMP_get_tunnel (const struct MeshPeer *peer);
+/**
+ * Set the hello message.
+ *
+ * @param peer Peer whose message to set.
+ * @param hello Hello message.
+ */
+void
+GMP_set_hello (struct MeshPeer *peer, const struct GNUNET_HELLO_Message *hello);
+
+/**
+ * Get the hello message.
+ *
+ * @param peer Peer whose message to get.
+ *
+ * @return Hello message.
+ */
+struct GNUNET_HELLO_Message *
+GMP_get_hello (struct MeshPeer *peer);
+
+
+/**
+ * Try to connect to a peer on TRANSPORT level.
+ *
+ * @param peer Peer to whom to connect.
+ */
+void
+GMP_try_connect (struct MeshPeer *peer);
+
+/**
+ * Count the number of known paths toward the peer.
+ *
+ * @param peer Peer to get path info.
+ *
+ * @return Number of known paths.
+ */
+unsigned int
+GMP_count_paths (const struct MeshPeer *peer);
+
+/**
+ * Iterate all known peers.
+ *
+ * @param iter Iterator.
+ * @param cls Closure for @c iter.
+ */
+void
+GMP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls);
+
/**
* Get the static string for a peer ID.
*