add function conv param string
[oweals/gnunet.git] / src / include / gnunet_mq_lib.h
index 4630fa35ac43ef98a39745d9c2c70279b4b80e6c..08e09d5b51c76c6f18cbdb3fbd7120e38d600300 100644 (file)
@@ -252,7 +252,7 @@ typedef void
  * the message queue.
  * Not every message queue implementation supports an error handler.
  *
- * @param cls closure, same closure as for the message handlers
+ * @param cls closure
  * @param error error code
  */
 typedef void
@@ -411,6 +411,16 @@ GNUNET_MQ_msg_ (struct GNUNET_MessageHeader **mhp,
                 uint16_t type);
 
 
+/**
+ * Create a new envelope by copying an existing message.
+ *
+ * @param hdr header of the message to copy
+ * @return envelope containing @a hdr
+ */
+struct GNUNET_MQ_Envelope *
+GNUNET_MQ_msg_copy (const struct GNUNET_MessageHeader *hdr);
+
+
 /**
  * Discard the message queue message, free all
  * allocated resources. Must be called in the event
@@ -422,6 +432,16 @@ void
 GNUNET_MQ_discard (struct GNUNET_MQ_Envelope *mqm);
 
 
+/**
+ * Obtain the current length of the message queue.
+ *
+ * @param mq queue to inspect
+ * @return number of queued, non-transmitted messages
+ */
+unsigned int
+GNUNET_MQ_get_length (struct GNUNET_MQ_Handle *mq);
+
+
 /**
  * Send a message with the give message queue.
  * May only be called once per message.
@@ -434,6 +454,18 @@ GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq,
                struct GNUNET_MQ_Envelope *ev);
 
 
+/**
+ * Send a copy of a message with the give message queue.
+ * Can be called repeatedly on the same envelope.
+ *
+ * @param mq message queue
+ * @param ev the envelope with the message to send.
+ */
+void
+GNUNET_MQ_send_copy (struct GNUNET_MQ_Handle *mq,
+                     const struct GNUNET_MQ_Envelope *ev);
+
+
 /**
  * Cancel sending the message. Message must have been sent with
  * #GNUNET_MQ_send before.  May not be called after the notify sent