Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2006 TightVNC Team. All Rights Reserved. |
| 2 | * |
| 3 | * Developed by Dennis Syrovatsky |
| 4 | * |
| 5 | * This is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This software is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this software; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 18 | * USA. |
| 19 | * |
Peter Åstrand | 7877cd6 | 2009-02-25 16:15:48 +0000 | [diff] [blame^] | 20 | * |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 21 | * |
| 22 | */ |
| 23 | |
| 24 | // -=- SFileTransfer.h |
| 25 | |
| 26 | #ifndef __RFB_SFILETRANSFER_H__ |
| 27 | #define __RFB_SFILETRANSFER_H__ |
| 28 | |
| 29 | #include <network/Socket.h> |
| 30 | #include <rfb/SFTMsgReader.h> |
| 31 | #include <rfb/SFTMsgWriter.h> |
| 32 | #include <rfb/FileWriter.h> |
| 33 | #include <rfb/FileReader.h> |
| 34 | #include <rfb/FileInfo.h> |
| 35 | #include <rfb/fttypes.h> |
| 36 | |
| 37 | namespace rfb { |
| 38 | class SFileTransfer |
| 39 | { |
| 40 | public: |
| 41 | SFileTransfer(network::Socket *sock); |
| 42 | virtual ~SFileTransfer(); |
| 43 | |
| 44 | bool processMessages(int type); |
| 45 | bool sendFileDownloadPortion(); |
| 46 | |
| 47 | protected: |
| 48 | bool processFileListRequest(); |
| 49 | bool processFileDownloadRequest(); |
| 50 | bool processFileUploadRequest(); |
| 51 | bool processFileUploadData(); |
| 52 | bool processFileDownloadCancel(); |
| 53 | bool processFileUploadFailed(); |
| 54 | bool processFileCreateDirRequest(); |
| 55 | bool processFileDirSizeRequest(); |
| 56 | bool processFileRenameRequest(); |
| 57 | bool processFileDeleteRequest(); |
| 58 | |
| 59 | virtual bool initDownloadCallback(); |
| 60 | virtual bool makeFileList(char *pszPath, FileInfo *pFI, bool bDirOnly); |
| 61 | virtual bool convertPathFromNet(char *pszPath); |
| 62 | |
| 63 | virtual bool deleteIt(char *pszPath); |
| 64 | virtual bool renameIt(char *pszOldPath, char *pszNewPath); |
| 65 | virtual bool createDir(char *pszPath); |
| 66 | |
| 67 | virtual bool getDirSize(char *pszName, unsigned short *pHighSize16, unsigned int *pLowSize32); |
| 68 | |
| 69 | bool m_bUploadStarted; |
| 70 | bool m_bDownloadStarted; |
| 71 | |
| 72 | private: |
| 73 | SFTMsgReader m_reader; |
| 74 | SFTMsgWriter m_writer; |
| 75 | |
| 76 | FileWriter m_fileWriter; |
| 77 | FileReader m_fileReader; |
| 78 | |
| 79 | network::Socket *m_pSocket; |
| 80 | }; |
| 81 | } |
| 82 | |
| 83 | #endif // __RFB_SFILETRANSFER_H__ |