Cleanup and remove deprecated interface methods
[platform/upstream/libzypp.git] / zypp / media / MediaSMB.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/media/MediaSMB.h
10  *
11 */
12 #ifndef ZYPP_MEDIA_MEDIASMB_H
13 #define ZYPP_MEDIA_MEDIASMB_H
14
15 #include "zypp/media/MediaHandler.h"
16
17 namespace zypp {
18   namespace media {
19
20     class AuthData;
21
22     ///////////////////////////////////////////////////////////////////
23     //
24     //  CLASS NAME : MediaSMB
25     /**
26      * @short Implementation class for SMB MediaHandler
27      *
28      * NOTE: The implementation currently serves both, "smb"
29      * and "cifs" URL's, but passes "cifs" to the mount command
30      * in any case.
31      * @see MediaHandler
32      **/
33     class MediaSMB : public MediaHandler {
34
35     private:
36
37       /**
38        * vfstype for mount. This is either "smbfs"
39        * or "cifs" (rewritten by MediaCIFS).
40        * Obsolete: vfstype is allways "cifs".
41        **/
42       const char* _vfstype;
43
44     protected:
45
46       virtual void attachTo (bool next = false);
47       virtual void releaseFrom( const std::string & ejectDev );
48       virtual void getFile( const Pathname & filename ) const;
49       virtual void getDir( const Pathname & dirname, bool recurse_r ) const;
50       virtual void getDirInfo( std::list<std::string> & retlist,
51                                const Pathname & dirname, bool dots = true ) const;
52       virtual void getDirInfo( filesystem::DirContent & retlist,
53                                const Pathname & dirname, bool dots = true ) const;
54       virtual bool getDoesFileExist( const Pathname & filename ) const;
55
56       /**
57        * MediaCIFS rewrites the vfstype to "cifs"
58        * within it's constructor.
59        **/
60       void mountAsCIFS() { _vfstype = "cifs"; }
61
62     public:
63       MediaSMB( const Url&       url_r,
64                 const Pathname & attach_point_hint_r );
65
66       virtual ~MediaSMB() { try { release(); } catch(...) {} }
67
68       virtual bool isAttached() const;
69
70     private:
71       bool authenticate( AuthData & authdata, bool firstTry ) const;
72     };
73
74 ///////////////////////////////////////////////////////////////////A
75   } // namespace media
76 } // namespace zypp
77
78 #endif // ZYPP_MEDIA_MEDIASMB_H