6 #ifndef LIBPKG_DOWNLOAD 7 #define LIBPKG_DOWNLOAD 12 #include "curl/curl.h" 33 static const size_type
npos=
static_cast<size_type
>(-1);
68 size_type _bytes_done;
71 size_type _bytes_total;
83 download(
const string& url,
const string& pathname);
104 {
return _error_buffer; }
110 {
return _bytes_done; }
116 {
return _bytes_total; }
141 int debug_callback(curl_infotype type,
char *data,
size_t size);
145 void log_to(
log *use_log);
155 static CURLM* _cmulti;
159 static unsigned int _cmulti_refcount;
string message() const
Get libcurl error message.
Definition: download.h:103
The state in which the download has been successfully completed.
Definition: download.h:42
The state in which the download is in progress.
Definition: download.h:39
The namespace used to hold the package management library.
Definition: auto_dir.cc:12
static const size_type npos
A null value for use in place of a byte count.
Definition: download.h:33
size_type bytes_done()
Get number of bytes downloaded.
Definition: download.h:109
~download()
Destroy download action.
Definition: download.cc:109
static void poll_all()
Poll all download operations.
Definition: download.cc:193
int progress_callback(double dltotal, double dlnow)
Handler for CURLOPT_PROGRESSFUNCTION callbacks.
Definition: download.cc:132
download(const string &url, const string &pathname)
Construct download action.
Definition: download.cc:53
unsigned long long size_type
A type for representing byte counts.
Definition: download.h:30
Class to log actions that occur in LibPkg.
Definition: log.h:213
void message_callback(CURLMsg *msg)
Handler for Curl messages.
Definition: download.cc:140
size_t write_callback(char *buffer, size_t size, size_t nitems)
Handler for CURLOPT_WRITEFUNCTION callbacks.
Definition: download.cc:126
A class for downloading a file from a URL.
Definition: download.h:26
state_type state() const
Get current state of the download.
Definition: download.h:91
state_type
Definition: download.h:36
The state in which the download has failed.
Definition: download.h:44
size_type bytes_total()
Get total number of bytes to download.
Definition: download.h:115
CURLcode result() const
Get libcurl result code.
Definition: download.h:97