libzypp
10.5.0
|
00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #ifndef ZYPP_MEDIA_MEDIAARIA2C_H 00013 #define ZYPP_MEDIA_MEDIAARIA2C_H 00014 00015 #include "zypp/media/MediaHandler.h" 00016 #include "zypp/media/MediaCurl.h" 00017 #include "zypp/media/TransferSettings.h" 00018 #include "zypp/ZYppCallbacks.h" 00019 00020 namespace zypp { 00021 namespace media { 00022 00031 class MediaAria2c : public MediaCurl { 00032 00033 public: 00037 static bool existsAria2cmd(); 00038 00039 protected: 00040 virtual void attachTo (bool next = false); 00041 virtual void releaseFrom( const std::string & ejectDev ); 00042 virtual void getFile( const Pathname & filename ) const; 00043 virtual void getDir( const Pathname & dirname, bool recurse_r ) const; 00044 virtual void getDirInfo( std::list<std::string> & retlist, 00045 const Pathname & dirname, bool dots = true ) const; 00046 virtual void getDirInfo( filesystem::DirContent & retlist, 00047 const Pathname & dirname, bool dots = true ) const; 00053 virtual bool getDoesFileExist( const Pathname & filename ) const; 00054 00058 virtual bool doGetDoesFileExist( const Pathname & filename ) const; 00059 00065 virtual void disconnectFrom(); 00071 virtual void getFileCopy( const Pathname & srcFilename, const Pathname & targetFilename) const; 00072 00073 virtual bool checkAttachPoint(const Pathname &apoint) const; 00074 00075 public: 00076 00077 MediaAria2c( const Url & url_r, 00078 const Pathname & attach_point_hint_r ); 00079 00080 virtual ~MediaAria2c() { try { release(); } catch(...) {} } 00081 00082 //static void setCookieFile( const Pathname & ); 00083 00084 class Callbacks 00085 { 00086 public: 00087 virtual ~Callbacks() {} 00088 virtual bool progress( int percent ) = 0; 00089 }; 00090 00091 protected: 00092 00093 static const char *const agentString(); 00094 00095 private: 00096 00097 bool authenticate(const std::string & availAuthTypes, bool firstTry) const; 00098 00099 std::string _currentCookieFile; 00100 std::string _ca_path; 00101 static Pathname _cookieFile; 00102 00104 std::string getAria2cVersion(); 00105 static std::string _aria2cVersion; 00106 }; 00107 00109 00110 } // namespace media 00111 } // namespace zypp 00112 00113 #endif // ZYPP_MEDIA_MEDIAARIA2C_H