3.3.1.5 RDC File Transfer
A transfer over the RDC protocol starts and finishes similarly to a direct file transfer. The client first uses an InitializeFileTransferAsync to establish a context handle for the file, and then calls RdcGetSignatures to retrieve the signatures (possibly at recursive levels) that pertain to the file being transferred. To retrieve file data at given offsets and lengths, the client uses RdcPushSourceNeeds to indicate which data ranges are requested from the file to be transferred. Notice that several ranges might be coalesced in a single call to RdcPushSourceNeeds. To retrieve actual file data, the client uses separate calls, RdcGetFileData, or a single call to RdcGetFileDataAsync. When the file transfer is done, the client is required to use RdcClose to context handle gracefully.
RDC allows the application to choose the recursion depth arbitrarily. Choosing an optimum recursion depth is difficult because many factors are involved, including the available network bandwidth and network latency, the speed and load of the disk storage systems on the server and client machines, as well as available CPU time for computing signatures, if necessary.<35>
There are few constraints on the order in which a client uses these APIs. Signature data and file data can be downloaded concurrently.
The DFS-R server requires that the client follow the following rules:
A client initializes RDC transfer using InitializeFileTransferAsync, specifying that it wants to perform a download using RDC.
If a server determines that the file to be served is not suitable for the RDC protocol, it sets rdcSignatureLevels to 0 in the FRS_RDC_FILEINFO structure. The client then has to complete the download by using a direct transfer, as if it had not requested the RDC protocol.
A client serializes its calls to RdcGetSignatures, RdcPushSourceNeeds, RdcGetFileData, or RdcGetFileDataAsync.
The accumulated amount of data requested using RdcGetFileData or RdcGetFileDataAsync never exceeds the length of the intervals pushed by RdcPushSourceNeeds. The DFS-R server is otherwise free to fail all subsequent requests on that context handle.
RdcClose terminates a context handle and no further requests can be made on the context handle following this call. The RPC runtime furthermore enforces this constraint, as shown in the following state diagram.
Figure 9: RDC file transfer state machine
The client has to call either RdcGetFileData or RdcGetFileDataAsync, but cannot call both.