libzypp  10.5.0
zypp::media::MediaCIFS Class Reference

Implementation class for CIFS MediaHandler. More...

#include <MediaCIFS.h>

Inheritance diagram for zypp::media::MediaCIFS:

List of all members.

Public Member Functions

 MediaCIFS (const Url &url_r, const Pathname &attach_point_hint_r)
virtual ~MediaCIFS ()
virtual bool isAttached () const
 True if media is attached.

Protected Member Functions

virtual void attachTo (bool next=false)
 Asserted that not already attached, and attachPoint is a directory.
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
 check if a file exists

Private Member Functions

bool authenticate (AuthData &authdata, bool firstTry) const

Detailed Description

Implementation class for CIFS MediaHandler.

NOTE: The implementation serves both, "smb" and "cifs" URL's, but passes "cifs" to the mount command in any case.

See also:
MediaHandler

Definition at line 32 of file MediaCIFS.h.


Constructor & Destructor Documentation

zypp::media::MediaCIFS::MediaCIFS ( const Url url_r,
const Pathname &  attach_point_hint_r 
)

Definition at line 101 of file MediaCIFS.cc.

virtual zypp::media::MediaCIFS::~MediaCIFS ( ) [inline, virtual]

Definition at line 50 of file MediaCIFS.h.


Member Function Documentation

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

Asserted that not already attached, and attachPoint is a directory.

Authentication: credentials can be specified in the following few ways (the first has the highest preference).

  • URL username:password
  • mountoptions URL query parameter (see man mount.cifs)
  • CredentialManager - either previously saved credentials will be used or the user will be promted for them via AuthenticationReport callback.
Note:
The implementation currently serves both, "smb" and and "cifs" URL's, but passes "cifs" to the mount command in any case.

Implements zypp::media::MediaHandler.

Definition at line 129 of file MediaCIFS.cc.

void zypp::media::MediaCIFS::releaseFrom ( const std::string &  ejectDev) [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.

Parameters:
ejectDevDevice to eject. None if empty.
Exceptions:
MediaException

Implements zypp::media::MediaHandler.

Definition at line 343 of file MediaCIFS.cc.

void zypp::media::MediaCIFS::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 356 of file MediaCIFS.cc.

void zypp::media::MediaCIFS::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 368 of file MediaCIFS.cc.

void zypp::media::MediaCIFS::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 381 of file MediaCIFS.cc.

void zypp::media::MediaCIFS::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 395 of file MediaCIFS.cc.

bool zypp::media::MediaCIFS::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 401 of file MediaCIFS.cc.

bool zypp::media::MediaCIFS::isAttached ( ) const [virtual]

True if media is attached.

Reimplemented from zypp::media::MediaHandler.

Definition at line 330 of file MediaCIFS.cc.

bool zypp::media::MediaCIFS::authenticate ( AuthData authdata,
bool  firstTry 
) const [private]
Todo:
need a way to pass different CredManagerOptions here
Todo:
add comma to the message for the next release
Todo:
find a way to save the url with changed username back to repoinfo or dont store urls with username (and either forbid more repos with the same url and different user, or return a set of credentials from CM and try them one by one)

Definition at line 406 of file MediaCIFS.cc.


The documentation for this class was generated from the following files: