#ifndef HEADER_CURL_TOOL_CFGABLE_H1#define HEADER_CURL_TOOL_CFGABLE_H2/***************************************************************************3* _ _ ____ _4* Project ___| | | | _ \| |5* / __| | | | |_) | |6* | (__| |_| | _ <| |___7* \___|\___/|_| \_\_____|8*9* Copyright (C) Daniel Stenberg, <[email protected]>, et al.10*11* This software is licensed as described in the file COPYING, which12* you should have received as part of this distribution. The terms13* are also available at https://curl.se/docs/copyright.html.14*15* You may opt to use, copy, modify, merge, publish, distribute and/or sell16* copies of the Software, and permit persons to whom the Software is17* furnished to do so, under the terms of the COPYING file.18*19* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY20* KIND, either express or implied.21*22* SPDX-License-Identifier: curl23*24***************************************************************************/2526#include <curl/mprintf.h>27#include "tool_setup.h"28#include "tool_sdecls.h"29#include "tool_urlglob.h"30#include "var.h"3132/* the type we use for storing a single boolean bit */33#ifndef BIT34#ifdef _MSC_VER35#define BIT(x) bool x36#else37#define BIT(x) unsigned int x:138#endif39#endif4041/* make the tool use the libcurl *printf family */42# undef printf43# undef fprintf44# undef msnprintf45# undef vprintf46# undef vfprintf47# undef mvsnprintf48# undef aprintf49# undef vaprintf50# define printf curl_mprintf51# define fprintf curl_mfprintf52# define msnprintf curl_msnprintf53# define vprintf curl_mvprintf54# define vfprintf curl_mvfprintf55# define mvsnprintf curl_mvsnprintf56# define aprintf curl_maprintf57# define vaprintf curl_mvaprintf5859#define checkprefix(a,b) curl_strnequal(b, STRCONST(a))6061#define tool_safefree(ptr) \62do { free((ptr)); (ptr) = NULL;} while(0)6364struct GlobalConfig;6566struct State {67struct getout *urlnode;68struct URLGlob *inglob;69struct URLGlob *urls;70char *outfiles;71char *httpgetfields;72char *uploadfile;73curl_off_t infilenum; /* number of files to upload */74curl_off_t up; /* upload file counter within a single upload glob */75curl_off_t urlnum; /* how many iterations this single URL has with ranges76etc */77curl_off_t li;78};7980struct OperationConfig {81struct State state; /* for create_transfer() */82struct dynbuf postdata;83char *useragent;84struct curl_slist *cookies; /* cookies to serialize into a single line */85char *cookiejar; /* write to this file */86struct curl_slist *cookiefiles; /* file(s) to load cookies from */87char *altsvc; /* alt-svc cache filename */88char *hsts; /* HSTS cache filename */89char *proto_str;90char *proto_redir_str;91char *proto_default;92curl_off_t resume_from;93char *postfields;94char *referer;95char *query;96curl_off_t max_filesize;97char *output_dir;98char *headerfile;99char *ftpport;100char *iface;101char *range;102char *dns_servers; /* dot notation: 1.1.1.1;2.2.2.2 */103char *dns_interface; /* interface name */104char *dns_ipv4_addr; /* dot notation */105char *dns_ipv6_addr; /* dot notation */106char *userpwd;107char *login_options;108char *tls_username;109char *tls_password;110char *tls_authtype;111char *proxy_tls_username;112char *proxy_tls_password;113char *proxy_tls_authtype;114char *proxyuserpwd;115char *proxy;116char *noproxy;117char *mail_from;118struct curl_slist *mail_rcpt;119char *mail_auth;120char *sasl_authzid; /* Authorization identity (identity to use) */121char *netrc_file;122struct getout *url_list; /* point to the first node */123struct getout *url_last; /* point to the last/current node */124struct getout *url_get; /* point to the node to fill in URL */125struct getout *url_out; /* point to the node to fill in outfile */126struct getout *url_ul; /* point to the node to fill in upload */127size_t num_urls; /* number of URLs added to the list */128#ifndef CURL_DISABLE_IPFS129char *ipfs_gateway;130#endif /* !CURL_DISABLE_IPFS */131char *doh_url;132char *cipher_list;133char *proxy_cipher_list;134char *cipher13_list;135char *proxy_cipher13_list;136char *cert;137char *proxy_cert;138char *cert_type;139char *proxy_cert_type;140char *cacert;141char *proxy_cacert;142char *capath;143char *proxy_capath;144char *crlfile;145char *proxy_crlfile;146char *pinnedpubkey;147char *proxy_pinnedpubkey;148char *key;149char *proxy_key;150char *key_type;151char *proxy_key_type;152char *key_passwd;153char *proxy_key_passwd;154char *pubkey;155char *hostpubmd5;156char *hostpubsha256;157char *engine;158char *etag_save_file;159char *etag_compare_file;160char *customrequest;161char *ssl_ec_curves;162char *ssl_signature_algorithms;163char *krblevel;164char *request_target;165char *writeout; /* %-styled format string to output */166struct curl_slist *quote;167struct curl_slist *postquote;168struct curl_slist *prequote;169struct curl_slist *headers;170struct curl_slist *proxyheaders;171struct tool_mime *mimeroot;172struct tool_mime *mimecurrent;173curl_mime *mimepost;174struct curl_slist *telnet_options;175struct curl_slist *resolve;176struct curl_slist *connect_to;177char *preproxy;178char *proxy_service_name; /* set authentication service name for HTTP and179SOCKS5 proxies */180char *service_name; /* set authentication service name for DIGEST-MD5,181Kerberos 5 and SPNEGO */182char *ftp_account; /* for ACCT */183char *ftp_alternative_to_user; /* send command if USER/PASS fails */184char *oauth_bearer; /* OAuth 2.0 bearer token */185char *unix_socket_path; /* path to Unix domain socket */186char *haproxy_clientip; /* client IP for HAProxy protocol */187char *aws_sigv4;188char *ech; /* Config set by --ech keywords */189char *ech_config; /* Config set by "--ech esl:" option */190char *ech_public; /* Config set by "--ech pn:" option */191struct GlobalConfig *global;192struct OperationConfig *prev;193struct OperationConfig *next; /* Always last in the struct */194curl_off_t condtime;195/* for bandwidth limiting features: */196curl_off_t sendpersecond; /* send to peer */197curl_off_t recvpersecond; /* receive from peer */198199long ssl_version;200long ssl_version_max;201long proxy_ssl_version;202long ip_version;203long create_file_mode; /* CURLOPT_NEW_FILE_PERMS */204long low_speed_limit;205long low_speed_time;206long ip_tos; /* IP Type of Service */207long vlan_priority; /* VLAN priority */208long localport;209long localportrange;210unsigned long authtype; /* auth bitmask */211long timeout_ms;212long connecttimeout_ms;213long maxredirs;214long httpversion;215unsigned long socks5_auth;/* auth bitmask for socks5 proxies */216long req_retry; /* number of retries */217long retry_delay; /* delay between retries (in seconds) */218long retry_maxtime; /* maximum time to keep retrying */219220unsigned long mime_options; /* Mime option flags. */221long tftp_blksize; /* TFTP BLKSIZE option */222long alivetime; /* keepalive-time */223long alivecnt; /* keepalive-cnt */224long gssapi_delegation;225long expect100timeout_ms;226long happy_eyeballs_timeout_ms; /* happy eyeballs timeout in milliseconds.2270 is valid. default: CURL_HET_DEFAULT. */228unsigned long timecond;229HttpReq httpreq;230long proxyver; /* set to CURLPROXY_HTTP* define */231int ftp_ssl_ccc_mode;232int ftp_filemethod;233enum {234CLOBBER_DEFAULT, /* Provides compatibility with previous versions of curl,235by using the default behavior for -o, -O, and -J.236If those options would have overwritten files, like237-o and -O would, then overwrite them. In the case of238-J, this will not overwrite any files. */239CLOBBER_NEVER, /* If the file exists, always fail */240CLOBBER_ALWAYS /* If the file exists, always overwrite it */241} file_clobber_mode;242unsigned char upload_flags; /* Bitmask for --upload-flags */243unsigned short porttouse;244BIT(remote_name_all); /* --remote-name-all */245BIT(remote_time);246BIT(cookiesession); /* new session? */247BIT(encoding); /* Accept-Encoding please */248BIT(tr_encoding); /* Transfer-Encoding please */249BIT(use_resume);250BIT(resume_from_current);251BIT(disable_epsv);252BIT(disable_eprt);253BIT(ftp_pret);254BIT(proto_present);255BIT(proto_redir_present);256BIT(mail_rcpt_allowfails); /* --mail-rcpt-allowfails */257BIT(sasl_ir); /* Enable/disable SASL initial response */258BIT(proxytunnel);259BIT(ftp_append); /* APPE on ftp */260BIT(use_ascii); /* select ASCII or text transfer */261BIT(autoreferer); /* automatically set referer */262BIT(failonerror); /* fail on (HTTP) errors */263BIT(failwithbody); /* fail on (HTTP) errors but still store body */264BIT(show_headers); /* show headers to data output */265BIT(no_body); /* do not get the body */266BIT(dirlistonly); /* only get the FTP dir list */267BIT(followlocation); /* follow http redirects */268BIT(unrestricted_auth); /* Continue to send authentication (user+password)269when following redirects, even when hostname270changed */271BIT(netrc_opt);272BIT(netrc);273BIT(crlf);274BIT(http09_allowed);275BIT(nobuffer);276BIT(readbusy); /* set when reading input returns EAGAIN */277BIT(globoff);278BIT(use_httpget);279BIT(insecure_ok); /* set TRUE to allow insecure SSL connects */280BIT(doh_insecure_ok); /* set TRUE to allow insecure SSL connects281for DoH */282BIT(proxy_insecure_ok); /* set TRUE to allow insecure SSL connects283for proxy */284BIT(terminal_binary_ok);285BIT(verifystatus);286BIT(doh_verifystatus);287BIT(create_dirs);288BIT(ftp_create_dirs);289BIT(ftp_skip_ip);290BIT(proxynegotiate);291BIT(proxyntlm);292BIT(proxydigest);293BIT(proxybasic);294BIT(proxyanyauth);295BIT(jsoned); /* added json content-type */296BIT(ftp_ssl);297BIT(ftp_ssl_reqd);298BIT(ftp_ssl_control);299BIT(ftp_ssl_ccc);300BIT(socks5_gssapi_nec); /* The NEC reference server does not protect the301encryption type exchange */302BIT(tcp_nodelay);303BIT(tcp_fastopen);304BIT(retry_all_errors); /* retry on any error */305BIT(retry_connrefused); /* set connection refused as a transient error */306BIT(tftp_no_options); /* do not send TFTP options requests */307BIT(ignorecl); /* --ignore-content-length */308BIT(disable_sessionid);309310BIT(raw);311BIT(post301);312BIT(post302);313BIT(post303);314BIT(nokeepalive); /* for keepalive needs */315BIT(content_disposition); /* use Content-disposition filename */316317BIT(xattr); /* store metadata in extended attributes */318BIT(ssl_allow_beast); /* allow this SSL vulnerability */319BIT(ssl_allow_earlydata); /* allow use of TLSv1.3 early data */320BIT(proxy_ssl_allow_beast); /* allow this SSL vulnerability for proxy */321BIT(ssl_no_revoke); /* disable SSL certificate revocation checks */322BIT(ssl_revoke_best_effort); /* ignore SSL revocation offline/missing323revocation list errors */324325BIT(native_ca_store); /* use the native OS CA store */326BIT(proxy_native_ca_store); /* use the native OS CA store for proxy */327BIT(ssl_auto_client_cert); /* automatically locate and use a client328certificate for authentication (Schannel) */329BIT(proxy_ssl_auto_client_cert); /* proxy version of ssl_auto_client_cert */330BIT(noalpn); /* enable/disable TLS ALPN extension */331BIT(abstract_unix_socket); /* path to an abstract Unix domain socket */332BIT(falsestart);333BIT(path_as_is);334BIT(suppress_connect_headers); /* suppress proxy CONNECT response headers335from user callbacks */336BIT(synthetic_error); /* if TRUE, this is tool-internal error */337BIT(ssh_compression); /* enable/disable SSH compression */338BIT(haproxy_protocol); /* whether to send HAProxy protocol v1 */339BIT(disallow_username_in_url); /* disallow usernames in URLs */340BIT(mptcp); /* enable MPTCP support */341BIT(rm_partial); /* on error, remove partially written output342files */343BIT(skip_existing);344};345346struct GlobalConfig {347char *trace_dump; /* file to dump the network trace to */348FILE *trace_stream;349char *libcurl; /* Output libcurl code to this filename */350char *ssl_sessions; /* file to load/save SSL session tickets */351char *knownhosts; /* known host path, if set. curl_free()352this */353struct tool_var *variables;354struct OperationConfig *first;355struct OperationConfig *current;356struct OperationConfig *last;357timediff_t ms_per_transfer; /* start next transfer after (at least) this358many milliseconds */359trace tracetype;360int progressmode; /* CURL_PROGRESS_BAR / CURL_PROGRESS_STATS */361unsigned short parallel_max; /* MAX_PARALLEL is the maximum */362unsigned char verbosity; /* How verbose we should be */363#ifdef DEBUGBUILD364BIT(test_duphandle);365BIT(test_event_based);366#endif367BIT(parallel);368BIT(parallel_connect);369BIT(fail_early); /* exit on first transfer error */370BIT(styled_output); /* enable fancy output style detection */371BIT(trace_fopened);372BIT(tracetime); /* include timestamp? */373BIT(traceids); /* include xfer-/conn-id? */374BIT(showerror); /* show errors when silent */375BIT(silent); /* do not show messages, --silent given */376BIT(noprogress); /* do not show progress bar */377BIT(isatty); /* Updated internally if output is a tty */378};379380void config_init(struct OperationConfig *config);381void config_free(struct OperationConfig *config);382383#endif /* HEADER_CURL_TOOL_CFGABLE_H */384385386