~ubuntu-branches/ubuntu/vivid/curl/vivid

« back to all changes in this revision

Viewing changes to include/curl/curl.h

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Schuldei
  • Date: 2009-04-02 23:35:45 UTC
  • mto: (1.2.1 upstream) (3.2.3 sid)
  • mto: This revision was merged to the branch mainline in revision 38.
  • Revision ID: james.westby@ubuntu.com-20090402233545-geixkwhe3izccjt7
Tags: upstream-7.19.4
ImportĀ upstreamĀ versionĀ 7.19.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 *                            | (__| |_| |  _ <| |___
8
8
 *                             \___|\___/|_| \_\_____|
9
9
 *
10
 
 * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
 
10
 * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
11
11
 *
12
12
 * This software is licensed as described in the file COPYING, which
13
13
 * you should have received as part of this distribution. The terms
20
20
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21
21
 * KIND, either express or implied.
22
22
 *
23
 
 * $Id: curl.h,v 1.352 2008-06-03 18:00:48 danf Exp $
 
23
 * $Id: curl.h,v 1.379 2009-03-02 23:05:31 bagder Exp $
24
24
 ***************************************************************************/
25
25
 
26
 
/* If you have problems, all libcurl docs and details are found here:
27
 
   http://curl.haxx.se/libcurl/
28
 
*/
 
26
/*
 
27
 * If you have libcurl problems, all docs and details are found here:
 
28
 *   http://curl.haxx.se/libcurl/
 
29
 *
 
30
 * curl-library mailing list subscription and unsubscription web interface:
 
31
 *   http://cool.haxx.se/mailman/listinfo/curl-library/
 
32
 */
29
33
 
30
 
#include "curlver.h" /* the libcurl version defines */
 
34
#include "curlver.h"         /* libcurl version defines   */
 
35
#include "curl/curlbuild.h"  /* libcurl build definitions */
 
36
#include "curlrules.h"       /* libcurl rules enforcement */
31
37
 
32
38
/*
33
39
 * Define WIN32 when build target is Win32 API
64
70
   libc5-based Linux systems. Only include it on system that are known to
65
71
   require it! */
66
72
#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
67
 
    defined(__minix) || defined(__SYMBIAN32__)
 
73
    defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY)
68
74
#include <sys/select.h>
69
75
#endif
70
76
 
71
77
#ifndef _WIN32_WCE
72
78
#include <sys/socket.h>
73
79
#endif
74
 
#ifndef __WATCOMC__
 
80
#if !defined(WIN32) && !defined(__WATCOMC__)
75
81
#include <sys/time.h>
76
82
#endif
77
83
#include <sys/types.h>
113
119
#endif
114
120
#endif
115
121
 
116
 
/*
117
 
 * We want the typedef curl_off_t setup for large file support on all
118
 
 * platforms. We also provide a CURL_FORMAT_OFF_T define to use in *printf
119
 
 * format strings when outputting a variable of type curl_off_t.
120
 
 *
121
 
 * Note: "pocc -Ze" is MSVC compatibility mode and this sets _MSC_VER!
122
 
 */
123
 
 
124
 
#if (defined(_MSC_VER) && !defined(__POCC__)) || (defined(__LCC__) && \
125
 
     defined(WIN32))
126
 
/* MSVC */
127
 
#ifdef _WIN32_WCE
128
 
  typedef long curl_off_t;
129
 
#define CURL_FORMAT_OFF_T "%ld"
130
 
#else
131
 
  typedef signed __int64 curl_off_t;
132
 
#define CURL_FORMAT_OFF_T "%I64d"
133
 
#endif
134
 
#else /* (_MSC_VER && !__POCC__) || (__LCC__ && WIN32) */
135
 
#if (defined(__GNUC__) && defined(WIN32)) || defined(__WATCOMC__)
136
 
/* gcc on windows or Watcom */
137
 
  typedef long long curl_off_t;
138
 
#define CURL_FORMAT_OFF_T "%I64d"
139
 
#else /* GCC or Watcom on Windows  */
140
 
#if defined(__ILEC400__)
141
 
/* OS400 C compiler. */
142
 
  typedef long long curl_off_t;
143
 
#define CURL_FORMAT_OFF_T "%lld"
144
 
#else /* OS400 C compiler. */
145
 
 
146
 
/* "normal" POSIX approach, do note that this does not necessarily mean that
147
 
   the type is >32 bits, see the SIZEOF_CURL_OFF_T define for that! */
148
 
  typedef off_t curl_off_t;
149
 
 
150
 
/* Check a range of defines to detect large file support. On Linux it seems
151
 
   none of these are set by default, so if you don't explicitly switches on
152
 
   large file support, this define will be made for "small file" support. */
153
 
#ifndef _FILE_OFFSET_BITS
154
 
#define _FILE_OFFSET_BITS 0 /* to prevent warnings in the check below */
155
 
#define UNDEF_FILE_OFFSET_BITS
156
 
#endif
157
 
#ifndef FILESIZEBITS
158
 
#define FILESIZEBITS 0 /* to prevent warnings in the check below */
159
 
#define UNDEF_FILESIZEBITS
160
 
#endif
161
 
 
162
 
#if defined(_LARGE_FILES) || (_FILE_OFFSET_BITS > 32) || (FILESIZEBITS > 32) \
163
 
   || defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE)
164
 
  /* For now, we assume at least one of these to be set for large files to
165
 
     work! */
166
 
#define CURL_FORMAT_OFF_T "%lld"
167
 
#else /* LARGE_FILE support */
168
 
#define CURL_FORMAT_OFF_T "%ld"
169
 
#endif
170
 
#endif /* OS400 C compiler. */
171
 
#endif /* GCC or Watcom on Windows */
172
 
#endif /* (_MSC_VER && !__POCC__) || (__LCC__ && WIN32) */
173
 
 
174
 
#ifdef UNDEF_FILE_OFFSET_BITS
175
 
/* this was defined above for our checks, undefine it again */
176
 
#undef _FILE_OFFSET_BITS
177
 
#endif
178
 
 
179
 
#ifdef UNDEF_FILESIZEBITS
180
 
/* this was defined above for our checks, undefine it again */
181
 
#undef FILESIZEBITS
182
 
#endif
183
 
 
184
122
#ifndef curl_socket_typedef
185
123
/* socket typedef */
186
124
#ifdef WIN32
452
390
  CURLE_SSL_SHUTDOWN_FAILED,     /* 80 - Failed to shut down the SSL
453
391
                                    connection */
454
392
  CURLE_AGAIN,                   /* 81 - socket is not ready for send/recv,
455
 
                                    wait till it's ready and try again */
 
393
                                    wait till it's ready and try again (Added
 
394
                                    in 7.18.2) */
 
395
  CURLE_SSL_CRL_BADFILE,         /* 82 - could not load CRL file, missing or
 
396
                                    wrong format (Added in 7.19.0) */
 
397
  CURLE_SSL_ISSUER_ERROR,        /* 83 - Issuer check failed.  (Added in
 
398
                                    7.19.0) */
456
399
  CURL_LAST /* never use! */
457
400
} CURLcode;
458
401
 
516
459
                                          void *userptr);
517
460
 
518
461
typedef enum {
519
 
  CURLPROXY_HTTP = 0,   /* added in 7.10 */
 
462
  CURLPROXY_HTTP = 0,   /* added in 7.10, new in 7.19.4 default is to use
 
463
                           CONNECT HTTP/1.1 */
 
464
  CURLPROXY_HTTP_1_0 = 1,   /* added in 7.19.4, force to use CONNECT
 
465
                               HTTP/1.0  */
520
466
  CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already
521
467
                           in 7.10 */
522
468
  CURLPROXY_SOCKS5 = 5, /* added in 7.10 */
531
477
#define CURLAUTH_DIGEST       (1<<1)  /* Digest */
532
478
#define CURLAUTH_GSSNEGOTIATE (1<<2)  /* GSS-Negotiate */
533
479
#define CURLAUTH_NTLM         (1<<3)  /* NTLM */
534
 
#define CURLAUTH_ANY ~0               /* all types set */
535
 
#define CURLAUTH_ANYSAFE (~CURLAUTH_BASIC)
 
480
#define CURLAUTH_DIGEST_IE    (1<<4)  /* Digest with IE flavour */
 
481
#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE)  /* all fine types set */
 
482
#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
536
483
 
537
484
#define CURLSSH_AUTH_ANY       ~0     /* all types supported by the server */
538
485
#define CURLSSH_AUTH_NONE      0      /* none allowed, silly but complete */
583
530
  CURLFTPAUTH_LAST /* not an option, never use */
584
531
} curl_ftpauth;
585
532
 
 
533
/* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */
 
534
typedef enum {
 
535
  CURLFTP_CREATE_DIR_NONE,  /* do NOT create missing dirs! */
 
536
  CURLFTP_CREATE_DIR,       /* (FTP/SFTP) if CWD fails, try MKD and then CWD
 
537
                               again if MKD succeeded, for SFTP this does
 
538
                               similar magic */
 
539
  CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD
 
540
                               again even if MKD failed! */
 
541
  CURLFTP_CREATE_DIR_LAST   /* not an option, never use */
 
542
} curl_ftpcreatedir;
 
543
 
586
544
/* parameter for the CURLOPT_FTP_FILEMETHOD option */
587
545
typedef enum {
588
546
  CURLFTPMETHOD_DEFAULT,   /* let libcurl pick */
592
550
  CURLFTPMETHOD_LAST       /* not an option, never use */
593
551
} curl_ftpmethod;
594
552
 
 
553
/* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */
 
554
#define CURLPROTO_HTTP   (1<<0)
 
555
#define CURLPROTO_HTTPS  (1<<1)
 
556
#define CURLPROTO_FTP    (1<<2)
 
557
#define CURLPROTO_FTPS   (1<<3)
 
558
#define CURLPROTO_SCP    (1<<4)
 
559
#define CURLPROTO_SFTP   (1<<5)
 
560
#define CURLPROTO_TELNET (1<<6)
 
561
#define CURLPROTO_LDAP   (1<<7)
 
562
#define CURLPROTO_LDAPS  (1<<8)
 
563
#define CURLPROTO_DICT   (1<<9)
 
564
#define CURLPROTO_FILE   (1<<10)
 
565
#define CURLPROTO_TFTP   (1<<11)
 
566
#define CURLPROTO_ALL    (~0) /* enable everything */
 
567
 
595
568
/* long may be 32 or 64 bits, but we should never depend on anything else
596
569
   but 32 */
597
570
#define CURLOPTTYPE_LONG          0
605
578
#ifdef CINIT
606
579
#undef CINIT
607
580
#endif
608
 
/*
609
 
 * Figure out if we can use the ## operator, which is supported by ISO/ANSI C
610
 
 * and C++. Some compilers support it without setting __STDC__ or __cplusplus
611
 
 * so we need to carefully check for them too. We don't use configure-checks
612
 
 * for these since we want these headers to remain generic and working for all
613
 
 * platforms.
614
 
 */
615
 
#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
616
 
  defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
617
 
  defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
618
 
  defined(__ILEC400__)
619
 
  /* This compiler is believed to have an ISO compatible preprocessor */
620
 
#define CURL_ISOCPP
621
 
#else
622
 
  /* This compiler is believed NOT to have an ISO compatible preprocessor */
623
 
#undef CURL_ISOCPP
624
 
#endif
625
581
 
626
582
#ifdef CURL_ISOCPP
627
583
#define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
732
688
  /* This points to a linked list of headers, struct curl_slist kind */
733
689
  CINIT(HTTPHEADER, OBJECTPOINT, 23),
734
690
 
735
 
  /* This points to a linked list of post entries, struct HttpPost */
 
691
  /* This points to a linked list of post entries, struct curl_httppost */
736
692
  CINIT(HTTPPOST, OBJECTPOINT, 24),
737
693
 
738
694
  /* name of the file keeping your private SSL-certificate */
941
897
  /* DNS cache timeout */
942
898
  CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
943
899
 
944
 
  /* send linked-list of pre-transfer QUOTE commands (Wesley Laxton)*/
 
900
  /* send linked-list of pre-transfer QUOTE commands */
945
901
  CINIT(PREQUOTE, OBJECTPOINT, 93),
946
902
 
947
903
  /* set the debug function */
1006
962
     argument */
1007
963
  CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),
1008
964
 
1009
 
  /* FTP Option that causes missing dirs to be created on the remote server */
 
965
  /* FTP Option that causes missing dirs to be created on the remote server.
 
966
     In 7.19.4 we introduced the convenience enums for this option using the
 
967
     CURLFTP_CREATE_DIR prefix.
 
968
  */
1010
969
  CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),
1011
970
 
1012
971
  /* Set this to a bitmask value to enable the particular authentications
1177
1136
  CINIT(NEW_FILE_PERMS, LONG, 159),
1178
1137
  CINIT(NEW_DIRECTORY_PERMS, LONG, 160),
1179
1138
 
1180
 
  /* Obey RFC 2616/10.3.2 and keep POSTs as POSTs after a 301 */
1181
 
  CINIT(POST301, LONG, 161),
 
1139
  /* Set the behaviour of POST when redirecting. Values must be set to one
 
1140
     of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */
 
1141
  CINIT(POSTREDIR, LONG, 161),
1182
1142
 
1183
1143
  /* used by scp/sftp to verify the host's public key */
1184
1144
  CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162),
1200
1160
  CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),
1201
1161
  CINIT(SEEKDATA, OBJECTPOINT, 168),
1202
1162
 
 
1163
  /* CRL file */
 
1164
  CINIT(CRLFILE, OBJECTPOINT, 169),
 
1165
 
 
1166
  /* Issuer certificate */
 
1167
  CINIT(ISSUERCERT, OBJECTPOINT, 170),
 
1168
 
 
1169
  /* (IPv6) Address scope */
 
1170
  CINIT(ADDRESS_SCOPE, LONG, 171),
 
1171
 
 
1172
  /* Collect certificate chain info and allow it to get retrievable with
 
1173
     CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only
 
1174
     working with OpenSSL-powered builds. */
 
1175
  CINIT(CERTINFO, LONG, 172),
 
1176
 
 
1177
  /* "name" and "pwd" to use when fetching. */
 
1178
  CINIT(USERNAME, OBJECTPOINT, 173),
 
1179
  CINIT(PASSWORD, OBJECTPOINT, 174),
 
1180
 
 
1181
    /* "name" and "pwd" to use with Proxy when fetching. */
 
1182
  CINIT(PROXYUSERNAME, OBJECTPOINT, 175),
 
1183
  CINIT(PROXYPASSWORD, OBJECTPOINT, 176),
 
1184
 
 
1185
  /* Comma separated list of hostnames defining no-proxy zones. These should
 
1186
     match both hostnames directly, and hostnames within a domain. For
 
1187
     example, local.com will match local.com and www.local.com, but NOT
 
1188
     notlocal.com or www.notlocal.com. For compatibility with other
 
1189
     implementations of this, .local.com will be considered to be the same as
 
1190
     local.com. A single * is the only valid wildcard, and effectively
 
1191
     disables the use of proxy. */
 
1192
  CINIT(NOPROXY, OBJECTPOINT, 177),
 
1193
 
 
1194
  /* block size for TFTP transfers */
 
1195
  CINIT(TFTP_BLKSIZE, LONG, 178),
 
1196
 
 
1197
  /* Socks Service */
 
1198
  CINIT(SOCKS5_GSSAPI_SERVICE, LONG, 179),
 
1199
 
 
1200
  /* Socks Service */
 
1201
  CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),
 
1202
 
 
1203
  /* set the bitmask for the protocols that are allowed to be used for the
 
1204
     transfer, which thus helps the app which takes URLs from users or other
 
1205
     external inputs and want to restrict what protocol(s) to deal
 
1206
     with. Defaults to CURLPROTO_ALL. */
 
1207
  CINIT(PROTOCOLS, LONG, 181),
 
1208
 
 
1209
  /* set the bitmask for the protocols that libcurl is allowed to follow to,
 
1210
     as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs
 
1211
     to be set in both bitmasks to be allowed to get redirected to. Defaults
 
1212
     to all protocols except FILE and SCP. */
 
1213
  CINIT(REDIR_PROTOCOLS, LONG, 182),
 
1214
 
1203
1215
  CURLOPT_LASTENTRY /* the last unused */
1204
1216
} CURLoption;
1205
1217
 
1207
1219
                          the obsolete stuff removed! */
1208
1220
 
1209
1221
/* Backwards compatibility with older names */
 
1222
/* These are scheduled to disappear by 2011 */
 
1223
 
 
1224
/* This was added in version 7.19.1 */
 
1225
#define CURLOPT_POST301 CURLOPT_POSTREDIR
 
1226
 
1210
1227
/* These are scheduled to disappear by 2009 */
1211
1228
 
1212
1229
/* The following were added in 7.17.0 */
1271
1288
  CURL_SSLVERSION_LAST /* never use, keep last */
1272
1289
};
1273
1290
 
 
1291
/* symbols to use with CURLOPT_POSTREDIR.
 
1292
   CURL_REDIR_POST_301 and CURL_REDIR_POST_302 can be bitwise ORed so that
 
1293
   CURL_REDIR_POST_301 | CURL_REDIR_POST_302 == CURL_REDIR_POST_ALL */
 
1294
 
 
1295
#define CURL_REDIR_GET_ALL  0
 
1296
#define CURL_REDIR_POST_301 1
 
1297
#define CURL_REDIR_POST_302 2
 
1298
#define CURL_REDIR_POST_ALL (CURL_REDIR_POST_301|CURL_REDIR_POST_302)
1274
1299
 
1275
1300
typedef enum {
1276
1301
  CURL_TIMECOND_NONE,
1349
1374
 * CURL_FORMADD_MEMORY         if the allocation of a FormInfo struct failed
1350
1375
 * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
1351
1376
 * CURL_FORMADD_INCOMPLETE     if the some FormInfo is not complete (or error)
1352
 
 * CURL_FORMADD_MEMORY         if a HttpPost struct cannot be allocated
 
1377
 * CURL_FORMADD_MEMORY         if a curl_httppost struct cannot be allocated
1353
1378
 * CURL_FORMADD_MEMORY         if some allocation for string copying failed.
1354
1379
 * CURL_FORMADD_ILLEGAL_ARRAY  if an illegal option is used in an array
1355
1380
 *
1556
1581
 */
1557
1582
CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);
1558
1583
 
 
1584
/* info about the certificate chain, only for OpenSSL builds. Asked
 
1585
   for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */
 
1586
struct curl_certinfo {
 
1587
  int num_of_certs;             /* number of certificates with information */
 
1588
  struct curl_slist **certinfo; /* for each index in this array, there's a
 
1589
                                   linked list with textual information in the
 
1590
                                   format "name: value" */
 
1591
};
 
1592
 
1559
1593
#define CURLINFO_STRING   0x100000
1560
1594
#define CURLINFO_LONG     0x200000
1561
1595
#define CURLINFO_DOUBLE   0x300000
1596
1630
  CURLINFO_LASTSOCKET       = CURLINFO_LONG   + 29,
1597
1631
  CURLINFO_FTP_ENTRY_PATH   = CURLINFO_STRING + 30,
1598
1632
  CURLINFO_REDIRECT_URL     = CURLINFO_STRING + 31,
 
1633
  CURLINFO_PRIMARY_IP       = CURLINFO_STRING + 32,
 
1634
  CURLINFO_APPCONNECT_TIME  = CURLINFO_DOUBLE + 33,
 
1635
  CURLINFO_CERTINFO         = CURLINFO_SLIST  + 34,
 
1636
  CURLINFO_CONDITION_UNMET  = CURLINFO_LONG   + 35,
1599
1637
  /* Fill in new entries below here! */
1600
1638
 
1601
 
  CURLINFO_LASTONE          = 31
 
1639
  CURLINFO_LASTONE          = 35
1602
1640
} CURLINFO;
1603
1641
 
1604
1642
/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
1809
1847
#include "multi.h"
1810
1848
 
1811
1849
/* the typechecker doesn't work in C++ (yet) */
1812
 
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
 
1850
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
 
1851
    ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
1813
1852
    !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)
1814
1853
#include "typecheck-gcc.h"
1815
1854
#else