├── .gitignore ├── rfb-common ├── .gitignore ├── .project ├── src │ └── main │ │ └── java │ │ └── com │ │ └── sshtools │ │ └── rfbcommon │ │ ├── TightConstants.java │ │ ├── RFBFile.java │ │ ├── ScreenDimension.java │ │ ├── TightUtil.java │ │ ├── ScreenDetail.java │ │ ├── ProtocolWriter.java │ │ └── ScreenData.java └── pom.xml ├── rfb-server ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ └── images │ │ │ ├── pointer.png │ │ │ ├── dot-cursor.gif │ │ │ ├── dot-cursor.png │ │ │ ├── stop-cursor.gif │ │ │ ├── stop-cursor.png │ │ │ ├── empty-cursor.gif │ │ │ └── empty-cursor.png │ │ └── java │ │ └── com │ │ └── sshtools │ │ └── rfbserver │ │ ├── RFBServerConfiguration.java │ │ ├── encodings │ │ ├── CompressLevel1.java │ │ ├── CompressLevel9.java │ │ ├── JPEGQualityLevel1.java │ │ ├── JPEGQualityLevel2.java │ │ ├── JPEGQualityLevel3.java │ │ ├── JPEGQualityLevel4.java │ │ ├── JPEGQualityLevel5.java │ │ ├── JPEGQualityLevel6.java │ │ ├── JPEGQualityLevel7.java │ │ ├── JPEGQualityLevel8.java │ │ ├── JPEGQualityLevel9.java │ │ ├── CompressLevel3.java │ │ ├── CompressLevel4.java │ │ ├── CompressLevel5.java │ │ ├── CompressLevel6.java │ │ ├── CompressLevel7.java │ │ ├── CompressLevel8.java │ │ ├── CompressLevel2.java │ │ ├── AbstractEncoding.java │ │ ├── authentication │ │ │ ├── None.java │ │ │ └── AbstractAuth.java │ │ ├── RFBServerEncoding.java │ │ ├── RREEncoding.java │ │ ├── RawEncoding.java │ │ ├── CORREEncoding.java │ │ ├── RFBResizeEncoding.java │ │ ├── ContinuousUpdatesEncoding.java │ │ ├── CursorPositionEncoding.java │ │ └── CopyRectEncoding.java │ │ ├── protocol │ │ ├── ProtocolExtension.java │ │ ├── ClientCutTextProtocolExtension.java │ │ ├── KeyboardEventProtocolExtension.java │ │ ├── PointerEventProtocolExtension.java │ │ ├── EnableContinuousUpdatesProtocolExtension.java │ │ ├── SetDesktopSizeExtension.java │ │ └── Reply.java │ │ ├── RFBEncodingData.java │ │ ├── transport │ │ ├── RFBServerTransport.java │ │ ├── SocketRFBServerTransport.java │ │ └── RFBServerTransportFactory.java │ │ ├── FixedRFBServerConfiguration.java │ │ ├── Beep.java │ │ ├── RFBClientContext.java │ │ ├── EndContinuousUpdates.java │ │ ├── ServerCut.java │ │ └── files │ │ ├── RFBServerFS.java │ │ └── uvnc │ │ ├── EndListDirectoryReply.java │ │ ├── StartListDirectoryReply.java │ │ ├── FileTransfer.java │ │ └── ListDrivesReply.java └── .project ├── rfb-server-linux ├── .gitignore ├── src │ └── main │ │ └── resources │ │ └── images │ │ ├── pointer.png │ │ ├── dot-cursor.gif │ │ ├── dot-cursor.png │ │ ├── empty-cursor.gif │ │ ├── empty-cursor.png │ │ ├── stop-cursor.gif │ │ └── stop-cursor.png └── .project ├── rfb-viewer-common ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ └── images │ │ │ ├── dot-cursor.gif │ │ │ ├── dot-cursor.png │ │ │ ├── empty-cursor.gif │ │ │ ├── empty-cursor.png │ │ │ ├── stop-cursor.gif │ │ │ └── stop-cursor.png │ │ └── java │ │ └── com │ │ └── sshtools │ │ └── rfb │ │ ├── encoding │ │ ├── JPEGQuality2Encoding.java │ │ ├── JPEGQuality3Encoding.java │ │ ├── JPEGQuality4Encoding.java │ │ ├── JPEGQuality5Encoding.java │ │ ├── JPEGQuality6Encoding.java │ │ ├── JPEGQuality7Encoding.java │ │ ├── JPEGQuality8Encoding.java │ │ ├── JPEGQuality9Encoding.java │ │ ├── CompressLevel1Encoding.java │ │ ├── CompressLevel2Encoding.java │ │ ├── CompressLevel3Encoding.java │ │ ├── CompressLevel4Encoding.java │ │ ├── CompressLevel5Encoding.java │ │ ├── CompressLevel6Encoding.java │ │ ├── CompressLevel7Encoding.java │ │ ├── CompressLevel8Encoding.java │ │ ├── CompressLevel9Encoding.java │ │ ├── JPEGQuality1Encoding.java │ │ ├── LastRectEncoding.java │ │ ├── CursorPositionEncoding.java │ │ ├── CompressLevel0Encoding.java │ │ ├── JPEGQuality0Encoding.java │ │ ├── TightPNGEncoding.java │ │ ├── CopyRectEncoding.java │ │ ├── RFBResizeEncoding.java │ │ ├── RawEncoding.java │ │ └── ContinuousUpdatesEncoding.java │ │ ├── RFBTransportFactory.java │ │ ├── SecurityTypeFactory.java │ │ ├── RFBProtocolTransport.java │ │ ├── SecurityType.java │ │ ├── RFBEncoding.java │ │ ├── RFBEventHandler.java │ │ ├── BufferUpdate.java │ │ ├── RFBRectangle.java │ │ ├── RFBAuthenticationException.java │ │ ├── RFBSocketTransport.java │ │ ├── RFBFS.java │ │ ├── auth │ │ └── None.java │ │ ├── RFBDisplay.java │ │ └── RFBTransport.java └── .project ├── rfb-viewer-javafx ├── .gitignore ├── src │ └── main │ │ └── resources │ │ └── beep.wav └── .project ├── rfb-viewer-swing ├── .gitignore └── .project ├── vnc-viewer-javafx ├── .gitignore ├── src │ └── main │ │ └── resources │ │ └── beep.wav └── .project ├── vnc-viewer-swing ├── .gitignore ├── .project └── README.md ├── rfb-player ├── .gitignore └── .project ├── rfb-recorder ├── .gitignore ├── .project └── src │ └── main │ └── java │ └── com │ └── sshtools │ └── rfbrecorder │ ├── RecordingOutputStream.java │ └── RecordingInputStream.java ├── vnc-server ├── .gitignore ├── src │ └── main │ │ └── resources │ │ └── images │ │ ├── pointer.png │ │ ├── dot-cursor.gif │ │ ├── dot-cursor.png │ │ ├── stop-cursor.gif │ │ ├── stop-cursor.png │ │ ├── empty-cursor.gif │ │ └── empty-cursor.png └── .project ├── rfb-server-windows ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ └── images │ │ │ ├── pointer.png │ │ │ ├── dot-cursor.gif │ │ │ ├── dot-cursor.png │ │ │ ├── stop-cursor.gif │ │ │ ├── stop-cursor.png │ │ │ ├── empty-cursor.gif │ │ │ └── empty-cursor.png │ │ ├── native │ │ ├── displayhook.h │ │ ├── com_sshtools_rfbserver_windows_jni_HookTest.h │ │ └── com_sshtools_rfbserver_windows_jni_DisplayHook.h │ │ └── java │ │ └── com │ │ └── sshtools │ │ └── rfbserver │ │ └── windows │ │ └── jni │ │ ├── DisplayCallback.java │ │ ├── DisplayHook.java │ │ ├── HookTest.java │ │ ├── DisplayTest.java │ │ └── FrameTest.java ├── .project ├── genh-x.bat ├── genh.bat ├── build-x.bat └── build.bat ├── .project ├── README.md └── templates └── GPL-3.txt /.gitignore: -------------------------------------------------------------------------------- 1 | /.settings/ 2 | -------------------------------------------------------------------------------- /rfb-common/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.settings/ 3 | *.classpath 4 | /bin/ 5 | -------------------------------------------------------------------------------- /rfb-server/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.settings/ 3 | *.classpath 4 | /bin/ 5 | -------------------------------------------------------------------------------- /rfb-server-linux/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.settings/ 3 | *.classpath 4 | /bin/ 5 | -------------------------------------------------------------------------------- /rfb-viewer-common/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.settings/ 3 | *.classpath 4 | /bin/ 5 | -------------------------------------------------------------------------------- /rfb-viewer-javafx/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.settings/ 3 | *.classpath 4 | /bin/ 5 | -------------------------------------------------------------------------------- /rfb-viewer-swing/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.settings/ 3 | *.classpath 4 | /bin/ 5 | -------------------------------------------------------------------------------- /vnc-viewer-javafx/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.settings/ 3 | *.classpath 4 | /bin/ 5 | -------------------------------------------------------------------------------- /vnc-viewer-swing/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.settings/ 3 | *.classpath 4 | /bin/ 5 | -------------------------------------------------------------------------------- /rfb-player/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.settings/ 3 | *.classpath 4 | *.xml 5 | /bin/ 6 | -------------------------------------------------------------------------------- /rfb-recorder/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.settings/ 3 | *.classpath 4 | *.xml 5 | /bin/ 6 | -------------------------------------------------------------------------------- /vnc-server/.gitignore: -------------------------------------------------------------------------------- 1 | /.settings/ 2 | /target/ 3 | *.classpath 4 | *.xml 5 | /bin/ 6 | -------------------------------------------------------------------------------- /rfb-server-windows/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.settings/ 3 | *.classpath 4 | *.xml 5 | /bin/ 6 | -------------------------------------------------------------------------------- /rfb-viewer-javafx/src/main/resources/beep.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-viewer-javafx/src/main/resources/beep.wav -------------------------------------------------------------------------------- /vnc-viewer-javafx/src/main/resources/beep.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/vnc-viewer-javafx/src/main/resources/beep.wav -------------------------------------------------------------------------------- /rfb-server/src/main/resources/images/pointer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server/src/main/resources/images/pointer.png -------------------------------------------------------------------------------- /vnc-server/src/main/resources/images/pointer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/vnc-server/src/main/resources/images/pointer.png -------------------------------------------------------------------------------- /rfb-server/src/main/resources/images/dot-cursor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server/src/main/resources/images/dot-cursor.gif -------------------------------------------------------------------------------- /rfb-server/src/main/resources/images/dot-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server/src/main/resources/images/dot-cursor.png -------------------------------------------------------------------------------- /rfb-server/src/main/resources/images/stop-cursor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server/src/main/resources/images/stop-cursor.gif -------------------------------------------------------------------------------- /rfb-server/src/main/resources/images/stop-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server/src/main/resources/images/stop-cursor.png -------------------------------------------------------------------------------- /vnc-server/src/main/resources/images/dot-cursor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/vnc-server/src/main/resources/images/dot-cursor.gif -------------------------------------------------------------------------------- /vnc-server/src/main/resources/images/dot-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/vnc-server/src/main/resources/images/dot-cursor.png -------------------------------------------------------------------------------- /vnc-server/src/main/resources/images/stop-cursor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/vnc-server/src/main/resources/images/stop-cursor.gif -------------------------------------------------------------------------------- /vnc-server/src/main/resources/images/stop-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/vnc-server/src/main/resources/images/stop-cursor.png -------------------------------------------------------------------------------- /rfb-server-linux/src/main/resources/images/pointer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server-linux/src/main/resources/images/pointer.png -------------------------------------------------------------------------------- /rfb-server/src/main/resources/images/empty-cursor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server/src/main/resources/images/empty-cursor.gif -------------------------------------------------------------------------------- /rfb-server/src/main/resources/images/empty-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server/src/main/resources/images/empty-cursor.png -------------------------------------------------------------------------------- /vnc-server/src/main/resources/images/empty-cursor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/vnc-server/src/main/resources/images/empty-cursor.gif -------------------------------------------------------------------------------- /vnc-server/src/main/resources/images/empty-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/vnc-server/src/main/resources/images/empty-cursor.png -------------------------------------------------------------------------------- /rfb-server-linux/src/main/resources/images/dot-cursor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server-linux/src/main/resources/images/dot-cursor.gif -------------------------------------------------------------------------------- /rfb-server-linux/src/main/resources/images/dot-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server-linux/src/main/resources/images/dot-cursor.png -------------------------------------------------------------------------------- /rfb-server-windows/src/main/resources/images/pointer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server-windows/src/main/resources/images/pointer.png -------------------------------------------------------------------------------- /rfb-server-linux/src/main/resources/images/empty-cursor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server-linux/src/main/resources/images/empty-cursor.gif -------------------------------------------------------------------------------- /rfb-server-linux/src/main/resources/images/empty-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server-linux/src/main/resources/images/empty-cursor.png -------------------------------------------------------------------------------- /rfb-server-linux/src/main/resources/images/stop-cursor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server-linux/src/main/resources/images/stop-cursor.gif -------------------------------------------------------------------------------- /rfb-server-linux/src/main/resources/images/stop-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server-linux/src/main/resources/images/stop-cursor.png -------------------------------------------------------------------------------- /rfb-server-windows/src/main/resources/images/dot-cursor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server-windows/src/main/resources/images/dot-cursor.gif -------------------------------------------------------------------------------- /rfb-server-windows/src/main/resources/images/dot-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server-windows/src/main/resources/images/dot-cursor.png -------------------------------------------------------------------------------- /rfb-server-windows/src/main/resources/images/stop-cursor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server-windows/src/main/resources/images/stop-cursor.gif -------------------------------------------------------------------------------- /rfb-server-windows/src/main/resources/images/stop-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server-windows/src/main/resources/images/stop-cursor.png -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/resources/images/dot-cursor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-viewer-common/src/main/resources/images/dot-cursor.gif -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/resources/images/dot-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-viewer-common/src/main/resources/images/dot-cursor.png -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/resources/images/empty-cursor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-viewer-common/src/main/resources/images/empty-cursor.gif -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/resources/images/empty-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-viewer-common/src/main/resources/images/empty-cursor.png -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/resources/images/stop-cursor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-viewer-common/src/main/resources/images/stop-cursor.gif -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/resources/images/stop-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-viewer-common/src/main/resources/images/stop-cursor.png -------------------------------------------------------------------------------- /rfb-server-windows/src/main/resources/images/empty-cursor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server-windows/src/main/resources/images/empty-cursor.gif -------------------------------------------------------------------------------- /rfb-server-windows/src/main/resources/images/empty-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sshtools/rfb/HEAD/rfb-server-windows/src/main/resources/images/empty-cursor.png -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | rfb 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.m2e.core.maven2Builder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Nature 16 | 17 | 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # rfb 2 | 3 | A number of modules to support the RFB protocol, also known as VNC in Java. Included is a Swing viewer component, 4 | a recorder, a player, and some common code that may be used throughout these modules. 5 | 6 | Most encodings are supported include ZLIB, CORRE, Hextile, Tight, ZLIB and ZRLE as well as AnonTLS, Tight and 7 | VNC authentication methods. 8 | 9 | File transfer support for both TightVNC and UltraVNC is also provided. -------------------------------------------------------------------------------- /rfb-player/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | rfb-player 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /templates/GPL-3.txt: -------------------------------------------------------------------------------- 1 | ${project.name} - ${project.description} 2 | Copyright © ${project.inceptionYear} ${owner} (${email}) 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . -------------------------------------------------------------------------------- /rfb-common/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | rfb-common 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.maven.ide.eclipse.maven2Builder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.maven.ide.eclipse.maven2Nature 26 | org.eclipse.jdt.core.javanature 27 | org.eclipse.m2e.core.maven2Nature 28 | 29 | 30 | -------------------------------------------------------------------------------- /rfb-server/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | rfb-server 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.maven.ide.eclipse.maven2Builder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.maven.ide.eclipse.maven2Nature 26 | org.eclipse.jdt.core.javanature 27 | org.eclipse.m2e.core.maven2Nature 28 | 29 | 30 | -------------------------------------------------------------------------------- /vnc-server/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | vnc-server 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.maven.ide.eclipse.maven2Builder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.maven.ide.eclipse.maven2Nature 26 | org.eclipse.jdt.core.javanature 27 | org.eclipse.m2e.core.maven2Nature 28 | 29 | 30 | -------------------------------------------------------------------------------- /rfb-recorder/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | rfb-recorder 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.maven.ide.eclipse.maven2Builder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.maven.ide.eclipse.maven2Nature 26 | org.eclipse.jdt.core.javanature 27 | org.eclipse.m2e.core.maven2Nature 28 | 29 | 30 | -------------------------------------------------------------------------------- /rfb-server-linux/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | rfb-server-linux 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.maven.ide.eclipse.maven2Builder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.maven.ide.eclipse.maven2Nature 26 | org.eclipse.jdt.core.javanature 27 | org.eclipse.m2e.core.maven2Nature 28 | 29 | 30 | -------------------------------------------------------------------------------- /rfb-viewer-swing/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | rfb-viewer-swing 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.maven.ide.eclipse.maven2Builder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.maven.ide.eclipse.maven2Nature 26 | org.eclipse.jdt.core.javanature 27 | org.eclipse.m2e.core.maven2Nature 28 | 29 | 30 | -------------------------------------------------------------------------------- /vnc-viewer-swing/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | vnc-viewer-swing 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.maven.ide.eclipse.maven2Builder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.maven.ide.eclipse.maven2Nature 26 | org.eclipse.jdt.core.javanature 27 | org.eclipse.m2e.core.maven2Nature 28 | 29 | 30 | -------------------------------------------------------------------------------- /rfb-server-windows/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | rfb-server-windows 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.maven.ide.eclipse.maven2Builder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.maven.ide.eclipse.maven2Nature 26 | org.eclipse.jdt.core.javanature 27 | org.eclipse.m2e.core.maven2Nature 28 | 29 | 30 | -------------------------------------------------------------------------------- /rfb-viewer-common/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | rfb-viewer-common 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.maven.ide.eclipse.maven2Builder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.maven.ide.eclipse.maven2Nature 26 | org.eclipse.jdt.core.javanature 27 | org.eclipse.m2e.core.maven2Nature 28 | 29 | 30 | -------------------------------------------------------------------------------- /rfb-viewer-javafx/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | rfb-viewer-javafx 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.maven.ide.eclipse.maven2Builder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.maven.ide.eclipse.maven2Nature 26 | org.eclipse.jdt.core.javanature 27 | org.eclipse.m2e.core.maven2Nature 28 | 29 | 30 | -------------------------------------------------------------------------------- /vnc-viewer-javafx/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | vnc-viewer-javafx 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.maven.ide.eclipse.maven2Builder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.maven.ide.eclipse.maven2Nature 26 | org.eclipse.jdt.core.javanature 27 | org.eclipse.m2e.core.maven2Nature 28 | 29 | 30 | -------------------------------------------------------------------------------- /rfb-server-windows/src/main/native/displayhook.h: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server (Windows Driver) - A JNA based driver for Windows, 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | #define EXPORT __declspec(dllexport) 19 | -------------------------------------------------------------------------------- /rfb-server-windows/genh-x.bat: -------------------------------------------------------------------------------- 1 | @REM 2 | @REM RFB Server (Windows Driver) - A JNA based driver for Windows, 3 | @REM Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | @REM 5 | @REM This program is free software: you can redistribute it and/or modify 6 | @REM it under the terms of the GNU General Public License as published by 7 | @REM the Free Software Foundation, either version 3 of the License, or 8 | @REM (at your option) any later version. 9 | @REM 10 | @REM This program is distributed in the hope that it will be useful, 11 | @REM but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | @REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | @REM GNU General Public License for more details. 14 | @REM 15 | @REM You should have received a copy of the GNU General Public License 16 | @REM along with this program. If not, see . 17 | @REM 18 | 19 | "c:\program files\java\jdk1.7.0_67\bin\javah.exe" -d src/main/native -classpath target\classes com.sshtools.rfbserver.windows.jni.HookTest -------------------------------------------------------------------------------- /rfb-server-windows/genh.bat: -------------------------------------------------------------------------------- 1 | @REM 2 | @REM RFB Server (Windows Driver) - A JNA based driver for Windows, 3 | @REM Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | @REM 5 | @REM This program is free software: you can redistribute it and/or modify 6 | @REM it under the terms of the GNU General Public License as published by 7 | @REM the Free Software Foundation, either version 3 of the License, or 8 | @REM (at your option) any later version. 9 | @REM 10 | @REM This program is distributed in the hope that it will be useful, 11 | @REM but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | @REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | @REM GNU General Public License for more details. 14 | @REM 15 | @REM You should have received a copy of the GNU General Public License 16 | @REM along with this program. If not, see . 17 | @REM 18 | 19 | "c:\program files\java\jdk1.7.0_67\bin\javah.exe" -d src/main/native -classpath target\classes com.sshtools.rfbserver.windows.jni.DisplayHook -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/JPEGQuality2Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class JPEGQuality2Encoding extends JPEGQuality0Encoding { 23 | @Override 24 | public int getType() { 25 | return RFBConstants.ENC_JPEG_QUALITY_LEVEL0 + 2; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/JPEGQuality3Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class JPEGQuality3Encoding extends JPEGQuality0Encoding { 23 | @Override 24 | public int getType() { 25 | return RFBConstants.ENC_JPEG_QUALITY_LEVEL0 + 3; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/JPEGQuality4Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class JPEGQuality4Encoding extends JPEGQuality0Encoding { 23 | @Override 24 | public int getType() { 25 | return RFBConstants.ENC_JPEG_QUALITY_LEVEL0 + 4; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/JPEGQuality5Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class JPEGQuality5Encoding extends JPEGQuality0Encoding { 23 | @Override 24 | public int getType() { 25 | return RFBConstants.ENC_JPEG_QUALITY_LEVEL0 + 5; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/JPEGQuality6Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class JPEGQuality6Encoding extends JPEGQuality0Encoding { 23 | @Override 24 | public int getType() { 25 | return RFBConstants.ENC_JPEG_QUALITY_LEVEL0 + 6; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/JPEGQuality7Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class JPEGQuality7Encoding extends JPEGQuality0Encoding { 23 | @Override 24 | public int getType() { 25 | return RFBConstants.ENC_JPEG_QUALITY_LEVEL0 + 7; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/JPEGQuality8Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class JPEGQuality8Encoding extends JPEGQuality0Encoding { 23 | @Override 24 | public int getType() { 25 | return RFBConstants.ENC_JPEG_QUALITY_LEVEL0 + 7; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/JPEGQuality9Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class JPEGQuality9Encoding extends JPEGQuality0Encoding { 23 | @Override 24 | public int getType() { 25 | return RFBConstants.ENC_JPEG_QUALITY_LEVEL0 + 9; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/CompressLevel1Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class CompressLevel1Encoding extends CompressLevel0Encoding { 23 | @Override 24 | public int getType() { 25 | return RFBConstants.ENC_COMPRESS_LEVEL0 + 1; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/CompressLevel2Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class CompressLevel2Encoding extends CompressLevel0Encoding { 23 | @Override 24 | public int getType() { 25 | return RFBConstants.ENC_COMPRESS_LEVEL0 + 2; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/CompressLevel3Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class CompressLevel3Encoding extends CompressLevel0Encoding { 23 | @Override 24 | public int getType() { 25 | return RFBConstants.ENC_COMPRESS_LEVEL0 + 3; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/CompressLevel4Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class CompressLevel4Encoding extends CompressLevel0Encoding { 23 | @Override 24 | public int getType() { 25 | return RFBConstants.ENC_COMPRESS_LEVEL0 + 4; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/CompressLevel5Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class CompressLevel5Encoding extends CompressLevel0Encoding { 23 | @Override 24 | public int getType() { 25 | return RFBConstants.ENC_COMPRESS_LEVEL0 + 5; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/CompressLevel6Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class CompressLevel6Encoding extends CompressLevel0Encoding { 23 | @Override 24 | public int getType() { 25 | return RFBConstants.ENC_COMPRESS_LEVEL0 + 6; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/CompressLevel7Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class CompressLevel7Encoding extends CompressLevel0Encoding { 23 | @Override 24 | public int getType() { 25 | return RFBConstants.ENC_COMPRESS_LEVEL0 + 7; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/CompressLevel8Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class CompressLevel8Encoding extends CompressLevel0Encoding { 23 | @Override 24 | public int getType() { 25 | return RFBConstants.ENC_COMPRESS_LEVEL0 + 8; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/CompressLevel9Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class CompressLevel9Encoding extends CompressLevel0Encoding { 23 | @Override 24 | public int getType() { 25 | return RFBConstants.ENC_COMPRESS_LEVEL0 + 9; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-server-windows/src/main/java/com/sshtools/rfbserver/windows/jni/DisplayCallback.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server (Windows Driver) - A JNA based driver for Windows, 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfbserver.windows.jni; 19 | 20 | public interface DisplayCallback { 21 | void windowMoved(int hwnd, int x, int y, int width, int height); 22 | void windowCreated(int hwnd, int x, int y, int width, int height); 23 | void windowDestroyed(int hwnd); 24 | } -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/RFBTransportFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb; 19 | 20 | import java.io.IOException; 21 | 22 | public interface RFBTransportFactory { 23 | 24 | public RFBTransport connect(String hostname, int port, String command) throws 25 | IOException; 26 | 27 | public void disconnect(RFBTransport transport, String command); 28 | 29 | } -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/JPEGQuality1Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import com.sshtools.rfbcommon.RFBConstants; 21 | 22 | public class JPEGQuality1Encoding extends JPEGQuality0Encoding { 23 | public JPEGQuality1Encoding() { 24 | } 25 | 26 | @Override 27 | public int getType() { 28 | return RFBConstants.ENC_JPEG_QUALITY_LEVEL0 + 1; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /rfb-server-windows/src/main/java/com/sshtools/rfbserver/windows/jni/DisplayHook.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server (Windows Driver) - A JNA based driver for Windows, 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfbserver.windows.jni; 19 | 20 | public class DisplayHook { 21 | 22 | static { 23 | System.loadLibrary("displayhook"); 24 | } 25 | 26 | public final static DisplayHook INSTANCE = new DisplayHook(); 27 | 28 | public native boolean register(DisplayCallback target); 29 | public native void loop(); 30 | } 31 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/SecurityTypeFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb; 19 | 20 | import java.io.IOException; 21 | import java.util.List; 22 | 23 | public interface SecurityTypeFactory { 24 | 25 | SecurityType getSecurityType(int type); 26 | 27 | boolean isAvailable(int type); 28 | 29 | List getSecurityTypes(); 30 | 31 | int selectScheme(List supportedServerTypes) throws IOException; 32 | } 33 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/RFBProtocolTransport.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | /* HEADER */ 19 | package com.sshtools.rfb; 20 | 21 | import java.io.IOException; 22 | import java.io.InputStream; 23 | import java.io.OutputStream; 24 | 25 | public interface RFBProtocolTransport extends RFBTransport { 26 | 27 | @Override 28 | InputStream getInputStream() throws IOException; 29 | 30 | @Override 31 | OutputStream getOutputStream() throws IOException; 32 | 33 | } -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/SecurityType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb; 19 | 20 | import java.io.IOException; 21 | import java.util.List; 22 | 23 | public interface SecurityType { 24 | 25 | int process(ProtocolEngine engine) throws RFBAuthenticationException, 26 | IOException; 27 | 28 | int getType(); 29 | 30 | void postServerInitialisation(ProtocolEngine engine) throws IOException; 31 | 32 | List getSubAuthTypes(); 33 | } 34 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/RFBEncoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb; 19 | 20 | import java.io.IOException; 21 | 22 | public interface RFBEncoding { 23 | 24 | public int getType(); 25 | 26 | public String getName(); 27 | 28 | public boolean isPseudoEncoding(); 29 | 30 | public void processEncodedRect(RFBDisplay display, int x, int y, int width, 31 | int height, int encodingType) throws 32 | IOException; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /rfb-server-windows/src/main/java/com/sshtools/rfbserver/windows/jni/HookTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server (Windows Driver) - A JNA based driver for Windows, 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfbserver.windows.jni; 19 | 20 | // 21 | // HookTest.java 22 | // 23 | public class HookTest { 24 | static { 25 | System.loadLibrary("HookTest"); 26 | } 27 | 28 | void processKey(int key, boolean pressed) { 29 | System.out.println("Java: HookTest.processKey - key = " + key 30 | + (pressed ? " pressed" : " released")); 31 | } 32 | 33 | native void registerHook(); 34 | 35 | native void unRegisterHook(); 36 | } -------------------------------------------------------------------------------- /rfb-common/src/main/java/com/sshtools/rfbcommon/TightConstants.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Common - Remote Frame Buffer common code used both in client and server. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfbcommon; 19 | 20 | public interface TightConstants { 21 | final static int OP_FILL = 0x08; 22 | final static int OP_JPEG = 0x09; 23 | final static int OP_PNG = 0x0A; 24 | final static int OP_COPY = 0x00; 25 | 26 | final static int OP_READ_FILTER_ID = 0x40; 27 | 28 | final static int OP_FILTER_RAW = 0x00; 29 | final static int OP_FILTER_PALETTE = 0x01; 30 | final static int OP_FILTER_GRADIENT = 0x02; 31 | } 32 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/RFBEventHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | /* HEADER */ 19 | package com.sshtools.rfb; 20 | 21 | /** 22 | * Callback interface that enables the RFB protocol to prompt the user for a 23 | * password. 24 | * 25 | * @author Lee David Painter 26 | */ 27 | public interface RFBEventHandler { 28 | 29 | String passwordAuthenticationRequired(); 30 | 31 | void connected(); 32 | 33 | void disconnected(); 34 | 35 | void remoteResize(int width, int height); 36 | 37 | void encodingChanged(RFBEncoding currentEncoding); 38 | } -------------------------------------------------------------------------------- /rfb-common/src/main/java/com/sshtools/rfbcommon/RFBFile.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Common - Remote Frame Buffer common code used both in client and server. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | /** 19 | * 20 | */ 21 | package com.sshtools.rfbcommon; 22 | 23 | public interface RFBFile { 24 | int getFileAttributes(); 25 | 26 | long getCreationTime(); 27 | 28 | long getLastAccessTime(); 29 | 30 | long getLastWriteTime(); 31 | 32 | boolean isFolder(); 33 | 34 | long getSize(); 35 | 36 | String getName(); 37 | 38 | String getAlternateName(); 39 | 40 | boolean isExecutable(); 41 | 42 | boolean setLastWriteTime(long lastWriteTime); 43 | } -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/BufferUpdate.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | /* 19 | */ 20 | package com.sshtools.rfb; 21 | 22 | public class BufferUpdate extends RFBRectangle { 23 | public int encoding; 24 | 25 | public BufferUpdate(int x, int y, int w, int h, int encoding) { 26 | super(x, y, w, h); 27 | this.encoding = encoding; 28 | } 29 | 30 | public int getEncoding() { 31 | return encoding; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | return "BufferUpdate [encoding=" + encoding + ", x=" + x + ", y=" + y + ", w=" + w + ", h=" + h + "]"; 37 | } 38 | } -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/RFBRectangle.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | /* 19 | */ 20 | package com.sshtools.rfb; 21 | 22 | public class RFBRectangle { 23 | public int x; 24 | public int y; 25 | public int w; 26 | public int h; 27 | 28 | public RFBRectangle(int x, int y, int w, int h) { 29 | this.x = x; 30 | this.y = y; 31 | this.w = w; 32 | this.h = h; 33 | } 34 | 35 | public int getX() { 36 | return x; 37 | } 38 | 39 | public int getY() { 40 | return y; 41 | } 42 | 43 | public int getWidth() { 44 | return w; 45 | } 46 | 47 | public int getHeight() { 48 | return h; 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /rfb-server-windows/src/main/java/com/sshtools/rfbserver/windows/jni/DisplayTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server (Windows Driver) - A JNA based driver for Windows, 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfbserver.windows.jni; 19 | 20 | public class DisplayTest implements DisplayCallback { 21 | 22 | public static void main(String[] args) { 23 | DisplayTest dy = new DisplayTest(); 24 | DisplayHook.INSTANCE.register(dy); 25 | DisplayHook.INSTANCE.loop(); 26 | } 27 | 28 | public void windowMoved(int hwnd, int x, int y, int width, int height) { 29 | } 30 | 31 | public void windowCreated(int hwnd, int x, int y, int width, int height) { 32 | } 33 | 34 | public void windowDestroyed(int hwnd) { 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/RFBServerConfiguration.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver; 21 | 22 | public interface RFBServerConfiguration { 23 | int getPort(); 24 | int getListenBacklog(); 25 | String getAddress(); 26 | String getDesktopName(); 27 | } 28 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/CompressLevel1.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | 23 | public class CompressLevel1 extends CompressLevel0 { 24 | 25 | public int getCode() { 26 | return getType().getCode() + 1; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/CompressLevel9.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | public class CompressLevel9 extends CompressLevel0 { 23 | public int getCode() { 24 | return getType().getCode() + 9; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/JPEGQualityLevel1.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | 23 | public class JPEGQualityLevel1 extends JPEGQualityLevel0 { 24 | 25 | public int getCode() { 26 | return getType().getCode() + 1; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/JPEGQualityLevel2.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | 23 | public class JPEGQualityLevel2 extends JPEGQualityLevel0 { 24 | 25 | public int getCode() { 26 | return getType().getCode() + 2; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/JPEGQualityLevel3.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | 23 | public class JPEGQualityLevel3 extends JPEGQualityLevel0 { 24 | 25 | public int getCode() { 26 | return getType().getCode() + 3; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/JPEGQualityLevel4.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | 23 | public class JPEGQualityLevel4 extends JPEGQualityLevel0 { 24 | 25 | public int getCode() { 26 | return getType().getCode() + 4; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/JPEGQualityLevel5.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | 23 | public class JPEGQualityLevel5 extends JPEGQualityLevel0 { 24 | 25 | public int getCode() { 26 | return getType().getCode() + 5; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/JPEGQualityLevel6.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | 23 | public class JPEGQualityLevel6 extends JPEGQualityLevel0 { 24 | 25 | public int getCode() { 26 | return getType().getCode() + 6; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/JPEGQualityLevel7.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | 23 | public class JPEGQualityLevel7 extends JPEGQualityLevel0 { 24 | 25 | public int getCode() { 26 | return getType().getCode() + 7; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/JPEGQualityLevel8.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | 23 | public class JPEGQualityLevel8 extends JPEGQualityLevel0 { 24 | 25 | public int getCode() { 26 | return getType().getCode() + 8; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/JPEGQualityLevel9.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | 23 | public class JPEGQualityLevel9 extends JPEGQualityLevel0 { 24 | 25 | public int getCode() { 26 | return getType().getCode() + 9; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/CompressLevel3.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | 23 | public class CompressLevel3 extends CompressLevel0 { 24 | 25 | public int getCode() { 26 | return getType().getCode() +3; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/CompressLevel4.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | 23 | public class CompressLevel4 extends CompressLevel0 { 24 | 25 | public int getCode() { 26 | return getType().getCode() + 4; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/CompressLevel5.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | 23 | public class CompressLevel5 extends CompressLevel0 { 24 | 25 | public int getCode() { 26 | return getType().getCode() + 5; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/CompressLevel6.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | 23 | public class CompressLevel6 extends CompressLevel0 { 24 | 25 | public int getCode() { 26 | return getType().getCode() + 6; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/CompressLevel7.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | 23 | public class CompressLevel7 extends CompressLevel0 { 24 | 25 | public int getCode() { 26 | return getType().getCode() + 7; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/CompressLevel8.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | 23 | public class CompressLevel8 extends CompressLevel0 { 24 | 25 | public int getCode() { 26 | return getType().getCode() + 8; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/CompressLevel2.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | 23 | public class CompressLevel2 extends CompressLevel0 { 24 | 25 | 26 | public int getCode() { 27 | return getType().getCode() + 2; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/AbstractEncoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | public abstract class AbstractEncoding implements RFBServerEncoding { 23 | 24 | public int getCode() { 25 | return getType().getCode(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rfb-server-windows/build-x.bat: -------------------------------------------------------------------------------- 1 | @REM 2 | @REM RFB Server (Windows Driver) - A JNA based driver for Windows, 3 | @REM Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | @REM 5 | @REM This program is free software: you can redistribute it and/or modify 6 | @REM it under the terms of the GNU General Public License as published by 7 | @REM the Free Software Foundation, either version 3 of the License, or 8 | @REM (at your option) any later version. 9 | @REM 10 | @REM This program is distributed in the hope that it will be useful, 11 | @REM but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | @REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | @REM GNU General Public License for more details. 14 | @REM 15 | @REM You should have received a copy of the GNU General Public License 16 | @REM along with this program. If not, see . 17 | @REM 18 | 19 | 20 | 21 | g++ -c -DBUILDING_HOOKTEST_DLL -I "C:\Program Files\Java\jdk1.7.0_67\include" -I "C:\Program Files\Java\jdk1.7.0_67\include\win32" src\main\native\HookTest.cpp -o target\HookTest.o 22 | REM g++ -shared --enable-runtime-pseudo-reloc -o target\HookTest.dll target\HookTest.o -Wl,--kill-at -Wl,--out-implib,target\libHookTest.dll.a 23 | REM g++ -shared -o target\HookTest.dll target\HookTest.o -Wl,--kill-at -Wl,--out-implib,target\libHookTest.dll.a 24 | 25 | g++ -shared -o target\HookTest.dll target\HookTest.o -Wl,--subsystem,windows -Wl,--kill-at -Wl,--out-implib,target\libHookTest.dll.a 26 | 27 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/protocol/ProtocolExtension.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.protocol; 21 | 22 | import java.io.IOException; 23 | 24 | import com.sshtools.rfbserver.RFBClient; 25 | 26 | public interface ProtocolExtension { 27 | 28 | boolean handle(int msg, RFBClient rfbClient) throws IOException; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /vnc-viewer-swing/README.md: -------------------------------------------------------------------------------- 1 | # vnc-viewer-swing 2 | 3 | This simple VNC viewer application makes use of SSHTools' RFB components. It serves as both an 4 | example for how to build you own VNC viewer based on our components, as well as a useful VNC 5 | viewer in it's own right. 6 | 7 | This version uses the 'Swing' Java GUI toolkit, and is recommended for use with Java 7 and above. 8 | 9 | ## Standalone application and Example 10 | By default the application is built as a simple executable JAR. 11 | 12 | ``` 13 | java -jar vnc-viewer-swing.jar [] [:] 14 | ``` 15 | 16 | If you omit either the hostname (e.g :1), or the port / display (e.g. myhost), then the defaul 17 | hostname and / or port of locahost:5900 wwill be used. 18 | 19 | By using --help, the following will be displayed detailing all possible options. 20 | 21 | ``` 22 | usage: VNCViewer [-?] [-C] [-e ] [-f ] [-l ] [-p ] 23 | A pure Java VNC viewerr 24 | -?,--help Display help 25 | -C,--nocopyrect Do not use the CopyRect driver for window 26 | movement (if supported) 27 | -e,--encodings Comma separated list of enabled encoding 28 | -f,--passwordfile A file containing the password that clients 29 | must authenticate with. 30 | -l,--log Log level 31 | -p,--password The password that clients must authenticate 32 | with. 33 | 34 | Provided by SSHTOOLS Limited. 35 | 36 | ``` 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/RFBAuthenticationException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | /* HEADER */ 19 | package com.sshtools.rfb; 20 | 21 | /** 22 | * Exception thrown if the authentication with a host fails for some reason 23 | * during connection. 24 | */ 25 | public class RFBAuthenticationException extends Exception { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | public RFBAuthenticationException() { 30 | super(); 31 | } 32 | 33 | public RFBAuthenticationException(String message, Throwable cause) { 34 | super(message, cause); 35 | } 36 | 37 | public RFBAuthenticationException(Throwable cause) { 38 | super(cause); 39 | } 40 | 41 | public RFBAuthenticationException(String message) { 42 | super(message); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /rfb-server-windows/build.bat: -------------------------------------------------------------------------------- 1 | @REM 2 | @REM RFB Server (Windows Driver) - A JNA based driver for Windows, 3 | @REM Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | @REM 5 | @REM This program is free software: you can redistribute it and/or modify 6 | @REM it under the terms of the GNU General Public License as published by 7 | @REM the Free Software Foundation, either version 3 of the License, or 8 | @REM (at your option) any later version. 9 | @REM 10 | @REM This program is distributed in the hope that it will be useful, 11 | @REM but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | @REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | @REM GNU General Public License for more details. 14 | @REM 15 | @REM You should have received a copy of the GNU General Public License 16 | @REM along with this program. If not, see . 17 | @REM 18 | 19 | 20 | 21 | g++ -c -DBUILDING_DISPLAYHOOK_DLL -I "C:\Program Files\Java\jdk1.7.0_67\include" -I "C:\Program Files\Java\jdk1.7.0_67\include\win32" src\main\native\displayhook.cpp -o target\displayhook.o 22 | g++ -shared --enable-runtime-pseudo-reloc -o target\displayhook.dll target\displayhook.o -Wl,--kill-at -Wl,--out-implib,target\libdisplayhook.dll.a 23 | 24 | REM g++ -shared --enable-runtime-pseudo-reloc -o displayhook.dll displayhook.o -Wl,--out-implib,libdisplayhook.dll.a 25 | REM g++ -D_JNI_IMPLEMENTATION_ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -shared -mthreads -Wl,--out-implib,target\libdisplayhook.a -o target\displayhook.dll target\displayhook.o -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/RFBSocketTransport.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | /* HEADER */ 19 | package com.sshtools.rfb; 20 | 21 | import java.io.IOException; 22 | 23 | /** 24 | * A simple Socket RFBTransport for insecure 25 | * links. 26 | * 27 | * @author Lee David Painter 28 | */ 29 | public class RFBSocketTransport extends java.net.Socket implements RFBTransport { 30 | /** 31 | * Connect the socket. 32 | * 33 | * @param hostname hostname 34 | * @param port port 35 | * @throws IOException on error 36 | */ 37 | public RFBSocketTransport(String hostname, int port) throws IOException { 38 | super(hostname, port); 39 | } 40 | 41 | @Override 42 | public String getHostname() { 43 | return getInetAddress().getHostName(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/RFBEncodingData.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver; 21 | 22 | /** 23 | * Drivers may attach this to damage and window events, and it will be passed on 24 | * to the protocol encoders. They may use this to get contextual information 25 | * from the driver (if any). This was first introduced to support the CopyRect 26 | * driver. 27 | */ 28 | public interface RFBEncodingData { 29 | 30 | } 31 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/transport/RFBServerTransport.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.transport; 21 | 22 | import java.io.IOException; 23 | import java.io.InputStream; 24 | import java.io.OutputStream; 25 | 26 | public interface RFBServerTransport { 27 | InputStream getInputStream() throws IOException; 28 | 29 | OutputStream getOutputStream() throws IOException; 30 | 31 | void stop(); 32 | 33 | boolean isDisconnect(IOException e); 34 | } 35 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/FixedRFBServerConfiguration.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver; 21 | 22 | 23 | public class FixedRFBServerConfiguration implements RFBServerConfiguration { 24 | 25 | public int getPort() { 26 | return 6900; 27 | } 28 | 29 | public String getAddress() { 30 | return "0.0.0.0"; 31 | } 32 | 33 | public int getListenBacklog() { 34 | return 1; 35 | } 36 | 37 | public String getDesktopName() { 38 | return "JavaRFB"; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/RFBFS.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb; 19 | 20 | import java.io.IOException; 21 | import java.io.InputStream; 22 | import java.io.OutputStream; 23 | 24 | import com.sshtools.rfbcommon.RFBFile; 25 | 26 | public interface RFBFS { 27 | 28 | boolean isActive(); 29 | 30 | boolean mkdir(String filename) throws IOException; 31 | 32 | RFBFile[] list(String filename) throws IOException; 33 | 34 | boolean rm(String processPath) throws IOException; 35 | 36 | RFBFile stat(String filename) throws IOException; 37 | 38 | boolean handleReply(int type) throws IOException; 39 | 40 | void mv(String oldName, String newName) throws IOException; 41 | 42 | OutputStream send(String path, boolean overwrite, long offset) throws IOException; 43 | 44 | InputStream receive(String processPath, long filePointer) throws IOException; 45 | } 46 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/Beep.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver; 21 | 22 | import java.io.IOException; 23 | 24 | import com.sshtools.rfbcommon.ProtocolWriter; 25 | import com.sshtools.rfbcommon.RFBConstants; 26 | import com.sshtools.rfbserver.protocol.Reply; 27 | 28 | public class Beep extends Reply { 29 | 30 | public Beep() { 31 | super(RFBConstants.SMSG_BELL); 32 | } 33 | 34 | @Override 35 | public void write(ProtocolWriter dout) throws IOException { 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/authentication/None.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings.authentication; 21 | 22 | import com.sshtools.rfbcommon.RFBConstants; 23 | import com.sshtools.rfbserver.RFBClient; 24 | 25 | public class None extends AbstractAuth { 26 | public None() { 27 | super(RFBConstants.CAP_AUTH_NONE); 28 | } 29 | 30 | public boolean process(RFBClient rfbClient) throws AuthenticationException { 31 | return true; 32 | } 33 | 34 | public void postAuthentication(RFBClient rfbClient) { 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/LastRectEncoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import java.io.IOException; 21 | 22 | import com.sshtools.rfb.RFBDisplay; 23 | import com.sshtools.rfb.RFBEncoding; 24 | import com.sshtools.rfbcommon.RFBConstants; 25 | 26 | public class LastRectEncoding implements RFBEncoding { 27 | public LastRectEncoding() { 28 | } 29 | 30 | @Override 31 | public int getType() { 32 | return RFBConstants.ENC_LAST_RECT; 33 | } 34 | 35 | @Override 36 | public boolean isPseudoEncoding() { 37 | return true; 38 | } 39 | 40 | @Override 41 | public void processEncodedRect(RFBDisplay display, int x, int y, int width, int height, int encodingType) 42 | throws IOException { 43 | display.getDisplayModel().drawRectangle(x, y, width, height, null); 44 | } 45 | 46 | @Override 47 | public String getName() { 48 | return "Last Rectangle"; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/CursorPositionEncoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import java.io.IOException; 21 | 22 | import com.sshtools.rfb.RFBDisplay; 23 | import com.sshtools.rfb.RFBEncoding; 24 | import com.sshtools.rfbcommon.RFBConstants; 25 | 26 | public class CursorPositionEncoding implements RFBEncoding { 27 | public CursorPositionEncoding() { 28 | } 29 | 30 | @Override 31 | public int getType() { 32 | return RFBConstants.ENC_POINTER_POS; 33 | } 34 | 35 | @Override 36 | public boolean isPseudoEncoding() { 37 | return true; 38 | } 39 | 40 | @Override 41 | public void processEncodedRect(RFBDisplay display, int x, int y, int width, int height, int encodingType) 42 | throws IOException { 43 | display.getDisplayModel().softCursorMove(x, y); 44 | } 45 | 46 | @Override 47 | public String getName() { 48 | return "Cursor Position"; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/RFBClientContext.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver; 21 | 22 | import java.util.Collection; 23 | 24 | import com.sshtools.rfbcommon.RFBVersion; 25 | import com.sshtools.rfbserver.files.RFBServerFS; 26 | 27 | public interface RFBClientContext { 28 | 29 | RFBServerConfiguration getConfiguration(); 30 | 31 | RFBVersion getVersion(); 32 | 33 | Collection getSecurityHandlers(); 34 | 35 | RFBServerFS getServerFileSystem(); 36 | 37 | RFBAuthenticator getSecurityHandler(int selectedAuthentication); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/EndContinuousUpdates.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver; 21 | 22 | import java.io.IOException; 23 | 24 | import com.sshtools.rfbcommon.ProtocolWriter; 25 | import com.sshtools.rfbcommon.RFBConstants; 26 | import com.sshtools.rfbserver.protocol.Reply; 27 | 28 | public class EndContinuousUpdates extends Reply { 29 | 30 | public EndContinuousUpdates() { 31 | super(RFBConstants.SMSG_END_CONTINUOUS_UPDATES); 32 | } 33 | 34 | @Override 35 | public void write(ProtocolWriter dout) throws IOException { 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/CompressLevel0Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import java.io.IOException; 21 | 22 | import com.sshtools.rfb.RFBDisplay; 23 | import com.sshtools.rfb.RFBEncoding; 24 | import com.sshtools.rfbcommon.RFBConstants; 25 | 26 | public class CompressLevel0Encoding implements RFBEncoding { 27 | public CompressLevel0Encoding() { 28 | } 29 | 30 | @Override 31 | public int getType() { 32 | return RFBConstants.ENC_COMPRESS_LEVEL0; 33 | } 34 | 35 | @Override 36 | public boolean isPseudoEncoding() { 37 | return true; 38 | } 39 | 40 | @Override 41 | public void processEncodedRect(RFBDisplay display, int x, int y, int width, int height, int encodingType) 42 | throws IOException { 43 | throw new UnsupportedOperationException(); 44 | } 45 | 46 | @Override 47 | public String getName() { 48 | return "Compress Level " + ( getType() - RFBConstants.ENC_COMPRESS_LEVEL0 ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/JPEGQuality0Encoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import java.io.IOException; 21 | 22 | import com.sshtools.rfb.RFBDisplay; 23 | import com.sshtools.rfb.RFBEncoding; 24 | import com.sshtools.rfbcommon.RFBConstants; 25 | 26 | public class JPEGQuality0Encoding implements RFBEncoding { 27 | public JPEGQuality0Encoding() { 28 | } 29 | 30 | @Override 31 | public int getType() { 32 | return RFBConstants.ENC_JPEG_QUALITY_LEVEL0; 33 | } 34 | 35 | @Override 36 | public boolean isPseudoEncoding() { 37 | return true; 38 | } 39 | 40 | @Override 41 | public void processEncodedRect(RFBDisplay display, int x, int y, int width, int height, int encodingType) 42 | throws IOException { 43 | throw new UnsupportedOperationException(); 44 | } 45 | 46 | @Override 47 | public String getName() { 48 | return "JPEG Quality " + ( getType() - RFBConstants.ENC_JPEG_QUALITY_LEVEL0 ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /rfb-server-windows/src/main/native/com_sshtools_rfbserver_windows_jni_HookTest.h: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server (Windows Driver) - A JNA based driver for Windows, 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | /* DO NOT EDIT THIS FILE - it is machine generated */ 19 | #include 20 | /* Header for class com_sshtools_rfbserver_windows_jni_HookTest */ 21 | 22 | #ifndef _Included_com_sshtools_rfbserver_windows_jni_HookTest 23 | #define _Included_com_sshtools_rfbserver_windows_jni_HookTest 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | /* 28 | * Class: com_sshtools_rfbserver_windows_jni_HookTest 29 | * Method: registerHook 30 | * Signature: ()V 31 | */ 32 | JNIEXPORT void JNICALL Java_com_sshtools_rfbserver_windows_jni_HookTest_registerHook 33 | (JNIEnv *, jobject); 34 | 35 | /* 36 | * Class: com_sshtools_rfbserver_windows_jni_HookTest 37 | * Method: unRegisterHook 38 | * Signature: ()V 39 | */ 40 | JNIEXPORT void JNICALL Java_com_sshtools_rfbserver_windows_jni_HookTest_unRegisterHook 41 | (JNIEnv *, jobject); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | #endif 47 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/auth/None.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.auth; 19 | 20 | import java.io.IOException; 21 | import java.util.List; 22 | 23 | import com.sshtools.rfb.ProtocolEngine; 24 | import com.sshtools.rfb.RFBAuthenticationException; 25 | import com.sshtools.rfb.SecurityType; 26 | import com.sshtools.rfbcommon.RFBConstants; 27 | 28 | public class None implements SecurityType { 29 | 30 | @Override 31 | public int process(ProtocolEngine engine) throws RFBAuthenticationException, 32 | IOException { 33 | return 1; 34 | } 35 | 36 | @Override 37 | public int getType() { 38 | return RFBConstants.SCHEME_NO_AUTHENTICATION; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return "None"; 44 | } 45 | 46 | @Override 47 | public void postServerInitialisation(ProtocolEngine engine) 48 | throws IOException { 49 | } 50 | 51 | @Override 52 | public List getSubAuthTypes() { 53 | return null; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /rfb-common/src/main/java/com/sshtools/rfbcommon/ScreenDimension.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Common - Remote Frame Buffer common code used both in client and server. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfbcommon; 19 | 20 | public class ScreenDimension { 21 | private int width; 22 | private int height; 23 | 24 | public ScreenDimension(ScreenDimension other) { 25 | this(other.width, other.height); 26 | 27 | } 28 | 29 | public ScreenDimension(int width, int height) { 30 | super(); 31 | this.width = width; 32 | this.height = height; 33 | } 34 | 35 | public int getWidth() { 36 | return width; 37 | } 38 | 39 | public int getHeight() { 40 | return height; 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return "ScreenDimension [width=" + width + ", height=" + height + "]"; 46 | } 47 | 48 | public void reset() { 49 | width = 0; 50 | height = 0; 51 | } 52 | 53 | public boolean isEmpty() { 54 | return width == 0 || height == 0; 55 | } 56 | 57 | public void set(ScreenDimension dimension) { 58 | this.width = dimension.width; 59 | this.height = dimension.height; 60 | } 61 | } -------------------------------------------------------------------------------- /rfb-server-windows/src/main/native/com_sshtools_rfbserver_windows_jni_DisplayHook.h: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server (Windows Driver) - A JNA based driver for Windows, 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | /* DO NOT EDIT THIS FILE - it is machine generated */ 19 | #include 20 | /* Header for class com_sshtools_rfbserver_windows_jni_DisplayHook */ 21 | 22 | #ifndef _Included_com_sshtools_rfbserver_windows_jni_DisplayHook 23 | #define _Included_com_sshtools_rfbserver_windows_jni_DisplayHook 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | /* 28 | * Class: com_sshtools_rfbserver_windows_jni_DisplayHook 29 | * Method: register 30 | * Signature: (Lcom/sshtools/rfbserver/windows/jni/DisplayCallback;)Z 31 | */ 32 | JNIEXPORT jboolean JNICALL Java_com_sshtools_rfbserver_windows_jni_DisplayHook_register 33 | (JNIEnv *, jobject, jobject); 34 | 35 | /* 36 | * Class: com_sshtools_rfbserver_windows_jni_DisplayHook 37 | * Method: loop 38 | * Signature: ()V 39 | */ 40 | JNIEXPORT void JNICALL Java_com_sshtools_rfbserver_windows_jni_DisplayHook_loop 41 | (JNIEnv *, jobject); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | #endif 47 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/protocol/ClientCutTextProtocolExtension.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.protocol; 21 | 22 | import java.io.IOException; 23 | 24 | import com.sshtools.rfbcommon.ProtocolReader; 25 | import com.sshtools.rfbserver.RFBClient; 26 | 27 | public class ClientCutTextProtocolExtension implements ProtocolExtension { 28 | 29 | public boolean handle(int msg, RFBClient rfbClient) throws IOException { 30 | ProtocolReader din = rfbClient.getInput(); 31 | din.read(); 32 | din.read(); 33 | din.read(); 34 | rfbClient.getDisplayDriver().setClipboardText(din.readASCII()); 35 | return true; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /rfb-common/src/main/java/com/sshtools/rfbcommon/TightUtil.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Common - Remote Frame Buffer common code used both in client and server. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfbcommon; 19 | 20 | import java.io.DataOutput; 21 | import java.io.IOException; 22 | 23 | public class TightUtil { 24 | public static int getTightPixSize(PixelFormat rfbModel) { 25 | return (rfbModel.getColorDepth() == 24 && rfbModel.getBitsPerPixel() == 32) ? 3 : rfbModel.getBytesPerPixel(); 26 | } 27 | 28 | public static boolean isTightNative(PixelFormat rfbModel) { 29 | return rfbModel.getBytesPerPixel() == 4 && getTightPixSize(rfbModel) == 3 && rfbModel.getRedMax() == 0xff 30 | && rfbModel.getGreenMax() == 0xff && rfbModel.getBlueMax() == 0xff; 31 | } 32 | 33 | public static void writeTightColor(int pixel, PixelFormat rfbModel, DataOutput dout) throws IOException { 34 | if (isTightNative(rfbModel)) { 35 | dout.writeByte(pixel >> 16 & 0xff); 36 | dout.writeByte(pixel >> 8 & 0xff); 37 | dout.writeByte(pixel & 0xff); 38 | } else { 39 | dout.write(ImageUtil.translateAndEncodePixel(rfbModel, pixel)); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/TightPNGEncoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import java.io.IOException; 21 | 22 | import org.slf4j.Logger; 23 | import org.slf4j.LoggerFactory; 24 | 25 | import com.sshtools.rfb.ProtocolEngine; 26 | import com.sshtools.rfbcommon.RFBConstants; 27 | 28 | public class TightPNGEncoding extends TightEncoding { 29 | final static Logger LOG = LoggerFactory.getLogger(ProtocolEngine.class); 30 | 31 | public TightPNGEncoding() { 32 | } 33 | 34 | @Override 35 | public int getType() { 36 | return RFBConstants.ENC_TIGHT_PNG; 37 | } 38 | 39 | @Override 40 | public String getName() { 41 | return "Tight PNG"; 42 | } 43 | 44 | @Override 45 | public boolean isPseudoEncoding() { 46 | return false; 47 | } 48 | 49 | protected void doTight(int x, int y, int width, int height, int op) throws IOException { 50 | int type = op >> 4 & 0x0F; 51 | if (type == OP_PNG) { 52 | doGenericImage(x, y); 53 | } else { 54 | super.doTight(x, type, width, height, op); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/protocol/KeyboardEventProtocolExtension.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.protocol; 21 | 22 | import java.io.IOException; 23 | 24 | import com.sshtools.rfbcommon.ProtocolReader; 25 | import com.sshtools.rfbserver.RFBClient; 26 | 27 | public class KeyboardEventProtocolExtension implements ProtocolExtension { 28 | 29 | public boolean handle(int msg, RFBClient rfbClient) throws IOException { 30 | ProtocolReader din = rfbClient.getInput(); 31 | boolean down = din.read() > 0; 32 | din.readUnsignedShort(); // padding 33 | rfbClient.getDisplayDriver().keyEvent(rfbClient, down, din.readInt()); 34 | return true; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/RFBServerEncoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | import java.io.IOException; 23 | 24 | import com.sshtools.rfbcommon.PixelFormat; 25 | import com.sshtools.rfbcommon.ProtocolWriter; 26 | import com.sshtools.rfbcommon.TightCapability; 27 | import com.sshtools.rfbserver.RFBClient; 28 | import com.sshtools.rfbserver.UpdateRectangle; 29 | 30 | public interface RFBServerEncoding { 31 | void selected(RFBClient client); 32 | 33 | int getCode(); 34 | 35 | TightCapability getType(); 36 | 37 | boolean isPseudoEncoding(); 38 | 39 | void encode(UpdateRectangle update, ProtocolWriter dout, PixelFormat pixelFormat, RFBClient client) throws IOException; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/ServerCut.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver; 21 | 22 | import java.io.IOException; 23 | 24 | import com.sshtools.rfbcommon.ProtocolWriter; 25 | import com.sshtools.rfbcommon.RFBConstants; 26 | import com.sshtools.rfbserver.protocol.Reply; 27 | 28 | public class ServerCut extends Reply { 29 | 30 | private String text; 31 | 32 | public ServerCut(String text) { 33 | super(RFBConstants.SMSG_SERVER_CUT_TEXT); 34 | this.text = text; 35 | } 36 | 37 | @Override 38 | public void write(ProtocolWriter dout) throws IOException { 39 | dout.write(new byte[3]); 40 | dout.writeUInt32(text.length()); 41 | dout.write(text.getBytes()); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/protocol/PointerEventProtocolExtension.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.protocol; 21 | 22 | import java.io.IOException; 23 | 24 | import com.sshtools.rfbcommon.ProtocolReader; 25 | import com.sshtools.rfbserver.RFBClient; 26 | 27 | public class PointerEventProtocolExtension implements ProtocolExtension { 28 | 29 | public boolean handle(int msg, RFBClient rfbClient) throws IOException { 30 | ProtocolReader din = rfbClient.getInput(); 31 | int buttonMask = din.read(); 32 | int x = din.readUnsignedShort(); 33 | int y = din.readUnsignedShort(); 34 | rfbClient.getDisplayDriver().mouseEvent(rfbClient, buttonMask, x, y); 35 | return false; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/files/RFBServerFS.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.files; 21 | 22 | import java.io.IOException; 23 | import java.io.InputStream; 24 | import java.io.OutputStream; 25 | 26 | import com.sshtools.rfbcommon.RFBFile; 27 | 28 | public interface RFBServerFS { 29 | RFBFile[] getRoots() throws IOException; 30 | RFBFile[] list(String path) throws IOException; 31 | boolean mkdir(String filename) throws IOException; 32 | void rm(String path) throws IOException; 33 | void mv(String oldPath, String newPath) throws IOException; 34 | OutputStream receive(String path, boolean overwrite, long offset) throws IOException; 35 | InputStream retrieve(String path, long offset) throws IOException; 36 | RFBFile get(String sendingPath) throws IOException; 37 | } 38 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/CopyRectEncoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import java.io.IOException; 21 | 22 | import com.sshtools.rfb.RFBDisplay; 23 | import com.sshtools.rfb.RFBEncoding; 24 | import com.sshtools.rfbcommon.RFBConstants; 25 | 26 | public class CopyRectEncoding implements RFBEncoding { 27 | public CopyRectEncoding() { 28 | } 29 | 30 | @Override 31 | public boolean isPseudoEncoding() { 32 | return false; 33 | } 34 | 35 | @Override 36 | public int getType() { 37 | return RFBConstants.ENC_COPYRECT; 38 | } 39 | 40 | @Override 41 | public void processEncodedRect(RFBDisplay display, int x, int y, int width, int height, int encodingType) 42 | throws IOException { 43 | int posx = display.getEngine().getInputStream().readUnsignedShort(); 44 | int posy = display.getEngine().getInputStream().readUnsignedShort(); 45 | display.getDisplayModel().getGraphicBuffer().copyArea(posx, posy, width, height, x - posx, y - posy); 46 | display.requestRepaint(display.getContext().getScreenUpdateTimeout(), x, y, width, height); 47 | } 48 | 49 | @Override 50 | public String getName() { 51 | return "CopyRect"; 52 | } 53 | } -------------------------------------------------------------------------------- /rfb-recorder/src/main/java/com/sshtools/rfbrecorder/RecordingOutputStream.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Recorder - Remote Frame Buffer Recorder. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfbrecorder; 19 | 20 | import java.io.DataOutputStream; 21 | import java.io.FilterOutputStream; 22 | import java.io.IOException; 23 | import java.io.OutputStream; 24 | 25 | public class RecordingOutputStream extends FilterOutputStream { 26 | private OutputStream out; 27 | private DataOutputStream rec; 28 | 29 | public RecordingOutputStream(OutputStream out, DataOutputStream rec) { 30 | super(out); 31 | this.out = out; 32 | this.rec = rec; 33 | } 34 | 35 | @Override 36 | public void write(byte[] b) throws IOException { 37 | out.write(b); 38 | writeBlock(b, 0, b.length); 39 | } 40 | 41 | @Override 42 | public void write(byte[] b, int off, int len) throws IOException { 43 | out.write(b, off, len); 44 | writeBlock(b, off, len); 45 | } 46 | 47 | @Override 48 | public void write(int b) throws IOException { 49 | out.write(b); 50 | writeBlock(new byte[] { (byte)b }, 0, 1); 51 | } 52 | 53 | private void writeBlock(byte[] b, int off, int len) throws IOException { 54 | rec.writeBoolean(false); 55 | rec.writeLong(System.currentTimeMillis()); 56 | rec.writeInt(len); 57 | rec.write(b, off, len); 58 | } 59 | } -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/protocol/EnableContinuousUpdatesProtocolExtension.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.protocol; 21 | 22 | import java.awt.Rectangle; 23 | import java.io.IOException; 24 | 25 | import com.sshtools.rfbcommon.ProtocolReader; 26 | import com.sshtools.rfbserver.RFBClient; 27 | 28 | public class EnableContinuousUpdatesProtocolExtension implements ProtocolExtension { 29 | public boolean handle(int msg, RFBClient rfbClient) throws IOException { 30 | ProtocolReader din = rfbClient.getInput(); 31 | boolean enable = din.read() > 0; 32 | int x = din.readUnsignedShort(); 33 | int y = din.readUnsignedShort(); 34 | int w = din.readUnsignedShort(); 35 | int h = din.readUnsignedShort(); 36 | rfbClient.setContinuousUpdates(enable); 37 | rfbClient.setRequestedArea(new Rectangle(x, y, w, h)); 38 | return false; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /rfb-common/src/main/java/com/sshtools/rfbcommon/ScreenDetail.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Common - Remote Frame Buffer common code used both in client and server. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfbcommon; 19 | 20 | public class ScreenDetail { 21 | private long id; 22 | private ScreenDimension dimension; 23 | private int x; 24 | private int y; 25 | private long flags; 26 | 27 | public ScreenDetail(long id, int x, int y, ScreenDimension dimension, long flags) { 28 | super(); 29 | this.id = id; 30 | this.dimension = dimension; 31 | this.x = x; 32 | this.y = y; 33 | this.flags = flags; 34 | } 35 | 36 | public ScreenDetail(ScreenDetail other) { 37 | this.id = other.id; 38 | this.dimension = new ScreenDimension(other.dimension); 39 | this.x = other.x; 40 | this.y = other.y; 41 | this.flags = other.flags; 42 | } 43 | 44 | public long getId() { 45 | return id; 46 | } 47 | 48 | public ScreenDimension getDimension() { 49 | return dimension; 50 | } 51 | 52 | public int getX() { 53 | return x; 54 | } 55 | 56 | public int getY() { 57 | return y; 58 | } 59 | 60 | public int getWidth() { 61 | return dimension.getWidth(); 62 | } 63 | 64 | public int getHeight() { 65 | return dimension.getHeight(); 66 | } 67 | 68 | public long getFlags() { 69 | return flags; 70 | } 71 | 72 | } -------------------------------------------------------------------------------- /rfb-server-windows/src/main/java/com/sshtools/rfbserver/windows/jni/FrameTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server (Windows Driver) - A JNA based driver for Windows, 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfbserver.windows.jni; 19 | 20 | // 21 | // FrameTest.java 22 | // 23 | import java.awt.*; 24 | import java.awt.event.*; 25 | import javax.swing.*; 26 | 27 | public class FrameTest extends JFrame { 28 | private JPanel mainPanel; 29 | private JTextArea mainTextArea; 30 | private HookTest hook; 31 | 32 | public static void main(String[] args) { 33 | SwingUtilities.invokeLater(new Runnable() { 34 | public void run() { 35 | new FrameTest().setVisible(true); 36 | } 37 | }); 38 | } 39 | 40 | FrameTest() { 41 | super("FrameTest"); 42 | setSize(200, 200); 43 | setDefaultCloseOperation(EXIT_ON_CLOSE); 44 | mainPanel = new JPanel(); 45 | mainPanel.setLayout(new BorderLayout()); 46 | mainTextArea = new JTextArea(); 47 | mainPanel.add(mainTextArea, BorderLayout.CENTER); 48 | getContentPane().add(mainPanel); 49 | addWindowListener(new WindowAdapter() { 50 | public void windowClosing(WindowEvent event) { 51 | hook.unRegisterHook(); 52 | } 53 | }); 54 | new Thread() { 55 | public void run() { 56 | hook = new HookTest(); 57 | hook.registerHook(); 58 | } 59 | }.start(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/RFBResizeEncoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import java.io.IOException; 21 | 22 | import com.sshtools.rfb.RFBDisplay; 23 | import com.sshtools.rfb.RFBEncoding; 24 | import com.sshtools.rfbcommon.RFBConstants; 25 | import com.sshtools.rfbcommon.ScreenData; 26 | import com.sshtools.rfbcommon.ScreenDetail; 27 | import com.sshtools.rfbcommon.ScreenDimension; 28 | 29 | public class RFBResizeEncoding implements RFBEncoding { 30 | public RFBResizeEncoding() { 31 | } 32 | 33 | @Override 34 | public int getType() { 35 | return RFBConstants.ENC_NEW_FB_SIZE; 36 | } 37 | 38 | @Override 39 | public boolean isPseudoEncoding() { 40 | return true; 41 | } 42 | 43 | @Override 44 | public void processEncodedRect(RFBDisplay display, int x, int y, int width, int height, int encodingType) 45 | throws IOException { 46 | ScreenDimension dim = new ScreenDimension(width, height); 47 | ScreenData sd = new ScreenData(dim); 48 | sd.getDetails().add(new ScreenDetail(0, 0, 0, dim, 0)); 49 | display.getDisplayModel().changeFramebufferSize(ExtendedDesktopSizeEncoding.SERVER_SIDE_CHANGE, sd); 50 | } 51 | 52 | @Override 53 | public String getName() { 54 | return "Resize"; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/authentication/AbstractAuth.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings.authentication; 21 | 22 | import java.util.List; 23 | 24 | import com.sshtools.rfbcommon.TightCapability; 25 | import com.sshtools.rfbserver.RFBAuthenticator; 26 | 27 | public abstract class AbstractAuth implements RFBAuthenticator { 28 | private TightCapability cap; 29 | private int code; 30 | 31 | protected AbstractAuth(TightCapability cap) { 32 | this.cap = cap; 33 | this.code = cap.getCode(); 34 | } 35 | 36 | protected AbstractAuth(int code) { 37 | this.code = code; 38 | } 39 | 40 | @Override 41 | public final TightCapability getCapability() { 42 | return cap; 43 | } 44 | 45 | @Override 46 | public final int getSecurityType() { 47 | return code; 48 | } 49 | 50 | @Override 51 | public List getSubAuthTypes() { 52 | return null; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/files/uvnc/EndListDirectoryReply.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.files.uvnc; 21 | 22 | import java.io.IOException; 23 | 24 | import com.sshtools.rfbcommon.ProtocolWriter; 25 | import com.sshtools.rfbcommon.RFBConstants; 26 | 27 | public class EndListDirectoryReply extends FileTransfer { 28 | 29 | public EndListDirectoryReply(int size) { 30 | super(RFBConstants.RFB_DIR_DRIVE_LIST, RFBConstants.RFB_RECV_NONE); 31 | setData(size); 32 | } 33 | 34 | @Override 35 | protected void onWrite(ProtocolWriter dout) throws IOException { 36 | dout.writeUInt32(0); 37 | dout.writeInt(data); 38 | } 39 | 40 | // @Override 41 | // public EndListDirectoryReply copy() { 42 | // EndListDirectoryReply d = new EndListDirectoryReply(data); 43 | // populate(d); 44 | // return d; 45 | // } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/RREEncoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | import java.io.DataOutputStream; 23 | import java.io.IOException; 24 | 25 | import com.sshtools.rfbcommon.PixelFormat; 26 | import com.sshtools.rfbcommon.RFBConstants; 27 | import com.sshtools.rfbcommon.TightCapability; 28 | 29 | public class RREEncoding extends AbstractRREEncoding { 30 | 31 | public RREEncoding() { 32 | super(); 33 | } 34 | 35 | public TightCapability getType() { 36 | return RFBConstants.CAP_ENC_RRE; 37 | } 38 | 39 | public boolean isPseudoEncoding() { 40 | return false; 41 | } 42 | 43 | @Override 44 | protected void writeSubrect(DataOutputStream dout, PixelFormat pixelFormat, SubRect s) throws IOException { 45 | writePixel(dout, pixelFormat, s.pixel); 46 | dout.writeShort(s.x); 47 | dout.writeShort(s.y); 48 | dout.writeShort(s.w); 49 | dout.writeShort(s.h); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/RawEncoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import java.io.DataInputStream; 21 | import java.io.IOException; 22 | 23 | import com.sshtools.rfb.ProtocolEngine; 24 | import com.sshtools.rfb.RFBDisplay; 25 | import com.sshtools.rfb.RFBDisplayModel; 26 | 27 | public class RawEncoding extends AbstractRawEncoding { 28 | public RawEncoding() { 29 | } 30 | 31 | @Override 32 | public int getType() { 33 | return 0; 34 | } 35 | 36 | @Override 37 | public boolean isPseudoEncoding() { 38 | return false; 39 | } 40 | 41 | @Override 42 | public void processEncodedRect(RFBDisplay display, int x, int y, int width, int height, int encodingType) 43 | throws IOException { 44 | ProtocolEngine engine = display.getEngine(); 45 | RFBDisplayModel model = display.getDisplayModel(); 46 | DataInputStream in = engine.getInputStream(); 47 | int bpp = model.getBitsPerPixel(); 48 | int bytes = (bpp / 8); 49 | byte[] buf = new byte[width * bytes * height]; 50 | in.readFully(buf); 51 | doProcessRaw(display, x, y, width, height, buf); 52 | display.requestRepaint(display.getContext().getScreenUpdateTimeout(), x, y, width, height); 53 | } 54 | 55 | @Override 56 | public String getName() { 57 | return "Raw"; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /rfb-recorder/src/main/java/com/sshtools/rfbrecorder/RecordingInputStream.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Recorder - Remote Frame Buffer Recorder. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfbrecorder; 19 | 20 | import java.io.DataOutputStream; 21 | import java.io.FilterInputStream; 22 | import java.io.IOException; 23 | import java.io.InputStream; 24 | 25 | public class RecordingInputStream extends FilterInputStream { 26 | 27 | private DataOutputStream rec; 28 | 29 | public RecordingInputStream(InputStream in, DataOutputStream rec) { 30 | super(in); 31 | this.rec = rec; 32 | } 33 | 34 | @Override 35 | public int read() throws IOException { 36 | int r = super.read(); 37 | if (r != -1) { 38 | writeBlock(new byte[] { (byte)r } , 0, 1); 39 | } 40 | return r; 41 | } 42 | 43 | @Override 44 | public int read(byte[] b) throws IOException { 45 | int r = super.read(b); 46 | if (r != -1) { 47 | writeBlock(b, 0, r); 48 | } 49 | return r; 50 | } 51 | 52 | @Override 53 | public int read(byte[] b, int off, int len) throws IOException { 54 | int r = super.read(b, off, len); 55 | if (r != -1) { 56 | writeBlock(b , off, r); 57 | } 58 | return r; 59 | } 60 | 61 | 62 | private void writeBlock(byte[] b, int off, int len) throws IOException { 63 | rec.writeBoolean(true); 64 | rec.writeLong(System.currentTimeMillis()); 65 | rec.writeInt(len); 66 | rec.write(b, off, len); 67 | } 68 | 69 | } -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/RawEncoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | import java.awt.image.BufferedImage; 23 | import java.io.IOException; 24 | 25 | import com.sshtools.rfbcommon.PixelFormat; 26 | import com.sshtools.rfbcommon.ProtocolWriter; 27 | import com.sshtools.rfbcommon.RFBConstants; 28 | import com.sshtools.rfbcommon.TightCapability; 29 | import com.sshtools.rfbserver.RFBClient; 30 | import com.sshtools.rfbserver.UpdateRectangle; 31 | 32 | public class RawEncoding extends AbstractRawEncoding { 33 | public RawEncoding() { 34 | } 35 | 36 | public TightCapability getType() { 37 | return RFBConstants.CAP_ENC_RAW; 38 | } 39 | 40 | public boolean isPseudoEncoding() { 41 | return false; 42 | } 43 | 44 | public void encode(UpdateRectangle update, ProtocolWriter dout, PixelFormat pixelFormat, RFBClient client) 45 | throws IOException { 46 | rawEncode(update, dout, pixelFormat); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/CORREEncoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | import java.io.DataOutputStream; 23 | import java.io.IOException; 24 | 25 | import com.sshtools.rfbcommon.PixelFormat; 26 | import com.sshtools.rfbcommon.RFBConstants; 27 | import com.sshtools.rfbcommon.TightCapability; 28 | 29 | public class CORREEncoding extends AbstractRREEncoding { 30 | 31 | public CORREEncoding() { 32 | super(); 33 | } 34 | 35 | public TightCapability getType() { 36 | return RFBConstants.CAP_ENC_CORRE; 37 | } 38 | 39 | public boolean isPseudoEncoding() { 40 | return false; 41 | } 42 | 43 | @Override 44 | protected void writeSubrect(DataOutputStream dout, PixelFormat pixelFormat, SubRect s) throws IOException { 45 | writePixel(dout, pixelFormat, s.pixel); 46 | dout.write(s.x); 47 | dout.write(s.y); 48 | dout.write(s.w); 49 | dout.write(s.h); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/RFBResizeEncoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | import java.io.IOException; 23 | 24 | import com.sshtools.rfbcommon.PixelFormat; 25 | import com.sshtools.rfbcommon.ProtocolWriter; 26 | import com.sshtools.rfbcommon.RFBConstants; 27 | import com.sshtools.rfbcommon.TightCapability; 28 | import com.sshtools.rfbserver.RFBClient; 29 | import com.sshtools.rfbserver.UpdateRectangle; 30 | 31 | public class RFBResizeEncoding extends AbstractEncoding { 32 | public RFBResizeEncoding() { 33 | } 34 | 35 | public TightCapability getType() { 36 | return RFBConstants.CAP_ENC_NEW_FB_SIZE; 37 | } 38 | 39 | public boolean isPseudoEncoding() { 40 | return true; 41 | } 42 | 43 | public void encode(UpdateRectangle update, ProtocolWriter dout, PixelFormat pixelFormat, RFBClient client) 44 | throws IOException { 45 | dout.writeUInt32(getType().getCode()); 46 | } 47 | 48 | public void selected(RFBClient client) { 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/files/uvnc/StartListDirectoryReply.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.files.uvnc; 21 | 22 | import java.io.IOException; 23 | 24 | import com.sshtools.rfbcommon.ProtocolWriter; 25 | import com.sshtools.rfbcommon.RFBConstants; 26 | 27 | public class StartListDirectoryReply extends FileTransfer { 28 | public StartListDirectoryReply(String path) { 29 | super(RFBConstants.RFB_DIR_DRIVE_LIST, RFBConstants.RFB_RECV_DIRECTORY); 30 | setData(path); 31 | } 32 | 33 | @Override 34 | protected void onWrite(ProtocolWriter dout) throws IOException { 35 | dout.writeUInt32(0); 36 | if (getData() == null || getData().length() == 0) { 37 | dout.writeUInt32(0); 38 | } else { 39 | byte[] buf = (getData() + "\0").getBytes(); 40 | dout.writeUInt32(buf.length); 41 | dout.write(buf); 42 | } 43 | } 44 | // @Override 45 | // public Reply copy() { 46 | // StartListDirectoryReply d = new StartListDirectoryReply(data); 47 | // populate(d); 48 | // return d; 49 | // } 50 | } 51 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/RFBDisplay.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | /* HEADER */ 19 | package com.sshtools.rfb; 20 | 21 | import com.sshtools.rfb.RFBToolkit.RFBCursor; 22 | 23 | public interface RFBDisplay { 24 | // Desktop scaling 25 | public final static int RESIZE_DESKTOP = -1; 26 | public final static int NO_SCALING = 0; 27 | public final static int NEAREST_NEIGHBOR = 1; 28 | public final static int BILINEAR = 2; 29 | public final static int BICUBIC = 3; 30 | // The protocol version 31 | public final static String VERSION_STRING = "3.8"; 32 | // Useful shortcuts for modifier masks. 33 | public final static int CTRL_MASK = 1 << 1; 34 | public final static int SHIFT_MASK = 1 << 0; 35 | public final static int META_MASK = 1 << 2; 36 | public final static int ALT_MASK = 1 << 3; 37 | public final static int COLOR_8BIT = 8; 38 | public final static int COLOR_32BIT = 32; 39 | 40 | ProtocolEngine getEngine(); 41 | 42 | void initialiseSession(RFBTransport transport, RFBContext context, RFBEventHandler prompt); 43 | 44 | C getDisplayComponent(); 45 | 46 | void requestRepaint(int tm, int x, int y, int w, int h); 47 | 48 | void setUpdateRect(RFBRectangle updateRect); 49 | 50 | void resizeComponent(); 51 | 52 | RFBDisplayModel getDisplayModel(); 53 | 54 | RFBContext getContext(); 55 | 56 | boolean handleKeyEvent(K evt); 57 | 58 | void setCursor(RFBCursor defaultCursor); 59 | 60 | int[] getDisplayComponentSize(); 61 | } 62 | -------------------------------------------------------------------------------- /rfb-common/pom.xml: -------------------------------------------------------------------------------- 1 | 20 | 21 | 4.0.0 22 | rfb-common 23 | RFB Common 24 | Remote Frame Buffer common code used both in client and server. 25 | 26 | com.sshtools 27 | rfb 28 | 3.0.1 29 | .. 30 | 31 | 32 | src/main/java 33 | src/test/java 34 | target/classes 35 | target/test-classes 36 | 37 | 38 | . 39 | src/main/resources 40 | 41 | 42 | 43 | 44 | . 45 | src/test/resources 46 | 47 | 48 | 49 | 50 | org.apache.maven.plugins 51 | maven-site-plugin 52 | 3.8.2 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/RFBTransport.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | /* HEADER */ 19 | package com.sshtools.rfb; 20 | 21 | import java.io.IOException; 22 | import java.io.InputStream; 23 | import java.io.OutputStream; 24 | 25 | /** 26 | * Defines the attributes of a transport for the RFB protocol. Essentially this 27 | * allows RFB to run over any type of transport that can provide an InputStream 28 | * and OutputStream. 29 | * 30 | * @author Lee David Painter 31 | */ 32 | public interface RFBTransport { 33 | 34 | /** 35 | * Get the hostname of the remote computer. This is for informational 36 | * purposes only. 37 | * 38 | * @return hostname 39 | */ 40 | String getHostname(); 41 | 42 | /** 43 | * The InputStream for reading RFB data. 44 | * 45 | * @return input stream of RFB data 46 | * @throws IOException on error 47 | */ 48 | InputStream getInputStream() throws IOException; 49 | 50 | /** 51 | * The OutputStream to write RFB data. 52 | * 53 | * @return output stream to write RFB data to 54 | * @throws IOException on error 55 | */ 56 | OutputStream getOutputStream() throws IOException; 57 | 58 | /** 59 | * Close the connection and terminate the RFB protocol. 60 | * 61 | * @throws IOException on error 62 | */ 63 | void close() throws IOException; 64 | 65 | /** 66 | * Get the port on which this transport is connector, or -1 if 67 | * not applicable. 68 | * 69 | * @return port 70 | */ 71 | int getPort(); 72 | 73 | } -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/protocol/SetDesktopSizeExtension.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.protocol; 21 | 22 | import java.io.IOException; 23 | 24 | import com.sshtools.rfbcommon.ProtocolReader; 25 | import com.sshtools.rfbcommon.ScreenData; 26 | import com.sshtools.rfbcommon.ScreenDetail; 27 | import com.sshtools.rfbcommon.ScreenDimension; 28 | import com.sshtools.rfbserver.RFBClient; 29 | 30 | public class SetDesktopSizeExtension implements ProtocolExtension { 31 | 32 | public boolean handle(int msg, RFBClient rfbClient) throws IOException { 33 | ProtocolReader din = rfbClient.getInput(); 34 | ScreenData screenData = new ScreenData(new ScreenDimension(din.readUnsignedShort(), din.readUnsignedShort())); 35 | int noScreens = din.readUnsignedByte(); 36 | din.read(); 37 | for (int i = 0; i < noScreens; i++) 38 | screenData.getDetails() 39 | .add(new ScreenDetail(din.readUInt32(), din.readUnsignedShort(), din.readUnsignedShort(), 40 | new ScreenDimension(din.readUnsignedShort(), din.readUnsignedShort()), din.readUInt32())); 41 | rfbClient.getDisplayDriver().resize(screenData); 42 | return true; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/transport/SocketRFBServerTransport.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.transport; 21 | 22 | import java.io.IOException; 23 | import java.io.InputStream; 24 | import java.io.OutputStream; 25 | import java.net.Socket; 26 | import java.net.SocketException; 27 | 28 | public class SocketRFBServerTransport implements RFBServerTransport { 29 | 30 | private Socket socket; 31 | 32 | public SocketRFBServerTransport(Socket socket) { 33 | this.socket = socket; 34 | } 35 | 36 | public InputStream getInputStream() throws IOException { 37 | return socket.getInputStream(); 38 | } 39 | 40 | public OutputStream getOutputStream() throws IOException { 41 | return socket.getOutputStream(); 42 | } 43 | 44 | public void stop() { 45 | try { 46 | socket.close(); 47 | } catch (IOException e) { 48 | } 49 | } 50 | 51 | public boolean isDisconnect(IOException e) { 52 | return getCause(e) instanceof SocketException; 53 | } 54 | 55 | private Throwable getCause(Throwable t) { 56 | Throwable cause = t.getCause(); 57 | if(cause != null) { 58 | return getCause(cause); 59 | } 60 | return t; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/ContinuousUpdatesEncoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | import java.io.IOException; 23 | 24 | import org.slf4j.Logger; 25 | import org.slf4j.LoggerFactory; 26 | 27 | import com.sshtools.rfbcommon.PixelFormat; 28 | import com.sshtools.rfbcommon.ProtocolWriter; 29 | import com.sshtools.rfbcommon.RFBConstants; 30 | import com.sshtools.rfbcommon.TightCapability; 31 | import com.sshtools.rfbserver.RFBClient; 32 | import com.sshtools.rfbserver.UpdateRectangle; 33 | 34 | public class ContinuousUpdatesEncoding extends AbstractEncoding { 35 | final static Logger LOG = LoggerFactory.getLogger(ContinuousUpdatesEncoding.class); 36 | 37 | public ContinuousUpdatesEncoding() { 38 | } 39 | 40 | public TightCapability getType() { 41 | return RFBConstants.CAP_ENC_CONTINUOUS_UPDATES; 42 | } 43 | 44 | public boolean isPseudoEncoding() { 45 | return true; 46 | } 47 | 48 | public void encode(UpdateRectangle update, ProtocolWriter dout, PixelFormat pixelFormat, RFBClient client) 49 | throws IOException { 50 | dout.writeUInt32(getType().getCode()); 51 | } 52 | 53 | public void selected(RFBClient client) { 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/transport/RFBServerTransportFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.transport; 21 | 22 | import java.io.IOException; 23 | 24 | import com.sshtools.rfbserver.RFBServerConfiguration; 25 | 26 | public interface RFBServerTransportFactory { 27 | /** 28 | * Get the next transport. This should block until a transport 29 | * is available. When there will be no more transports available, 30 | * null will be returned. 31 | * 32 | * @return transport 33 | * @throws IOException if transport cannot be obtained 34 | */ 35 | RFBServerTransport nextTransport() throws IOException; 36 | 37 | /** 38 | * Initialise the transport factory with the configuration required. 39 | * 40 | * @param configuration configuration 41 | */ 42 | void init(RFBServerConfiguration configuration); 43 | 44 | /** 45 | * Get if the transport factory is started. 46 | * 47 | * @return started 48 | */ 49 | boolean isStarted(); 50 | 51 | /** 52 | * Start accepting connections. 53 | * 54 | * @throws IOException if no connections can be accepted 55 | */ 56 | void start() throws IOException; 57 | 58 | /** 59 | * Stop accepting connections. 60 | */ 61 | void stop(); 62 | } 63 | -------------------------------------------------------------------------------- /rfb-common/src/main/java/com/sshtools/rfbcommon/ProtocolWriter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Common - Remote Frame Buffer common code used both in client and server. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfbcommon; 19 | 20 | import java.io.DataOutputStream; 21 | import java.io.IOException; 22 | import java.io.OutputStream; 23 | import java.io.UnsupportedEncodingException; 24 | 25 | public class ProtocolWriter extends DataOutputStream { 26 | public ProtocolWriter(OutputStream out) { 27 | super(out); 28 | } 29 | 30 | public void writeTerminatedString(String str) throws UnsupportedEncodingException, IOException { 31 | writeUTF8String(str + '\0'); 32 | } 33 | 34 | public void writeUTF8String(String message) throws UnsupportedEncodingException, IOException { 35 | byte[] buf = message == null ? null : message.getBytes("UTF-8"); 36 | writeInt(buf == null ? 0 : buf.length); 37 | write(buf); 38 | flush(); 39 | } 40 | 41 | public void writeCompactLen(int len) throws IOException { 42 | byte[] buf = new byte[3]; 43 | int bytes = 0; 44 | buf[bytes++] = (byte) (len & 0x7F); 45 | if (len > 0x7F) { 46 | buf[bytes - 1] |= 0x80; 47 | buf[bytes++] = (byte) (len >> 7 & 0x7F); 48 | if (len > 0x3FFF) { 49 | buf[bytes - 1] |= 0x80; 50 | buf[bytes++] = (byte) (len >> 14 & 0xFF); 51 | } 52 | } 53 | write(buf, 0, bytes); 54 | } 55 | 56 | public void writeString(String message) throws UnsupportedEncodingException, IOException { 57 | byte[] buf = message == null ? null : message.getBytes("ASCII"); 58 | writeInt(buf == null ? 0 : buf.length); 59 | write(buf); 60 | flush(); 61 | } 62 | 63 | public void writeUInt32(long uint32) throws IOException { 64 | writeInt((int) uint32); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /rfb-common/src/main/java/com/sshtools/rfbcommon/ScreenData.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Common - Remote Frame Buffer common code used both in client and server. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfbcommon; 19 | 20 | import java.util.ArrayList; 21 | import java.util.Arrays; 22 | import java.util.Collections; 23 | import java.util.List; 24 | 25 | public class ScreenData { 26 | private ScreenDimension dimension; 27 | private List details = new ArrayList<>(); 28 | 29 | public ScreenData(ScreenData other) { 30 | this(); 31 | set(other); 32 | } 33 | 34 | public ScreenData() { 35 | this(new ScreenDimension(0, 0)); 36 | } 37 | 38 | public ScreenData(ScreenDimension dimension) { 39 | super(); 40 | this.dimension = dimension; 41 | } 42 | 43 | public ScreenDimension getDimension() { 44 | return dimension; 45 | } 46 | 47 | public List getDetails() { 48 | return details; 49 | } 50 | 51 | public synchronized List getAllDetails() { 52 | if(details.isEmpty()) 53 | return Arrays.asList(new ScreenDetail(0, 0, 0, dimension, 0)); 54 | else 55 | return Collections.unmodifiableList(details); 56 | } 57 | 58 | public synchronized void reset() { 59 | this.dimension.reset(); 60 | details.clear(); 61 | } 62 | 63 | public int getWidth() { 64 | return dimension.getWidth(); 65 | } 66 | 67 | public int getHeight() { 68 | return dimension.getHeight(); 69 | } 70 | 71 | public boolean isEmpty() { 72 | return dimension.isEmpty(); 73 | } 74 | 75 | public synchronized void set(ScreenData screenData) { 76 | this.dimension.set(screenData.getDimension()); 77 | details.clear(); 78 | for(ScreenDetail d : screenData.getDetails()) { 79 | details.add(new ScreenDetail(d)); 80 | } 81 | } 82 | 83 | } -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/CursorPositionEncoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | import java.io.IOException; 23 | 24 | import org.slf4j.Logger; 25 | import org.slf4j.LoggerFactory; 26 | 27 | import com.sshtools.rfbcommon.PixelFormat; 28 | import com.sshtools.rfbcommon.ProtocolWriter; 29 | import com.sshtools.rfbcommon.RFBConstants; 30 | import com.sshtools.rfbcommon.TightCapability; 31 | import com.sshtools.rfbserver.RFBClient; 32 | import com.sshtools.rfbserver.UpdateRectangle; 33 | 34 | public class CursorPositionEncoding extends AbstractEncoding { 35 | final static Logger LOG = LoggerFactory.getLogger(CursorPositionEncoding.class); 36 | 37 | public CursorPositionEncoding() { 38 | } 39 | 40 | public TightCapability getType() { 41 | return RFBConstants.CAP_ENC_POINTER_POS; 42 | } 43 | 44 | public boolean isPseudoEncoding() { 45 | return true; 46 | } 47 | 48 | public void encode(UpdateRectangle update, ProtocolWriter dout, PixelFormat pixelFormat, RFBClient client) 49 | throws IOException { 50 | if (LOG.isDebugEnabled()) { 51 | LOG.debug("Send cursor position " + update.getArea().x + "," + update.getArea().y); 52 | } 53 | dout.writeUInt32(getType().getCode()); 54 | } 55 | 56 | public void selected(RFBClient client) { 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/files/uvnc/FileTransfer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.files.uvnc; 21 | 22 | import java.io.IOException; 23 | 24 | import com.sshtools.rfbcommon.ProtocolWriter; 25 | import com.sshtools.rfbcommon.RFBConstants; 26 | import com.sshtools.rfbserver.protocol.Reply; 27 | 28 | public abstract class FileTransfer extends Reply { 29 | 30 | protected int type; 31 | protected int contentParam; 32 | 33 | public FileTransfer(int type, int contentParam) { 34 | super(RFBConstants.SMSG_FILE_TRANSFER); 35 | this.type = type; 36 | this.contentParam = contentParam; 37 | } 38 | 39 | @Override 40 | public final void write(ProtocolWriter dout) throws IOException { 41 | dout.write(type); 42 | dout.write(contentParam & 0xff); 43 | dout.write(contentParam >> 8); 44 | onWrite(dout); 45 | } 46 | 47 | protected void populate(FileTransfer t) { 48 | t.type = type; 49 | t.contentParam = contentParam; 50 | super.populate(t); 51 | } 52 | 53 | @Override 54 | public String toString() { 55 | return "FileTransfer [type=" + type + ", contentParam=" + contentParam + ", data=" + data + ", code=" + code + "]"; 56 | } 57 | 58 | protected abstract void onWrite(ProtocolWriter dout) throws IOException; 59 | 60 | } -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/encodings/CopyRectEncoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.encodings; 21 | 22 | import java.awt.Point; 23 | import java.io.IOException; 24 | 25 | import org.slf4j.Logger; 26 | import org.slf4j.LoggerFactory; 27 | 28 | import com.sshtools.rfbcommon.PixelFormat; 29 | import com.sshtools.rfbcommon.ProtocolWriter; 30 | import com.sshtools.rfbcommon.RFBConstants; 31 | import com.sshtools.rfbcommon.TightCapability; 32 | import com.sshtools.rfbserver.RFBClient; 33 | import com.sshtools.rfbserver.UpdateRectangle; 34 | 35 | public class CopyRectEncoding extends AbstractEncoding { 36 | final static Logger LOG = LoggerFactory.getLogger(CopyRectEncoding.class); 37 | 38 | public CopyRectEncoding() { 39 | } 40 | 41 | public TightCapability getType() { 42 | return RFBConstants.CAP_ENC_COPYRECT; 43 | } 44 | 45 | public boolean isPseudoEncoding() { 46 | return false; 47 | } 48 | 49 | public void encode(UpdateRectangle update, ProtocolWriter dout, PixelFormat pixelFormat, RFBClient client) 50 | throws IOException { 51 | if(LOG.isDebugEnabled()) 52 | LOG.debug("CopyRect of " + update.getData() + " to " + update.getArea()); 53 | dout.writeUInt32(getType().getCode()); 54 | dout.writeShort(update.getData().x); 55 | dout.writeShort(update.getData().y); 56 | } 57 | 58 | @Override 59 | public void selected(RFBClient client) { 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/files/uvnc/ListDrivesReply.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.files.uvnc; 21 | 22 | import java.io.IOException; 23 | import java.util.ArrayList; 24 | import java.util.List; 25 | 26 | import com.sshtools.rfbcommon.ProtocolWriter; 27 | import com.sshtools.rfbcommon.RFBConstants; 28 | 29 | public class ListDrivesReply extends FileTransfer> { 30 | 31 | public ListDrivesReply() { 32 | super(RFBConstants.RFB_DIR_DRIVE_LIST, RFBConstants.RFB_RECV_DRIVE_LIST); 33 | } 34 | 35 | @Override 36 | protected void onWrite(ProtocolWriter dout) throws IOException { 37 | StringBuilder bui = new StringBuilder(); 38 | dout.writeUInt32(0); 39 | for(RFBDrive d : getData()) { 40 | bui.append(String.format("%-2s", d.getName())); 41 | bui.append(d.toCode()); 42 | bui.append('\0'); 43 | } 44 | byte[] bytes = bui.toString().getBytes("UTF-8"); 45 | dout.writeInt(bytes.length); 46 | dout.write(bytes); 47 | } 48 | 49 | // @Override 50 | // public Reply> copy() { 51 | // ListDrivesReply d = new ListDrivesReply(); 52 | // populate(d); 53 | // return d; 54 | // } 55 | 56 | protected void populate(ListDrivesReply r) { 57 | super.populate(r); 58 | r.data = new ArrayList(getData()); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /rfb-server/src/main/java/com/sshtools/rfbserver/protocol/Reply.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB Server - Remote Frame Buffer (VNC Server) implementation. This is the base module if you want to create a VNC server. It takes a layered driver approach to add native specific features (which is recommened as the cross-platform default "Robot" driver is very slow). 3 | * 4 | * See the vncserver module for a concrete server implementation that has some native performance improvements for some platforms. 5 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | package com.sshtools.rfbserver.protocol; 21 | 22 | import java.awt.Point; 23 | import java.awt.image.BufferedImage; 24 | import java.io.IOException; 25 | 26 | import com.sshtools.rfbcommon.ProtocolWriter; 27 | 28 | public abstract class Reply { 29 | 30 | protected T data; 31 | protected int code; 32 | 33 | protected Reply(int code) { 34 | this.code = code; 35 | } 36 | 37 | // public abstract Reply copy(); 38 | 39 | protected void populate(Reply t) { 40 | t.data = data; 41 | t.code = code; 42 | } 43 | 44 | public void setData(T data) { 45 | if (this.data != null && this.data instanceof Point && data != null && data instanceof BufferedImage) { 46 | try { 47 | throw new Exception(); 48 | } catch (Exception e) { 49 | System.err.println("POINT CHANGED TO IMG"); 50 | e.printStackTrace(); 51 | } 52 | } 53 | this.data = data; 54 | } 55 | 56 | public int getCode() { 57 | return code; 58 | } 59 | 60 | public T getData() { 61 | return data; 62 | } 63 | 64 | @Override 65 | public String toString() { 66 | return "Reply [data=" + data + ", code=" + code + "]"; 67 | } 68 | 69 | public abstract void write(ProtocolWriter dout) throws IOException; 70 | 71 | } -------------------------------------------------------------------------------- /rfb-viewer-common/src/main/java/com/sshtools/rfb/encoding/ContinuousUpdatesEncoding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * RFB - Remote Frame Buffer (VNC) implementation. 3 | * Copyright © 2006 SSHTOOLS Limited (support@sshtools.com) 4 | * 5 | * This program 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 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program 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 program. If not, see . 17 | */ 18 | package com.sshtools.rfb.encoding; 19 | 20 | import java.io.IOException; 21 | 22 | import org.slf4j.Logger; 23 | import org.slf4j.LoggerFactory; 24 | 25 | import com.sshtools.rfb.RFBDisplay; 26 | import com.sshtools.rfb.RFBEncoding; 27 | import com.sshtools.rfbcommon.RFBConstants; 28 | 29 | public class ContinuousUpdatesEncoding implements RFBEncoding { 30 | final static Logger LOG = LoggerFactory.getLogger(ContinuousUpdatesEncoding.class); 31 | 32 | public ContinuousUpdatesEncoding() { 33 | } 34 | 35 | @Override 36 | public int getType() { 37 | return RFBConstants.ENC_CONTINUOUS_UPDATES; 38 | } 39 | 40 | @Override 41 | public boolean isPseudoEncoding() { 42 | return true; 43 | } 44 | 45 | @Override 46 | public void processEncodedRect(RFBDisplay display, int x, int y, int width, int height, int encodingType) 47 | throws IOException { 48 | /* 49 | * If we get this message at all then continuous updates are supported 50 | */ 51 | if (!display.getEngine().isContinuousUpdatesSupported()) { 52 | display.getEngine().setContinuousUpdatesSupported(true); 53 | if (display.getContext().isContinuousUpdates()) { 54 | LOG.info("Continuous updates are supported and enabled"); 55 | display.getEngine().enableContinuousUpdates(); 56 | } else { 57 | LOG.info("Continuous updates are supported by server, but this client is not configured to use them."); 58 | } 59 | } else { 60 | if (display.getContext().isContinuousUpdates()) { 61 | LOG.info("Turning off continuous updates"); 62 | display.getContext().setContinuousUpdates(false); 63 | } 64 | } 65 | } 66 | 67 | @Override 68 | public String getName() { 69 | return "Continuous Updates"; 70 | } 71 | } 72 | --------------------------------------------------------------------------------