Go to file
ilammy 092e870d2a wClipboard/posix: implement file range retrieval
This is another bunch of callbacks which provide the file contents to
the clients. We jump through some extra hoops in order to have more
pleasant user experience.

Simple stuff goes first. The file offset (or position) is split into the
low and high parts because this is the format in which the clients
receive the request from the server. They can simply copy the values as
is into the struct without repackaging them (which we do instead in the
end to get a 64-bit off_t).

Another thing is that we try to minimize the number of lseek() calls and
to keep as few file descriptors open as possible. We cannot open all the
files at once as there could be thousands of them and we'll run out of
the allowed number of the fds. However, the server can (in theory)
request the file ranges randomly so we need to be prepared for that. One
way to do that would be to always open the file before reading and close
it immediately afterwards. A dead simple solution with an acceptable
performance, but... some file systems do not support seeking, such as
FTP directories mounted over FUSE. However, they handle sequential
reading just fine *and* the server requests the data sequentially most
of the time so we can exploit this.

Thus open the file only once, during the first range request and keep
it open until the server reads all the data. In order to know how much
data is left we keep an accurate account of all reads and maintain the
file offset ourselves. This also allows us to avoid calling lseek() when
the file offset will not be effectively changed. However, if the server
requests some weird offset then we have no choice and will attempt
seeking. Unfortunately, we cannot tell whether it is a genuine failure
or the file system just does not support seeking, so we do not handle
the error further. (One workaround would be to reopen the file and keep
reading it until we're at the correct offset.) In this way we can
support sequential-only file systems if the server requests the contents
sequentially (and it does).

Also note that we do an fstat() right after opening the file in order to
have an accurate value of file size, for this exact file descriptor we
will be using. We should have it filled it by now, but just in case...

There is one more thing to explain. The cbRequested field specifies the
maximum number of bytes the server can handle, not the required number.
Usually this is some power-of-two number like 64 KB, based on the size
of the files on the clipboard. This is why posix_file_read_perform()
does not attempt to fill the whole buffer by repeatedly calling read()
if it has read less data than requested. The server can handle underruns
just fine (and this spares us from special-casing the EOF condition).
2017-04-09 03:15:49 +03:00
channels channels/cliprdr: CLIPRDR_FILELIST utilities 2017-04-09 03:15:48 +03:00
ci/cmake-preloads Rewrite drive channel using WinPR functions 2017-03-13 14:18:46 -07:00
client Fixed RPATH settings for OS X 2017-04-06 08:08:07 +02:00
cmake wClipboard: local file subsystem boilerplate 2017-04-09 03:15:48 +03:00
docs Added android release build configurations. 2017-01-16 15:25:20 +01:00
external cmake: added external directory 2012-11-01 13:50:49 -04:00
include channels/cliprdr: CLIPRDR_FILELIST utilities 2017-04-09 03:15:48 +03:00
libfreerdp Fixed NEON YUV to RGB conversion issues. 2017-04-05 12:20:29 +02:00
packaging Fix nightly packages 2017-01-23 16:43:00 +01:00
rdtk Fixed argument checks, formatting. 2017-03-03 14:11:28 +01:00
resources Recompressed images with FileOptimizer 6.8 (an open-source mass file recompression tool for Windows) 2014-08-08 20:12:25 -04:00
scripts Update for android scripts, per arch includes. 2017-03-09 11:32:34 +01:00
server Scanbuild warning, argument checks and leak fixes. 2017-03-02 18:13:43 +01:00
third-party cleanup cmake exports and pkg-config files 2016-01-12 17:32:33 +01:00
uwac trivial issue found by cppcheck: 2017-01-25 15:48:49 +05:00
winpr wClipboard/posix: implement file range retrieval 2017-04-09 03:15:49 +03:00
.gitignore Add an environment variables section to the man 2016-06-21 15:28:38 +02:00
buildflags.h.in add parameter buildconfig 2016-01-12 17:32:33 +01:00
ChangeLog changelog: update for 1.0.1 2012-02-09 21:01:42 -05:00
CMakeCPack.cmake Added pdb files to package target. 2015-12-15 12:07:21 +01:00
CMakeCPackOptions.cmake.in cmake: fix package generation on Mac OS X 2013-09-09 21:42:25 -04:00
CMakeLists.txt Fixed RPATH settings for OS X 2017-04-06 08:08:07 +02:00
config.h.in wClipboard: local file subsystem boilerplate 2017-04-09 03:15:48 +03:00
LICENSE FreeRDP 1.0: initial commit 2011-06-30 15:12:51 -04:00
README Updated links in README 2013-05-27 18:29:24 +02:00

FreeRDP: A Remote Desktop Protocol Implementation
=================================================

FreeRDP is a free implementation of the Remote Desktop Protocol (RDP), released under the Apache license.
Enjoy the freedom of using your software wherever you want, the way you want it, in a world where
interoperability can finally liberate your computing experience.

Resources
---------

Project website: http://www.freerdp.com/
Issue tracker: https://github.com/FreeRDP/FreeRDP/issues
Sources: https://github.com/FreeRDP/FreeRDP/
Wiki: https://github.com/FreeRDP/FreeRDP/wiki
Downloads and other resources: http://pub.freerdp.com
API doc: http://pub.freerdp.com/api/

IRC channel: #freerdp @ irc.freenode.net
Mailing list: https://lists.sourceforge.net/lists/listinfo/freerdp-devel

Microsoft Open Specifications
-----------------------------

Information regarding the Microsoft Open Specifications can be found at:
http://www.microsoft.com/openspecifications/

A list of reference documentation is maintained here:
https://github.com/FreeRDP/FreeRDP/wiki/Reference-Documentation

Compilation
-----------

Instructions on how to get started compiling FreeRDP can be found on the wiki:
https://github.com/FreeRDP/FreeRDP/wiki/Compilation