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