FileQueue.h
资源名称:FTP总集.rar [点击查看]
上传用户:tjfeida
上传日期:2013-03-10
资源大小:1917k
文件大小:4k
源码类别:
Ftp客户端
开发平台:
Visual C++
- // FileQueue.h: interface for the CFileQueue class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_FILEQUEUE_H__B42073D4_CC80_41D1_BF14_AA3246344119__INCLUDED_)
- #define AFX_FILEQUEUE_H__B42073D4_CC80_41D1_BF14_AA3246344119__INCLUDED_
- /*********************************************
- **该文件是属于WolfFTP工程中的。如果有什么问题
- **请联系
- ** tablejiang@21cn.com
- **或者访问
- ** http://wolfftp.51.net
- **以得到最新的支持。
- *********************************************/
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include "share.h"
- #include "Winsock.h"
- //////////////////////////////////////////////////
- // Struct define //
- //////////////////////////////////////////////////
- typedef struct
- {
- char sitename[MAX_PATH] ; //this site name .
- char host[50] ; // host machine ip address .
- UINT hosttype ; // the host OS type .
- /*
- 0 : Auto-Detect .
- 1 : UNIX .
- 2 : Windows NT .
- 3 : ...
- */
- char user[50] ; // username
- char pass[50] ; // password
- char remotepath[MAX_PATH] ; //Initial remote path .
- char localpath[MAX_PATH] ; //Initial local path .
- UINT logintype ; //user login type .
- /*
- 0 : Normal login . need user(name) and pass(word).
- 1 : Anonymous login . needn't username and password .
- */
- UINT transfertype ;
- /*
- 0 : Auto-Detect .
- 1 : ASCII .
- 2 : Binary .
- */
- BOOL brokendownload ;
- /*
- Is this host suppost broken continue transf
- */
- }SITEINFO ;
- #define FILE_STATE_READY 0
- #define FILE_STATE_ERROR 1
- #define FILE_STATE_STOP 2
- #define FILE_STATE_RUNNING 3
- #define FILE_STATE_PAUSE 4
- struct FTPFILEINFO
- {
- SITEINFO site ;
- char remotepath[MAX_PATH] ;
- char remotefilename[MAX_PATH] ;
- char localpath[MAX_PATH] ;
- char localfilename[MAX_PATH] ;
- __int64 startpos ;
- __int64 endpos ;
- __int64 filesize;
- char filetime[50] ;
- HWND hWnd ;
- SOCKET hSocket ;
- BOOL bfileput ;
- BOOL bIsDirectory ;
- UINT state ;
- /*
- 0 : ready .
- 1 : error .
- 2 : stop .
- */
- int iExistAction ;
- FTPFILEINFO* pNext ;
- };
- /***********************************************************
- ** @Description:
- ** this class is used for store the transmit file info.
- ** Because this file queue will be readed by multithread ,
- ** so the critical section technique is used in this class .
- ** And the file queue is a single chain .
- **
- ** @Note:
- ** Interface function :
- **
- ** addItem() : add a delete file to queue
- ** DeleteItem( ) : delete a file from queue .
- ** DeleteAllItem( ) : delete all files of queue .
- ** IsInFileQueue( ) : is specify file in this file queue .
- ** IsEmpty( ) : file queue is empty .
- ** GetNextItem( ) : Get next useful item .
- **
- **
- ** @Author :Table.JHM.太子
- ** e-mail: tablejiang@21cn.com
- ** Date: 2001 4 10
- *************************************************************/
- class CFileQueue
- {
- public:
- CFileQueue();
- virtual ~CFileQueue();
- public:
- BOOL SetSaveFileName( LPCTSTR filename );
- FTPFILEINFO* GetSameSiteFile( FTPFILEINFO* pFile );
- void UnLockTheFileList( );
- void LockTheFileList( );
- BOOL SetItemState( int iState , FTPFILEINFO* pFileInfo );
- FTPFILEINFO* GetNextItem( );
- BOOL IsEmpty( );
- BOOL DeleteAllFileQueue( );
- BOOL IsInFileQueue( FTPFILEINFO* pFileInfo );
- BOOL DeleteItem( FTPFILEINFO* pFileInfo );
- BOOL AddItem( FTPFILEINFO* pFileInfo );
- FTPFILEINFO* m_pFileTransmitQueue ;
- protected:
- BOOL FtpFileCmp( FTPFILEINFO * pItem1 , FTPFILEINFO * pItem2 );
- BOOL LoadQueue( );
- BOOL SaveQueue( );
- CRITICAL_SECTION m_cs ; //let thread can read the queue mutex
- BOOL m_bLetRun ;
- char m_SaveFileName[MAX_PATH] ; //the file queue save local file name..
- public:
- HWND m_hParentWnd ; //if file queue change ,we use this
- //handle notify parent window.
- };
- #endif // !defined(AFX_FILEQUEUE_H__B42073D4_CC80_41D1_BF14_AA3246344119__INCLUDED_)