types
[oweals/gnunet.git] / src / include / gnunet_client_lib.h
index 4ac993deac5404c1f5b2db662f764e8f53b4786e..fd9291598333318ab05fc070796b65b734040d8b 100644 (file)
@@ -85,7 +85,6 @@ typedef void (*GNUNET_CLIENT_MessageHandler) (void *cls,
 /**
  * Read from the service.
  *
- * @param sched scheduler to use
  * @param sock the service
  * @param handler function to call with the message
  * @param cls closure for handler
@@ -111,19 +110,42 @@ void GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *sock,
  *         non-NULL if the notify callback was queued (can be used to cancel
  *         using GNUNET_CONNECTION_notify_transmit_ready_cancel)
  */
-struct GNUNET_NETWORK_TransmitHandle
+struct GNUNET_CONNECTION_TransmitHandle
   *GNUNET_CLIENT_notify_transmit_ready (struct GNUNET_CLIENT_Connection *sock,
                                         size_t size,
                                         struct GNUNET_TIME_Relative timeout,
-                                        GNUNET_NETWORK_TransmitReadyNotify
+                                        GNUNET_CONNECTION_TransmitReadyNotify
                                         notify, void *notify_cls);
 
 
+
+/**
+ * Convenience API that combines sending a request
+ * to the service and waiting for a response.
+ * If either operation times out, the callback
+ * will be called with a "NULL" response (in which
+ * case the connection should probably be destroyed).
+ *
+ * @param sock connection to use
+ * @param hdr message to transmit
+ * @param timeout when to give up (for both transmission
+ *         and for waiting for a response)
+ * @param rn function to call with the response
+ * @param rn_cls closure for rn 
+ */
+void
+GNUNET_CLIENT_transmit_and_get_response (struct GNUNET_CLIENT_Connection *sock,
+                                        const struct GNUNET_MessageHeader *hdr,
+                                        struct GNUNET_TIME_Relative timeout,
+                                        GNUNET_CLIENT_MessageHandler rn,
+                                        void *rn_cls);
+
+
+
 /**
  * Request that the service should shutdown.
  * Afterwards, the connection should be disconnected.
  *
- * @param sched scheduler to use
  * @param sock the socket connected to the service
  */
 void GNUNET_CLIENT_service_shutdown (struct GNUNET_CLIENT_Connection *sock);