4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * * Neither the name of Red Hat nor the names of its contributors may be
16 * used to endorse or promote products derived from this software without
17 * specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 #ifndef NBDKIT_CURLDEFS_H
34 #define NBDKIT_CURLDEFS_H
38 #include "windows-compat.h"
40 /* Macro CURL_AT_LEAST_VERSION was added in 2015 (Curl 7.43) so if the
41 * macro isn't present then Curl is very old.
43 #ifdef CURL_AT_LEAST_VERSION
44 #if CURL_AT_LEAST_VERSION (7, 55, 0)
45 #define HAVE_CURLINFO_CONTENT_LENGTH_DOWNLOAD_T
49 extern const char *url
;
51 extern const char *cainfo
;
52 extern const char *capath
;
53 extern unsigned connections
;
55 extern const char *cookiefile
;
56 extern const char *cookiejar
;
57 extern const char *cookie_script
;
58 extern unsigned cookie_script_renew
;
59 extern bool followlocation
;
60 extern struct curl_slist
*headers
;
61 extern const char *header_script
;
62 extern unsigned header_script_renew
;
63 extern long http_version
;
64 extern char *password
;
65 #ifndef HAVE_CURLOPT_PROTOCOLS_STR
66 extern long protocols
;
68 extern const char *protocols
;
70 extern const char *proxy
;
71 extern char *proxy_password
;
72 extern const char *proxy_user
;
73 extern bool sslverify
;
74 extern const char *ssl_cipher_list
;
75 extern long ssl_version
;
76 extern const char *tls13_ciphers
;
77 extern bool tcp_keepalive
;
78 extern bool tcp_nodelay
;
79 extern uint32_t timeout
;
80 extern const char *unix_socket_path
;
81 extern const char *user
;
82 extern const char *user_agent
;
84 extern int curl_debug_verbose
;
86 /* The per-connection handle. */
91 /* The libcurl handle and some associated fields and buffers. */
93 /* The underlying curl handle. */
96 /* Index of this handle in the pool (for debugging). */
99 /* True if the handle is in use by a thread. */
102 /* These fields are used/initialized when we create the handle. */
106 char errbuf
[CURL_ERROR_SIZE
];
108 /* Before doing a read or write operation, set these to point to the
109 * buffer where you want the data to be stored / come from. Note
110 * the confusing terminology from libcurl: write_* is used when
111 * reading, read_* is used when writing.
114 uint32_t write_count
;
115 const char *read_buf
;
118 /* Used by scripts.c */
119 struct curl_slist
*headers_copy
;
123 extern struct curl_handle
*get_handle (void);
124 extern void put_handle (struct curl_handle
*ch
);
125 extern void free_all_handles (void);
128 extern int do_scripts (struct curl_handle
*ch
);
129 extern void scripts_unload (void);
131 #endif /* NBDKIT_CURLDEFS_H */