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 - 2015, 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 #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   curl_off_t resume_from;
55   char *postfields;
56   curl_off_t postfieldsize;
57   char *referer;
58   double timeout;
59   double connecttimeout;
60   long maxredirs;
61   curl_off_t max_filesize;
62   char *headerfile;
63   char *ftpport;
64   char *iface;
65   int localport;
66   int localportrange;
67   unsigned short porttouse;
68   char *range;
69   long low_speed_limit;
70   long low_speed_time;
71   char *dns_servers;   /* dot notation: 1.1.1.1;2.2.2.2 */
72   char *dns_interface; /* interface name */
73   char *dns_ipv4_addr; /* dot notation */
74   char *dns_ipv6_addr; /* dot notation */
75   char *userpwd;
76   char *login_options;
77   char *tls_username;
78   char *tls_password;
79   char *tls_authtype;
80   char *proxyuserpwd;
81   char *proxy;
82   int proxyver;             /* set to CURLPROXY_HTTP* define */
83   char *noproxy;
84   char *mail_from;
85   struct curl_slist *mail_rcpt;
86   char *mail_auth;
87   bool sasl_ir;             /* Enable/disable SASL initial response */
88   bool proxytunnel;
89   bool ftp_append;          /* APPE on ftp */
90   bool use_ascii;           /* select ascii or text transfer */
91   bool autoreferer;         /* automatically set referer */
92   bool failonerror;         /* fail on (HTTP) errors */
93   bool include_headers;     /* send headers to data output */
94   bool no_body;             /* don't get the body */
95   bool dirlistonly;         /* only get the FTP dir list */
96   bool followlocation;      /* follow http redirects */
97   bool unrestricted_auth;   /* Continue to send authentication (user+password)
98                                when following ocations, even when hostname
99                                changed */
100   bool netrc_opt;
101   bool netrc;
102   char *netrc_file;
103   struct getout *url_list;  /* point to the first node */
104   struct getout *url_last;  /* point to the last/current node */
105   struct getout *url_get;   /* point to the node to fill in URL */
106   struct getout *url_out;   /* point to the node to fill in outfile */
107   char *cipher_list;
108   char *cert;
109   char *cert_type;
110   char *cacert;
111   char *capath;
112   char *crlfile;
113   char *pinnedpubkey;
114   char *key;
115   char *key_type;
116   char *key_passwd;
117   char *pubkey;
118   char *hostpubmd5;
119   char *engine;
120   bool crlf;
121   char *customrequest;
122   char *krblevel;
123   long httpversion;
124   bool nobuffer;
125   bool readbusy;            /* set when reading input returns EAGAIN */
126   bool globoff;
127   bool use_httpget;
128   bool insecure_ok;         /* set TRUE to allow insecure SSL connects */
129   bool verifystatus;
130   bool create_dirs;
131   bool ftp_create_dirs;
132   bool ftp_skip_ip;
133   bool proxynegotiate;
134   bool proxyntlm;
135   bool proxydigest;
136   bool proxybasic;
137   bool proxyanyauth;
138   char *writeout;           /* %-styled format string to output */
139   bool writeenv;            /* write results to environment, if available */
140   struct curl_slist *quote;
141   struct curl_slist *postquote;
142   struct curl_slist *prequote;
143   long ssl_version;
144   long ip_version;
145   curl_TimeCond timecond;
146   time_t condtime;
147   struct curl_slist *headers;
148   struct curl_slist *proxyheaders;
149   struct curl_httppost *httppost;
150   struct curl_httppost *last_post;
151   struct curl_slist *telnet_options;
152   struct curl_slist *resolve;
153   HttpReq httpreq;
154 
155   /* for bandwidth limiting features: */
156   curl_off_t sendpersecond; /* send to peer */
157   curl_off_t recvpersecond; /* receive from peer */
158 
159   bool ftp_ssl;
160   bool ftp_ssl_reqd;
161   bool ftp_ssl_control;
162   bool ftp_ssl_ccc;
163   int ftp_ssl_ccc_mode;
164 
165   char *socksproxy;         /* set to server string */
166   int socksver;             /* set to CURLPROXY_SOCKS* define */
167   char *socks5_gssapi_service;  /* set service name for gssapi principal
168                                  * default rcmd */
169   char *proxy_service_name; /* set service name for proxy negotiation
170                              * default HTTP */
171   int socks5_gssapi_nec ;   /* The NEC reference server does not protect
172                              * the encryption type exchange */
173   char *service_name;       /* set negotiation service name
174                              * default HTTP */
175 
176   bool tcp_nodelay;
177   long req_retry;           /* number of retries */
178   long retry_delay;         /* delay between retries (in seconds) */
179   long retry_maxtime;       /* maximum time to keep retrying */
180 
181   char *ftp_account;        /* for ACCT */
182   char *ftp_alternative_to_user;  /* send command if USER/PASS fails */
183   int ftp_filemethod;
184   long tftp_blksize;        /* TFTP BLKSIZE option */
185   bool ignorecl;            /* --ignore-content-length */
186   bool disable_sessionid;
187 
188   bool raw;
189   bool post301;
190   bool post302;
191   bool post303;
192   bool nokeepalive;         /* for keepalive needs */
193   long alivetime;
194   bool content_disposition; /* use Content-disposition filename */
195 
196   int default_node_flags;   /* default flags to search for each 'node', which
197                                is basically each given URL to transfer */
198 
199   bool xattr;               /* store metadata in extended attributes */
200   long gssapi_delegation;
201   bool ssl_allow_beast;     /* allow this SSL vulnerability */
202 
203   bool use_metalink;        /* process given URLs as metalink XML file */
204   metalinkfile *metalinkfile_list; /* point to the first node */
205   metalinkfile *metalinkfile_last; /* point to the last/current node */
206 #ifdef CURLDEBUG
207   bool test_event_based;
208 #endif
209   char *xoauth2_bearer;           /* XOAUTH2 bearer token */
210   bool nonpn;                     /* enable/disable TLS NPN extension */
211   bool noalpn;                    /* enable/disable TLS ALPN extension */
212   char *unix_socket_path;         /* path to Unix domain socket */
213   bool falsestart;
214   bool path_as_is;
215   struct GlobalConfig *global;
216   struct OperationConfig *prev;
217   struct OperationConfig *next;   /* Always last in the struct */
218 };
219 
220 struct GlobalConfig {
221   CURL *easy;                     /* Once we have one, we keep it here */
222   int showerror;                  /* -1 == unset, default => show errors
223                                       0 => -s is used to NOT show errors
224                                       1 => -S has been used to show errors */
225   bool mute;                      /* don't show messages, --silent given */
226   bool noprogress;                /* don't show progress bar --silent given */
227   bool isatty;                    /* Updated internally if output is a tty */
228   FILE *errors;                   /* Error stream, defaults to stderr */
229   bool errors_fopened;            /* Whether error stream isn't stderr */
230   char *trace_dump;               /* file to dump the network trace to */
231   FILE *trace_stream;
232   bool trace_fopened;
233   trace tracetype;
234   bool tracetime;                 /* include timestamp? */
235   int progressmode;               /* CURL_PROGRESS_BAR / CURL_PROGRESS_STATS */
236   char *libcurl;                  /* Output libcurl code to this file name */
237 
238   struct OperationConfig *first;
239   struct OperationConfig *current;
240   struct OperationConfig *last;   /* Always last in the struct */
241 };
242 
243 void config_init(struct OperationConfig *config);
244 void config_free(struct OperationConfig *config);
245 
246 #endif /* HEADER_CURL_TOOL_CFGABLE_H */
247