libzypp  11.13.5
MediaAria2c.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_MEDIA_MEDIAARIA2C_H
13 #define ZYPP_MEDIA_MEDIAARIA2C_H
14 
16 #include "zypp/media/MediaCurl.h"
18 #include "zypp/ZYppCallbacks.h"
19 
20 namespace zypp {
21  namespace media {
22 
31 class MediaAria2c : public MediaCurl {
32 
33  public:
37  static bool existsAria2cmd();
38 
39  protected:
40  virtual void attachTo (bool next = false);
41  virtual void releaseFrom( const std::string & ejectDev );
42  virtual void getFile( const Pathname & filename ) const;
43  virtual void getDir( const Pathname & dirname, bool recurse_r ) const;
44  virtual void getDirInfo( std::list<std::string> & retlist,
45  const Pathname & dirname, bool dots = true ) const;
46  virtual void getDirInfo( filesystem::DirContent & retlist,
47  const Pathname & dirname, bool dots = true ) const;
53  virtual bool getDoesFileExist( const Pathname & filename ) const;
54 
58  virtual bool doGetDoesFileExist( const Pathname & filename ) const;
59 
65  virtual void disconnectFrom();
71  virtual void getFileCopy( const Pathname & srcFilename, const Pathname & targetFilename) const;
72 
73  virtual bool checkAttachPoint(const Pathname &apoint) const;
74 
75  public:
76 
77  MediaAria2c( const Url & url_r,
78  const Pathname & attach_point_hint_r );
79 
80  virtual ~MediaAria2c() { try { release(); } catch(...) {} }
81 
82  //static void setCookieFile( const Pathname & );
83 
84  class Callbacks
85  {
86  public:
87  virtual ~Callbacks() {}
88  virtual bool progress( int percent ) = 0;
89  };
90 
91  protected:
92 
93  static const char *const agentString();
94 
95  private:
96 
97  bool authenticate(const std::string & availAuthTypes, bool firstTry) const;
98 
99  std::string _currentCookieFile;
100  std::string _ca_path;
101  static Pathname _cookieFile;
102 
104  std::string getAria2cVersion();
105  static std::string _aria2cVersion;
106 };
107 
109 
110  } // namespace media
111 } // namespace zypp
112 
113 #endif // ZYPP_MEDIA_MEDIAARIA2C_H