33#ifndef GNUNET_CURL_LIB_H
34#define GNUNET_CURL_LIB_H
138 fd_set *write_fd_set,
139 fd_set *except_fd_set,
272 const char *userpass);
291 const char *certtype,
292 const char *certfile,
294 const char *keypass);
348 const struct curl_slist *extra_headers);
421 const char *header_name);
static struct GNUNET_TIME_Relative timeout
User defined timestamp for completing operations.
static struct GNUNET_SCHEDULER_Task * job
Task for main job.
static struct MHD_Response * response
Our canonical response.
static struct GNUNET_FS_Handle * ctx
static char * rp
Relying party.
static struct GNUNET_FS_DirectoryBuilder * db
void GNUNET_CURL_set_tlscert(struct GNUNET_CURL_Context *ctx, const char *certtype, const char *certfile, const char *keyfile, const char *keypass)
Force use of the provided TLS client certificate for client authentication for all operations perform...
void GNUNET_CURL_gnunet_scheduler_reschedule(void *cls)
Implementation of the GNUNET_CURL_RescheduleCallback for GNUnet's scheduler.
void(* GNUNET_CURL_RawJobCompletionCallback)(void *cls, long response_code, const void *body, size_t body_size)
Function to call upon completion of a raw job.
void(* GNUNET_CURL_JobCompletionCallback)(void *cls, long response_code, const void *response)
Function to call upon completion of a job.
struct GNUNET_CURL_Job * GNUNET_CURL_job_add_raw(struct GNUNET_CURL_Context *ctx, CURL *eh, const struct curl_slist *job_headers, GNUNET_CURL_RawJobCompletionCallback jcc, void *jcc_cls)
Schedule a CURL request to be executed and call the given jcc upon its completion.
struct GNUNET_CURL_RescheduleContext * GNUNET_CURL_gnunet_rc_create_with_parser(struct GNUNET_CURL_Context *ctx, GNUNET_CURL_RawParser rp, GNUNET_CURL_ResponseCleaner rc)
Initialize reschedule context; with custom response parser.
struct GNUNET_CURL_Job * GNUNET_CURL_job_add(struct GNUNET_CURL_Context *ctx, CURL *eh, GNUNET_CURL_JobCompletionCallback jcc, void *jcc_cls)
Schedule a CURL request to be executed and call the given jcc upon its completion.
void GNUNET_CURL_get_select_info(struct GNUNET_CURL_Context *ctx, fd_set *read_fd_set, fd_set *write_fd_set, fd_set *except_fd_set, int *max_fd, long *timeout)
Obtain the information for a select() call to wait until GNUNET_CURL_perform() is ready again.
struct GNUNET_CURL_Context * GNUNET_CURL_init(GNUNET_CURL_RescheduleCallback cb, void *cb_cls)
Initialise this library.
void GNUNET_CURL_fini(struct GNUNET_CURL_Context *ctx)
Cleanup library initialisation resources.
void(* GNUNET_CURL_ResponseCleaner)(void *response)
Deallocate the response.
void GNUNET_CURL_extend_headers(struct GNUNET_CURL_Job *job, const struct curl_slist *extra_headers)
Add extra_headers to the HTTP headers for job.
struct GNUNET_CURL_RescheduleContext * GNUNET_CURL_gnunet_rc_create(struct GNUNET_CURL_Context *ctx)
Initialize reschedule context.
void GNUNET_CURL_perform2(struct GNUNET_CURL_Context *ctx, GNUNET_CURL_RawParser rp, GNUNET_CURL_ResponseCleaner rc)
Run the main event loop for the HTTP interaction.
void GNUNET_CURL_job_cancel(struct GNUNET_CURL_Job *job)
Cancel a job.
enum GNUNET_GenericReturnValue GNUNET_CURL_is_valid_scope_id(const char *scope_id)
Return GNUNET_YES if given a valid scope ID and GNUNET_NO otherwise.
void GNUNET_CURL_perform(struct GNUNET_CURL_Context *ctx)
Run the main event loop for the CURL interaction.
void GNUNET_CURL_set_userpass(struct GNUNET_CURL_Context *ctx, const char *userpass)
Force use of the provided username and password for client authentication for all operations performe...
void *(* GNUNET_CURL_RawParser)(struct GNUNET_CURL_DownloadBuffer *db, CURL *eh, long *response_code)
Parses the raw response we got from the Web server.
struct GNUNET_CURL_Job * GNUNET_CURL_job_add_with_ct_json(struct GNUNET_CURL_Context *ctx, CURL *eh, GNUNET_CURL_JobCompletionCallback jcc, void *jcc_cls)
Schedule a CURL request to be executed and call the given jcc upon its completion.
enum GNUNET_GenericReturnValue GNUNET_CURL_append_header(struct GNUNET_CURL_Context *ctx, const char *header)
Add custom request header.
void(* GNUNET_CURL_RescheduleCallback)(void *cls)
Function called by the context to ask for the event loop to be rescheduled, that is the application s...
void GNUNET_CURL_gnunet_rc_destroy(struct GNUNET_CURL_RescheduleContext *rc)
Destroy reschedule context.
void GNUNET_CURL_enable_async_scope_header(struct GNUNET_CURL_Context *ctx, const char *header_name)
Enable sending the async scope ID as a header.
struct GNUNET_CURL_Job * GNUNET_CURL_job_add2(struct GNUNET_CURL_Context *ctx, CURL *eh, const struct curl_slist *job_headers, GNUNET_CURL_JobCompletionCallback jcc, void *jcc_cls)
Schedule a CURL request to be executed and call the given jcc upon its completion.
GNUNET_GenericReturnValue
Named constants for return values.
void * cb_cls
Closure for cb.
GNUNET_CURL_RescheduleCallback cb
Function we need to call whenever the event loop's socket set changed.
Buffer data structure we use to buffer the HTTP download before giving it to the JSON parser.
void * buf
Download buffer.
size_t buf_size
The size of the download buffer.
int eno
Error code (based on libc errno) if we failed to download (e.g.
Jobs are CURL requests running within a struct GNUNET_CURL_Context.
struct curl_slist * job_headers
Headers used for this job, the list needs to be freed after the job has finished.
GNUNET_CURL_JobCompletionCallback jcc
Function to call upon completion.
void * jcc_cls
Closure for jcc.
Closure for GNUNET_CURL_gnunet_scheduler_reschedule().