Home | History | Annotate | Download | only in src
      1 #ifndef HEADER_CURL_TOOL_CFGABLE_H
      2 #define HEADER_CURL_TOOL_CFGABLE_H
      3 /***************************************************************************
      4  *                                  _   _ ____  _
      5  *  Project                     ___| | | |  _ \| |
      6  *                             / __| | | | |_) | |
      7  *                            | (__| |_| |  _ <| |___
      8  *                             \___|\___/|_| \_\_____|
      9  *
     10  * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel (at) 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 https://curl.haxx.se/docs/copyright.html.
     15  *
     16  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
     17  * copies of the Software, and permit persons to whom the Software is
     18  * furnished to do so, under the terms of the COPYING file.
     19  *
     20  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
     21  * KIND, either express or implied.
     22  *
     23  ***************************************************************************/
     24 #include "tool_setup.h"
     25 
     26 #include "tool_sdecls.h"
     27 
     28 #include "tool_metalink.h"
     29 
     30 struct GlobalConfig;
     31 
     32 struct OperationConfig {
     33   CURL *easy;               /* A copy of the handle from GlobalConfig */
     34   bool remote_time;
     35   char *random_file;
     36   char *egd_file;
     37   char *useragent;
     38   char *cookie;             /* single line with specified cookies */
     39   char *cookiejar;          /* write to this file */
     40   char *cookiefile;         /* read from this file */
     41   bool cookiesession;       /* new session? */
     42   bool encoding;            /* Accept-Encoding please */
     43   bool tr_encoding;         /* Transfer-Encoding please */
     44   unsigned long authtype;   /* auth bitmask */
     45   bool use_resume;
     46   bool resume_from_current;
     47   bool disable_epsv;
     48   bool disable_eprt;
     49   bool ftp_pret;
     50   long proto;
     51   bool proto_present;
     52   long proto_redir;
     53   bool proto_redir_present;
     54   char *proto_default;
     55   curl_off_t resume_from;
     56   char *postfields;
     57   curl_off_t postfieldsize;
     58   char *referer;
     59   double timeout;
     60   double connecttimeout;
     61   long maxredirs;
     62   curl_off_t max_filesize;
     63   char *headerfile;
     64   char *ftpport;
     65   char *iface;
     66   int localport;
     67   int localportrange;
     68   unsigned short porttouse;
     69   char *range;
     70   long low_speed_limit;
     71   long low_speed_time;
     72   char *dns_servers;   /* dot notation: 1.1.1.1;2.2.2.2 */
     73   char *dns_interface; /* interface name */
     74   char *dns_ipv4_addr; /* dot notation */
     75   char *dns_ipv6_addr; /* dot notation */
     76   char *userpwd;
     77   char *login_options;
     78   char *tls_username;
     79   char *tls_password;
     80   char *tls_authtype;
     81   char *proxy_tls_username;
     82   char *proxy_tls_password;
     83   char *proxy_tls_authtype;
     84   char *proxyuserpwd;
     85   char *proxy;
     86   int proxyver;             /* set to CURLPROXY_HTTP* define */
     87   char *noproxy;
     88   char *mail_from;
     89   struct curl_slist *mail_rcpt;
     90   char *mail_auth;
     91   bool sasl_ir;             /* Enable/disable SASL initial response */
     92   bool proxytunnel;
     93   bool ftp_append;          /* APPE on ftp */
     94   bool use_ascii;           /* select ascii or text transfer */
     95   bool autoreferer;         /* automatically set referer */
     96   bool failonerror;         /* fail on (HTTP) errors */
     97   bool include_headers;     /* send headers to data output */
     98   bool no_body;             /* don't get the body */
     99   bool dirlistonly;         /* only get the FTP dir list */
    100   bool followlocation;      /* follow http redirects */
    101   bool unrestricted_auth;   /* Continue to send authentication (user+password)
    102                                when following ocations, even when hostname
    103                                changed */
    104   bool netrc_opt;
    105   bool netrc;
    106   char *netrc_file;
    107   struct getout *url_list;  /* point to the first node */
    108   struct getout *url_last;  /* point to the last/current node */
    109   struct getout *url_get;   /* point to the node to fill in URL */
    110   struct getout *url_out;   /* point to the node to fill in outfile */
    111   char *cipher_list;
    112   char *proxy_cipher_list;
    113   char *cert;
    114   char *proxy_cert;
    115   char *cert_type;
    116   char *proxy_cert_type;
    117   char *cacert;
    118   char *proxy_cacert;
    119   char *capath;
    120   char *proxy_capath;
    121   char *crlfile;
    122   char *proxy_crlfile;
    123   char *pinnedpubkey;
    124   char *key;
    125   char *proxy_key;
    126   char *key_type;
    127   char *proxy_key_type;
    128   char *key_passwd;
    129   char *proxy_key_passwd;
    130   char *pubkey;
    131   char *hostpubmd5;
    132   char *engine;
    133   bool crlf;
    134   char *customrequest;
    135   char *krblevel;
    136   long httpversion;
    137   bool nobuffer;
    138   bool readbusy;            /* set when reading input returns EAGAIN */
    139   bool globoff;
    140   bool use_httpget;
    141   bool insecure_ok;         /* set TRUE to allow insecure SSL connects */
    142   bool proxy_insecure_ok;   /* set TRUE to allow insecure SSL connects
    143                                for proxy */
    144   bool verifystatus;
    145   bool create_dirs;
    146   bool ftp_create_dirs;
    147   bool ftp_skip_ip;
    148   bool proxynegotiate;
    149   bool proxyntlm;
    150   bool proxydigest;
    151   bool proxybasic;
    152   bool proxyanyauth;
    153   char *writeout;           /* %-styled format string to output */
    154   bool writeenv;            /* write results to environment, if available */
    155   struct curl_slist *quote;
    156   struct curl_slist *postquote;
    157   struct curl_slist *prequote;
    158   long ssl_version;
    159   long proxy_ssl_version;
    160   long ip_version;
    161   curl_TimeCond timecond;
    162   time_t condtime;
    163   struct curl_slist *headers;
    164   struct curl_slist *proxyheaders;
    165   struct curl_httppost *httppost;
    166   struct curl_httppost *last_post;
    167   struct curl_slist *telnet_options;
    168   struct curl_slist *resolve;
    169   struct curl_slist *connect_to;
    170   HttpReq httpreq;
    171 
    172   /* for bandwidth limiting features: */
    173   curl_off_t sendpersecond; /* send to peer */
    174   curl_off_t recvpersecond; /* receive from peer */
    175 
    176   bool ftp_ssl;
    177   bool ftp_ssl_reqd;
    178   bool ftp_ssl_control;
    179   bool ftp_ssl_ccc;
    180   int ftp_ssl_ccc_mode;
    181 
    182   char *socksproxy;         /* set to server string */
    183   int socksver;             /* set to CURLPROXY_SOCKS* define */
    184   int socks5_gssapi_nec;    /* The NEC reference server does not protect the
    185                                encryption type exchange */
    186   char *proxy_service_name; /* set authentication service name for HTTP and
    187                                SOCKS5 proxies */
    188   char *service_name;       /* set authentication service name for DIGEST-MD5,
    189                                Kerberos 5 and SPNEGO */
    190 
    191   bool tcp_nodelay;
    192   bool tcp_fastopen;
    193   long req_retry;           /* number of retries */
    194   bool retry_connrefused;   /* set connection refused as a transient error */
    195   long retry_delay;         /* delay between retries (in seconds) */
    196   long retry_maxtime;       /* maximum time to keep retrying */
    197 
    198   char *ftp_account;        /* for ACCT */
    199   char *ftp_alternative_to_user;  /* send command if USER/PASS fails */
    200   int ftp_filemethod;
    201   long tftp_blksize;        /* TFTP BLKSIZE option */
    202   bool tftp_no_options;     /* do not send TFTP options requests */
    203   bool ignorecl;            /* --ignore-content-length */
    204   bool disable_sessionid;
    205 
    206   bool raw;
    207   bool post301;
    208   bool post302;
    209   bool post303;
    210   bool nokeepalive;         /* for keepalive needs */
    211   long alivetime;
    212   bool content_disposition; /* use Content-disposition filename */
    213 
    214   int default_node_flags;   /* default flags to search for each 'node', which
    215                                is basically each given URL to transfer */
    216 
    217   bool xattr;               /* store metadata in extended attributes */
    218   long gssapi_delegation;
    219   bool ssl_allow_beast;     /* allow this SSL vulnerability */
    220   bool proxy_ssl_allow_beast; /* allow this SSL vulnerability for proxy*/
    221 
    222   bool ssl_no_revoke;       /* disable SSL certificate revocation checks */
    223   /*bool proxy_ssl_no_revoke; */
    224 
    225   bool use_metalink;        /* process given URLs as metalink XML file */
    226   metalinkfile *metalinkfile_list; /* point to the first node */
    227   metalinkfile *metalinkfile_last; /* point to the last/current node */
    228 #ifdef CURLDEBUG
    229   bool test_event_based;
    230 #endif
    231   char *oauth_bearer;             /* OAuth 2.0 bearer token */
    232   bool nonpn;                     /* enable/disable TLS NPN extension */
    233   bool noalpn;                    /* enable/disable TLS ALPN extension */
    234   char *unix_socket_path;         /* path to Unix domain socket */
    235   bool falsestart;
    236   bool path_as_is;
    237   double expect100timeout;
    238   struct GlobalConfig *global;
    239   struct OperationConfig *prev;
    240   struct OperationConfig *next;   /* Always last in the struct */
    241 };
    242 
    243 struct GlobalConfig {
    244   CURL *easy;                     /* Once we have one, we keep it here */
    245   int showerror;                  /* -1 == unset, default => show errors
    246                                       0 => -s is used to NOT show errors
    247                                       1 => -S has been used to show errors */
    248   bool mute;                      /* don't show messages, --silent given */
    249   bool noprogress;                /* don't show progress bar --silent given */
    250   bool isatty;                    /* Updated internally if output is a tty */
    251   FILE *errors;                   /* Error stream, defaults to stderr */
    252   bool errors_fopened;            /* Whether error stream isn't stderr */
    253   char *trace_dump;               /* file to dump the network trace to */
    254   FILE *trace_stream;
    255   bool trace_fopened;
    256   trace tracetype;
    257   bool tracetime;                 /* include timestamp? */
    258   int progressmode;               /* CURL_PROGRESS_BAR / CURL_PROGRESS_STATS */
    259   char *libcurl;                  /* Output libcurl code to this file name */
    260   bool fail_early;                /* exit on first transfer error */
    261   struct OperationConfig *first;
    262   struct OperationConfig *current;
    263   struct OperationConfig *last;   /* Always last in the struct */
    264 };
    265 
    266 void config_init(struct OperationConfig *config);
    267 void config_free(struct OperationConfig *config);
    268 
    269 #endif /* HEADER_CURL_TOOL_CFGABLE_H */
    270