├── README.md
├── curl
├── Makefile.am
├── curl.h
├── curlbuild.h
├── curlrules.h
├── curlver.h
├── easy.h
├── mprintf.h
├── multi.h
├── stdcheaders.h
├── system.h
├── typecheck-gcc.h
└── urlapi.h
├── install.sh
├── main.cpp
└── sqlvuln.py
/README.md:
--------------------------------------------------------------------------------
1 | # SQLVuln
2 |
3 | Simple tool to scanning sql injection vulnerability, easy to use!!
4 |
5 | # install
6 |
7 |
8 |
9 | **Using sqlvuln python, available for linux and termux (android)**
10 | ```
11 | $apt install pyton3 git -y
12 | $git clone https://github.com/Ranginang67/SQLVuln
13 | $cd SQLVuln
14 | $python3 sqlvuln.py
15 | ```
16 |
17 |
18 |
19 | **Using sqlvuln c++, available for linux only**
20 |
21 | ```
22 | $sudo apt-get install git
23 | $git clone https://github.com/Ranginang67/SQLVuln
24 | $cd SQLVuln
25 | $chmod +x *.sh
26 | $./install.sh main.cpp
27 | $./dork
28 | ```
29 |
30 |
31 | Note: select language you want to use :D
32 |
--------------------------------------------------------------------------------
/curl/Makefile.am:
--------------------------------------------------------------------------------
1 | #***************************************************************************
2 | # _ _ ____ _
3 | # Project ___| | | | _ \| |
4 | # / __| | | | |_) | |
5 | # | (__| |_| | _ <| |___
6 | # \___|\___/|_| \_\_____|
7 | #
8 | # Copyright (C) 1998 - 2019, Daniel Stenberg, , et al.
9 | #
10 | # This software is licensed as described in the file COPYING, which
11 | # you should have received as part of this distribution. The terms
12 | # are also available at https://curl.haxx.se/docs/copyright.html.
13 | #
14 | # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 | # copies of the Software, and permit persons to whom the Software is
16 | # furnished to do so, under the terms of the COPYING file.
17 | #
18 | # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 | # KIND, either express or implied.
20 | #
21 | ###########################################################################
22 | pkginclude_HEADERS = \
23 | curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \
24 | typecheck-gcc.h system.h urlapi.h
25 |
26 | pkgincludedir= $(includedir)/curl
27 |
28 | CHECKSRC = $(CS_$(V))
29 | CS_0 = @echo " RUN " $@;
30 | CS_1 =
31 | CS_ = $(CS_0)
32 |
33 | checksrc:
34 | $(CHECKSRC)@PERL@ $(top_srcdir)/lib/checksrc.pl -D$(top_srcdir)/include/curl $(pkginclude_HEADERS)
35 |
36 | if CURLDEBUG
37 | # for debug builds, we scan the sources on all regular make invokes
38 | all-local: checksrc
39 | endif
40 |
--------------------------------------------------------------------------------
/curl/curl.h:
--------------------------------------------------------------------------------
1 | #ifndef __CURL_CURL_H
2 | #define __CURL_CURL_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at http://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 |
25 | /*
26 | * If you have libcurl problems, all docs and details are found here:
27 | * http://curl.haxx.se/libcurl/
28 | *
29 | * curl-library mailing list subscription and unsubscription web interface:
30 | * http://cool.haxx.se/mailman/listinfo/curl-library/
31 | */
32 |
33 | #include "curlver.h" /* libcurl version defines */
34 | #include "curlbuild.h" /* libcurl build definitions */
35 | #include "curlrules.h" /* libcurl rules enforcement */
36 |
37 | /*
38 | * Define WIN32 when build target is Win32 API
39 | */
40 |
41 | #if (defined(_WIN32) || defined(__WIN32__)) && \
42 | !defined(WIN32) && !defined(__SYMBIAN32__)
43 | #define WIN32
44 | #endif
45 |
46 | #include
47 | #include
48 |
49 | #if defined(__FreeBSD__) && (__FreeBSD__ >= 2)
50 | /* Needed for __FreeBSD_version symbol definition */
51 | #include
52 | #endif
53 |
54 | /* The include stuff here below is mainly for time_t! */
55 | #include
56 | #include
57 |
58 | #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__)
59 | #if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || \
60 | defined(__LWIP_OPT_H__) || defined(LWIP_HDR_OPT_H))
61 | /* The check above prevents the winsock2 inclusion if winsock.h already was
62 | included, since they can't co-exist without problems */
63 | #include
64 | #include
65 | #endif
66 | #endif
67 |
68 | /* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
69 | libc5-based Linux systems. Only include it on systems that are known to
70 | require it! */
71 | #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
72 | defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \
73 | defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \
74 | (defined(__FreeBSD_version) && (__FreeBSD_version < 800000))
75 | #include
76 | #endif
77 |
78 | #if !defined(WIN32) && !defined(_WIN32_WCE)
79 | #include
80 | #endif
81 |
82 | #if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)
83 | #include
84 | #endif
85 |
86 | #ifdef __BEOS__
87 | #include
88 | #endif
89 |
90 | #ifdef __cplusplus
91 | extern "C" {
92 | #endif
93 |
94 | typedef void CURL;
95 |
96 | /*
97 | * libcurl external API function linkage decorations.
98 | */
99 |
100 | #ifdef CURL_STATICLIB
101 | # define CURL_EXTERN
102 | #elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)
103 | # if defined(BUILDING_LIBCURL)
104 | # define CURL_EXTERN __declspec(dllexport)
105 | # else
106 | # define CURL_EXTERN __declspec(dllimport)
107 | # endif
108 | #elif defined(BUILDING_LIBCURL) && defined(CURL_HIDDEN_SYMBOLS)
109 | # define CURL_EXTERN CURL_EXTERN_SYMBOL
110 | #else
111 | # define CURL_EXTERN
112 | #endif
113 |
114 | #ifndef curl_socket_typedef
115 | /* socket typedef */
116 | #if defined(WIN32) && !defined(__LWIP_OPT_H__) && !defined(LWIP_HDR_OPT_H)
117 | typedef SOCKET curl_socket_t;
118 | #define CURL_SOCKET_BAD INVALID_SOCKET
119 | #else
120 | typedef int curl_socket_t;
121 | #define CURL_SOCKET_BAD -1
122 | #endif
123 | #define curl_socket_typedef
124 | #endif /* curl_socket_typedef */
125 |
126 | struct curl_httppost {
127 | struct curl_httppost *next; /* next entry in the list */
128 | char *name; /* pointer to allocated name */
129 | long namelength; /* length of name length */
130 | char *contents; /* pointer to allocated data contents */
131 | long contentslength; /* length of contents field, see also
132 | CURL_HTTPPOST_LARGE */
133 | char *buffer; /* pointer to allocated buffer contents */
134 | long bufferlength; /* length of buffer field */
135 | char *contenttype; /* Content-Type */
136 | struct curl_slist* contentheader; /* list of extra headers for this form */
137 | struct curl_httppost *more; /* if one field name has more than one
138 | file, this link should link to following
139 | files */
140 | long flags; /* as defined below */
141 |
142 | /* specified content is a file name */
143 | #define CURL_HTTPPOST_FILENAME (1<<0)
144 | /* specified content is a file name */
145 | #define CURL_HTTPPOST_READFILE (1<<1)
146 | /* name is only stored pointer do not free in formfree */
147 | #define CURL_HTTPPOST_PTRNAME (1<<2)
148 | /* contents is only stored pointer do not free in formfree */
149 | #define CURL_HTTPPOST_PTRCONTENTS (1<<3)
150 | /* upload file from buffer */
151 | #define CURL_HTTPPOST_BUFFER (1<<4)
152 | /* upload file from pointer contents */
153 | #define CURL_HTTPPOST_PTRBUFFER (1<<5)
154 | /* upload file contents by using the regular read callback to get the data and
155 | pass the given pointer as custom pointer */
156 | #define CURL_HTTPPOST_CALLBACK (1<<6)
157 | /* use size in 'contentlen', added in 7.46.0 */
158 | #define CURL_HTTPPOST_LARGE (1<<7)
159 |
160 | char *showfilename; /* The file name to show. If not set, the
161 | actual file name will be used (if this
162 | is a file part) */
163 | void *userp; /* custom pointer used for
164 | HTTPPOST_CALLBACK posts */
165 | curl_off_t contentlen; /* alternative length of contents
166 | field. Used if CURL_HTTPPOST_LARGE is
167 | set. Added in 7.46.0 */
168 | };
169 |
170 | /* This is the CURLOPT_PROGRESSFUNCTION callback proto. It is now considered
171 | deprecated but was the only choice up until 7.31.0 */
172 | typedef int (*curl_progress_callback)(void *clientp,
173 | double dltotal,
174 | double dlnow,
175 | double ultotal,
176 | double ulnow);
177 |
178 | /* This is the CURLOPT_XFERINFOFUNCTION callback proto. It was introduced in
179 | 7.32.0, it avoids floating point and provides more detailed information. */
180 | typedef int (*curl_xferinfo_callback)(void *clientp,
181 | curl_off_t dltotal,
182 | curl_off_t dlnow,
183 | curl_off_t ultotal,
184 | curl_off_t ulnow);
185 |
186 | #ifndef CURL_MAX_WRITE_SIZE
187 | /* Tests have proven that 20K is a very bad buffer size for uploads on
188 | Windows, while 16K for some odd reason performed a lot better.
189 | We do the ifndef check to allow this value to easier be changed at build
190 | time for those who feel adventurous. The practical minimum is about
191 | 400 bytes since libcurl uses a buffer of this size as a scratch area
192 | (unrelated to network send operations). */
193 | #define CURL_MAX_WRITE_SIZE 16384
194 | #endif
195 |
196 | #ifndef CURL_MAX_HTTP_HEADER
197 | /* The only reason to have a max limit for this is to avoid the risk of a bad
198 | server feeding libcurl with a never-ending header that will cause reallocs
199 | infinitely */
200 | #define CURL_MAX_HTTP_HEADER (100*1024)
201 | #endif
202 |
203 | /* This is a magic return code for the write callback that, when returned,
204 | will signal libcurl to pause receiving on the current transfer. */
205 | #define CURL_WRITEFUNC_PAUSE 0x10000001
206 |
207 | typedef size_t (*curl_write_callback)(char *buffer,
208 | size_t size,
209 | size_t nitems,
210 | void *outstream);
211 |
212 |
213 |
214 | /* enumeration of file types */
215 | typedef enum {
216 | CURLFILETYPE_FILE = 0,
217 | CURLFILETYPE_DIRECTORY,
218 | CURLFILETYPE_SYMLINK,
219 | CURLFILETYPE_DEVICE_BLOCK,
220 | CURLFILETYPE_DEVICE_CHAR,
221 | CURLFILETYPE_NAMEDPIPE,
222 | CURLFILETYPE_SOCKET,
223 | CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */
224 |
225 | CURLFILETYPE_UNKNOWN /* should never occur */
226 | } curlfiletype;
227 |
228 | #define CURLFINFOFLAG_KNOWN_FILENAME (1<<0)
229 | #define CURLFINFOFLAG_KNOWN_FILETYPE (1<<1)
230 | #define CURLFINFOFLAG_KNOWN_TIME (1<<2)
231 | #define CURLFINFOFLAG_KNOWN_PERM (1<<3)
232 | #define CURLFINFOFLAG_KNOWN_UID (1<<4)
233 | #define CURLFINFOFLAG_KNOWN_GID (1<<5)
234 | #define CURLFINFOFLAG_KNOWN_SIZE (1<<6)
235 | #define CURLFINFOFLAG_KNOWN_HLINKCOUNT (1<<7)
236 |
237 | /* Content of this structure depends on information which is known and is
238 | achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man
239 | page for callbacks returning this structure -- some fields are mandatory,
240 | some others are optional. The FLAG field has special meaning. */
241 | struct curl_fileinfo {
242 | char *filename;
243 | curlfiletype filetype;
244 | time_t time;
245 | unsigned int perm;
246 | int uid;
247 | int gid;
248 | curl_off_t size;
249 | long int hardlinks;
250 |
251 | struct {
252 | /* If some of these fields is not NULL, it is a pointer to b_data. */
253 | char *time;
254 | char *perm;
255 | char *user;
256 | char *group;
257 | char *target; /* pointer to the target filename of a symlink */
258 | } strings;
259 |
260 | unsigned int flags;
261 |
262 | /* used internally */
263 | char * b_data;
264 | size_t b_size;
265 | size_t b_used;
266 | };
267 |
268 | /* return codes for CURLOPT_CHUNK_BGN_FUNCTION */
269 | #define CURL_CHUNK_BGN_FUNC_OK 0
270 | #define CURL_CHUNK_BGN_FUNC_FAIL 1 /* tell the lib to end the task */
271 | #define CURL_CHUNK_BGN_FUNC_SKIP 2 /* skip this chunk over */
272 |
273 | /* if splitting of data transfer is enabled, this callback is called before
274 | download of an individual chunk started. Note that parameter "remains" works
275 | only for FTP wildcard downloading (for now), otherwise is not used */
276 | typedef long (*curl_chunk_bgn_callback)(const void *transfer_info,
277 | void *ptr,
278 | int remains);
279 |
280 | /* return codes for CURLOPT_CHUNK_END_FUNCTION */
281 | #define CURL_CHUNK_END_FUNC_OK 0
282 | #define CURL_CHUNK_END_FUNC_FAIL 1 /* tell the lib to end the task */
283 |
284 | /* If splitting of data transfer is enabled this callback is called after
285 | download of an individual chunk finished.
286 | Note! After this callback was set then it have to be called FOR ALL chunks.
287 | Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC.
288 | This is the reason why we don't need "transfer_info" parameter in this
289 | callback and we are not interested in "remains" parameter too. */
290 | typedef long (*curl_chunk_end_callback)(void *ptr);
291 |
292 | /* return codes for FNMATCHFUNCTION */
293 | #define CURL_FNMATCHFUNC_MATCH 0 /* string corresponds to the pattern */
294 | #define CURL_FNMATCHFUNC_NOMATCH 1 /* pattern doesn't match the string */
295 | #define CURL_FNMATCHFUNC_FAIL 2 /* an error occurred */
296 |
297 | /* callback type for wildcard downloading pattern matching. If the
298 | string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */
299 | typedef int (*curl_fnmatch_callback)(void *ptr,
300 | const char *pattern,
301 | const char *string);
302 |
303 | /* These are the return codes for the seek callbacks */
304 | #define CURL_SEEKFUNC_OK 0
305 | #define CURL_SEEKFUNC_FAIL 1 /* fail the entire transfer */
306 | #define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so
307 | libcurl might try other means instead */
308 | typedef int (*curl_seek_callback)(void *instream,
309 | curl_off_t offset,
310 | int origin); /* 'whence' */
311 |
312 | /* This is a return code for the read callback that, when returned, will
313 | signal libcurl to immediately abort the current transfer. */
314 | #define CURL_READFUNC_ABORT 0x10000000
315 | /* This is a return code for the read callback that, when returned, will
316 | signal libcurl to pause sending data on the current transfer. */
317 | #define CURL_READFUNC_PAUSE 0x10000001
318 |
319 | typedef size_t (*curl_read_callback)(char *buffer,
320 | size_t size,
321 | size_t nitems,
322 | void *instream);
323 |
324 | typedef enum {
325 | CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */
326 | CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */
327 | CURLSOCKTYPE_LAST /* never use */
328 | } curlsocktype;
329 |
330 | /* The return code from the sockopt_callback can signal information back
331 | to libcurl: */
332 | #define CURL_SOCKOPT_OK 0
333 | #define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return
334 | CURLE_ABORTED_BY_CALLBACK */
335 | #define CURL_SOCKOPT_ALREADY_CONNECTED 2
336 |
337 | typedef int (*curl_sockopt_callback)(void *clientp,
338 | curl_socket_t curlfd,
339 | curlsocktype purpose);
340 |
341 | struct curl_sockaddr {
342 | int family;
343 | int socktype;
344 | int protocol;
345 | unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it
346 | turned really ugly and painful on the systems that
347 | lack this type */
348 | struct sockaddr addr;
349 | };
350 |
351 | typedef curl_socket_t
352 | (*curl_opensocket_callback)(void *clientp,
353 | curlsocktype purpose,
354 | struct curl_sockaddr *address);
355 |
356 | typedef int
357 | (*curl_closesocket_callback)(void *clientp, curl_socket_t item);
358 |
359 | typedef enum {
360 | CURLIOE_OK, /* I/O operation successful */
361 | CURLIOE_UNKNOWNCMD, /* command was unknown to callback */
362 | CURLIOE_FAILRESTART, /* failed to restart the read */
363 | CURLIOE_LAST /* never use */
364 | } curlioerr;
365 |
366 | typedef enum {
367 | CURLIOCMD_NOP, /* no operation */
368 | CURLIOCMD_RESTARTREAD, /* restart the read stream from start */
369 | CURLIOCMD_LAST /* never use */
370 | } curliocmd;
371 |
372 | typedef curlioerr (*curl_ioctl_callback)(CURL *handle,
373 | int cmd,
374 | void *clientp);
375 |
376 | /*
377 | * The following typedef's are signatures of malloc, free, realloc, strdup and
378 | * calloc respectively. Function pointers of these types can be passed to the
379 | * curl_global_init_mem() function to set user defined memory management
380 | * callback routines.
381 | */
382 | typedef void *(*curl_malloc_callback)(size_t size);
383 | typedef void (*curl_free_callback)(void *ptr);
384 | typedef void *(*curl_realloc_callback)(void *ptr, size_t size);
385 | typedef char *(*curl_strdup_callback)(const char *str);
386 | typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);
387 |
388 | /* the kind of data that is passed to information_callback*/
389 | typedef enum {
390 | CURLINFO_TEXT = 0,
391 | CURLINFO_HEADER_IN, /* 1 */
392 | CURLINFO_HEADER_OUT, /* 2 */
393 | CURLINFO_DATA_IN, /* 3 */
394 | CURLINFO_DATA_OUT, /* 4 */
395 | CURLINFO_SSL_DATA_IN, /* 5 */
396 | CURLINFO_SSL_DATA_OUT, /* 6 */
397 | CURLINFO_END
398 | } curl_infotype;
399 |
400 | typedef int (*curl_debug_callback)
401 | (CURL *handle, /* the handle/transfer this concerns */
402 | curl_infotype type, /* what kind of data */
403 | char *data, /* points to the data */
404 | size_t size, /* size of the data pointed to */
405 | void *userptr); /* whatever the user please */
406 |
407 | /* All possible error codes from all sorts of curl functions. Future versions
408 | may return other values, stay prepared.
409 |
410 | Always add new return codes last. Never *EVER* remove any. The return
411 | codes must remain the same!
412 | */
413 |
414 | typedef enum {
415 | CURLE_OK = 0,
416 | CURLE_UNSUPPORTED_PROTOCOL, /* 1 */
417 | CURLE_FAILED_INIT, /* 2 */
418 | CURLE_URL_MALFORMAT, /* 3 */
419 | CURLE_NOT_BUILT_IN, /* 4 - [was obsoleted in August 2007 for
420 | 7.17.0, reused in April 2011 for 7.21.5] */
421 | CURLE_COULDNT_RESOLVE_PROXY, /* 5 */
422 | CURLE_COULDNT_RESOLVE_HOST, /* 6 */
423 | CURLE_COULDNT_CONNECT, /* 7 */
424 | CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */
425 | CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server
426 | due to lack of access - when login fails
427 | this is not returned. */
428 | CURLE_FTP_ACCEPT_FAILED, /* 10 - [was obsoleted in April 2006 for
429 | 7.15.4, reused in Dec 2011 for 7.24.0]*/
430 | CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */
431 | CURLE_FTP_ACCEPT_TIMEOUT, /* 12 - timeout occurred accepting server
432 | [was obsoleted in August 2007 for 7.17.0,
433 | reused in Dec 2011 for 7.24.0]*/
434 | CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */
435 | CURLE_FTP_WEIRD_227_FORMAT, /* 14 */
436 | CURLE_FTP_CANT_GET_HOST, /* 15 */
437 | CURLE_HTTP2, /* 16 - A problem in the http2 framing layer.
438 | [was obsoleted in August 2007 for 7.17.0,
439 | reused in July 2014 for 7.38.0] */
440 | CURLE_FTP_COULDNT_SET_TYPE, /* 17 */
441 | CURLE_PARTIAL_FILE, /* 18 */
442 | CURLE_FTP_COULDNT_RETR_FILE, /* 19 */
443 | CURLE_OBSOLETE20, /* 20 - NOT USED */
444 | CURLE_QUOTE_ERROR, /* 21 - quote command failure */
445 | CURLE_HTTP_RETURNED_ERROR, /* 22 */
446 | CURLE_WRITE_ERROR, /* 23 */
447 | CURLE_OBSOLETE24, /* 24 - NOT USED */
448 | CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */
449 | CURLE_READ_ERROR, /* 26 - couldn't open/read from file */
450 | CURLE_OUT_OF_MEMORY, /* 27 */
451 | /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
452 | instead of a memory allocation error if CURL_DOES_CONVERSIONS
453 | is defined
454 | */
455 | CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was reached */
456 | CURLE_OBSOLETE29, /* 29 - NOT USED */
457 | CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */
458 | CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */
459 | CURLE_OBSOLETE32, /* 32 - NOT USED */
460 | CURLE_RANGE_ERROR, /* 33 - RANGE "command" didn't work */
461 | CURLE_HTTP_POST_ERROR, /* 34 */
462 | CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */
463 | CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */
464 | CURLE_FILE_COULDNT_READ_FILE, /* 37 */
465 | CURLE_LDAP_CANNOT_BIND, /* 38 */
466 | CURLE_LDAP_SEARCH_FAILED, /* 39 */
467 | CURLE_OBSOLETE40, /* 40 - NOT USED */
468 | CURLE_FUNCTION_NOT_FOUND, /* 41 */
469 | CURLE_ABORTED_BY_CALLBACK, /* 42 */
470 | CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */
471 | CURLE_OBSOLETE44, /* 44 - NOT USED */
472 | CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */
473 | CURLE_OBSOLETE46, /* 46 - NOT USED */
474 | CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */
475 | CURLE_UNKNOWN_OPTION, /* 48 - User specified an unknown option */
476 | CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */
477 | CURLE_OBSOLETE50, /* 50 - NOT USED */
478 | CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint
479 | wasn't verified fine */
480 | CURLE_GOT_NOTHING, /* 52 - when this is a specific error */
481 | CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */
482 | CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as
483 | default */
484 | CURLE_SEND_ERROR, /* 55 - failed sending network data */
485 | CURLE_RECV_ERROR, /* 56 - failure in receiving network data */
486 | CURLE_OBSOLETE57, /* 57 - NOT IN USE */
487 | CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */
488 | CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */
489 | CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */
490 | CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */
491 | CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */
492 | CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */
493 | CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */
494 | CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind
495 | that failed */
496 | CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */
497 | CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not
498 | accepted and we failed to login */
499 | CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */
500 | CURLE_TFTP_PERM, /* 69 - permission problem on server */
501 | CURLE_REMOTE_DISK_FULL, /* 70 - out of disk space on server */
502 | CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */
503 | CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */
504 | CURLE_REMOTE_FILE_EXISTS, /* 73 - File already exists */
505 | CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */
506 | CURLE_CONV_FAILED, /* 75 - conversion failed */
507 | CURLE_CONV_REQD, /* 76 - caller must register conversion
508 | callbacks using curl_easy_setopt options
509 | CURLOPT_CONV_FROM_NETWORK_FUNCTION,
510 | CURLOPT_CONV_TO_NETWORK_FUNCTION, and
511 | CURLOPT_CONV_FROM_UTF8_FUNCTION */
512 | CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing
513 | or wrong format */
514 | CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */
515 | CURLE_SSH, /* 79 - error from the SSH layer, somewhat
516 | generic so the error message will be of
517 | interest when this has happened */
518 |
519 | CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL
520 | connection */
521 | CURLE_AGAIN, /* 81 - socket is not ready for send/recv,
522 | wait till it's ready and try again (Added
523 | in 7.18.2) */
524 | CURLE_SSL_CRL_BADFILE, /* 82 - could not load CRL file, missing or
525 | wrong format (Added in 7.19.0) */
526 | CURLE_SSL_ISSUER_ERROR, /* 83 - Issuer check failed. (Added in
527 | 7.19.0) */
528 | CURLE_FTP_PRET_FAILED, /* 84 - a PRET command failed */
529 | CURLE_RTSP_CSEQ_ERROR, /* 85 - mismatch of RTSP CSeq numbers */
530 | CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Ids */
531 | CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */
532 | CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */
533 | CURLE_NO_CONNECTION_AVAILABLE, /* 89 - No connection available, the
534 | session will be queued */
535 | CURLE_SSL_PINNEDPUBKEYNOTMATCH, /* 90 - specified pinned public key did not
536 | match */
537 | CURLE_SSL_INVALIDCERTSTATUS, /* 91 - invalid certificate status */
538 | CURL_LAST /* never use! */
539 | } CURLcode;
540 |
541 | #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
542 | the obsolete stuff removed! */
543 |
544 | /* Previously obsolete error code re-used in 7.38.0 */
545 | #define CURLE_OBSOLETE16 CURLE_HTTP2
546 |
547 | /* Previously obsolete error codes re-used in 7.24.0 */
548 | #define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED
549 | #define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT
550 |
551 | /* compatibility with older names */
552 | #define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING
553 |
554 | /* The following were added in 7.21.5, April 2011 */
555 | #define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION
556 |
557 | /* The following were added in 7.17.1 */
558 | /* These are scheduled to disappear by 2009 */
559 | #define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION
560 |
561 | /* The following were added in 7.17.0 */
562 | /* These are scheduled to disappear by 2009 */
563 | #define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */
564 | #define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46
565 | #define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44
566 | #define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10
567 | #define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16
568 | #define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32
569 | #define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29
570 | #define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12
571 | #define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20
572 | #define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40
573 | #define CURLE_MALFORMAT_USER CURLE_OBSOLETE24
574 | #define CURLE_SHARE_IN_USE CURLE_OBSOLETE57
575 | #define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN
576 |
577 | #define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED
578 | #define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE
579 | #define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR
580 | #define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL
581 | #define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS
582 | #define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR
583 | #define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED
584 |
585 | /* The following were added earlier */
586 |
587 | #define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT
588 |
589 | #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
590 | #define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
591 | #define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED
592 |
593 | #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
594 | #define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
595 |
596 | /* This was the error code 50 in 7.7.3 and a few earlier versions, this
597 | is no longer used by libcurl but is instead #defined here only to not
598 | make programs break */
599 | #define CURLE_ALREADY_COMPLETE 99999
600 |
601 | /* Provide defines for really old option names */
602 | #define CURLOPT_FILE CURLOPT_WRITEDATA /* name changed in 7.9.7 */
603 | #define CURLOPT_INFILE CURLOPT_READDATA /* name changed in 7.9.7 */
604 | #define CURLOPT_WRITEHEADER CURLOPT_HEADERDATA
605 |
606 | /* Since long deprecated options with no code in the lib that does anything
607 | with them. */
608 | #define CURLOPT_WRITEINFO CURLOPT_OBSOLETE40
609 | #define CURLOPT_CLOSEPOLICY CURLOPT_OBSOLETE72
610 |
611 | #endif /*!CURL_NO_OLDIES*/
612 |
613 | /* This prototype applies to all conversion callbacks */
614 | typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);
615 |
616 | typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */
617 | void *ssl_ctx, /* actually an
618 | OpenSSL SSL_CTX */
619 | void *userptr);
620 |
621 | typedef enum {
622 | CURLPROXY_HTTP = 0, /* added in 7.10, new in 7.19.4 default is to use
623 | CONNECT HTTP/1.1 */
624 | CURLPROXY_HTTP_1_0 = 1, /* added in 7.19.4, force to use CONNECT
625 | HTTP/1.0 */
626 | CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already
627 | in 7.10 */
628 | CURLPROXY_SOCKS5 = 5, /* added in 7.10 */
629 | CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */
630 | CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the
631 | host name rather than the IP address. added
632 | in 7.18.0 */
633 | } curl_proxytype; /* this enum was added in 7.10 */
634 |
635 | /*
636 | * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options:
637 | *
638 | * CURLAUTH_NONE - No HTTP authentication
639 | * CURLAUTH_BASIC - HTTP Basic authentication (default)
640 | * CURLAUTH_DIGEST - HTTP Digest authentication
641 | * CURLAUTH_NEGOTIATE - HTTP Negotiate (SPNEGO) authentication
642 | * CURLAUTH_GSSNEGOTIATE - Alias for CURLAUTH_NEGOTIATE (deprecated)
643 | * CURLAUTH_NTLM - HTTP NTLM authentication
644 | * CURLAUTH_DIGEST_IE - HTTP Digest authentication with IE flavour
645 | * CURLAUTH_NTLM_WB - HTTP NTLM authentication delegated to winbind helper
646 | * CURLAUTH_ONLY - Use together with a single other type to force no
647 | * authentication or just that single type
648 | * CURLAUTH_ANY - All fine types set
649 | * CURLAUTH_ANYSAFE - All fine types except Basic
650 | */
651 |
652 | #define CURLAUTH_NONE ((unsigned long)0)
653 | #define CURLAUTH_BASIC (((unsigned long)1)<<0)
654 | #define CURLAUTH_DIGEST (((unsigned long)1)<<1)
655 | #define CURLAUTH_NEGOTIATE (((unsigned long)1)<<2)
656 | /* Deprecated since the advent of CURLAUTH_NEGOTIATE */
657 | #define CURLAUTH_GSSNEGOTIATE CURLAUTH_NEGOTIATE
658 | #define CURLAUTH_NTLM (((unsigned long)1)<<3)
659 | #define CURLAUTH_DIGEST_IE (((unsigned long)1)<<4)
660 | #define CURLAUTH_NTLM_WB (((unsigned long)1)<<5)
661 | #define CURLAUTH_ONLY (((unsigned long)1)<<31)
662 | #define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE)
663 | #define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
664 |
665 | #define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */
666 | #define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */
667 | #define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */
668 | #define CURLSSH_AUTH_PASSWORD (1<<1) /* password */
669 | #define CURLSSH_AUTH_HOST (1<<2) /* host key files */
670 | #define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */
671 | #define CURLSSH_AUTH_AGENT (1<<4) /* agent (ssh-agent, pageant...) */
672 | #define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY
673 |
674 | #define CURLGSSAPI_DELEGATION_NONE 0 /* no delegation (default) */
675 | #define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */
676 | #define CURLGSSAPI_DELEGATION_FLAG (1<<1) /* delegate always */
677 |
678 | #define CURL_ERROR_SIZE 256
679 |
680 | enum curl_khtype {
681 | CURLKHTYPE_UNKNOWN,
682 | CURLKHTYPE_RSA1,
683 | CURLKHTYPE_RSA,
684 | CURLKHTYPE_DSS
685 | };
686 |
687 | struct curl_khkey {
688 | const char *key; /* points to a zero-terminated string encoded with base64
689 | if len is zero, otherwise to the "raw" data */
690 | size_t len;
691 | enum curl_khtype keytype;
692 | };
693 |
694 | /* this is the set of return values expected from the curl_sshkeycallback
695 | callback */
696 | enum curl_khstat {
697 | CURLKHSTAT_FINE_ADD_TO_FILE,
698 | CURLKHSTAT_FINE,
699 | CURLKHSTAT_REJECT, /* reject the connection, return an error */
700 | CURLKHSTAT_DEFER, /* do not accept it, but we can't answer right now so
701 | this causes a CURLE_DEFER error but otherwise the
702 | connection will be left intact etc */
703 | CURLKHSTAT_LAST /* not for use, only a marker for last-in-list */
704 | };
705 |
706 | /* this is the set of status codes pass in to the callback */
707 | enum curl_khmatch {
708 | CURLKHMATCH_OK, /* match */
709 | CURLKHMATCH_MISMATCH, /* host found, key mismatch! */
710 | CURLKHMATCH_MISSING, /* no matching host/key found */
711 | CURLKHMATCH_LAST /* not for use, only a marker for last-in-list */
712 | };
713 |
714 | typedef int
715 | (*curl_sshkeycallback) (CURL *easy, /* easy handle */
716 | const struct curl_khkey *knownkey, /* known */
717 | const struct curl_khkey *foundkey, /* found */
718 | enum curl_khmatch, /* libcurl's view on the keys */
719 | void *clientp); /* custom pointer passed from app */
720 |
721 | /* parameter for the CURLOPT_USE_SSL option */
722 | typedef enum {
723 | CURLUSESSL_NONE, /* do not attempt to use SSL */
724 | CURLUSESSL_TRY, /* try using SSL, proceed anyway otherwise */
725 | CURLUSESSL_CONTROL, /* SSL for the control connection or fail */
726 | CURLUSESSL_ALL, /* SSL for all communication or fail */
727 | CURLUSESSL_LAST /* not an option, never use */
728 | } curl_usessl;
729 |
730 | /* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */
731 |
732 | /* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the
733 | name of improving interoperability with older servers. Some SSL libraries
734 | have introduced work-arounds for this flaw but those work-arounds sometimes
735 | make the SSL communication fail. To regain functionality with those broken
736 | servers, a user can this way allow the vulnerability back. */
737 | #define CURLSSLOPT_ALLOW_BEAST (1<<0)
738 |
739 | /* - NO_REVOKE tells libcurl to disable certificate revocation checks for those
740 | SSL backends where such behavior is present. */
741 | #define CURLSSLOPT_NO_REVOKE (1<<1)
742 |
743 | #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
744 | the obsolete stuff removed! */
745 |
746 | /* Backwards compatibility with older names */
747 | /* These are scheduled to disappear by 2009 */
748 |
749 | #define CURLFTPSSL_NONE CURLUSESSL_NONE
750 | #define CURLFTPSSL_TRY CURLUSESSL_TRY
751 | #define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL
752 | #define CURLFTPSSL_ALL CURLUSESSL_ALL
753 | #define CURLFTPSSL_LAST CURLUSESSL_LAST
754 | #define curl_ftpssl curl_usessl
755 | #endif /*!CURL_NO_OLDIES*/
756 |
757 | /* parameter for the CURLOPT_FTP_SSL_CCC option */
758 | typedef enum {
759 | CURLFTPSSL_CCC_NONE, /* do not send CCC */
760 | CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */
761 | CURLFTPSSL_CCC_ACTIVE, /* Initiate the shutdown */
762 | CURLFTPSSL_CCC_LAST /* not an option, never use */
763 | } curl_ftpccc;
764 |
765 | /* parameter for the CURLOPT_FTPSSLAUTH option */
766 | typedef enum {
767 | CURLFTPAUTH_DEFAULT, /* let libcurl decide */
768 | CURLFTPAUTH_SSL, /* use "AUTH SSL" */
769 | CURLFTPAUTH_TLS, /* use "AUTH TLS" */
770 | CURLFTPAUTH_LAST /* not an option, never use */
771 | } curl_ftpauth;
772 |
773 | /* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */
774 | typedef enum {
775 | CURLFTP_CREATE_DIR_NONE, /* do NOT create missing dirs! */
776 | CURLFTP_CREATE_DIR, /* (FTP/SFTP) if CWD fails, try MKD and then CWD
777 | again if MKD succeeded, for SFTP this does
778 | similar magic */
779 | CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD
780 | again even if MKD failed! */
781 | CURLFTP_CREATE_DIR_LAST /* not an option, never use */
782 | } curl_ftpcreatedir;
783 |
784 | /* parameter for the CURLOPT_FTP_FILEMETHOD option */
785 | typedef enum {
786 | CURLFTPMETHOD_DEFAULT, /* let libcurl pick */
787 | CURLFTPMETHOD_MULTICWD, /* single CWD operation for each path part */
788 | CURLFTPMETHOD_NOCWD, /* no CWD at all */
789 | CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */
790 | CURLFTPMETHOD_LAST /* not an option, never use */
791 | } curl_ftpmethod;
792 |
793 | /* bitmask defines for CURLOPT_HEADEROPT */
794 | #define CURLHEADER_UNIFIED 0
795 | #define CURLHEADER_SEPARATE (1<<0)
796 |
797 | /* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */
798 | #define CURLPROTO_HTTP (1<<0)
799 | #define CURLPROTO_HTTPS (1<<1)
800 | #define CURLPROTO_FTP (1<<2)
801 | #define CURLPROTO_FTPS (1<<3)
802 | #define CURLPROTO_SCP (1<<4)
803 | #define CURLPROTO_SFTP (1<<5)
804 | #define CURLPROTO_TELNET (1<<6)
805 | #define CURLPROTO_LDAP (1<<7)
806 | #define CURLPROTO_LDAPS (1<<8)
807 | #define CURLPROTO_DICT (1<<9)
808 | #define CURLPROTO_FILE (1<<10)
809 | #define CURLPROTO_TFTP (1<<11)
810 | #define CURLPROTO_IMAP (1<<12)
811 | #define CURLPROTO_IMAPS (1<<13)
812 | #define CURLPROTO_POP3 (1<<14)
813 | #define CURLPROTO_POP3S (1<<15)
814 | #define CURLPROTO_SMTP (1<<16)
815 | #define CURLPROTO_SMTPS (1<<17)
816 | #define CURLPROTO_RTSP (1<<18)
817 | #define CURLPROTO_RTMP (1<<19)
818 | #define CURLPROTO_RTMPT (1<<20)
819 | #define CURLPROTO_RTMPE (1<<21)
820 | #define CURLPROTO_RTMPTE (1<<22)
821 | #define CURLPROTO_RTMPS (1<<23)
822 | #define CURLPROTO_RTMPTS (1<<24)
823 | #define CURLPROTO_GOPHER (1<<25)
824 | #define CURLPROTO_SMB (1<<26)
825 | #define CURLPROTO_SMBS (1<<27)
826 | #define CURLPROTO_ALL (~0) /* enable everything */
827 |
828 | /* long may be 32 or 64 bits, but we should never depend on anything else
829 | but 32 */
830 | #define CURLOPTTYPE_LONG 0
831 | #define CURLOPTTYPE_OBJECTPOINT 10000
832 | #define CURLOPTTYPE_STRINGPOINT 10000
833 | #define CURLOPTTYPE_FUNCTIONPOINT 20000
834 | #define CURLOPTTYPE_OFF_T 30000
835 |
836 | /* *STRINGPOINT is an alias for OBJECTPOINT to allow tools to extract the
837 | string options from the header file */
838 |
839 | /* name is uppercase CURLOPT_,
840 | type is one of the defined CURLOPTTYPE_
841 | number is unique identifier */
842 | #ifdef CINIT
843 | #undef CINIT
844 | #endif
845 |
846 | #ifdef CURL_ISOCPP
847 | #define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu
848 | #else
849 | /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
850 | #define LONG CURLOPTTYPE_LONG
851 | #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
852 | #define STRINGPOINT CURLOPTTYPE_OBJECTPOINT
853 | #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
854 | #define OFF_T CURLOPTTYPE_OFF_T
855 | #define CINIT(name,type,number) CURLOPT_/**/name = type + number
856 | #endif
857 |
858 | /*
859 | * This macro-mania below setups the CURLOPT_[what] enum, to be used with
860 | * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]
861 | * word.
862 | */
863 |
864 | typedef enum {
865 | /* This is the FILE * or void * the regular output should be written to. */
866 | CINIT(WRITEDATA, OBJECTPOINT, 1),
867 |
868 | /* The full URL to get/put */
869 | CINIT(URL, STRINGPOINT, 2),
870 |
871 | /* Port number to connect to, if other than default. */
872 | CINIT(PORT, LONG, 3),
873 |
874 | /* Name of proxy to use. */
875 | CINIT(PROXY, STRINGPOINT, 4),
876 |
877 | /* "user:password;options" to use when fetching. */
878 | CINIT(USERPWD, STRINGPOINT, 5),
879 |
880 | /* "user:password" to use with proxy. */
881 | CINIT(PROXYUSERPWD, STRINGPOINT, 6),
882 |
883 | /* Range to get, specified as an ASCII string. */
884 | CINIT(RANGE, STRINGPOINT, 7),
885 |
886 | /* not used */
887 |
888 | /* Specified file stream to upload from (use as input): */
889 | CINIT(READDATA, OBJECTPOINT, 9),
890 |
891 | /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
892 | * bytes big. If this is not used, error messages go to stderr instead: */
893 | CINIT(ERRORBUFFER, OBJECTPOINT, 10),
894 |
895 | /* Function that will be called to store the output (instead of fwrite). The
896 | * parameters will use fwrite() syntax, make sure to follow them. */
897 | CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),
898 |
899 | /* Function that will be called to read the input (instead of fread). The
900 | * parameters will use fread() syntax, make sure to follow them. */
901 | CINIT(READFUNCTION, FUNCTIONPOINT, 12),
902 |
903 | /* Time-out the read operation after this amount of seconds */
904 | CINIT(TIMEOUT, LONG, 13),
905 |
906 | /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
907 | * how large the file being sent really is. That allows better error
908 | * checking and better verifies that the upload was successful. -1 means
909 | * unknown size.
910 | *
911 | * For large file support, there is also a _LARGE version of the key
912 | * which takes an off_t type, allowing platforms with larger off_t
913 | * sizes to handle larger files. See below for INFILESIZE_LARGE.
914 | */
915 | CINIT(INFILESIZE, LONG, 14),
916 |
917 | /* POST static input fields. */
918 | CINIT(POSTFIELDS, OBJECTPOINT, 15),
919 |
920 | /* Set the referrer page (needed by some CGIs) */
921 | CINIT(REFERER, STRINGPOINT, 16),
922 |
923 | /* Set the FTP PORT string (interface name, named or numerical IP address)
924 | Use i.e '-' to use default address. */
925 | CINIT(FTPPORT, STRINGPOINT, 17),
926 |
927 | /* Set the User-Agent string (examined by some CGIs) */
928 | CINIT(USERAGENT, STRINGPOINT, 18),
929 |
930 | /* If the download receives less than "low speed limit" bytes/second
931 | * during "low speed time" seconds, the operations is aborted.
932 | * You could i.e if you have a pretty high speed connection, abort if
933 | * it is less than 2000 bytes/sec during 20 seconds.
934 | */
935 |
936 | /* Set the "low speed limit" */
937 | CINIT(LOW_SPEED_LIMIT, LONG, 19),
938 |
939 | /* Set the "low speed time" */
940 | CINIT(LOW_SPEED_TIME, LONG, 20),
941 |
942 | /* Set the continuation offset.
943 | *
944 | * Note there is also a _LARGE version of this key which uses
945 | * off_t types, allowing for large file offsets on platforms which
946 | * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE.
947 | */
948 | CINIT(RESUME_FROM, LONG, 21),
949 |
950 | /* Set cookie in request: */
951 | CINIT(COOKIE, STRINGPOINT, 22),
952 |
953 | /* This points to a linked list of headers, struct curl_slist kind. This
954 | list is also used for RTSP (in spite of its name) */
955 | CINIT(HTTPHEADER, OBJECTPOINT, 23),
956 |
957 | /* This points to a linked list of post entries, struct curl_httppost */
958 | CINIT(HTTPPOST, OBJECTPOINT, 24),
959 |
960 | /* name of the file keeping your private SSL-certificate */
961 | CINIT(SSLCERT, STRINGPOINT, 25),
962 |
963 | /* password for the SSL or SSH private key */
964 | CINIT(KEYPASSWD, STRINGPOINT, 26),
965 |
966 | /* send TYPE parameter? */
967 | CINIT(CRLF, LONG, 27),
968 |
969 | /* send linked-list of QUOTE commands */
970 | CINIT(QUOTE, OBJECTPOINT, 28),
971 |
972 | /* send FILE * or void * to store headers to, if you use a callback it
973 | is simply passed to the callback unmodified */
974 | CINIT(HEADERDATA, OBJECTPOINT, 29),
975 |
976 | /* point to a file to read the initial cookies from, also enables
977 | "cookie awareness" */
978 | CINIT(COOKIEFILE, STRINGPOINT, 31),
979 |
980 | /* What version to specifically try to use.
981 | See CURL_SSLVERSION defines below. */
982 | CINIT(SSLVERSION, LONG, 32),
983 |
984 | /* What kind of HTTP time condition to use, see defines */
985 | CINIT(TIMECONDITION, LONG, 33),
986 |
987 | /* Time to use with the above condition. Specified in number of seconds
988 | since 1 Jan 1970 */
989 | CINIT(TIMEVALUE, LONG, 34),
990 |
991 | /* 35 = OBSOLETE */
992 |
993 | /* Custom request, for customizing the get command like
994 | HTTP: DELETE, TRACE and others
995 | FTP: to use a different list command
996 | */
997 | CINIT(CUSTOMREQUEST, STRINGPOINT, 36),
998 |
999 | /* FILE handle to use instead of stderr */
1000 | CINIT(STDERR, OBJECTPOINT, 37),
1001 |
1002 | /* 38 is not used */
1003 |
1004 | /* send linked-list of post-transfer QUOTE commands */
1005 | CINIT(POSTQUOTE, OBJECTPOINT, 39),
1006 |
1007 | CINIT(OBSOLETE40, OBJECTPOINT, 40), /* OBSOLETE, do not use! */
1008 |
1009 | CINIT(VERBOSE, LONG, 41), /* talk a lot */
1010 | CINIT(HEADER, LONG, 42), /* throw the header out too */
1011 | CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */
1012 | CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */
1013 | CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 400 */
1014 | CINIT(UPLOAD, LONG, 46), /* this is an upload */
1015 | CINIT(POST, LONG, 47), /* HTTP POST method */
1016 | CINIT(DIRLISTONLY, LONG, 48), /* bare names when listing directories */
1017 |
1018 | CINIT(APPEND, LONG, 50), /* Append instead of overwrite on upload! */
1019 |
1020 | /* Specify whether to read the user+password from the .netrc or the URL.
1021 | * This must be one of the CURL_NETRC_* enums below. */
1022 | CINIT(NETRC, LONG, 51),
1023 |
1024 | CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */
1025 |
1026 | CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
1027 | CINIT(PUT, LONG, 54), /* HTTP PUT */
1028 |
1029 | /* 55 = OBSOLETE */
1030 |
1031 | /* DEPRECATED
1032 | * Function that will be called instead of the internal progress display
1033 | * function. This function should be defined as the curl_progress_callback
1034 | * prototype defines. */
1035 | CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
1036 |
1037 | /* Data passed to the CURLOPT_PROGRESSFUNCTION and CURLOPT_XFERINFOFUNCTION
1038 | callbacks */
1039 | CINIT(PROGRESSDATA, OBJECTPOINT, 57),
1040 | #define CURLOPT_XFERINFODATA CURLOPT_PROGRESSDATA
1041 |
1042 | /* We want the referrer field set automatically when following locations */
1043 | CINIT(AUTOREFERER, LONG, 58),
1044 |
1045 | /* Port of the proxy, can be set in the proxy string as well with:
1046 | "[host]:[port]" */
1047 | CINIT(PROXYPORT, LONG, 59),
1048 |
1049 | /* size of the POST input data, if strlen() is not good to use */
1050 | CINIT(POSTFIELDSIZE, LONG, 60),
1051 |
1052 | /* tunnel non-http operations through a HTTP proxy */
1053 | CINIT(HTTPPROXYTUNNEL, LONG, 61),
1054 |
1055 | /* Set the interface string to use as outgoing network interface */
1056 | CINIT(INTERFACE, STRINGPOINT, 62),
1057 |
1058 | /* Set the krb4/5 security level, this also enables krb4/5 awareness. This
1059 | * is a string, 'clear', 'safe', 'confidential' or 'private'. If the string
1060 | * is set but doesn't match one of these, 'private' will be used. */
1061 | CINIT(KRBLEVEL, STRINGPOINT, 63),
1062 |
1063 | /* Set if we should verify the peer in ssl handshake, set 1 to verify. */
1064 | CINIT(SSL_VERIFYPEER, LONG, 64),
1065 |
1066 | /* The CApath or CAfile used to validate the peer certificate
1067 | this option is used only if SSL_VERIFYPEER is true */
1068 | CINIT(CAINFO, STRINGPOINT, 65),
1069 |
1070 | /* 66 = OBSOLETE */
1071 | /* 67 = OBSOLETE */
1072 |
1073 | /* Maximum number of http redirects to follow */
1074 | CINIT(MAXREDIRS, LONG, 68),
1075 |
1076 | /* Pass a long set to 1 to get the date of the requested document (if
1077 | possible)! Pass a zero to shut it off. */
1078 | CINIT(FILETIME, LONG, 69),
1079 |
1080 | /* This points to a linked list of telnet options */
1081 | CINIT(TELNETOPTIONS, OBJECTPOINT, 70),
1082 |
1083 | /* Max amount of cached alive connections */
1084 | CINIT(MAXCONNECTS, LONG, 71),
1085 |
1086 | CINIT(OBSOLETE72, LONG, 72), /* OBSOLETE, do not use! */
1087 |
1088 | /* 73 = OBSOLETE */
1089 |
1090 | /* Set to explicitly use a new connection for the upcoming transfer.
1091 | Do not use this unless you're absolutely sure of this, as it makes the
1092 | operation slower and is less friendly for the network. */
1093 | CINIT(FRESH_CONNECT, LONG, 74),
1094 |
1095 | /* Set to explicitly forbid the upcoming transfer's connection to be re-used
1096 | when done. Do not use this unless you're absolutely sure of this, as it
1097 | makes the operation slower and is less friendly for the network. */
1098 | CINIT(FORBID_REUSE, LONG, 75),
1099 |
1100 | /* Set to a file name that contains random data for libcurl to use to
1101 | seed the random engine when doing SSL connects. */
1102 | CINIT(RANDOM_FILE, STRINGPOINT, 76),
1103 |
1104 | /* Set to the Entropy Gathering Daemon socket pathname */
1105 | CINIT(EGDSOCKET, STRINGPOINT, 77),
1106 |
1107 | /* Time-out connect operations after this amount of seconds, if connects are
1108 | OK within this time, then fine... This only aborts the connect phase. */
1109 | CINIT(CONNECTTIMEOUT, LONG, 78),
1110 |
1111 | /* Function that will be called to store headers (instead of fwrite). The
1112 | * parameters will use fwrite() syntax, make sure to follow them. */
1113 | CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),
1114 |
1115 | /* Set this to force the HTTP request to get back to GET. Only really usable
1116 | if POST, PUT or a custom request have been used first.
1117 | */
1118 | CINIT(HTTPGET, LONG, 80),
1119 |
1120 | /* Set if we should verify the Common name from the peer certificate in ssl
1121 | * handshake, set 1 to check existence, 2 to ensure that it matches the
1122 | * provided hostname. */
1123 | CINIT(SSL_VERIFYHOST, LONG, 81),
1124 |
1125 | /* Specify which file name to write all known cookies in after completed
1126 | operation. Set file name to "-" (dash) to make it go to stdout. */
1127 | CINIT(COOKIEJAR, STRINGPOINT, 82),
1128 |
1129 | /* Specify which SSL ciphers to use */
1130 | CINIT(SSL_CIPHER_LIST, STRINGPOINT, 83),
1131 |
1132 | /* Specify which HTTP version to use! This must be set to one of the
1133 | CURL_HTTP_VERSION* enums set below. */
1134 | CINIT(HTTP_VERSION, LONG, 84),
1135 |
1136 | /* Specifically switch on or off the FTP engine's use of the EPSV command. By
1137 | default, that one will always be attempted before the more traditional
1138 | PASV command. */
1139 | CINIT(FTP_USE_EPSV, LONG, 85),
1140 |
1141 | /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */
1142 | CINIT(SSLCERTTYPE, STRINGPOINT, 86),
1143 |
1144 | /* name of the file keeping your private SSL-key */
1145 | CINIT(SSLKEY, STRINGPOINT, 87),
1146 |
1147 | /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */
1148 | CINIT(SSLKEYTYPE, STRINGPOINT, 88),
1149 |
1150 | /* crypto engine for the SSL-sub system */
1151 | CINIT(SSLENGINE, STRINGPOINT, 89),
1152 |
1153 | /* set the crypto engine for the SSL-sub system as default
1154 | the param has no meaning...
1155 | */
1156 | CINIT(SSLENGINE_DEFAULT, LONG, 90),
1157 |
1158 | /* Non-zero value means to use the global dns cache */
1159 | CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */
1160 |
1161 | /* DNS cache timeout */
1162 | CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
1163 |
1164 | /* send linked-list of pre-transfer QUOTE commands */
1165 | CINIT(PREQUOTE, OBJECTPOINT, 93),
1166 |
1167 | /* set the debug function */
1168 | CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),
1169 |
1170 | /* set the data for the debug function */
1171 | CINIT(DEBUGDATA, OBJECTPOINT, 95),
1172 |
1173 | /* mark this as start of a cookie session */
1174 | CINIT(COOKIESESSION, LONG, 96),
1175 |
1176 | /* The CApath directory used to validate the peer certificate
1177 | this option is used only if SSL_VERIFYPEER is true */
1178 | CINIT(CAPATH, STRINGPOINT, 97),
1179 |
1180 | /* Instruct libcurl to use a smaller receive buffer */
1181 | CINIT(BUFFERSIZE, LONG, 98),
1182 |
1183 | /* Instruct libcurl to not use any signal/alarm handlers, even when using
1184 | timeouts. This option is useful for multi-threaded applications.
1185 | See libcurl-the-guide for more background information. */
1186 | CINIT(NOSIGNAL, LONG, 99),
1187 |
1188 | /* Provide a CURLShare for mutexing non-ts data */
1189 | CINIT(SHARE, OBJECTPOINT, 100),
1190 |
1191 | /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
1192 | CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */
1193 | CINIT(PROXYTYPE, LONG, 101),
1194 |
1195 | /* Set the Accept-Encoding string. Use this to tell a server you would like
1196 | the response to be compressed. Before 7.21.6, this was known as
1197 | CURLOPT_ENCODING */
1198 | CINIT(ACCEPT_ENCODING, STRINGPOINT, 102),
1199 |
1200 | /* Set pointer to private data */
1201 | CINIT(PRIVATE, OBJECTPOINT, 103),
1202 |
1203 | /* Set aliases for HTTP 200 in the HTTP Response header */
1204 | CINIT(HTTP200ALIASES, OBJECTPOINT, 104),
1205 |
1206 | /* Continue to send authentication (user+password) when following locations,
1207 | even when hostname changed. This can potentially send off the name
1208 | and password to whatever host the server decides. */
1209 | CINIT(UNRESTRICTED_AUTH, LONG, 105),
1210 |
1211 | /* Specifically switch on or off the FTP engine's use of the EPRT command (
1212 | it also disables the LPRT attempt). By default, those ones will always be
1213 | attempted before the good old traditional PORT command. */
1214 | CINIT(FTP_USE_EPRT, LONG, 106),
1215 |
1216 | /* Set this to a bitmask value to enable the particular authentications
1217 | methods you like. Use this in combination with CURLOPT_USERPWD.
1218 | Note that setting multiple bits may cause extra network round-trips. */
1219 | CINIT(HTTPAUTH, LONG, 107),
1220 |
1221 | /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx
1222 | in second argument. The function must be matching the
1223 | curl_ssl_ctx_callback proto. */
1224 | CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),
1225 |
1226 | /* Set the userdata for the ssl context callback function's third
1227 | argument */
1228 | CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),
1229 |
1230 | /* FTP Option that causes missing dirs to be created on the remote server.
1231 | In 7.19.4 we introduced the convenience enums for this option using the
1232 | CURLFTP_CREATE_DIR prefix.
1233 | */
1234 | CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),
1235 |
1236 | /* Set this to a bitmask value to enable the particular authentications
1237 | methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.
1238 | Note that setting multiple bits may cause extra network round-trips. */
1239 | CINIT(PROXYAUTH, LONG, 111),
1240 |
1241 | /* FTP option that changes the timeout, in seconds, associated with
1242 | getting a response. This is different from transfer timeout time and
1243 | essentially places a demand on the FTP server to acknowledge commands
1244 | in a timely manner. */
1245 | CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),
1246 | #define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT
1247 |
1248 | /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
1249 | tell libcurl to resolve names to those IP versions only. This only has
1250 | affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
1251 | CINIT(IPRESOLVE, LONG, 113),
1252 |
1253 | /* Set this option to limit the size of a file that will be downloaded from
1254 | an HTTP or FTP server.
1255 |
1256 | Note there is also _LARGE version which adds large file support for
1257 | platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */
1258 | CINIT(MAXFILESIZE, LONG, 114),
1259 |
1260 | /* See the comment for INFILESIZE above, but in short, specifies
1261 | * the size of the file being uploaded. -1 means unknown.
1262 | */
1263 | CINIT(INFILESIZE_LARGE, OFF_T, 115),
1264 |
1265 | /* Sets the continuation offset. There is also a LONG version of this;
1266 | * look above for RESUME_FROM.
1267 | */
1268 | CINIT(RESUME_FROM_LARGE, OFF_T, 116),
1269 |
1270 | /* Sets the maximum size of data that will be downloaded from
1271 | * an HTTP or FTP server. See MAXFILESIZE above for the LONG version.
1272 | */
1273 | CINIT(MAXFILESIZE_LARGE, OFF_T, 117),
1274 |
1275 | /* Set this option to the file name of your .netrc file you want libcurl
1276 | to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
1277 | a poor attempt to find the user's home directory and check for a .netrc
1278 | file in there. */
1279 | CINIT(NETRC_FILE, STRINGPOINT, 118),
1280 |
1281 | /* Enable SSL/TLS for FTP, pick one of:
1282 | CURLUSESSL_TRY - try using SSL, proceed anyway otherwise
1283 | CURLUSESSL_CONTROL - SSL for the control connection or fail
1284 | CURLUSESSL_ALL - SSL for all communication or fail
1285 | */
1286 | CINIT(USE_SSL, LONG, 119),
1287 |
1288 | /* The _LARGE version of the standard POSTFIELDSIZE option */
1289 | CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),
1290 |
1291 | /* Enable/disable the TCP Nagle algorithm */
1292 | CINIT(TCP_NODELAY, LONG, 121),
1293 |
1294 | /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
1295 | /* 123 OBSOLETE. Gone in 7.16.0 */
1296 | /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
1297 | /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
1298 | /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
1299 | /* 127 OBSOLETE. Gone in 7.16.0 */
1300 | /* 128 OBSOLETE. Gone in 7.16.0 */
1301 |
1302 | /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option
1303 | can be used to change libcurl's default action which is to first try
1304 | "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK
1305 | response has been received.
1306 |
1307 | Available parameters are:
1308 | CURLFTPAUTH_DEFAULT - let libcurl decide
1309 | CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS
1310 | CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL
1311 | */
1312 | CINIT(FTPSSLAUTH, LONG, 129),
1313 |
1314 | CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),
1315 | CINIT(IOCTLDATA, OBJECTPOINT, 131),
1316 |
1317 | /* 132 OBSOLETE. Gone in 7.16.0 */
1318 | /* 133 OBSOLETE. Gone in 7.16.0 */
1319 |
1320 | /* zero terminated string for pass on to the FTP server when asked for
1321 | "account" info */
1322 | CINIT(FTP_ACCOUNT, STRINGPOINT, 134),
1323 |
1324 | /* feed cookie into cookie engine */
1325 | CINIT(COOKIELIST, STRINGPOINT, 135),
1326 |
1327 | /* ignore Content-Length */
1328 | CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),
1329 |
1330 | /* Set to non-zero to skip the IP address received in a 227 PASV FTP server
1331 | response. Typically used for FTP-SSL purposes but is not restricted to
1332 | that. libcurl will then instead use the same IP address it used for the
1333 | control connection. */
1334 | CINIT(FTP_SKIP_PASV_IP, LONG, 137),
1335 |
1336 | /* Select "file method" to use when doing FTP, see the curl_ftpmethod
1337 | above. */
1338 | CINIT(FTP_FILEMETHOD, LONG, 138),
1339 |
1340 | /* Local port number to bind the socket to */
1341 | CINIT(LOCALPORT, LONG, 139),
1342 |
1343 | /* Number of ports to try, including the first one set with LOCALPORT.
1344 | Thus, setting it to 1 will make no additional attempts but the first.
1345 | */
1346 | CINIT(LOCALPORTRANGE, LONG, 140),
1347 |
1348 | /* no transfer, set up connection and let application use the socket by
1349 | extracting it with CURLINFO_LASTSOCKET */
1350 | CINIT(CONNECT_ONLY, LONG, 141),
1351 |
1352 | /* Function that will be called to convert from the
1353 | network encoding (instead of using the iconv calls in libcurl) */
1354 | CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142),
1355 |
1356 | /* Function that will be called to convert to the
1357 | network encoding (instead of using the iconv calls in libcurl) */
1358 | CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143),
1359 |
1360 | /* Function that will be called to convert from UTF8
1361 | (instead of using the iconv calls in libcurl)
1362 | Note that this is used only for SSL certificate processing */
1363 | CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),
1364 |
1365 | /* if the connection proceeds too quickly then need to slow it down */
1366 | /* limit-rate: maximum number of bytes per second to send or receive */
1367 | CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),
1368 | CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),
1369 |
1370 | /* Pointer to command string to send if USER/PASS fails. */
1371 | CINIT(FTP_ALTERNATIVE_TO_USER, STRINGPOINT, 147),
1372 |
1373 | /* callback function for setting socket options */
1374 | CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),
1375 | CINIT(SOCKOPTDATA, OBJECTPOINT, 149),
1376 |
1377 | /* set to 0 to disable session ID re-use for this transfer, default is
1378 | enabled (== 1) */
1379 | CINIT(SSL_SESSIONID_CACHE, LONG, 150),
1380 |
1381 | /* allowed SSH authentication methods */
1382 | CINIT(SSH_AUTH_TYPES, LONG, 151),
1383 |
1384 | /* Used by scp/sftp to do public/private key authentication */
1385 | CINIT(SSH_PUBLIC_KEYFILE, STRINGPOINT, 152),
1386 | CINIT(SSH_PRIVATE_KEYFILE, STRINGPOINT, 153),
1387 |
1388 | /* Send CCC (Clear Command Channel) after authentication */
1389 | CINIT(FTP_SSL_CCC, LONG, 154),
1390 |
1391 | /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */
1392 | CINIT(TIMEOUT_MS, LONG, 155),
1393 | CINIT(CONNECTTIMEOUT_MS, LONG, 156),
1394 |
1395 | /* set to zero to disable the libcurl's decoding and thus pass the raw body
1396 | data to the application even when it is encoded/compressed */
1397 | CINIT(HTTP_TRANSFER_DECODING, LONG, 157),
1398 | CINIT(HTTP_CONTENT_DECODING, LONG, 158),
1399 |
1400 | /* Permission used when creating new files and directories on the remote
1401 | server for protocols that support it, SFTP/SCP/FILE */
1402 | CINIT(NEW_FILE_PERMS, LONG, 159),
1403 | CINIT(NEW_DIRECTORY_PERMS, LONG, 160),
1404 |
1405 | /* Set the behaviour of POST when redirecting. Values must be set to one
1406 | of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */
1407 | CINIT(POSTREDIR, LONG, 161),
1408 |
1409 | /* used by scp/sftp to verify the host's public key */
1410 | CINIT(SSH_HOST_PUBLIC_KEY_MD5, STRINGPOINT, 162),
1411 |
1412 | /* Callback function for opening socket (instead of socket(2)). Optionally,
1413 | callback is able change the address or refuse to connect returning
1414 | CURL_SOCKET_BAD. The callback should have type
1415 | curl_opensocket_callback */
1416 | CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),
1417 | CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),
1418 |
1419 | /* POST volatile input fields. */
1420 | CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165),
1421 |
1422 | /* set transfer mode (;type=) when doing FTP via an HTTP proxy */
1423 | CINIT(PROXY_TRANSFER_MODE, LONG, 166),
1424 |
1425 | /* Callback function for seeking in the input stream */
1426 | CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),
1427 | CINIT(SEEKDATA, OBJECTPOINT, 168),
1428 |
1429 | /* CRL file */
1430 | CINIT(CRLFILE, STRINGPOINT, 169),
1431 |
1432 | /* Issuer certificate */
1433 | CINIT(ISSUERCERT, STRINGPOINT, 170),
1434 |
1435 | /* (IPv6) Address scope */
1436 | CINIT(ADDRESS_SCOPE, LONG, 171),
1437 |
1438 | /* Collect certificate chain info and allow it to get retrievable with
1439 | CURLINFO_CERTINFO after the transfer is complete. */
1440 | CINIT(CERTINFO, LONG, 172),
1441 |
1442 | /* "name" and "pwd" to use when fetching. */
1443 | CINIT(USERNAME, STRINGPOINT, 173),
1444 | CINIT(PASSWORD, STRINGPOINT, 174),
1445 |
1446 | /* "name" and "pwd" to use with Proxy when fetching. */
1447 | CINIT(PROXYUSERNAME, STRINGPOINT, 175),
1448 | CINIT(PROXYPASSWORD, STRINGPOINT, 176),
1449 |
1450 | /* Comma separated list of hostnames defining no-proxy zones. These should
1451 | match both hostnames directly, and hostnames within a domain. For
1452 | example, local.com will match local.com and www.local.com, but NOT
1453 | notlocal.com or www.notlocal.com. For compatibility with other
1454 | implementations of this, .local.com will be considered to be the same as
1455 | local.com. A single * is the only valid wildcard, and effectively
1456 | disables the use of proxy. */
1457 | CINIT(NOPROXY, STRINGPOINT, 177),
1458 |
1459 | /* block size for TFTP transfers */
1460 | CINIT(TFTP_BLKSIZE, LONG, 178),
1461 |
1462 | /* Socks Service */
1463 | CINIT(SOCKS5_GSSAPI_SERVICE, STRINGPOINT, 179),
1464 |
1465 | /* Socks Service */
1466 | CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),
1467 |
1468 | /* set the bitmask for the protocols that are allowed to be used for the
1469 | transfer, which thus helps the app which takes URLs from users or other
1470 | external inputs and want to restrict what protocol(s) to deal
1471 | with. Defaults to CURLPROTO_ALL. */
1472 | CINIT(PROTOCOLS, LONG, 181),
1473 |
1474 | /* set the bitmask for the protocols that libcurl is allowed to follow to,
1475 | as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs
1476 | to be set in both bitmasks to be allowed to get redirected to. Defaults
1477 | to all protocols except FILE and SCP. */
1478 | CINIT(REDIR_PROTOCOLS, LONG, 182),
1479 |
1480 | /* set the SSH knownhost file name to use */
1481 | CINIT(SSH_KNOWNHOSTS, STRINGPOINT, 183),
1482 |
1483 | /* set the SSH host key callback, must point to a curl_sshkeycallback
1484 | function */
1485 | CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184),
1486 |
1487 | /* set the SSH host key callback custom pointer */
1488 | CINIT(SSH_KEYDATA, OBJECTPOINT, 185),
1489 |
1490 | /* set the SMTP mail originator */
1491 | CINIT(MAIL_FROM, STRINGPOINT, 186),
1492 |
1493 | /* set the list of SMTP mail receiver(s) */
1494 | CINIT(MAIL_RCPT, OBJECTPOINT, 187),
1495 |
1496 | /* FTP: send PRET before PASV */
1497 | CINIT(FTP_USE_PRET, LONG, 188),
1498 |
1499 | /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */
1500 | CINIT(RTSP_REQUEST, LONG, 189),
1501 |
1502 | /* The RTSP session identifier */
1503 | CINIT(RTSP_SESSION_ID, STRINGPOINT, 190),
1504 |
1505 | /* The RTSP stream URI */
1506 | CINIT(RTSP_STREAM_URI, STRINGPOINT, 191),
1507 |
1508 | /* The Transport: header to use in RTSP requests */
1509 | CINIT(RTSP_TRANSPORT, STRINGPOINT, 192),
1510 |
1511 | /* Manually initialize the client RTSP CSeq for this handle */
1512 | CINIT(RTSP_CLIENT_CSEQ, LONG, 193),
1513 |
1514 | /* Manually initialize the server RTSP CSeq for this handle */
1515 | CINIT(RTSP_SERVER_CSEQ, LONG, 194),
1516 |
1517 | /* The stream to pass to INTERLEAVEFUNCTION. */
1518 | CINIT(INTERLEAVEDATA, OBJECTPOINT, 195),
1519 |
1520 | /* Let the application define a custom write method for RTP data */
1521 | CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196),
1522 |
1523 | /* Turn on wildcard matching */
1524 | CINIT(WILDCARDMATCH, LONG, 197),
1525 |
1526 | /* Directory matching callback called before downloading of an
1527 | individual file (chunk) started */
1528 | CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198),
1529 |
1530 | /* Directory matching callback called after the file (chunk)
1531 | was downloaded, or skipped */
1532 | CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199),
1533 |
1534 | /* Change match (fnmatch-like) callback for wildcard matching */
1535 | CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200),
1536 |
1537 | /* Let the application define custom chunk data pointer */
1538 | CINIT(CHUNK_DATA, OBJECTPOINT, 201),
1539 |
1540 | /* FNMATCH_FUNCTION user pointer */
1541 | CINIT(FNMATCH_DATA, OBJECTPOINT, 202),
1542 |
1543 | /* send linked-list of name:port:address sets */
1544 | CINIT(RESOLVE, OBJECTPOINT, 203),
1545 |
1546 | /* Set a username for authenticated TLS */
1547 | CINIT(TLSAUTH_USERNAME, STRINGPOINT, 204),
1548 |
1549 | /* Set a password for authenticated TLS */
1550 | CINIT(TLSAUTH_PASSWORD, STRINGPOINT, 205),
1551 |
1552 | /* Set authentication type for authenticated TLS */
1553 | CINIT(TLSAUTH_TYPE, STRINGPOINT, 206),
1554 |
1555 | /* Set to 1 to enable the "TE:" header in HTTP requests to ask for
1556 | compressed transfer-encoded responses. Set to 0 to disable the use of TE:
1557 | in outgoing requests. The current default is 0, but it might change in a
1558 | future libcurl release.
1559 |
1560 | libcurl will ask for the compressed methods it knows of, and if that
1561 | isn't any, it will not ask for transfer-encoding at all even if this
1562 | option is set to 1.
1563 |
1564 | */
1565 | CINIT(TRANSFER_ENCODING, LONG, 207),
1566 |
1567 | /* Callback function for closing socket (instead of close(2)). The callback
1568 | should have type curl_closesocket_callback */
1569 | CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208),
1570 | CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209),
1571 |
1572 | /* allow GSSAPI credential delegation */
1573 | CINIT(GSSAPI_DELEGATION, LONG, 210),
1574 |
1575 | /* Set the name servers to use for DNS resolution */
1576 | CINIT(DNS_SERVERS, STRINGPOINT, 211),
1577 |
1578 | /* Time-out accept operations (currently for FTP only) after this amount
1579 | of miliseconds. */
1580 | CINIT(ACCEPTTIMEOUT_MS, LONG, 212),
1581 |
1582 | /* Set TCP keepalive */
1583 | CINIT(TCP_KEEPALIVE, LONG, 213),
1584 |
1585 | /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */
1586 | CINIT(TCP_KEEPIDLE, LONG, 214),
1587 | CINIT(TCP_KEEPINTVL, LONG, 215),
1588 |
1589 | /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */
1590 | CINIT(SSL_OPTIONS, LONG, 216),
1591 |
1592 | /* Set the SMTP auth originator */
1593 | CINIT(MAIL_AUTH, STRINGPOINT, 217),
1594 |
1595 | /* Enable/disable SASL initial response */
1596 | CINIT(SASL_IR, LONG, 218),
1597 |
1598 | /* Function that will be called instead of the internal progress display
1599 | * function. This function should be defined as the curl_xferinfo_callback
1600 | * prototype defines. (Deprecates CURLOPT_PROGRESSFUNCTION) */
1601 | CINIT(XFERINFOFUNCTION, FUNCTIONPOINT, 219),
1602 |
1603 | /* The XOAUTH2 bearer token */
1604 | CINIT(XOAUTH2_BEARER, STRINGPOINT, 220),
1605 |
1606 | /* Set the interface string to use as outgoing network
1607 | * interface for DNS requests.
1608 | * Only supported by the c-ares DNS backend */
1609 | CINIT(DNS_INTERFACE, STRINGPOINT, 221),
1610 |
1611 | /* Set the local IPv4 address to use for outgoing DNS requests.
1612 | * Only supported by the c-ares DNS backend */
1613 | CINIT(DNS_LOCAL_IP4, STRINGPOINT, 222),
1614 |
1615 | /* Set the local IPv4 address to use for outgoing DNS requests.
1616 | * Only supported by the c-ares DNS backend */
1617 | CINIT(DNS_LOCAL_IP6, STRINGPOINT, 223),
1618 |
1619 | /* Set authentication options directly */
1620 | CINIT(LOGIN_OPTIONS, STRINGPOINT, 224),
1621 |
1622 | /* Enable/disable TLS NPN extension (http2 over ssl might fail without) */
1623 | CINIT(SSL_ENABLE_NPN, LONG, 225),
1624 |
1625 | /* Enable/disable TLS ALPN extension (http2 over ssl might fail without) */
1626 | CINIT(SSL_ENABLE_ALPN, LONG, 226),
1627 |
1628 | /* Time to wait for a response to a HTTP request containing an
1629 | * Expect: 100-continue header before sending the data anyway. */
1630 | CINIT(EXPECT_100_TIMEOUT_MS, LONG, 227),
1631 |
1632 | /* This points to a linked list of headers used for proxy requests only,
1633 | struct curl_slist kind */
1634 | CINIT(PROXYHEADER, OBJECTPOINT, 228),
1635 |
1636 | /* Pass in a bitmask of "header options" */
1637 | CINIT(HEADEROPT, LONG, 229),
1638 |
1639 | /* The public key in DER form used to validate the peer public key
1640 | this option is used only if SSL_VERIFYPEER is true */
1641 | CINIT(PINNEDPUBLICKEY, STRINGPOINT, 230),
1642 |
1643 | /* Path to Unix domain socket */
1644 | CINIT(UNIX_SOCKET_PATH, STRINGPOINT, 231),
1645 |
1646 | /* Set if we should verify the certificate status. */
1647 | CINIT(SSL_VERIFYSTATUS, LONG, 232),
1648 |
1649 | /* Set if we should enable TLS false start. */
1650 | CINIT(SSL_FALSESTART, LONG, 233),
1651 |
1652 | /* Do not squash dot-dot sequences */
1653 | CINIT(PATH_AS_IS, LONG, 234),
1654 |
1655 | /* Proxy Service Name */
1656 | CINIT(PROXY_SERVICE_NAME, STRINGPOINT, 235),
1657 |
1658 | /* Service Name */
1659 | CINIT(SERVICE_NAME, STRINGPOINT, 236),
1660 |
1661 | /* Wait/don't wait for pipe/mutex to clarify */
1662 | CINIT(PIPEWAIT, LONG, 237),
1663 |
1664 | /* Set the protocol used when curl is given a URL without a protocol */
1665 | CINIT(DEFAULT_PROTOCOL, STRINGPOINT, 238),
1666 |
1667 | /* Set stream weight, 1 - 256 (default is 16) */
1668 | CINIT(STREAM_WEIGHT, LONG, 239),
1669 |
1670 | /* Set stream dependency on another CURL handle */
1671 | CINIT(STREAM_DEPENDS, OBJECTPOINT, 240),
1672 |
1673 | /* Set E-xclusive stream dependency on another CURL handle */
1674 | CINIT(STREAM_DEPENDS_E, OBJECTPOINT, 241),
1675 |
1676 | CURLOPT_LASTENTRY /* the last unused */
1677 | } CURLoption;
1678 |
1679 | #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
1680 | the obsolete stuff removed! */
1681 |
1682 | /* Backwards compatibility with older names */
1683 | /* These are scheduled to disappear by 2011 */
1684 |
1685 | /* This was added in version 7.19.1 */
1686 | #define CURLOPT_POST301 CURLOPT_POSTREDIR
1687 |
1688 | /* These are scheduled to disappear by 2009 */
1689 |
1690 | /* The following were added in 7.17.0 */
1691 | #define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD
1692 | #define CURLOPT_FTPAPPEND CURLOPT_APPEND
1693 | #define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY
1694 | #define CURLOPT_FTP_SSL CURLOPT_USE_SSL
1695 |
1696 | /* The following were added earlier */
1697 |
1698 | #define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD
1699 | #define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL
1700 |
1701 | #else
1702 | /* This is set if CURL_NO_OLDIES is defined at compile-time */
1703 | #undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
1704 | #endif
1705 |
1706 |
1707 | /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
1708 | name resolves addresses using more than one IP protocol version, this
1709 | option might be handy to force libcurl to use a specific IP version. */
1710 | #define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
1711 | versions that your system allows */
1712 | #define CURL_IPRESOLVE_V4 1 /* resolve to IPv4 addresses */
1713 | #define CURL_IPRESOLVE_V6 2 /* resolve to IPv6 addresses */
1714 |
1715 | /* three convenient "aliases" that follow the name scheme better */
1716 | #define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER
1717 |
1718 | /* These enums are for use with the CURLOPT_HTTP_VERSION option. */
1719 | enum {
1720 | CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd
1721 | like the library to choose the best possible
1722 | for us! */
1723 | CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */
1724 | CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */
1725 | CURL_HTTP_VERSION_2_0, /* please use HTTP 2 in the request */
1726 | CURL_HTTP_VERSION_2TLS, /* use version 2 for HTTPS, version 1.1 for HTTP */
1727 |
1728 | CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
1729 | };
1730 |
1731 | /* Convenience definition simple because the name of the version is HTTP/2 and
1732 | not 2.0. The 2_0 version of the enum name was set while the version was
1733 | still planned to be 2.0 and we stick to it for compatibility. */
1734 | #define CURL_HTTP_VERSION_2 CURL_HTTP_VERSION_2_0
1735 |
1736 | /*
1737 | * Public API enums for RTSP requests
1738 | */
1739 | enum {
1740 | CURL_RTSPREQ_NONE, /* first in list */
1741 | CURL_RTSPREQ_OPTIONS,
1742 | CURL_RTSPREQ_DESCRIBE,
1743 | CURL_RTSPREQ_ANNOUNCE,
1744 | CURL_RTSPREQ_SETUP,
1745 | CURL_RTSPREQ_PLAY,
1746 | CURL_RTSPREQ_PAUSE,
1747 | CURL_RTSPREQ_TEARDOWN,
1748 | CURL_RTSPREQ_GET_PARAMETER,
1749 | CURL_RTSPREQ_SET_PARAMETER,
1750 | CURL_RTSPREQ_RECORD,
1751 | CURL_RTSPREQ_RECEIVE,
1752 | CURL_RTSPREQ_LAST /* last in list */
1753 | };
1754 |
1755 | /* These enums are for use with the CURLOPT_NETRC option. */
1756 | enum CURL_NETRC_OPTION {
1757 | CURL_NETRC_IGNORED, /* The .netrc will never be read.
1758 | * This is the default. */
1759 | CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred
1760 | * to one in the .netrc. */
1761 | CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored.
1762 | * Unless one is set programmatically, the .netrc
1763 | * will be queried. */
1764 | CURL_NETRC_LAST
1765 | };
1766 |
1767 | enum {
1768 | CURL_SSLVERSION_DEFAULT,
1769 | CURL_SSLVERSION_TLSv1, /* TLS 1.x */
1770 | CURL_SSLVERSION_SSLv2,
1771 | CURL_SSLVERSION_SSLv3,
1772 | CURL_SSLVERSION_TLSv1_0,
1773 | CURL_SSLVERSION_TLSv1_1,
1774 | CURL_SSLVERSION_TLSv1_2,
1775 |
1776 | CURL_SSLVERSION_LAST /* never use, keep last */
1777 | };
1778 |
1779 | enum CURL_TLSAUTH {
1780 | CURL_TLSAUTH_NONE,
1781 | CURL_TLSAUTH_SRP,
1782 | CURL_TLSAUTH_LAST /* never use, keep last */
1783 | };
1784 |
1785 | /* symbols to use with CURLOPT_POSTREDIR.
1786 | CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303
1787 | can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302
1788 | | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */
1789 |
1790 | #define CURL_REDIR_GET_ALL 0
1791 | #define CURL_REDIR_POST_301 1
1792 | #define CURL_REDIR_POST_302 2
1793 | #define CURL_REDIR_POST_303 4
1794 | #define CURL_REDIR_POST_ALL \
1795 | (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303)
1796 |
1797 | typedef enum {
1798 | CURL_TIMECOND_NONE,
1799 |
1800 | CURL_TIMECOND_IFMODSINCE,
1801 | CURL_TIMECOND_IFUNMODSINCE,
1802 | CURL_TIMECOND_LASTMOD,
1803 |
1804 | CURL_TIMECOND_LAST
1805 | } curl_TimeCond;
1806 |
1807 |
1808 | /* curl_strequal() and curl_strnequal() are subject for removal in a future
1809 | libcurl, see lib/README.curlx for details */
1810 | CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);
1811 | CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);
1812 |
1813 | /* name is uppercase CURLFORM_ */
1814 | #ifdef CFINIT
1815 | #undef CFINIT
1816 | #endif
1817 |
1818 | #ifdef CURL_ISOCPP
1819 | #define CFINIT(name) CURLFORM_ ## name
1820 | #else
1821 | /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
1822 | #define CFINIT(name) CURLFORM_/**/name
1823 | #endif
1824 |
1825 | typedef enum {
1826 | CFINIT(NOTHING), /********* the first one is unused ************/
1827 |
1828 | /* */
1829 | CFINIT(COPYNAME),
1830 | CFINIT(PTRNAME),
1831 | CFINIT(NAMELENGTH),
1832 | CFINIT(COPYCONTENTS),
1833 | CFINIT(PTRCONTENTS),
1834 | CFINIT(CONTENTSLENGTH),
1835 | CFINIT(FILECONTENT),
1836 | CFINIT(ARRAY),
1837 | CFINIT(OBSOLETE),
1838 | CFINIT(FILE),
1839 |
1840 | CFINIT(BUFFER),
1841 | CFINIT(BUFFERPTR),
1842 | CFINIT(BUFFERLENGTH),
1843 |
1844 | CFINIT(CONTENTTYPE),
1845 | CFINIT(CONTENTHEADER),
1846 | CFINIT(FILENAME),
1847 | CFINIT(END),
1848 | CFINIT(OBSOLETE2),
1849 |
1850 | CFINIT(STREAM),
1851 | CFINIT(CONTENTLEN), /* added in 7.46.0, provide a curl_off_t length */
1852 |
1853 | CURLFORM_LASTENTRY /* the last unused */
1854 | } CURLformoption;
1855 |
1856 | #undef CFINIT /* done */
1857 |
1858 | /* structure to be used as parameter for CURLFORM_ARRAY */
1859 | struct curl_forms {
1860 | CURLformoption option;
1861 | const char *value;
1862 | };
1863 |
1864 | /* use this for multipart formpost building */
1865 | /* Returns code for curl_formadd()
1866 | *
1867 | * Returns:
1868 | * CURL_FORMADD_OK on success
1869 | * CURL_FORMADD_MEMORY if the FormInfo allocation fails
1870 | * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form
1871 | * CURL_FORMADD_NULL if a null pointer was given for a char
1872 | * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed
1873 | * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
1874 | * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error)
1875 | * CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated
1876 | * CURL_FORMADD_MEMORY if some allocation for string copying failed.
1877 | * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array
1878 | *
1879 | ***************************************************************************/
1880 | typedef enum {
1881 | CURL_FORMADD_OK, /* first, no error */
1882 |
1883 | CURL_FORMADD_MEMORY,
1884 | CURL_FORMADD_OPTION_TWICE,
1885 | CURL_FORMADD_NULL,
1886 | CURL_FORMADD_UNKNOWN_OPTION,
1887 | CURL_FORMADD_INCOMPLETE,
1888 | CURL_FORMADD_ILLEGAL_ARRAY,
1889 | CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */
1890 |
1891 | CURL_FORMADD_LAST /* last */
1892 | } CURLFORMcode;
1893 |
1894 | /*
1895 | * NAME curl_formadd()
1896 | *
1897 | * DESCRIPTION
1898 | *
1899 | * Pretty advanced function for building multi-part formposts. Each invoke
1900 | * adds one part that together construct a full post. Then use
1901 | * CURLOPT_HTTPPOST to send it off to libcurl.
1902 | */
1903 | CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,
1904 | struct curl_httppost **last_post,
1905 | ...);
1906 |
1907 | /*
1908 | * callback function for curl_formget()
1909 | * The void *arg pointer will be the one passed as second argument to
1910 | * curl_formget().
1911 | * The character buffer passed to it must not be freed.
1912 | * Should return the buffer length passed to it as the argument "len" on
1913 | * success.
1914 | */
1915 | typedef size_t (*curl_formget_callback)(void *arg, const char *buf,
1916 | size_t len);
1917 |
1918 | /*
1919 | * NAME curl_formget()
1920 | *
1921 | * DESCRIPTION
1922 | *
1923 | * Serialize a curl_httppost struct built with curl_formadd().
1924 | * Accepts a void pointer as second argument which will be passed to
1925 | * the curl_formget_callback function.
1926 | * Returns 0 on success.
1927 | */
1928 | CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg,
1929 | curl_formget_callback append);
1930 | /*
1931 | * NAME curl_formfree()
1932 | *
1933 | * DESCRIPTION
1934 | *
1935 | * Free a multipart formpost previously built with curl_formadd().
1936 | */
1937 | CURL_EXTERN void curl_formfree(struct curl_httppost *form);
1938 |
1939 | /*
1940 | * NAME curl_getenv()
1941 | *
1942 | * DESCRIPTION
1943 | *
1944 | * Returns a malloc()'ed string that MUST be curl_free()ed after usage is
1945 | * complete. DEPRECATED - see lib/README.curlx
1946 | */
1947 | CURL_EXTERN char *curl_getenv(const char *variable);
1948 |
1949 | /*
1950 | * NAME curl_version()
1951 | *
1952 | * DESCRIPTION
1953 | *
1954 | * Returns a static ascii string of the libcurl version.
1955 | */
1956 | CURL_EXTERN char *curl_version(void);
1957 |
1958 | /*
1959 | * NAME curl_easy_escape()
1960 | *
1961 | * DESCRIPTION
1962 | *
1963 | * Escapes URL strings (converts all letters consider illegal in URLs to their
1964 | * %XX versions). This function returns a new allocated string or NULL if an
1965 | * error occurred.
1966 | */
1967 | CURL_EXTERN char *curl_easy_escape(CURL *handle,
1968 | const char *string,
1969 | int length);
1970 |
1971 | /* the previous version: */
1972 | CURL_EXTERN char *curl_escape(const char *string,
1973 | int length);
1974 |
1975 |
1976 | /*
1977 | * NAME curl_easy_unescape()
1978 | *
1979 | * DESCRIPTION
1980 | *
1981 | * Unescapes URL encoding in strings (converts all %XX codes to their 8bit
1982 | * versions). This function returns a new allocated string or NULL if an error
1983 | * occurred.
1984 | * Conversion Note: On non-ASCII platforms the ASCII %XX codes are
1985 | * converted into the host encoding.
1986 | */
1987 | CURL_EXTERN char *curl_easy_unescape(CURL *handle,
1988 | const char *string,
1989 | int length,
1990 | int *outlength);
1991 |
1992 | /* the previous version */
1993 | CURL_EXTERN char *curl_unescape(const char *string,
1994 | int length);
1995 |
1996 | /*
1997 | * NAME curl_free()
1998 | *
1999 | * DESCRIPTION
2000 | *
2001 | * Provided for de-allocation in the same translation unit that did the
2002 | * allocation. Added in libcurl 7.10
2003 | */
2004 | CURL_EXTERN void curl_free(void *p);
2005 |
2006 | /*
2007 | * NAME curl_global_init()
2008 | *
2009 | * DESCRIPTION
2010 | *
2011 | * curl_global_init() should be invoked exactly once for each application that
2012 | * uses libcurl and before any call of other libcurl functions.
2013 | *
2014 | * This function is not thread-safe!
2015 | */
2016 | CURL_EXTERN CURLcode curl_global_init(long flags);
2017 |
2018 | /*
2019 | * NAME curl_global_init_mem()
2020 | *
2021 | * DESCRIPTION
2022 | *
2023 | * curl_global_init() or curl_global_init_mem() should be invoked exactly once
2024 | * for each application that uses libcurl. This function can be used to
2025 | * initialize libcurl and set user defined memory management callback
2026 | * functions. Users can implement memory management routines to check for
2027 | * memory leaks, check for mis-use of the curl library etc. User registered
2028 | * callback routines with be invoked by this library instead of the system
2029 | * memory management routines like malloc, free etc.
2030 | */
2031 | CURL_EXTERN CURLcode curl_global_init_mem(long flags,
2032 | curl_malloc_callback m,
2033 | curl_free_callback f,
2034 | curl_realloc_callback r,
2035 | curl_strdup_callback s,
2036 | curl_calloc_callback c);
2037 |
2038 | /*
2039 | * NAME curl_global_cleanup()
2040 | *
2041 | * DESCRIPTION
2042 | *
2043 | * curl_global_cleanup() should be invoked exactly once for each application
2044 | * that uses libcurl
2045 | */
2046 | CURL_EXTERN void curl_global_cleanup(void);
2047 |
2048 | /* linked-list structure for the CURLOPT_QUOTE option (and other) */
2049 | struct curl_slist {
2050 | char *data;
2051 | struct curl_slist *next;
2052 | };
2053 |
2054 | /*
2055 | * NAME curl_slist_append()
2056 | *
2057 | * DESCRIPTION
2058 | *
2059 | * Appends a string to a linked list. If no list exists, it will be created
2060 | * first. Returns the new list, after appending.
2061 | */
2062 | CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,
2063 | const char *);
2064 |
2065 | /*
2066 | * NAME curl_slist_free_all()
2067 | *
2068 | * DESCRIPTION
2069 | *
2070 | * free a previously built curl_slist.
2071 | */
2072 | CURL_EXTERN void curl_slist_free_all(struct curl_slist *);
2073 |
2074 | /*
2075 | * NAME curl_getdate()
2076 | *
2077 | * DESCRIPTION
2078 | *
2079 | * Returns the time, in seconds since 1 Jan 1970 of the time string given in
2080 | * the first argument. The time argument in the second parameter is unused
2081 | * and should be set to NULL.
2082 | */
2083 | CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);
2084 |
2085 | /* info about the certificate chain, only for OpenSSL builds. Asked
2086 | for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */
2087 | struct curl_certinfo {
2088 | int num_of_certs; /* number of certificates with information */
2089 | struct curl_slist **certinfo; /* for each index in this array, there's a
2090 | linked list with textual information in the
2091 | format "name: value" */
2092 | };
2093 |
2094 | /* enum for the different supported SSL backends */
2095 | typedef enum {
2096 | CURLSSLBACKEND_NONE = 0,
2097 | CURLSSLBACKEND_OPENSSL = 1,
2098 | CURLSSLBACKEND_GNUTLS = 2,
2099 | CURLSSLBACKEND_NSS = 3,
2100 | CURLSSLBACKEND_OBSOLETE4 = 4, /* Was QSOSSL. */
2101 | CURLSSLBACKEND_GSKIT = 5,
2102 | CURLSSLBACKEND_POLARSSL = 6,
2103 | CURLSSLBACKEND_CYASSL = 7,
2104 | CURLSSLBACKEND_SCHANNEL = 8,
2105 | CURLSSLBACKEND_DARWINSSL = 9,
2106 | CURLSSLBACKEND_AXTLS = 10,
2107 | CURLSSLBACKEND_MBEDTLS = 11
2108 | } curl_sslbackend;
2109 |
2110 | /* Information about the SSL library used and the respective internal SSL
2111 | handle, which can be used to obtain further information regarding the
2112 | connection. Asked for with CURLINFO_TLS_SESSION. */
2113 | struct curl_tlssessioninfo {
2114 | curl_sslbackend backend;
2115 | void *internals;
2116 | };
2117 |
2118 | #define CURLINFO_STRING 0x100000
2119 | #define CURLINFO_LONG 0x200000
2120 | #define CURLINFO_DOUBLE 0x300000
2121 | #define CURLINFO_SLIST 0x400000
2122 | #define CURLINFO_SOCKET 0x500000
2123 | #define CURLINFO_MASK 0x0fffff
2124 | #define CURLINFO_TYPEMASK 0xf00000
2125 |
2126 | typedef enum {
2127 | CURLINFO_NONE, /* first, never use this */
2128 | CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1,
2129 | CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2,
2130 | CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3,
2131 | CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4,
2132 | CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5,
2133 | CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,
2134 | CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7,
2135 | CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8,
2136 | CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9,
2137 | CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10,
2138 | CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11,
2139 | CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12,
2140 | CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13,
2141 | CURLINFO_FILETIME = CURLINFO_LONG + 14,
2142 | CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15,
2143 | CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16,
2144 | CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,
2145 | CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18,
2146 | CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19,
2147 | CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20,
2148 | CURLINFO_PRIVATE = CURLINFO_STRING + 21,
2149 | CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22,
2150 | CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23,
2151 | CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24,
2152 | CURLINFO_OS_ERRNO = CURLINFO_LONG + 25,
2153 | CURLINFO_NUM_CONNECTS = CURLINFO_LONG + 26,
2154 | CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27,
2155 | CURLINFO_COOKIELIST = CURLINFO_SLIST + 28,
2156 | CURLINFO_LASTSOCKET = CURLINFO_LONG + 29,
2157 | CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30,
2158 | CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31,
2159 | CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32,
2160 | CURLINFO_APPCONNECT_TIME = CURLINFO_DOUBLE + 33,
2161 | CURLINFO_CERTINFO = CURLINFO_SLIST + 34,
2162 | CURLINFO_CONDITION_UNMET = CURLINFO_LONG + 35,
2163 | CURLINFO_RTSP_SESSION_ID = CURLINFO_STRING + 36,
2164 | CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG + 37,
2165 | CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG + 38,
2166 | CURLINFO_RTSP_CSEQ_RECV = CURLINFO_LONG + 39,
2167 | CURLINFO_PRIMARY_PORT = CURLINFO_LONG + 40,
2168 | CURLINFO_LOCAL_IP = CURLINFO_STRING + 41,
2169 | CURLINFO_LOCAL_PORT = CURLINFO_LONG + 42,
2170 | CURLINFO_TLS_SESSION = CURLINFO_SLIST + 43,
2171 | CURLINFO_ACTIVESOCKET = CURLINFO_SOCKET + 44,
2172 | /* Fill in new entries below here! */
2173 |
2174 | CURLINFO_LASTONE = 44
2175 | } CURLINFO;
2176 |
2177 | /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
2178 | CURLINFO_HTTP_CODE */
2179 | #define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE
2180 |
2181 | typedef enum {
2182 | CURLCLOSEPOLICY_NONE, /* first, never use this */
2183 |
2184 | CURLCLOSEPOLICY_OLDEST,
2185 | CURLCLOSEPOLICY_LEAST_RECENTLY_USED,
2186 | CURLCLOSEPOLICY_LEAST_TRAFFIC,
2187 | CURLCLOSEPOLICY_SLOWEST,
2188 | CURLCLOSEPOLICY_CALLBACK,
2189 |
2190 | CURLCLOSEPOLICY_LAST /* last, never use this */
2191 | } curl_closepolicy;
2192 |
2193 | #define CURL_GLOBAL_SSL (1<<0)
2194 | #define CURL_GLOBAL_WIN32 (1<<1)
2195 | #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
2196 | #define CURL_GLOBAL_NOTHING 0
2197 | #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
2198 | #define CURL_GLOBAL_ACK_EINTR (1<<2)
2199 |
2200 |
2201 | /*****************************************************************************
2202 | * Setup defines, protos etc for the sharing stuff.
2203 | */
2204 |
2205 | /* Different data locks for a single share */
2206 | typedef enum {
2207 | CURL_LOCK_DATA_NONE = 0,
2208 | /* CURL_LOCK_DATA_SHARE is used internally to say that
2209 | * the locking is just made to change the internal state of the share
2210 | * itself.
2211 | */
2212 | CURL_LOCK_DATA_SHARE,
2213 | CURL_LOCK_DATA_COOKIE,
2214 | CURL_LOCK_DATA_DNS,
2215 | CURL_LOCK_DATA_SSL_SESSION,
2216 | CURL_LOCK_DATA_CONNECT,
2217 | CURL_LOCK_DATA_LAST
2218 | } curl_lock_data;
2219 |
2220 | /* Different lock access types */
2221 | typedef enum {
2222 | CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */
2223 | CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */
2224 | CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */
2225 | CURL_LOCK_ACCESS_LAST /* never use */
2226 | } curl_lock_access;
2227 |
2228 | typedef void (*curl_lock_function)(CURL *handle,
2229 | curl_lock_data data,
2230 | curl_lock_access locktype,
2231 | void *userptr);
2232 | typedef void (*curl_unlock_function)(CURL *handle,
2233 | curl_lock_data data,
2234 | void *userptr);
2235 |
2236 | typedef void CURLSH;
2237 |
2238 | typedef enum {
2239 | CURLSHE_OK, /* all is fine */
2240 | CURLSHE_BAD_OPTION, /* 1 */
2241 | CURLSHE_IN_USE, /* 2 */
2242 | CURLSHE_INVALID, /* 3 */
2243 | CURLSHE_NOMEM, /* 4 out of memory */
2244 | CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */
2245 | CURLSHE_LAST /* never use */
2246 | } CURLSHcode;
2247 |
2248 | typedef enum {
2249 | CURLSHOPT_NONE, /* don't use */
2250 | CURLSHOPT_SHARE, /* specify a data type to share */
2251 | CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */
2252 | CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */
2253 | CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */
2254 | CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock
2255 | callback functions */
2256 | CURLSHOPT_LAST /* never use */
2257 | } CURLSHoption;
2258 |
2259 | CURL_EXTERN CURLSH *curl_share_init(void);
2260 | CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);
2261 | CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);
2262 |
2263 | /****************************************************************************
2264 | * Structures for querying information about the curl library at runtime.
2265 | */
2266 |
2267 | typedef enum {
2268 | CURLVERSION_FIRST,
2269 | CURLVERSION_SECOND,
2270 | CURLVERSION_THIRD,
2271 | CURLVERSION_FOURTH,
2272 | CURLVERSION_LAST /* never actually use this */
2273 | } CURLversion;
2274 |
2275 | /* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
2276 | basically all programs ever that want to get version information. It is
2277 | meant to be a built-in version number for what kind of struct the caller
2278 | expects. If the struct ever changes, we redefine the NOW to another enum
2279 | from above. */
2280 | #define CURLVERSION_NOW CURLVERSION_FOURTH
2281 |
2282 | typedef struct {
2283 | CURLversion age; /* age of the returned struct */
2284 | const char *version; /* LIBCURL_VERSION */
2285 | unsigned int version_num; /* LIBCURL_VERSION_NUM */
2286 | const char *host; /* OS/host/cpu/machine when configured */
2287 | int features; /* bitmask, see defines below */
2288 | const char *ssl_version; /* human readable string */
2289 | long ssl_version_num; /* not used anymore, always 0 */
2290 | const char *libz_version; /* human readable string */
2291 | /* protocols is terminated by an entry with a NULL protoname */
2292 | const char * const *protocols;
2293 |
2294 | /* The fields below this were added in CURLVERSION_SECOND */
2295 | const char *ares;
2296 | int ares_num;
2297 |
2298 | /* This field was added in CURLVERSION_THIRD */
2299 | const char *libidn;
2300 |
2301 | /* These field were added in CURLVERSION_FOURTH */
2302 |
2303 | /* Same as '_libiconv_version' if built with HAVE_ICONV */
2304 | int iconv_ver_num;
2305 |
2306 | const char *libssh_version; /* human readable string */
2307 |
2308 | } curl_version_info_data;
2309 |
2310 | #define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */
2311 | #define CURL_VERSION_KERBEROS4 (1<<1) /* Kerberos V4 auth is supported
2312 | (deprecated) */
2313 | #define CURL_VERSION_SSL (1<<2) /* SSL options are present */
2314 | #define CURL_VERSION_LIBZ (1<<3) /* libz features are present */
2315 | #define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */
2316 | #define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth is supported
2317 | (deprecated) */
2318 | #define CURL_VERSION_DEBUG (1<<6) /* Built with debug capabilities */
2319 | #define CURL_VERSION_ASYNCHDNS (1<<7) /* Asynchronous DNS resolves */
2320 | #define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth is supported */
2321 | #define CURL_VERSION_LARGEFILE (1<<9) /* Supports files larger than 2GB */
2322 | #define CURL_VERSION_IDN (1<<10) /* Internationized Domain Names are
2323 | supported */
2324 | #define CURL_VERSION_SSPI (1<<11) /* Built against Windows SSPI */
2325 | #define CURL_VERSION_CONV (1<<12) /* Character conversions supported */
2326 | #define CURL_VERSION_CURLDEBUG (1<<13) /* Debug memory tracking supported */
2327 | #define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */
2328 | #define CURL_VERSION_NTLM_WB (1<<15) /* NTLM delegation to winbind helper
2329 | is suported */
2330 | #define CURL_VERSION_HTTP2 (1<<16) /* HTTP2 support built-in */
2331 | #define CURL_VERSION_GSSAPI (1<<17) /* Built against a GSS-API library */
2332 | #define CURL_VERSION_KERBEROS5 (1<<18) /* Kerberos V5 auth is supported */
2333 | #define CURL_VERSION_UNIX_SOCKETS (1<<19) /* Unix domain sockets support */
2334 | #define CURL_VERSION_PSL (1<<20) /* Mozilla's Public Suffix List, used
2335 | for cookie domain verification */
2336 |
2337 | /*
2338 | * NAME curl_version_info()
2339 | *
2340 | * DESCRIPTION
2341 | *
2342 | * This function returns a pointer to a static copy of the version info
2343 | * struct. See above.
2344 | */
2345 | CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);
2346 |
2347 | /*
2348 | * NAME curl_easy_strerror()
2349 | *
2350 | * DESCRIPTION
2351 | *
2352 | * The curl_easy_strerror function may be used to turn a CURLcode value
2353 | * into the equivalent human readable error string. This is useful
2354 | * for printing meaningful error messages.
2355 | */
2356 | CURL_EXTERN const char *curl_easy_strerror(CURLcode);
2357 |
2358 | /*
2359 | * NAME curl_share_strerror()
2360 | *
2361 | * DESCRIPTION
2362 | *
2363 | * The curl_share_strerror function may be used to turn a CURLSHcode value
2364 | * into the equivalent human readable error string. This is useful
2365 | * for printing meaningful error messages.
2366 | */
2367 | CURL_EXTERN const char *curl_share_strerror(CURLSHcode);
2368 |
2369 | /*
2370 | * NAME curl_easy_pause()
2371 | *
2372 | * DESCRIPTION
2373 | *
2374 | * The curl_easy_pause function pauses or unpauses transfers. Select the new
2375 | * state by setting the bitmask, use the convenience defines below.
2376 | *
2377 | */
2378 | CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);
2379 |
2380 | #define CURLPAUSE_RECV (1<<0)
2381 | #define CURLPAUSE_RECV_CONT (0)
2382 |
2383 | #define CURLPAUSE_SEND (1<<2)
2384 | #define CURLPAUSE_SEND_CONT (0)
2385 |
2386 | #define CURLPAUSE_ALL (CURLPAUSE_RECV|CURLPAUSE_SEND)
2387 | #define CURLPAUSE_CONT (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT)
2388 |
2389 | #ifdef __cplusplus
2390 | }
2391 | #endif
2392 |
2393 | /* unfortunately, the easy.h and multi.h include files need options and info
2394 | stuff before they can be included! */
2395 | #include "easy.h" /* nothing in curl is fun without the easy stuff */
2396 | #include "multi.h"
2397 |
2398 | /* the typechecker doesn't work in C++ (yet) */
2399 | #if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
2400 | ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
2401 | !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)
2402 | #include "typecheck-gcc.h"
2403 | #else
2404 | #if defined(__STDC__) && (__STDC__ >= 1)
2405 | /* This preprocessor magic that replaces a call with the exact same call is
2406 | only done to make sure application authors pass exactly three arguments
2407 | to these functions. */
2408 | #define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
2409 | #define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)
2410 | #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
2411 | #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
2412 | #endif /* __STDC__ >= 1 */
2413 | #endif /* gcc >= 4.3 && !__cplusplus */
2414 |
2415 | #endif /* __CURL_CURL_H */
2416 |
--------------------------------------------------------------------------------
/curl/curlbuild.h:
--------------------------------------------------------------------------------
1 | /* include/curl/curlbuild.h. Generated from curlbuild.h.in by configure. */
2 | #ifndef __CURL_CURLBUILD_H
3 | #define __CURL_CURLBUILD_H
4 | /***************************************************************************
5 | * _ _ ____ _
6 | * Project ___| | | | _ \| |
7 | * / __| | | | |_) | |
8 | * | (__| |_| | _ <| |___
9 | * \___|\___/|_| \_\_____|
10 | *
11 | * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al.
12 | *
13 | * This software is licensed as described in the file COPYING, which
14 | * you should have received as part of this distribution. The terms
15 | * are also available at http://curl.haxx.se/docs/copyright.html.
16 | *
17 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
18 | * copies of the Software, and permit persons to whom the Software is
19 | * furnished to do so, under the terms of the COPYING file.
20 | *
21 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
22 | * KIND, either express or implied.
23 | *
24 | ***************************************************************************/
25 |
26 | /* ================================================================ */
27 | /* NOTES FOR CONFIGURE CAPABLE SYSTEMS */
28 | /* ================================================================ */
29 |
30 | /*
31 | * NOTE 1:
32 | * -------
33 | *
34 | * Nothing in this file is intended to be modified or adjusted by the
35 | * curl library user nor by the curl library builder.
36 | *
37 | * If you think that something actually needs to be changed, adjusted
38 | * or fixed in this file, then, report it on the libcurl development
39 | * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/
40 | *
41 | * This header file shall only export symbols which are 'curl' or 'CURL'
42 | * prefixed, otherwise public name space would be polluted.
43 | *
44 | * NOTE 2:
45 | * -------
46 | *
47 | * Right now you might be staring at file include/curl/curlbuild.h.in or
48 | * at file include/curl/curlbuild.h, this is due to the following reason:
49 | *
50 | * On systems capable of running the configure script, the configure process
51 | * will overwrite the distributed include/curl/curlbuild.h file with one that
52 | * is suitable and specific to the library being configured and built, which
53 | * is generated from the include/curl/curlbuild.h.in template file.
54 | *
55 | */
56 |
57 | /* ================================================================ */
58 | /* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
59 | /* ================================================================ */
60 |
61 | #ifdef CURL_SIZEOF_LONG
62 | #error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h"
63 | Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined
64 | #endif
65 |
66 | #ifdef CURL_TYPEOF_CURL_SOCKLEN_T
67 | #error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
68 | Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined
69 | #endif
70 |
71 | #ifdef CURL_SIZEOF_CURL_SOCKLEN_T
72 | #error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
73 | Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined
74 | #endif
75 |
76 | #ifdef CURL_TYPEOF_CURL_OFF_T
77 | #error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
78 | Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined
79 | #endif
80 |
81 | #ifdef CURL_FORMAT_CURL_OFF_T
82 | #error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h"
83 | Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined
84 | #endif
85 |
86 | #ifdef CURL_FORMAT_CURL_OFF_TU
87 | #error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h"
88 | Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined
89 | #endif
90 |
91 | #ifdef CURL_FORMAT_OFF_T
92 | #error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h"
93 | Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined
94 | #endif
95 |
96 | #ifdef CURL_SIZEOF_CURL_OFF_T
97 | #error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
98 | Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined
99 | #endif
100 |
101 | #ifdef CURL_SUFFIX_CURL_OFF_T
102 | #error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h"
103 | Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined
104 | #endif
105 |
106 | #ifdef CURL_SUFFIX_CURL_OFF_TU
107 | #error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h"
108 | Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined
109 | #endif
110 |
111 | /* ================================================================ */
112 | /* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */
113 | /* ================================================================ */
114 |
115 | /* Configure process defines this to 1 when it finds out that system */
116 | /* header file ws2tcpip.h must be included by the external interface. */
117 | /* #undef CURL_PULL_WS2TCPIP_H */
118 | #ifdef CURL_PULL_WS2TCPIP_H
119 | # ifndef WIN32_LEAN_AND_MEAN
120 | # define WIN32_LEAN_AND_MEAN
121 | # endif
122 | # include
123 | # include
124 | # include
125 | #endif
126 |
127 | /* Configure process defines this to 1 when it finds out that system */
128 | /* header file sys/types.h must be included by the external interface. */
129 | #define CURL_PULL_SYS_TYPES_H 1
130 | #ifdef CURL_PULL_SYS_TYPES_H
131 | # include
132 | #endif
133 |
134 | /* Configure process defines this to 1 when it finds out that system */
135 | /* header file stdint.h must be included by the external interface. */
136 | /* #undef CURL_PULL_STDINT_H */
137 | #ifdef CURL_PULL_STDINT_H
138 | # include
139 | #endif
140 |
141 | /* Configure process defines this to 1 when it finds out that system */
142 | /* header file inttypes.h must be included by the external interface. */
143 | /* #undef CURL_PULL_INTTYPES_H */
144 | #ifdef CURL_PULL_INTTYPES_H
145 | # include
146 | #endif
147 |
148 | /* Configure process defines this to 1 when it finds out that system */
149 | /* header file sys/socket.h must be included by the external interface. */
150 | #define CURL_PULL_SYS_SOCKET_H 1
151 | #ifdef CURL_PULL_SYS_SOCKET_H
152 | # include
153 | #endif
154 |
155 | /* Configure process defines this to 1 when it finds out that system */
156 | /* header file sys/poll.h must be included by the external interface. */
157 | /* #undef CURL_PULL_SYS_POLL_H */
158 | #ifdef CURL_PULL_SYS_POLL_H
159 | # include
160 | #endif
161 |
162 | /* The size of `long', as computed by sizeof. */
163 | #define CURL_SIZEOF_LONG 8
164 |
165 | /* Integral data type used for curl_socklen_t. */
166 | #define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
167 |
168 | /* The size of `curl_socklen_t', as computed by sizeof. */
169 | #define CURL_SIZEOF_CURL_SOCKLEN_T 4
170 |
171 | /* Data type definition of curl_socklen_t. */
172 | typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
173 |
174 | /* Signed integral data type used for curl_off_t. */
175 | #define CURL_TYPEOF_CURL_OFF_T long
176 |
177 | /* Data type definition of curl_off_t. */
178 | typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
179 |
180 | /* curl_off_t formatting string directive without "%" conversion specifier. */
181 | #define CURL_FORMAT_CURL_OFF_T "ld"
182 |
183 | /* unsigned curl_off_t formatting string without "%" conversion specifier. */
184 | #define CURL_FORMAT_CURL_OFF_TU "lu"
185 |
186 | /* curl_off_t formatting string directive with "%" conversion specifier. */
187 | #define CURL_FORMAT_OFF_T "%ld"
188 |
189 | /* The size of `curl_off_t', as computed by sizeof. */
190 | #define CURL_SIZEOF_CURL_OFF_T 8
191 |
192 | /* curl_off_t constant suffix. */
193 | #define CURL_SUFFIX_CURL_OFF_T L
194 |
195 | /* unsigned curl_off_t constant suffix. */
196 | #define CURL_SUFFIX_CURL_OFF_TU UL
197 |
198 | #endif /* __CURL_CURLBUILD_H */
199 |
--------------------------------------------------------------------------------
/curl/curlrules.h:
--------------------------------------------------------------------------------
1 | #ifndef __CURL_CURLRULES_H
2 | #define __CURL_CURLRULES_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at http://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 |
25 | /* ================================================================ */
26 | /* COMPILE TIME SANITY CHECKS */
27 | /* ================================================================ */
28 |
29 | /*
30 | * NOTE 1:
31 | * -------
32 | *
33 | * All checks done in this file are intentionally placed in a public
34 | * header file which is pulled by curl/curl.h when an application is
35 | * being built using an already built libcurl library. Additionally
36 | * this file is also included and used when building the library.
37 | *
38 | * If compilation fails on this file it is certainly sure that the
39 | * problem is elsewhere. It could be a problem in the curlbuild.h
40 | * header file, or simply that you are using different compilation
41 | * settings than those used to build the library.
42 | *
43 | * Nothing in this file is intended to be modified or adjusted by the
44 | * curl library user nor by the curl library builder.
45 | *
46 | * Do not deactivate any check, these are done to make sure that the
47 | * library is properly built and used.
48 | *
49 | * You can find further help on the libcurl development mailing list:
50 | * http://cool.haxx.se/mailman/listinfo/curl-library/
51 | *
52 | * NOTE 2
53 | * ------
54 | *
55 | * Some of the following compile time checks are based on the fact
56 | * that the dimension of a constant array can not be a negative one.
57 | * In this way if the compile time verification fails, the compilation
58 | * will fail issuing an error. The error description wording is compiler
59 | * dependent but it will be quite similar to one of the following:
60 | *
61 | * "negative subscript or subscript is too large"
62 | * "array must have at least one element"
63 | * "-1 is an illegal array size"
64 | * "size of array is negative"
65 | *
66 | * If you are building an application which tries to use an already
67 | * built libcurl library and you are getting this kind of errors on
68 | * this file, it is a clear indication that there is a mismatch between
69 | * how the library was built and how you are trying to use it for your
70 | * application. Your already compiled or binary library provider is the
71 | * only one who can give you the details you need to properly use it.
72 | */
73 |
74 | /*
75 | * Verify that some macros are actually defined.
76 | */
77 |
78 | #ifndef CURL_SIZEOF_LONG
79 | # error "CURL_SIZEOF_LONG definition is missing!"
80 | Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing
81 | #endif
82 |
83 | #ifndef CURL_TYPEOF_CURL_SOCKLEN_T
84 | # error "CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!"
85 | Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing
86 | #endif
87 |
88 | #ifndef CURL_SIZEOF_CURL_SOCKLEN_T
89 | # error "CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!"
90 | Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing
91 | #endif
92 |
93 | #ifndef CURL_TYPEOF_CURL_OFF_T
94 | # error "CURL_TYPEOF_CURL_OFF_T definition is missing!"
95 | Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing
96 | #endif
97 |
98 | #ifndef CURL_FORMAT_CURL_OFF_T
99 | # error "CURL_FORMAT_CURL_OFF_T definition is missing!"
100 | Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing
101 | #endif
102 |
103 | #ifndef CURL_FORMAT_CURL_OFF_TU
104 | # error "CURL_FORMAT_CURL_OFF_TU definition is missing!"
105 | Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing
106 | #endif
107 |
108 | #ifndef CURL_FORMAT_OFF_T
109 | # error "CURL_FORMAT_OFF_T definition is missing!"
110 | Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing
111 | #endif
112 |
113 | #ifndef CURL_SIZEOF_CURL_OFF_T
114 | # error "CURL_SIZEOF_CURL_OFF_T definition is missing!"
115 | Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing
116 | #endif
117 |
118 | #ifndef CURL_SUFFIX_CURL_OFF_T
119 | # error "CURL_SUFFIX_CURL_OFF_T definition is missing!"
120 | Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing
121 | #endif
122 |
123 | #ifndef CURL_SUFFIX_CURL_OFF_TU
124 | # error "CURL_SUFFIX_CURL_OFF_TU definition is missing!"
125 | Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing
126 | #endif
127 |
128 | /*
129 | * Macros private to this header file.
130 | */
131 |
132 | #define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1
133 |
134 | #define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1
135 |
136 | /*
137 | * Verify that the size previously defined and expected for long
138 | * is the same as the one reported by sizeof() at compile time.
139 | */
140 |
141 | typedef char
142 | __curl_rule_01__
143 | [CurlchkszEQ(long, CURL_SIZEOF_LONG)];
144 |
145 | /*
146 | * Verify that the size previously defined and expected for
147 | * curl_off_t is actually the the same as the one reported
148 | * by sizeof() at compile time.
149 | */
150 |
151 | typedef char
152 | __curl_rule_02__
153 | [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)];
154 |
155 | /*
156 | * Verify at compile time that the size of curl_off_t as reported
157 | * by sizeof() is greater or equal than the one reported for long
158 | * for the current compilation.
159 | */
160 |
161 | typedef char
162 | __curl_rule_03__
163 | [CurlchkszGE(curl_off_t, long)];
164 |
165 | /*
166 | * Verify that the size previously defined and expected for
167 | * curl_socklen_t is actually the the same as the one reported
168 | * by sizeof() at compile time.
169 | */
170 |
171 | typedef char
172 | __curl_rule_04__
173 | [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)];
174 |
175 | /*
176 | * Verify at compile time that the size of curl_socklen_t as reported
177 | * by sizeof() is greater or equal than the one reported for int for
178 | * the current compilation.
179 | */
180 |
181 | typedef char
182 | __curl_rule_05__
183 | [CurlchkszGE(curl_socklen_t, int)];
184 |
185 | /* ================================================================ */
186 | /* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */
187 | /* ================================================================ */
188 |
189 | /*
190 | * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
191 | * these to be visible and exported by the external libcurl interface API,
192 | * while also making them visible to the library internals, simply including
193 | * curl_setup.h, without actually needing to include curl.h internally.
194 | * If some day this section would grow big enough, all this should be moved
195 | * to its own header file.
196 | */
197 |
198 | /*
199 | * Figure out if we can use the ## preprocessor operator, which is supported
200 | * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
201 | * or __cplusplus so we need to carefully check for them too.
202 | */
203 |
204 | #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
205 | defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
206 | defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
207 | defined(__ILEC400__)
208 | /* This compiler is believed to have an ISO compatible preprocessor */
209 | #define CURL_ISOCPP
210 | #else
211 | /* This compiler is believed NOT to have an ISO compatible preprocessor */
212 | #undef CURL_ISOCPP
213 | #endif
214 |
215 | /*
216 | * Macros for minimum-width signed and unsigned curl_off_t integer constants.
217 | */
218 |
219 | #if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
220 | # define __CURL_OFF_T_C_HLPR2(x) x
221 | # define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)
222 | # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
223 | __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
224 | # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
225 | __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
226 | #else
227 | # ifdef CURL_ISOCPP
228 | # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
229 | # else
230 | # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
231 | # endif
232 | # define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)
233 | # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
234 | # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
235 | #endif
236 |
237 | /*
238 | * Get rid of macros private to this header file.
239 | */
240 |
241 | #undef CurlchkszEQ
242 | #undef CurlchkszGE
243 |
244 | /*
245 | * Get rid of macros not intended to exist beyond this point.
246 | */
247 |
248 | #undef CURL_PULL_WS2TCPIP_H
249 | #undef CURL_PULL_SYS_TYPES_H
250 | #undef CURL_PULL_SYS_SOCKET_H
251 | #undef CURL_PULL_SYS_POLL_H
252 | #undef CURL_PULL_STDINT_H
253 | #undef CURL_PULL_INTTYPES_H
254 |
255 | #undef CURL_TYPEOF_CURL_SOCKLEN_T
256 | #undef CURL_TYPEOF_CURL_OFF_T
257 |
258 | #ifdef CURL_NO_OLDIES
259 | #undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */
260 | #endif
261 |
262 | #endif /* __CURL_CURLRULES_H */
263 |
--------------------------------------------------------------------------------
/curl/curlver.h:
--------------------------------------------------------------------------------
1 | #ifndef __CURL_CURLVER_H
2 | #define __CURL_CURLVER_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at http://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 |
25 | /* This header file contains nothing but libcurl version info, generated by
26 | a script at release-time. This was made its own header file in 7.11.2 */
27 |
28 | /* This is the global package copyright */
29 | #define LIBCURL_COPYRIGHT "1996 - 2015 Daniel Stenberg, ."
30 |
31 | /* This is the version number of the libcurl package from which this header
32 | file origins: */
33 | #define LIBCURL_VERSION "7.47.0"
34 |
35 | /* The numeric version number is also available "in parts" by using these
36 | defines: */
37 | #define LIBCURL_VERSION_MAJOR 7
38 | #define LIBCURL_VERSION_MINOR 47
39 | #define LIBCURL_VERSION_PATCH 0
40 |
41 | /* This is the numeric version of the libcurl version number, meant for easier
42 | parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
43 | always follow this syntax:
44 |
45 | 0xXXYYZZ
46 |
47 | Where XX, YY and ZZ are the main version, release and patch numbers in
48 | hexadecimal (using 8 bits each). All three numbers are always represented
49 | using two digits. 1.2 would appear as "0x010200" while version 9.11.7
50 | appears as "0x090b07".
51 |
52 | This 6-digit (24 bits) hexadecimal number does not show pre-release number,
53 | and it is always a greater number in a more recent release. It makes
54 | comparisons with greater than and less than work.
55 |
56 | Note: This define is the full hex number and _does not_ use the
57 | CURL_VERSION_BITS() macro since curl's own configure script greps for it
58 | and needs it to contain the full number.
59 | */
60 | #define LIBCURL_VERSION_NUM 0x072f00
61 |
62 | /*
63 | * This is the date and time when the full source package was created. The
64 | * timestamp is not stored in git, as the timestamp is properly set in the
65 | * tarballs by the maketgz script.
66 | *
67 | * The format of the date should follow this template:
68 | *
69 | * "Mon Feb 12 11:35:33 UTC 2007"
70 | */
71 | #define LIBCURL_TIMESTAMP "Wed Jan 27 07:32:44 UTC 2016"
72 |
73 | #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z)
74 | #define CURL_AT_LEAST_VERSION(x,y,z) \
75 | (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
76 |
77 | #endif /* __CURL_CURLVER_H */
78 |
--------------------------------------------------------------------------------
/curl/easy.h:
--------------------------------------------------------------------------------
1 | #ifndef __CURL_EASY_H
2 | #define __CURL_EASY_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at http://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | CURL_EXTERN CURL *curl_easy_init(void);
29 | CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
30 | CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
31 | CURL_EXTERN void curl_easy_cleanup(CURL *curl);
32 |
33 | /*
34 | * NAME curl_easy_getinfo()
35 | *
36 | * DESCRIPTION
37 | *
38 | * Request internal information from the curl session with this function. The
39 | * third argument MUST be a pointer to a long, a pointer to a char * or a
40 | * pointer to a double (as the documentation describes elsewhere). The data
41 | * pointed to will be filled in accordingly and can be relied upon only if the
42 | * function returns CURLE_OK. This function is intended to get used *AFTER* a
43 | * performed transfer, all results from this function are undefined until the
44 | * transfer is completed.
45 | */
46 | CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
47 |
48 |
49 | /*
50 | * NAME curl_easy_duphandle()
51 | *
52 | * DESCRIPTION
53 | *
54 | * Creates a new curl session handle with the same options set for the handle
55 | * passed in. Duplicating a handle could only be a matter of cloning data and
56 | * options, internal state info and things like persistent connections cannot
57 | * be transferred. It is useful in multithreaded applications when you can run
58 | * curl_easy_duphandle() for each new thread to avoid a series of identical
59 | * curl_easy_setopt() invokes in every thread.
60 | */
61 | CURL_EXTERN CURL* curl_easy_duphandle(CURL *curl);
62 |
63 | /*
64 | * NAME curl_easy_reset()
65 | *
66 | * DESCRIPTION
67 | *
68 | * Re-initializes a CURL handle to the default values. This puts back the
69 | * handle to the same state as it was in when it was just created.
70 | *
71 | * It does keep: live connections, the Session ID cache, the DNS cache and the
72 | * cookies.
73 | */
74 | CURL_EXTERN void curl_easy_reset(CURL *curl);
75 |
76 | /*
77 | * NAME curl_easy_recv()
78 | *
79 | * DESCRIPTION
80 | *
81 | * Receives data from the connected socket. Use after successful
82 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
83 | */
84 | CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen,
85 | size_t *n);
86 |
87 | /*
88 | * NAME curl_easy_send()
89 | *
90 | * DESCRIPTION
91 | *
92 | * Sends data over the connected socket. Use after successful
93 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
94 | */
95 | CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,
96 | size_t buflen, size_t *n);
97 |
98 | #ifdef __cplusplus
99 | }
100 | #endif
101 |
102 | #endif
103 |
--------------------------------------------------------------------------------
/curl/mprintf.h:
--------------------------------------------------------------------------------
1 | #ifndef __CURL_MPRINTF_H
2 | #define __CURL_MPRINTF_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at http://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 |
25 | #include
26 | #include /* needed for FILE */
27 |
28 | #include "curl.h"
29 |
30 | #ifdef __cplusplus
31 | extern "C" {
32 | #endif
33 |
34 | CURL_EXTERN int curl_mprintf(const char *format, ...);
35 | CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);
36 | CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);
37 | CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,
38 | const char *format, ...);
39 | CURL_EXTERN int curl_mvprintf(const char *format, va_list args);
40 | CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);
41 | CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);
42 | CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,
43 | const char *format, va_list args);
44 | CURL_EXTERN char *curl_maprintf(const char *format, ...);
45 | CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
46 |
47 | #ifdef _MPRINTF_REPLACE
48 | # undef printf
49 | # undef fprintf
50 | # undef sprintf
51 | # undef vsprintf
52 | # undef snprintf
53 | # undef vprintf
54 | # undef vfprintf
55 | # undef vsnprintf
56 | # undef aprintf
57 | # undef vaprintf
58 | # define printf curl_mprintf
59 | # define fprintf curl_mfprintf
60 | # define sprintf curl_msprintf
61 | # define vsprintf curl_mvsprintf
62 | # define snprintf curl_msnprintf
63 | # define vprintf curl_mvprintf
64 | # define vfprintf curl_mvfprintf
65 | # define vsnprintf curl_mvsnprintf
66 | # define aprintf curl_maprintf
67 | # define vaprintf curl_mvaprintf
68 | #endif
69 |
70 | #ifdef __cplusplus
71 | }
72 | #endif
73 |
74 | #endif /* __CURL_MPRINTF_H */
75 |
--------------------------------------------------------------------------------
/curl/multi.h:
--------------------------------------------------------------------------------
1 | #ifndef __CURL_MULTI_H
2 | #define __CURL_MULTI_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at http://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 | /*
25 | This is an "external" header file. Don't give away any internals here!
26 |
27 | GOALS
28 |
29 | o Enable a "pull" interface. The application that uses libcurl decides where
30 | and when to ask libcurl to get/send data.
31 |
32 | o Enable multiple simultaneous transfers in the same thread without making it
33 | complicated for the application.
34 |
35 | o Enable the application to select() on its own file descriptors and curl's
36 | file descriptors simultaneous easily.
37 |
38 | */
39 |
40 | /*
41 | * This header file should not really need to include "curl.h" since curl.h
42 | * itself includes this file and we expect user applications to do #include
43 | * without the need for especially including multi.h.
44 | *
45 | * For some reason we added this include here at one point, and rather than to
46 | * break existing (wrongly written) libcurl applications, we leave it as-is
47 | * but with this warning attached.
48 | */
49 | #include "curl.h"
50 |
51 | #ifdef __cplusplus
52 | extern "C" {
53 | #endif
54 |
55 | typedef void CURLM;
56 |
57 | typedef enum {
58 | CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
59 | curl_multi_socket*() soon */
60 | CURLM_OK,
61 | CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */
62 | CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
63 | CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */
64 | CURLM_INTERNAL_ERROR, /* this is a libcurl bug */
65 | CURLM_BAD_SOCKET, /* the passed in socket argument did not match */
66 | CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */
67 | CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was
68 | attempted to get added - again */
69 | CURLM_LAST
70 | } CURLMcode;
71 |
72 | /* just to make code nicer when using curl_multi_socket() you can now check
73 | for CURLM_CALL_MULTI_SOCKET too in the same style it works for
74 | curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */
75 | #define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM
76 |
77 | /* bitmask bits for CURLMOPT_PIPELINING */
78 | #define CURLPIPE_NOTHING 0L
79 | #define CURLPIPE_HTTP1 1L
80 | #define CURLPIPE_MULTIPLEX 2L
81 |
82 | typedef enum {
83 | CURLMSG_NONE, /* first, not used */
84 | CURLMSG_DONE, /* This easy handle has completed. 'result' contains
85 | the CURLcode of the transfer */
86 | CURLMSG_LAST /* last, not used */
87 | } CURLMSG;
88 |
89 | struct CURLMsg {
90 | CURLMSG msg; /* what this message means */
91 | CURL *easy_handle; /* the handle it concerns */
92 | union {
93 | void *whatever; /* message-specific data */
94 | CURLcode result; /* return code for transfer */
95 | } data;
96 | };
97 | typedef struct CURLMsg CURLMsg;
98 |
99 | /* Based on poll(2) structure and values.
100 | * We don't use pollfd and POLL* constants explicitly
101 | * to cover platforms without poll(). */
102 | #define CURL_WAIT_POLLIN 0x0001
103 | #define CURL_WAIT_POLLPRI 0x0002
104 | #define CURL_WAIT_POLLOUT 0x0004
105 |
106 | struct curl_waitfd {
107 | curl_socket_t fd;
108 | short events;
109 | short revents; /* not supported yet */
110 | };
111 |
112 | /*
113 | * Name: curl_multi_init()
114 | *
115 | * Desc: inititalize multi-style curl usage
116 | *
117 | * Returns: a new CURLM handle to use in all 'curl_multi' functions.
118 | */
119 | CURL_EXTERN CURLM *curl_multi_init(void);
120 |
121 | /*
122 | * Name: curl_multi_add_handle()
123 | *
124 | * Desc: add a standard curl handle to the multi stack
125 | *
126 | * Returns: CURLMcode type, general multi error code.
127 | */
128 | CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,
129 | CURL *curl_handle);
130 |
131 | /*
132 | * Name: curl_multi_remove_handle()
133 | *
134 | * Desc: removes a curl handle from the multi stack again
135 | *
136 | * Returns: CURLMcode type, general multi error code.
137 | */
138 | CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
139 | CURL *curl_handle);
140 |
141 | /*
142 | * Name: curl_multi_fdset()
143 | *
144 | * Desc: Ask curl for its fd_set sets. The app can use these to select() or
145 | * poll() on. We want curl_multi_perform() called as soon as one of
146 | * them are ready.
147 | *
148 | * Returns: CURLMcode type, general multi error code.
149 | */
150 | CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
151 | fd_set *read_fd_set,
152 | fd_set *write_fd_set,
153 | fd_set *exc_fd_set,
154 | int *max_fd);
155 |
156 | /*
157 | * Name: curl_multi_wait()
158 | *
159 | * Desc: Poll on all fds within a CURLM set as well as any
160 | * additional fds passed to the function.
161 | *
162 | * Returns: CURLMcode type, general multi error code.
163 | */
164 | CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,
165 | struct curl_waitfd extra_fds[],
166 | unsigned int extra_nfds,
167 | int timeout_ms,
168 | int *ret);
169 |
170 | /*
171 | * Name: curl_multi_perform()
172 | *
173 | * Desc: When the app thinks there's data available for curl it calls this
174 | * function to read/write whatever there is right now. This returns
175 | * as soon as the reads and writes are done. This function does not
176 | * require that there actually is data available for reading or that
177 | * data can be written, it can be called just in case. It returns
178 | * the number of handles that still transfer data in the second
179 | * argument's integer-pointer.
180 | *
181 | * Returns: CURLMcode type, general multi error code. *NOTE* that this only
182 | * returns errors etc regarding the whole multi stack. There might
183 | * still have occurred problems on invidual transfers even when this
184 | * returns OK.
185 | */
186 | CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
187 | int *running_handles);
188 |
189 | /*
190 | * Name: curl_multi_cleanup()
191 | *
192 | * Desc: Cleans up and removes a whole multi stack. It does not free or
193 | * touch any individual easy handles in any way. We need to define
194 | * in what state those handles will be if this function is called
195 | * in the middle of a transfer.
196 | *
197 | * Returns: CURLMcode type, general multi error code.
198 | */
199 | CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
200 |
201 | /*
202 | * Name: curl_multi_info_read()
203 | *
204 | * Desc: Ask the multi handle if there's any messages/informationals from
205 | * the individual transfers. Messages include informationals such as
206 | * error code from the transfer or just the fact that a transfer is
207 | * completed. More details on these should be written down as well.
208 | *
209 | * Repeated calls to this function will return a new struct each
210 | * time, until a special "end of msgs" struct is returned as a signal
211 | * that there is no more to get at this point.
212 | *
213 | * The data the returned pointer points to will not survive calling
214 | * curl_multi_cleanup().
215 | *
216 | * The 'CURLMsg' struct is meant to be very simple and only contain
217 | * very basic informations. If more involved information is wanted,
218 | * we will provide the particular "transfer handle" in that struct
219 | * and that should/could/would be used in subsequent
220 | * curl_easy_getinfo() calls (or similar). The point being that we
221 | * must never expose complex structs to applications, as then we'll
222 | * undoubtably get backwards compatibility problems in the future.
223 | *
224 | * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
225 | * of structs. It also writes the number of messages left in the
226 | * queue (after this read) in the integer the second argument points
227 | * to.
228 | */
229 | CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
230 | int *msgs_in_queue);
231 |
232 | /*
233 | * Name: curl_multi_strerror()
234 | *
235 | * Desc: The curl_multi_strerror function may be used to turn a CURLMcode
236 | * value into the equivalent human readable error string. This is
237 | * useful for printing meaningful error messages.
238 | *
239 | * Returns: A pointer to a zero-terminated error message.
240 | */
241 | CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
242 |
243 | /*
244 | * Name: curl_multi_socket() and
245 | * curl_multi_socket_all()
246 | *
247 | * Desc: An alternative version of curl_multi_perform() that allows the
248 | * application to pass in one of the file descriptors that have been
249 | * detected to have "action" on them and let libcurl perform.
250 | * See man page for details.
251 | */
252 | #define CURL_POLL_NONE 0
253 | #define CURL_POLL_IN 1
254 | #define CURL_POLL_OUT 2
255 | #define CURL_POLL_INOUT 3
256 | #define CURL_POLL_REMOVE 4
257 |
258 | #define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
259 |
260 | #define CURL_CSELECT_IN 0x01
261 | #define CURL_CSELECT_OUT 0x02
262 | #define CURL_CSELECT_ERR 0x04
263 |
264 | typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */
265 | curl_socket_t s, /* socket */
266 | int what, /* see above */
267 | void *userp, /* private callback
268 | pointer */
269 | void *socketp); /* private socket
270 | pointer */
271 | /*
272 | * Name: curl_multi_timer_callback
273 | *
274 | * Desc: Called by libcurl whenever the library detects a change in the
275 | * maximum number of milliseconds the app is allowed to wait before
276 | * curl_multi_socket() or curl_multi_perform() must be called
277 | * (to allow libcurl's timed events to take place).
278 | *
279 | * Returns: The callback should return zero.
280 | */
281 | typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */
282 | long timeout_ms, /* see above */
283 | void *userp); /* private callback
284 | pointer */
285 |
286 | CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,
287 | int *running_handles);
288 |
289 | CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,
290 | curl_socket_t s,
291 | int ev_bitmask,
292 | int *running_handles);
293 |
294 | CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,
295 | int *running_handles);
296 |
297 | #ifndef CURL_ALLOW_OLD_MULTI_SOCKET
298 | /* This macro below was added in 7.16.3 to push users who recompile to use
299 | the new curl_multi_socket_action() instead of the old curl_multi_socket()
300 | */
301 | #define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)
302 | #endif
303 |
304 | /*
305 | * Name: curl_multi_timeout()
306 | *
307 | * Desc: Returns the maximum number of milliseconds the app is allowed to
308 | * wait before curl_multi_socket() or curl_multi_perform() must be
309 | * called (to allow libcurl's timed events to take place).
310 | *
311 | * Returns: CURLM error code.
312 | */
313 | CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,
314 | long *milliseconds);
315 |
316 | #undef CINIT /* re-using the same name as in curl.h */
317 |
318 | #ifdef CURL_ISOCPP
319 | #define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num
320 | #else
321 | /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
322 | #define LONG CURLOPTTYPE_LONG
323 | #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
324 | #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
325 | #define OFF_T CURLOPTTYPE_OFF_T
326 | #define CINIT(name,type,number) CURLMOPT_/**/name = type + number
327 | #endif
328 |
329 | typedef enum {
330 | /* This is the socket callback function pointer */
331 | CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),
332 |
333 | /* This is the argument passed to the socket callback */
334 | CINIT(SOCKETDATA, OBJECTPOINT, 2),
335 |
336 | /* set to 1 to enable pipelining for this multi handle */
337 | CINIT(PIPELINING, LONG, 3),
338 |
339 | /* This is the timer callback function pointer */
340 | CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),
341 |
342 | /* This is the argument passed to the timer callback */
343 | CINIT(TIMERDATA, OBJECTPOINT, 5),
344 |
345 | /* maximum number of entries in the connection cache */
346 | CINIT(MAXCONNECTS, LONG, 6),
347 |
348 | /* maximum number of (pipelining) connections to one host */
349 | CINIT(MAX_HOST_CONNECTIONS, LONG, 7),
350 |
351 | /* maximum number of requests in a pipeline */
352 | CINIT(MAX_PIPELINE_LENGTH, LONG, 8),
353 |
354 | /* a connection with a content-length longer than this
355 | will not be considered for pipelining */
356 | CINIT(CONTENT_LENGTH_PENALTY_SIZE, OFF_T, 9),
357 |
358 | /* a connection with a chunk length longer than this
359 | will not be considered for pipelining */
360 | CINIT(CHUNK_LENGTH_PENALTY_SIZE, OFF_T, 10),
361 |
362 | /* a list of site names(+port) that are blacklisted from
363 | pipelining */
364 | CINIT(PIPELINING_SITE_BL, OBJECTPOINT, 11),
365 |
366 | /* a list of server types that are blacklisted from
367 | pipelining */
368 | CINIT(PIPELINING_SERVER_BL, OBJECTPOINT, 12),
369 |
370 | /* maximum number of open connections in total */
371 | CINIT(MAX_TOTAL_CONNECTIONS, LONG, 13),
372 |
373 | /* This is the server push callback function pointer */
374 | CINIT(PUSHFUNCTION, FUNCTIONPOINT, 14),
375 |
376 | /* This is the argument passed to the server push callback */
377 | CINIT(PUSHDATA, OBJECTPOINT, 15),
378 |
379 | CURLMOPT_LASTENTRY /* the last unused */
380 | } CURLMoption;
381 |
382 |
383 | /*
384 | * Name: curl_multi_setopt()
385 | *
386 | * Desc: Sets options for the multi handle.
387 | *
388 | * Returns: CURLM error code.
389 | */
390 | CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,
391 | CURLMoption option, ...);
392 |
393 |
394 | /*
395 | * Name: curl_multi_assign()
396 | *
397 | * Desc: This function sets an association in the multi handle between the
398 | * given socket and a private pointer of the application. This is
399 | * (only) useful for curl_multi_socket uses.
400 | *
401 | * Returns: CURLM error code.
402 | */
403 | CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
404 | curl_socket_t sockfd, void *sockp);
405 |
406 |
407 | /*
408 | * Name: curl_push_callback
409 | *
410 | * Desc: This callback gets called when a new stream is being pushed by the
411 | * server. It approves or denies the new stream.
412 | *
413 | * Returns: CURL_PUSH_OK or CURL_PUSH_DENY.
414 | */
415 | #define CURL_PUSH_OK 0
416 | #define CURL_PUSH_DENY 1
417 |
418 | struct curl_pushheaders; /* forward declaration only */
419 |
420 | CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h,
421 | size_t num);
422 | CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h,
423 | const char *name);
424 |
425 | typedef int (*curl_push_callback)(CURL *parent,
426 | CURL *easy,
427 | size_t num_headers,
428 | struct curl_pushheaders *headers,
429 | void *userp);
430 |
431 | #ifdef __cplusplus
432 | } /* end of extern "C" */
433 | #endif
434 |
435 | #endif
436 |
--------------------------------------------------------------------------------
/curl/stdcheaders.h:
--------------------------------------------------------------------------------
1 | #ifndef __STDC_HEADERS_H
2 | #define __STDC_HEADERS_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at http://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 |
25 | #include
26 |
27 | size_t fread (void *, size_t, size_t, FILE *);
28 | size_t fwrite (const void *, size_t, size_t, FILE *);
29 |
30 | int strcasecmp(const char *, const char *);
31 | int strncasecmp(const char *, const char *, size_t);
32 |
33 | #endif /* __STDC_HEADERS_H */
34 |
--------------------------------------------------------------------------------
/curl/system.h:
--------------------------------------------------------------------------------
1 | #ifndef __CURL_SYSTEM_H
2 | #define __CURL_SYSTEM_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at https://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 |
25 | /*
26 | * Try to keep one section per platform, compiler and architecture, otherwise,
27 | * if an existing section is reused for a different one and later on the
28 | * original is adjusted, probably the piggybacking one can be adversely
29 | * changed.
30 | *
31 | * In order to differentiate between platforms/compilers/architectures use
32 | * only compiler built in predefined preprocessor symbols.
33 | *
34 | * curl_off_t
35 | * ----------
36 | *
37 | * For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit
38 | * wide signed integral data type. The width of this data type must remain
39 | * constant and independent of any possible large file support settings.
40 | *
41 | * As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit
42 | * wide signed integral data type if there is no 64-bit type.
43 | *
44 | * As a general rule, curl_off_t shall not be mapped to off_t. This rule shall
45 | * only be violated if off_t is the only 64-bit data type available and the
46 | * size of off_t is independent of large file support settings. Keep your
47 | * build on the safe side avoiding an off_t gating. If you have a 64-bit
48 | * off_t then take for sure that another 64-bit data type exists, dig deeper
49 | * and you will find it.
50 | *
51 | */
52 |
53 | #if defined(__DJGPP__) || defined(__GO32__)
54 | # if defined(__DJGPP__) && (__DJGPP__ > 1)
55 | # define CURL_TYPEOF_CURL_OFF_T long long
56 | # define CURL_FORMAT_CURL_OFF_T "lld"
57 | # define CURL_FORMAT_CURL_OFF_TU "llu"
58 | # define CURL_SUFFIX_CURL_OFF_T LL
59 | # define CURL_SUFFIX_CURL_OFF_TU ULL
60 | # else
61 | # define CURL_TYPEOF_CURL_OFF_T long
62 | # define CURL_FORMAT_CURL_OFF_T "ld"
63 | # define CURL_FORMAT_CURL_OFF_TU "lu"
64 | # define CURL_SUFFIX_CURL_OFF_T L
65 | # define CURL_SUFFIX_CURL_OFF_TU UL
66 | # endif
67 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
68 |
69 | #elif defined(__SALFORDC__)
70 | # define CURL_TYPEOF_CURL_OFF_T long
71 | # define CURL_FORMAT_CURL_OFF_T "ld"
72 | # define CURL_FORMAT_CURL_OFF_TU "lu"
73 | # define CURL_SUFFIX_CURL_OFF_T L
74 | # define CURL_SUFFIX_CURL_OFF_TU UL
75 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
76 |
77 | #elif defined(__BORLANDC__)
78 | # if (__BORLANDC__ < 0x520)
79 | # define CURL_TYPEOF_CURL_OFF_T long
80 | # define CURL_FORMAT_CURL_OFF_T "ld"
81 | # define CURL_FORMAT_CURL_OFF_TU "lu"
82 | # define CURL_SUFFIX_CURL_OFF_T L
83 | # define CURL_SUFFIX_CURL_OFF_TU UL
84 | # else
85 | # define CURL_TYPEOF_CURL_OFF_T __int64
86 | # define CURL_FORMAT_CURL_OFF_T "I64d"
87 | # define CURL_FORMAT_CURL_OFF_TU "I64u"
88 | # define CURL_SUFFIX_CURL_OFF_T i64
89 | # define CURL_SUFFIX_CURL_OFF_TU ui64
90 | # endif
91 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
92 |
93 | #elif defined(__TURBOC__)
94 | # define CURL_TYPEOF_CURL_OFF_T long
95 | # define CURL_FORMAT_CURL_OFF_T "ld"
96 | # define CURL_FORMAT_CURL_OFF_TU "lu"
97 | # define CURL_SUFFIX_CURL_OFF_T L
98 | # define CURL_SUFFIX_CURL_OFF_TU UL
99 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
100 |
101 | #elif defined(__WATCOMC__)
102 | # if defined(__386__)
103 | # define CURL_TYPEOF_CURL_OFF_T __int64
104 | # define CURL_FORMAT_CURL_OFF_T "I64d"
105 | # define CURL_FORMAT_CURL_OFF_TU "I64u"
106 | # define CURL_SUFFIX_CURL_OFF_T i64
107 | # define CURL_SUFFIX_CURL_OFF_TU ui64
108 | # else
109 | # define CURL_TYPEOF_CURL_OFF_T long
110 | # define CURL_FORMAT_CURL_OFF_T "ld"
111 | # define CURL_FORMAT_CURL_OFF_TU "lu"
112 | # define CURL_SUFFIX_CURL_OFF_T L
113 | # define CURL_SUFFIX_CURL_OFF_TU UL
114 | # endif
115 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
116 |
117 | #elif defined(__POCC__)
118 | # if (__POCC__ < 280)
119 | # define CURL_TYPEOF_CURL_OFF_T long
120 | # define CURL_FORMAT_CURL_OFF_T "ld"
121 | # define CURL_FORMAT_CURL_OFF_TU "lu"
122 | # define CURL_SUFFIX_CURL_OFF_T L
123 | # define CURL_SUFFIX_CURL_OFF_TU UL
124 | # elif defined(_MSC_VER)
125 | # define CURL_TYPEOF_CURL_OFF_T __int64
126 | # define CURL_FORMAT_CURL_OFF_T "I64d"
127 | # define CURL_FORMAT_CURL_OFF_TU "I64u"
128 | # define CURL_SUFFIX_CURL_OFF_T i64
129 | # define CURL_SUFFIX_CURL_OFF_TU ui64
130 | # else
131 | # define CURL_TYPEOF_CURL_OFF_T long long
132 | # define CURL_FORMAT_CURL_OFF_T "lld"
133 | # define CURL_FORMAT_CURL_OFF_TU "llu"
134 | # define CURL_SUFFIX_CURL_OFF_T LL
135 | # define CURL_SUFFIX_CURL_OFF_TU ULL
136 | # endif
137 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
138 |
139 | #elif defined(__LCC__)
140 | # define CURL_TYPEOF_CURL_OFF_T long
141 | # define CURL_FORMAT_CURL_OFF_T "ld"
142 | # define CURL_FORMAT_CURL_OFF_TU "lu"
143 | # define CURL_SUFFIX_CURL_OFF_T L
144 | # define CURL_SUFFIX_CURL_OFF_TU UL
145 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
146 |
147 | #elif defined(__SYMBIAN32__)
148 | # if defined(__EABI__) /* Treat all ARM compilers equally */
149 | # define CURL_TYPEOF_CURL_OFF_T long long
150 | # define CURL_FORMAT_CURL_OFF_T "lld"
151 | # define CURL_FORMAT_CURL_OFF_TU "llu"
152 | # define CURL_SUFFIX_CURL_OFF_T LL
153 | # define CURL_SUFFIX_CURL_OFF_TU ULL
154 | # elif defined(__CW32__)
155 | # pragma longlong on
156 | # define CURL_TYPEOF_CURL_OFF_T long long
157 | # define CURL_FORMAT_CURL_OFF_T "lld"
158 | # define CURL_FORMAT_CURL_OFF_TU "llu"
159 | # define CURL_SUFFIX_CURL_OFF_T LL
160 | # define CURL_SUFFIX_CURL_OFF_TU ULL
161 | # elif defined(__VC32__)
162 | # define CURL_TYPEOF_CURL_OFF_T __int64
163 | # define CURL_FORMAT_CURL_OFF_T "lld"
164 | # define CURL_FORMAT_CURL_OFF_TU "llu"
165 | # define CURL_SUFFIX_CURL_OFF_T LL
166 | # define CURL_SUFFIX_CURL_OFF_TU ULL
167 | # endif
168 | # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
169 |
170 | #elif defined(__MWERKS__)
171 | # define CURL_TYPEOF_CURL_OFF_T long long
172 | # define CURL_FORMAT_CURL_OFF_T "lld"
173 | # define CURL_FORMAT_CURL_OFF_TU "llu"
174 | # define CURL_SUFFIX_CURL_OFF_T LL
175 | # define CURL_SUFFIX_CURL_OFF_TU ULL
176 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
177 |
178 | #elif defined(_WIN32_WCE)
179 | # define CURL_TYPEOF_CURL_OFF_T __int64
180 | # define CURL_FORMAT_CURL_OFF_T "I64d"
181 | # define CURL_FORMAT_CURL_OFF_TU "I64u"
182 | # define CURL_SUFFIX_CURL_OFF_T i64
183 | # define CURL_SUFFIX_CURL_OFF_TU ui64
184 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
185 |
186 | #elif defined(__MINGW32__)
187 | # define CURL_TYPEOF_CURL_OFF_T long long
188 | # define CURL_FORMAT_CURL_OFF_T "I64d"
189 | # define CURL_FORMAT_CURL_OFF_TU "I64u"
190 | # define CURL_SUFFIX_CURL_OFF_T LL
191 | # define CURL_SUFFIX_CURL_OFF_TU ULL
192 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
193 | # define CURL_PULL_SYS_TYPES_H 1
194 | # define CURL_PULL_WS2TCPIP_H 1
195 |
196 | #elif defined(__VMS)
197 | # if defined(__VAX)
198 | # define CURL_TYPEOF_CURL_OFF_T long
199 | # define CURL_FORMAT_CURL_OFF_T "ld"
200 | # define CURL_FORMAT_CURL_OFF_TU "lu"
201 | # define CURL_SUFFIX_CURL_OFF_T L
202 | # define CURL_SUFFIX_CURL_OFF_TU UL
203 | # else
204 | # define CURL_TYPEOF_CURL_OFF_T long long
205 | # define CURL_FORMAT_CURL_OFF_T "lld"
206 | # define CURL_FORMAT_CURL_OFF_TU "llu"
207 | # define CURL_SUFFIX_CURL_OFF_T LL
208 | # define CURL_SUFFIX_CURL_OFF_TU ULL
209 | # endif
210 | # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
211 |
212 | #elif defined(__OS400__)
213 | # if defined(__ILEC400__)
214 | # define CURL_TYPEOF_CURL_OFF_T long long
215 | # define CURL_FORMAT_CURL_OFF_T "lld"
216 | # define CURL_FORMAT_CURL_OFF_TU "llu"
217 | # define CURL_SUFFIX_CURL_OFF_T LL
218 | # define CURL_SUFFIX_CURL_OFF_TU ULL
219 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
220 | # define CURL_PULL_SYS_TYPES_H 1
221 | # define CURL_PULL_SYS_SOCKET_H 1
222 | # endif
223 |
224 | #elif defined(__MVS__)
225 | # if defined(__IBMC__) || defined(__IBMCPP__)
226 | # if defined(_ILP32)
227 | # elif defined(_LP64)
228 | # endif
229 | # if defined(_LONG_LONG)
230 | # define CURL_TYPEOF_CURL_OFF_T long long
231 | # define CURL_FORMAT_CURL_OFF_T "lld"
232 | # define CURL_FORMAT_CURL_OFF_TU "llu"
233 | # define CURL_SUFFIX_CURL_OFF_T LL
234 | # define CURL_SUFFIX_CURL_OFF_TU ULL
235 | # elif defined(_LP64)
236 | # define CURL_TYPEOF_CURL_OFF_T long
237 | # define CURL_FORMAT_CURL_OFF_T "ld"
238 | # define CURL_FORMAT_CURL_OFF_TU "lu"
239 | # define CURL_SUFFIX_CURL_OFF_T L
240 | # define CURL_SUFFIX_CURL_OFF_TU UL
241 | # else
242 | # define CURL_TYPEOF_CURL_OFF_T long
243 | # define CURL_FORMAT_CURL_OFF_T "ld"
244 | # define CURL_FORMAT_CURL_OFF_TU "lu"
245 | # define CURL_SUFFIX_CURL_OFF_T L
246 | # define CURL_SUFFIX_CURL_OFF_TU UL
247 | # endif
248 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
249 | # define CURL_PULL_SYS_TYPES_H 1
250 | # define CURL_PULL_SYS_SOCKET_H 1
251 | # endif
252 |
253 | #elif defined(__370__)
254 | # if defined(__IBMC__) || defined(__IBMCPP__)
255 | # if defined(_ILP32)
256 | # elif defined(_LP64)
257 | # endif
258 | # if defined(_LONG_LONG)
259 | # define CURL_TYPEOF_CURL_OFF_T long long
260 | # define CURL_FORMAT_CURL_OFF_T "lld"
261 | # define CURL_FORMAT_CURL_OFF_TU "llu"
262 | # define CURL_SUFFIX_CURL_OFF_T LL
263 | # define CURL_SUFFIX_CURL_OFF_TU ULL
264 | # elif defined(_LP64)
265 | # define CURL_TYPEOF_CURL_OFF_T long
266 | # define CURL_FORMAT_CURL_OFF_T "ld"
267 | # define CURL_FORMAT_CURL_OFF_TU "lu"
268 | # define CURL_SUFFIX_CURL_OFF_T L
269 | # define CURL_SUFFIX_CURL_OFF_TU UL
270 | # else
271 | # define CURL_TYPEOF_CURL_OFF_T long
272 | # define CURL_FORMAT_CURL_OFF_T "ld"
273 | # define CURL_FORMAT_CURL_OFF_TU "lu"
274 | # define CURL_SUFFIX_CURL_OFF_T L
275 | # define CURL_SUFFIX_CURL_OFF_TU UL
276 | # endif
277 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
278 | # define CURL_PULL_SYS_TYPES_H 1
279 | # define CURL_PULL_SYS_SOCKET_H 1
280 | # endif
281 |
282 | #elif defined(TPF)
283 | # define CURL_TYPEOF_CURL_OFF_T long
284 | # define CURL_FORMAT_CURL_OFF_T "ld"
285 | # define CURL_FORMAT_CURL_OFF_TU "lu"
286 | # define CURL_SUFFIX_CURL_OFF_T L
287 | # define CURL_SUFFIX_CURL_OFF_TU UL
288 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
289 |
290 | #elif defined(__TINYC__) /* also known as tcc */
291 |
292 | # define CURL_TYPEOF_CURL_OFF_T long long
293 | # define CURL_FORMAT_CURL_OFF_T "lld"
294 | # define CURL_FORMAT_CURL_OFF_TU "llu"
295 | # define CURL_SUFFIX_CURL_OFF_T LL
296 | # define CURL_SUFFIX_CURL_OFF_TU ULL
297 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
298 | # define CURL_PULL_SYS_TYPES_H 1
299 | # define CURL_PULL_SYS_SOCKET_H 1
300 |
301 | #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* Oracle Solaris Studio */
302 | # if !defined(__LP64) && (defined(__ILP32) || \
303 | defined(__i386) || \
304 | defined(__sparcv8) || \
305 | defined(__sparcv8plus))
306 | # define CURL_TYPEOF_CURL_OFF_T long long
307 | # define CURL_FORMAT_CURL_OFF_T "lld"
308 | # define CURL_FORMAT_CURL_OFF_TU "llu"
309 | # define CURL_SUFFIX_CURL_OFF_T LL
310 | # define CURL_SUFFIX_CURL_OFF_TU ULL
311 | # elif defined(__LP64) || \
312 | defined(__amd64) || defined(__sparcv9)
313 | # define CURL_TYPEOF_CURL_OFF_T long
314 | # define CURL_FORMAT_CURL_OFF_T "ld"
315 | # define CURL_FORMAT_CURL_OFF_TU "lu"
316 | # define CURL_SUFFIX_CURL_OFF_T L
317 | # define CURL_SUFFIX_CURL_OFF_TU UL
318 | # endif
319 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
320 | # define CURL_PULL_SYS_TYPES_H 1
321 | # define CURL_PULL_SYS_SOCKET_H 1
322 |
323 | #elif defined(__xlc__) /* IBM xlc compiler */
324 | # if !defined(_LP64)
325 | # define CURL_TYPEOF_CURL_OFF_T long long
326 | # define CURL_FORMAT_CURL_OFF_T "lld"
327 | # define CURL_FORMAT_CURL_OFF_TU "llu"
328 | # define CURL_SUFFIX_CURL_OFF_T LL
329 | # define CURL_SUFFIX_CURL_OFF_TU ULL
330 | # else
331 | # define CURL_TYPEOF_CURL_OFF_T long
332 | # define CURL_FORMAT_CURL_OFF_T "ld"
333 | # define CURL_FORMAT_CURL_OFF_TU "lu"
334 | # define CURL_SUFFIX_CURL_OFF_T L
335 | # define CURL_SUFFIX_CURL_OFF_TU UL
336 | # endif
337 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
338 | # define CURL_PULL_SYS_TYPES_H 1
339 | # define CURL_PULL_SYS_SOCKET_H 1
340 |
341 | /* ===================================== */
342 | /* KEEP MSVC THE PENULTIMATE ENTRY */
343 | /* ===================================== */
344 |
345 | #elif defined(_MSC_VER)
346 | # if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
347 | # define CURL_TYPEOF_CURL_OFF_T __int64
348 | # define CURL_FORMAT_CURL_OFF_T "I64d"
349 | # define CURL_FORMAT_CURL_OFF_TU "I64u"
350 | # define CURL_SUFFIX_CURL_OFF_T i64
351 | # define CURL_SUFFIX_CURL_OFF_TU ui64
352 | # else
353 | # define CURL_TYPEOF_CURL_OFF_T long
354 | # define CURL_FORMAT_CURL_OFF_T "ld"
355 | # define CURL_FORMAT_CURL_OFF_TU "lu"
356 | # define CURL_SUFFIX_CURL_OFF_T L
357 | # define CURL_SUFFIX_CURL_OFF_TU UL
358 | # endif
359 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
360 |
361 | /* ===================================== */
362 | /* KEEP GENERIC GCC THE LAST ENTRY */
363 | /* ===================================== */
364 |
365 | #elif defined(__GNUC__) && !defined(_SCO_DS)
366 | # if !defined(__LP64__) && \
367 | (defined(__ILP32__) || defined(__i386__) || defined(__hppa__) || \
368 | defined(__ppc__) || defined(__powerpc__) || defined(__arm__) || \
369 | defined(__sparc__) || defined(__mips__) || defined(__sh__) || \
370 | defined(__XTENSA__) || \
371 | (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4) || \
372 | (defined(__LONG_MAX__) && __LONG_MAX__ == 2147483647L))
373 | # define CURL_TYPEOF_CURL_OFF_T long long
374 | # define CURL_FORMAT_CURL_OFF_T "lld"
375 | # define CURL_FORMAT_CURL_OFF_TU "llu"
376 | # define CURL_SUFFIX_CURL_OFF_T LL
377 | # define CURL_SUFFIX_CURL_OFF_TU ULL
378 | # elif defined(__LP64__) || \
379 | defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \
380 | (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \
381 | (defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L)
382 | # define CURL_TYPEOF_CURL_OFF_T long
383 | # define CURL_FORMAT_CURL_OFF_T "ld"
384 | # define CURL_FORMAT_CURL_OFF_TU "lu"
385 | # define CURL_SUFFIX_CURL_OFF_T L
386 | # define CURL_SUFFIX_CURL_OFF_TU UL
387 | # endif
388 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
389 | # define CURL_PULL_SYS_TYPES_H 1
390 | # define CURL_PULL_SYS_SOCKET_H 1
391 |
392 | #else
393 | /* generic "safe guess" on old 32 bit style */
394 | # define CURL_TYPEOF_CURL_OFF_T long
395 | # define CURL_FORMAT_CURL_OFF_T "ld"
396 | # define CURL_FORMAT_CURL_OFF_TU "lu"
397 | # define CURL_SUFFIX_CURL_OFF_T L
398 | # define CURL_SUFFIX_CURL_OFF_TU UL
399 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
400 | #endif
401 |
402 | #ifdef _AIX
403 | /* AIX needs */
404 | #define CURL_PULL_SYS_POLL_H
405 | #endif
406 |
407 |
408 | /* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file */
409 | /* ws2tcpip.h is required here to properly make type definitions below. */
410 | #ifdef CURL_PULL_WS2TCPIP_H
411 | # include
412 | # include
413 | # include
414 | #endif
415 |
416 | /* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */
417 | /* sys/types.h is required here to properly make type definitions below. */
418 | #ifdef CURL_PULL_SYS_TYPES_H
419 | # include
420 | #endif
421 |
422 | /* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
423 | /* sys/socket.h is required here to properly make type definitions below. */
424 | #ifdef CURL_PULL_SYS_SOCKET_H
425 | # include
426 | #endif
427 |
428 | /* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file */
429 | /* sys/poll.h is required here to properly make type definitions below. */
430 | #ifdef CURL_PULL_SYS_POLL_H
431 | # include
432 | #endif
433 |
434 | /* Data type definition of curl_socklen_t. */
435 | #ifdef CURL_TYPEOF_CURL_SOCKLEN_T
436 | typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
437 | #endif
438 |
439 | /* Data type definition of curl_off_t. */
440 |
441 | #ifdef CURL_TYPEOF_CURL_OFF_T
442 | typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
443 | #endif
444 |
445 | /*
446 | * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
447 | * these to be visible and exported by the external libcurl interface API,
448 | * while also making them visible to the library internals, simply including
449 | * curl_setup.h, without actually needing to include curl.h internally.
450 | * If some day this section would grow big enough, all this should be moved
451 | * to its own header file.
452 | */
453 |
454 | /*
455 | * Figure out if we can use the ## preprocessor operator, which is supported
456 | * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
457 | * or __cplusplus so we need to carefully check for them too.
458 | */
459 |
460 | #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
461 | defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
462 | defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
463 | defined(__ILEC400__)
464 | /* This compiler is believed to have an ISO compatible preprocessor */
465 | #define CURL_ISOCPP
466 | #else
467 | /* This compiler is believed NOT to have an ISO compatible preprocessor */
468 | #undef CURL_ISOCPP
469 | #endif
470 |
471 | /*
472 | * Macros for minimum-width signed and unsigned curl_off_t integer constants.
473 | */
474 |
475 | #if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
476 | # define __CURL_OFF_T_C_HLPR2(x) x
477 | # define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)
478 | # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
479 | __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
480 | # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
481 | __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
482 | #else
483 | # ifdef CURL_ISOCPP
484 | # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
485 | # else
486 | # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
487 | # endif
488 | # define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)
489 | # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
490 | # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
491 | #endif
492 |
493 | #endif /* __CURL_SYSTEM_H */
494 |
--------------------------------------------------------------------------------
/curl/typecheck-gcc.h:
--------------------------------------------------------------------------------
1 | #ifndef __CURL_TYPECHECK_GCC_H
2 | #define __CURL_TYPECHECK_GCC_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at http://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 |
25 | /* wraps curl_easy_setopt() with typechecking */
26 |
27 | /* To add a new kind of warning, add an
28 | * if(_curl_is_sometype_option(_curl_opt))
29 | * if(!_curl_is_sometype(value))
30 | * _curl_easy_setopt_err_sometype();
31 | * block and define _curl_is_sometype_option, _curl_is_sometype and
32 | * _curl_easy_setopt_err_sometype below
33 | *
34 | * NOTE: We use two nested 'if' statements here instead of the && operator, in
35 | * order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x
36 | * when compiling with -Wlogical-op.
37 | *
38 | * To add an option that uses the same type as an existing option, you'll just
39 | * need to extend the appropriate _curl_*_option macro
40 | */
41 | #define curl_easy_setopt(handle, option, value) \
42 | __extension__ ({ \
43 | __typeof__ (option) _curl_opt = option; \
44 | if(__builtin_constant_p(_curl_opt)) { \
45 | if(_curl_is_long_option(_curl_opt)) \
46 | if(!_curl_is_long(value)) \
47 | _curl_easy_setopt_err_long(); \
48 | if(_curl_is_off_t_option(_curl_opt)) \
49 | if(!_curl_is_off_t(value)) \
50 | _curl_easy_setopt_err_curl_off_t(); \
51 | if(_curl_is_string_option(_curl_opt)) \
52 | if(!_curl_is_string(value)) \
53 | _curl_easy_setopt_err_string(); \
54 | if(_curl_is_write_cb_option(_curl_opt)) \
55 | if(!_curl_is_write_cb(value)) \
56 | _curl_easy_setopt_err_write_callback(); \
57 | if((_curl_opt) == CURLOPT_READFUNCTION) \
58 | if(!_curl_is_read_cb(value)) \
59 | _curl_easy_setopt_err_read_cb(); \
60 | if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \
61 | if(!_curl_is_ioctl_cb(value)) \
62 | _curl_easy_setopt_err_ioctl_cb(); \
63 | if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \
64 | if(!_curl_is_sockopt_cb(value)) \
65 | _curl_easy_setopt_err_sockopt_cb(); \
66 | if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \
67 | if(!_curl_is_opensocket_cb(value)) \
68 | _curl_easy_setopt_err_opensocket_cb(); \
69 | if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \
70 | if(!_curl_is_progress_cb(value)) \
71 | _curl_easy_setopt_err_progress_cb(); \
72 | if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \
73 | if(!_curl_is_debug_cb(value)) \
74 | _curl_easy_setopt_err_debug_cb(); \
75 | if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \
76 | if(!_curl_is_ssl_ctx_cb(value)) \
77 | _curl_easy_setopt_err_ssl_ctx_cb(); \
78 | if(_curl_is_conv_cb_option(_curl_opt)) \
79 | if(!_curl_is_conv_cb(value)) \
80 | _curl_easy_setopt_err_conv_cb(); \
81 | if((_curl_opt) == CURLOPT_SEEKFUNCTION) \
82 | if(!_curl_is_seek_cb(value)) \
83 | _curl_easy_setopt_err_seek_cb(); \
84 | if(_curl_is_cb_data_option(_curl_opt)) \
85 | if(!_curl_is_cb_data(value)) \
86 | _curl_easy_setopt_err_cb_data(); \
87 | if((_curl_opt) == CURLOPT_ERRORBUFFER) \
88 | if(!_curl_is_error_buffer(value)) \
89 | _curl_easy_setopt_err_error_buffer(); \
90 | if((_curl_opt) == CURLOPT_STDERR) \
91 | if(!_curl_is_FILE(value)) \
92 | _curl_easy_setopt_err_FILE(); \
93 | if(_curl_is_postfields_option(_curl_opt)) \
94 | if(!_curl_is_postfields(value)) \
95 | _curl_easy_setopt_err_postfields(); \
96 | if((_curl_opt) == CURLOPT_HTTPPOST) \
97 | if(!_curl_is_arr((value), struct curl_httppost)) \
98 | _curl_easy_setopt_err_curl_httpost(); \
99 | if(_curl_is_slist_option(_curl_opt)) \
100 | if(!_curl_is_arr((value), struct curl_slist)) \
101 | _curl_easy_setopt_err_curl_slist(); \
102 | if((_curl_opt) == CURLOPT_SHARE) \
103 | if(!_curl_is_ptr((value), CURLSH)) \
104 | _curl_easy_setopt_err_CURLSH(); \
105 | } \
106 | curl_easy_setopt(handle, _curl_opt, value); \
107 | })
108 |
109 | /* wraps curl_easy_getinfo() with typechecking */
110 | /* FIXME: don't allow const pointers */
111 | #define curl_easy_getinfo(handle, info, arg) \
112 | __extension__ ({ \
113 | __typeof__ (info) _curl_info = info; \
114 | if(__builtin_constant_p(_curl_info)) { \
115 | if(_curl_is_string_info(_curl_info)) \
116 | if(!_curl_is_arr((arg), char *)) \
117 | _curl_easy_getinfo_err_string(); \
118 | if(_curl_is_long_info(_curl_info)) \
119 | if(!_curl_is_arr((arg), long)) \
120 | _curl_easy_getinfo_err_long(); \
121 | if(_curl_is_double_info(_curl_info)) \
122 | if(!_curl_is_arr((arg), double)) \
123 | _curl_easy_getinfo_err_double(); \
124 | if(_curl_is_slist_info(_curl_info)) \
125 | if(!_curl_is_arr((arg), struct curl_slist *)) \
126 | _curl_easy_getinfo_err_curl_slist(); \
127 | } \
128 | curl_easy_getinfo(handle, _curl_info, arg); \
129 | })
130 |
131 | /* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(),
132 | * for now just make sure that the functions are called with three
133 | * arguments
134 | */
135 | #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
136 | #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
137 |
138 |
139 | /* the actual warnings, triggered by calling the _curl_easy_setopt_err*
140 | * functions */
141 |
142 | /* To define a new warning, use _CURL_WARNING(identifier, "message") */
143 | #define _CURL_WARNING(id, message) \
144 | static void __attribute__((__warning__(message))) \
145 | __attribute__((__unused__)) __attribute__((__noinline__)) \
146 | id(void) { __asm__(""); }
147 |
148 | _CURL_WARNING(_curl_easy_setopt_err_long,
149 | "curl_easy_setopt expects a long argument for this option")
150 | _CURL_WARNING(_curl_easy_setopt_err_curl_off_t,
151 | "curl_easy_setopt expects a curl_off_t argument for this option")
152 | _CURL_WARNING(_curl_easy_setopt_err_string,
153 | "curl_easy_setopt expects a "
154 | "string (char* or char[]) argument for this option"
155 | )
156 | _CURL_WARNING(_curl_easy_setopt_err_write_callback,
157 | "curl_easy_setopt expects a curl_write_callback argument for this option")
158 | _CURL_WARNING(_curl_easy_setopt_err_read_cb,
159 | "curl_easy_setopt expects a curl_read_callback argument for this option")
160 | _CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,
161 | "curl_easy_setopt expects a curl_ioctl_callback argument for this option")
162 | _CURL_WARNING(_curl_easy_setopt_err_sockopt_cb,
163 | "curl_easy_setopt expects a curl_sockopt_callback argument for this option")
164 | _CURL_WARNING(_curl_easy_setopt_err_opensocket_cb,
165 | "curl_easy_setopt expects a "
166 | "curl_opensocket_callback argument for this option"
167 | )
168 | _CURL_WARNING(_curl_easy_setopt_err_progress_cb,
169 | "curl_easy_setopt expects a curl_progress_callback argument for this option")
170 | _CURL_WARNING(_curl_easy_setopt_err_debug_cb,
171 | "curl_easy_setopt expects a curl_debug_callback argument for this option")
172 | _CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb,
173 | "curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option")
174 | _CURL_WARNING(_curl_easy_setopt_err_conv_cb,
175 | "curl_easy_setopt expects a curl_conv_callback argument for this option")
176 | _CURL_WARNING(_curl_easy_setopt_err_seek_cb,
177 | "curl_easy_setopt expects a curl_seek_callback argument for this option")
178 | _CURL_WARNING(_curl_easy_setopt_err_cb_data,
179 | "curl_easy_setopt expects a "
180 | "private data pointer as argument for this option")
181 | _CURL_WARNING(_curl_easy_setopt_err_error_buffer,
182 | "curl_easy_setopt expects a "
183 | "char buffer of CURL_ERROR_SIZE as argument for this option")
184 | _CURL_WARNING(_curl_easy_setopt_err_FILE,
185 | "curl_easy_setopt expects a FILE* argument for this option")
186 | _CURL_WARNING(_curl_easy_setopt_err_postfields,
187 | "curl_easy_setopt expects a void* or char* argument for this option")
188 | _CURL_WARNING(_curl_easy_setopt_err_curl_httpost,
189 | "curl_easy_setopt expects a struct curl_httppost* argument for this option")
190 | _CURL_WARNING(_curl_easy_setopt_err_curl_slist,
191 | "curl_easy_setopt expects a struct curl_slist* argument for this option")
192 | _CURL_WARNING(_curl_easy_setopt_err_CURLSH,
193 | "curl_easy_setopt expects a CURLSH* argument for this option")
194 |
195 | _CURL_WARNING(_curl_easy_getinfo_err_string,
196 | "curl_easy_getinfo expects a pointer to char * for this info")
197 | _CURL_WARNING(_curl_easy_getinfo_err_long,
198 | "curl_easy_getinfo expects a pointer to long for this info")
199 | _CURL_WARNING(_curl_easy_getinfo_err_double,
200 | "curl_easy_getinfo expects a pointer to double for this info")
201 | _CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
202 | "curl_easy_getinfo expects a pointer to struct curl_slist * for this info")
203 |
204 | /* groups of curl_easy_setops options that take the same type of argument */
205 |
206 | /* To add a new option to one of the groups, just add
207 | * (option) == CURLOPT_SOMETHING
208 | * to the or-expression. If the option takes a long or curl_off_t, you don't
209 | * have to do anything
210 | */
211 |
212 | /* evaluates to true if option takes a long argument */
213 | #define _curl_is_long_option(option) \
214 | (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)
215 |
216 | #define _curl_is_off_t_option(option) \
217 | ((option) > CURLOPTTYPE_OFF_T)
218 |
219 | /* evaluates to true if option takes a char* argument */
220 | #define _curl_is_string_option(option) \
221 | ((option) == CURLOPT_ACCEPT_ENCODING || \
222 | (option) == CURLOPT_CAINFO || \
223 | (option) == CURLOPT_CAPATH || \
224 | (option) == CURLOPT_COOKIE || \
225 | (option) == CURLOPT_COOKIEFILE || \
226 | (option) == CURLOPT_COOKIEJAR || \
227 | (option) == CURLOPT_COOKIELIST || \
228 | (option) == CURLOPT_CRLFILE || \
229 | (option) == CURLOPT_CUSTOMREQUEST || \
230 | (option) == CURLOPT_DEFAULT_PROTOCOL || \
231 | (option) == CURLOPT_DNS_INTERFACE || \
232 | (option) == CURLOPT_DNS_LOCAL_IP4 || \
233 | (option) == CURLOPT_DNS_LOCAL_IP6 || \
234 | (option) == CURLOPT_DNS_SERVERS || \
235 | (option) == CURLOPT_EGDSOCKET || \
236 | (option) == CURLOPT_FTPPORT || \
237 | (option) == CURLOPT_FTP_ACCOUNT || \
238 | (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \
239 | (option) == CURLOPT_INTERFACE || \
240 | (option) == CURLOPT_ISSUERCERT || \
241 | (option) == CURLOPT_KEYPASSWD || \
242 | (option) == CURLOPT_KRBLEVEL || \
243 | (option) == CURLOPT_LOGIN_OPTIONS || \
244 | (option) == CURLOPT_MAIL_AUTH || \
245 | (option) == CURLOPT_MAIL_FROM || \
246 | (option) == CURLOPT_NETRC_FILE || \
247 | (option) == CURLOPT_NOPROXY || \
248 | (option) == CURLOPT_PASSWORD || \
249 | (option) == CURLOPT_PINNEDPUBLICKEY || \
250 | (option) == CURLOPT_PROXY || \
251 | (option) == CURLOPT_PROXYPASSWORD || \
252 | (option) == CURLOPT_PROXYUSERNAME || \
253 | (option) == CURLOPT_PROXYUSERPWD || \
254 | (option) == CURLOPT_PROXY_SERVICE_NAME || \
255 | (option) == CURLOPT_RANDOM_FILE || \
256 | (option) == CURLOPT_RANGE || \
257 | (option) == CURLOPT_REFERER || \
258 | (option) == CURLOPT_RTSP_SESSION_ID || \
259 | (option) == CURLOPT_RTSP_STREAM_URI || \
260 | (option) == CURLOPT_RTSP_TRANSPORT || \
261 | (option) == CURLOPT_SERVICE_NAME || \
262 | (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \
263 | (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \
264 | (option) == CURLOPT_SSH_KNOWNHOSTS || \
265 | (option) == CURLOPT_SSH_PRIVATE_KEYFILE || \
266 | (option) == CURLOPT_SSH_PUBLIC_KEYFILE || \
267 | (option) == CURLOPT_SSLCERT || \
268 | (option) == CURLOPT_SSLCERTTYPE || \
269 | (option) == CURLOPT_SSLENGINE || \
270 | (option) == CURLOPT_SSLKEY || \
271 | (option) == CURLOPT_SSLKEYTYPE || \
272 | (option) == CURLOPT_SSL_CIPHER_LIST || \
273 | (option) == CURLOPT_TLSAUTH_PASSWORD || \
274 | (option) == CURLOPT_TLSAUTH_TYPE || \
275 | (option) == CURLOPT_TLSAUTH_USERNAME || \
276 | (option) == CURLOPT_UNIX_SOCKET_PATH || \
277 | (option) == CURLOPT_URL || \
278 | (option) == CURLOPT_USERAGENT || \
279 | (option) == CURLOPT_USERNAME || \
280 | (option) == CURLOPT_USERPWD || \
281 | (option) == CURLOPT_XOAUTH2_BEARER || \
282 | 0)
283 |
284 | /* evaluates to true if option takes a curl_write_callback argument */
285 | #define _curl_is_write_cb_option(option) \
286 | ((option) == CURLOPT_HEADERFUNCTION || \
287 | (option) == CURLOPT_WRITEFUNCTION)
288 |
289 | /* evaluates to true if option takes a curl_conv_callback argument */
290 | #define _curl_is_conv_cb_option(option) \
291 | ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \
292 | (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \
293 | (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)
294 |
295 | /* evaluates to true if option takes a data argument to pass to a callback */
296 | #define _curl_is_cb_data_option(option) \
297 | ((option) == CURLOPT_CHUNK_DATA || \
298 | (option) == CURLOPT_CLOSESOCKETDATA || \
299 | (option) == CURLOPT_DEBUGDATA || \
300 | (option) == CURLOPT_FNMATCH_DATA || \
301 | (option) == CURLOPT_HEADERDATA || \
302 | (option) == CURLOPT_INTERLEAVEDATA || \
303 | (option) == CURLOPT_IOCTLDATA || \
304 | (option) == CURLOPT_OPENSOCKETDATA || \
305 | (option) == CURLOPT_PRIVATE || \
306 | (option) == CURLOPT_PROGRESSDATA || \
307 | (option) == CURLOPT_READDATA || \
308 | (option) == CURLOPT_SEEKDATA || \
309 | (option) == CURLOPT_SOCKOPTDATA || \
310 | (option) == CURLOPT_SSH_KEYDATA || \
311 | (option) == CURLOPT_SSL_CTX_DATA || \
312 | (option) == CURLOPT_WRITEDATA || \
313 | 0)
314 |
315 | /* evaluates to true if option takes a POST data argument (void* or char*) */
316 | #define _curl_is_postfields_option(option) \
317 | ((option) == CURLOPT_POSTFIELDS || \
318 | (option) == CURLOPT_COPYPOSTFIELDS || \
319 | 0)
320 |
321 | /* evaluates to true if option takes a struct curl_slist * argument */
322 | #define _curl_is_slist_option(option) \
323 | ((option) == CURLOPT_HTTP200ALIASES || \
324 | (option) == CURLOPT_HTTPHEADER || \
325 | (option) == CURLOPT_MAIL_RCPT || \
326 | (option) == CURLOPT_POSTQUOTE || \
327 | (option) == CURLOPT_PREQUOTE || \
328 | (option) == CURLOPT_PROXYHEADER || \
329 | (option) == CURLOPT_QUOTE || \
330 | (option) == CURLOPT_RESOLVE || \
331 | (option) == CURLOPT_TELNETOPTIONS || \
332 | 0)
333 |
334 | /* groups of curl_easy_getinfo infos that take the same type of argument */
335 |
336 | /* evaluates to true if info expects a pointer to char * argument */
337 | #define _curl_is_string_info(info) \
338 | (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG)
339 |
340 | /* evaluates to true if info expects a pointer to long argument */
341 | #define _curl_is_long_info(info) \
342 | (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)
343 |
344 | /* evaluates to true if info expects a pointer to double argument */
345 | #define _curl_is_double_info(info) \
346 | (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)
347 |
348 | /* true if info expects a pointer to struct curl_slist * argument */
349 | #define _curl_is_slist_info(info) \
350 | (CURLINFO_SLIST < (info))
351 |
352 |
353 | /* typecheck helpers -- check whether given expression has requested type*/
354 |
355 | /* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros,
356 | * otherwise define a new macro. Search for __builtin_types_compatible_p
357 | * in the GCC manual.
358 | * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is
359 | * the actual expression passed to the curl_easy_setopt macro. This
360 | * means that you can only apply the sizeof and __typeof__ operators, no
361 | * == or whatsoever.
362 | */
363 |
364 | /* XXX: should evaluate to true iff expr is a pointer */
365 | #define _curl_is_any_ptr(expr) \
366 | (sizeof(expr) == sizeof(void*))
367 |
368 | /* evaluates to true if expr is NULL */
369 | /* XXX: must not evaluate expr, so this check is not accurate */
370 | #define _curl_is_NULL(expr) \
371 | (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))
372 |
373 | /* evaluates to true if expr is type*, const type* or NULL */
374 | #define _curl_is_ptr(expr, type) \
375 | (_curl_is_NULL(expr) || \
376 | __builtin_types_compatible_p(__typeof__(expr), type *) || \
377 | __builtin_types_compatible_p(__typeof__(expr), const type *))
378 |
379 | /* evaluates to true if expr is one of type[], type*, NULL or const type* */
380 | #define _curl_is_arr(expr, type) \
381 | (_curl_is_ptr((expr), type) || \
382 | __builtin_types_compatible_p(__typeof__(expr), type []))
383 |
384 | /* evaluates to true if expr is a string */
385 | #define _curl_is_string(expr) \
386 | (_curl_is_arr((expr), char) || \
387 | _curl_is_arr((expr), signed char) || \
388 | _curl_is_arr((expr), unsigned char))
389 |
390 | /* evaluates to true if expr is a long (no matter the signedness)
391 | * XXX: for now, int is also accepted (and therefore short and char, which
392 | * are promoted to int when passed to a variadic function) */
393 | #define _curl_is_long(expr) \
394 | (__builtin_types_compatible_p(__typeof__(expr), long) || \
395 | __builtin_types_compatible_p(__typeof__(expr), signed long) || \
396 | __builtin_types_compatible_p(__typeof__(expr), unsigned long) || \
397 | __builtin_types_compatible_p(__typeof__(expr), int) || \
398 | __builtin_types_compatible_p(__typeof__(expr), signed int) || \
399 | __builtin_types_compatible_p(__typeof__(expr), unsigned int) || \
400 | __builtin_types_compatible_p(__typeof__(expr), short) || \
401 | __builtin_types_compatible_p(__typeof__(expr), signed short) || \
402 | __builtin_types_compatible_p(__typeof__(expr), unsigned short) || \
403 | __builtin_types_compatible_p(__typeof__(expr), char) || \
404 | __builtin_types_compatible_p(__typeof__(expr), signed char) || \
405 | __builtin_types_compatible_p(__typeof__(expr), unsigned char))
406 |
407 | /* evaluates to true if expr is of type curl_off_t */
408 | #define _curl_is_off_t(expr) \
409 | (__builtin_types_compatible_p(__typeof__(expr), curl_off_t))
410 |
411 | /* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
412 | /* XXX: also check size of an char[] array? */
413 | #define _curl_is_error_buffer(expr) \
414 | (_curl_is_NULL(expr) || \
415 | __builtin_types_compatible_p(__typeof__(expr), char *) || \
416 | __builtin_types_compatible_p(__typeof__(expr), char[]))
417 |
418 | /* evaluates to true if expr is of type (const) void* or (const) FILE* */
419 | #if 0
420 | #define _curl_is_cb_data(expr) \
421 | (_curl_is_ptr((expr), void) || \
422 | _curl_is_ptr((expr), FILE))
423 | #else /* be less strict */
424 | #define _curl_is_cb_data(expr) \
425 | _curl_is_any_ptr(expr)
426 | #endif
427 |
428 | /* evaluates to true if expr is of type FILE* */
429 | #define _curl_is_FILE(expr) \
430 | (__builtin_types_compatible_p(__typeof__(expr), FILE *))
431 |
432 | /* evaluates to true if expr can be passed as POST data (void* or char*) */
433 | #define _curl_is_postfields(expr) \
434 | (_curl_is_ptr((expr), void) || \
435 | _curl_is_arr((expr), char))
436 |
437 | /* FIXME: the whole callback checking is messy...
438 | * The idea is to tolerate char vs. void and const vs. not const
439 | * pointers in arguments at least
440 | */
441 | /* helper: __builtin_types_compatible_p distinguishes between functions and
442 | * function pointers, hide it */
443 | #define _curl_callback_compatible(func, type) \
444 | (__builtin_types_compatible_p(__typeof__(func), type) || \
445 | __builtin_types_compatible_p(__typeof__(func), type*))
446 |
447 | /* evaluates to true if expr is of type curl_read_callback or "similar" */
448 | #define _curl_is_read_cb(expr) \
449 | (_curl_is_NULL(expr) || \
450 | __builtin_types_compatible_p(__typeof__(expr), __typeof__(fread)) || \
451 | __builtin_types_compatible_p(__typeof__(expr), curl_read_callback) || \
452 | _curl_callback_compatible((expr), _curl_read_callback1) || \
453 | _curl_callback_compatible((expr), _curl_read_callback2) || \
454 | _curl_callback_compatible((expr), _curl_read_callback3) || \
455 | _curl_callback_compatible((expr), _curl_read_callback4) || \
456 | _curl_callback_compatible((expr), _curl_read_callback5) || \
457 | _curl_callback_compatible((expr), _curl_read_callback6))
458 | typedef size_t (_curl_read_callback1)(char *, size_t, size_t, void*);
459 | typedef size_t (_curl_read_callback2)(char *, size_t, size_t, const void*);
460 | typedef size_t (_curl_read_callback3)(char *, size_t, size_t, FILE*);
461 | typedef size_t (_curl_read_callback4)(void *, size_t, size_t, void*);
462 | typedef size_t (_curl_read_callback5)(void *, size_t, size_t, const void*);
463 | typedef size_t (_curl_read_callback6)(void *, size_t, size_t, FILE*);
464 |
465 | /* evaluates to true if expr is of type curl_write_callback or "similar" */
466 | #define _curl_is_write_cb(expr) \
467 | (_curl_is_read_cb(expr) || \
468 | __builtin_types_compatible_p(__typeof__(expr), __typeof__(fwrite)) || \
469 | __builtin_types_compatible_p(__typeof__(expr), curl_write_callback) || \
470 | _curl_callback_compatible((expr), _curl_write_callback1) || \
471 | _curl_callback_compatible((expr), _curl_write_callback2) || \
472 | _curl_callback_compatible((expr), _curl_write_callback3) || \
473 | _curl_callback_compatible((expr), _curl_write_callback4) || \
474 | _curl_callback_compatible((expr), _curl_write_callback5) || \
475 | _curl_callback_compatible((expr), _curl_write_callback6))
476 | typedef size_t (_curl_write_callback1)(const char *, size_t, size_t, void*);
477 | typedef size_t (_curl_write_callback2)(const char *, size_t, size_t,
478 | const void*);
479 | typedef size_t (_curl_write_callback3)(const char *, size_t, size_t, FILE*);
480 | typedef size_t (_curl_write_callback4)(const void *, size_t, size_t, void*);
481 | typedef size_t (_curl_write_callback5)(const void *, size_t, size_t,
482 | const void*);
483 | typedef size_t (_curl_write_callback6)(const void *, size_t, size_t, FILE*);
484 |
485 | /* evaluates to true if expr is of type curl_ioctl_callback or "similar" */
486 | #define _curl_is_ioctl_cb(expr) \
487 | (_curl_is_NULL(expr) || \
488 | __builtin_types_compatible_p(__typeof__(expr), curl_ioctl_callback) || \
489 | _curl_callback_compatible((expr), _curl_ioctl_callback1) || \
490 | _curl_callback_compatible((expr), _curl_ioctl_callback2) || \
491 | _curl_callback_compatible((expr), _curl_ioctl_callback3) || \
492 | _curl_callback_compatible((expr), _curl_ioctl_callback4))
493 | typedef curlioerr (_curl_ioctl_callback1)(CURL *, int, void*);
494 | typedef curlioerr (_curl_ioctl_callback2)(CURL *, int, const void*);
495 | typedef curlioerr (_curl_ioctl_callback3)(CURL *, curliocmd, void*);
496 | typedef curlioerr (_curl_ioctl_callback4)(CURL *, curliocmd, const void*);
497 |
498 | /* evaluates to true if expr is of type curl_sockopt_callback or "similar" */
499 | #define _curl_is_sockopt_cb(expr) \
500 | (_curl_is_NULL(expr) || \
501 | __builtin_types_compatible_p(__typeof__(expr), curl_sockopt_callback) || \
502 | _curl_callback_compatible((expr), _curl_sockopt_callback1) || \
503 | _curl_callback_compatible((expr), _curl_sockopt_callback2))
504 | typedef int (_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
505 | typedef int (_curl_sockopt_callback2)(const void *, curl_socket_t,
506 | curlsocktype);
507 |
508 | /* evaluates to true if expr is of type curl_opensocket_callback or
509 | "similar" */
510 | #define _curl_is_opensocket_cb(expr) \
511 | (_curl_is_NULL(expr) || \
512 | __builtin_types_compatible_p(__typeof__(expr), curl_opensocket_callback) ||\
513 | _curl_callback_compatible((expr), _curl_opensocket_callback1) || \
514 | _curl_callback_compatible((expr), _curl_opensocket_callback2) || \
515 | _curl_callback_compatible((expr), _curl_opensocket_callback3) || \
516 | _curl_callback_compatible((expr), _curl_opensocket_callback4))
517 | typedef curl_socket_t (_curl_opensocket_callback1)
518 | (void *, curlsocktype, struct curl_sockaddr *);
519 | typedef curl_socket_t (_curl_opensocket_callback2)
520 | (void *, curlsocktype, const struct curl_sockaddr *);
521 | typedef curl_socket_t (_curl_opensocket_callback3)
522 | (const void *, curlsocktype, struct curl_sockaddr *);
523 | typedef curl_socket_t (_curl_opensocket_callback4)
524 | (const void *, curlsocktype, const struct curl_sockaddr *);
525 |
526 | /* evaluates to true if expr is of type curl_progress_callback or "similar" */
527 | #define _curl_is_progress_cb(expr) \
528 | (_curl_is_NULL(expr) || \
529 | __builtin_types_compatible_p(__typeof__(expr), curl_progress_callback) || \
530 | _curl_callback_compatible((expr), _curl_progress_callback1) || \
531 | _curl_callback_compatible((expr), _curl_progress_callback2))
532 | typedef int (_curl_progress_callback1)(void *,
533 | double, double, double, double);
534 | typedef int (_curl_progress_callback2)(const void *,
535 | double, double, double, double);
536 |
537 | /* evaluates to true if expr is of type curl_debug_callback or "similar" */
538 | #define _curl_is_debug_cb(expr) \
539 | (_curl_is_NULL(expr) || \
540 | __builtin_types_compatible_p(__typeof__(expr), curl_debug_callback) || \
541 | _curl_callback_compatible((expr), _curl_debug_callback1) || \
542 | _curl_callback_compatible((expr), _curl_debug_callback2) || \
543 | _curl_callback_compatible((expr), _curl_debug_callback3) || \
544 | _curl_callback_compatible((expr), _curl_debug_callback4) || \
545 | _curl_callback_compatible((expr), _curl_debug_callback5) || \
546 | _curl_callback_compatible((expr), _curl_debug_callback6) || \
547 | _curl_callback_compatible((expr), _curl_debug_callback7) || \
548 | _curl_callback_compatible((expr), _curl_debug_callback8))
549 | typedef int (_curl_debug_callback1) (CURL *,
550 | curl_infotype, char *, size_t, void *);
551 | typedef int (_curl_debug_callback2) (CURL *,
552 | curl_infotype, char *, size_t, const void *);
553 | typedef int (_curl_debug_callback3) (CURL *,
554 | curl_infotype, const char *, size_t, void *);
555 | typedef int (_curl_debug_callback4) (CURL *,
556 | curl_infotype, const char *, size_t, const void *);
557 | typedef int (_curl_debug_callback5) (CURL *,
558 | curl_infotype, unsigned char *, size_t, void *);
559 | typedef int (_curl_debug_callback6) (CURL *,
560 | curl_infotype, unsigned char *, size_t, const void *);
561 | typedef int (_curl_debug_callback7) (CURL *,
562 | curl_infotype, const unsigned char *, size_t, void *);
563 | typedef int (_curl_debug_callback8) (CURL *,
564 | curl_infotype, const unsigned char *, size_t, const void *);
565 |
566 | /* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
567 | /* this is getting even messier... */
568 | #define _curl_is_ssl_ctx_cb(expr) \
569 | (_curl_is_NULL(expr) || \
570 | __builtin_types_compatible_p(__typeof__(expr), curl_ssl_ctx_callback) || \
571 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback1) || \
572 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback2) || \
573 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback3) || \
574 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback4) || \
575 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback5) || \
576 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback6) || \
577 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback7) || \
578 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback8))
579 | typedef CURLcode (_curl_ssl_ctx_callback1)(CURL *, void *, void *);
580 | typedef CURLcode (_curl_ssl_ctx_callback2)(CURL *, void *, const void *);
581 | typedef CURLcode (_curl_ssl_ctx_callback3)(CURL *, const void *, void *);
582 | typedef CURLcode (_curl_ssl_ctx_callback4)(CURL *, const void *, const void *);
583 | #ifdef HEADER_SSL_H
584 | /* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX
585 | * this will of course break if we're included before OpenSSL headers...
586 | */
587 | typedef CURLcode (_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);
588 | typedef CURLcode (_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);
589 | typedef CURLcode (_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);
590 | typedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX,
591 | const void *);
592 | #else
593 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;
594 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;
595 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;
596 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;
597 | #endif
598 |
599 | /* evaluates to true if expr is of type curl_conv_callback or "similar" */
600 | #define _curl_is_conv_cb(expr) \
601 | (_curl_is_NULL(expr) || \
602 | __builtin_types_compatible_p(__typeof__(expr), curl_conv_callback) || \
603 | _curl_callback_compatible((expr), _curl_conv_callback1) || \
604 | _curl_callback_compatible((expr), _curl_conv_callback2) || \
605 | _curl_callback_compatible((expr), _curl_conv_callback3) || \
606 | _curl_callback_compatible((expr), _curl_conv_callback4))
607 | typedef CURLcode (*_curl_conv_callback1)(char *, size_t length);
608 | typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);
609 | typedef CURLcode (*_curl_conv_callback3)(void *, size_t length);
610 | typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);
611 |
612 | /* evaluates to true if expr is of type curl_seek_callback or "similar" */
613 | #define _curl_is_seek_cb(expr) \
614 | (_curl_is_NULL(expr) || \
615 | __builtin_types_compatible_p(__typeof__(expr), curl_seek_callback) || \
616 | _curl_callback_compatible((expr), _curl_seek_callback1) || \
617 | _curl_callback_compatible((expr), _curl_seek_callback2))
618 | typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);
619 | typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);
620 |
621 |
622 | #endif /* __CURL_TYPECHECK_GCC_H */
623 |
--------------------------------------------------------------------------------
/curl/urlapi.h:
--------------------------------------------------------------------------------
1 | #ifndef __CURL_URLAPI_H
2 | #define __CURL_URLAPI_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 2018 - 2019, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at https://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 |
25 | #include "curl.h"
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif
30 |
31 | /* the error codes for the URL API */
32 | typedef enum {
33 | CURLUE_OK,
34 | CURLUE_BAD_HANDLE, /* 1 */
35 | CURLUE_BAD_PARTPOINTER, /* 2 */
36 | CURLUE_MALFORMED_INPUT, /* 3 */
37 | CURLUE_BAD_PORT_NUMBER, /* 4 */
38 | CURLUE_UNSUPPORTED_SCHEME, /* 5 */
39 | CURLUE_URLDECODE, /* 6 */
40 | CURLUE_OUT_OF_MEMORY, /* 7 */
41 | CURLUE_USER_NOT_ALLOWED, /* 8 */
42 | CURLUE_UNKNOWN_PART, /* 9 */
43 | CURLUE_NO_SCHEME, /* 10 */
44 | CURLUE_NO_USER, /* 11 */
45 | CURLUE_NO_PASSWORD, /* 12 */
46 | CURLUE_NO_OPTIONS, /* 13 */
47 | CURLUE_NO_HOST, /* 14 */
48 | CURLUE_NO_PORT, /* 15 */
49 | CURLUE_NO_QUERY, /* 16 */
50 | CURLUE_NO_FRAGMENT /* 17 */
51 | } CURLUcode;
52 |
53 | typedef enum {
54 | CURLUPART_URL,
55 | CURLUPART_SCHEME,
56 | CURLUPART_USER,
57 | CURLUPART_PASSWORD,
58 | CURLUPART_OPTIONS,
59 | CURLUPART_HOST,
60 | CURLUPART_PORT,
61 | CURLUPART_PATH,
62 | CURLUPART_QUERY,
63 | CURLUPART_FRAGMENT,
64 | CURLUPART_ZONEID /* added in 7.65.0 */
65 | } CURLUPart;
66 |
67 | #define CURLU_DEFAULT_PORT (1<<0) /* return default port number */
68 | #define CURLU_NO_DEFAULT_PORT (1<<1) /* act as if no port number was set,
69 | if the port number matches the
70 | default for the scheme */
71 | #define CURLU_DEFAULT_SCHEME (1<<2) /* return default scheme if
72 | missing */
73 | #define CURLU_NON_SUPPORT_SCHEME (1<<3) /* allow non-supported scheme */
74 | #define CURLU_PATH_AS_IS (1<<4) /* leave dot sequences */
75 | #define CURLU_DISALLOW_USER (1<<5) /* no user+password allowed */
76 | #define CURLU_URLDECODE (1<<6) /* URL decode on get */
77 | #define CURLU_URLENCODE (1<<7) /* URL encode on set */
78 | #define CURLU_APPENDQUERY (1<<8) /* append a form style part */
79 | #define CURLU_GUESS_SCHEME (1<<9) /* legacy curl-style guessing */
80 |
81 | typedef struct Curl_URL CURLU;
82 |
83 | /*
84 | * curl_url() creates a new CURLU handle and returns a pointer to it.
85 | * Must be freed with curl_url_cleanup().
86 | */
87 | CURL_EXTERN CURLU *curl_url(void);
88 |
89 | /*
90 | * curl_url_cleanup() frees the CURLU handle and related resources used for
91 | * the URL parsing. It will not free strings previously returned with the URL
92 | * API.
93 | */
94 | CURL_EXTERN void curl_url_cleanup(CURLU *handle);
95 |
96 | /*
97 | * curl_url_dup() duplicates a CURLU handle and returns a new copy. The new
98 | * handle must also be freed with curl_url_cleanup().
99 | */
100 | CURL_EXTERN CURLU *curl_url_dup(CURLU *in);
101 |
102 | /*
103 | * curl_url_get() extracts a specific part of the URL from a CURLU
104 | * handle. Returns error code. The returned pointer MUST be freed with
105 | * curl_free() afterwards.
106 | */
107 | CURL_EXTERN CURLUcode curl_url_get(CURLU *handle, CURLUPart what,
108 | char **part, unsigned int flags);
109 |
110 | /*
111 | * curl_url_set() sets a specific part of the URL in a CURLU handle. Returns
112 | * error code. The passed in string will be copied. Passing a NULL instead of
113 | * a part string, clears that part.
114 | */
115 | CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what,
116 | const char *part, unsigned int flags);
117 |
118 |
119 | #ifdef __cplusplus
120 | } /* end of extern "C" */
121 | #endif
122 |
123 | #endif
124 |
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | LIBRARY_PATH="/usr/include/"
4 |
5 | if [ $# -eq 0 ];
6 | then
7 | echo "INSTALL: $0 main.cpp"
8 | exit
9 | fi
10 |
11 | if [ -d "/usr/bin" ] || [ -d "/usr/include/"];
12 | then
13 | sudo cp -r curl $LIBRARY_PATH
14 | sudo apt-get install libcurl4-gnutls-dev -y
15 | g++ $1 -std=c++11 -lcurl -o dork
16 | printf "\nCompile command: g++ main.cpp -std=c++11 -lcurl -o dork\nRUN: ./dork\n"
17 | else
18 | echo "Hello sir, sorry this tool not available on your operating system"
19 | fi
--------------------------------------------------------------------------------
/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | #define MX(mxNumb) ((mxNumb < 1 || mxNumb > 8) ? 0 : 1)
12 | #define HELP "ambari.developer@gmail.com"
13 | #define SAVEFILENAME "sql_vuln.txt"
14 | #define RD "\033[31m"
15 | #define RS "\033[0m"
16 | #define GR "\033[32m"
17 | #define YL "\033[33m"
18 |
19 | struct L{
20 | int log;
21 | }log_ok,log_no;
22 | static std::string code;
23 | static std::string ER[] = {
24 | "You have an error in your SQL syntax",
25 | "MySQL server version for the right syntax to use near",
26 | "SELECT * FROM"
27 | };
28 | int REQ(const char*);
29 | template int writeToFiles(T filename, const char *data) {
30 | std::ofstream files(filename,std::ios::app);
31 | files << data << std::endl;
32 | files.close();
33 | return 0;
34 | }
35 | template int array_count(S const(&arr)[n]) {
36 | return (sizeof(arr)/sizeof(*arr));
37 | }
38 | int writedata(void *buffer, size_t size, size_t sizem, void *m) {
39 | code.append((char*)buffer,size*sizem);
40 | return (size*sizem);
41 | }
42 | int CAMN(std::vector data) {
43 | std::smatch rs;
44 | if(!data.size()) {
45 | return 0;
46 | }
47 | for(auto u : data) {
48 | std::string LE = u+"'";
49 | REQ((char*)LE.c_str());
50 | for(int x = 0; x < (sizeof(ER)/sizeof(*ER)); x++) {
51 | bool console_show = ((log_ok.log != 0 || log_no.log != 0) ? 1 : 0);
52 | if(std::regex_search(code,rs,std::regex(ER[x]))) {
53 | if(!console_show) {
54 | writeToFiles(SAVEFILENAME,(char*)u.c_str());
55 | std::cout << "[ " << GR << "OK" << RS << " ] " << YL
56 | << "=> " << RS << u << std::endl;
57 | }
58 | log_ok.log = 1;
59 | }else {
60 | if(!console_show) {
61 | std::cout << "[ " << RD << "NOT "<< RS <<"]" << YL
62 | << " => " << RS << u << std::endl;
63 | }
64 | log_no.log = 1;
65 | }
66 | }
67 | code.clear(); log_no.log = 0; log_ok.log = 0;
68 | }
69 | return 0;
70 | }
71 | int REQ(const char *url) {
72 | curl_global_init(CURL_GLOBAL_ALL);
73 | CURL *curl = curl_easy_init();
74 | if(!curl) {
75 | return 0;
76 | }
77 | CURLcode resp;
78 | long http_code;
79 | curl_easy_setopt(curl,CURLOPT_URL,url);
80 | curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,writedata);
81 | resp = curl_easy_perform(curl);
82 | if(resp != CURLE_OK) {
83 | return 0;
84 | }
85 | curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&http_code);
86 | return http_code;
87 | }
88 | int DORKING(const char *DRK, int max=1) {
89 | std::vector tmp;
90 | std::smatch RxHasil;
91 | if(!MX(max)) {
92 | std::cout << "MAX PAGE [1/8]" << std::endl;
93 | return 0;
94 | }
95 | for(int counter = 1; counter <= max; counter++) {
96 | std::string SEARCH_URL = "http://www1.search-results.com/web?q="+std::string(DRK)+"&page="+std::to_string(counter);
97 | char SUL[SEARCH_URL.length()];
98 | strcpy(SUL,SEARCH_URL.c_str());
99 | if(!REQ(SUL)) {
100 | return 0;
101 | }
102 | std::istringstream ssr(code);
103 | std::string lines;
104 | while(getline(ssr,lines)) {
105 | if(std::regex_search(lines,RxHasil,std::regex("algo-display-url\">(.*?)"))) {
106 | tmp.push_back(RxHasil[1]);
107 | }
108 | }
109 | code.clear();
110 | }
111 | CAMN(tmp);
112 | return 0;
113 | }
114 | int main(int argc, const char *argv[]) {
115 | char dr[100];
116 | short int mx;
117 | if(argc != 3) {
118 | std::cout <<
119 | "[ ? ] DORK: "; std::cin.getline(dr,sizeof(dr));
120 | std::cout <<
121 | "[ ? ] MAX PAGE [1/8]: "; std::cin >> mx;
122 | }else {
123 | strcpy(dr,argv[1]);
124 | mx = static_cast(atoi(argv[2]));
125 | }
126 | DORKING(dr,mx);
127 | }
--------------------------------------------------------------------------------
/sqlvuln.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | """
4 | SQLVuln
5 | -------
6 | simple tool to scanning sql injection vulnerability
7 | and this tool is very easy to use.
8 |
9 | Author: Ms.ambari
10 | Github: /Ranginang67
11 | YouTube: Ms.ambari
12 | """
13 |
14 | import sys
15 |
16 | if sys.version_info < (3,0):
17 | sys.exit("Please use python 3")
18 |
19 | import os, re
20 | import urllib.request
21 | import random
22 | import urllib3
23 | import datetime
24 |
25 | class SqlScan:
26 |
27 | __counter = 1
28 | __maxPage = 2
29 | __hasil = []
30 | __vuln = []
31 | __nothing = []
32 | __error = []
33 |
34 | __mysql_error = [ # do you have another error of sql ? add here ...
35 | "You have an error in your SQL syntax",
36 | "MySQL server version for the right syntax to use near",
37 | "SELECT * FROM"]
38 |
39 | @classmethod
40 | def dorking(cls,dork=None,max_page=2):
41 | cls.__maxPage = max_page
42 | while(cls.__counter < cls.__maxPage):
43 | try:
44 | url = "http://www1.search-results.com/web?q="+dork+"&page="+str(cls.__counter)
45 | req = urllib.request.urlopen(url);
46 | results = req.read()
47 | results = results.decode("utf8")
48 | regx = re.findall(r" "+cls.__reset
64 | else: x = "["+cls.__success+" ✓"+cls.__reset+" ] OK! "+cls.__success+"=> "+cls.__reset
65 | print(str(x)+" "+text)
66 |
67 | @classmethod
68 | def scan(cls):
69 | date = "="*20 + " " + datetime.datetime.now().strftime("%d %h-%m-%Y") # Print this variable to showing date and time now.
70 | try:
71 | (dork, max_p) = str(input("Enter your Dork [ ex: product.php?id= ]: ")), int(input("Max page [ integer ]: "))
72 | cls.dorking(dork,max_p)
73 | for target in set(cls.__hasil):
74 | try:
75 | req = urllib.request.urlopen(target+"'")
76 | html = req.read()
77 | html = html.decode("utf8")
78 | for sql_error in cls.__mysql_error:
79 | if re.search(r""+sql_error.lower(),html.lower()):
80 | cls.__vuln.append(target)
81 | cls.show(str(target))
82 | break
83 | else:
84 | cls.__nothing.append(target)
85 | continue
86 | except (Exception) as e:
87 | cls.__error.append(target)
88 | cls.show(str(str(target)+" [ "+cls.__danger+str(e)+cls.__reset)+" ]","e")
89 | except KeyboardInterrupt:
90 | sys.exit("\n")
91 | except KeyboardInterrupt:
92 | sys.exit("\n")
93 |
94 | print("\n\nScanning success..\nVuln: {}\nNot vuln: {}\nError: {}".format(
95 | len(set(cls.__vuln)),
96 | len(set(cls.__nothing)),
97 | len(set(cls.__error))))
98 |
99 | SqlScan().scan()
100 |
--------------------------------------------------------------------------------