server.h

00001 #ifndef __SERVER_H__
00002 #define __SERVER_H__
00003 
00004 #include <util/string.h>
00005 #include <util/handler.h>
00006 #include <util/locker.h>
00007 #include <map>
00008 
00009 #include "transferthread.h"
00010 #include "queuenode.h"
00011 
00012 
00013 using namespace os;
00014 
00022 class Server
00023 {
00024 public:
00025         Server( const String& zURL, Handler* pcTarget, int nParallelConnections = 2 );
00026         virtual ~Server();
00027         int Close();
00028         
00029         int Lock();
00030         int Unlock();
00031         
00032         String GetServerAddress();
00033         
00034         int GetDirListing( const String& zPath, Handler* pcTarger );
00035         int GetRemote( const String& zRemoteSource, const String& zLocalDest );
00036         int SendLocal( const String& zLocalSource, const String& zRemoteDest );
00037 
00038 #if 0
00039         virtual int ParseDirListing( const String& zDir, char* pzBuf, size_t nSize, Handler* pcTarget, bool bInitial ); /* Parse the text of a dir listing into RemoteNodes and send it to the RemoteView */    
00040 #endif
00041 
00042         /* Methods for controlling active transfers, eg pause, cancel, resume */
00043         int PauseTransfer( int nNodeID );
00044         int ResumeTransfer( int nNodeID );
00045         int CancelTransfer( int nNodeID );
00046         
00047         /* Methods for manipulating the queue (ie raise/lower priority of a queued transfer) */
00048         /* TODO */
00049         
00050 private:
00051         /* These methods are only called from TransferThread */
00052 
00053         virtual CURLcode _SetupCurlHandle( CURL* pHandle );     /* Add our settings to the curl handle */
00054 
00055 private:
00056 
00057         String m_zURL; 
00059         Handler* m_pcTarget; 
00061         TransferThread* m_pcThread;     
00063         int m_nParallelConnections;     
00071         std::map< int, QueueNode* > m_apcQueue;
00072         
00073         
00074         int m_nNextID; 
00075         Locker* m_pcLock; 
00077         friend class TransferThread;
00078 };
00079 
00087 class FTPServer : public Server
00088 {
00089 public:
00090         FTPServer( const String& zURL, Handler* pcTarget, int nParallelConnections );
00091 
00092 //      int ParseDirListing( const String& zDir, char* pzBuf, size_t nSize, Handler* pcTarget, bool bInitial );
00093         
00094 private:
00095         ~FTPServer();
00096 //      CURLcode _SetupCurlHandle( CURL* pHandle );
00097 };
00098 
00099 
00100 
00101 #endif  /* __SERVER_H__ */
00102 
00103 
00104 
00105 

Generated on Sun Oct 26 21:16:23 2008 for Transferrer by  doxygen 1.5.1