#include "gnunet_common.h"
#include "gnunet_configuration_lib.h"
-#include "gnunet_network_lib.h"
+#include "gnunet_connection_lib.h"
#include "gnunet_scheduler_lib.h"
#include "gnunet_time_lib.h"
/**
* 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
* @param notify_cls closure for notify
* @return NULL if someone else is already waiting to be notified
* non-NULL if the notify callback was queued (can be used to cancel
- * using GNUNET_NETWORK_notify_transmit_ready_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);