Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

MediaCurl.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013    File:        MediaCurl.h
00014 
00015    Author:      Klaus Kaempf <kkaempf@suse.de>
00016    Maintainer:  Klaus Kaempf <kkaempf@suse.de>
00017 
00018    Purpose:     Implementation class for FTP, HTTP and HTTPS MediaHandler
00019 
00020 /-*/
00021 #ifndef MediaCurl_h
00022 #define MediaCurl_h
00023 
00024 #include <y2pm/MediaHandler.h>
00025 
00026 #include <curl/curl.h>
00027 
00029 //
00030 //      CLASS NAME : MediaCurl
00035 class MediaCurl : public MediaHandler {
00036 
00037   protected:
00038 
00039     MEDIA_HANDLER_API;
00040 
00041     virtual PMError disconnectFrom();
00042     virtual PMError getFileCopy( const Pathname & srcFilename, const Pathname & targetFilename) const;
00043 
00044 
00045   public:
00046 
00047     MediaCurl( const Url &      url_r,
00048                const Pathname & attach_point_hint_r );
00049 
00050     virtual ~MediaCurl() { release(); }
00051 
00052     static void setCookieFile( const Pathname & );
00053 
00054     class Callbacks
00055     {
00056       public:
00057         virtual bool progress( int percent ) = 0;
00058     };
00059 
00060     static void setCallbacks( Callbacks *c ) { _callbacks = c; }
00061 
00062   protected:
00063 
00064     static int progressCallback( void *clientp, double dltotal, double dlnow,
00065                                  double ultotal, double ulnow );
00066 
00067   private:
00068     CURL *_curl;
00069     char _curlError[ CURL_ERROR_SIZE ];
00070 
00071     std::string _userpwd;
00072     std::string _proxy;
00073     std::string _proxyuserpwd;
00074     std::string _currentCookieFile;
00075 
00076     static Pathname _cookieFile;
00077 
00078     static Callbacks *_callbacks;
00079 
00080     bool _connected;
00081 };
00082 
00084 
00085 #endif // MediaCurl_h

Generated on Fri Nov 9 14:30:31 2007 for yast2-packagemanager by doxygen 1.3.6