diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-11-24 19:11:34 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-11-24 19:12:16 +0100 |
commit | 5f38569fce2e77afeed58cbd3429c67bf8ab9109 (patch) | |
tree | f348bc7b24e5cfafe9abe1fee3f7502a4a2fe434 /src/include | |
parent | a6e31c91476191a038e240c030a799247fde39fb (diff) | |
download | gnunet-5f38569fce2e77afeed58cbd3429c67bf8ab9109.tar.gz gnunet-5f38569fce2e77afeed58cbd3429c67bf8ab9109.zip |
add RAW mode for libgnunetcurl
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_curl_lib.h | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/include/gnunet_curl_lib.h b/src/include/gnunet_curl_lib.h index 64b41ed83..48eb7e490 100644 --- a/src/include/gnunet_curl_lib.h +++ b/src/include/gnunet_curl_lib.h | |||
@@ -197,7 +197,7 @@ struct GNUNET_CURL_Job; | |||
197 | * | 197 | * |
198 | * @param cls closure | 198 | * @param cls closure |
199 | * @param response_code HTTP response code from server, 0 on hard error | 199 | * @param response_code HTTP response code from server, 0 on hard error |
200 | * @param json response, NULL if response was not in JSON format | 200 | * @param response in JSON, NULL if response was not in JSON format |
201 | */ | 201 | */ |
202 | typedef void | 202 | typedef void |
203 | (*GNUNET_CURL_JobCompletionCallback)(void *cls, | 203 | (*GNUNET_CURL_JobCompletionCallback)(void *cls, |
@@ -206,6 +206,21 @@ typedef void | |||
206 | 206 | ||
207 | 207 | ||
208 | /** | 208 | /** |
209 | * Function to call upon completion of a raw job. | ||
210 | * | ||
211 | * @param cls closure | ||
212 | * @param response_code HTTP response code from server, 0 on hard error | ||
213 | * @param body http body of the response | ||
214 | * @param body_size number of bytes in @a body | ||
215 | */ | ||
216 | typedef void | ||
217 | (*GNUNET_CURL_RawJobCompletionCallback)(void *cls, | ||
218 | long response_code, | ||
219 | const void *body, | ||
220 | size_t body_size); | ||
221 | |||
222 | |||
223 | /** | ||
209 | * Schedule a CURL request to be executed and call the given @a jcc | 224 | * Schedule a CURL request to be executed and call the given @a jcc |
210 | * upon its completion. Note that the context will make use of the | 225 | * upon its completion. Note that the context will make use of the |
211 | * CURLOPT_PRIVATE facility of the CURL @a eh. | 226 | * CURLOPT_PRIVATE facility of the CURL @a eh. |
@@ -254,6 +269,29 @@ GNUNET_CURL_job_add2 (struct GNUNET_CURL_Context *ctx, | |||
254 | 269 | ||
255 | 270 | ||
256 | /** | 271 | /** |
272 | * Schedule a CURL request to be executed and call the given @a jcc | ||
273 | * upon its completion. Note that the context will make use of the | ||
274 | * CURLOPT_PRIVATE facility of the CURL @a eh. Used to download | ||
275 | * resources that are NOT in JSON. The raw body will be returned. | ||
276 | * | ||
277 | * @param ctx context to execute the job in | ||
278 | * @param eh curl easy handle for the request, will | ||
279 | * be executed AND cleaned up | ||
280 | * @param job_headers extra headers to add for this request | ||
281 | * @param max_reply_size largest acceptable response body | ||
282 | * @param jcc callback to invoke upon completion | ||
283 | * @param jcc_cls closure for @a jcc | ||
284 | * @return NULL on error (in this case, @eh is still released!) | ||
285 | */ | ||
286 | struct GNUNET_CURL_Job * | ||
287 | GNUNET_CURL_job_add_raw (struct GNUNET_CURL_Context *ctx, | ||
288 | CURL *eh, | ||
289 | const struct curl_slist *job_headers, | ||
290 | GNUNET_CURL_RawJobCompletionCallback jcc, | ||
291 | void *jcc_cls); | ||
292 | |||
293 | |||
294 | /** | ||
257 | * Cancel a job. Must only be called before the job completion | 295 | * Cancel a job. Must only be called before the job completion |
258 | * callback is called for the respective job. | 296 | * callback is called for the respective job. |
259 | * | 297 | * |