#include "platform.h"
#include "gnunet_util_lib.h"
-#include "mesh_protocol_enc.h"
-#include "mesh_enc.h"
+#include "mesh_protocol.h"
+#include "mesh.h"
/**
* Struct containing all information regarding a channel to a remote client.
/**
- * Get channel ID.
+ * Destroy a channel and free all resources.
+ *
+ * @param ch Channel to destroy.
+ */
+void
+GMCH_destroy (struct MeshChannel *ch);
+
+
+/**
+ * Get the channel's public ID.
*
* @param ch Channel.
*
- * @return ID
+ * @return ID used to identify the channel with the remote peer.
*/
MESH_ChannelNumber
GMCH_get_id (const struct MeshChannel *ch);
int
GMCH_is_terminal (struct MeshChannel *ch, int fwd);
-/**
- * Send data on a channel.
- *
- * If the destination is local, send it to client, otherwise encrypt and
- * send to next hop.
- *
- * @param ch Channel
- * @param msg Message.
- * @param fwd Is this a fwd (root->dest) message?
- */
-void
-GMCH_send_data (struct MeshChannel *ch,
- const struct GNUNET_MESH_Data *msg,
- int fwd);
-
/**
* Send an end-to-end ACK message for the most recent in-sequence payload.
*
void
GMCH_send_create (struct MeshChannel *ch);
-/**
- * Notify a client that the channel is no longer valid.
- *
- * @param ch Channel that is destroyed.
- */
-void
-GMCH_send_destroy (struct MeshChannel *ch);
-
/**
* Allow a client to send us more data, in case it was choked.
*
*
* @param ch Channel.
* @param c Client that requested the destruction (to avoid notifying him).
+ * @param is_root Is the request coming from root?
*/
void
GMCH_handle_local_destroy (struct MeshChannel *ch,
- struct MeshClient *c);
+ struct MeshClient *c,
+ int is_root);
/**
* Handle a channel create requested by a client.
GMCH_handle_create (struct MeshTunnel3 *t,
const struct GNUNET_MESH_ChannelCreate *msg);
+/**
+ * Handler for channel NACK messages.
+ *
+ * NACK messages always go dest -> root, no need for 'fwd' or 'msg' parameter.
+ *
+ * @param ch Channel.
+ */
+void
+GMCH_handle_nack (struct MeshChannel *ch);
+
/**
* Handler for channel ack messages.
*
* On a normal channel passes the message to the tunnel for encryption and
* sending on a connection.
*
+ * This function DOES NOT save the message for retransmission.
+ *
* @param message Message to send. Function makes a copy of it.
* @param ch Channel on which this message is transmitted.
* @param fwd Is this a fwd message?
+ * @param existing_copy This is a retransmission, don't save a copy.
*/
void
GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
- struct MeshChannel *ch, int fwd);
+ struct MeshChannel *ch, int fwd,
+ void *existing_copy);
/**
* Get the static string for identification of the channel.
*
- * @param ch Channel.
+ * @param ch Channel.i
*
* @return Static string with the channel IDs.
*/