18 #ifndef INCLUDE_RCF_FILETRANSFERSERVICE_HPP 19 #define INCLUDE_RCF_FILETRANSFERSERVICE_HPP 26 #include <RCF/Service.hpp> 28 #include <SF/vector.hpp> 45 class FileTransferService;
48 class FileDownloadInfo;
53 class FileDownloadInfo;
55 typedef std::shared_ptr<FileUploadInfo> FileUploadInfoPtr;
56 typedef std::shared_ptr<FileDownloadInfo> FileDownloadInfoPtr;
58 typedef std::function<bool(const FileUploadInfo &)> UploadAccessCallback;
59 typedef std::function<bool(const FileDownloadInfo &)> DownloadAccessCallback;
62 typedef std::shared_ptr<FileIoRequest> FileIoRequestPtr;
71 std::string getUploadId()
const;
73 FileManifest mManifest;
74 std::uint32_t mCurrentFile;
75 std::uint64_t mCurrentPos;
80 friend class FileTransferService;
82 FileHandlePtr mFileHandle;
84 FileIoRequestPtr mWriteOp;
88 std::uint32_t mTimeStampMs;
90 std::uint32_t mSessionLocalId;
91 std::string mUploadId;
104 FileManifest mManifest;
105 std::uint32_t mCurrentFile;
106 std::uint64_t mCurrentPos;
111 friend class FileTransferService;
113 FileHandlePtr mFileHandle;
114 Path mFileHandlePath;
115 FileIoRequestPtr mReadOp;
122 Timer mTransferWindowTimer;
123 std::uint32_t mTransferWindowBytesSoFar;
124 std::uint32_t mTransferWindowBytesTotal;
126 std::uint32_t mSessionLocalId;
127 std::string mServerDownloadId;
132 typedef std::shared_ptr<FileUploadInfo> FileUploadInfoPtr;
133 typedef std::shared_ptr<FileDownloadInfo> FileDownloadInfoPtr;
136 class FileTransferRequest;
145 class RCF_EXPORT FileTransferService :
public I_Service
148 FileTransferService();
151 typedef BandwidthQuotaCallback UploadQuotaCallback;
152 typedef BandwidthQuotaCallback DownloadQuotaCallback;
155 void setTransferWindowS(std::uint32_t transferWindowS);
156 std::uint32_t getTransferWindowS();
162 const FileManifest & manifest,
163 const std::vector<FileChunk> & chunks,
164 FileChunk & startPos,
165 std::uint32_t & maxMessageLength,
166 std::string & uploadId,
168 std::uint32_t sessionLocalId);
171 const std::vector<FileChunk> & chunks,
172 std::uint32_t & bps);
175 FileManifest & manifest,
176 const FileTransferRequest & request,
177 std::vector<FileChunk> & chunks,
178 std::uint32_t & maxMessageLength,
180 std::uint32_t sessionLocalId,
181 const std::string & serverDownloadId);
184 const FileChunk & startPos);
187 const FileTransferRequest & request,
188 std::vector<FileChunk> & chunks,
189 std::uint32_t & adviseWaitMs,
190 std::uint32_t & bps);
199 void addFileTransfer(
const std::string & transferId,
const TransferInfo & transferInfo);
200 void removeFileTransfer(
const std::string & transferId);
201 TransferInfo findFileTransfer(
const std::string & transferId);
203 Mutex mFileTransfersInProgressMutex;
204 std::map<std::string, TransferInfo> mFileTransfersInProgress;
206 void checkForUploadCompletion(FileUploadInfoPtr uploadInfoPtr);
213 Path mUploadDirectory;
218 std::uint32_t mTransferWindowS;
223 BandwidthQuotaCallback mUploadQuotaCallback;
224 BandwidthQuotaCallback mDownloadQuotaCallback;
227 typedef std::shared_ptr<FileTransferService> FileTransferServicePtr;
231 #endif // ! INCLUDE_RCF_FILETRANSFERSERVICE_HPP Represents an archive, in which serialized objects are stored.
Definition: Archive.hpp:31
RCF_FILESYSTEM_NS::path Path
Typedef for standard C++ path type.
Definition: FileSystem.hpp:31
std::function< BandwidthQuotaPtr(RcfSession &)> BandwidthQuotaCallback
Describes user-provided callback functions for assigning custom bandwidth quotas to a RcfSession...
Definition: RcfFwd.hpp:140
std::function< void(RcfSession &, FileDownloadInfo &)> DownloadProgressCallback
Describes user-provided callback functions for server-side monitoring of a file download.
Definition: RcfFwd.hpp:134
Represents a server side session, associated with a client connection.
Definition: RcfSession.hpp:64
std::shared_ptr< BandwidthQuota > BandwidthQuotaPtr
Reference counted wrapper for RCF::BandwidthQuota.
Definition: RcfFwd.hpp:127
Server-side information about a file download taking place from a RcfServer.
Definition: FileTransferService.hpp:97
Definition: ByteBuffer.hpp:188
Provides RCF server-side functionality.
Definition: RcfServer.hpp:53
std::function< void(RcfSession &, FileUploadInfo &)> UploadProgressCallback
Describes user-provided callback functions for server-side monitoring of a file upload.
Definition: RcfFwd.hpp:137
Definition: ByteBuffer.hpp:39
Definition: AmiIoHandler.hpp:23
Server-side information about a file upload taking place to a RcfServer.
Definition: FileTransferService.hpp:65