|
|
/*************************************************************************** xqlftp.h - description ------------------- begin : Sun Mar 10 2002 copyright : (C) 2002 by Raoul Markus email : raoul.markus@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef XQLFTP_H #define XQLFTP_H #define DEFAULT_PORT_NUM 21 #define PASSWORD_LENGTH 256 #define bzero(x,y) memset(x,0,y) #define bcopy(x,y,z) memcpy(y,x,z) #define INVALID_SOCKET (~0) enum { LS = 0, BINARY, ASCII, PWD, CD, OPEN, CLOSE, QUIT, LCD, LLS, LDIR, USER, SHELL, IGNORE_COMMAND, GET, PUT, HELP, RHELP, FTP_COMPLETE=1, /* these will be used later */ FTP_CONTINUE, FTP_ERROR }; /**class to provide ftp-connection *@author Raoul Markus */ class xqlFtp { public: xqlFtp(); ~xqlFtp(); void DoOpen(char *); void DoList(char *); void DoCD(const char *pDir); void DoLogin(char *pUser, char* pPasswd); void DoClose(void); void DoLCD( char *); void DoPut(const char * pLocalFile, const char * pRemoteFile ); void DoGet(const char *pRemoteFile, const char * pLocalFile); void DoLLS( char * command ); void DoBinary(); void DoAscii(); void DoPWD(); int CheckFds(char *); /** connects and performs login on the ftp-server */ void DoConnect(); /** sets the ftp login name for this ftp connection */ void setUserName(const char* pUser); /** sets the hostname */ void setHostname(const char * pHostname); /** sets the password for this ftp connection */ void setPasswd(const char * pPasswd); private: char szBuffer[1025]; /* buffer used to read/write */ char szUser[20]; /* stores username */ char szPass[256]; /* stores user password */ int Connected; /* flag for connect status */ int hListenSocket; int hControlSocket; int hDataSocket; /** */ char mHostname[1025]; int bSendPort; int ReadCommand; int bMode; int GetReply(); int GetLine(); void CleanUp(); int SendControlMsg(char *, int); int SendDataMsg( char *szBuffer, int len); int ConnectToServer(char *name, char *port); int GetListenSocket(); int InitWinsock(); int AcceptConnection(); void CloseControlConnection( void ); void CloseDataConnection( int hDataSocket ); void CloseListenSocket(); int ReadDataMsg( char *szBuffer, int len); void GetPassword( char *szPass ); int GetUnixInput(char *command); int GetWin32Input( char *command); void GetFile(const char *fname, const char* pToName); void PutFile(const char *fname, const char * pToFile); int ReadControlMsg( char *szBuffer, int len); int CheckControlMsg( char *szPtr, int len); int CheckInput(); }; #endif
Generated by: markus on hobbes on Fri Mar 29 16:15:24 2002, using kdoc 2.0a53. |