17 #ifndef LIBPKG_DOWNLOAD 18 #define LIBPKG_DOWNLOAD 23 #include "curl/curl.h" 44 static const size_type
npos=
static_cast<size_type
>(-1);
86 size_type _bytes_done;
89 size_type _bytes_total;
102 download(
const string& url,
const string& pathname,
options *opts =
nullptr);
123 {
return _error_buffer; }
129 {
return _bytes_done; }
135 {
return _bytes_total; }
160 int debug_callback(curl_infotype type,
char *data,
size_t size);
164 void log_to(
log *use_log);
174 static CURLM* _cmulti;
178 static unsigned int _cmulti_refcount;
string message() const
Get libcurl error message.
Definition: download.h:122
Definition: download.h:58
The state in which the download has been successfully completed.
Definition: download.h:53
string do_not_proxy
Definition: download.h:62
The state in which the download is in progress.
Definition: download.h:50
bool use_proxy
Definition: download.h:60
The namespace used to hold the package management library.
Definition: auto_dir.cc:23
static const size_type npos
A null value for use in place of a byte count.
Definition: download.h:44
size_type bytes_done()
Get number of bytes downloaded.
Definition: download.h:128
~download()
Destroy download action.
Definition: download.cc:135
static void poll_all()
Poll all download operations.
Definition: download.cc:219
int progress_callback(double dltotal, double dlnow)
Handler for CURLOPT_PROGRESSFUNCTION callbacks.
Definition: download.cc:158
unsigned long long size_type
A type for representing byte counts.
Definition: download.h:41
Class to log actions that occur in LibPkg.
Definition: log.h:226
void message_callback(CURLMsg *msg)
Handler for Curl messages.
Definition: download.cc:166
size_t write_callback(char *buffer, size_t size, size_t nitems)
Handler for CURLOPT_WRITEFUNCTION callbacks.
Definition: download.cc:152
download(const string &url, const string &pathname, options *opts=nullptr)
Construct download action.
Definition: download.cc:64
string proxy
Definition: download.h:61
A class for downloading a file from a URL.
Definition: download.h:37
state_type state() const
Get current state of the download.
Definition: download.h:110
state_type
Definition: download.h:47
The state in which the download has failed.
Definition: download.h:55
size_type bytes_total()
Get total number of bytes to download.
Definition: download.h:134
CURLcode result() const
Get libcurl result code.
Definition: download.h:116