+ SIMIX_communication_destroy(comm);
+}
+
+/**
+ * \brief Cancels a communication
+ * \brief comm The communication to cancel
+ */
+XBT_INLINE void SIMIX_communication_cancel(smx_comm_t comm)
+{
+ if (comm->act)
+ SIMIX_action_cancel(comm->act);
+}
+
+/**
+ * \brief get the amount remaining from the communication
+ * \param comm The communication
+ */
+XBT_INLINE double SIMIX_communication_get_remains(smx_comm_t comm)
+{
+ return SIMIX_action_get_remains(comm->act);
+}
+
+/******************************************************************************/
+/* SIMIX_network_copy_data callbacks */
+/******************************************************************************/
+static void (*SIMIX_network_copy_data_callback)(smx_comm_t, size_t) = &SIMIX_network_copy_pointer_callback;
+
+void SIMIX_network_set_copy_data_callback(void (*callback)(smx_comm_t, size_t)) {
+ SIMIX_network_copy_data_callback = callback;
+}
+
+void SIMIX_network_copy_pointer_callback(smx_comm_t comm, size_t buff_size) {
+ xbt_assert1((buff_size == sizeof(void*)), "Cannot copy %zu bytes: must be sizeof(void*)",buff_size);
+ *(void**)(comm->dst_buff) = comm->src_buff;
+}
+
+void SIMIX_network_copy_buffer_callback(smx_comm_t comm, size_t buff_size) {
+ memcpy(comm->dst_buff, comm->src_buff, buff_size);
+}
+
+/**
+ * \brief Copy the communication data from the sender's buffer to the receiver's one
+ * \param comm The communication
+ */
+void SIMIX_network_copy_data(smx_comm_t comm)
+{
+ /* If there is no data to be copy then return */
+ if(!comm->src_buff || !comm->dst_buff)
+ return;
+
+ /* Copy at most dst_buff_size bytes of the message to receiver's buffer */
+ size_t buff_size = comm->src_buff_size;
+ if (comm->dst_buff_size)
+ buff_size = MIN(buff_size,*(comm->dst_buff_size));
+
+ /* Update the receiver's buffer size to the copied amount */
+ if (comm->dst_buff_size)
+ *comm->dst_buff_size = buff_size;
+
+ if(buff_size == 0)
+ return;
+ DEBUG6("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)",
+ comm,
+ comm->src_proc->smx_host->name, comm->src_buff,
+ comm->dst_proc->smx_host->name, comm->dst_buff,
+ buff_size);
+ (*SIMIX_network_copy_data_callback)(comm, buff_size);
+}
+
+/**
+ * \brief Return the user data associated to the communication
+ * \param comm The communication
+ * \return the user data
+ */
+XBT_INLINE void *SIMIX_communication_get_data(smx_comm_t comm)
+{
+ return comm->data;