aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_curl_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_curl_lib.h')
-rw-r--r--src/include/gnunet_curl_lib.h97
1 files changed, 47 insertions, 50 deletions
diff --git a/src/include/gnunet_curl_lib.h b/src/include/gnunet_curl_lib.h
index e9378794e..af0e929a5 100644
--- a/src/include/gnunet_curl_lib.h
+++ b/src/include/gnunet_curl_lib.h
@@ -1,22 +1,22 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2014, 2015, 2016 GNUnet e.V. 3 Copyright (C) 2014, 2015, 2016 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License, 7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20/** 20/**
21 * @file src/include/gnunet_curl_lib.h 21 * @file src/include/gnunet_curl_lib.h
22 * @brief library to make it easy to download JSON replies over HTTP 22 * @brief library to make it easy to download JSON replies over HTTP
@@ -54,9 +54,7 @@ typedef void
54 * @brief Buffer data structure we use to buffer the HTTP download 54 * @brief Buffer data structure we use to buffer the HTTP download
55 * before giving it to the JSON parser. 55 * before giving it to the JSON parser.
56 */ 56 */
57struct GNUNET_CURL_DownloadBuffer 57struct GNUNET_CURL_DownloadBuffer {
58{
59
60 /** 58 /**
61 * Download buffer 59 * Download buffer
62 */ 60 */
@@ -72,7 +70,6 @@ struct GNUNET_CURL_DownloadBuffer
72 * (i.e. response too large). 70 * (i.e. response too large).
73 */ 71 */
74 int eno; 72 int eno;
75
76}; 73};
77 74
78 75
@@ -91,7 +88,7 @@ typedef void *
91 88
92/** 89/**
93 * Deallocate the response. 90 * Deallocate the response.
94 * 91 *
95 * @param response object to clean 92 * @param response object to clean
96 */ 93 */
97typedef void 94typedef void
@@ -106,8 +103,8 @@ typedef void
106 * @return library context 103 * @return library context
107 */ 104 */
108struct GNUNET_CURL_Context * 105struct GNUNET_CURL_Context *
109GNUNET_CURL_init (GNUNET_CURL_RescheduleCallback cb, 106GNUNET_CURL_init(GNUNET_CURL_RescheduleCallback cb,
110 void *cb_cls); 107 void *cb_cls);
111 108
112 109
113/** 110/**
@@ -137,12 +134,12 @@ GNUNET_CURL_init (GNUNET_CURL_RescheduleCallback cb,
137 * proceed immediately with #GNUNET_CURL_perform(). 134 * proceed immediately with #GNUNET_CURL_perform().
138 */ 135 */
139void 136void
140GNUNET_CURL_get_select_info (struct GNUNET_CURL_Context *ctx, 137GNUNET_CURL_get_select_info(struct GNUNET_CURL_Context *ctx,
141 fd_set *read_fd_set, 138 fd_set *read_fd_set,
142 fd_set *write_fd_set, 139 fd_set *write_fd_set,
143 fd_set *except_fd_set, 140 fd_set *except_fd_set,
144 int *max_fd, 141 int *max_fd,
145 long *timeout); 142 long *timeout);
146 143
147 144
148/** 145/**
@@ -153,8 +150,8 @@ GNUNET_CURL_get_select_info (struct GNUNET_CURL_Context *ctx,
153 * @return #GNUNET_OK if no errors occurred, #GNUNET_SYSERR otherwise. 150 * @return #GNUNET_OK if no errors occurred, #GNUNET_SYSERR otherwise.
154 */ 151 */
155int 152int
156GNUNET_CURL_append_header (struct GNUNET_CURL_Context *ctx, 153GNUNET_CURL_append_header(struct GNUNET_CURL_Context *ctx,
157 const char *header); 154 const char *header);
158 155
159/** 156/**
160 * Run the main event loop for the CURL interaction. 157 * Run the main event loop for the CURL interaction.
@@ -162,7 +159,7 @@ GNUNET_CURL_append_header (struct GNUNET_CURL_Context *ctx,
162 * @param ctx the library context 159 * @param ctx the library context
163 */ 160 */
164void 161void
165GNUNET_CURL_perform (struct GNUNET_CURL_Context *ctx); 162GNUNET_CURL_perform(struct GNUNET_CURL_Context *ctx);
166 163
167 164
168/** 165/**
@@ -174,9 +171,9 @@ GNUNET_CURL_perform (struct GNUNET_CURL_Context *ctx);
174 * @param rc cleans/frees the response 171 * @param rc cleans/frees the response
175 */ 172 */
176void 173void
177GNUNET_CURL_perform2 (struct GNUNET_CURL_Context *ctx, 174GNUNET_CURL_perform2(struct GNUNET_CURL_Context *ctx,
178 GNUNET_CURL_RawParser rp, 175 GNUNET_CURL_RawParser rp,
179 GNUNET_CURL_ResponseCleaner rc); 176 GNUNET_CURL_ResponseCleaner rc);
180 177
181/** 178/**
182 * Cleanup library initialisation resources. This function should be called 179 * Cleanup library initialisation resources. This function should be called
@@ -186,7 +183,7 @@ GNUNET_CURL_perform2 (struct GNUNET_CURL_Context *ctx,
186 * @param ctx the library context 183 * @param ctx the library context
187 */ 184 */
188void 185void
189GNUNET_CURL_fini (struct GNUNET_CURL_Context *ctx); 186GNUNET_CURL_fini(struct GNUNET_CURL_Context *ctx);
190 187
191 188
192/** 189/**
@@ -224,11 +221,11 @@ typedef void
224 * @return NULL on error (in this case, @eh is still released!) 221 * @return NULL on error (in this case, @eh is still released!)
225 */ 222 */
226struct GNUNET_CURL_Job * 223struct GNUNET_CURL_Job *
227GNUNET_CURL_job_add (struct GNUNET_CURL_Context *ctx, 224GNUNET_CURL_job_add(struct GNUNET_CURL_Context *ctx,
228 CURL *eh, 225 CURL *eh,
229 int add_json, 226 int add_json,
230 GNUNET_CURL_JobCompletionCallback jcc, 227 GNUNET_CURL_JobCompletionCallback jcc,
231 void *jcc_cls); 228 void *jcc_cls);
232 229
233 230
234/** 231/**
@@ -248,7 +245,7 @@ GNUNET_CURL_job_add (struct GNUNET_CURL_Context *ctx,
248 * @return NULL on error (in this case, @eh is still released!) 245 * @return NULL on error (in this case, @eh is still released!)
249 */ 246 */
250struct GNUNET_CURL_Job * 247struct GNUNET_CURL_Job *
251GNUNET_CURL_job_add2 (struct GNUNET_CURL_Context *ctx, 248GNUNET_CURL_job_add2(struct GNUNET_CURL_Context *ctx,
252 CURL *eh, 249 CURL *eh,
253 const struct curl_slist *job_headers, 250 const struct curl_slist *job_headers,
254 GNUNET_CURL_JobCompletionCallback jcc, 251 GNUNET_CURL_JobCompletionCallback jcc,
@@ -262,7 +259,7 @@ GNUNET_CURL_job_add2 (struct GNUNET_CURL_Context *ctx,
262 * @param job job to cancel 259 * @param job job to cancel
263 */ 260 */
264void 261void
265GNUNET_CURL_job_cancel (struct GNUNET_CURL_Job *job); 262GNUNET_CURL_job_cancel(struct GNUNET_CURL_Job *job);
266 263
267 264
268/* ******* GNUnet SCHEDULER integration ************ */ 265/* ******* GNUnet SCHEDULER integration ************ */
@@ -281,7 +278,7 @@ struct GNUNET_CURL_RescheduleContext;
281 * @return closure for #GNUNET_CURL_gnunet_scheduler_reschedule(). 278 * @return closure for #GNUNET_CURL_gnunet_scheduler_reschedule().
282 */ 279 */
283struct GNUNET_CURL_RescheduleContext * 280struct GNUNET_CURL_RescheduleContext *
284GNUNET_CURL_gnunet_rc_create (struct GNUNET_CURL_Context *ctx); 281GNUNET_CURL_gnunet_rc_create(struct GNUNET_CURL_Context *ctx);
285 282
286/** 283/**
287 * Initialize reschedule context; with custom response parser 284 * Initialize reschedule context; with custom response parser
@@ -290,9 +287,9 @@ GNUNET_CURL_gnunet_rc_create (struct GNUNET_CURL_Context *ctx);
290 * @return closure for #GNUNET_CURL_gnunet_scheduler_reschedule(). 287 * @return closure for #GNUNET_CURL_gnunet_scheduler_reschedule().
291 */ 288 */
292struct GNUNET_CURL_RescheduleContext * 289struct GNUNET_CURL_RescheduleContext *
293GNUNET_CURL_gnunet_rc_create_with_parser (struct GNUNET_CURL_Context *ctx, 290GNUNET_CURL_gnunet_rc_create_with_parser(struct GNUNET_CURL_Context *ctx,
294 GNUNET_CURL_RawParser rp, 291 GNUNET_CURL_RawParser rp,
295 GNUNET_CURL_ResponseCleaner rc); 292 GNUNET_CURL_ResponseCleaner rc);
296 293
297 294
298/** 295/**
@@ -301,7 +298,7 @@ GNUNET_CURL_gnunet_rc_create_with_parser (struct GNUNET_CURL_Context *ctx,
301 * @param rc context to destroy 298 * @param rc context to destroy
302 */ 299 */
303void 300void
304GNUNET_CURL_gnunet_rc_destroy (struct GNUNET_CURL_RescheduleContext *rc); 301GNUNET_CURL_gnunet_rc_destroy(struct GNUNET_CURL_RescheduleContext *rc);
305 302
306 303
307/** 304/**
@@ -314,7 +311,7 @@ GNUNET_CURL_gnunet_rc_destroy (struct GNUNET_CURL_RescheduleContext *rc);
314 * (pointer to a pointer!) 311 * (pointer to a pointer!)
315 */ 312 */
316void 313void
317GNUNET_CURL_gnunet_scheduler_reschedule (void *cls); 314GNUNET_CURL_gnunet_scheduler_reschedule(void *cls);
318 315
319 316
320/** 317/**
@@ -324,7 +321,7 @@ GNUNET_CURL_gnunet_scheduler_reschedule (void *cls);
324 * @param header_name name of the header to send. 321 * @param header_name name of the header to send.
325 */ 322 */
326void 323void
327GNUNET_CURL_enable_async_scope_header (struct GNUNET_CURL_Context *ctx, const char *header_name); 324GNUNET_CURL_enable_async_scope_header(struct GNUNET_CURL_Context *ctx, const char *header_name);
328 325
329 326
330#endif 327#endif