#include <MediaCurl.h>
Inheritance diagram for zypp::media::MediaCurl:

Public Member Functions | ||||
| MediaCurl (const Url &url_r, const Pathname &attach_point_hint_r) | ||||
| virtual | ~MediaCurl () | |||
Static Public Member Functions | ||||
| static void | setCookieFile (const Pathname &) | |||
Protected Member Functions | ||||
| virtual void | attachTo (bool next=false) | |||
| Call concrete handler to attach the media. | ||||
| virtual void | releaseFrom (bool eject) | |||
| 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 | |||
| check if a file exists | ||||
| virtual void | disconnectFrom () | |||
| ||||
| virtual void | getFileCopy (const Pathname &srcFilename, const Pathname &targetFilename) const | |||
| ||||
| virtual void | doGetFileCopy (const Pathname &srcFilename, const Pathname &targetFilename, callback::SendReport< DownloadProgressReport > &_report) 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 int | progressCallback (void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) | |||
Private Attributes | ||||
| CURL * | _curl | |||
| char | _curlError [CURL_ERROR_SIZE] | |||
| long | _curlDebug | |||
| std::string | _userpwd | |||
| std::string | _proxy | |||
| std::string | _proxyuserpwd | |||
| std::string | _currentCookieFile | |||
| std::string | _ca_path | |||
| long | _xfer_timeout | |||
Static Private Attributes | ||||
| static Pathname | _cookieFile | |||
| static std::string | _agent | |||
Classes | ||||
| class | Callbacks | |||
Definition at line 30 of file MediaCurl.h.
| zypp::media::MediaCurl::MediaCurl | ( | const Url & | url_r, | |
| const Pathname & | attach_point_hint_r | |||
| ) |
Definition at line 166 of file MediaCurl.cc.
References _curlDebug, _curlError, zypp::media::MediaHandler::attachPoint(), zypp::Url::getScheme(), globalInitOnce(), MIL, zypp::filesystem::rmdir(), zypp::media::MediaHandler::setAttachPoint(), and WAR.
| virtual zypp::media::MediaCurl::~MediaCurl | ( | ) | [inline, virtual] |
| void zypp::media::MediaCurl::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 |
Implements zypp::media::MediaHandler.
Definition at line 214 of file MediaCurl.cc.
References _agent, _ca_path, _cookieFile, _curl, _curlDebug, _curlError, _currentCookieFile, _proxy, _proxyuserpwd, zypp::media::MediaHandler::_url, _userpwd, _xfer_timeout, zypp::ui::asString(), zypp::media::MediaHandler::attachPoint(), CONNECT_TIMEOUT, zypp::media::MediaHandler::createAttachPoint(), DBG, disconnectFrom(), zypp::media::ProxyInfo::enabled(), zypp::media::MediaHandler::isUseableAttachPoint(), log_curl(), zypp::media::ProxyInfo::noProxy(), zypp::media::ProxyInfo::noProxyBegin(), zypp::media::ProxyInfo::noProxyEnd(), progressCallback(), zypp::media::ProxyInfo::proxy(), zypp::base::sysconfig::read(), zypp::media::MediaHandler::setAttachPoint(), zypp::media::MediaHandler::setMediaSource(), zypp::url::split(), zypp::str::toLower(), TRANSFER_TIMEOUT, TRANSFER_TIMEOUT_MAX, zypp::media::unEscape(), zypp::media::MediaHandler::url(), WAR, and ZYPP_THROW.
| void zypp::media::MediaCurl::releaseFrom | ( | bool | eject | ) | [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.
| MediaException |
Implements zypp::media::MediaHandler.
Definition at line 694 of file MediaCurl.cc.
References zypp::media::MediaHandler::disconnect().
| void zypp::media::MediaCurl::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 |
Implements zypp::media::MediaHandler.
Definition at line 706 of file MediaCurl.cc.
References getFileCopy(), and zypp::media::MediaHandler::localPath().
Referenced by getDir().
| void zypp::media::MediaCurl::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 |
Implements zypp::media::MediaHandler.
Definition at line 1129 of file MediaCurl.cc.
References zypp::filesystem::assert_dir(), zypp::filesystem::FT_DIR, zypp::filesystem::FT_FILE, zypp::filesystem::FT_NOT_AVAIL, getDirInfo(), getFile(), zypp::media::MediaHandler::localPath(), and WAR.
| void zypp::media::MediaCurl::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 |
Implements zypp::media::MediaHandler.
Definition at line 1168 of file MediaCurl.cc.
References zypp::media::MediaHandler::getDirectoryYast().
Referenced by getDir().
| void zypp::media::MediaCurl::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 |
Implements zypp::media::MediaHandler.
Definition at line 1182 of file MediaCurl.cc.
References zypp::media::MediaHandler::getDirectoryYast().
| bool zypp::media::MediaCurl::getDoesFileExist | ( | const Pathname & | filename | ) | const [protected, virtual] |
check if a file exists
Asserted that url is a file and not a dir.
| MediaException |
Implements zypp::media::MediaHandler.
Definition at line 733 of file MediaCurl.cc.
References _curl, _curlError, zypp::media::MediaHandler::_url, zypp::Url::asString(), DBG, ERR, zypp::Url::getHost(), zypp::Url::getPathName(), zypp::Url::isValid(), MIL, zypp::Url::setFragment(), zypp::Url::setPassword(), zypp::Url::setPathName(), zypp::Url::setPathParams(), zypp::Url::setQueryString(), zypp::Url::setUsername(), zypp::media::MediaHandler::url(), and ZYPP_THROW.
| void zypp::media::MediaCurl::disconnectFrom | ( | ) | [protected, virtual] |
| MediaException |
Reimplemented from zypp::media::MediaHandler.
Definition at line 677 of file MediaCurl.cc.
References _curl.
Referenced by attachTo().
| void zypp::media::MediaCurl::getFileCopy | ( | const Pathname & | srcFilename, | |
| const Pathname & | targetFilename | |||
| ) | const [protected, virtual] |
| MediaException |
Reimplemented from zypp::media::MediaHandler.
Definition at line 714 of file MediaCurl.cc.
References zypp::media::MediaHandler::_url, doGetFileCopy(), zypp::Exception::msg(), zypp::media::DownloadProgressReport::NO_ERROR, zypp::media::DownloadProgressReport::NOT_FOUND, report, zypp::media::MediaHandler::url(), and ZYPP_RETHROW.
Referenced by getFile().
| void zypp::media::MediaCurl::doGetFileCopy | ( | const Pathname & | srcFilename, | |
| const Pathname & | targetFilename, | |||
| callback::SendReport< DownloadProgressReport > & | _report | |||
| ) | const [protected, virtual] |
| MediaException |
Definition at line 847 of file MediaCurl.cc.
References _curl, _curlError, zypp::media::MediaHandler::_url, _xfer_timeout, zypp::filesystem::assert_dir(), zypp::Url::asString(), DBG, ERR, zypp::Url::getHost(), zypp::Url::getPathName(), zypp::Url::getScheme(), zypp::Url::isValid(), zypp::str::numstring(), zypp::filesystem::rename(), report, zypp::Url::setFragment(), zypp::Url::setPassword(), zypp::Url::setPathName(), zypp::Url::setPathParams(), zypp::Url::setQueryString(), zypp::Url::setUsername(), zypp::filesystem::unlink(), zypp::media::MediaHandler::url(), WAR, ZYPP_RETHROW, and ZYPP_THROW.
Referenced by getFileCopy().
| bool zypp::media::MediaCurl::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::MediaHandler.
Definition at line 666 of file MediaCurl.cc.
References zypp::media::MediaHandler::checkAttachPoint().
| void zypp::media::MediaCurl::setCookieFile | ( | const Pathname & | ) | [static] |
| int zypp::media::MediaCurl::progressCallback | ( | void * | clientp, | |
| double | dltotal, | |||
| double | dlnow, | |||
| double | ultotal, | |||
| double | ulnow | |||
| ) | [static, protected] |
CURL* zypp::media::MediaCurl::_curl [private] |
Definition at line 89 of file MediaCurl.h.
Referenced by attachTo(), disconnectFrom(), doGetFileCopy(), and getDoesFileExist().
char zypp::media::MediaCurl::_curlError[CURL_ERROR_SIZE] [private] |
Definition at line 90 of file MediaCurl.h.
Referenced by attachTo(), doGetFileCopy(), getDoesFileExist(), and MediaCurl().
long zypp::media::MediaCurl::_curlDebug [private] |
std::string zypp::media::MediaCurl::_userpwd [private] |
std::string zypp::media::MediaCurl::_proxy [private] |
std::string zypp::media::MediaCurl::_proxyuserpwd [private] |
std::string zypp::media::MediaCurl::_currentCookieFile [private] |
std::string zypp::media::MediaCurl::_ca_path [private] |
long zypp::media::MediaCurl::_xfer_timeout [private] |
Pathname zypp::media::MediaCurl::_cookieFile [static, private] |
std::string zypp::media::MediaCurl::_agent [static, private] |
1.5.0