Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members

FXFtpClient.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                  FTP client                                                   *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2003 by Mathew Robertson.   All Rights Reserved.                *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************/
00022 #ifndef FXFTPCLIENT_H
00023 #define FXFTPCLIENT_H
00024 
00025 #ifndef FXIOSLAVE_H
00026 #include "FXIOSlave.h"
00027 #endif
00028 namespace FXEX {
00029 #define FTP_PORT 21
00030 
00031 /**
00032  * FTP client implementation details:
00033  * - notifies application of new data _after_ all further processing (makes use of a chore) so as
00034  *   to optimise network throughput, and to allow the app to update the GUI
00035  * - apps should ignore the return code of most functions; since a socket is asynchronous,
00036  *   more than likely, the result of a command will be 'delayed' -> implies we get to 'handle'
00037  *   the error events rather than looking for a return code
00038  */
00039 class FXAPI FXFtpClient : public FXIOSlave {
00040     FXDECLARE(FXFtpClient)
00041 
00042   private:
00043     FXSocketClient *connection;
00044 
00045   protected:
00046     FXFtpClient(){}
00047 
00048   public:
00049     enum{
00050       ID_FTP_CLIENT=FXIOSlave::ID_LAST,
00051       ID_DATA_FORWARD,
00052       ID_LAST
00053       };
00054 
00055   public:
00056     long onOpened(FXObject*,FXSelector,void*);
00057     long onClosed(FXObject*,FXSelector,void*);
00058     long onDestroyed(FXObject*,FXSelector,void*);
00059     long onDataIncoming(FXObject*,FXSelector,void*);
00060     long onDataForward(FXObject*,FXSelector,void*);
00061 
00062   public:
00063     /// create a new ftp connection
00064     FXFtpClient(FXApp *a,const FXString& host="localhost",FXObject *tgt=NULL,FXSelector=0,FXint prt=FTP_PORT);
00065 
00066     /// open the connection
00067     virtual void open();
00068 
00069     /// close the connection
00070     virtual void close();
00071 
00072     /// list the current directory
00073     virtual void list();
00074 
00075     /// dtor
00076     virtual ~FXFtpClient();
00077   };
00078 
00079 } // namespace FXEX
00080 #endif // FXFTPCLIENT_H