#include <MediaAria2c.h>
Classes | |
class | Callbacks |
Public Member Functions | |
MediaAria2c (const Url &url_r, const Pathname &attach_point_hint_r) | |
virtual | ~MediaAria2c () |
Static Public Member Functions | |
static bool | existsAria2cmd () |
check if aria2c command line is present in the system | |
Protected Member Functions | |
virtual void | attachTo (bool next=false) |
Call concrete handler to attach the media. | |
virtual void | releaseFrom (const std::string &ejectDev) |
Call concrete handler to release the media. | |
virtual void | getFile (const Pathname &filename) const |
Call concrete handler to provide file below attach point. | |
virtual void | getDir (const Pathname &dirname, bool recurse_r) const |
Call concrete handler to provide directory content (not recursive!) below attach point. | |
virtual void | getDirInfo (std::list< std::string > &retlist, const Pathname &dirname, bool dots=true) const |
Call concrete handler to provide a content list of directory on media via retlist. | |
virtual void | getDirInfo (filesystem::DirContent &retlist, const Pathname &dirname, bool dots=true) const |
Basically the same as getDirInfo above. | |
virtual bool | getDoesFileExist (const Pathname &filename) const |
Repeatedly calls doGetDoesFileExist() until it successfully returns, fails unexpectedly, or user cancels the operation. | |
virtual bool | doGetDoesFileExist (const Pathname &filename) const |
virtual void | disconnectFrom () |
virtual void | getFileCopy (const Pathname &srcFilename, const Pathname &targetFilename) const |
virtual bool | checkAttachPoint (const Pathname &apoint) const |
Verify if the specified directory as attach point (root) as requires by the particular media handler implementation. | |
Static Protected Member Functions | |
static const char *const | agentString () |
Private Member Functions | |
bool | authenticate (const std::string &availAuthTypes, bool firstTry) const |
std::string | getAria2cVersion () |
External process to get aria2c version. | |
Private Attributes | |
std::string | _currentCookieFile |
std::string | _ca_path |
Static Private Attributes | |
static Pathname | _cookieFile = "/var/lib/YaST2/cookies" |
static std::string | _aria2cVersion = "WE DON'T KNOW ARIA2C VERSION" |
Definition at line 31 of file MediaAria2c.h.
zypp::media::MediaAria2c::MediaAria2c | ( | const Url & | url_r, | |
const Pathname & | attach_point_hint_r | |||
) |
Definition at line 233 of file MediaAria2c.cc.
References _aria2cVersion, getAria2cVersion(), and MIL.
virtual zypp::media::MediaAria2c::~MediaAria2c | ( | ) | [inline, virtual] |
bool zypp::media::MediaAria2c::existsAria2cmd | ( | ) | [static] |
check if aria2c command line is present in the system
Definition at line 71 of file MediaAria2c.cc.
References ARIA_BINARY, zypp::ExternalProgram::close(), and zypp::ExternalProgram::Stderr_To_Stdout.
Referenced by zypp::media::MediaAccess::open().
void zypp::media::MediaAria2c::attachTo | ( | bool | next = false |
) | [protected, virtual] |
Call concrete handler to attach the media.
Asserted that not already attached, and attachPoint is a directory.
next | try next available device in turn until end of device list is reached (for media which are accessible through multiple devices like cdroms). |
MediaException |
Reimplemented from zypp::media::MediaCurl.
Definition at line 242 of file MediaAria2c.cc.
References zypp::media::MediaCurl::_settings, agentString(), and zypp::media::TransferSettings::setUserAgentString().
void zypp::media::MediaAria2c::releaseFrom | ( | const std::string & | ejectDev | ) | [protected, virtual] |
Call concrete handler to release the media.
If eject is true, and the media is used in one handler instance only, physically eject the media (i.e. CD-ROM).
Asserted that media is attached.
ejectDev | Device to eject. None if empty. |
MediaException |
Reimplemented from zypp::media::MediaCurl.
Definition at line 259 of file MediaAria2c.cc.
void zypp::media::MediaAria2c::getFile | ( | const Pathname & | filename | ) | const [protected, virtual] |
Call concrete handler to provide file below attach point.
Default implementation provided, that returns whether a file is located at 'localRoot + filename'.
Asserted that media is attached.
MediaException |
Reimplemented from zypp::media::MediaCurl.
Definition at line 264 of file MediaAria2c.cc.
References getFileCopy(), and zypp::media::MediaHandler::localPath().
void zypp::media::MediaAria2c::getDir | ( | const Pathname & | dirname, | |
bool | recurse_r | |||
) | const [protected, virtual] |
Call concrete handler to provide directory content (not recursive!) below attach point.
Return E_not_supported_by_media if media does not support retrieval of directory content.
Default implementation provided, that returns whether a directory is located at 'localRoot + dirname'.
Asserted that media is attached.
MediaException |
Reimplemented from zypp::media::MediaCurl.
Definition at line 555 of file MediaAria2c.cc.
void zypp::media::MediaAria2c::getDirInfo | ( | std::list< std::string > & | retlist, | |
const Pathname & | dirname, | |||
bool | dots = true | |||
) | const [protected, virtual] |
Call concrete handler to provide a content list of directory on media via retlist.
If dots is false entries starting with '.' are not reported.
Return E_not_supported_by_media if media does not support retrieval of directory content.
Default implementation provided, that returns the content of a directory at 'localRoot + dirnname' retrieved via 'readdir'.
Asserted that media is attached and retlist is empty.
MediaException |
Reimplemented from zypp::media::MediaCurl.
Definition at line 565 of file MediaAria2c.cc.
References zypp::media::MediaHandler::getDirectoryYast().
void zypp::media::MediaAria2c::getDirInfo | ( | filesystem::DirContent & | retlist, | |
const Pathname & | dirname, | |||
bool | dots = true | |||
) | const [protected, virtual] |
Basically the same as getDirInfo above.
The content list is returned as filesystem::DirContent, which includes name and filetype of each directory entry. Retrieving the filetype usg. requires an additional stat call for each entry, thus it's more expensive than a simple readdir.
Asserted that media is attached and retlist is empty.
MediaException |
Reimplemented from zypp::media::MediaCurl.
Definition at line 571 of file MediaAria2c.cc.
References zypp::media::MediaHandler::getDirectoryYast().
bool zypp::media::MediaAria2c::getDoesFileExist | ( | const Pathname & | filename | ) | const [protected, virtual] |
Repeatedly calls doGetDoesFileExist() until it successfully returns, fails unexpectedly, or user cancels the operation.
This is used to handle authentication or similar retry scenarios on media level.
Reimplemented from zypp::media::MediaCurl.
Definition at line 545 of file MediaAria2c.cc.
bool zypp::media::MediaAria2c::doGetDoesFileExist | ( | const Pathname & | filename | ) | const [protected, virtual] |
Reimplemented from zypp::media::MediaCurl.
Definition at line 550 of file MediaAria2c.cc.
void zypp::media::MediaAria2c::disconnectFrom | ( | ) | [protected, virtual] |
MediaException |
Reimplemented from zypp::media::MediaCurl.
Definition at line 254 of file MediaAria2c.cc.
void zypp::media::MediaAria2c::getFileCopy | ( | const Pathname & | srcFilename, | |
const Pathname & | targetFilename | |||
) | const [protected, virtual] |
MediaException |
Reimplemented from zypp::media::MediaCurl.
Definition at line 271 of file MediaAria2c.cc.
References _, _aria2cVersion, zypp::media::MediaCurl::_settings, zypp::media::MediaHandler::_url, zypp::media::DownloadProgressReport::ACCESS_DENIED, zypp::Exception::addHistory(), zypp::Url::asCompleteString(), zypp::Url::asString(), zypp::Exception::asUserHistory(), authenticate(), zypp::ExternalProgram::close(), DBG, ERR, zypp::media::DownloadProgressReport::ERROR, zypp::media::fillAriaCmdLine(), for_, zypp::str::form(), zypp::media::MediaCurl::getFileUrl(), zypp::str::hasPrefix(), zypp::media::MediaUnauthorizedException::hint(), zypp::ExternalProgram::kill(), zypp::media::DownloadProgressReport::NO_ERROR, zypp::externalprogram::ExternalDataSource::receiveLine(), zypp::str::regex_match(), report, zypp::media::DownloadProgressReport::RETRY, zypp::ExternalProgram::Stderr_To_Stdout, zypp::str::trim(), WAR, ZYPP_RETHROW, and ZYPP_THROW.
Referenced by getFile().
bool zypp::media::MediaAria2c::checkAttachPoint | ( | const Pathname & | apoint | ) | const [protected, virtual] |
Verify if the specified directory as attach point (root) as requires by the particular media handler implementation.
apoint | The directory to check. |
Reimplemented from zypp::media::MediaCurl.
Definition at line 249 of file MediaAria2c.cc.
const char *const zypp::media::MediaAria2c::agentString | ( | ) | [static, protected] |
Definition at line 212 of file MediaAria2c.cc.
References _aria2cVersion, _value, zypp::str::form(), and zypp::Target::targetDistribution().
Referenced by attachTo().
bool zypp::media::MediaAria2c::authenticate | ( | const std::string & | availAuthTypes, | |
bool | firstTry | |||
) | const [private] |
Reimplemented from zypp::media::MediaCurl.
Definition at line 560 of file MediaAria2c.cc.
Referenced by getFileCopy().
std::string zypp::media::MediaAria2c::getAria2cVersion | ( | ) | [private] |
External process to get aria2c version.
Definition at line 577 of file MediaAria2c.cc.
References ARIA_BINARY, zypp::ExternalProgram::close(), zypp::externalprogram::ExternalDataSource::receiveLine(), zypp::ExternalProgram::Stderr_To_Stdout, and zypp::str::trim().
Referenced by MediaAria2c().
std::string zypp::media::MediaAria2c::_currentCookieFile [private] |
std::string zypp::media::MediaAria2c::_ca_path [private] |
Definition at line 100 of file MediaAria2c.h.
Pathname zypp::media::MediaAria2c::_cookieFile = "/var/lib/YaST2/cookies" [static, private] |
std::string zypp::media::MediaAria2c::_aria2cVersion = "WE DON'T KNOW ARIA2C VERSION" [static, private] |
Definition at line 105 of file MediaAria2c.h.
Referenced by agentString(), getFileCopy(), and MediaAria2c().