libzypp
11.13.5
|
Implementation class for FTP, HTTP and HTTPS MediaHandler using an external program (aria2c) to retrive files. More...
#include <MediaAria2c.h>
Classes | |
class | Callbacks |
Public Member Functions | |
MediaAria2c (const Url &url_r, const Pathname &attach_point_hint_r) | |
virtual | ~MediaAria2c () |
Public Member Functions inherited from zypp::media::MediaCurl | |
ZYPP_DECLARE_FLAGS (RequestOptions, RequestOption) | |
MediaCurl (const Url &url_r, const Pathname &attach_point_hint_r) | |
virtual | ~MediaCurl () |
TransferSettings & | settings () |
Public Member Functions inherited from zypp::media::MediaHandler | |
MediaHandler (const Url &url_r, const Pathname &attach_point_r, const Pathname &urlpath_below_attachpoint_r, const bool does_download_r) | |
If the concrete media handler provides a nonempty attach_point, it must be an existing directory. | |
virtual | ~MediaHandler () |
Contolling MediaAccess takes care, that attached media is released prior to deleting this. | |
bool | downloads () const |
Hint if files are downloaded or not. | |
std::string | protocol () const |
Protocol hint for MediaAccess. | |
Url | url () const |
Url used. | |
void | attach (bool next) |
Use concrete handler to attach the media. | |
virtual bool | isAttached () const |
True if media is attached. | |
Pathname | localRoot () const |
Return the local directory that corresponds to medias url, no matter if media isAttached or not. | |
Pathname | localPath (const Pathname &pathname) const |
Files provided will be available at 'localPath(filename)'. | |
void | disconnect () |
Use concrete handler to isconnect media. | |
void | release (const std::string &ejectDev="") |
Use concrete handler to release the media. | |
void | provideFile (Pathname filename) const |
Use concrete handler to provide file denoted by path below 'localRoot'. | |
void | provideFileCopy (Pathname srcFilename, Pathname targetFilename) const |
Call concrete handler to provide a copy of a file under a different place in the file system (usually not under attach point) as a copy. | |
void | provideDir (Pathname dirname) const |
Use concrete handler to provide directory denoted by path below 'localRoot' (not recursive!). | |
void | provideDirTree (Pathname dirname) const |
Use concrete handler to provide directory tree denoted by path below 'localRoot' (recursive!!). | |
void | releaseFile (const Pathname &filename) const |
Remove filename below localRoot IFF handler downloads files to the local filesystem. | |
void | releaseDir (const Pathname &dirname) const |
Remove directory tree below localRoot IFF handler downloads files to the local filesystem. | |
void | releasePath (Pathname pathname) const |
Remove pathname below localRoot IFF handler downloads files to the local filesystem. | |
void | setDeltafile (const Pathname &filename=Pathname()) const |
Pathname | deltafile () const |
void | dirInfo (std::list< std::string > &retlist, const Pathname &dirname, bool dots=true) const |
Return content of directory on media via retlist. | |
void | dirInfo (filesystem::DirContent &retlist, const Pathname &dirname, bool dots=true) const |
Basically the same as dirInfo above. | |
bool | doesFileExist (const Pathname &filename) const |
check if a file exists | |
virtual bool | hasMoreDevices () |
Check if the media has one more device available for attach(true). | |
virtual void | getDetectedDevices (std::vector< std::string > &devices, unsigned int &index) const |
Fill in a vector of detected ejectable devices and the index of the currently attached device within the vector. |
Static Public Member Functions | |
static bool | existsAria2cmd () |
check if aria2c command line is present in the system | |
Static Public Member Functions inherited from zypp::media::MediaCurl | |
static void | setCookieFile (const Pathname &) |
Static Public Member Functions inherited from zypp::media::MediaHandler | |
static bool | setAttachPrefix (const Pathname &attach_prefix) |
static std::string | getRealPath (const std::string &path) |
static Pathname | getRealPath (const Pathname &path) |
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. | |
Protected Member Functions inherited from zypp::media::MediaCurl | |
Url | clearQueryString (const Url &url) const |
virtual void | doGetFileCopy (const Pathname &srcFilename, const Pathname &targetFilename, callback::SendReport< DownloadProgressReport > &_report, RequestOptions options=OPTION_NONE) const |
void | checkProtocol (const Url &url) const |
check the url is supported by the curl library | |
virtual void | setupEasy () |
initializes the curl easy handle with the data from the url | |
Url | getFileUrl (const Pathname &filename) const |
concatenate the attach url and the filename to a complete download url | |
void | evaluateCurlCode (const zypp::Pathname &filename, CURLcode code, bool timeout) const |
Evaluates a curl return code and throws the right MediaException filename Filename being downloaded code Code curl returnes timeout Whether we reached timeout, which we need to differentiate in case the codes aborted-by-callback or timeout are returned by curl Otherwise we can't differentiate abort from timeout. | |
void | doGetFileCopyFile (const Pathname &srcFilename, const Pathname &dest, FILE *file, callback::SendReport< DownloadProgressReport > &_report, RequestOptions options=OPTION_NONE) const |
Protected Member Functions inherited from zypp::media::MediaHandler | |
bool | dependsOnParent (MediaAccessId parentId, bool exactIdMatch) |
Check if the current media handler depends on an another handler specified by media access id. | |
bool | dependsOnParent () |
void | resetParentId () |
Called in case, where the media manager takes over the destruction of the parent id (e.g. | |
Pathname | attachPoint () const |
Return the currently used attach point. | |
void | setAttachPoint (const Pathname &path, bool temp) |
Set a new attach point. | |
void | setAttachPoint (const AttachPointRef &ref) |
Set a (shared) attach point. | |
AttachPoint | attachPointHint () const |
Get the actual attach point hint. | |
void | attachPointHint (const Pathname &path, bool temp) |
Set the attach point hint as specified by the user. | |
Pathname | createAttachPoint () const |
Try to create a default / temporary attach point. | |
Pathname | createAttachPoint (const Pathname &attach_root) const |
Try to create a temporary attach point in specified root. | |
void | removeAttachPoint () |
Remove unused attach point. | |
bool | isUseableAttachPoint (const Pathname &path, bool mtab=true) const |
Ask media manager, if the specified path is already used as attach point or if there are another attach points bellow of it. | |
std::string | mediaSourceName () const |
Get the media source name or an empty string. | |
void | setMediaSource (const MediaSourceRef &ref) |
Set new media source reference. | |
AttachedMedia | findAttachedMedia (const MediaSourceRef &media) const |
Ask the media manager if specified media source is already attached. | |
AttachedMedia | attachedMedia () const |
Returns the attached media. | |
bool | isSharedMedia () const |
Returns a hint if the media is shared or not. | |
bool | checkAttached (bool matchMountFs) const |
Check actual mediaSource attachment against the current mount table of the system. | |
void | forceRelaseAllMedia (bool matchMountFs) |
Call to this function will try to release all media matching the currenlty attached media source, that it is able to find in the mount table. | |
void | forceRelaseAllMedia (const MediaSourceRef &ref, bool matchMountFs) |
virtual void | forceEject (const std::string &device) |
Call concrete handler to physically eject the media (i.e. | |
void | getDirectoryYast (std::list< std::string > &retlist, const Pathname &dirname, bool dots=true) const |
Retrieve and if available scan dirname/directory.yast. | |
void | getDirectoryYast (filesystem::DirContent &retlist, const Pathname &dirname, bool dots=true) const |
Retrieve and if available scan dirname/directory.yast. |
Static Protected Member Functions | |
static const char *const | agentString () |
Static Protected Member Functions inherited from zypp::media::MediaCurl | |
static int | progressCallback (void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) |
Static Protected Member Functions inherited from zypp::media::MediaHandler | |
static bool | checkAttachPoint (const Pathname &apoint, bool empty_dir, bool writeable) |
Verify if the specified directory as attach point (root) using requested checks. |
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" |
Additional Inherited Members | |
Public Types inherited from zypp::media::MediaCurl | |
enum | RequestOption { OPTION_NONE = 0x0, OPTION_RANGE = 0x1, OPTION_HEAD = 0x02, OPTION_NO_IFMODSINCE = 0x04, OPTION_NO_REPORT_START = 0x08 } |
Public Types inherited from zypp::media::MediaHandler | |
typedef shared_ptr< MediaHandler > | Ptr |
typedef shared_ptr< const MediaHandler > | constPtr |
Protected Attributes inherited from zypp::media::MediaCurl | |
CURL * | _curl |
char | _curlError [CURL_ERROR_SIZE] |
curl_slist * | _customHeaders |
TransferSettings | _settings |
Protected Attributes inherited from zypp::media::MediaHandler | |
const Url | _url |
Url to handle. | |
MediaAccessId | _parentId |
Access Id of media handler we depend on. |
Implementation class for FTP, HTTP and HTTPS MediaHandler using an external program (aria2c) to retrive files.
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.
|
inlinevirtual |
Definition at line 80 of file MediaAria2c.h.
|
static |
check if aria2c command line is present in the system
Definition at line 71 of file MediaAria2c.cc.
|
protectedvirtual |
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.
|
protectedvirtual |
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.
|
protectedvirtual |
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.
|
protectedvirtual |
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.
|
protectedvirtual |
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.
|
protectedvirtual |
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.
|
protectedvirtual |
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.
|
protectedvirtual |
Reimplemented from zypp::media::MediaCurl.
Definition at line 550 of file MediaAria2c.cc.
|
protectedvirtual |
MediaException |
Reimplemented from zypp::media::MediaCurl.
Definition at line 254 of file MediaAria2c.cc.
|
protectedvirtual |
MediaException |
Reimplemented from zypp::media::MediaCurl.
Definition at line 271 of file MediaAria2c.cc.
|
protectedvirtual |
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.
|
staticprotected |
Definition at line 212 of file MediaAria2c.cc.
|
private |
Reimplemented from zypp::media::MediaCurl.
Definition at line 560 of file MediaAria2c.cc.
|
private |
External process to get aria2c version.
Definition at line 577 of file MediaAria2c.cc.
|
private |
Reimplemented from zypp::media::MediaCurl.
Definition at line 99 of file MediaAria2c.h.
|
private |
Definition at line 100 of file MediaAria2c.h.
|
staticprivate |
Reimplemented from zypp::media::MediaCurl.
Definition at line 101 of file MediaAria2c.h.
|
staticprivate |
Definition at line 105 of file MediaAria2c.h.