#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#define checkprefix(a,b) curl_strnequal(b, STRCONST(a))4243#define tool_safefree(ptr) \44do { free((ptr)); (ptr) = NULL;} while(0)4546extern struct GlobalConfig *global;4748struct State {49struct getout *urlnode;50struct URLGlob inglob;51struct URLGlob urlglob;52char *httpgetfields;53char *uploadfile;54curl_off_t upnum; /* number of files to upload */55curl_off_t upidx; /* index for upload glob */56curl_off_t urlnum; /* how many iterations this URL has with ranges etc */57curl_off_t urlidx; /* index for globbed URLs */58};5960#define FAIL_NONE 061#define FAIL_WITH_BODY 162#define FAIL_WO_BODY 26364struct OperationConfig {65struct dynbuf postdata;66char *useragent;67struct curl_slist *cookies; /* cookies to serialize into a single line */68char *cookiejar; /* write to this file */69struct curl_slist *cookiefiles; /* file(s) to load cookies from */70char *altsvc; /* alt-svc cache filename */71char *hsts; /* HSTS cache filename */72char *proto_str;73char *proto_redir_str;74char *proto_default;75curl_off_t resume_from;76char *postfields;77char *referer;78char *query;79curl_off_t max_filesize;80char *output_dir;81char *headerfile;82char *ftpport;83char *iface;84char *range;85char *dns_servers; /* dot notation: 1.1.1.1;2.2.2.2 */86char *dns_interface; /* interface name */87char *dns_ipv4_addr; /* dot notation */88char *dns_ipv6_addr; /* dot notation */89char *userpwd;90char *login_options;91char *tls_username;92char *tls_password;93char *tls_authtype;94char *proxy_tls_username;95char *proxy_tls_password;96char *proxy_tls_authtype;97char *proxyuserpwd;98char *proxy;99char *noproxy;100char *knownhosts;101char *mail_from;102struct curl_slist *mail_rcpt;103char *mail_auth;104char *sasl_authzid; /* Authorization identity (identity to use) */105char *netrc_file;106struct getout *url_list; /* point to the first node */107struct getout *url_last; /* point to the last/current node */108struct getout *url_get; /* point to the node to fill in URL */109struct getout *url_out; /* point to the node to fill in outfile */110struct getout *url_ul; /* point to the node to fill in upload */111size_t num_urls; /* number of URLs added to the list */112#ifndef CURL_DISABLE_IPFS113char *ipfs_gateway;114#endif /* !CURL_DISABLE_IPFS */115char *doh_url;116char *cipher_list;117char *proxy_cipher_list;118char *cipher13_list;119char *proxy_cipher13_list;120char *cert;121char *proxy_cert;122char *cert_type;123char *proxy_cert_type;124char *cacert;125char *proxy_cacert;126char *capath;127char *proxy_capath;128char *crlfile;129char *proxy_crlfile;130char *pinnedpubkey;131char *proxy_pinnedpubkey;132char *key;133char *proxy_key;134char *key_type;135char *proxy_key_type;136char *key_passwd;137char *proxy_key_passwd;138char *pubkey;139char *hostpubmd5;140char *hostpubsha256;141char *engine;142char *etag_save_file;143char *etag_compare_file;144char *customrequest;145char *ssl_ec_curves;146char *ssl_signature_algorithms;147char *krblevel;148char *request_target;149char *writeout; /* %-styled format string to output */150struct curl_slist *quote;151struct curl_slist *postquote;152struct curl_slist *prequote;153struct curl_slist *headers;154struct curl_slist *proxyheaders;155struct tool_mime *mimeroot;156struct tool_mime *mimecurrent;157curl_mime *mimepost;158struct curl_slist *telnet_options;159struct curl_slist *resolve;160struct curl_slist *connect_to;161char *preproxy;162char *proxy_service_name; /* set authentication service name for HTTP and163SOCKS5 proxies */164char *service_name; /* set authentication service name for DIGEST-MD5,165Kerberos 5 and SPNEGO */166char *ftp_account; /* for ACCT */167char *ftp_alternative_to_user; /* send command if USER/PASS fails */168char *oauth_bearer; /* OAuth 2.0 bearer token */169char *unix_socket_path; /* path to Unix domain socket */170char *haproxy_clientip; /* client IP for HAProxy protocol */171char *aws_sigv4;172char *ech; /* Config set by --ech keywords */173char *ech_config; /* Config set by "--ech esl:" option */174char *ech_public; /* Config set by "--ech pn:" option */175struct OperationConfig *prev;176struct OperationConfig *next; /* Always last in the struct */177curl_off_t condtime;178/* for bandwidth limiting features: */179curl_off_t sendpersecond; /* send to peer */180curl_off_t recvpersecond; /* receive from peer */181182long proxy_ssl_version;183long ip_version;184long create_file_mode; /* CURLOPT_NEW_FILE_PERMS */185long low_speed_limit;186long low_speed_time;187long ip_tos; /* IP Type of Service */188long vlan_priority; /* VLAN priority */189long localport;190long localportrange;191unsigned long authtype; /* auth bitmask */192long timeout_ms;193long connecttimeout_ms;194long maxredirs;195long httpversion;196unsigned long socks5_auth;/* auth bitmask for socks5 proxies */197long req_retry; /* number of retries */198long retry_delay_ms; /* delay between retries (in milliseconds),1990 means increase exponentially */200long retry_maxtime_ms; /* maximum time to keep retrying */201202unsigned long mime_options; /* Mime option flags. */203long tftp_blksize; /* TFTP BLKSIZE option */204long alivetime; /* keepalive-time */205long alivecnt; /* keepalive-cnt */206long gssapi_delegation;207long expect100timeout_ms;208long happy_eyeballs_timeout_ms; /* happy eyeballs timeout in milliseconds.2090 is valid. default: CURL_HET_DEFAULT. */210unsigned long timecond;211long followlocation; /* follow http redirects mode */212HttpReq httpreq;213long proxyver; /* set to CURLPROXY_HTTP* define */214long ftp_ssl_ccc_mode;215long ftp_filemethod;216enum {217CLOBBER_DEFAULT, /* Provides compatibility with previous versions of curl,218by using the default behavior for -o, -O, and -J.219If those options would have overwritten files, like220-o and -O would, then overwrite them. In the case of221-J, this will not overwrite any files. */222CLOBBER_NEVER, /* If the file exists, always fail */223CLOBBER_ALWAYS /* If the file exists, always overwrite it */224} file_clobber_mode;225unsigned char upload_flags; /* Bitmask for --upload-flags */226unsigned short porttouse;227unsigned char ssl_version; /* 0 - 4, 0 being default */228unsigned char ssl_version_max; /* 0 - 4, 0 being default */229unsigned char fail; /* NONE, with body, without body */230BIT(remote_name_all); /* --remote-name-all */231BIT(remote_time);232BIT(cookiesession); /* new session? */233BIT(encoding); /* Accept-Encoding please */234BIT(tr_encoding); /* Transfer-Encoding please */235BIT(use_resume);236BIT(resume_from_current);237BIT(disable_epsv);238BIT(disable_eprt);239BIT(ftp_pret);240BIT(proto_present);241BIT(proto_redir_present);242BIT(mail_rcpt_allowfails); /* --mail-rcpt-allowfails */243BIT(sasl_ir); /* Enable/disable SASL initial response */244BIT(proxytunnel);245BIT(ftp_append); /* APPE on ftp */246BIT(use_ascii); /* select ASCII or text transfer */247BIT(autoreferer); /* automatically set referer */248BIT(show_headers); /* show headers to data output */249BIT(no_body); /* do not get the body */250BIT(dirlistonly); /* only get the FTP dir list */251BIT(unrestricted_auth); /* Continue to send authentication (user+password)252when following redirects, even when hostname253changed */254BIT(netrc_opt);255BIT(netrc);256BIT(crlf);257BIT(http09_allowed);258BIT(nobuffer);259BIT(readbusy); /* set when reading input returns EAGAIN */260BIT(globoff);261BIT(use_httpget);262BIT(insecure_ok); /* set TRUE to allow insecure SSL connects */263BIT(doh_insecure_ok); /* set TRUE to allow insecure SSL connects264for DoH */265BIT(proxy_insecure_ok); /* set TRUE to allow insecure SSL connects266for proxy */267BIT(terminal_binary_ok);268BIT(verifystatus);269BIT(doh_verifystatus);270BIT(create_dirs);271BIT(ftp_create_dirs);272BIT(ftp_skip_ip);273BIT(proxynegotiate);274BIT(proxyntlm);275BIT(proxydigest);276BIT(proxybasic);277BIT(proxyanyauth);278BIT(jsoned); /* added json content-type */279BIT(ftp_ssl);280BIT(ftp_ssl_reqd);281BIT(ftp_ssl_control);282BIT(ftp_ssl_ccc);283BIT(socks5_gssapi_nec); /* The NEC reference server does not protect the284encryption type exchange */285BIT(tcp_nodelay);286BIT(tcp_fastopen);287BIT(retry_all_errors); /* retry on any error */288BIT(retry_connrefused); /* set connection refused as a transient error */289BIT(tftp_no_options); /* do not send TFTP options requests */290BIT(ignorecl); /* --ignore-content-length */291BIT(disable_sessionid);292293BIT(raw);294BIT(post301);295BIT(post302);296BIT(post303);297BIT(nokeepalive); /* for keepalive needs */298BIT(content_disposition); /* use Content-disposition filename */299300BIT(xattr); /* store metadata in extended attributes */301BIT(ssl_allow_beast); /* allow this SSL vulnerability */302BIT(ssl_allow_earlydata); /* allow use of TLSv1.3 early data */303BIT(proxy_ssl_allow_beast); /* allow this SSL vulnerability for proxy */304BIT(ssl_no_revoke); /* disable SSL certificate revocation checks */305BIT(ssl_revoke_best_effort); /* ignore SSL revocation offline/missing306revocation list errors */307308BIT(native_ca_store); /* use the native OS CA store */309BIT(proxy_native_ca_store); /* use the native OS CA store for proxy */310BIT(ssl_auto_client_cert); /* automatically locate and use a client311certificate for authentication (Schannel) */312BIT(proxy_ssl_auto_client_cert); /* proxy version of ssl_auto_client_cert */313BIT(noalpn); /* enable/disable TLS ALPN extension */314BIT(abstract_unix_socket); /* path to an abstract Unix domain socket */315BIT(path_as_is);316BIT(suppress_connect_headers); /* suppress proxy CONNECT response headers317from user callbacks */318BIT(synthetic_error); /* if TRUE, this is tool-internal error */319BIT(ssh_compression); /* enable/disable SSH compression */320BIT(haproxy_protocol); /* whether to send HAProxy protocol v1 */321BIT(disallow_username_in_url); /* disallow usernames in URLs */322BIT(mptcp); /* enable MPTCP support */323BIT(rm_partial); /* on error, remove partially written output324files */325BIT(skip_existing);326};327328#if defined(_WIN32) && !defined(UNDER_CE)329struct termout {330wchar_t *buf;331DWORD len;332};333#endif334335struct GlobalConfig {336struct State state; /* for create_transfer() */337char *trace_dump; /* file to dump the network trace to */338FILE *trace_stream;339char *libcurl; /* Output libcurl code to this filename */340char *ssl_sessions; /* file to load/save SSL session tickets */341struct tool_var *variables;342struct OperationConfig *first;343struct OperationConfig *current;344struct OperationConfig *last;345#if defined(_WIN32) && !defined(UNDER_CE)346struct termout term;347#endif348timediff_t ms_per_transfer; /* start next transfer after (at least) this349many milliseconds */350trace tracetype;351int progressmode; /* CURL_PROGRESS_BAR / CURL_PROGRESS_STATS */352unsigned short parallel_host; /* MAX_PARALLEL_HOST is the maximum */353unsigned short parallel_max; /* MAX_PARALLEL is the maximum */354unsigned char verbosity; /* How verbose we should be */355#ifdef DEBUGBUILD356BIT(test_duphandle);357BIT(test_event_based);358#endif359BIT(parallel);360BIT(parallel_connect);361BIT(fail_early); /* exit on first transfer error */362BIT(styled_output); /* enable fancy output style detection */363BIT(trace_fopened);364BIT(tracetime); /* include timestamp? */365BIT(traceids); /* include xfer-/conn-id? */366BIT(showerror); /* show errors when silent */367BIT(silent); /* do not show messages, --silent given */368BIT(noprogress); /* do not show progress bar */369BIT(isatty); /* Updated internally if output is a tty */370BIT(trace_set); /* --trace-config has been used */371};372373struct OperationConfig *config_alloc(void);374void config_free(struct OperationConfig *config);375CURLcode globalconf_init(void);376void globalconf_free(void);377378#endif /* HEADER_CURL_TOOL_CFGABLE_H */379380381