missing changes to headers
[oweals/gnunet.git] / src / include / gnunet_mq_lib.h
index f88017fbe07fd82d40e808de3cf7e33c79993724..5936f3ca2ab4ff9e32830a63f118302e0e7df15c 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2012-2013 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2012-2013 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -14,8 +14,8 @@
 
      You should have received a copy of the GNU General Public License
      along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -28,8 +28,6 @@
 #ifndef GNUNET_MQ_H
 #define GNUNET_MQ_H
 
-#include "gnunet_common.h"
-
 
 /**
  * Allocate an envelope, with extra space allocated after the space needed
@@ -42,7 +40,7 @@
  * @param type type of the message
  * @return the MQ message
  */
-#define GNUNET_MQ_msg_extra(mvar, esize, type) GNUNET_MQ_msg_((((void)(mvar)->header), (struct GNUNET_MessageHeader**) &(mvar)), (esize) + sizeof *(mvar), (type))
+#define GNUNET_MQ_msg_extra(mvar, esize, type) GNUNET_MQ_msg_(((struct GNUNET_MessageHeader**) &(mvar)), (esize) + sizeof *(mvar), (type))
 
 /**
  * Allocate a GNUNET_MQ_Envelope.
  * @param base_size size of the message before the nested message's header appears
  * @return pointer to the nested message, does not copy the message
  */
-struct GNUNET_MessageHeader *
-GNUNET_MQ_extract_nested_mh_ (const struct GNUNET_MessageHeader *mh, uint16_t base_size);
+const struct GNUNET_MessageHeader *
+GNUNET_MQ_extract_nested_mh_ (const struct GNUNET_MessageHeader *mh,
+                              uint16_t base_size);
 
 
 /**
@@ -121,7 +120,9 @@ GNUNET_MQ_extract_nested_mh_ (const struct GNUNET_MessageHeader *mh, uint16_t ba
  * @param nested_mh the message to append to the message after base_size
  */
 struct GNUNET_MQ_Envelope *
-GNUNET_MQ_msg_nested_mh_ (struct GNUNET_MessageHeader **mhp, uint16_t base_size, uint16_t type,
+GNUNET_MQ_msg_nested_mh_ (struct GNUNET_MessageHeader **mhp,
+                          uint16_t base_size,
+                          uint16_t type,
                           const struct GNUNET_MessageHeader *nested_mh);
 
 
@@ -145,22 +146,22 @@ struct GNUNET_MQ_Envelope;
 
 /**
  * Error codes for the queue.
- */ 
+ */
 enum GNUNET_MQ_Error
 {
   /**
    * FIXME: document!
-   */ 
+   */
   GNUNET_MQ_ERROR_READ = 1,
 
   /**
    * FIXME: document!
-   */ 
+   */
   GNUNET_MQ_ERROR_WRITE = 2,
 
   /**
    * FIXME: document!
-   */ 
+   */
   GNUNET_MQ_ERROR_TIMEOUT = 4
 };
 
@@ -195,22 +196,24 @@ typedef void
  * destruction of a message queue.
  * Implementations must not free @a mq, but should
  * take care of @a impl_state.
- * 
+ *
  * @param mq the message queue to destroy
  * @param impl_state state of the implementation
  */
 typedef void
-(*GNUNET_MQ_DestroyImpl) (struct GNUNET_MQ_Handle *mq, void *impl_state);
+(*GNUNET_MQ_DestroyImpl) (struct GNUNET_MQ_Handle *mq,
+                          void *impl_state);
 
 
 /**
  * Implementation function that cancels the currently sent message.
- * 
+ *
  * @param mq message queue
  * @param impl_state state specific to the implementation
  */
 typedef void
-(*GNUNET_MQ_CancelImpl) (struct GNUNET_MQ_Handle *mq, void *impl_state);
+(*GNUNET_MQ_CancelImpl) (struct GNUNET_MQ_Handle *mq,
+                         void *impl_state);
 
 
 /**
@@ -232,7 +235,8 @@ typedef void
  * @param error error code
  */
 typedef void
-(*GNUNET_MQ_ErrorHandler) (void *cls, enum GNUNET_MQ_Error error);
+(*GNUNET_MQ_ErrorHandler) (void *cls,
+                           enum GNUNET_MQ_Error error);
 
 
 /**
@@ -241,12 +245,11 @@ typedef void
 struct GNUNET_MQ_MessageHandler
 {
   /**
-   * Callback, called every time a new message of 
+   * Callback, called every time a new message of
    * the specified type has been receied.
    */
   GNUNET_MQ_MessageCallback cb;
 
-
   /**
    * Type of the message this handler covers.
    */
@@ -265,14 +268,16 @@ struct GNUNET_MQ_MessageHandler
 
 /**
  * Create a new envelope.
- * 
+ *
  * @param mhp message header to store the allocated message header in, can be NULL
  * @param size size of the message to allocate
  * @param type type of the message, will be set in the allocated message
  * @return the allocated MQ message
  */
 struct GNUNET_MQ_Envelope *
-GNUNET_MQ_msg_ (struct GNUNET_MessageHeader **mhp, uint16_t size, uint16_t type);
+GNUNET_MQ_msg_ (struct GNUNET_MessageHeader **mhp,
+                uint16_t size,
+                uint16_t type);
 
 
 /**
@@ -289,12 +294,12 @@ GNUNET_MQ_discard (struct GNUNET_MQ_Envelope *mqm);
 /**
  * Send a message with the give message queue.
  * May only be called once per message.
- * 
+ *
  * @param mq message queue
  * @param ev the envelope with the message to send.
  */
 void
-GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, 
+GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq,
                struct GNUNET_MQ_Envelope *ev);
 
 
@@ -327,7 +332,8 @@ GNUNET_MQ_assoc_add (struct GNUNET_MQ_Handle *mq, void *assoc_data);
  * @return the associated data
  */
 void *
-GNUNET_MQ_assoc_get (struct GNUNET_MQ_Handle *mq, uint32_t request_id);
+GNUNET_MQ_assoc_get (struct GNUNET_MQ_Handle *mq,
+                     uint32_t request_id);
 
 
 /**
@@ -338,7 +344,8 @@ GNUNET_MQ_assoc_get (struct GNUNET_MQ_Handle *mq, uint32_t request_id);
  * @return the associated data
  */
 void *
-GNUNET_MQ_assoc_remove (struct GNUNET_MQ_Handle *mq, uint32_t request_id);
+GNUNET_MQ_assoc_remove (struct GNUNET_MQ_Handle *mq,
+                        uint32_t request_id);
 
 
 /**
@@ -388,13 +395,12 @@ GNUNET_MQ_queue_for_callbacks (GNUNET_MQ_SendImpl send,
                                const struct GNUNET_MQ_MessageHandler *handlers,
                                GNUNET_MQ_ErrorHandler error_handler,
                                void *cls);
-                               
 
 
 /**
- * Replace the handlers of a message queue with new handlers.
- * Takes effect immediately, even for messages that already have been received, but for
- * with the handler has not been called.
+ * Replace the handlers of a message queue with new handlers.  Takes
+ * effect immediately, even for messages that already have been
+ * received, but for with the handler has not been called.
  *
  * If the message queue does not support receiving messages,
  * this function has no effect.
@@ -477,11 +483,14 @@ GNUNET_MQ_impl_send_continue (struct GNUNET_MQ_Handle *mq);
 
 /**
  * Get the message that should currently be sent.
+ * The returned message is only valid until #GNUNET_MQ_impl_send_continue
+ * is called.
  * Fails if there is no current message.
  * Only useful for implementing message queues,
  * results in undefined behavior if not used carefully.
  *
- * @param mq message queue with the current message
+ * @param mq message queue with the current message, only valid
+ *        until #GNUNET_MQ_impl_send_continue is called
  * @return message to send, never NULL
  */
 const struct GNUNET_MessageHeader *
@@ -506,16 +515,6 @@ void *
 GNUNET_MQ_impl_state (struct GNUNET_MQ_Handle *mq);
 
 
-/**
- * Mark the current message as irrevocably sent, but do not
- * proceed with sending the next message.
- * Will call the appropriate GNUNET_MQ_NotifyCallback, if any.
- *
- * @param mq message queue
- */
-void
-GNUNET_MQ_impl_send_commit (struct GNUNET_MQ_Handle *mq);
-
 /** @} */ /* end of group mq */
 
 #endif