- begin work on enhanced multipart receiving
[oweals/gnunet.git] / src / mesh / gnunet-service-mesh_channel.h
index c6e051356a5d7504cc6f00acf878b0bd1c3c0c07..504754148c849fa0c4f1a61a7a65d21d9cc79a65 100644 (file)
@@ -53,6 +53,14 @@ struct MeshChannel;
 #include "gnunet-service-mesh_local.h"
 
 
+/**
+ * Destroy a channel and free all resources.
+ *
+ * @param ch Channel to destroy.
+ */
+void
+GMCH_destroy (struct MeshChannel *ch);
+
 /**
  * Get channel ID.
  *
@@ -119,21 +127,6 @@ GMCH_is_origin (struct MeshChannel *ch, int fwd);
 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.
  *
@@ -153,14 +146,6 @@ GMCH_send_data_ack (struct MeshChannel *ch, int fwd);
 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.
  *
@@ -216,10 +201,12 @@ GMCH_handle_local_data (struct MeshChannel *ch,
  *
  * @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.
@@ -326,18 +313,22 @@ GMCH_handle_destroy (struct MeshChannel *ch,
  * 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.
  */