#include <MediaManager.h>
Inheritance diagram for zypp::media::MediaManager:
Public Member Functions | |
MediaManager () | |
Creates a MediaManager envelope instance. | |
~MediaManager () | |
Destroys MediaManager envelope instance. | |
MediaAccessId | open (const Url &url, const Pathname &preferred_attach_point="") |
Opens the media access for specified with the url. | |
void | close (MediaAccessId accessId) |
Close the media access with specified id. | |
bool | isOpen (MediaAccessId accessId) const |
Query if the media access is open / exists. | |
std::string | protocol (MediaAccessId accessId) const |
Query the protocol name used by the media access handler. | |
bool | downloads (MediaAccessId accessId) const |
Hint if files are downloaded or not. | |
Url | url (MediaAccessId accessId) const |
Returns the Media Access Url of the media access id. | |
void | addVerifier (MediaAccessId accessId, const MediaVerifierRef &verifier) |
Add verifier implementation for the specified media id. | |
void | delVerifier (MediaAccessId accessId) |
Remove verifier for specified media id. | |
bool | setAttachPrefix (const Pathname &attach_prefix) |
Set or resets the directory name, where the media manager handlers create their temporary attach points (see open() function). | |
void | attach (MediaAccessId accessId, bool next=false) |
Attach the media using the concrete handler. | |
void | release (MediaAccessId accessId, bool eject=false) |
Release the attached media and optionally eject. | |
void | disconnect (MediaAccessId accessId) |
Disconnect a remote media. | |
bool | isAttached (MediaAccessId accessId) const |
Check if media is attached or not. | |
bool | isSharedMedia (MediaAccessId accessId) const |
Returns information if media is on a shared physical device or not. | |
bool | isDesiredMedia (MediaAccessId accessId) const |
Ask the registered verifier if the attached media is the desired one or not. | |
bool | isDesiredMedia (MediaAccessId accessId, const MediaVerifierRef &verifier) const |
Ask the specified verifier if the attached media is the desired one or not. | |
Pathname | localRoot (MediaAccessId accessId) const |
Return the local directory that corresponds to medias url, no matter if media isAttached or not. | |
Pathname | localPath (MediaAccessId accessId, const Pathname &pathname) const |
Shortcut for 'localRoot() + pathname', but returns an empty pathname if media is not attached. | |
void | provideFile (MediaAccessId accessId, const Pathname &filename, bool cached=false, bool checkonly=false) const |
Provide provide file denoted by relative path below of the 'attach point' of the specified media and the path prefix on the media. | |
void | provideDir (MediaAccessId accessId, const Pathname &dirname) const |
FIXME: see MediaAccess class. | |
void | provideDirTree (MediaAccessId accessId, const Pathname &dirname) const |
FIXME: see MediaAccess class. | |
void | releaseFile (MediaAccessId accessId, const Pathname &filename) const |
FIXME: see MediaAccess class. | |
void | releaseDir (MediaAccessId accessId, const Pathname &dirname) const |
FIXME: see MediaAccess class. | |
void | releasePath (MediaAccessId accessId, const Pathname &pathname) const |
FIXME: see MediaAccess class. | |
void | dirInfo (MediaAccessId accessId, std::list< std::string > &retlist, const Pathname &dirname, bool dots=true) const |
FIXME: see MediaAccess class. | |
void | dirInfo (MediaAccessId accessId, filesystem::DirContent &retlist, const Pathname &dirname, bool dots=true) const |
FIXME: see MediaAccess class. | |
bool | isUseableAttachPoint (const Pathname &path, bool mtab=true) const |
Check if the specified path is useable as attach point. | |
Static Public Member Functions | |
static bool | downloads (const Url &url) |
Hint if files will be downloaded when using the specified media url . | |
static time_t | getMountTableMTime () |
Get the modification time of the /etc/mtab file. | |
static std::vector< MountEntry > | getMountEntries () |
Get current mount entries from /etc/mtab file. | |
Private Member Functions | |
AttachedMedia | getAttachedMedia (MediaAccessId &accessId) const |
AttachedMedia | findAttachedMedia (const MediaSourceRef &media) const |
void | forceReleaseShared (const MediaSourceRef &media) |
Static Private Attributes | |
static zypp::RW_pointer< MediaManager_Impl > | m_impl |
Static reference to the implementation (singleton). | |
Friends | |
class | MediaHandler |
All URL's may contain following query parameters, that are reserved by the Source classes and unused/ignored by the media manager:
alias
: A source specific media alias string.Currently, following access handlers (backends) are implemented:
"cd:/" "cd:/?devices=/dev/hda,/dev/hdb" "cd:/subdir?devices=/dev/hda,/dev/hdb" "dvd:/" "dvd:/?devices=/dev/hda,/dev/hdb" "dvd:/subdir?devices=/dev/hda,/dev/hdb"
devices
: Optional parameter, containing a comma separated list of block device names to use, e.g.: "/dev/sr0,/dev/sr1". "hd:/?device=/dev/hda1" "hd:/subdir?device=/dev/sda1" "hd:/subdir?device=/dev/sda1&filesystem=reiserfs"
device
: Mandatory parameter specifying the name of the block device of the partition to mount.filesystem
: The name of the filesystem. Defaults to "auto"."dir:/directory/name" "file:/directory/name"
"iso:/?iso=/path/to/CD1.iso" "iso:/?iso=CD1.iso&url=dir:/path/to" "iso:/?iso=CD1.iso&url=nfs://server/path/to/media" "iso:/?iso=CD1.iso&url=hd:/?device=/dev/hda" "iso:/subdir?iso=DVD1.iso&url=nfs://nfs-server/directory&mnt=/nfs/attach/point&filesystem=udf"
iso
: Mandatory parameter specifying the name of the iso file.url
: Optional parameter specifying the URL to the directory containing the iso file.mnt
: Optional parameter specifying the prefered attach point for the source media url.filesystem
: Optional name of the filesystem used in the iso file. Defaults to "auto"."nfs://nfs-server/exported/path" "nfs://nfs-server/exported/path?mountoptions=ro"
mountoptions
: The mount options separated by comma ','. Default is the "ro" option."cifs://servername/share/path/on/the/share" "cifs://username:passwd@servername/share/path/on/the/share?mountoptions=ro" "smb://servername/share/path/on/the/share" "smb://username:passwd@servername/share/path/on/the/share?mountoptions=ro"
mountoptions
: The mount options separated by a comma ','. Default are the "ro" and "guest" options.workgroup
: The name of the workgroup.username
: Alternative username to username in URL authority.password
: Alternative password to password in URL authority.user
: Alternative username (cifs specific variant?)pass
: Alternative password (cifs specific variant?)"ftp://server/relative/path/to/media/dir" "ftp://server/%2fabsolute/path/to/media/dir" "ftp://user:pass@server/path/to/media/dir" "ftp://user:pass@server/%2f/home/user/path/to/media/dir" "http://server/path/on/server" "http://user:pass@server/path" "https://user:pass@server/path?proxy=foo&proxyuser=me&proxypass=pw"
proxy
: A proxy hostname or hostname and port separated by ':'.proxyport
: Alternative way to provide the proxy port.proxyuser
: The proxy username.proxypass
: The proxy password.ssl_capath
: The absolute CA directory to use, default is /etc/ssl/certs.ssl_verify
: Flag to modify the ssl verify behaviour. Valid values are: 'yes', 'no' and a comma separated list of 'host' and 'peer' flags.ssl_capath
.timeout
: Transfer timeout in seconds between 0 and 3600, 0 disables the timeout, default timeout is 180 seconds.auth
: A comma separated list of http authentication method names to use: 'basic', 'digest', 'ntlm', 'negotiate', 'spnego', 'gssnego'. Note, that this list depends on the list of methods supported by the curl library.
Proxy settings: If no proxy settings are present in tha URLs query parameters, the media handler reads the system wide proxy settings from the /etc/sysconfig/proxy
file. If a proxy setting was present, but the proxy password not, it attempts to read the proxy-user
variable from the ~/.curlrc
(/root/.curlrc
) file.
If no proxy setting was present, then libzypp does not pass any proxy settings to curl, but curl fallbacks to use the content of the http_proxy
, ftp_proxy
, etc environment variables.
Definition at line 426 of file MediaManager.h.
|
Creates a MediaManager envelope instance. In the case, that the inner implementation is not already allocated, and the MediaManager constructor was unable to allocate it, a std::bad_alloc exception is thrown. All further instances increase the use counter only.
Definition at line 389 of file MediaManager.cc. References zypp::media::g_Mutex, m_impl, and zypp::RW_pointer< _D, _Traits >::reset(). |
|
Destroys MediaManager envelope instance. Decreases the use counter of the inner implementation. Definition at line 399 of file MediaManager.cc. |
|
Opens the media access for specified with the url.
If the Remember to close() each id you've opened and not need any more. It is like a new and delete!
Definition at line 405 of file MediaManager.cc. References zypp::Url::asString(), DBG, zypp::media::g_Mutex, handler, m_impl, url(), and verifier. Referenced by zypp::SourceFactory::createFrom(), zypp::SourceFactory::listProducts(), and zypp::source::SourceImpl::redirect(). |
|
Close the media access with specified id.
Definition at line 427 of file MediaManager.cc. References zypp::media::g_Mutex, m_impl, and ZYPP_THROW. Referenced by zypp::source::MediaSet::redirect(), zypp::source::MediaSet::reset(), zypp::media::MediaISO::~MediaISO(), and zypp::source::MediaSet::~MediaSet(). |
|
Query if the media access is open / exists.
Definition at line 463 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. Referenced by zypp::source::MediaSet::redirect(), zypp::source::MediaSet::reset(), and zypp::media::MediaISO::~MediaISO(). |
|
Query the protocol name used by the media access handler. Similar to url().getScheme().
Definition at line 474 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. |
|
Hint if files are downloaded or not.
Definition at line 485 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. Referenced by zypp::source::SourceImpl::remote(). |
|
Hint if files will be downloaded when using the specified media
Definition at line 497 of file MediaManager.cc. References zypp::media::MediaAccess::downloads(), and url(). |
|
Returns the Media Access Url of the media access id.
Definition at line 504 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. Referenced by zypp::source::SourceImpl::changeMedia(), downloads(), zypp::source::SourceImpl::factoryCtor(), open(), and zypp::source::MediaSet::reattach(). |
|
Add verifier implementation for the specified media id. By default, the NoVerifier is used.
Definition at line 515 of file MediaManager.cc. References DBG, zypp::media::g_Mutex, m_impl, verifier, and ZYPP_THROW. Referenced by zypp::SourceFactory::createFrom(), and zypp::source::SourceImpl::resetMediaVerifier(). |
|
Remove verifier for specified media id. It resets the verifier to NoVerifier.
Definition at line 534 of file MediaManager.cc. References DBG, zypp::media::g_Mutex, m_impl, and verifier. Referenced by zypp::source::SourceImpl::resetMediaVerifier(). |
|
Set or resets the directory name, where the media manager handlers create their temporary attach points (see open() function). It has effect to newly created temporary attach points only.
Definition at line 550 of file MediaManager.cc. References zypp::media::g_Mutex, and zypp::media::MediaHandler::setAttachPrefix(). Referenced by zypp::source::MediaSet::reattach(). |
|
Attach the media using the concrete handler. Remember to release() or close() each id you've attached and not need any more. Attach is like an open of a file!
Definition at line 559 of file MediaManager.cc. References DBG, zypp::media::g_Mutex, and m_impl. Referenced by zypp::SourceFactory::createFrom(), zypp::source::MediaSet::getMediaAccessId(), zypp::SourceFactory::listProducts(), and zypp::source::MediaSet::reattach(). |
|
Release the attached media and optionally eject.
If the
Definition at line 571 of file MediaManager.cc. References DBG, zypp::media::g_Mutex, m_impl, and ZYPP_CAUGHT. Referenced by zypp::SourceFactory::listProducts(), zypp::source::SourceImpl::provideDirTree(), zypp::source::SourceImpl::provideJustFile(), zypp::source::MediaSet::reattach(), zypp::source::MediaSet::release(), and zypp::source::SourceImpl::~SourceImpl(). |
|
Disconnect a remote media. This is useful for media which e.g. holds open a connection to a server like FTP. After calling disconnect() the media object (attach point) is still valid and files are present. But after calling disconnect() it's not possible to call fetch more data using the provideFile() or provideDir() functions anymore.
Definition at line 612 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. |
|
Check if media is attached or not.
Definition at line 623 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. Referenced by zypp::source::MediaSet::getMediaAccessId(), and zypp::source::MediaSet::release(). |
|
Returns information if media is on a shared physical device or not.
Definition at line 633 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. |
|
Ask the registered verifier if the attached media is the desired one or not.
Definition at line 644 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. |
|
Ask the specified verifier if the attached media is the desired one or not.
Definition at line 673 of file MediaManager.cc. References desired, zypp::media::g_Mutex, m_impl, verifier, and ZYPP_THROW. |
|
Return the local directory that corresponds to medias url, no matter if media isAttached or not. Files requested will be available at 'localRoot() + filename' or even better 'localPath( filename )'
Definition at line 704 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. |
|
Shortcut for 'localRoot() + pathname', but returns an empty pathname if media is not attached. Files provided will be available at 'localPath(filename)'.
Definition at line 717 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. Referenced by zypp::SourceFactory::listProducts(), zypp::source::SourceImpl::provideDirTree(), zypp::source::SourceImpl::provideJustFile(), and zypp::source::SourceImpl::tryToProvideFile(). |
|
Provide provide file denoted by relative path below of the 'attach point' of the specified media and the path prefix on the media.
Definition at line 731 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. Referenced by zypp::SourceFactory::listProducts(), zypp::source::SourceImpl::provideJustFile(), and zypp::source::SourceImpl::tryToProvideFile(). |
|
FIXME: see MediaAccess class.
Definition at line 747 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. |
|
FIXME: see MediaAccess class.
Definition at line 761 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. Referenced by zypp::source::SourceImpl::provideDirTree(). |
|
FIXME: see MediaAccess class.
Definition at line 775 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. Referenced by zypp::source::SourceImpl::releaseFile(). |
|
FIXME: see MediaAccess class.
Definition at line 789 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. Referenced by zypp::source::SourceImpl::releaseDir(). |
|
FIXME: see MediaAccess class.
Definition at line 804 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. Referenced by zypp::source::SourceImpl::releaseDir(). |
|
FIXME: see MediaAccess class.
Definition at line 818 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. Referenced by zypp::source::SourceImpl::dirInfo(). |
|
FIXME: see MediaAccess class.
Definition at line 835 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. |
|
Get the modification time of the /etc/mtab file.
Definition at line 853 of file MediaManager.cc. References zypp::media::g_Mutex, and zypp::media::MediaManager_Impl::getMountTableMTime(). Referenced by zypp::media::MediaHandler::checkAttached(). |
|
Get current mount entries from /etc/mtab file.
Definition at line 862 of file MediaManager.cc. References zypp::media::g_Mutex, and zypp::media::MediaManager_Impl::getMountEntries(). Referenced by zypp::media::MediaHandler::checkAttached(), and zypp::media::MediaHandler::forceRelaseAllMedia(). |
|
Check if the specified
Definition at line 871 of file MediaManager.cc. References zypp::filesystem::Pathname::asString(), zypp::filesystem::Pathname::empty(), zypp::media::g_Mutex, and m_impl. Referenced by zypp::media::MediaHandler::isUseableAttachPoint(). |
|
Definition at line 942 of file MediaManager.cc. References zypp::media::g_Mutex, and m_impl. Referenced by zypp::media::MediaHandler::dependsOnParent(). |
|
Definition at line 953 of file MediaManager.cc. References zypp::media::g_Mutex, m_impl, and zypp::media::AttachedMedia::mediaSource. |
|
Definition at line 975 of file MediaManager.cc. References zypp::media::g_Mutex, m_impl, and zypp::media::AttachedMedia::mediaSource. |
|
Definition at line 809 of file MediaManager.h. |
|
Static reference to the implementation (singleton).
Definition at line 850 of file MediaManager.h. Referenced by addVerifier(), attach(), close(), delVerifier(), dirInfo(), disconnect(), downloads(), findAttachedMedia(), forceReleaseShared(), getAttachedMedia(), isAttached(), isDesiredMedia(), isOpen(), isSharedMedia(), isUseableAttachPoint(), localPath(), localRoot(), MediaManager(), open(), protocol(), provideDir(), provideDirTree(), provideFile(), release(), releaseDir(), releaseFile(), releasePath(), and url(). |