33#ifndef GNUNET_CURL_LIB_H
34#define GNUNET_CURL_LIB_H
138 fd_set *write_fd_set,
139 fd_set *except_fd_set,
257#define GNUNET_CURL_STREAM_PAUSE CURL_WRITEFUNC_PAUSE
451 const char *userpass);
470 const char *certtype,
471 const char *certfile,
473 const char *keypass);
527 const struct curl_slist *extra_headers);
600 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 char * line
Desired phone line (string to be converted to a hash).
static struct MHD_Response * response
Our canonical response.
static char * data
The data to insert into the dht.
static struct GNUNET_FS_Handle * ctx
static struct GNUNET_IDENTITY_Handle * sh
Handle to IDENTITY service.
static size_t data_size
Number of bytes in data.
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.
void GNUNET_CURL_job_set_paused(struct GNUNET_CURL_Job *job, bool recv_paused, bool send_paused)
Say which directions of job are to be paused from now on.
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.
size_t(* GNUNET_CURL_StreamCallback)(void *cls, const void *data, size_t data_size)
Function called with a chunk of the response body as it arrives.
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.
struct GNUNET_CURL_Job * GNUNET_CURL_job_add_stream(struct GNUNET_CURL_Context *ctx, CURL *eh, const struct curl_slist *job_headers, const struct GNUNET_CURL_StreamHandlers *sh)
Schedule a CURL request whose response is delivered incrementally, rather than buffered in full and h...
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.
enum GNUNET_GenericReturnValue(* GNUNET_CURL_StreamHeaderCallback)(void *cls, const char *line, size_t line_size)
Function called with one raw header line of the response, as it arrives.
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().
What to call for a job added with GNUNET_CURL_job_add_stream().
void * jcc_cls
Closure for jcc.
GNUNET_CURL_RawJobCompletionCallback jcc
Called once the transfer has ended, successfully or not.
void * hcb_cls
Closure for hcb.
void * scb_cls
Closure for scb.
GNUNET_CURL_StreamHeaderCallback hcb
Called per response header line, or NULL if the caller does not want them.
GNUNET_CURL_StreamCallback scb
Called per chunk of response body.