MediaCurl.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_MEDIA_MEDIACURL_H
00013 #define ZYPP_MEDIA_MEDIACURL_H
00014 
00015 #include "zypp/media/MediaHandler.h"
00016 #include "zypp/ZYppCallbacks.h"
00017 
00018 #include <curl/curl.h>
00019 
00020 namespace zypp {
00021   namespace media {
00022 
00024 //
00025 //      CLASS NAME : MediaCurl
00030 class MediaCurl : public MediaHandler {
00031 
00032   protected:
00033 
00034     MEDIA_HANDLER_API;
00040     virtual void disconnectFrom();
00046     virtual void getFileCopy( const Pathname & srcFilename, const Pathname & targetFilename) const;
00047 
00053     virtual void doGetFileCopy( const Pathname & srcFilename, const Pathname & targetFilename, callback::SendReport<DownloadProgressReport> & _report) const;
00054 
00055 
00056     virtual bool checkAttachPoint(const Pathname &apoint) const;
00057 
00058   public:
00059 
00060     MediaCurl( const Url &      url_r,
00061                const Pathname & attach_point_hint_r );
00062 
00063     virtual ~MediaCurl() { try { release(); } catch(...) {} }
00064 
00065     static void setCookieFile( const Pathname & );
00066 
00067     class Callbacks
00068     {
00069       public:
00070         virtual ~Callbacks() {}
00071         virtual bool progress( int percent ) = 0;
00072     };
00073 
00074   protected:
00075 
00076     static int progressCallback( void *clientp, double dltotal, double dlnow,
00077                                  double ultotal, double ulnow );
00078 
00079   private:
00080     CURL *_curl;
00081     char _curlError[ CURL_ERROR_SIZE ];
00082 
00083     std::string _userpwd;
00084     std::string _proxy;
00085     std::string _proxyuserpwd;
00086     std::string _currentCookieFile;
00087     std::string _ca_path;
00088     long        _xfer_timeout;
00089 
00090     static Pathname _cookieFile;
00091     static std::string _agent;
00092 };
00093 
00095 
00096   } // namespace media
00097 } // namespace zypp
00098 
00099 #endif // ZYPP_MEDIA_MEDIACURL_H

Generated on Thu Jul 6 00:07:21 2006 for zypp by  doxygen 1.4.6