uint16_t base_size);
+/**
+ * Opaque handle to an envelope.
+ */
+struct GNUNET_MQ_Envelope;
+
+
/**
* Implementation of the #GNUNET_MQ_msg_nested_mh macro.
*
*/
struct GNUNET_MQ_Handle;
-/**
- * Opaque handle to an envelope.
- */
-struct GNUNET_MQ_Envelope;
-
/**
* Error codes for the queue.
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
/**
- * Send a message with the give message queue.
+ * 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 given message queue.
* May only be called once per message.
*
* @param mq message queue
struct GNUNET_MQ_Envelope *ev);
+/**
+ * Send a copy of a message with the given 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