zypp::media::MediaCurl Class Reference

Implementation class for FTP, HTTP and HTTPS MediaHandler. More...

#include <MediaCurl.h>

Inheritance diagram for zypp::media::MediaCurl:

zypp::media::MediaHandler List of all members.

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)
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 ()
 
Exceptions:
MediaException 

virtual void getFileCopy (const Pathname &srcFilename, const Pathname &targetFilename) const
 
Exceptions:
MediaException 

virtual void doGetFileCopy (const Pathname &srcFilename, const Pathname &targetFilename, callback::SendReport< DownloadProgressReport > &_report) const
 
Exceptions:
MediaException 

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 = "/var/lib/YaST2/cookies"
static std::string _agent = "Novell ZYPP Installer"

Classes

class  Callbacks

Detailed Description

Implementation class for FTP, HTTP and HTTPS MediaHandler.

See also:
MediaHandler

Definition at line 30 of file MediaCurl.h.


Constructor & Destructor Documentation

zypp::media::MediaCurl::MediaCurl const Url url_r,
const Pathname attach_point_hint_r
 

Definition at line 167 of file MediaCurl.cc.

References _curlDebug, _curlError, zypp::filesystem::Pathname::asString(), zypp::media::MediaHandler::attachPoint(), zypp::Url::getScheme(), globalInitOnce(), zypp::filesystem::PathInfo::isDir(), MIL, zypp::filesystem::PathInfo::path(), zypp::filesystem::rmdir(), zypp::media::MediaHandler::setAttachPoint(), zypp::filesystem::PathInfo::userMayRWX(), and WAR.

virtual zypp::media::MediaCurl::~MediaCurl  )  [inline, virtual]
 

Definition at line 72 of file MediaCurl.h.

References zypp::media::MediaHandler::release().


Member Function Documentation

void zypp::media::MediaCurl::attachTo bool  next = false  )  [protected, virtual]
 

Transfer timeout

Implements zypp::media::MediaHandler.

Definition at line 215 of file MediaCurl.cc.

References _curl, _curlDebug, _curlError, zypp::media::MediaHandler::_url, _xfer_timeout, zypp::filesystem::Pathname::asString(), zypp::media::MediaHandler::attachPoint(), zypp::media::MediaHandler::createAttachPoint(), disconnectFrom(), zypp::media::MediaHandler::isUseableAttachPoint(), log_curl(), zypp::media::MediaHandler::setAttachPoint(), TRANSFER_TIMEOUT, TRANSFER_TIMEOUT_MAX, zypp::media::MediaHandler::url(), 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.

Exceptions:
MediaException 

Implements zypp::media::MediaHandler.

Definition at line 699 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.

Exceptions:
MediaException 

Implements zypp::media::MediaHandler.

Definition at line 711 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.

Exceptions:
MediaException 

Implements zypp::media::MediaHandler.

Definition at line 1247 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.

Exceptions:
MediaException 

Implements zypp::media::MediaHandler.

Definition at line 1286 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.

Exceptions:
MediaException 

Implements zypp::media::MediaHandler.

Definition at line 1300 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.

Exceptions:
MediaException 

Implements zypp::media::MediaHandler.

Definition at line 738 of file MediaCurl.cc.

References zypp::media::MediaHandler::_url, zypp::filesystem::Pathname::absolute(), zypp::filesystem::Pathname::asString(), DBG, zypp::Url::getHost(), zypp::Url::getPathName(), zypp::Url::isValid(), and ZYPP_THROW.

void zypp::media::MediaCurl::disconnectFrom  )  [protected, virtual]
 

Exceptions:
MediaException 

Reimplemented from zypp::media::MediaHandler.

Definition at line 682 of file MediaCurl.cc.

Referenced by attachTo().

void zypp::media::MediaCurl::getFileCopy const Pathname srcFilename,
const Pathname targetFilename
const [protected, virtual]
 

Exceptions:
MediaException 

Reimplemented from zypp::media::MediaHandler.

Definition at line 719 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]
 

Exceptions:
MediaException 

Definition at line 952 of file MediaCurl.cc.

References zypp::media::MediaHandler::_url, zypp::filesystem::Pathname::absolute(), zypp::filesystem::Pathname::asString(), DBG, zypp::Url::getHost(), zypp::Url::getPathName(), zypp::Url::isValid(), 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.

Parameters:
apoint The directory to check.
Returns:
True, if the directory checks succeeded.

Reimplemented from zypp::media::MediaHandler.

Definition at line 671 of file MediaCurl.cc.

References zypp::media::MediaHandler::checkAttachPoint().

void zypp::media::MediaCurl::setCookieFile const Pathname  )  [static]
 

Definition at line 202 of file MediaCurl.cc.

References _cookieFile.

int zypp::media::MediaCurl::progressCallback void *  clientp,
double  dltotal,
double  dlnow,
double  ultotal,
double  ulnow
[static, protected]
 

Definition at line 1314 of file MediaCurl.cc.


Member Data Documentation

CURL* zypp::media::MediaCurl::_curl [private]
 

Definition at line 89 of file MediaCurl.h.

Referenced by attachTo().

char zypp::media::MediaCurl::_curlError[CURL_ERROR_SIZE] [private]
 

Definition at line 90 of file MediaCurl.h.

Referenced by attachTo(), and MediaCurl().

long zypp::media::MediaCurl::_curlDebug [private]
 

Definition at line 91 of file MediaCurl.h.

Referenced by attachTo(), and MediaCurl().

std::string zypp::media::MediaCurl::_userpwd [private]
 

Definition at line 93 of file MediaCurl.h.

std::string zypp::media::MediaCurl::_proxy [private]
 

Definition at line 94 of file MediaCurl.h.

std::string zypp::media::MediaCurl::_proxyuserpwd [private]
 

Definition at line 95 of file MediaCurl.h.

std::string zypp::media::MediaCurl::_currentCookieFile [private]
 

Definition at line 96 of file MediaCurl.h.

std::string zypp::media::MediaCurl::_ca_path [private]
 

Definition at line 97 of file MediaCurl.h.

long zypp::media::MediaCurl::_xfer_timeout [private]
 

Definition at line 98 of file MediaCurl.h.

Referenced by attachTo().

Pathname zypp::media::MediaCurl::_cookieFile = "/var/lib/YaST2/cookies" [static, private]
 

Definition at line 100 of file MediaCurl.h.

Referenced by setCookieFile().

std::string zypp::media::MediaCurl::_agent = "Novell ZYPP Installer" [static, private]
 

Definition at line 101 of file MediaCurl.h.


The documentation for this class was generated from the following files:
Generated on Thu Apr 24 02:25:10 2008 for zypp by  doxygen 1.4.6