#ifndef ZYPP_MEDIA_MEDIAMANAGER_H
#define ZYPP_MEDIA_MEDIAMANAGER_H
-#include <zypp/media/MediaAccess.h>
+#include "zypp/media/MediaAccess.h"
-#include <zypp/base/Deprecated.h>
-#include <zypp/base/NonCopyable.h>
-#include <zypp/base/PtrTypes.h>
-#include <zypp/Pathname.h>
-#include <zypp/Url.h>
+#include "zypp/APIConfig.h"
+#include "zypp/base/NonCopyable.h"
+#include "zypp/base/PtrTypes.h"
+#include "zypp/Pathname.h"
+#include "zypp/Url.h"
#include <list>
* The MediaManager uses several media access handlers (backends),
* that can be specified by a Media Access URL in its open() method.
*
- * All URL's may contain following query parameters, that are
+ * All URLs may contain following query parameters, that are
* reserved by the Source classes and unused/ignored by the media
* manager:
* - <tt>alias</tt>: A source specific media alias string.
* Mandatory parameter specifying the name of the block device of
* the partition to mount.
* - <tt>filesystem</tt>:
- * The name of the filesystem. Defaults to "auto".
+ * The name of the filesystem. Defaults to "auto".
* - Authority:
* A non-empty authority URL component is not allowed.
* - Path name:
* "file:/directory/name"
* \endcode
* - Query parameters:
- * none
+ * none
* - Authority:
* A non-empty authority URL component (e.g. containing
* a host name) is not allowed.
*
* "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"
* \endcode
* - Query parameters:
* Optional parameter specifying the URL to the directory containing
* the iso file.<br>
* The supported URL schemes are: <i><b>hd</b>, <b>dir</b>,
- * <b>file</b>, <b>nfs</b>, <b>smb</b>, <b>cifs</b>.</i>
+ * <b>file</b>, <b>nfs</b>, <b>nfs4</b>, <b>smb</b>, <b>cifs</b>.</i>
* - <tt>mnt</tt>:
* Optional parameter specifying the prefered attach point for the
* source media url.
* - <tt>filesystem</tt>:
* Optional name of the filesystem used in the iso file. Defaults
- * to "auto".
+ * to "auto".
* - Authority:
* A non-empty authority URL component is not allowed.
* - Path name:
* The access handler for media on NFS exported directory tree.
* - Scheme:
* - <b>nfs</b>
+ * - <b>nfs</b>
* - Examples:
* \code
* "nfs://nfs-server/exported/path"
* "nfs://nfs-server/exported/path?mountoptions=ro"
+ * "nfs://nfs-server/exported/path&type=nfs4"
+ * "nfs4://nfs-server/exported/path"
* \endcode
* - Query parameters:
* - <tt>mountoptions</tt>:
* The mount options separated by comma ','.
* Default is the "ro" option.
- * - Authority:
+ * - <tt>type=nfs4</tt>:
+ * Whether to mount as nfs4. This is the default for scheme nfs4.
+ * - Authority:
* The authority component has to provide a hostname.
* Username, password and port are currently ignored.
* - Path name:
* \code
* "cifs://servername/share/path/on/the/share"
* "cifs://username:passwd@servername/share/path/on/the/share?mountoptions=ro"
+ * "cifs://username:passwd@servername/share/path/on/the/share?mountoptions=noguest"
* "smb://servername/share/path/on/the/share"
* "smb://username:passwd@servername/share/path/on/the/share?mountoptions=ro"
* \endcode
* - Query parameters:
* - <tt>mountoptions</tt>:
* The mount options separated by a comma ','. Default are the
- * "ro" and "guest" options.
- * - <tt>workgroup</tt>:
+ * "ro" and "guest" options. Specify "noguest" to turn off
+ * "guest". This is necessary if Samba is configured to reject
+ * guest connections.
+ * - <tt>workgroup</tt> or <tt>domain</tt>:
* The name of the workgroup.
* - <tt>username</tt>:
* Alternative username to username in URL authority.
* - <tt>password</tt>:
* Alternative password to password in URL authority.
* - <tt>user</tt>:
- * Alternative username (cifs specific variant?)
+ * Alternative username (cifs specific variant)
* - <tt>pass</tt>:
- * Alternative password (cifs specific variant?)
+ * Alternative password (cifs specific variant)
* - Authority:
* The authority component has to provide a hostname. Optionally
* also a username and password.
* Mandatory URL component, that specifies the share name with
* optional subdirectory, where the desired files are located.
*
- * \subsection MediaCurl_Url MediaCurl - FTP/HTTP directory tree (ftp, http, https)
+ * \subsection MediaCurl_Url MediaCurl - FTP/HTTP directory tree (ftp, tftp, http, https)
* The access handler to media directory tree on a ftp/http server.
* - Scheme:
* - <b>ftp</b>
+ * - <b>tftp</b>
* - <b>http</b>
* - <b>https</b>
* - Examples:
* "ftp://user:pass@server/%2fhome/user/path/to/media" -- both
* URLs points to the same directory on the server.
* - Query parameters:
+ * - <tt>cookies</tt>:
+ * Turn off using cookies by setting it to "0" (or false, no, off).
* - <tt>proxy</tt>:
* A proxy hostname or hostname and port separated by ':'.
+ * Setting the hostname to '_none_' explicitly disables the use of a
+ * proxy even if configured in /etc/sysconfig/proxy or the environment.
* - <tt>proxyport</tt>:
* Alternative way to provide the proxy port.
* - <tt>proxyuser</tt>:
* enables ssl verify, this is the default
* and is equivalent to 'host,peer'.
* - 'host': The server is considered the intended one, when the
- * 'Common Name' field or a 'Subject Alternate Name' field in
+ * 'Common Name' field or a 'Subject Alternate Name' field in
* the certificate matches the host name in the URL.
* - 'peer': Verifies whether the certificate provided by the
* server is authentic against the chain of digital signatures
- * found in <tt>ssl_capath</tt>.
+ * found in <tt>ssl_capath</tt>.
+ * - <tt>ssl_clientcert</tt>
+ * Path to the ssl client certificate for authentication to a repo (CURLOPT_SSLCERT).
+ * - <tt>ssl_clientkey</tt>
+ * Path to the ssl client key for authentication to a repo (CURLOPT_SSLKEY).
* - <tt>timeout</tt>:
* Transfer timeout in seconds between 0 and 3600, 0 disables
* the timeout, default timeout is 180 seconds.
* 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.
+ * by the curl library.
+ * - <tt>mediahandler</tt>: Set the mediahandler for this url
+ * Valid values are: 'curl', 'multicurl'
* - Authority:
* The authority component has to provide a hostname. Optionally
* also a username and password. In case of the 'ftp' scheme,
* proxy settings to curl, but curl fallbacks to use the content of
* the <tt>http_proxy</tt>, <tt>ftp_proxy</tt>, etc environment
* variables.
+ *
+ * \subsection MediaPlugin_Url MediaPlugin - custom media handler
+ * Media access is delegated to a script located in the libzypp
+ * media plugin directory. The URLs query options are translated
+ * into commandline arguments passed to the script.
+ * - Scheme:
+ * - <b>plugin</b>
+ * - Examples:
+ * \code
+ * "plugin:script?loptv=lvalue&v=optv&lopt=&o&=foo"
+ * \__________/ \____/ \___/ | \_/
+ * __________/__ ____/_ _|_ \ \___
+ * / \ / \ / \ /\ / \
+ * script --loptv "lvalue" -v "optv" --lopt -o -- foo
+ * \endcode
+ * - Query parameters:
+ * - The URLs query options are translated into commandline
+ * arguments passed to the script.
+ * - \b Note: No option may appear twice, as the <tt>(option,value)</tt>
+ * pairs are stored in a hash.
+ * - \b Note: The order in which the query options are passes to the
+ * script is arbitrary, except for an option with an empty key, which
+ * is translated into <tt>'-- value'</tt> and passed as final option.
+ * - <tt>'c[=[value]]'</tt> ist passed as <tt>'-c [value]'</tt>
+ * - <tt>'word[=[value]]'</tt> ist passed as <tt>'--word [value]'</tt>
+ * - <tt>'[=value]'</tt> ist passed as last args as <tt>'-- [value]'</tt>
+ * - \c script<->libzypp communication:
+ * - \TODO to be documented.
*/
class MediaManager: private zypp::base::NonCopyable
{
downloads(MediaAccessId accessId) const;
/**
- * Hint if files will be downloaded when using the
- * specified media \p url.
- *
- * @note This hint is based on the \p url scheme
- * only and does not imply, that the URL is valid.
- *
- * @param url The media URL to check.
- * @return True, if the files are downloaded.
- */
- static bool
- downloads(const Url &url);
-
- /**
* Returns the \ref MediaAccessUrl of the media access id.
*
* \param accessId The media access id to query.
setAttachPrefix(const Pathname &attach_prefix);
/**
- * Attach the media using the concrete handler.
+ * Attach the media using the concrete handler (checks all devices).
*
* Remember to release() or close() each id you've attached
* and not need any more. Attach is like an open of a file!
*
* \param accessId A media access id.
- * \param next Whether to try the next drive if avaliable.
* \throws MediaNotOpenException for invalid access id.
- * \deprecated in favor of attachDesiredMedia(MediaAccessId) which looks
- * for a desirable media on all available devices.
*/
void
- attach(MediaAccessId accessId, bool next = false) ZYPP_DEPRECATED;
-
- void
- attachDesiredMedia(MediaAccessId accessId);
+ attach(MediaAccessId accessId);
/**
* Release the attached media and optionally eject.
* If the \p ejectDev parameter is not empty all other access
* id's are released and the specified drive (CD/DVD drive) is
* ejected.
- *
+ *
* \param accessId A media access id.
* \param ejectDev Device to eject. None if empty.
* \throws MediaNotOpenException for invalid access id.
* Simple check, based on media's URL scheme, telling whether the
* it is possible to physically change the media inside its drive, like
* CDs or DVDs. Useful to decide whether to request media change from
- * user or not.
- *
+ * user or not.
+ *
* \param accessId The media access id.
* \return <tt>false</tt> if the media is not changeable,
* <tt>true</tt> otherwise.
* Fill in a vector of detected ejectable devices and the index of the
* currently attached device within the vector. The contents of the vector
* are the device names (/dev/cdrom and such).
- *
+ *
* \param accessId Medium id.
* \param devices vector to load with the device names
* \param index index of the currently used device in the devices vector
std::vector<std::string> & devices,
unsigned int & index) const;
+ void
+ setDeltafile(MediaAccessId accessId,
+ const Pathname &filename ) const;
+
public:
/**
* Get the modification time of the /etc/mtab file.
bool
isUseableAttachPoint(const Pathname &path,
bool mtab=true) const;
-
+
private:
friend class MediaHandler;