wut  1.0.0-alpha
Wii U Toolchain
curl.h
Go to the documentation of this file.
1 #ifndef __CURL_CURL_H
2 #define __CURL_CURL_H
3 /***************************************************************************
4  * _ _ ____ _
5  * Project ___| | | | _ \| |
6  * / __| | | | |_) | |
7  * | (__| |_| | _ <| |___
8  * \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, 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 #include <stdio.h>
38 #include <limits.h>
39 
40 /* The include stuff here below is mainly for time_t! */
41 #include <sys/types.h>
42 #include <time.h>
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 typedef void CURL;
49 
50 #ifdef CURL_HIDDEN_SYMBOLS
51 /*
52  * This definition is used to make external definitions visible in the
53  * shared library when symbols are hidden by default. It makes no
54  * difference when compiling applications whether this is set or not,
55  * only when compiling the library.
56  */
57 #define CURL_EXTERN CURL_EXTERN_SYMBOL
58 #else
59 #define CURL_EXTERN
60 #endif
61 
62 #ifndef curl_socket_typedef
63 /* socket typedef */
64 typedef int curl_socket_t;
65 #define CURL_SOCKET_BAD -1
66 #define curl_socket_typedef
67 #endif /* curl_socket_typedef */
68 
69 struct curl_httppost {
70  struct curl_httppost *next; /* next entry in the list */
71  char *name; /* pointer to allocated name */
72  long namelength; /* length of name length */
73  char *contents; /* pointer to allocated data contents */
74  long contentslength; /* length of contents field */
75  char *buffer; /* pointer to allocated buffer contents */
76  long bufferlength; /* length of buffer field */
77  char *contenttype; /* Content-Type */
78  struct curl_slist* contentheader; /* list of extra headers for this form */
79  struct curl_httppost *more; /* if one field name has more than one
80  file, this link should link to following
81  files */
82  long flags; /* as defined below */
83 #define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */
84 #define HTTPPOST_READFILE (1<<1) /* specified content is a file name */
85 #define HTTPPOST_PTRNAME (1<<2) /* name is only stored pointer
86  do not free in formfree */
87 #define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer
88  do not free in formfree */
89 #define HTTPPOST_BUFFER (1<<4) /* upload file from buffer */
90 #define HTTPPOST_PTRBUFFER (1<<5) /* upload file from pointer contents */
91 #define HTTPPOST_CALLBACK (1<<6) /* upload file contents by using the
92  regular read callback to get the data
93  and pass the given pointer as custom
94  pointer */
95 
96  char *showfilename; /* The file name to show. If not set, the
97  actual file name will be used (if this
98  is a file part) */
99  void *userp; /* custom pointer used for
100  HTTPPOST_CALLBACK posts */
101 };
102 
103 typedef int (*curl_progress_callback)(void *clientp,
104  double dltotal,
105  double dlnow,
106  double ultotal,
107  double ulnow);
108 
109 #ifndef CURL_MAX_WRITE_SIZE
110  /* Tests have proven that 20K is a very bad buffer size for uploads on
111  Windows, while 16K for some odd reason performed a lot better.
112  We do the ifndef check to allow this value to easier be changed at build
113  time for those who feel adventurous. The practical minimum is about
114  400 bytes since libcurl uses a buffer of this size as a scratch area
115  (unrelated to network send operations). */
116 #define CURL_MAX_WRITE_SIZE 16384
117 #endif
118 
119 #ifndef CURL_MAX_HTTP_HEADER
120 /* The only reason to have a max limit for this is to avoid the risk of a bad
121  server feeding libcurl with a never-ending header that will cause reallocs
122  infinitely */
123 #define CURL_MAX_HTTP_HEADER (100*1024)
124 #endif
125 
126 
127 /* This is a magic return code for the write callback that, when returned,
128  will signal libcurl to pause receiving on the current transfer. */
129 #define CURL_WRITEFUNC_PAUSE 0x10000001
130 typedef size_t (*curl_write_callback)(char *buffer,
131  size_t size,
132  size_t nitems,
133  void *outstream);
134 
135 
136 
137 /* enumeration of file types */
138 typedef enum {
146  CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */
147 
148  CURLFILETYPE_UNKNOWN /* should never occur */
149 } curlfiletype;
150 
151 #define CURLFINFOFLAG_KNOWN_FILENAME (1<<0)
152 #define CURLFINFOFLAG_KNOWN_FILETYPE (1<<1)
153 #define CURLFINFOFLAG_KNOWN_TIME (1<<2)
154 #define CURLFINFOFLAG_KNOWN_PERM (1<<3)
155 #define CURLFINFOFLAG_KNOWN_UID (1<<4)
156 #define CURLFINFOFLAG_KNOWN_GID (1<<5)
157 #define CURLFINFOFLAG_KNOWN_SIZE (1<<6)
158 #define CURLFINFOFLAG_KNOWN_HLINKCOUNT (1<<7)
159 
160 /* Content of this structure depends on information which is known and is
161  achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man
162  page for callbacks returning this structure -- some fields are mandatory,
163  some others are optional. The FLAG field has special meaning. */
165  char *filename;
167  time_t time;
168  unsigned int perm;
169  int uid;
170  int gid;
172  long int hardlinks;
173 
174  struct {
175  /* If some of these fields is not NULL, it is a pointer to b_data. */
176  char *time;
177  char *perm;
178  char *user;
179  char *group;
180  char *target; /* pointer to the target filename of a symlink */
181  } strings;
182 
183  unsigned int flags;
184 
185  /* used internally */
186  char * b_data;
187  size_t b_size;
188  size_t b_used;
189 };
190 
191 /* return codes for CURLOPT_CHUNK_BGN_FUNCTION */
192 #define CURL_CHUNK_BGN_FUNC_OK 0
193 #define CURL_CHUNK_BGN_FUNC_FAIL 1 /* tell the lib to end the task */
194 #define CURL_CHUNK_BGN_FUNC_SKIP 2 /* skip this chunk over */
195 
196 /* if splitting of data transfer is enabled, this callback is called before
197  download of an individual chunk started. Note that parameter "remains" works
198  only for FTP wildcard downloading (for now), otherwise is not used */
199 typedef long (*curl_chunk_bgn_callback)(const void *transfer_info,
200  void *ptr,
201  int remains);
202 
203 /* return codes for CURLOPT_CHUNK_END_FUNCTION */
204 #define CURL_CHUNK_END_FUNC_OK 0
205 #define CURL_CHUNK_END_FUNC_FAIL 1 /* tell the lib to end the task */
206 
207 /* If splitting of data transfer is enabled this callback is called after
208  download of an individual chunk finished.
209  Note! After this callback was set then it have to be called FOR ALL chunks.
210  Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC.
211  This is the reason why we don't need "transfer_info" parameter in this
212  callback and we are not interested in "remains" parameter too. */
213 typedef long (*curl_chunk_end_callback)(void *ptr);
214 
215 /* return codes for FNMATCHFUNCTION */
216 #define CURL_FNMATCHFUNC_MATCH 0 /* string corresponds to the pattern */
217 #define CURL_FNMATCHFUNC_NOMATCH 1 /* pattern doesn't match the string */
218 #define CURL_FNMATCHFUNC_FAIL 2 /* an error occurred */
219 
220 /* callback type for wildcard downloading pattern matching. If the
221  string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */
222 typedef int (*curl_fnmatch_callback)(void *ptr,
223  const char *pattern,
224  const char *string);
225 
226 /* These are the return codes for the seek callbacks */
227 #define CURL_SEEKFUNC_OK 0
228 #define CURL_SEEKFUNC_FAIL 1 /* fail the entire transfer */
229 #define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so
230  libcurl might try other means instead */
231 typedef int (*curl_seek_callback)(void *instream,
232  curl_off_t offset,
233  int origin); /* 'whence' */
234 
235 /* This is a return code for the read callback that, when returned, will
236  signal libcurl to immediately abort the current transfer. */
237 #define CURL_READFUNC_ABORT 0x10000000
238 /* This is a return code for the read callback that, when returned, will
239  signal libcurl to pause sending data on the current transfer. */
240 #define CURL_READFUNC_PAUSE 0x10000001
241 
242 typedef size_t (*curl_read_callback)(char *buffer,
243  size_t size,
244  size_t nitems,
245  void *instream);
246 
247 typedef enum {
248  CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */
249  CURLSOCKTYPE_LAST /* never use */
250 } curlsocktype;
251 
252 /* The return code from the sockopt_callback can signal information back
253  to libcurl: */
254 #define CURL_SOCKOPT_OK 0
255 #define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return
256  CURLE_ABORTED_BY_CALLBACK */
257 #define CURL_SOCKOPT_ALREADY_CONNECTED 2
258 
259 typedef int (*curl_sockopt_callback)(void *clientp,
260  curl_socket_t curlfd,
261  curlsocktype purpose);
262 
264  int family;
265  int socktype;
266  int protocol;
267  unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it
268  turned really ugly and painful on the systems that
269  lack this type */
270  struct sockaddr addr;
271 };
272 
273 typedef curl_socket_t
274 (*curl_opensocket_callback)(void *clientp,
275  curlsocktype purpose,
276  struct curl_sockaddr *address);
277 
278 typedef int
279 (*curl_closesocket_callback)(void *clientp, curl_socket_t item);
280 
281 typedef enum {
282  CURLIOE_OK, /* I/O operation successful */
283  CURLIOE_UNKNOWNCMD, /* command was unknown to callback */
284  CURLIOE_FAILRESTART, /* failed to restart the read */
285  CURLIOE_LAST /* never use */
286 } curlioerr;
287 
288 typedef enum {
289  CURLIOCMD_NOP, /* no operation */
290  CURLIOCMD_RESTARTREAD, /* restart the read stream from start */
291  CURLIOCMD_LAST /* never use */
292 } curliocmd;
293 
294 typedef curlioerr (*curl_ioctl_callback)(CURL *handle,
295  int cmd,
296  void *clientp);
297 
298 /*
299  * The following typedef's are signatures of malloc, free, realloc, strdup and
300  * calloc respectively. Function pointers of these types can be passed to the
301  * curl_global_init_mem() function to set user defined memory management
302  * callback routines.
303  */
304 typedef void *(*curl_malloc_callback)(size_t size);
305 typedef void (*curl_free_callback)(void *ptr);
306 typedef void *(*curl_realloc_callback)(void *ptr, size_t size);
307 typedef char *(*curl_strdup_callback)(const char *str);
308 typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);
309 
310 /* the kind of data that is passed to information_callback*/
311 typedef enum {
320 } curl_infotype;
321 
322 typedef int (*curl_debug_callback)
323  (CURL *handle, /* the handle/transfer this concerns */
324  curl_infotype type, /* what kind of data */
325  char *data, /* points to the data */
326  size_t size, /* size of the data pointed to */
327  void *userptr); /* whatever the user please */
328 
329 /* All possible error codes from all sorts of curl functions. Future versions
330  may return other values, stay prepared.
331 
332  Always add new return codes last. Never *EVER* remove any. The return
333  codes must remain the same!
334  */
335 
336 typedef enum {
337  CURLE_OK = 0,
341  CURLE_NOT_BUILT_IN, /* 4 - [was obsoleted in August 2007 for
342  7.17.0, reused in April 2011 for 7.21.5] */
347  CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server
348  due to lack of access - when login fails
349  this is not returned. */
350  CURLE_OBSOLETE10, /* 10 - NOT USED */
352  CURLE_OBSOLETE12, /* 12 - NOT USED */
356  CURLE_OBSOLETE16, /* 16 - NOT USED */
360  CURLE_OBSOLETE20, /* 20 - NOT USED */
361  CURLE_QUOTE_ERROR, /* 21 - quote command failure */
364  CURLE_OBSOLETE24, /* 24 - NOT USED */
365  CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */
366  CURLE_READ_ERROR, /* 26 - couldn't open/read from file */
368  /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
369  instead of a memory allocation error if CURL_DOES_CONVERSIONS
370  is defined
371  */
372  CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was reached */
373  CURLE_OBSOLETE29, /* 29 - NOT USED */
374  CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */
375  CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */
376  CURLE_OBSOLETE32, /* 32 - NOT USED */
377  CURLE_RANGE_ERROR, /* 33 - RANGE "command" didn't work */
379  CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */
380  CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */
384  CURLE_OBSOLETE40, /* 40 - NOT USED */
388  CURLE_OBSOLETE44, /* 44 - NOT USED */
389  CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */
390  CURLE_OBSOLETE46, /* 46 - NOT USED */
391  CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */
392  CURLE_UNKNOWN_OPTION, /* 48 - User specified an unknown option */
393  CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */
394  CURLE_OBSOLETE50, /* 50 - NOT USED */
395  CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint
396  wasn't verified fine */
397  CURLE_GOT_NOTHING, /* 52 - when this is a specific error */
398  CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */
399  CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as
400  default */
401  CURLE_SEND_ERROR, /* 55 - failed sending network data */
402  CURLE_RECV_ERROR, /* 56 - failure in receiving network data */
403  CURLE_OBSOLETE57, /* 57 - NOT IN USE */
404  CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */
405  CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */
406  CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */
407  CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */
408  CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */
409  CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */
410  CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */
411  CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind
412  that failed */
413  CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */
414  CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not
415  accepted and we failed to login */
416  CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */
417  CURLE_TFTP_PERM, /* 69 - permission problem on server */
418  CURLE_REMOTE_DISK_FULL, /* 70 - out of disk space on server */
419  CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */
420  CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */
421  CURLE_REMOTE_FILE_EXISTS, /* 73 - File already exists */
422  CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */
423  CURLE_CONV_FAILED, /* 75 - conversion failed */
424  CURLE_CONV_REQD, /* 76 - caller must register conversion
425  callbacks using curl_easy_setopt options
426  CURLOPT_CONV_FROM_NETWORK_FUNCTION,
427  CURLOPT_CONV_TO_NETWORK_FUNCTION, and
428  CURLOPT_CONV_FROM_UTF8_FUNCTION */
429  CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing
430  or wrong format */
431  CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */
432  CURLE_SSH, /* 79 - error from the SSH layer, somewhat
433  generic so the error message will be of
434  interest when this has happened */
435 
436  CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL
437  connection */
438  CURLE_AGAIN, /* 81 - socket is not ready for send/recv,
439  wait till it's ready and try again (Added
440  in 7.18.2) */
441  CURLE_SSL_CRL_BADFILE, /* 82 - could not load CRL file, missing or
442  wrong format (Added in 7.19.0) */
443  CURLE_SSL_ISSUER_ERROR, /* 83 - Issuer check failed. (Added in
444  7.19.0) */
445  CURLE_FTP_PRET_FAILED, /* 84 - a PRET command failed */
446  CURLE_RTSP_CSEQ_ERROR, /* 85 - mismatch of RTSP CSeq numbers */
447  CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Ids */
448  CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */
449  CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */
450 
451  CURL_LAST /* never use! */
452 } CURLcode;
453 
454 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
455  the obsolete stuff removed! */
456 
457 /* compatibility with older names */
458 #define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING
459 
460 /* The following were added in 7.21.5, April 2011 */
461 #define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION
462 
463 /* The following were added in 7.17.1 */
464 /* These are scheduled to disappear by 2009 */
465 #define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION
466 
467 /* The following were added in 7.17.0 */
468 /* These are scheduled to disappear by 2009 */
469 #define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */
470 #define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46
471 #define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44
472 #define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10
473 #define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16
474 #define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32
475 #define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29
476 #define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12
477 #define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20
478 #define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40
479 #define CURLE_MALFORMAT_USER CURLE_OBSOLETE24
480 #define CURLE_SHARE_IN_USE CURLE_OBSOLETE57
481 #define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN
482 
483 #define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED
484 #define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE
485 #define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR
486 #define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL
487 #define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS
488 #define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR
489 #define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED
490 
491 /* The following were added earlier */
492 
493 #define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT
494 
495 #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
496 #define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
497 #define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED
498 
499 #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
500 #define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
501 
502 /* This was the error code 50 in 7.7.3 and a few earlier versions, this
503  is no longer used by libcurl but is instead #defined here only to not
504  make programs break */
505 #define CURLE_ALREADY_COMPLETE 99999
506 
507 #endif
509 /* This prototype applies to all conversion callbacks */
510 typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);
511 
512 typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */
513  void *ssl_ctx, /* actually an
514  OpenSSL SSL_CTX */
515  void *userptr);
516 
517 typedef enum {
518  CURLPROXY_HTTP = 0, /* added in 7.10, new in 7.19.4 default is to use
519  CONNECT HTTP/1.1 */
520  CURLPROXY_HTTP_1_0 = 1, /* added in 7.19.4, force to use CONNECT
521  HTTP/1.0 */
522  CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already
523  in 7.10 */
524  CURLPROXY_SOCKS5 = 5, /* added in 7.10 */
525  CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */
526  CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the
527  host name rather than the IP address. added
528  in 7.18.0 */
529 } curl_proxytype; /* this enum was added in 7.10 */
530 
531 #define CURLAUTH_NONE 0 /* nothing */
532 #define CURLAUTH_BASIC (1<<0) /* Basic (default) */
533 #define CURLAUTH_DIGEST (1<<1) /* Digest */
534 #define CURLAUTH_GSSNEGOTIATE (1<<2) /* GSS-Negotiate */
535 #define CURLAUTH_NTLM (1<<3) /* NTLM */
536 #define CURLAUTH_DIGEST_IE (1<<4) /* Digest with IE flavour */
537 #define CURLAUTH_ONLY (1<<31) /* used together with a single other
538  type to force no auth or just that
539  single type */
540 #define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) /* all fine types set */
541 #define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
542 
543 #define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */
544 #define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */
545 #define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */
546 #define CURLSSH_AUTH_PASSWORD (1<<1) /* password */
547 #define CURLSSH_AUTH_HOST (1<<2) /* host key files */
548 #define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */
549 #define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY
550 
551 #define CURL_ERROR_SIZE 256
552 
553 struct curl_khkey {
554  const char *key; /* points to a zero-terminated string encoded with base64
555  if len is zero, otherwise to the "raw" data */
556  size_t len;
557  enum type {
562  } keytype;
563 };
564 
565 /* this is the set of return values expected from the curl_sshkeycallback
566  callback */
570  CURLKHSTAT_REJECT, /* reject the connection, return an error */
571  CURLKHSTAT_DEFER, /* do not accept it, but we can't answer right now so
572  this causes a CURLE_DEFER error but otherwise the
573  connection will be left intact etc */
574  CURLKHSTAT_LAST /* not for use, only a marker for last-in-list */
575 };
576 
577 /* this is the set of status codes pass in to the callback */
579  CURLKHMATCH_OK, /* match */
580  CURLKHMATCH_MISMATCH, /* host found, key mismatch! */
581  CURLKHMATCH_MISSING, /* no matching host/key found */
582  CURLKHMATCH_LAST /* not for use, only a marker for last-in-list */
583 };
584 
585 typedef int
586  (*curl_sshkeycallback) (CURL *easy, /* easy handle */
587  const struct curl_khkey *knownkey, /* known */
588  const struct curl_khkey *foundkey, /* found */
589  enum curl_khmatch, /* libcurl's view on the keys */
590  void *clientp); /* custom pointer passed from app */
591 
592 /* parameter for the CURLOPT_USE_SSL option */
593 typedef enum {
594  CURLUSESSL_NONE, /* do not attempt to use SSL */
595  CURLUSESSL_TRY, /* try using SSL, proceed anyway otherwise */
596  CURLUSESSL_CONTROL, /* SSL for the control connection or fail */
597  CURLUSESSL_ALL, /* SSL for all communication or fail */
598  CURLUSESSL_LAST /* not an option, never use */
599 } curl_usessl;
600 
601 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
602  the obsolete stuff removed! */
603 
604 /* Backwards compatibility with older names */
605 /* These are scheduled to disappear by 2009 */
606 
607 #define CURLFTPSSL_NONE CURLUSESSL_NONE
608 #define CURLFTPSSL_TRY CURLUSESSL_TRY
609 #define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL
610 #define CURLFTPSSL_ALL CURLUSESSL_ALL
611 #define CURLFTPSSL_LAST CURLUSESSL_LAST
612 #define curl_ftpssl curl_usessl
613 #endif
615 /* parameter for the CURLOPT_FTP_SSL_CCC option */
616 typedef enum {
617  CURLFTPSSL_CCC_NONE, /* do not send CCC */
618  CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */
619  CURLFTPSSL_CCC_ACTIVE, /* Initiate the shutdown */
620  CURLFTPSSL_CCC_LAST /* not an option, never use */
621 } curl_ftpccc;
622 
623 /* parameter for the CURLOPT_FTPSSLAUTH option */
624 typedef enum {
625  CURLFTPAUTH_DEFAULT, /* let libcurl decide */
626  CURLFTPAUTH_SSL, /* use "AUTH SSL" */
627  CURLFTPAUTH_TLS, /* use "AUTH TLS" */
628  CURLFTPAUTH_LAST /* not an option, never use */
629 } curl_ftpauth;
630 
631 /* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */
632 typedef enum {
633  CURLFTP_CREATE_DIR_NONE, /* do NOT create missing dirs! */
634  CURLFTP_CREATE_DIR, /* (FTP/SFTP) if CWD fails, try MKD and then CWD
635  again if MKD succeeded, for SFTP this does
636  similar magic */
637  CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD
638  again even if MKD failed! */
639  CURLFTP_CREATE_DIR_LAST /* not an option, never use */
641 
642 /* parameter for the CURLOPT_FTP_FILEMETHOD option */
643 typedef enum {
644  CURLFTPMETHOD_DEFAULT, /* let libcurl pick */
645  CURLFTPMETHOD_MULTICWD, /* single CWD operation for each path part */
646  CURLFTPMETHOD_NOCWD, /* no CWD at all */
647  CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */
648  CURLFTPMETHOD_LAST /* not an option, never use */
650 
651 /* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */
652 #define CURLPROTO_HTTP (1<<0)
653 #define CURLPROTO_HTTPS (1<<1)
654 #define CURLPROTO_FTP (1<<2)
655 #define CURLPROTO_FTPS (1<<3)
656 #define CURLPROTO_SCP (1<<4)
657 #define CURLPROTO_SFTP (1<<5)
658 #define CURLPROTO_TELNET (1<<6)
659 #define CURLPROTO_LDAP (1<<7)
660 #define CURLPROTO_LDAPS (1<<8)
661 #define CURLPROTO_DICT (1<<9)
662 #define CURLPROTO_FILE (1<<10)
663 #define CURLPROTO_TFTP (1<<11)
664 #define CURLPROTO_IMAP (1<<12)
665 #define CURLPROTO_IMAPS (1<<13)
666 #define CURLPROTO_POP3 (1<<14)
667 #define CURLPROTO_POP3S (1<<15)
668 #define CURLPROTO_SMTP (1<<16)
669 #define CURLPROTO_SMTPS (1<<17)
670 #define CURLPROTO_RTSP (1<<18)
671 #define CURLPROTO_RTMP (1<<19)
672 #define CURLPROTO_RTMPT (1<<20)
673 #define CURLPROTO_RTMPE (1<<21)
674 #define CURLPROTO_RTMPTE (1<<22)
675 #define CURLPROTO_RTMPS (1<<23)
676 #define CURLPROTO_RTMPTS (1<<24)
677 #define CURLPROTO_GOPHER (1<<25)
678 #define CURLPROTO_ALL (~0) /* enable everything */
679 
680 /* long may be 32 or 64 bits, but we should never depend on anything else
681  but 32 */
682 #define CURLOPTTYPE_LONG 0
683 #define CURLOPTTYPE_OBJECTPOINT 10000
684 #define CURLOPTTYPE_FUNCTIONPOINT 20000
685 #define CURLOPTTYPE_OFF_T 30000
686 
687 /* name is uppercase CURLOPT_<name>,
688  type is one of the defined CURLOPTTYPE_<type>
689  number is unique identifier */
690 #ifdef CINIT
691 #undef CINIT
692 #endif
693 
694 #ifdef CURL_ISOCPP
695 #define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu
696 #else
697 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
698 #define LONG CURLOPTTYPE_LONG
699 #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
700 #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
701 #define OFF_T CURLOPTTYPE_OFF_T
702 #define CINIT(name,type,number) CURLOPT_name = type + number
703 #endif
704 
705 /*
706  * This macro-mania below setups the CURLOPT_[what] enum, to be used with
707  * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]
708  * word.
709  */
710 
711 typedef enum {
712  /* This is the FILE * or void * the regular output should be written to. */
713  CINIT(FILE, OBJECTPOINT, 1),
714 
715  /* The full URL to get/put */
716  CINIT(URL, OBJECTPOINT, 2),
717 
718  /* Port number to connect to, if other than default. */
719  CINIT(PORT, LONG, 3),
720 
721  /* Name of proxy to use. */
722  CINIT(PROXY, OBJECTPOINT, 4),
723 
724  /* "name:password" to use when fetching. */
725  CINIT(USERPWD, OBJECTPOINT, 5),
726 
727  /* "name:password" to use with proxy. */
728  CINIT(PROXYUSERPWD, OBJECTPOINT, 6),
729 
730  /* Range to get, specified as an ASCII string. */
731  CINIT(RANGE, OBJECTPOINT, 7),
732 
733  /* not used */
734 
735  /* Specified file stream to upload from (use as input): */
736  CINIT(INFILE, OBJECTPOINT, 9),
737 
738  /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
739  * bytes big. If this is not used, error messages go to stderr instead: */
740  CINIT(ERRORBUFFER, OBJECTPOINT, 10),
741 
742  /* Function that will be called to store the output (instead of fwrite). The
743  * parameters will use fwrite() syntax, make sure to follow them. */
744  CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),
745 
746  /* Function that will be called to read the input (instead of fread). The
747  * parameters will use fread() syntax, make sure to follow them. */
748  CINIT(READFUNCTION, FUNCTIONPOINT, 12),
749 
750  /* Time-out the read operation after this amount of seconds */
751  CINIT(TIMEOUT, LONG, 13),
752 
753  /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
754  * how large the file being sent really is. That allows better error
755  * checking and better verifies that the upload was successful. -1 means
756  * unknown size.
757  *
758  * For large file support, there is also a _LARGE version of the key
759  * which takes an off_t type, allowing platforms with larger off_t
760  * sizes to handle larger files. See below for INFILESIZE_LARGE.
761  */
762  CINIT(INFILESIZE, LONG, 14),
763 
764  /* POST static input fields. */
765  CINIT(POSTFIELDS, OBJECTPOINT, 15),
766 
767  /* Set the referrer page (needed by some CGIs) */
768  CINIT(REFERER, OBJECTPOINT, 16),
769 
770  /* Set the FTP PORT string (interface name, named or numerical IP address)
771  Use i.e '-' to use default address. */
772  CINIT(FTPPORT, OBJECTPOINT, 17),
773 
774  /* Set the User-Agent string (examined by some CGIs) */
775  CINIT(USERAGENT, OBJECTPOINT, 18),
776 
777  /* If the download receives less than "low speed limit" bytes/second
778  * during "low speed time" seconds, the operations is aborted.
779  * You could i.e if you have a pretty high speed connection, abort if
780  * it is less than 2000 bytes/sec during 20 seconds.
781  */
782 
783  /* Set the "low speed limit" */
784  CINIT(LOW_SPEED_LIMIT, LONG, 19),
785 
786  /* Set the "low speed time" */
787  CINIT(LOW_SPEED_TIME, LONG, 20),
788 
789  /* Set the continuation offset.
790  *
791  * Note there is also a _LARGE version of this key which uses
792  * off_t types, allowing for large file offsets on platforms which
793  * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE.
794  */
795  CINIT(RESUME_FROM, LONG, 21),
796 
797  /* Set cookie in request: */
798  CINIT(COOKIE, OBJECTPOINT, 22),
799 
800  /* This points to a linked list of headers, struct curl_slist kind */
801  CINIT(HTTPHEADER, OBJECTPOINT, 23),
802 
803  /* This points to a linked list of post entries, struct curl_httppost */
804  CINIT(HTTPPOST, OBJECTPOINT, 24),
805 
806  /* send TYPE parameter? */
807  CINIT(CRLF, LONG, 27),
808 
809  /* send linked-list of QUOTE commands */
810  CINIT(QUOTE, OBJECTPOINT, 28),
811 
812  /* send FILE * or void * to store headers to, if you use a callback it
813  is simply passed to the callback unmodified */
814  CINIT(WRITEHEADER, OBJECTPOINT, 29),
815 
816  /* point to a file to read the initial cookies from, also enables
817  "cookie awareness" */
818  CINIT(COOKIEFILE, OBJECTPOINT, 31),
819 
820  /* What kind of HTTP time condition to use, see defines */
821  CINIT(TIMECONDITION, LONG, 33),
822 
823  /* Time to use with the above condition. Specified in number of seconds
824  since 1 Jan 1970 */
825  CINIT(TIMEVALUE, LONG, 34),
826 
827  /* 35 = OBSOLETE */
828 
829  /* Custom request, for customizing the get command like
830  HTTP: DELETE, TRACE and others
831  FTP: to use a different list command
832  */
833  CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),
834 
835  /* HTTP request, for odd commands like DELETE, TRACE and others */
836  CINIT(STDERR, OBJECTPOINT, 37),
837 
838  /* 38 is not used */
839 
840  /* send linked-list of post-transfer QUOTE commands */
841  CINIT(POSTQUOTE, OBJECTPOINT, 39),
842 
843  /* Pass a pointer to string of the output using full variable-replacement
844  as described elsewhere. */
845  CINIT(WRITEINFO, OBJECTPOINT, 40),
846 
847  CINIT(VERBOSE, LONG, 41), /* talk a lot */
848  CINIT(HEADER, LONG, 42), /* throw the header out too */
849  CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */
850  CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */
851  CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 300 */
852  CINIT(UPLOAD, LONG, 46), /* this is an upload */
853  CINIT(POST, LONG, 47), /* HTTP POST method */
854  CINIT(DIRLISTONLY, LONG, 48), /* bare names when listing directories */
855 
856  CINIT(APPEND, LONG, 50), /* Append instead of overwrite on upload! */
857 
858  /* Specify whether to read the user+password from the .netrc or the URL.
859  * This must be one of the CURL_NETRC_* enums below. */
860  CINIT(NETRC, LONG, 51),
861 
862  CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */
863 
864  CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
865  CINIT(PUT, LONG, 54), /* HTTP PUT */
866 
867  /* 55 = OBSOLETE */
868 
869  /* Function that will be called instead of the internal progress display
870  * function. This function should be defined as the curl_progress_callback
871  * prototype defines. */
872  CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
873 
874  /* Data passed to the progress callback */
875  CINIT(PROGRESSDATA, OBJECTPOINT, 57),
876 
877  /* We want the referrer field set automatically when following locations */
878  CINIT(AUTOREFERER, LONG, 58),
879 
880  /* Port of the proxy, can be set in the proxy string as well with:
881  "[host]:[port]" */
882  CINIT(PROXYPORT, LONG, 59),
883 
884  /* size of the POST input data, if strlen() is not good to use */
885  CINIT(POSTFIELDSIZE, LONG, 60),
886 
887  /* tunnel non-http operations through a HTTP proxy */
888  CINIT(HTTPPROXYTUNNEL, LONG, 61),
889 
890  /* Set the interface string to use as outgoing network interface */
891  CINIT(INTERFACE, OBJECTPOINT, 62),
892 
893  /* Set the krb4/5 security level, this also enables krb4/5 awareness. This
894  * is a string, 'clear', 'safe', 'confidential' or 'private'. If the string
895  * is set but doesn't match one of these, 'private' will be used. */
896  CINIT(KRBLEVEL, OBJECTPOINT, 63),
897 
898  /* 66 = OBSOLETE */
899  /* 67 = OBSOLETE */
900 
901  /* Maximum number of http redirects to follow */
902  CINIT(MAXREDIRS, LONG, 68),
903 
904  /* Pass a long set to 1 to get the date of the requested document (if
905  possible)! Pass a zero to shut it off. */
906  CINIT(FILETIME, LONG, 69),
907 
908  /* This points to a linked list of telnet options */
909  CINIT(TELNETOPTIONS, OBJECTPOINT, 70),
910 
911  /* Max amount of cached alive connections */
912  CINIT(MAXCONNECTS, LONG, 71),
913 
914  /* 72 - DEPRECATED */
915  CINIT(CLOSEPOLICY, LONG, 72),
916 
917  /* 73 = OBSOLETE */
918 
919  /* Set to explicitly use a new connection for the upcoming transfer.
920  Do not use this unless you're absolutely sure of this, as it makes the
921  operation slower and is less friendly for the network. */
922  CINIT(FRESH_CONNECT, LONG, 74),
923 
924  /* Set to explicitly forbid the upcoming transfer's connection to be re-used
925  when done. Do not use this unless you're absolutely sure of this, as it
926  makes the operation slower and is less friendly for the network. */
927  CINIT(FORBID_REUSE, LONG, 75),
928 
929  /* Time-out connect operations after this amount of seconds, if connects
930  are OK within this time, then fine... This only aborts the connect
931  phase. [Only works on unix-style/SIGALRM operating systems] */
932  CINIT(CONNECTTIMEOUT, LONG, 78),
933 
934  /* Function that will be called to store headers (instead of fwrite). The
935  * parameters will use fwrite() syntax, make sure to follow them. */
936  CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),
937 
938  /* Set this to force the HTTP request to get back to GET. Only really usable
939  if POST, PUT or a custom request have been used first.
940  */
941  CINIT(HTTPGET, LONG, 80),
942 
943  /* Specify which file name to write all known cookies in after completed
944  operation. Set file name to "-" (dash) to make it go to stdout. */
945  CINIT(COOKIEJAR, OBJECTPOINT, 82),
946 
947  /* Specify which HTTP version to use! This must be set to one of the
948  CURL_HTTP_VERSION* enums set below. */
949  CINIT(HTTP_VERSION, LONG, 84),
950 
951  /* Specifically switch on or off the FTP engine's use of the EPSV command. By
952  default, that one will always be attempted before the more traditional
953  PASV command. */
954  CINIT(FTP_USE_EPSV, LONG, 85),
955 
956  /* Non-zero value means to use the global dns cache */
957  CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* To become OBSOLETE soon */
958 
959  /* DNS cache timeout */
960  CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
961 
962  /* send linked-list of pre-transfer QUOTE commands */
963  CINIT(PREQUOTE, OBJECTPOINT, 93),
964 
965  /* set the debug function */
966  CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),
967 
968  /* set the data for the debug function */
969  CINIT(DEBUGDATA, OBJECTPOINT, 95),
970 
971  /* mark this as start of a cookie session */
972  CINIT(COOKIESESSION, LONG, 96),
973 
974  /* Instruct libcurl to use a smaller receive buffer */
975  CINIT(BUFFERSIZE, LONG, 98),
976 
977  /* Instruct libcurl to not use any signal/alarm handlers, even when using
978  timeouts. This option is useful for multi-threaded applications.
979  See libcurl-the-guide for more background information. */
980  CINIT(NOSIGNAL, LONG, 99),
981 
982  /* Provide a CURLShare for mutexing non-ts data */
983  CINIT(SHARE, OBJECTPOINT, 100),
984 
985  /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
986  CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */
987  CINIT(PROXYTYPE, LONG, 101),
988 
989  /* Set the Accept-Encoding string. Use this to tell a server you would like
990  the response to be compressed. Before 7.21.6, this was known as
991  CURLOPT_ENCODING */
992  CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102),
993 
994  /* Set pointer to private data */
995  CINIT(PRIVATE, OBJECTPOINT, 103),
996 
997  /* Set aliases for HTTP 200 in the HTTP Response header */
998  CINIT(HTTP200ALIASES, OBJECTPOINT, 104),
999 
1000  /* Continue to send authentication (user+password) when following locations,
1001  even when hostname changed. This can potentially send off the name
1002  and password to whatever host the server decides. */
1003  CINIT(UNRESTRICTED_AUTH, LONG, 105),
1004 
1005  /* Specifically switch on or off the FTP engine's use of the EPRT command (
1006  it also disables the LPRT attempt). By default, those ones will always be
1007  attempted before the good old traditional PORT command. */
1008  CINIT(FTP_USE_EPRT, LONG, 106),
1009 
1010  /* Set this to a bitmask value to enable the particular authentications
1011  methods you like. Use this in combination with CURLOPT_USERPWD.
1012  Note that setting multiple bits may cause extra network round-trips. */
1013  CINIT(HTTPAUTH, LONG, 107),
1014 
1015  /* FTP Option that causes missing dirs to be created on the remote server.
1016  In 7.19.4 we introduced the convenience enums for this option using the
1017  CURLFTP_CREATE_DIR prefix.
1018  */
1019  CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),
1020 
1021  /* Set this to a bitmask value to enable the particular authentications
1022  methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.
1023  Note that setting multiple bits may cause extra network round-trips. */
1024  CINIT(PROXYAUTH, LONG, 111),
1025 
1026  /* FTP option that changes the timeout, in seconds, associated with
1027  getting a response. This is different from transfer timeout time and
1028  essentially places a demand on the FTP server to acknowledge commands
1029  in a timely manner. */
1030  CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),
1031 #define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT
1032 
1033  /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
1034  tell libcurl to resolve names to those IP versions only. This only has
1035  affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
1036  CINIT(IPRESOLVE, LONG, 113),
1037 
1038  /* Set this option to limit the size of a file that will be downloaded from
1039  an HTTP or FTP server.
1040 
1041  Note there is also _LARGE version which adds large file support for
1042  platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */
1043  CINIT(MAXFILESIZE, LONG, 114),
1044 
1045  /* See the comment for INFILESIZE above, but in short, specifies
1046  * the size of the file being uploaded. -1 means unknown.
1047  */
1048  CINIT(INFILESIZE_LARGE, OFF_T, 115),
1049 
1050  /* Sets the continuation offset. There is also a LONG version of this;
1051  * look above for RESUME_FROM.
1052  */
1053  CINIT(RESUME_FROM_LARGE, OFF_T, 116),
1054 
1055  /* Sets the maximum size of data that will be downloaded from
1056  * an HTTP or FTP server. See MAXFILESIZE above for the LONG version.
1057  */
1058  CINIT(MAXFILESIZE_LARGE, OFF_T, 117),
1059 
1060  /* Set this option to the file name of your .netrc file you want libcurl
1061  to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
1062  a poor attempt to find the user's home directory and check for a .netrc
1063  file in there. */
1064  CINIT(NETRC_FILE, OBJECTPOINT, 118),
1065 
1066  /* Enable SSL/TLS for FTP, pick one of:
1067  CURLFTPSSL_TRY - try using SSL, proceed anyway otherwise
1068  CURLFTPSSL_CONTROL - SSL for the control connection or fail
1069  CURLFTPSSL_ALL - SSL for all communication or fail
1070  */
1071  CINIT(USE_SSL, LONG, 119),
1072 
1073  /* The _LARGE version of the standard POSTFIELDSIZE option */
1074  CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),
1075 
1076  /* Enable/disable the TCP Nagle algorithm */
1077  CINIT(TCP_NODELAY, LONG, 121),
1078 
1079  /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
1080  /* 123 OBSOLETE. Gone in 7.16.0 */
1081  /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
1082  /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
1083  /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
1084  /* 127 OBSOLETE. Gone in 7.16.0 */
1085  /* 128 OBSOLETE. Gone in 7.16.0 */
1086 
1087  /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option
1088  can be used to change libcurl's default action which is to first try
1089  "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK
1090  response has been received.
1091 
1092  Available parameters are:
1093  CURLFTPAUTH_DEFAULT - let libcurl decide
1094  CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS
1095  CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL
1096  */
1097  CINIT(FTPSSLAUTH, LONG, 129),
1098 
1099  CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),
1100  CINIT(IOCTLDATA, OBJECTPOINT, 131),
1101 
1102  /* 132 OBSOLETE. Gone in 7.16.0 */
1103  /* 133 OBSOLETE. Gone in 7.16.0 */
1104 
1105  /* zero terminated string for pass on to the FTP server when asked for
1106  "account" info */
1107  CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),
1108 
1109  /* feed cookies into cookie engine */
1110  CINIT(COOKIELIST, OBJECTPOINT, 135),
1111 
1112  /* ignore Content-Length */
1113  CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),
1114 
1115  /* Set to non-zero to skip the IP address received in a 227 PASV FTP server
1116  response. Typically used for FTP-SSL purposes but is not restricted to
1117  that. libcurl will then instead use the same IP address it used for the
1118  control connection. */
1119  CINIT(FTP_SKIP_PASV_IP, LONG, 137),
1120 
1121  /* Select "file method" to use when doing FTP, see the curl_ftpmethod
1122  above. */
1123  CINIT(FTP_FILEMETHOD, LONG, 138),
1124 
1125  /* Local port number to bind the socket to */
1126  CINIT(LOCALPORT, LONG, 139),
1127 
1128  /* Number of ports to try, including the first one set with LOCALPORT.
1129  Thus, setting it to 1 will make no additional attempts but the first.
1130  */
1131  CINIT(LOCALPORTRANGE, LONG, 140),
1132 
1133  /* no transfer, set up connection and let application use the socket by
1134  extracting it with CURLINFO_LASTSOCKET */
1135  CINIT(CONNECT_ONLY, LONG, 141),
1136 
1137  /* Function that will be called to convert from the
1138  network encoding (instead of using the iconv calls in libcurl) */
1139  CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142),
1140 
1141  /* Function that will be called to convert to the
1142  network encoding (instead of using the iconv calls in libcurl) */
1143  CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143),
1144 
1145  /* Function that will be called to convert from UTF8
1146  (instead of using the iconv calls in libcurl)
1147  Note that this is used only for SSL certificate processing */
1148  CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),
1149 
1150  /* if the connection proceeds too quickly then need to slow it down */
1151  /* limit-rate: maximum number of bytes per second to send or receive */
1152  CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),
1153  CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),
1154 
1155  /* Pointer to command string to send if USER/PASS fails. */
1156  CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147),
1157 
1158  /* callback function for setting socket options */
1159  CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),
1160  CINIT(SOCKOPTDATA, OBJECTPOINT, 149),
1161 
1162  /* set to 0 to disable session ID re-use for this transfer, default is
1163  enabled (== 1) */
1164  CINIT(SSL_SESSIONID_CACHE, LONG, 150),
1165 
1166  /* allowed SSH authentication methods */
1167  CINIT(SSH_AUTH_TYPES, LONG, 151),
1168 
1169  /* Used by scp/sftp to do public/private key authentication */
1170  CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152),
1171  CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153),
1172 
1173  /* Send CCC (Clear Command Channel) after authentication */
1174  CINIT(FTP_SSL_CCC, LONG, 154),
1175 
1176  /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */
1177  CINIT(TIMEOUT_MS, LONG, 155),
1178  CINIT(CONNECTTIMEOUT_MS, LONG, 156),
1179 
1180  /* set to zero to disable the libcurl's decoding and thus pass the raw body
1181  data to the application even when it is encoded/compressed */
1182  CINIT(HTTP_TRANSFER_DECODING, LONG, 157),
1183  CINIT(HTTP_CONTENT_DECODING, LONG, 158),
1184 
1185  /* Permission used when creating new files and directories on the remote
1186  server for protocols that support it, SFTP/SCP/FILE */
1187  CINIT(NEW_FILE_PERMS, LONG, 159),
1188  CINIT(NEW_DIRECTORY_PERMS, LONG, 160),
1189 
1190  /* Set the behaviour of POST when redirecting. Values must be set to one
1191  of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */
1192  CINIT(POSTREDIR, LONG, 161),
1193 
1194  /* used by scp/sftp to verify the host's public key */
1195  CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162),
1196 
1197  /* Callback function for opening socket (instead of socket(2)). Optionally,
1198  callback is able change the address or refuse to connect returning
1199  CURL_SOCKET_BAD. The callback should have type
1200  curl_opensocket_callback */
1201  CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),
1202  CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),
1203 
1204  /* POST volatile input fields. */
1205  CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165),
1206 
1207  /* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */
1208  CINIT(PROXY_TRANSFER_MODE, LONG, 166),
1209 
1210  /* Callback function for seeking in the input stream */
1211  CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),
1212  CINIT(SEEKDATA, OBJECTPOINT, 168),
1213 
1214  /* (IPv6) Address scope */
1215  CINIT(ADDRESS_SCOPE, LONG, 171),
1216 
1217  /* "name" and "pwd" to use when fetching. */
1218  CINIT(USERNAME, OBJECTPOINT, 173),
1219  CINIT(PASSWORD, OBJECTPOINT, 174),
1220 
1221  /* "name" and "pwd" to use with Proxy when fetching. */
1222  CINIT(PROXYUSERNAME, OBJECTPOINT, 175),
1223  CINIT(PROXYPASSWORD, OBJECTPOINT, 176),
1224 
1225  /* Comma separated list of hostnames defining no-proxy zones. These should
1226  match both hostnames directly, and hostnames within a domain. For
1227  example, local.com will match local.com and www.local.com, but NOT
1228  notlocal.com or www.notlocal.com. For compatibility with other
1229  implementations of this, .local.com will be considered to be the same as
1230  local.com. A single * is the only valid wildcard, and effectively
1231  disables the use of proxy. */
1232  CINIT(NOPROXY, OBJECTPOINT, 177),
1233 
1234  /* block size for TFTP transfers */
1235  CINIT(TFTP_BLKSIZE, LONG, 178),
1236 
1237  /* Socks Service */
1238  CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179),
1239 
1240  /* Socks Service */
1241  CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),
1242 
1243  /* set the bitmask for the protocols that are allowed to be used for the
1244  transfer, which thus helps the app which takes URLs from users or other
1245  external inputs and want to restrict what protocol(s) to deal
1246  with. Defaults to CURLPROTO_ALL. */
1247  CINIT(PROTOCOLS, LONG, 181),
1248 
1249  /* set the bitmask for the protocols that libcurl is allowed to follow to,
1250  as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs
1251  to be set in both bitmasks to be allowed to get redirected to. Defaults
1252  to all protocols except FILE and SCP. */
1253  CINIT(REDIR_PROTOCOLS, LONG, 182),
1254 
1255  /* set the SSH knownhost file name to use */
1256  CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183),
1257 
1258  /* set the SSH host key callback, must point to a curl_sshkeycallback
1259  function */
1260  CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184),
1261 
1262  /* set the SSH host key callback custom pointer */
1263  CINIT(SSH_KEYDATA, OBJECTPOINT, 185),
1264 
1265  /* set the SMTP mail originator */
1266  CINIT(MAIL_FROM, OBJECTPOINT, 186),
1267 
1268  /* set the SMTP mail receiver(s) */
1269  CINIT(MAIL_RCPT, OBJECTPOINT, 187),
1270 
1271  /* FTP: send PRET before PASV */
1272  CINIT(FTP_USE_PRET, LONG, 188),
1273 
1274  /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */
1275  CINIT(RTSP_REQUEST, LONG, 189),
1276 
1277  /* The RTSP session identifier */
1278  CINIT(RTSP_SESSION_ID, OBJECTPOINT, 190),
1279 
1280  /* The RTSP stream URI */
1281  CINIT(RTSP_STREAM_URI, OBJECTPOINT, 191),
1282 
1283  /* The Transport: header to use in RTSP requests */
1284  CINIT(RTSP_TRANSPORT, OBJECTPOINT, 192),
1285 
1286  /* Manually initialize the client RTSP CSeq for this handle */
1287  CINIT(RTSP_CLIENT_CSEQ, LONG, 193),
1288 
1289  /* Manually initialize the server RTSP CSeq for this handle */
1290  CINIT(RTSP_SERVER_CSEQ, LONG, 194),
1291 
1292  /* The stream to pass to INTERLEAVEFUNCTION. */
1293  CINIT(INTERLEAVEDATA, OBJECTPOINT, 195),
1294 
1295  /* Let the application define a custom write method for RTP data */
1296  CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196),
1297 
1298  /* Turn on wildcard matching */
1299  CINIT(WILDCARDMATCH, LONG, 197),
1300 
1301  /* Directory matching callback called before downloading of an
1302  individual file (chunk) started */
1303  CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198),
1304 
1305  /* Directory matching callback called after the file (chunk)
1306  was downloaded, or skipped */
1307  CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199),
1308 
1309  /* Change match (fnmatch-like) callback for wildcard matching */
1310  CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200),
1311 
1312  /* Let the application define custom chunk data pointer */
1313  CINIT(CHUNK_DATA, OBJECTPOINT, 201),
1314 
1315  /* FNMATCH_FUNCTION user pointer */
1316  CINIT(FNMATCH_DATA, OBJECTPOINT, 202),
1317 
1318  /* send linked-list of name:port:address sets */
1319  CINIT(RESOLVE, OBJECTPOINT, 203),
1320 
1321  /* Set a username for authenticated TLS */
1322  CINIT(TLSAUTH_USERNAME, OBJECTPOINT, 204),
1323 
1324  /* Set a password for authenticated TLS */
1325  CINIT(TLSAUTH_PASSWORD, OBJECTPOINT, 205),
1326 
1327  /* Set authentication type for authenticated TLS */
1328  CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206),
1329 
1330  /* Set to 1 to enable the "TE:" header in HTTP requests to ask for
1331  compressed transfer-encoded responses. Set to 0 to disable the use of TE:
1332  in outgoing requests. The current default is 0, but it might change in a
1333  future libcurl release.
1334 
1335  libcurl will ask for the compressed methods it knows of, and if that
1336  isn't any, it will not ask for transfer-encoding at all even if this
1337  option is set to 1.
1338 
1339  */
1340  CINIT(TRANSFER_ENCODING, LONG, 207),
1341 
1342  /* Callback function for closing socket (instead of close(2)). The callback
1343  should have type curl_closesocket_callback */
1344  CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208),
1345  CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209),
1346 
1347  /* SSL context for NSSL functions in nsysnet.rpl */
1348  CINIT(NSSL_CONTEXT, LONG, 210),
1349 
1350  CURLOPT_LASTENTRY /* the last unused */
1351 } CURLoption;
1352 
1353 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
1354  the obsolete stuff removed! */
1355 
1356 /* Backwards compatibility with older names */
1357 /* These are scheduled to disappear by 2011 */
1358 
1359 /* This was added in version 7.19.1 */
1360 #define CURLOPT_POST301 CURLOPT_POSTREDIR
1361 
1362 /* These are scheduled to disappear by 2009 */
1363 
1364 /* The following were added in 7.17.0 */
1365 #define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD
1366 #define CURLOPT_FTPAPPEND CURLOPT_APPEND
1367 #define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY
1368 #define CURLOPT_FTP_SSL CURLOPT_USE_SSL
1369 
1370 /* The following were added earlier */
1371 
1372 #define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD
1373 #define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL
1374 
1375 #else
1376 /* This is set if CURL_NO_OLDIES is defined at compile-time */
1377 #undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
1378 #endif
1379 
1380 
1381  /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
1382  name resolves addresses using more than one IP protocol version, this
1383  option might be handy to force libcurl to use a specific IP version. */
1384 #define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
1385  versions that your system allows */
1386 #define CURL_IPRESOLVE_V4 1 /* resolve to ipv4 addresses */
1387 #define CURL_IPRESOLVE_V6 2 /* resolve to ipv6 addresses */
1388 
1389  /* three convenient "aliases" that follow the name scheme better */
1390 #define CURLOPT_WRITEDATA CURLOPT_FILE
1391 #define CURLOPT_READDATA CURLOPT_INFILE
1392 #define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER
1393 #define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER
1394 
1395  /* These enums are for use with the CURLOPT_HTTP_VERSION option. */
1396 enum {
1397  CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd
1398  like the library to choose the best possible
1399  for us! */
1400  CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */
1401  CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */
1402 
1403  CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
1404 };
1405 
1406 /*
1407  * Public API enums for RTSP requests
1408  */
1409 enum {
1410  CURL_RTSPREQ_NONE, /* first in list */
1422  CURL_RTSPREQ_LAST /* last in list */
1423 };
1424 
1425  /* These enums are for use with the CURLOPT_NETRC option. */
1427  CURL_NETRC_IGNORED, /* The .netrc will never be read.
1428  * This is the default. */
1429  CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred
1430  * to one in the .netrc. */
1431  CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored.
1432  * Unless one is set programmatically, the .netrc
1433  * will be queried. */
1435 };
1436 
1437 enum {
1442 
1443  CURL_SSLVERSION_LAST /* never use, keep last */
1444 };
1445 
1449  CURL_TLSAUTH_LAST /* never use, keep last */
1450 };
1451 
1452 /* symbols to use with CURLOPT_POSTREDIR.
1453  CURL_REDIR_POST_301 and CURL_REDIR_POST_302 can be bitwise ORed so that
1454  CURL_REDIR_POST_301 | CURL_REDIR_POST_302 == CURL_REDIR_POST_ALL */
1455 
1456 #define CURL_REDIR_GET_ALL 0
1457 #define CURL_REDIR_POST_301 1
1458 #define CURL_REDIR_POST_302 2
1459 #define CURL_REDIR_POST_ALL (CURL_REDIR_POST_301|CURL_REDIR_POST_302)
1460 
1461 typedef enum {
1463 
1467 
1469 } curl_TimeCond;
1470 
1471 
1472 /* curl_strequal() and curl_strnequal() are subject for removal in a future
1473  libcurl, see lib/README.curlx for details */
1474 CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);
1475 CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);
1476 
1477 /* name is uppercase CURLFORM_<name> */
1478 #ifdef CFINIT
1479 #undef CFINIT
1480 #endif
1481 
1482 #ifdef CURL_ISOCPP
1483 #define CFINIT(name) CURLFORM_ ## name
1484 #else
1485 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
1486 #define CFINIT(name) CURLFORM_name
1487 #endif
1488 
1489 typedef enum {
1490  CFINIT(NOTHING), /********* the first one is unused ************/
1491 
1492  /* */
1493  CFINIT(COPYNAME),
1494  CFINIT(PTRNAME),
1495  CFINIT(NAMELENGTH),
1496  CFINIT(COPYCONTENTS),
1497  CFINIT(PTRCONTENTS),
1498  CFINIT(CONTENTSLENGTH),
1499  CFINIT(FILECONTENT),
1500  CFINIT(ARRAY),
1501  CFINIT(OBSOLETE),
1502  CFINIT(FILE),
1503 
1504  CFINIT(BUFFER),
1505  CFINIT(BUFFERPTR),
1506  CFINIT(BUFFERLENGTH),
1507 
1508  CFINIT(CONTENTTYPE),
1509  CFINIT(CONTENTHEADER),
1510  CFINIT(FILENAME),
1511  CFINIT(END),
1512  CFINIT(OBSOLETE2),
1513 
1514  CFINIT(STREAM),
1515 
1516  CURLFORM_LASTENTRY /* the last unused */
1517 } CURLformoption;
1518 
1519 #undef CFINIT /* done */
1520 
1521 /* structure to be used as parameter for CURLFORM_ARRAY */
1522 struct curl_forms {
1524  const char *value;
1525 };
1526 
1527 /* use this for multipart formpost building */
1528 /* Returns code for curl_formadd()
1529  *
1530  * Returns:
1531  * CURL_FORMADD_OK on success
1532  * CURL_FORMADD_MEMORY if the FormInfo allocation fails
1533  * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form
1534  * CURL_FORMADD_NULL if a null pointer was given for a char
1535  * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed
1536  * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
1537  * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error)
1538  * CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated
1539  * CURL_FORMADD_MEMORY if some allocation for string copying failed.
1540  * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array
1541  *
1542  ***************************************************************************/
1543 typedef enum {
1544  CURL_FORMADD_OK, /* first, no error */
1545 
1552  CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */
1553 
1555 } CURLFORMcode;
1556 
1557 /*
1558  * NAME curl_formadd()
1559  *
1560  * DESCRIPTION
1561  *
1562  * Pretty advanced function for building multi-part formposts. Each invoke
1563  * adds one part that together construct a full post. Then use
1564  * CURLOPT_HTTPPOST to send it off to libcurl.
1565  */
1567  struct curl_httppost **last_post,
1568  ...);
1569 
1570 /*
1571  * callback function for curl_formget()
1572  * The void *arg pointer will be the one passed as second argument to
1573  * curl_formget().
1574  * The character buffer passed to it must not be freed.
1575  * Should return the buffer length passed to it as the argument "len" on
1576  * success.
1577  */
1578 typedef size_t (*curl_formget_callback)(void *arg, const char *buf,
1579  size_t len);
1580 
1581 /*
1582  * NAME curl_formget()
1583  *
1584  * DESCRIPTION
1585  *
1586  * Serialize a curl_httppost struct built with curl_formadd().
1587  * Accepts a void pointer as second argument which will be passed to
1588  * the curl_formget_callback function.
1589  * Returns 0 on success.
1590  */
1591 CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg,
1592  curl_formget_callback append);
1593 /*
1594  * NAME curl_formfree()
1595  *
1596  * DESCRIPTION
1597  *
1598  * Free a multipart formpost previously built with curl_formadd().
1599  */
1600 CURL_EXTERN void curl_formfree(struct curl_httppost *form);
1601 
1602 /*
1603  * NAME curl_getenv()
1604  *
1605  * DESCRIPTION
1606  *
1607  * Returns a malloc()'ed string that MUST be curl_free()ed after usage is
1608  * complete. DEPRECATED - see lib/README.curlx
1609  */
1610 CURL_EXTERN char *curl_getenv(const char *variable);
1611 
1612 /*
1613  * NAME curl_version()
1614  *
1615  * DESCRIPTION
1616  *
1617  * Returns a static ascii string of the libcurl version.
1618  */
1619 CURL_EXTERN char *curl_version(void);
1620 
1621 /*
1622  * NAME curl_easy_escape()
1623  *
1624  * DESCRIPTION
1625  *
1626  * Escapes URL strings (converts all letters consider illegal in URLs to their
1627  * %XX versions). This function returns a new allocated string or NULL if an
1628  * error occurred.
1629  */
1630 CURL_EXTERN char *curl_easy_escape(CURL *handle,
1631  const char *string,
1632  int length);
1633 
1634 /* the previous version: */
1635 CURL_EXTERN char *curl_escape(const char *string,
1636  int length);
1637 
1638 
1639 /*
1640  * NAME curl_easy_unescape()
1641  *
1642  * DESCRIPTION
1643  *
1644  * Unescapes URL encoding in strings (converts all %XX codes to their 8bit
1645  * versions). This function returns a new allocated string or NULL if an error
1646  * occurred.
1647  * Conversion Note: On non-ASCII platforms the ASCII %XX codes are
1648  * converted into the host encoding.
1649  */
1650 CURL_EXTERN char *curl_easy_unescape(CURL *handle,
1651  const char *string,
1652  int length,
1653  int *outlength);
1654 
1655 /* the previous version */
1656 CURL_EXTERN char *curl_unescape(const char *string,
1657  int length);
1658 
1659 /*
1660  * NAME curl_free()
1661  *
1662  * DESCRIPTION
1663  *
1664  * Provided for de-allocation in the same translation unit that did the
1665  * allocation. Added in libcurl 7.10
1666  */
1667 CURL_EXTERN void curl_free(void *p);
1668 
1669 /*
1670  * NAME curl_global_init()
1671  *
1672  * DESCRIPTION
1673  *
1674  * curl_global_init() should be invoked exactly once for each application that
1675  * uses libcurl and before any call of other libcurl functions.
1676  *
1677  * This function is not thread-safe!
1678  */
1680 
1681 /*
1682  * NAME curl_global_init_mem()
1683  *
1684  * DESCRIPTION
1685  *
1686  * curl_global_init() or curl_global_init_mem() should be invoked exactly once
1687  * for each application that uses libcurl. This function can be used to
1688  * initialize libcurl and set user defined memory management callback
1689  * functions. Users can implement memory management routines to check for
1690  * memory leaks, check for mis-use of the curl library etc. User registered
1691  * callback routines with be invoked by this library instead of the system
1692  * memory management routines like malloc, free etc.
1693  */
1700 
1701 /*
1702  * NAME curl_global_cleanup()
1703  *
1704  * DESCRIPTION
1705  *
1706  * curl_global_cleanup() should be invoked exactly once for each application
1707  * that uses libcurl
1708  */
1709 CURL_EXTERN void curl_global_cleanup(void);
1710 
1711 /* linked-list structure for the CURLOPT_QUOTE option (and other) */
1712 struct curl_slist {
1713  char *data;
1714  struct curl_slist *next;
1715 };
1716 
1717 /*
1718  * NAME curl_slist_append()
1719  *
1720  * DESCRIPTION
1721  *
1722  * Appends a string to a linked list. If no list exists, it will be created
1723  * first. Returns the new list, after appending.
1724  */
1726  const char *);
1727 
1728 /*
1729  * NAME curl_slist_free_all()
1730  *
1731  * DESCRIPTION
1732  *
1733  * free a previously built curl_slist.
1734  */
1736 
1737 /*
1738  * NAME curl_getdate()
1739  *
1740  * DESCRIPTION
1741  *
1742  * Returns the time, in seconds since 1 Jan 1970 of the time string given in
1743  * the first argument. The time argument in the second parameter is unused
1744  * and should be set to NULL.
1745  */
1746 CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);
1747 
1748 /* info about the certificate chain, only for OpenSSL builds. Asked
1749  for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */
1751  int num_of_certs; /* number of certificates with information */
1752  struct curl_slist **certinfo; /* for each index in this array, there's a
1753  linked list with textual information in the
1754  format "name: value" */
1755 };
1756 
1757 #define CURLINFO_STRING 0x100000
1758 #define CURLINFO_LONG 0x200000
1759 #define CURLINFO_DOUBLE 0x300000
1760 #define CURLINFO_SLIST 0x400000
1761 #define CURLINFO_MASK 0x0fffff
1762 #define CURLINFO_TYPEMASK 0xf00000
1763 
1764 typedef enum {
1765  CURLINFO_NONE, /* first, never use this */
1808  /* Fill in new entries below here! */
1809 
1811 } CURLINFO;
1812 
1813 /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
1814  CURLINFO_HTTP_CODE */
1815 #define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE
1816 
1817 typedef enum {
1818  CURLCLOSEPOLICY_NONE, /* first, never use this */
1819 
1825 
1826  CURLCLOSEPOLICY_LAST /* last, never use this */
1828 
1829 #define CURL_GLOBAL_SSL (1<<0)
1830 #define CURL_GLOBAL_WIN32 (1<<1)
1831 #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
1832 #define CURL_GLOBAL_NOTHING 0
1833 #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
1834 
1835 
1836 /*****************************************************************************
1837  * Setup defines, protos etc for the sharing stuff.
1838  */
1839 
1840 /* Different data locks for a single share */
1841 typedef enum {
1843  /* CURL_LOCK_DATA_SHARE is used internally to say that
1844  * the locking is just made to change the internal state of the share
1845  * itself.
1846  */
1853 } curl_lock_data;
1854 
1855 /* Different lock access types */
1856 typedef enum {
1857  CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */
1858  CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */
1859  CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */
1860  CURL_LOCK_ACCESS_LAST /* never use */
1862 
1863 typedef void (*curl_lock_function)(CURL *handle,
1865  curl_lock_access locktype,
1866  void *userptr);
1867 typedef void (*curl_unlock_function)(CURL *handle,
1869  void *userptr);
1870 
1871 typedef void CURLSH;
1872 
1873 typedef enum {
1874  CURLSHE_OK, /* all is fine */
1878  CURLSHE_NOMEM, /* out of memory */
1879  CURLSHE_LAST /* never use */
1880 } CURLSHcode;
1881 
1882 typedef enum {
1883  CURLSHOPT_NONE, /* don't use */
1884  CURLSHOPT_SHARE, /* specify a data type to share */
1885  CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */
1886  CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */
1887  CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */
1888  CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock
1889  callback functions */
1890  CURLSHOPT_LAST /* never use */
1891 } CURLSHoption;
1892 
1896 
1897 /****************************************************************************
1898  * Structures for querying information about the curl library at runtime.
1899  */
1900 
1901 typedef enum {
1906  CURLVERSION_LAST /* never actually use this */
1907 } CURLversion;
1908 
1909 /* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
1910  basically all programs ever that want to get version information. It is
1911  meant to be a built-in version number for what kind of struct the caller
1912  expects. If the struct ever changes, we redefine the NOW to another enum
1913  from above. */
1914 #define CURLVERSION_NOW CURLVERSION_FOURTH
1915 
1916 typedef struct {
1917  CURLversion age; /* age of the returned struct */
1918  const char *version; /* LIBCURL_VERSION */
1919  unsigned int version_num; /* LIBCURL_VERSION_NUM */
1920  const char *host; /* OS/host/cpu/machine when configured */
1921  int features; /* bitmask, see defines below */
1922  const char *ssl_version; /* human readable string */
1923  long ssl_version_num; /* not used anymore, always 0 */
1924  const char *libz_version; /* human readable string */
1925  /* protocols is terminated by an entry with a NULL protoname */
1926  const char * const *protocols;
1927 
1928  /* The fields below this were added in CURLVERSION_SECOND */
1929  const char *ares;
1931 
1932  /* This field was added in CURLVERSION_THIRD */
1933  const char *libidn;
1934 
1935  /* These field were added in CURLVERSION_FOURTH */
1936 
1937  /* Same as '_libiconv_version' if built with HAVE_ICONV */
1939 
1940  const char *libssh_version; /* human readable string */
1941 
1943 
1944 #define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */
1945 #define CURL_VERSION_KERBEROS4 (1<<1) /* kerberos auth is supported */
1946 #define CURL_VERSION_SSL (1<<2) /* SSL options are present */
1947 #define CURL_VERSION_LIBZ (1<<3) /* libz features are present */
1948 #define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */
1949 #define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */
1950 #define CURL_VERSION_DEBUG (1<<6) /* built with debug capabilities */
1951 #define CURL_VERSION_ASYNCHDNS (1<<7) /* asynchronous dns resolves */
1952 #define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth */
1953 #define CURL_VERSION_LARGEFILE (1<<9) /* supports files bigger than 2GB */
1954 #define CURL_VERSION_IDN (1<<10) /* International Domain Names support */
1955 #define CURL_VERSION_SSPI (1<<11) /* SSPI is supported */
1956 #define CURL_VERSION_CONV (1<<12) /* character conversions supported */
1957 #define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */
1958 #define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */
1959 
1960 /*
1961  * NAME curl_version_info()
1962  *
1963  * DESCRIPTION
1964  *
1965  * This function returns a pointer to a static copy of the version info
1966  * struct. See above.
1967  */
1969 
1970 /*
1971  * NAME curl_easy_strerror()
1972  *
1973  * DESCRIPTION
1974  *
1975  * The curl_easy_strerror function may be used to turn a CURLcode value
1976  * into the equivalent human readable error string. This is useful
1977  * for printing meaningful error messages.
1978  */
1980 
1981 /*
1982  * NAME curl_share_strerror()
1983  *
1984  * DESCRIPTION
1985  *
1986  * The curl_share_strerror function may be used to turn a CURLSHcode value
1987  * into the equivalent human readable error string. This is useful
1988  * for printing meaningful error messages.
1989  */
1991 
1992 /*
1993  * NAME curl_easy_pause()
1994  *
1995  * DESCRIPTION
1996  *
1997  * The curl_easy_pause function pauses or unpauses transfers. Select the new
1998  * state by setting the bitmask, use the convenience defines below.
1999  *
2000  */
2001 CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);
2002 
2003 #define CURLPAUSE_RECV (1<<0)
2004 #define CURLPAUSE_RECV_CONT (0)
2005 
2006 #define CURLPAUSE_SEND (1<<2)
2007 #define CURLPAUSE_SEND_CONT (0)
2008 
2009 #define CURLPAUSE_ALL (CURLPAUSE_RECV|CURLPAUSE_SEND)
2010 #define CURLPAUSE_CONT (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT)
2011 
2012 #ifdef __cplusplus
2013 }
2014 #endif
2015 
2016 /* unfortunately, the easy.h and multi.h include files need options and info
2017  stuff before they can be included! */
2018 #include "easy.h" /* nothing in curl is fun without the easy stuff */
2019 #include "multi.h"
2020 
2021 /* the typechecker doesn't work in C++ (yet) */
2022 #if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
2023  ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
2024  !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)
2025 #include "typecheck-gcc.h"
2026 #else
2027 #if defined(__STDC__) && (__STDC__ >= 1)
2028 /* This preprocessor magic that replaces a call with the exact same call is
2029  only done to make sure application authors pass exactly three arguments
2030  to these functions. */
2031 #define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
2032 #define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)
2033 #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
2034 #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
2035 #endif /* __STDC__ >= 1 */
2036 #endif /* gcc >= 4.3 && !__cplusplus */
2037 
2038 #endif /* __CURL_CURL_H */
void(* curl_lock_function)(CURL *handle, curl_lock_data data, curl_lock_access locktype, void *userptr)
Definition: curl.h:1863
const char * version
Definition: curl.h:1918
const char * libidn
Definition: curl.h:1933
const char *const * protocols
Definition: curl.h:1926
int(* curl_fnmatch_callback)(void *ptr, const char *pattern, const char *string)
Definition: curl.h:222
void *(* curl_calloc_callback)(size_t nmemb, size_t size)
Definition: curl.h:308
CURL_EXTERN curl_version_info_data * curl_version_info(CURLversion)
CURL_EXTERN void curl_free(void *p)
const char * key
Definition: curl.h:554
size_t b_used
Definition: curl.h:188
curlfiletype filetype
Definition: curl.h:166
struct curl_slist * contentheader
Definition: curl.h:78
CURL_EXTERN char * curl_unescape(const char *string, int length)
size_t len
Definition: curl.h:556
CURL_EXTERN char * curl_easy_escape(CURL *handle, const char *string, int length)
CURLformoption
Definition: curl.h:1489
curl_proxytype
Definition: curl.h:517
curl_khstat
Definition: curl.h:567
const char * host
Definition: curl.h:1920
void *(* curl_realloc_callback)(void *ptr, size_t size)
Definition: curl.h:306
#define CURLINFO_SLIST
Definition: curl.h:1760
char * contenttype
Definition: curl.h:77
CURLcode(* curl_ssl_ctx_callback)(CURL *curl, void *ssl_ctx, void *userptr)
Definition: curl.h:512
#define CURLINFO_DOUBLE
Definition: curl.h:1759
CURLcode
Definition: curl.h:336
char * filename
Definition: curl.h:165
CURL_EXTERN CURLSH * curl_share_init(void)
curl_ftpccc
Definition: curl.h:616
CURLcode(* curl_conv_callback)(char *buffer, size_t length)
Definition: curl.h:510
int(* curl_closesocket_callback)(void *clientp, curl_socket_t item)
Definition: curl.h:279
CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask)
CURL_NETRC_OPTION
Definition: curl.h:1426
CURLINFO
Definition: curl.h:1764
char * contents
Definition: curl.h:73
CURL_EXTERN int() curl_strnequal(const char *s1, const char *s2, size_t n)
CURLSHoption
Definition: curl.h:1882
curl_khmatch
Definition: curl.h:578
struct curl_slist * next
Definition: curl.h:1714
CURL_EXTERN int() curl_strequal(const char *s1, const char *s2)
char * showfilename
Definition: curl.h:96
int socktype
Definition: curl.h:265
CURL_EXTERN char * curl_getenv(const char *variable)
CURLformoption option
Definition: curl.h:1523
char * b_data
Definition: curl.h:186
CURLversion
Definition: curl.h:1901
CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *)
curl_closepolicy
Definition: curl.h:1817
curl_off_t size
Definition: curl.h:171
int(* curl_seek_callback)(void *instream, curl_off_t offset, int origin)
Definition: curl.h:231
int(* curl_debug_callback)(CURL *handle, curl_infotype type, char *data, size_t size, void *userptr)
Definition: curl.h:323
const char * libz_version
Definition: curl.h:1924
enum curl_khkey::type keytype
CURL_EXTERN void curl_formfree(struct curl_httppost *form)
CURLversion age
Definition: curl.h:1917
void * userp
Definition: curl.h:99
struct curl_httppost * next
Definition: curl.h:70
const char * libssh_version
Definition: curl.h:1940
size_t(* curl_formget_callback)(void *arg, const char *buf, size_t len)
Definition: curl.h:1578
CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost, struct curl_httppost **last_post,...)
long contentslength
Definition: curl.h:74
const char * ares
Definition: curl.h:1929
long bufferlength
Definition: curl.h:76
struct curl_slist ** certinfo
Definition: curl.h:1752
int(* curl_sockopt_callback)(void *clientp, curl_socket_t curlfd, curlsocktype purpose)
Definition: curl.h:259
CURL_EXTERN struct curl_slist * curl_slist_append(struct curl_slist *, const char *)
curl_TimeCond
Definition: curl.h:1461
CURLSHcode
Definition: curl.h:1873
CURL_EXTERN char * curl_escape(const char *string, int length)
char * data
Definition: curl.h:1713
void *(* curl_malloc_callback)(size_t size)
Definition: curl.h:304
curl_socket_t(* curl_opensocket_callback)(void *clientp, curlsocktype purpose, struct curl_sockaddr *address)
Definition: curl.h:274
CURL_TYPEOF_CURL_OFF_T curl_off_t
Definition: curlbuild.h:172
curlsocktype
Definition: curl.h:247
curlioerr(* curl_ioctl_callback)(CURL *handle, int cmd, void *clientp)
Definition: curl.h:294
CURLFORMcode
Definition: curl.h:1543
char * buffer
Definition: curl.h:75
curliocmd
Definition: curl.h:288
void CURLSH
Definition: curl.h:1871
curl_ftpcreatedir
Definition: curl.h:632
size_t(* curl_read_callback)(char *buffer, size_t size, size_t nitems, void *instream)
Definition: curl.h:242
int(* curl_sshkeycallback)(CURL *easy, const struct curl_khkey *knownkey, const struct curl_khkey *foundkey, enum curl_khmatch, void *clientp)
Definition: curl.h:586
CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option,...)
curl_lock_access
Definition: curl.h:1856
Definition: curl.h:337
long namelength
Definition: curl.h:72
curlioerr
Definition: curl.h:281
int protocol
Definition: curl.h:266
CURLoption
Definition: curl.h:711
int(* curl_progress_callback)(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
Definition: curl.h:103
int uid
Definition: curl.h:169
unsigned int version_num
Definition: curl.h:1919
unsigned int perm
Definition: curl.h:168
long(* curl_chunk_end_callback)(void *ptr)
Definition: curl.h:213
size_t(* curl_write_callback)(char *buffer, size_t size, size_t nitems, void *outstream)
Definition: curl.h:130
CURL_EXTERN CURLcode curl_global_init_mem(long flags, curl_malloc_callback m, curl_free_callback f, curl_realloc_callback r, curl_strdup_callback s, curl_calloc_callback c)
curl_usessl
Definition: curl.h:593
struct sockaddr addr
Definition: curl.h:270
const char * value
Definition: curl.h:1524
char * name
Definition: curl.h:71
CURL_EXTERN CURLcode curl_global_init(long flags)
CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused)
CURL_TLSAUTH
Definition: curl.h:1446
CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg, curl_formget_callback append)
int num_of_certs
Definition: curl.h:1751
size_t b_size
Definition: curl.h:187
void CURL
Definition: curl.h:48
time_t time
Definition: curl.h:167
curl_lock_data
Definition: curl.h:1841
curlfiletype
Definition: curl.h:138
const char * ssl_version
Definition: curl.h:1922
unsigned int addrlen
Definition: curl.h:267
#define CURLINFO_LONG
Definition: curl.h:1758
#define CINIT(na, t, nu)
Definition: curl.h:695
CURL_EXTERN const char * curl_share_strerror(CURLSHcode)
#define CURLINFO_STRING
Definition: curl.h:1757
unsigned int flags
Definition: curl.h:183
CURL_EXTERN void curl_global_cleanup(void)
curl_ftpmethod
Definition: curl.h:643
long flags
Definition: curl.h:82
char *(* curl_strdup_callback)(const char *str)
Definition: curl.h:307
curl_infotype
Definition: curl.h:311
void(* curl_free_callback)(void *ptr)
Definition: curl.h:305
long int hardlinks
Definition: curl.h:172
int curl_socket_t
Definition: curl.h:64
CURL_EXTERN char * curl_easy_unescape(CURL *handle, const char *string, int length, int *outlength)
#define CFINIT(name)
Definition: curl.h:1483
CURL_EXTERN const char * curl_easy_strerror(CURLcode)
CURL_EXTERN void curl_slist_free_all(struct curl_slist *)
#define CURL_EXTERN
Definition: curl.h:59
long(* curl_chunk_bgn_callback)(const void *transfer_info, void *ptr, int remains)
Definition: curl.h:199
int gid
Definition: curl.h:170
curl_ftpauth
Definition: curl.h:624
struct curl_httppost * more
Definition: curl.h:79
int family
Definition: curl.h:264
CURL_EXTERN char * curl_version(void)
struct curl_fileinfo::@3 strings
void(* curl_unlock_function)(CURL *handle, curl_lock_data data, void *userptr)
Definition: curl.h:1867