Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/pkg
Path: blob/main/external/curl/src/tool_cfgable.h
2065 views
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) Daniel Stenberg, <[email protected]>, 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.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
* SPDX-License-Identifier: curl
24
*
25
***************************************************************************/
26
27
#include <curl/mprintf.h>
28
#include "tool_setup.h"
29
#include "tool_sdecls.h"
30
#include "tool_urlglob.h"
31
#include "var.h"
32
33
/* the type we use for storing a single boolean bit */
34
#ifndef BIT
35
#ifdef _MSC_VER
36
#define BIT(x) bool x
37
#else
38
#define BIT(x) unsigned int x:1
39
#endif
40
#endif
41
42
/* make the tool use the libcurl *printf family */
43
# undef printf
44
# undef fprintf
45
# undef msnprintf
46
# undef vprintf
47
# undef vfprintf
48
# undef mvsnprintf
49
# undef aprintf
50
# undef vaprintf
51
# define printf curl_mprintf
52
# define fprintf curl_mfprintf
53
# define msnprintf curl_msnprintf
54
# define vprintf curl_mvprintf
55
# define vfprintf curl_mvfprintf
56
# define mvsnprintf curl_mvsnprintf
57
# define aprintf curl_maprintf
58
# define vaprintf curl_mvaprintf
59
60
#define checkprefix(a,b) curl_strnequal(b, STRCONST(a))
61
62
#define tool_safefree(ptr) \
63
do { free((ptr)); (ptr) = NULL;} while(0)
64
65
struct GlobalConfig;
66
67
struct State {
68
struct getout *urlnode;
69
struct URLGlob *inglob;
70
struct URLGlob *urls;
71
char *outfiles;
72
char *httpgetfields;
73
char *uploadfile;
74
curl_off_t infilenum; /* number of files to upload */
75
curl_off_t up; /* upload file counter within a single upload glob */
76
curl_off_t urlnum; /* how many iterations this single URL has with ranges
77
etc */
78
curl_off_t li;
79
};
80
81
struct OperationConfig {
82
struct State state; /* for create_transfer() */
83
struct dynbuf postdata;
84
char *useragent;
85
struct curl_slist *cookies; /* cookies to serialize into a single line */
86
char *cookiejar; /* write to this file */
87
struct curl_slist *cookiefiles; /* file(s) to load cookies from */
88
char *altsvc; /* alt-svc cache filename */
89
char *hsts; /* HSTS cache filename */
90
char *proto_str;
91
char *proto_redir_str;
92
char *proto_default;
93
curl_off_t resume_from;
94
char *postfields;
95
char *referer;
96
char *query;
97
curl_off_t max_filesize;
98
char *output_dir;
99
char *headerfile;
100
char *ftpport;
101
char *iface;
102
char *range;
103
char *dns_servers; /* dot notation: 1.1.1.1;2.2.2.2 */
104
char *dns_interface; /* interface name */
105
char *dns_ipv4_addr; /* dot notation */
106
char *dns_ipv6_addr; /* dot notation */
107
char *userpwd;
108
char *login_options;
109
char *tls_username;
110
char *tls_password;
111
char *tls_authtype;
112
char *proxy_tls_username;
113
char *proxy_tls_password;
114
char *proxy_tls_authtype;
115
char *proxyuserpwd;
116
char *proxy;
117
char *noproxy;
118
char *mail_from;
119
struct curl_slist *mail_rcpt;
120
char *mail_auth;
121
char *sasl_authzid; /* Authorization identity (identity to use) */
122
char *netrc_file;
123
struct getout *url_list; /* point to the first node */
124
struct getout *url_last; /* point to the last/current node */
125
struct getout *url_get; /* point to the node to fill in URL */
126
struct getout *url_out; /* point to the node to fill in outfile */
127
struct getout *url_ul; /* point to the node to fill in upload */
128
size_t num_urls; /* number of URLs added to the list */
129
#ifndef CURL_DISABLE_IPFS
130
char *ipfs_gateway;
131
#endif /* !CURL_DISABLE_IPFS */
132
char *doh_url;
133
char *cipher_list;
134
char *proxy_cipher_list;
135
char *cipher13_list;
136
char *proxy_cipher13_list;
137
char *cert;
138
char *proxy_cert;
139
char *cert_type;
140
char *proxy_cert_type;
141
char *cacert;
142
char *proxy_cacert;
143
char *capath;
144
char *proxy_capath;
145
char *crlfile;
146
char *proxy_crlfile;
147
char *pinnedpubkey;
148
char *proxy_pinnedpubkey;
149
char *key;
150
char *proxy_key;
151
char *key_type;
152
char *proxy_key_type;
153
char *key_passwd;
154
char *proxy_key_passwd;
155
char *pubkey;
156
char *hostpubmd5;
157
char *hostpubsha256;
158
char *engine;
159
char *etag_save_file;
160
char *etag_compare_file;
161
char *customrequest;
162
char *ssl_ec_curves;
163
char *ssl_signature_algorithms;
164
char *krblevel;
165
char *request_target;
166
char *writeout; /* %-styled format string to output */
167
struct curl_slist *quote;
168
struct curl_slist *postquote;
169
struct curl_slist *prequote;
170
struct curl_slist *headers;
171
struct curl_slist *proxyheaders;
172
struct tool_mime *mimeroot;
173
struct tool_mime *mimecurrent;
174
curl_mime *mimepost;
175
struct curl_slist *telnet_options;
176
struct curl_slist *resolve;
177
struct curl_slist *connect_to;
178
char *preproxy;
179
char *proxy_service_name; /* set authentication service name for HTTP and
180
SOCKS5 proxies */
181
char *service_name; /* set authentication service name for DIGEST-MD5,
182
Kerberos 5 and SPNEGO */
183
char *ftp_account; /* for ACCT */
184
char *ftp_alternative_to_user; /* send command if USER/PASS fails */
185
char *oauth_bearer; /* OAuth 2.0 bearer token */
186
char *unix_socket_path; /* path to Unix domain socket */
187
char *haproxy_clientip; /* client IP for HAProxy protocol */
188
char *aws_sigv4;
189
char *ech; /* Config set by --ech keywords */
190
char *ech_config; /* Config set by "--ech esl:" option */
191
char *ech_public; /* Config set by "--ech pn:" option */
192
struct GlobalConfig *global;
193
struct OperationConfig *prev;
194
struct OperationConfig *next; /* Always last in the struct */
195
curl_off_t condtime;
196
/* for bandwidth limiting features: */
197
curl_off_t sendpersecond; /* send to peer */
198
curl_off_t recvpersecond; /* receive from peer */
199
200
long ssl_version;
201
long ssl_version_max;
202
long proxy_ssl_version;
203
long ip_version;
204
long create_file_mode; /* CURLOPT_NEW_FILE_PERMS */
205
long low_speed_limit;
206
long low_speed_time;
207
long ip_tos; /* IP Type of Service */
208
long vlan_priority; /* VLAN priority */
209
long localport;
210
long localportrange;
211
unsigned long authtype; /* auth bitmask */
212
long timeout_ms;
213
long connecttimeout_ms;
214
long maxredirs;
215
long httpversion;
216
unsigned long socks5_auth;/* auth bitmask for socks5 proxies */
217
long req_retry; /* number of retries */
218
long retry_delay; /* delay between retries (in seconds) */
219
long retry_maxtime; /* maximum time to keep retrying */
220
221
unsigned long mime_options; /* Mime option flags. */
222
long tftp_blksize; /* TFTP BLKSIZE option */
223
long alivetime; /* keepalive-time */
224
long alivecnt; /* keepalive-cnt */
225
long gssapi_delegation;
226
long expect100timeout_ms;
227
long happy_eyeballs_timeout_ms; /* happy eyeballs timeout in milliseconds.
228
0 is valid. default: CURL_HET_DEFAULT. */
229
unsigned long timecond;
230
HttpReq httpreq;
231
long proxyver; /* set to CURLPROXY_HTTP* define */
232
int ftp_ssl_ccc_mode;
233
int ftp_filemethod;
234
enum {
235
CLOBBER_DEFAULT, /* Provides compatibility with previous versions of curl,
236
by using the default behavior for -o, -O, and -J.
237
If those options would have overwritten files, like
238
-o and -O would, then overwrite them. In the case of
239
-J, this will not overwrite any files. */
240
CLOBBER_NEVER, /* If the file exists, always fail */
241
CLOBBER_ALWAYS /* If the file exists, always overwrite it */
242
} file_clobber_mode;
243
unsigned char upload_flags; /* Bitmask for --upload-flags */
244
unsigned short porttouse;
245
BIT(remote_name_all); /* --remote-name-all */
246
BIT(remote_time);
247
BIT(cookiesession); /* new session? */
248
BIT(encoding); /* Accept-Encoding please */
249
BIT(tr_encoding); /* Transfer-Encoding please */
250
BIT(use_resume);
251
BIT(resume_from_current);
252
BIT(disable_epsv);
253
BIT(disable_eprt);
254
BIT(ftp_pret);
255
BIT(proto_present);
256
BIT(proto_redir_present);
257
BIT(mail_rcpt_allowfails); /* --mail-rcpt-allowfails */
258
BIT(sasl_ir); /* Enable/disable SASL initial response */
259
BIT(proxytunnel);
260
BIT(ftp_append); /* APPE on ftp */
261
BIT(use_ascii); /* select ASCII or text transfer */
262
BIT(autoreferer); /* automatically set referer */
263
BIT(failonerror); /* fail on (HTTP) errors */
264
BIT(failwithbody); /* fail on (HTTP) errors but still store body */
265
BIT(show_headers); /* show headers to data output */
266
BIT(no_body); /* do not get the body */
267
BIT(dirlistonly); /* only get the FTP dir list */
268
BIT(followlocation); /* follow http redirects */
269
BIT(unrestricted_auth); /* Continue to send authentication (user+password)
270
when following redirects, even when hostname
271
changed */
272
BIT(netrc_opt);
273
BIT(netrc);
274
BIT(crlf);
275
BIT(http09_allowed);
276
BIT(nobuffer);
277
BIT(readbusy); /* set when reading input returns EAGAIN */
278
BIT(globoff);
279
BIT(use_httpget);
280
BIT(insecure_ok); /* set TRUE to allow insecure SSL connects */
281
BIT(doh_insecure_ok); /* set TRUE to allow insecure SSL connects
282
for DoH */
283
BIT(proxy_insecure_ok); /* set TRUE to allow insecure SSL connects
284
for proxy */
285
BIT(terminal_binary_ok);
286
BIT(verifystatus);
287
BIT(doh_verifystatus);
288
BIT(create_dirs);
289
BIT(ftp_create_dirs);
290
BIT(ftp_skip_ip);
291
BIT(proxynegotiate);
292
BIT(proxyntlm);
293
BIT(proxydigest);
294
BIT(proxybasic);
295
BIT(proxyanyauth);
296
BIT(jsoned); /* added json content-type */
297
BIT(ftp_ssl);
298
BIT(ftp_ssl_reqd);
299
BIT(ftp_ssl_control);
300
BIT(ftp_ssl_ccc);
301
BIT(socks5_gssapi_nec); /* The NEC reference server does not protect the
302
encryption type exchange */
303
BIT(tcp_nodelay);
304
BIT(tcp_fastopen);
305
BIT(retry_all_errors); /* retry on any error */
306
BIT(retry_connrefused); /* set connection refused as a transient error */
307
BIT(tftp_no_options); /* do not send TFTP options requests */
308
BIT(ignorecl); /* --ignore-content-length */
309
BIT(disable_sessionid);
310
311
BIT(raw);
312
BIT(post301);
313
BIT(post302);
314
BIT(post303);
315
BIT(nokeepalive); /* for keepalive needs */
316
BIT(content_disposition); /* use Content-disposition filename */
317
318
BIT(xattr); /* store metadata in extended attributes */
319
BIT(ssl_allow_beast); /* allow this SSL vulnerability */
320
BIT(ssl_allow_earlydata); /* allow use of TLSv1.3 early data */
321
BIT(proxy_ssl_allow_beast); /* allow this SSL vulnerability for proxy */
322
BIT(ssl_no_revoke); /* disable SSL certificate revocation checks */
323
BIT(ssl_revoke_best_effort); /* ignore SSL revocation offline/missing
324
revocation list errors */
325
326
BIT(native_ca_store); /* use the native OS CA store */
327
BIT(proxy_native_ca_store); /* use the native OS CA store for proxy */
328
BIT(ssl_auto_client_cert); /* automatically locate and use a client
329
certificate for authentication (Schannel) */
330
BIT(proxy_ssl_auto_client_cert); /* proxy version of ssl_auto_client_cert */
331
BIT(noalpn); /* enable/disable TLS ALPN extension */
332
BIT(abstract_unix_socket); /* path to an abstract Unix domain socket */
333
BIT(falsestart);
334
BIT(path_as_is);
335
BIT(suppress_connect_headers); /* suppress proxy CONNECT response headers
336
from user callbacks */
337
BIT(synthetic_error); /* if TRUE, this is tool-internal error */
338
BIT(ssh_compression); /* enable/disable SSH compression */
339
BIT(haproxy_protocol); /* whether to send HAProxy protocol v1 */
340
BIT(disallow_username_in_url); /* disallow usernames in URLs */
341
BIT(mptcp); /* enable MPTCP support */
342
BIT(rm_partial); /* on error, remove partially written output
343
files */
344
BIT(skip_existing);
345
};
346
347
struct GlobalConfig {
348
char *trace_dump; /* file to dump the network trace to */
349
FILE *trace_stream;
350
char *libcurl; /* Output libcurl code to this filename */
351
char *ssl_sessions; /* file to load/save SSL session tickets */
352
char *knownhosts; /* known host path, if set. curl_free()
353
this */
354
struct tool_var *variables;
355
struct OperationConfig *first;
356
struct OperationConfig *current;
357
struct OperationConfig *last;
358
timediff_t ms_per_transfer; /* start next transfer after (at least) this
359
many milliseconds */
360
trace tracetype;
361
int progressmode; /* CURL_PROGRESS_BAR / CURL_PROGRESS_STATS */
362
unsigned short parallel_max; /* MAX_PARALLEL is the maximum */
363
unsigned char verbosity; /* How verbose we should be */
364
#ifdef DEBUGBUILD
365
BIT(test_duphandle);
366
BIT(test_event_based);
367
#endif
368
BIT(parallel);
369
BIT(parallel_connect);
370
BIT(fail_early); /* exit on first transfer error */
371
BIT(styled_output); /* enable fancy output style detection */
372
BIT(trace_fopened);
373
BIT(tracetime); /* include timestamp? */
374
BIT(traceids); /* include xfer-/conn-id? */
375
BIT(showerror); /* show errors when silent */
376
BIT(silent); /* do not show messages, --silent given */
377
BIT(noprogress); /* do not show progress bar */
378
BIT(isatty); /* Updated internally if output is a tty */
379
};
380
381
void config_init(struct OperationConfig *config);
382
void config_free(struct OperationConfig *config);
383
384
#endif /* HEADER_CURL_TOOL_CFGABLE_H */
385
386