FtpDTP.h

Go to the documentation of this file.
00001 //
00002 // Copyright 2002,2003 Sony Corporation 
00003 //
00004 // Permission to use, copy, modify, and redistribute this software for
00005 // non-commercial use is hereby granted.
00006 //
00007 // This software is provided "as is" without warranty of any kind,
00008 // either expressed or implied, including but not limited to the
00009 // implied warranties of fitness for a particular purpose.
00010 //
00011 
00012 #ifndef _FtpDTP_h_DEFINED
00013 #define _FtpDTP_h_DEFINED
00014 
00015 #include <stdio.h>
00016 #include <dirent.h>
00017 #include <EndpointTypes.h>
00018 #include <TCPEndpointMsg.h>
00019 #include "TCPConnection.h"
00020 #include "FtpConfig.h"
00021 
00022 #include "entry.h"
00023 #include "def.h"
00024 
00025 class FtpDTP
00026 {
00027 public:
00028     FtpDTP();
00029     virtual ~FtpDTP() {}
00030 
00031     OStatus Initialize(const OID& myoid,
00032                        const antStackRef& ipstack, void* index);
00033     bool ListenCont (TCPEndpointListenMsg*  listenMsg);
00034     bool ConnectCont(TCPEndpointConnectMsg* connectMsg);
00035     bool SendCont   (TCPEndpointSendMsg*    sendMsg);
00036     bool ReceiveCont(TCPEndpointReceiveMsg* receiveMsg);
00037     void CloseCont  (TCPEndpointCloseMsg*   closeMsg);
00038 
00039     OStatus Close  ();
00040 
00041     // Set
00042     void SetType(FTPDataType type) {dataType = type;};
00043     void SetUser(char *user);
00044     void SetHome(char *home);
00045 
00046     // Get
00047     ConnectionState GetState() {return connection.state;};
00048     FTPDataType GetType() {return dataType;};
00049     char * GetFilename() {return ftpFile;};
00050     char * GetDirectry() {return ftpDir;};
00051     size_t GetFileSize(char *name);
00052     char * GetUser() {return ftpUser;};
00053 
00054     // Method
00055     Port SetIP   (IPAddress ip);
00056     bool SetPort (char* ipport);
00057     bool Retrieve(char* filename);
00058     bool Store   (char* filename);
00059     bool ChangeDir(char* dir);
00060     bool MakeDir(char* dir);
00061     bool RemoveDir(char* dir);
00062     bool Delete(char* filename);
00063     bool List    (char* dir);
00064     bool RenameFrom(char *file);
00065     bool RenameTo(char *file);
00066     void ResetFilename();
00067 
00068 private:
00069     OStatus Listen ();
00070     OStatus Connect();
00071     OStatus Send   ();
00072     OStatus Receive();
00073 
00074     void Save(byte *data, int length, bool end = true);
00075     void DirNorm(char *dir);
00076     bool RetrieveSend();
00077     bool ListSend();
00078 
00079     OID myOID;
00080     antStackRef ipstackRef;
00081 
00082     // connection info
00083     IPAddress connectIP;
00084     Port      connectPort;
00085     FTPMethod method;
00086     bool passive;
00087 
00088     // File Info
00089     FTPDataType dataType;
00090     char ftpUser[MAX_STRING_LENGTH];
00091     char ftpHome[MAX_STRING_LENGTH];
00092     char ftpDir[MAX_STRING_LENGTH];
00093     char ftpFile[MAX_STRING_LENGTH];
00094     bool listLong;
00095     bool total;
00096     FILE* fp;
00097     DIR*  dirp;
00098 
00099     void* continuation;
00100     TCPConnection connection;
00101 };
00102 
00103 #endif /* _FtpDTP_h_DEFINED */

Generated on Sun Dec 2 23:04:28 2007 for openSDK by  doxygen 1.3.9.1