* @author Christian Grothoff
*/
#include "platform.h"
+#if HAVE_CURL_CURL_H
#include <curl/curl.h>
+#elif HAVE_GNURL_CURL_H
+#include <gnurl/curl.h>
+#endif
#include <jansson.h>
#include "gnunet_curl_lib.h"
*/
struct curl_slist *json_header;
+ /**
+ * Function we need to call whenever the event loop's
+ * socket set changed.
+ */
+ GNUNET_CURL_RescheduleCallback cb;
+
+ /**
+ * Closure for @e cb.
+ */
+ void *cb_cls;
};
* Initialise this library. This function should be called before using any of
* the following functions.
*
+ * @param cb function to call when rescheduling is required
+ * @param cb_cls closure for @a cb
* @return library context
*/
struct GNUNET_CURL_Context *
-GNUNET_CURL_init ()
+GNUNET_CURL_init (GNUNET_CURL_RescheduleCallback cb,
+ void *cb_cls)
{
struct GNUNET_CURL_Context *ctx;
CURLM *multi;
return NULL;
}
ctx = GNUNET_new (struct GNUNET_CURL_Context);
+ ctx->cb = cb;
+ ctx->cb_cls = cb_cls;
ctx->multi = multi;
ctx->share = share;
GNUNET_assert (NULL != (ctx->json_header =
GNUNET_CONTAINER_DLL_insert (ctx->jobs_head,
ctx->jobs_tail,
job);
+ ctx->cb (ctx->cb_cls);
return job;
}
job->jcc (job->jcc_cls,
response_code,
j);
+ json_decref (j);
GNUNET_CURL_job_cancel (job);
}
}